@Override public void exportDataSources() throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException { for ( ServiceReference<DataSource> dataSource : dataSources ) { ModuleDescriptor module = spi.moduleOf( dataSource ); EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() ); List<MBeanAttributeInfo> attributes = new ArrayList<>(); Map<String, AccessibleObject> properties = new LinkedHashMap<>(); descriptor.state().properties().forEach(persistentProperty -> { if ( !persistentProperty.isImmutable() ) { String propertyName = persistentProperty.qualifiedName().name(); String type = persistentProperty.valueType().primaryType().getName(); attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) ); properties.put( propertyName, persistentProperty.accessor() ); } } ); List<MBeanOperationInfo> operations = new ArrayList<>(); operations.add( new MBeanOperationInfo( "restart", "Restart DataSource", new MBeanParameterInfo[ 0 ], "void", MBeanOperationInfo.ACTION_INFO ) ); String mbeanName = dataSource.identity().toString(); MBeanInfo mbeanInfo = new MBeanInfo( DataSourceConfiguration.class.getName(), mbeanName, attributes.toArray( new MBeanAttributeInfo[ attributes.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null ); Object mbean = new ConfigurableDataSource( dataSourceService, mbeanInfo, mbeanName, properties ); ObjectName configurableDataSourceName = new ObjectName( "Polygene:application=" + application.name() + ",class=Datasource,name=" + mbeanName ); server.registerMBean( mbean, configurableDataSourceName ); configurationNames.add( configurableDataSourceName ); } }
@Override public void exportDataSources() throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException { for ( ServiceReference<DataSource> dataSource : dataSources ) { ModuleDescriptor module = spi.moduleOf( dataSource ); EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() ); List<MBeanAttributeInfo> attributes = new ArrayList<>(); Map<String, AccessibleObject> properties = new LinkedHashMap<>(); descriptor.state().properties().forEach(persistentProperty -> { if ( !persistentProperty.isImmutable() ) { String propertyName = persistentProperty.qualifiedName().name(); String type = persistentProperty.valueType().primaryType().getName(); attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) ); properties.put( propertyName, persistentProperty.accessor() ); } } ); List<MBeanOperationInfo> operations = new ArrayList<>(); operations.add( new MBeanOperationInfo( "restart", "Restart DataSource", new MBeanParameterInfo[ 0 ], "void", MBeanOperationInfo.ACTION_INFO ) ); String mbeanName = dataSource.identity().toString(); MBeanInfo mbeanInfo = new MBeanInfo( DataSourceConfiguration.class.getName(), mbeanName, attributes.toArray( new MBeanAttributeInfo[ attributes.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null ); Object mbean = new ConfigurableDataSource( dataSourceService, mbeanInfo, mbeanName, properties ); ObjectName configurableDataSourceName = new ObjectName( "Polygene:application=" + application.name() + ",class=Datasource,name=" + mbeanName ); server.registerMBean( mbean, configurableDataSourceName ); configurationNames.add( configurableDataSourceName ); } }
if( property.isImmutable() )
Map<String, AccessibleObject> properties = new HashMap<>(); descriptor.state().properties().forEach( persistentProperty -> { if( !persistentProperty.isImmutable() )
Map<String, AccessibleObject> properties = new HashMap<>(); descriptor.state().properties().forEach( persistentProperty -> { if( !persistentProperty.isImmutable() )
if( property.isImmutable() )
if( property.isImmutable() )
+ "size=\"80\" " + "type=\"text\" " + ( persistentProperty.isImmutable() ? "readonly=\"true\" " : "" ) + "name=\"" + persistentProperty.qualifiedName() + "\" " + "value=\"" + ( value == null ? "" : serialization.serialize( value ) )
if( !persistentProperty.isImmutable() )