Java Code Examples for org.jboss.as.controller.registry.ManagementResourceRegistration#registerSubModel()
The following examples show how to use
org.jboss.as.controller.registry.ManagementResourceRegistration#registerSubModel() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GmlcExtension.java From gmlc with GNU Affero General Public License v3.0 | 6 votes |
@Override public void initialize(ExtensionContext context) { final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, ModelVersion.create(MAJOR_VERSION, MINOR_VERSION)); final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(SubsystemDefinition.INSTANCE); final OperationDefinition describeOp = new SimpleOperationDefinitionBuilder(DESCRIBE, getResourceDescriptionResolver(null)) .setEntryType(OperationEntry.EntryType.PRIVATE) .build(); registration.registerOperationHandler(describeOp, GenericSubsystemDescribeHandler.INSTANCE, false); subsystem.registerXMLElementWriter(GmlcSubsystemParser.getInstance()); // here we can register submodels final ManagementResourceRegistration mbeans = registration.registerSubModel(GmlcMbeanDefinition.INSTANCE); }
Example 2
Source File: ObjectNameAddressUtilTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
@Test public void testToPathAddress() { NonResolvingResourceDescriptionResolver resolver = new NonResolvingResourceDescriptionResolver(); ManagementResourceRegistration rootRegistration = ManagementResourceRegistration.Factory.forProcessType(ProcessType.EMBEDDED_SERVER).createRegistration(rootResourceDef); ManagementResourceRegistration subsystemRegistration = rootRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("subsystem", "foo"), resolver)); ManagementResourceRegistration resourceRegistration = subsystemRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("resource", "resourceA"), resolver)); ManagementResourceRegistration subresourceRegistration = resourceRegistration.registerSubModel(new SimpleResourceDefinition(pathElement("subresource", "resourceB"), resolver)); PathAddress pathAddress = PathAddress.pathAddress("subsystem", "foo") .append("resource", "resourceA") .append("subresource", "resourceB"); ObjectName on = ObjectNameAddressUtil.createObjectName("jboss.as", pathAddress); PathAddress convertedAddress = ObjectNameAddressUtil.toPathAddress("jboss.as", rootRegistration, on); Assert.assertNotNull(convertedAddress); Assert.assertEquals(pathAddress, convertedAddress); }
Example 3
Source File: DeploymentScannerExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * {@inheritDoc} */ @Override public void initialize(ExtensionContext context) { ROOT_LOGGER.debug("Initializing Deployment Scanner Extension"); if (context.getProcessType().isHostController()) { throw DeploymentScannerLogger.ROOT_LOGGER.deploymentScannerNotForDomainMode(); } final SubsystemRegistration subsystem = context.registerSubsystem(CommonAttributes.DEPLOYMENT_SCANNER, CURRENT_VERSION); subsystem.registerXMLElementWriter(DeploymentScannerParser_2_0::new); final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new DeploymentScannerSubsystemDefinition()); registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE); final ManagementResourceRegistration scanner = registration.registerSubModel(new DeploymentScannerDefinition(context.getPathManager())); if (context.getProcessType().isServer()) { final ResolvePathHandler resolvePathHandler = ResolvePathHandler.Builder.of(context.getPathManager()) .setRelativeToAttribute(DeploymentScannerDefinition.RELATIVE_TO) .setPathAttribute(DeploymentScannerDefinition.PATH) .build(); scanner.registerOperationHandler(resolvePathHandler.getOperationDefinition(), resolvePathHandler); } }
Example 4
Source File: KeycloakExtension.java From keycloak with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void initialize(final ExtensionContext context) { KeycloakLogger.ROOT_LOGGER.debug("Activating Keycloak Extension"); final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, MGMT_API_VERSION); ManagementResourceRegistration registration = subsystem.registerSubsystemModel(KEYCLOAK_SUBSYSTEM_RESOURCE); registration.registerSubModel(REALM_DEFINITION); ManagementResourceRegistration secureDeploymentRegistration = registration.registerSubModel(SECURE_DEPLOYMENT_DEFINITION); secureDeploymentRegistration.registerSubModel(CREDENTIAL_DEFINITION); secureDeploymentRegistration.registerSubModel(REDIRECT_RULE_DEFINITON); ManagementResourceRegistration secureServerRegistration = registration.registerSubModel(SECURE_SERVER_DEFINITION); secureServerRegistration.registerSubModel(CREDENTIAL_DEFINITION); secureServerRegistration.registerSubModel(REDIRECT_RULE_DEFINITON); subsystem.registerXMLElementWriter(PARSER); }
Example 5
Source File: TestExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void initialize(ExtensionContext context) { System.out.println("Initializing TestExtension"); SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME, ModelVersion.create(1, 0, 0)); ManagementResourceRegistration rootRbacRegistration = registration.registerSubsystemModel(new RootResourceDefinition(SUBSYSTEM_NAME)); rootRbacRegistration.registerSubModel(new ConstrainedResource(PathElement.pathElement("rbac-constrained"))); rootRbacRegistration.registerSubModel(new SensitiveResource(PathElement.pathElement("rbac-sensitive"))); }
Example 6
Source File: KeycloakExtension.java From keycloak with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void initialize(final ExtensionContext context) { ROOT_LOGGER.debug("Activating Keycloak Extension"); final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, MGMT_API_VERSION); ManagementResourceRegistration subsystemRegistration = subsystem.registerSubsystemModel(KEYCLOAK_SUBSYSTEM_RESOURCE); subsystemRegistration.registerSubModel(THEME_DEFINITION); ManagementResourceRegistration spiRegistration = subsystemRegistration.registerSubModel(SPI_DEFINITION); spiRegistration.registerSubModel(PROVIDER_DEFINITION); subsystem.registerXMLElementWriter(PARSER); }
Example 7
Source File: CamelRootResource.java From wildfly-camel with Apache License 2.0 | 5 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel(new CamelContextResource(subsystemState)); if (registerRuntimeOnly) { AttributeDefinition eldef = new SimpleAttributeDefinitionBuilder("dummy", ModelType.STRING, false).build(); AttributeDefinition attdef = new SimpleListAttributeDefinition.Builder(ModelConstants.ENDPOINTS, eldef).setStorageRuntime().build(); resourceRegistration.registerReadOnlyAttribute(attdef, new CamelRuntimeOnlyHandler()); } }
Example 8
Source File: BadReadHandlerAttributeTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void initModel(ManagementModel managementModel) { ManagementResourceRegistration registration = managementModel.getRootResourceRegistration(); GlobalOperationHandlers.registerGlobalOperations(registration, processType); GlobalNotifications.registerGlobalNotifications(registration, processType); registration.registerSubModel(new TestResource()); }
Example 9
Source File: TrivialResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { if (children != null) { for (ResourceDefinition child : children) { resourceRegistration.registerSubModel(child); } } }
Example 10
Source File: WorkerResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { super.registerChildren(resourceRegistration); resourceRegistration.registerSubModel(OutboundBindAddressResourceDefinition.getInstance()); // Don't register on a domain profile, as there are no services to back the resource // We could check if (resourceRegistration.getProcessType().isServer()) instead but // if we ever support this extension as an HC subsystem (which seems reasonably possible) // by doing it this way it will still behave correctly. if (!PROFILE.equals(resourceRegistration.getPathAddress().getElement(0).getKey())) { resourceRegistration.registerSubModel(new WorkerServerDefinition()); } }
Example 11
Source File: WriteAttributeTestCase.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected void initModel(ManagementModel managementModel) { ManagementResourceRegistration registration = managementModel.getRootResourceRegistration(); GlobalOperationHandlers.registerGlobalOperations(registration, ProcessType.EMBEDDED_SERVER); GlobalNotifications.registerGlobalNotifications(registration, ProcessType.EMBEDDED_SERVER); registration.registerSubModel(new TestResourceDefinition(UNCONSTRAINED_RESOURCE)); registration.registerSubModel(new TestResourceDefinition(SENSITIVE_CONSTRAINED_RESOURCE, MY_SENSITIVE_CONSTRAINT)); registration.registerSubModel(new TestResourceDefinition(APPLICATION_CONSTRAINED_RESOURCE, MY_APPLICATION_CONSTRAINT)); }
Example 12
Source File: RemotingSubsystemTestUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
static void registerIOExtension(ExtensionRegistry extensionRegistry, ManagementResourceRegistration rootRegistration) { ManagementResourceRegistration extReg = rootRegistration.registerSubModel(new SimpleResourceDefinition(PathElement.pathElement(EXTENSION, "org.wildfly.extension.io"), NonResolvingResourceDescriptionResolver.INSTANCE, new ModelOnlyAddStepHandler(), ModelOnlyRemoveStepHandler.INSTANCE)); extReg.registerReadOnlyAttribute(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).build(), null); Extension ioe = new IOExtension(); ioe.initialize(extensionRegistry.getExtensionContext("org.wildfly.extension.io", rootRegistration, ExtensionRegistryType.MASTER)); }
Example 13
Source File: HostModelUtil.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
public static void createRootRegistry(final ManagementResourceRegistration root, final HostControllerEnvironment environment, final IgnoredDomainResourceRegistry ignoredDomainResourceRegistry, final HostModelRegistrar hostModelRegistrar, final ProcessType processType, final DelegatingConfigurableAuthorizer authorizer, final Resource modelControllerResource, final LocalHostControllerInfoImpl localHostControllerInfo, final ImmutableCapabilityRegistry capabilityRegistry) { // register HostDefinition for /host=*:add() root.registerSubModel(new HostDefinition(root, environment, ignoredDomainResourceRegistry, hostModelRegistrar, processType, authorizer, modelControllerResource, localHostControllerInfo)); // Global operations GlobalOperationHandlers.registerGlobalOperations(root, processType); root.registerOperationHandler(ReadFeatureDescriptionHandler.DEFINITION, ReadFeatureDescriptionHandler.getInstance(capabilityRegistry), true); // Global notifications GlobalNotifications.registerGlobalNotifications(root, processType); if (root.getOperationEntry(PathAddress.EMPTY_ADDRESS, ValidateOperationHandler.DEFINITION.getName())==null){//this is hack root.registerOperationHandler(ValidateOperationHandler.DEFINITION, ValidateOperationHandler.INSTANCE); } root.registerOperationHandler(WhoAmIOperation.DEFINITION, WhoAmIOperation.createOperation(authorizer), true); // Other root resource operations root.registerOperationHandler(CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE); }
Example 14
Source File: TestModelControllerService.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void initExtraModelInternal(Resource rootResource, ManagementResourceRegistration rootRegistration) { rootResource.getModel().get(SUBSYSTEM); rootRegistration.registerSubModel(ServerDeploymentResourceDefinition.create(contentRepository, null, null)); controllerInitializer.setTestModelControllerAccessor(this); controllerInitializer.initializeModel(rootResource, rootRegistration); }
Example 15
Source File: RemoteOutboundConnectionResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel(new PropertyResource(CommonAttributes.REMOTE_OUTBOUND_CONNECTION)); }
Example 16
Source File: TestAliasReadResourceDescriptionAddressExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel(new ThingResourceDefinition()); }
Example 17
Source File: SensitivityClassificationTypeResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel(SensitivityResourceDefinition.createSensitivityClassification()); }
Example 18
Source File: ServerRootResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { // Server environment resourceRegistration.registerSubModel(ServerEnvironmentResourceDescription.of(serverEnvironment)); // System Properties resourceRegistration.registerSubModel(SystemPropertyResourceDefinition.createForStandaloneServer(serverEnvironment)); //vault resourceRegistration.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 final EnvironmentNameReader environmentReader = new EnvironmentNameReader() { public boolean isServer() { return true; } public String getServerName() { return serverEnvironment.getServerName(); } public String getHostName() { return serverEnvironment.getHostControllerName(); } public String getProductName() { if (serverEnvironment.getProductConfig() != null && serverEnvironment.getProductConfig().getProductName() != null) { return serverEnvironment.getProductConfig().getProductName(); } return null; } }; final ResourceDefinition managementDefinition; if (isDomain) { managementDefinition = CoreManagementResourceDefinition.forDomainServer(authorizer, securityIdentitySupplier, auditLogger, pathManager, environmentReader, bootErrorCollector); } else { managementDefinition = CoreManagementResourceDefinition.forStandaloneServer(authorizer, securityIdentitySupplier, auditLogger, pathManager, environmentReader, bootErrorCollector, NativeManagementResourceDefinition.INSTANCE, NativeRemotingManagementResourceDefinition.INSTANCE, HttpManagementResourceDefinition.INSTANCE); } resourceRegistration.registerSubModel(managementDefinition); // Other core services resourceRegistration.registerSubModel(new ServiceContainerResourceDefinition()); //module loading resourceRegistration.registerSubModel(ModuleLoadingResourceDefinition.INSTANCE); // Platform MBeans PlatformMBeanResourceRegistrar.registerPlatformMBeanResources(resourceRegistration); // Paths // TODO why not resolvable? resourceRegistration.registerSubModel(PathResourceDefinition.createSpecified(pathManager)); //capability registry resourceRegistration.registerSubModel(new CapabilityRegistryResourceDefinition(capabilityRegistry)); // Interfaces ManagementResourceRegistration interfaces = resourceRegistration.registerSubModel(new InterfaceResourceDefinition( SpecifiedInterfaceAddHandler.INSTANCE, SpecifiedInterfaceRemoveHandler.INSTANCE, true, false )); interfaces.registerReadOnlyAttribute(NetworkInterfaceRuntimeHandler.RESOLVED_ADDRESS, NetworkInterfaceRuntimeHandler.INSTANCE); interfaces.registerOperationHandler(SpecifiedInterfaceResolveHandler.DEFINITION, SpecifiedInterfaceResolveHandler.INSTANCE); resourceRegistration.registerSubModel(SocketBindingGroupResourceDefinition.INSTANCE); // Deployments ManagementResourceRegistration deployments = resourceRegistration.registerSubModel(ServerDeploymentResourceDefinition.create(contentRepository, vaultReader, serverEnvironment)); //deployment overlays resourceRegistration.registerSubModel(new DeploymentOverlayDefinition(false, contentRepository, null)); // The sub-deployments registry deployments.registerSubModel(ServerSubDeploymentResourceDefinition.create()); // Extensions resourceRegistration.registerSubModel(new ExtensionResourceDefinition(extensionRegistry, parallelBoot, ExtensionRegistryType.SERVER, rootResourceRegistrationProvider)); extensionRegistry.setPathManager(pathManager); // Util resourceRegistration.registerOperationHandler(DeployerChainAddHandler.DEFINITION, DeployerChainAddHandler.INSTANCE, false); }
Example 19
Source File: LoggingExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private void registerSubModels(final ManagementResourceRegistration registration, final boolean includeLegacyAttributes, final SubsystemRegistration subsystem, final LoggingResourceDefinition subsystemResourceDefinition, final boolean registerTransformers, final PathManager pathManager) { // Only register if the path manager is not null, e.g. is a server ResolvePathHandler resolvePathHandler = null; PathInfoHandler diskUsagePathHandler = null; if (pathManager != null) { resolvePathHandler = ResolvePathHandler.Builder.of(pathManager) .setParentAttribute(CommonAttributes.FILE) .build(); diskUsagePathHandler = PathInfoHandler.Builder.of(pathManager) .setParentAttribute(CommonAttributes.FILE) .addAttribute(PathResourceDefinition.PATH, PathResourceDefinition.RELATIVE_TO) .build(); final LogFileResourceDefinition logFileResourceDefinition = new LogFileResourceDefinition(pathManager); registration.registerSubModel(logFileResourceDefinition); } final RootLoggerResourceDefinition rootLoggerResourceDefinition = new RootLoggerResourceDefinition(includeLegacyAttributes); registration.registerSubModel(rootLoggerResourceDefinition); final LoggerResourceDefinition loggerResourceDefinition = new LoggerResourceDefinition(includeLegacyAttributes); registration.registerSubModel(loggerResourceDefinition); final AsyncHandlerResourceDefinition asyncHandlerResourceDefinition = new AsyncHandlerResourceDefinition(includeLegacyAttributes); registration.registerSubModel(asyncHandlerResourceDefinition); final ConsoleHandlerResourceDefinition consoleHandlerResourceDefinition = new ConsoleHandlerResourceDefinition(includeLegacyAttributes); registration.registerSubModel(consoleHandlerResourceDefinition); final FileHandlerResourceDefinition fileHandlerResourceDefinition = new FileHandlerResourceDefinition(resolvePathHandler, diskUsagePathHandler, includeLegacyAttributes); registration.registerSubModel(fileHandlerResourceDefinition); final PeriodicHandlerResourceDefinition periodicHandlerResourceDefinition = new PeriodicHandlerResourceDefinition(resolvePathHandler, diskUsagePathHandler, includeLegacyAttributes); registration.registerSubModel(periodicHandlerResourceDefinition); final PeriodicSizeRotatingHandlerResourceDefinition periodicSizeRotatingHandlerResourceDefinition = new PeriodicSizeRotatingHandlerResourceDefinition(resolvePathHandler, diskUsagePathHandler); registration.registerSubModel(periodicSizeRotatingHandlerResourceDefinition); final SizeRotatingHandlerResourceDefinition sizeRotatingHandlerResourceDefinition = new SizeRotatingHandlerResourceDefinition(resolvePathHandler, includeLegacyAttributes); registration.registerSubModel(sizeRotatingHandlerResourceDefinition); final CustomHandlerResourceDefinition customHandlerResourceDefinition = new CustomHandlerResourceDefinition(includeLegacyAttributes); registration.registerSubModel(customHandlerResourceDefinition); registration.registerSubModel(SyslogHandlerResourceDefinition.INSTANCE); registration.registerSubModel(PatternFormatterResourceDefinition.INSTANCE); registration.registerSubModel(CustomFormatterResourceDefinition.INSTANCE); registration.registerSubModel(JsonFormatterResourceDefinition.INSTANCE); registration.registerSubModel(XmlFormatterResourceDefinition.INSTANCE); registration.registerSubModel(SocketHandlerResourceDefinition.INSTANCE); registration.registerSubModel(FilterResourceDefinition.INSTANCE); if (registerTransformers) { registerTransformers(subsystem, subsystemResourceDefinition, rootLoggerResourceDefinition, loggerResourceDefinition, asyncHandlerResourceDefinition, consoleHandlerResourceDefinition, fileHandlerResourceDefinition, periodicHandlerResourceDefinition, periodicSizeRotatingHandlerResourceDefinition, sizeRotatingHandlerResourceDefinition, customHandlerResourceDefinition, SyslogHandlerResourceDefinition.INSTANCE, PatternFormatterResourceDefinition.INSTANCE, CustomFormatterResourceDefinition.INSTANCE, JsonFormatterResourceDefinition.INSTANCE, XmlFormatterResourceDefinition.INSTANCE, SocketHandlerResourceDefinition.INSTANCE, FilterResourceDefinition.INSTANCE); } }
Example 20
Source File: MemoryPoolRootResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { super.registerChildren(resourceRegistration); resourceRegistration.registerSubModel(MemoryPoolResourceDefinition.INSTANCE); }