@Override public void registerAttributes(ManagementResourceRegistration registry) { super.registerAttributes(registry); AttributeDefinition[] attributes = deployed ? getDeploymentAttributes() : ATTRIBUTES; for (AttributeDefinition attr : attributes) { if (registerRuntimeOnly || !attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { if (deployed) { registry.registerReadOnlyAttribute(attr, JMSQueueConfigurationRuntimeHandler.INSTANCE); } else { if (attr == CommonAttributes.DESTINATION_ENTRIES) { registry.registerReadWriteAttribute( attr, null, JMSQueueConfigurationWriteHandler.INSTANCE); } else { registry.registerReadOnlyAttribute(attr, null); } } } } if (registerRuntimeOnly) { for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, JMSQueueReadAttributeHandler.INSTANCE); } for (AttributeDefinition metric : METRICS) { registry.registerMetric(metric, JMSQueueReadAttributeHandler.INSTANCE); } } }
@SuppressWarnings("deprecation") @Override public void registerReadOnlyAttribute( String attributeName, OperationStepHandler readHandler, AttributeAccess.Storage storage) { deployments.registerReadOnlyAttribute(attributeName, readHandler, storage); subdeployments.registerReadOnlyAttribute(attributeName, readHandler, storage); }
@SuppressWarnings("deprecation") @Override public void registerReadOnlyAttribute( String attributeName, OperationStepHandler readHandler, EnumSet<AttributeAccess.Flag> flags) { deployments.registerReadOnlyAttribute(attributeName, readHandler, flags); subdeployments.registerReadOnlyAttribute(attributeName, readHandler, flags); }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { if (deployed) { for (final SimpleAttributeDefinition attribute : DATASOURCE_ATTRIBUTE) { SimpleAttributeDefinition runtimeAttribute = new SimpleAttributeDefinitionBuilder(attribute) .setFlags(AttributeAccess.Flag.STORAGE_RUNTIME) .build(); resourceRegistration.registerReadOnlyAttribute( runtimeAttribute, XMLDataSourceRuntimeHandler.INSTANCE); } for (final PropertiesAttributeDefinition attribute : DATASOURCE_PROPERTIES_ATTRIBUTES) { PropertiesAttributeDefinition runtimeAttribute = new PropertiesAttributeDefinition.Builder(attribute) .setFlags(AttributeAccess.Flag.STORAGE_RUNTIME) .build(); resourceRegistration.registerReadOnlyAttribute( runtimeAttribute, XMLDataSourceRuntimeHandler.INSTANCE); } } else { for (final SimpleAttributeDefinition attribute : DATASOURCE_ATTRIBUTE) { if (PoolConfigurationRWHandler.ATTRIBUTES.contains(attribute.getName())) { resourceRegistration.registerReadWriteAttribute( attribute, PoolConfigurationRWHandler.PoolConfigurationReadHandler.INSTANCE, PoolConfigurationRWHandler.LocalAndXaDataSourcePoolConfigurationWriteHandler .INSTANCE); } else { resourceRegistration.registerReadWriteAttribute( attribute, null, new DisableRequiredWriteAttributeHandler(DATASOURCE_ATTRIBUTE)); } } for (final PropertiesAttributeDefinition attribute : DATASOURCE_PROPERTIES_ATTRIBUTES) { if (PoolConfigurationRWHandler.ATTRIBUTES.contains(attribute.getName())) { resourceRegistration.registerReadWriteAttribute( attribute, PoolConfigurationRWHandler.PoolConfigurationReadHandler.INSTANCE, PoolConfigurationRWHandler.LocalAndXaDataSourcePoolConfigurationWriteHandler .INSTANCE); } else { resourceRegistration.registerReadWriteAttribute( attribute, null, new DisableRequiredWriteAttributeHandler(DATASOURCE_PROPERTIES_ATTRIBUTES)); } } } for (SimpleAttributeDefinition attribute : READONLY_DATASOURCE_ATTRIBUTE) { resourceRegistration.registerReadWriteAttribute( attribute, null, new ReloadRequiredWriteAttributeHandler(attribute)); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute( POSSIBLE_CAPABILITIES, (context, operation) -> populateCapabilities( capabilityRegistry.getPossibleCapabilities(), context.getResult(), true)); resourceRegistration.registerReadOnlyAttribute( CAPABILITIES, (context, operation) -> populateCapabilities(capabilityRegistry.getCapabilities(), context.getResult(), false)); }
@Override public void registerAttributes(ManagementResourceRegistration registration) { super.registerAttributes(registration); registration.registerReadOnlyAttribute( PlatformMBeanConstants.OBJECT_NAME, CompilationMXBeanAttributeHandler.INSTANCE); for (SimpleAttributeDefinition attribute : READ_ATTRIBUTES) { registration.registerReadOnlyAttribute(attribute, CompilationMXBeanAttributeHandler.INSTANCE); } for (SimpleAttributeDefinition attribute : METRICS) { registration.registerMetric(attribute, CompilationMXBeanAttributeHandler.INSTANCE); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(CONTEXT_ROOT, null); resourceRegistration.registerReadOnlyAttribute(VIRTUAL_HOST, null); for (SessionStat stat : SessionStat.values()) { resourceRegistration.registerMetric( stat.definition, SessionManagerStatsHandler.getInstance()); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute(PoolAttributeDefinitions.NAME, null); BoundedQueueThreadPoolWriteAttributeHandler writeHandler = new BoundedQueueThreadPoolWriteAttributeHandler(blocking, serviceNameBase); writeHandler.registerAttributes(resourceRegistration); if (registerRuntimeOnly) { new BoundedQueueThreadPoolMetricsHandler(serviceNameBase) .registerAttributes(resourceRegistration); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute( PoolAttributeDefinitions.NAME, ReadResourceNameOperationStepHandler.INSTANCE); new UnboundedQueueThreadPoolWriteAttributeHandler(serviceNameBase) .registerAttributes(resourceRegistration); if (registerRuntimeOnly) { new UnboundedQueueThreadPoolMetricsHandler(serviceNameBase) .registerAttributes(resourceRegistration); } }
@Override protected void register(ManagementResourceRegistration registration) { if (PlatformMBeanUtil.JVM_MAJOR_VERSION > 6) { registration.registerReadOnlyAttribute( PlatformMBeanConstants.OBJECT_NAME, this, AttributeAccess.Storage.RUNTIME); } for (String attribute : PlatformMBeanConstants.MEMORY_MANAGER_READ_ATTRIBUTES) { registration.registerMetric(attribute, this); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute( DEFAULT_REQUIRES_ADDRESSABLE, SensitivityClassificationReadAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( DEFAULT_REQUIRES_READ, SensitivityClassificationReadAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( DEFAULT_REQUIRES_WRITE, SensitivityClassificationReadAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( CONFIGURED_REQUIRES_ADDRESSABLE, SensitivityClassificationReadAttributeHandler.INSTANCE, SensitivityClassificationWriteAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( CONFIGURED_REQUIRES_READ, SensitivityClassificationReadAttributeHandler.INSTANCE, SensitivityClassificationWriteAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( CONFIGURED_REQUIRES_WRITE, SensitivityClassificationReadAttributeHandler.INSTANCE, SensitivityClassificationWriteAttributeHandler.INSTANCE); }
@Override public void registerAttributes(ManagementResourceRegistration registration) { super.registerAttributes(registration); InterfaceCriteriaWriteHandler handler = updateRuntime ? InterfaceCriteriaWriteHandler.UPDATE_RUNTIME : InterfaceCriteriaWriteHandler.CONFIG_ONLY; for (final AttributeDefinition def : InterfaceDefinition.ROOT_ATTRIBUTES) { registration.registerReadWriteAttribute(def, null, handler); } registration.registerReadOnlyAttribute( InterfaceDefinition.NAME, ReadResourceNameOperationStepHandler.INSTANCE); }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { super.registerAttributes(resourceRegistration); for (final AttributeDefinition ad : DWmParameters.getReadOnlyAttributeDefinitions()) { resourceRegistration.registerReadOnlyAttribute( ad, ReadResourceNameOperationStepHandler.INSTANCE); } for (final AttributeDefinition ad : DWmParameters.getRuntimeAttributeDefinitions()) { resourceRegistration.registerReadWriteAttribute( ad, null, JcaDistributedWorkManagerWriteHandler.INSTANCE); } }
@Override public void registerAttributes(ManagementResourceRegistration registry) { super.registerAttributes(registry); for (SimpleAttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { if (runtimeOnly) { AttributeDefinition readOnlyRuntimeAttr = create(attr).setStorageRuntime().build(); registry.registerReadOnlyAttribute( readOnlyRuntimeAttr, QueueReadAttributeHandler.RUNTIME_INSTANCE); } else { registry.registerReadOnlyAttribute(attr, null); } } } for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, QueueReadAttributeHandler.INSTANCE); } for (AttributeDefinition metric : METRICS) { registry.registerMetric(metric, QueueReadAttributeHandler.INSTANCE); } }
@Override public void registerAttributes(final ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerReadOnlyAttribute( JOB_XML_NAMES, new JobOperationStepHandler(false) { @Override protected void execute( final OperationContext context, final ModelNode operation, final JobOperator jobOperator) throws OperationFailedException { final ModelNode list = context.getResult().setEmptyList(); if (jobOperator instanceof JobOperatorService) { final JobOperatorService jobOperatorService = (JobOperatorService) jobOperator; for (String jobXmlName : jobOperatorService.getJobDescriptors().getJobXmlNames()) { list.add(jobXmlName); } } } }); }
@SuppressWarnings("deprecation") @Override public void register(ManagementResourceRegistration parentRegistration) { ManagementResourceRegistration registration = parentRegistration.registerSubModel(this); ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()) .addAttributes(Attribute.class) .addExtraParameters(DeprecatedAttribute.class) .addCapabilities(Capability.class); ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(new ProtocolConfigurationBuilderFactory()); new RestartParentResourceAddStepHandler<>(this.parentBuilderFactory, descriptor, handler) .register(registration); new RestartParentResourceRemoveStepHandler<>(this.parentBuilderFactory, descriptor, handler) .register(registration); for (DeprecatedAttribute attribute : DeprecatedAttribute.values()) { registration.registerReadOnlyAttribute(attribute.getDefinition(), null); } super.register(registration); }
@Override public void registerAttributes(ManagementResourceRegistration registry) { super.registerAttributes(registry); for (AttributeDefinition attr : ATTRIBUTES) { // deprecated attributes if (attr == Common.DISCOVERY_INITIAL_WAIT_TIMEOUT || attr == Common.FAILOVER_ON_SERVER_SHUTDOWN) { registry.registerReadWriteAttribute(attr, null, DeprecatedAttributeWriteHandler.INSTANCE); } else { if (registerRuntimeOnly || !attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute( attr, null, ConnectionFactoryWriteAttributeHandler.INSTANCE); } } } if (registerRuntimeOnly) { for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, ConnectionFactoryReadAttributeHandler.INSTANCE); } } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { super.registerAttributes(resourceRegistration); resourceRegistration.registerReadWriteAttribute( NAME, null, new WriteAttributeHandlers.AttributeDefinitionValidatingHandler(NAME)); resourceRegistration.registerReadOnlyAttribute( PROCESS_TYPE, isMaster ? ProcessTypeHandler.MASTER : ProcessTypeHandler.SLAVE); resourceRegistration.registerReadOnlyAttribute( LAUNCH_TYPE, new LaunchTypeHandler(ServerEnvironment.LaunchType.DOMAIN)); resourceRegistration.registerReadOnlyAttribute( LOCAL_HOST_NAME, new LocalHostNameOperationHandler(hostControllerInfo)); resourceRegistration.registerReadOnlyAttribute( MANAGEMENT_MAJOR_VERSION, ManagementVersionAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( MANAGEMENT_MINOR_VERSION, ManagementVersionAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( MANAGEMENT_MICRO_VERSION, ManagementVersionAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( RELEASE_VERSION, ReleaseVersionAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( RELEASE_CODENAME, ReleaseVersionAttributeHandler.INSTANCE); ProductInfoAttributeHandler infoHandler = new ProductInfoAttributeHandler( environment != null ? environment.getProductConfig() : null); resourceRegistration.registerReadOnlyAttribute(PRODUCT_NAME, infoHandler); resourceRegistration.registerReadOnlyAttribute(PRODUCT_VERSION, infoHandler); resourceRegistration.registerReadOnlyAttribute( NAMESPACES, DefaultEmptyListAttributeHandler.INSTANCE); resourceRegistration.registerReadOnlyAttribute( SCHEMA_LOCATIONS, DefaultEmptyListAttributeHandler.INSTANCE); }
public static void initOperations( final ManagementResourceRegistration root, final ContentRepository contentRepository, final ExtensibleConfigurationPersister extensibleConfigurationPersister, final ServerEnvironment serverEnvironment, final ControlledProcessState processState, final RunningModeControl runningModeControl, final AbstractVaultReader vaultReader, final ExtensionRegistry extensionRegistry, final boolean parallelBoot, final PathManagerService pathManager) { // System Properties root.registerSubModel( SystemPropertyResourceDefinition.createForStandaloneServer(serverEnvironment)); // vault root.registerSubModel(new VaultResourceDefinition(vaultReader)); // Central Management // Start with the base /core-service=management MNR. The Resource for this is added by // ServerService itself, so there is no add/remove op handlers ManagementResourceRegistration management = root.registerSubModel(CoreManagementDefinition.INSTANCE); management.registerSubModel(SecurityRealmResourceDefinition.INSTANCE); management.registerSubModel(LdapConnectionResourceDefinition.INSTANCE); management.registerSubModel(NativeManagementResourceDefinition.INSTANCE); management.registerSubModel(NativeRemotingManagementResourceDefinition.INSTANCE); management.registerSubModel(HttpManagementResourceDefinition.INSTANCE); // Other core services ManagementResourceRegistration serviceContainer = root.registerSubModel( new SimpleResourceDefinition( PathElement.pathElement(CORE_SERVICE, SERVICE_CONTAINER), ControllerResolver.getResolver("core", SERVICE_CONTAINER))); serviceContainer.registerOperationHandler( DumpServicesHandler.DEFINITION, DumpServicesHandler.INSTANCE); // Platform MBeans PlatformMBeanResourceRegistrar.registerPlatformMBeanResources(root); // Paths root.registerSubModel(PathResourceDefinition.createSpecified(pathManager)); // Interfaces ManagementResourceRegistration interfaces = root.registerSubModel( new InterfaceDefinition( SpecifiedInterfaceAddHandler.INSTANCE, SpecifiedInterfaceRemoveHandler.INSTANCE, true)); interfaces.registerReadOnlyAttribute( NetworkInterfaceRuntimeHandler.RESOLVED_ADDRESS, NetworkInterfaceRuntimeHandler.INSTANCE); interfaces.registerOperationHandler( SpecifiedInterfaceResolveHandler.DEFINITION, SpecifiedInterfaceResolveHandler.INSTANCE); // TODO socket-binding-group currently lives in controller and the child RDs live in server so // they currently need passing in from here root.registerSubModel( new SocketBindingGroupResourceDefinition( BindingGroupAddHandler.INSTANCE, SocketBindingGroupRemoveHandler.INSTANCE, false, SocketBindingResourceDefinition.INSTANCE, RemoteDestinationOutboundSocketBindingResourceDefinition.INSTANCE, LocalDestinationOutboundSocketBindingResourceDefinition.INSTANCE)); // Deployments ManagementResourceRegistration deployments = root.registerSubModel( ServerDeploymentResourceDescription.create(contentRepository, vaultReader)); // deployment overlays root.registerSubModel( new DeploymentOverlayDefinition(DeploymentOverlayPriority.SERVER, contentRepository, null)); // The sub-deployments registry deployments.registerSubModel( new SimpleResourceDefinition( PathElement.pathElement(SUBDEPLOYMENT), DeploymentAttributes.DEPLOYMENT_RESOLVER)); // Extensions root.registerSubModel(new ExtensionResourceDefinition(extensionRegistry, parallelBoot, false)); if (extensionRegistry != null) { // extension registry may be null during testing extensionRegistry.setSubsystemParentResourceRegistrations(root, deployments); extensionRegistry.setPathManager(pathManager); } // Util root.registerOperationHandler( DeployerChainAddHandler.DEFINITION, DeployerChainAddHandler.INSTANCE, false); }
protected void initModel(ManagementModel managementModel) { ManagementResourceRegistration registration = managementModel.getRootResourceRegistration(); PathManagerService pathManagerService = new PathManagerService() {}; GlobalOperationHandlers.registerGlobalOperations(registration, processType); registration.registerOperationHandler( CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE); GlobalNotifications.registerGlobalNotifications(registration, processType); registration.registerReadOnlyAttribute( LAUNCH_TYPE, new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.getResult().set(TYPE_STANDALONE); } }); TestServiceListener listener = new TestServiceListener(); listener.reset(1); getContainer() .addService(PathManagerService.SERVICE_NAME, pathManagerService) .addListener(listener) .install(); try { listener.latch.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } registration.registerSubModel(PathResourceDefinition.createSpecified(pathManagerService)); registration.registerSubModel( CoreManagementResourceDefinition.forStandaloneServer( getAuthorizer(), getAuditLogger(), pathManagerService, new EnvironmentNameReader() { public boolean isServer() { return true; } public String getServerName() { return "Test"; } public String getHostName() { return null; } public String getProductName() { return null; } }, null, new ResourceDefinition[0])); Resource rootResource = managementModel.getRootResource(); pathManagerService.addPathManagerResources(rootResource); ExtensionRegistry extensionRegistry = new ExtensionRegistry( ProcessType.STANDALONE_SERVER, new RunningModeControl(RunningMode.NORMAL), AuditLogger.NO_OP_LOGGER, getAuthorizer(), RuntimeHostControllerInfoAccessor.SERVER); extensionRegistry.setPathManager(pathManagerService); extensionRegistry.setWriterRegistry(new NullConfigurationPersister()); JMXExtension extension = new JMXExtension(); extension.initialize( extensionRegistry.getExtensionContext( "org.jboss.as.jmx", registration, ExtensionRegistryType.SLAVE)); Resource coreManagementResource = Resource.Factory.create(); rootResource.registerChild( CoreManagementResourceDefinition.PATH_ELEMENT, coreManagementResource); Resource accessAuthorizationResource = Resource.Factory.create(); accessAuthorizationResource .getModel() .get(AccessAuthorizationResourceDefinition.PROVIDER.getName()) .set(AccessAuthorizationResourceDefinition.Provider.SIMPLE.toString()); coreManagementResource.registerChild( AccessAuthorizationResourceDefinition.PATH_ELEMENT, accessAuthorizationResource); }
private static void initializeDomainRegistry( final ManagementResourceRegistration root, final ExtensibleConfigurationPersister configurationPersister, final ContentRepository contentRepo, final HostFileRepository fileRepository, final boolean isMaster, final DomainController domainController, final UnregisteredHostChannelRegistry channelRegistry, final LocalHostControllerInfo hostControllerInfo, final ExtensionRegistry extensionRegistry) { final EnumSet<OperationEntry.Flag> readOnly = EnumSet.of(OperationEntry.Flag.READ_ONLY); final EnumSet<OperationEntry.Flag> deploymentUpload = EnumSet.of(OperationEntry.Flag.MASTER_HOST_CONTROLLER_ONLY); // Other root resource operations XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); root.registerOperationHandler( XmlMarshallingHandler.OPERATION_NAME, xmh, xmh, false, OperationEntry.EntryType.PUBLIC, readOnly); root.registerOperationHandler( NamespaceAddHandler.OPERATION_NAME, NamespaceAddHandler.INSTANCE, NamespaceAddHandler.INSTANCE, false); root.registerOperationHandler( NamespaceRemoveHandler.OPERATION_NAME, NamespaceRemoveHandler.INSTANCE, NamespaceRemoveHandler.INSTANCE, false); root.registerOperationHandler( SchemaLocationAddHandler.OPERATION_NAME, SchemaLocationAddHandler.INSTANCE, SchemaLocationAddHandler.INSTANCE, false); root.registerOperationHandler( SchemaLocationRemoveHandler.OPERATION_NAME, SchemaLocationRemoveHandler.INSTANCE, SchemaLocationRemoveHandler.INSTANCE, false); DeploymentUploadBytesHandler dubh = isMaster ? new DeploymentUploadBytesHandler(contentRepo) : new DeploymentUploadBytesHandler(); root.registerOperationHandler( DeploymentUploadBytesHandler.OPERATION_NAME, dubh, dubh, false, OperationEntry.EntryType.PUBLIC, deploymentUpload); DeploymentUploadURLHandler duuh = isMaster ? new DeploymentUploadURLHandler(contentRepo) : new DeploymentUploadURLHandler(); root.registerOperationHandler( DeploymentUploadURLHandler.OPERATION_NAME, duuh, duuh, false, OperationEntry.EntryType.PUBLIC, deploymentUpload); DeploymentUploadStreamAttachmentHandler dush = isMaster ? new DeploymentUploadStreamAttachmentHandler(contentRepo) : new DeploymentUploadStreamAttachmentHandler(); root.registerOperationHandler( DeploymentUploadStreamAttachmentHandler.OPERATION_NAME, dush, dush, false, OperationEntry.EntryType.PUBLIC, deploymentUpload); DeploymentFullReplaceHandler dfrh = isMaster ? new DeploymentFullReplaceHandler(contentRepo) : new DeploymentFullReplaceHandler(fileRepository); root.registerOperationHandler(DeploymentFullReplaceHandler.OPERATION_NAME, dfrh, dfrh); SnapshotDeleteHandler snapshotDelete = new SnapshotDeleteHandler(configurationPersister); root.registerOperationHandler( SnapshotDeleteHandler.OPERATION_NAME, snapshotDelete, snapshotDelete, false); SnapshotListHandler snapshotList = new SnapshotListHandler(configurationPersister); root.registerOperationHandler( SnapshotListHandler.OPERATION_NAME, snapshotList, snapshotList, false); SnapshotTakeHandler snapshotTake = new SnapshotTakeHandler(configurationPersister); root.registerOperationHandler( SnapshotTakeHandler.OPERATION_NAME, snapshotTake, snapshotTake, false); root.registerReadOnlyAttribute( PROCESS_TYPE, isMaster ? ProcessTypeHandler.MASTER : ProcessTypeHandler.SLAVE, Storage.RUNTIME); root.registerReadOnlyAttribute( ServerDescriptionConstants.LAUNCH_TYPE, new LaunchTypeHandler(ServerEnvironment.LaunchType.DOMAIN), Storage.RUNTIME); root.registerOperationHandler( GlobalOperationHandlers.VALIDATE_ADDRESS_OPERATION_NAME, GlobalOperationHandlers.VALIDATE_ADDRESS, CommonProviders.VALIDATE_ADDRESS_PROVIDER, true); root.registerOperationHandler( ResolveExpressionOnDomainHandler.OPERATION_NAME, ResolveExpressionOnDomainHandler.INSTANCE, ResolveExpressionOnDomainHandler.INSTANCE, EnumSet.of(OperationEntry.Flag.READ_ONLY, OperationEntry.Flag.DOMAIN_PUSH_TO_SERVERS)); DomainServerLifecycleHandlers.registerDomainHandlers(root); // System Properties ManagementResourceRegistration systemProperties = root.registerSubModel( PathElement.pathElement(SYSTEM_PROPERTY), DomainDescriptionProviders.SYSTEM_PROPERTY_PROVIDER); systemProperties.registerOperationHandler( SystemPropertyAddHandler.OPERATION_NAME, SystemPropertyAddHandler.INSTANCE_WITH_BOOTTIME, SystemPropertyAddHandler.INSTANCE_WITH_BOOTTIME, false); systemProperties.registerOperationHandler( SystemPropertyRemoveHandler.OPERATION_NAME, SystemPropertyRemoveHandler.INSTANCE, SystemPropertyRemoveHandler.INSTANCE, false); systemProperties.registerReadWriteAttribute( VALUE, null, SystemPropertyValueWriteAttributeHandler.INSTANCE, Storage.CONFIGURATION); systemProperties.registerReadWriteAttribute( BOOT_TIME, null, new ModelTypeValidatingHandler(ModelType.BOOLEAN), Storage.CONFIGURATION); final ManagementResourceRegistration interfaces = root.registerSubModel( PathElement.pathElement(INTERFACE), CommonProviders.NAMED_INTERFACE_PROVIDER); interfaces.registerOperationHandler( ADD, InterfaceAddHandler.NAMED_INSTANCE, InterfaceAddHandler.NAMED_INSTANCE, false); interfaces.registerOperationHandler( REMOVE, InterfaceRemoveHandler.INSTANCE, InterfaceRemoveHandler.INSTANCE, false); InterfaceCriteriaWriteHandler.register(interfaces); final ManagementResourceRegistration profile = root.registerSubModel(PathElement.pathElement(PROFILE), DomainDescriptionProviders.PROFILE); profile.registerOperationHandler( ADD, ProfileAddHandler.INSTANCE, ProfileAddHandler.INSTANCE, false); profile.registerOperationHandler( REMOVE, ProfileRemoveHandler.INSTANCE, ProfileRemoveHandler.INSTANCE, false); profile.registerOperationHandler( DESCRIBE, ProfileDescribeHandler.INSTANCE, ProfileDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE, readOnly); final ManagementResourceRegistration paths = root.registerSubModel( PathElement.pathElement(PATH), DomainDescriptionProviders.PATH_DESCRIPTION); paths.registerOperationHandler( ADD, PathAddHandler.NAMED_INSTANCE, PathAddHandler.NAMED_INSTANCE, false); paths.registerOperationHandler( REMOVE, PathRemoveHandler.INSTANCE, PathRemoveHandler.INSTANCE, false); final ManagementResourceRegistration socketBindingGroup = root.registerSubModel( new SocketBindingGroupResourceDefinition( SocketBindingGroupAddHandler.INSTANCE, SocketBindingGroupRemoveHandler.INSTANCE, true)); socketBindingGroup.registerSubModel(SocketBindingResourceDefinition.INSTANCE); // outbound-socket-binding (for remote destination) socketBindingGroup.registerSubModel( RemoteDestinationOutboundSocketBindingResourceDefinition.INSTANCE); // outbound-socket-binding (for local destination) socketBindingGroup.registerSubModel( LocalDestinationOutboundSocketBindingResourceDefinition.INSTANCE); final ManagementResourceRegistration serverGroups = root.registerSubModel( PathElement.pathElement(SERVER_GROUP), DomainDescriptionProviders.SERVER_GROUP); serverGroups.registerOperationHandler( ADD, ServerGroupAddHandler.INSTANCE, ServerGroupAddHandler.INSTANCE, false); serverGroups.registerOperationHandler( REMOVE, ServerGroupRemoveHandler.INSTANCE, ServerGroupRemoveHandler.INSTANCE, false); serverGroups.registerReadWriteAttribute( SOCKET_BINDING_GROUP, null, WriteAttributeHandlers.WriteAttributeOperationHandler.INSTANCE, Storage.CONFIGURATION); serverGroups.registerReadWriteAttribute( SOCKET_BINDING_PORT_OFFSET, null, new IntRangeValidatingHandler(0, true), Storage.CONFIGURATION); DomainServerLifecycleHandlers.registerServerGroupHandlers(serverGroups); final ManagementResourceRegistration groupVMs = serverGroups.registerSubModel(PathElement.pathElement(JVM), CommonProviders.JVM_PROVIDER); JVMHandlers.register(groupVMs); ServerGroupDeploymentReplaceHandler sgdrh = new ServerGroupDeploymentReplaceHandler(fileRepository); serverGroups.registerOperationHandler( ServerGroupDeploymentReplaceHandler.OPERATION_NAME, sgdrh, sgdrh); final ManagementResourceRegistration serverGroupDeployments = serverGroups.registerSubModel( PathElement.pathElement(DEPLOYMENT), DomainDescriptionProviders.SERVER_GROUP_DEPLOYMENT); ServerGroupDeploymentAddHandler sgdah = new ServerGroupDeploymentAddHandler(fileRepository); serverGroupDeployments.registerOperationHandler( ServerGroupDeploymentAddHandler.OPERATION_NAME, sgdah, sgdah); serverGroupDeployments.registerOperationHandler( ServerGroupDeploymentDeployHandler.OPERATION_NAME, ServerGroupDeploymentDeployHandler.INSTANCE, ServerGroupDeploymentDeployHandler.INSTANCE); serverGroupDeployments.registerOperationHandler( ServerGroupDeploymentRedeployHandler.OPERATION_NAME, ServerGroupDeploymentRedeployHandler.INSTANCE, ServerGroupDeploymentRedeployHandler.INSTANCE); serverGroupDeployments.registerOperationHandler( ServerGroupDeploymentUndeployHandler.OPERATION_NAME, ServerGroupDeploymentUndeployHandler.INSTANCE, ServerGroupDeploymentUndeployHandler.INSTANCE); serverGroupDeployments.registerOperationHandler( DeploymentRemoveHandler.OPERATION_NAME, ServerGroupDeploymentRemoveHandler.INSTANCE, ServerGroupDeploymentRemoveHandler.INSTANCE); // Server Group System Properties ManagementResourceRegistration serverGroupSystemProperties = serverGroups.registerSubModel( PathElement.pathElement(SYSTEM_PROPERTY), DomainDescriptionProviders.SERVER_GROUP_SYSTEM_PROPERTY_PROVIDER); serverGroupSystemProperties.registerOperationHandler( SystemPropertyAddHandler.OPERATION_NAME, SystemPropertyAddHandler.INSTANCE_WITH_BOOTTIME, SystemPropertyAddHandler.INSTANCE_WITH_BOOTTIME, false); serverGroupSystemProperties.registerOperationHandler( SystemPropertyRemoveHandler.OPERATION_NAME, SystemPropertyRemoveHandler.INSTANCE, SystemPropertyRemoveHandler.INSTANCE, false); serverGroupSystemProperties.registerReadWriteAttribute( VALUE, null, SystemPropertyValueWriteAttributeHandler.INSTANCE, Storage.CONFIGURATION); serverGroupSystemProperties.registerReadWriteAttribute( BOOT_TIME, null, new ModelTypeValidatingHandler(ModelType.BOOLEAN), Storage.CONFIGURATION); // Root Deployments final ManagementResourceRegistration deployments = root.registerSubModel( PathElement.pathElement(DEPLOYMENT), DomainDescriptionProviders.DEPLOYMENT_PROVIDER); DeploymentAddHandler dah = isMaster ? new DeploymentAddHandler(contentRepo) : new DeploymentAddHandler(); deployments.registerOperationHandler(DeploymentAddHandler.OPERATION_NAME, dah, dah); DeploymentRemoveHandler drh = isMaster ? DeploymentRemoveHandler.createForMaster(contentRepo) : DeploymentRemoveHandler.createForSlave(fileRepository); deployments.registerOperationHandler(DeploymentRemoveHandler.OPERATION_NAME, drh, drh); // Management client content ManagedDMRContentTypeResourceDefinition plansDef = new ManagedDMRContentTypeResourceDefinition( contentRepo, ROLLOUT_PLAN, PathElement.pathElement(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS), DomainRootDescription.getResourceDescriptionResolver(ROLLOUT_PLANS)); ManagementResourceRegistration mgmtContent = root.registerSubModel(plansDef); ParameterValidator contentValidator = new AbstractParameterValidator() { @Override public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { validateRolloutPlanStructure(value); } }; ManagedDMRContentResourceDefinition planDef = ManagedDMRContentResourceDefinition.create( ROLLOUT_PLAN, contentValidator, DomainRootDescription.getResourceDescriptionResolver(ROLLOUT_PLAN)); mgmtContent.registerSubModel(planDef); // Extensions root.registerSubModel(new ExtensionResourceDefinition(extensionRegistry, true)); extensionRegistry.setProfileResourceRegistration(profile); if (!isMaster) { ApplyRemoteMasterDomainModelHandler armdmh = new ApplyRemoteMasterDomainModelHandler( extensionRegistry, fileRepository, contentRepo, hostControllerInfo); root.registerOperationHandler( ApplyRemoteMasterDomainModelHandler.OPERATION_NAME, armdmh, armdmh, false, OperationEntry.EntryType.PRIVATE); } else { ReadMasterDomainModelHandler rmdmh = new ReadMasterDomainModelHandler(domainController, channelRegistry); root.registerOperationHandler( ReadMasterDomainModelHandler.OPERATION_NAME, rmdmh, rmdmh, false, OperationEntry.EntryType.PRIVATE, EnumSet.of(OperationEntry.Flag.READ_ONLY)); } }
@Override public void registerReadOnlyAttribute( AttributeDefinition definition, OperationStepHandler readHandler) { deployments.registerReadOnlyAttribute(definition, readHandler); subdeployments.registerReadOnlyAttribute(definition, readHandler); }
@Override public void registerAttributes(ManagementResourceRegistration hostRegistration) { super.registerAttributes(hostRegistration); hostRegistration.registerReadWriteAttribute( DIRECTORY_GROUPING, null, new ReloadRequiredWriteAttributeHandler(DIRECTORY_GROUPING) { @Override protected boolean requiresRuntime(OperationContext context) { return context.getRunningMode() == RunningMode.NORMAL && !context.isBooting(); } }); hostRegistration.registerReadOnlyAttribute(PRODUCT_NAME, null); hostRegistration.registerReadOnlyAttribute(SERVER_STATE, null); hostRegistration.registerReadOnlyAttribute(RELEASE_VERSION, null); hostRegistration.registerReadOnlyAttribute(RELEASE_CODENAME, null); hostRegistration.registerReadOnlyAttribute(PRODUCT_VERSION, null); hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MAJOR_VERSION, null); hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MINOR_VERSION, null); hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MICRO_VERSION, null); hostRegistration.registerReadOnlyAttribute(MASTER, IsMasterHandler.INSTANCE); hostRegistration.registerReadOnlyAttribute(DOMAIN_CONTROLLER, null); hostRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.NAMESPACES, null); hostRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.SCHEMA_LOCATIONS, null); hostRegistration.registerReadWriteAttribute( HostResourceDefinition.NAME, environment.getProcessNameReadHandler(), environment.getProcessNameWriteHandler()); hostRegistration.registerReadOnlyAttribute( HostResourceDefinition.HOST_STATE, new ProcessStateAttributeHandler(processState)); hostRegistration.registerReadOnlyAttribute( ServerRootResourceDefinition.RUNNING_MODE, new RunningModeReadHandler(runningModeControl)); hostRegistration.registerReadOnlyAttribute( ServerRootResourceDefinition.SUSPEND_STATE, SuspendStateReadHandler.INSTANCE); }