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 registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); final EnumSet<OperationEntry.Flag> readOnly = EnumSet.of(OperationEntry.Flag.READ_ONLY); // Other root resource operations XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); resourceRegistration.registerOperationHandler( NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE); resourceRegistration.registerOperationHandler( NamespaceRemoveHandler.DEFINITION, NamespaceRemoveHandler.INSTANCE); resourceRegistration.registerOperationHandler( SchemaLocationAddHandler.DEFINITION, SchemaLocationAddHandler.INSTANCE); resourceRegistration.registerOperationHandler( SchemaLocationRemoveHandler.DEFINITION, SchemaLocationRemoveHandler.INSTANCE); if (isMaster) { DeploymentUploadURLHandler.registerMaster(resourceRegistration, contentRepo); DeploymentUploadStreamAttachmentHandler.registerMaster(resourceRegistration, contentRepo); DeploymentUploadBytesHandler.registerMaster(resourceRegistration, contentRepo); SnapshotDeleteHandler snapshotDelete = new SnapshotDeleteHandler(configurationPersister); resourceRegistration.registerOperationHandler( SnapshotDeleteHandler.DEFINITION, snapshotDelete); SnapshotListHandler snapshotList = new SnapshotListHandler(configurationPersister); resourceRegistration.registerOperationHandler(SnapshotListHandler.DEFINITION, snapshotList); SnapshotTakeHandler snapshotTake = new SnapshotTakeHandler(configurationPersister); resourceRegistration.registerOperationHandler(SnapshotTakeHandler.DEFINITION, snapshotTake); final SubsystemDescriptionDump dumper = new SubsystemDescriptionDump(extensionRegistry); resourceRegistration.registerOperationHandler(SubsystemDescriptionDump.DEFINITION, dumper); } else { DeploymentUploadURLHandler.registerSlave(resourceRegistration); DeploymentUploadStreamAttachmentHandler.registerSlave(resourceRegistration); DeploymentUploadBytesHandler.registerSlave(resourceRegistration); final ApplyExtensionsHandler aexh = new ApplyExtensionsHandler( extensionRegistry, hostControllerInfo, ignoredDomainResourceRegistry); resourceRegistration.registerOperationHandler(ApplyExtensionsHandler.DEFINITION, aexh); ApplyRemoteMasterDomainModelHandler armdmh = new ApplyRemoteMasterDomainModelHandler( fileRepository, contentRepo, hostControllerInfo, ignoredDomainResourceRegistry); resourceRegistration.registerOperationHandler( ApplyRemoteMasterDomainModelHandler.DEFINITION, armdmh); } resourceRegistration.registerOperationHandler( DeploymentAttributes.FULL_REPLACE_DEPLOYMENT_DEFINITION, isMaster ? new DeploymentFullReplaceHandler(contentRepo) : new DeploymentFullReplaceHandler(fileRepository)); resourceRegistration.registerOperationHandler( ValidateAddressOperationHandler.DEFINITION, ValidateAddressOperationHandler.INSTANCE); resourceRegistration.registerOperationHandler( ResolveExpressionOnDomainHandler.DEFINITION, ResolveExpressionOnDomainHandler.INSTANCE); DomainServerLifecycleHandlers.registerDomainHandlers(resourceRegistration); }
@Override public void registerOperations(ManagementResourceRegistration hostRegistration) { super.registerOperations(hostRegistration); hostRegistration.registerOperationHandler( NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE); hostRegistration.registerOperationHandler( NamespaceRemoveHandler.DEFINITION, NamespaceRemoveHandler.INSTANCE); hostRegistration.registerOperationHandler( SchemaLocationAddHandler.DEFINITION, SchemaLocationAddHandler.INSTANCE); hostRegistration.registerOperationHandler( SchemaLocationRemoveHandler.DEFINITION, SchemaLocationRemoveHandler.INSTANCE); hostRegistration.registerOperationHandler( ValidateAddressOperationHandler.DEFINITION, ValidateAddressOperationHandler.INSTANCE); hostRegistration.registerOperationHandler( ResolveExpressionHandler.DEFINITION, ResolveExpressionHandler.INSTANCE); hostRegistration.registerOperationHandler( ResolveExpressionOnHostHandler.DEFINITION, ResolveExpressionOnHostHandler.INSTANCE); hostRegistration.registerOperationHandler( SpecifiedInterfaceResolveHandler.DEFINITION, SpecifiedInterfaceResolveHandler.INSTANCE); hostRegistration.registerOperationHandler( CleanObsoleteContentHandler.DEFINITION, CleanObsoleteContentHandler.createOperation(contentRepository)); XmlMarshallingHandler xmh = new HostXmlMarshallingHandler( configurationPersister.getHostPersister(), hostControllerInfo); hostRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); StartServersHandler ssh = new StartServersHandler(environment, serverInventory, runningModeControl); hostRegistration.registerOperationHandler(StartServersHandler.DEFINITION, ssh); HostShutdownHandler hsh = new HostShutdownHandler(domainController); hostRegistration.registerOperationHandler(HostShutdownHandler.DEFINITION, hsh); HostProcessReloadHandler reloadHandler = new HostProcessReloadHandler( HostControllerService.HC_SERVICE_NAME, runningModeControl, processState); hostRegistration.registerOperationHandler( HostProcessReloadHandler.getDefinition(hostControllerInfo), reloadHandler); DomainServerLifecycleHandlers.initializeServerInventory(serverInventory); DomainSocketBindingGroupRemoveHandler.INSTANCE.initializeServerInventory(serverInventory); ValidateOperationHandler validateOperationHandler = hostControllerInfo.isMasterDomainController() ? ValidateOperationHandler.INSTANCE : ValidateOperationHandler.SLAVE_HC_INSTANCE; hostRegistration.registerOperationHandler( ValidateOperationHandler.DEFINITION_PRIVATE, validateOperationHandler); SnapshotDeleteHandler snapshotDelete = new SnapshotDeleteHandler(configurationPersister.getHostPersister()); hostRegistration.registerOperationHandler(SnapshotDeleteHandler.DEFINITION, snapshotDelete); SnapshotListHandler snapshotList = new SnapshotListHandler(configurationPersister.getHostPersister()); hostRegistration.registerOperationHandler(SnapshotListHandler.DEFINITION, snapshotList); SnapshotTakeHandler snapshotTake = new SnapshotTakeHandler(configurationPersister.getHostPersister()); hostRegistration.registerOperationHandler(SnapshotTakeHandler.DEFINITION, snapshotTake); ignoredRegistry.registerResources(hostRegistration); // Platform MBeans PlatformMBeanResourceRegistrar.registerPlatformMBeanResources(hostRegistration); }