@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel( TlsKeyStore.createTrustStore(auditLogger, pathManager, environmentReader)); resourceRegistration.registerSubModel( TlsKeyStore.createClientCertStore(auditLogger, pathManager, environmentReader)); }
@SuppressWarnings("deprecation") @Override public void registerReadOnlyAttribute( String attributeName, OperationStepHandler readHandler, AttributeAccess.Storage storage) { deployments.registerReadOnlyAttribute(attributeName, readHandler, storage); subdeployments.registerReadOnlyAttribute(attributeName, readHandler, storage); }
@Override protected void initModel(Resource rootResource, ManagementResourceRegistration registration) { registration.registerOperationHandler( CompositeOperationHandler.DEFINITION, CompositeOperationHandler.INSTANCE); registration.registerOperationHandler( new SimpleOperationDefinitionBuilder( MY_OPERATION, new NonResolvingResourceDescriptionResolver()) .setParameters(FAIL_OPERATION) .setPrivateEntry() .build(), new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Notification notification = new Notification( MY_NOTIFICATION_TYPE, pathAddress(operation.get(OP_ADDR)), operation.get("param").asString()); context.emit(notification); boolean failOperation = FAIL_OPERATION.resolveModelAttribute(context, operation).asBoolean(); if (failOperation) { throw new OperationFailedException("failed operation"); } context.stepCompleted(); } }); }
public void initialize(ExtensionContext context) { final DescriptionProvider subsystemDescription = new DescriptionProvider() { public ModelNode getModelDescription(Locale locale) { return JdrReportDescriptions.getJdrSubsystemDescription(locale); } }; SubsystemRegistration subsystemRegistration = context.registerSubsystem(SUBSYSTEM_NAME, 1, 0); ManagementResourceRegistration root = subsystemRegistration.registerSubsystemModel(subsystemDescription); root.registerOperationHandler( JdrReportSubsystemAdd.OPERATION_NAME, JdrReportSubsystemAdd.INSTANCE, JdrReportSubsystemAdd.INSTANCE); root.registerOperationHandler( DESCRIBE, JdrSubsystemDescribeHandler.INSTANCE, JdrSubsystemDescribeHandler.INSTANCE, false, OperationEntry.EntryType.PRIVATE); root.registerOperationHandler( JdrReportSubsystemRemove.OPERATION_NAME, JdrReportSubsystemRemove.INSTANCE, JdrReportSubsystemRemove.INSTANCE); if (context.isRuntimeOnlyRegistrationValid()) { root.registerOperationHandler( JdrReportRequestHandler.OPERATION_NAME, JdrReportRequestHandler.INSTANCE, JdrReportRequestHandler.INSTANCE); } subsystemRegistration.registerXMLElementWriter(JdrReportSubsystemParser.INSTANCE); }
@Override public void registerOperations(ManagementResourceRegistration registration) { super.registerOperations(registration); final OperationDefinition SET_ROOT_LOGGER_DEFINITION = new SimpleOperationDefinition( ROOT_LOGGER_ADD_OPERATION_NAME, getResourceDescriptionResolver(), ATTRIBUTES); registration.registerOperationHandler( SET_ROOT_LOGGER_DEFINITION, RootLoggerResourceDefinition.ADD_ROOT_LOGGER); registration.registerOperationHandler( new SimpleOperationDefinition( ROOT_LOGGER_REMOVE_OPERATION_NAME, getResourceDescriptionResolver()), LoggerOperations.REMOVE_LOGGER); registration.registerOperationHandler( new SimpleOperationDefinition( ROOT_LOGGER_CHANGE_LEVEL_OPERATION_NAME, getResourceDescriptionResolver(), CommonAttributes.LEVEL), LoggerOperations.CHANGE_LEVEL); registration.registerOperationHandler( new SimpleOperationDefinition( ROOT_LOGGER_ADD_HANDLER_OPERATION_NAME, getResourceDescriptionResolver(), CommonAttributes.HANDLER_NAME), LoggerOperations.ADD_HANDLER); registration.registerOperationHandler( new SimpleOperationDefinition( ROOT_LOGGER_REMOVE_HANDLER_OPERATION_NAME, getResourceDescriptionResolver(), CommonAttributes.HANDLER_NAME), LoggerOperations.REMOVE_HANDLER); }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { final OperationStepHandler writeHandler = new ReloadRequiredWriteAttributeHandler(AUTHENTICATION_PROVIDER, SOCKET_BINDING); resourceRegistration.registerReadWriteAttribute(AUTHENTICATION_PROVIDER, null, writeHandler); resourceRegistration.registerReadWriteAttribute(SOCKET_BINDING, null, writeHandler); }
@Override protected void initModel(ManagementModel managementModel) { ManagementResourceRegistration registration = managementModel.getRootResourceRegistration(); GlobalOperationHandlers.registerGlobalOperations(registration, ProcessType.STANDALONE_SERVER); NotificationDefinition notificationDefinition = NotificationDefinition.Builder.create( MY_TYPE, new NonResolvingResourceDescriptionResolver() { @Override public String getNotificationDescription( String notificationType, Locale locale, ResourceBundle bundle) { return NOTIFICATION_DESCRIPTION; } }) .setDataValueDescriptor( new NotificationDefinition.DataValueDescriptor() { @Override public ModelNode describe(ResourceBundle bundle) { return DATA_TYPE_DESCRIPTION; } }) .build(); registration.registerNotification(notificationDefinition); }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { MaxRequestsWriteHandler handler = new MaxRequestsWriteHandler(MAX_REQUESTS, requestController); resourceRegistration.registerReadWriteAttribute(MAX_REQUESTS, null, handler); resourceRegistration.registerMetric( ACTIVE_REQUESTS, new ActiveRequestsReadHandler(requestController)); }
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel( LdapCacheResourceDefinition.createByAccessTime(CacheFor.AuthUser)); resourceRegistration.registerSubModel( LdapCacheResourceDefinition.createBySearchTime(CacheFor.AuthUser)); }
@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); } } }
@Override public void registerReadWriteAttribute( AttributeDefinition definition, OperationStepHandler readHandler, OperationStepHandler writeHandler) { deployments.registerReadWriteAttribute(definition, readHandler, writeHandler); subdeployments.registerReadWriteAttribute(definition, readHandler, writeHandler); }
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { if (deployed) { resourceRegistration.registerSubModel(XaDataSourcePropertyDefinition.DEPLOYED_INSTANCE); } else { resourceRegistration.registerSubModel(XaDataSourcePropertyDefinition.INSTANCE); } }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { super.registerAttributes(resourceRegistration); resourceRegistration.registerReadWriteAttribute( BASE_ROLE, null, new ReloadRequiredWriteAttributeHandler(BASE_ROLE)); resourceRegistration.registerReadWriteAttribute(HOSTS, null, writeAttributeHandler); }
@Override public void registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); resourceRegistration.registerOperationHandler( GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE); resourceRegistration.registerOperationHandler( MigrateJsonOperation.DEFINITION, new MigrateJsonOperation()); }
@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 @SuppressWarnings("deprecation") public void registerOperationHandler( String operationName, OperationStepHandler handler, DescriptionProvider descriptionProvider) { deployments.registerOperationHandler(operationName, handler, descriptionProvider); subdeployments.registerOperationHandler(operationName, handler, descriptionProvider); }
@Override public void registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); // register add-alias and remove-alias resourceRegistration.registerOperationHandler( CacheContainerResourceDefinition.ALIAS_ADD, AddAliasCommand.INSTANCE); resourceRegistration.registerOperationHandler( CacheContainerResourceDefinition.ALIAS_REMOVE, RemoveAliasCommand.INSTANCE); }
@Override public ManagementResourceRegistration registerOverrideModel( String name, OverrideDescriptionProvider descriptionProvider) { ManagementResourceRegistration depl = deployments.registerOverrideModel(name, descriptionProvider); ManagementResourceRegistration subdepl = subdeployments.registerOverrideModel(name, descriptionProvider); return new DeploymentManagementResourceRegistration(depl, subdepl); }
@SuppressWarnings("deprecation") @Override public void registerMetric( String attributeName, OperationStepHandler metricHandler, EnumSet<AttributeAccess.Flag> flags) { deployments.registerMetric(attributeName, metricHandler, flags); subdeployments.registerMetric(attributeName, metricHandler, flags); }
@Override public ManagementResourceRegistration registerDeploymentModel( ResourceDefinition resourceDefinition) { assert resourceDefinition != null : "resourceDefinition is null"; final ManagementResourceRegistration deploymentsReg = deploymentsRegistration; ManagementResourceRegistration base = deploymentsReg != null ? deploymentsReg : getDummyRegistration(); return base.registerSubModel(resourceDefinition); }
@Override public void registerOperations(final ManagementResourceRegistration registration) { super.registerOperations(registration); registration.registerOperationHandler(LEGACY_ADD_HANDLER, HandlerOperations.ADD_SUBHANDLER); registration.registerOperationHandler( LEGACY_REMOVE_HANDLER, HandlerOperations.REMOVE_SUBHANDLER); registration.registerOperationHandler(ADD_HANDLER, HandlerOperations.ADD_SUBHANDLER); registration.registerOperationHandler(REMOVE_HANDLER, HandlerOperations.REMOVE_SUBHANDLER); }
@SuppressWarnings("deprecation") @Override public void registerReadWriteAttribute( String attributeName, OperationStepHandler readHandler, OperationStepHandler writeHandler, EnumSet<AttributeAccess.Flag> flags) { deployments.registerReadWriteAttribute(attributeName, readHandler, writeHandler, flags); subdeployments.registerReadWriteAttribute(attributeName, readHandler, writeHandler, flags); }
@SuppressWarnings("deprecation") @Override public ManagementResourceRegistration registerSubModel( PathElement address, DescriptionProvider descriptionProvider) { ManagementResourceRegistration depl = deployments.registerSubModel(address, descriptionProvider); ManagementResourceRegistration subdepl = subdeployments.registerSubModel(address, descriptionProvider); return new DeploymentManagementResourceRegistration(depl, subdepl); }
@Override public void registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); resourceRegistration.registerOperationHandler( GET_PROVIDER_POINTS, (context, operation) -> { final ModelNode model = new ModelNode(); NAME.validateAndSet(operation, model); final String name = NAME.resolveModelAttribute(context, model).asString(); CapabilityId id = new CapabilityId( name, CapabilityScope.GLOBAL); // for possible capabilities it is always global Set<PathAddress> providerPoints = capabilityRegistry.getPossibleProviderPoints(id); for (PathAddress point : providerPoints) { context.getResult().add(point.toCLIStyleString()); } }); resourceRegistration.registerOperationHandler( GET_CAPABILITY, (context, operation) -> { final ModelNode model = new ModelNode(); NAME.validateAndSet(operation, model); SCOPE.validateAndSet(operation, model); final String name = NAME.resolveModelAttribute(context, model).asString(); final CapabilityScope scope; if (model.hasDefined(SCOPE.getName())) { String scopeName = SCOPE.resolveModelAttribute(context, model).asString(); scope = CapabilityScope.Factory.forName(scopeName); } else { scope = CapabilityScope.GLOBAL; } CapabilityId id = new CapabilityId(name, scope); CapabilityRegistration reg = capabilityRegistry.getCapability(id); if (reg != null) { ModelNode result = context.getResult(); populateCapabilityRegistration(reg, result); } }); resourceRegistration.registerOperationHandler( SUGGEST_CAPABILITIES, (context, operation) -> { final String name = NAME.resolveModelAttribute(context, operation).asString(); PathAddress address = PathAddress.pathAddress(DEPENDENT_ADDRESS.resolveModelAttribute(context, operation)); CapabilityScope dependentScope = CapabilityScope.Factory.create(context.getProcessType(), address); Set<String> capabilities = capabilityRegistry.getDynamicCapabilityNames(name, dependentScope); for (String capability : capabilities) { context.getResult().add(capability); } }); }
// override the add operation to provide a custom definition (for the optional PROPERTIES // parameter to add()) @Override protected void registerAddOperation( final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) { registration.registerOperationHandler(FILE_STORE_ADD_DEFINITION, handler); if (resolvePathHandler != null) { registration.registerOperationHandler( resolvePathHandler.getOperationDefinition(), resolvePathHandler); } }
protected ManagementResourceRegistration initializeSubsystem( final SubsystemRegistration registration) { // Common subsystem tasks final ResourceDefinition def = createResourceDefinition(SUBSYSTEM_PATH); registration.registerXMLElementWriter(getParser()); final ManagementResourceRegistration reg = registration.registerSubsystemModel(def); reg.registerReadWriteAttribute( TEST_ATTRIBUTE, null, new BasicAttributeWriteHandler(TEST_ATTRIBUTE)); return reg; }
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { final OperationStepHandler writeHandler = new ReloadRequiredWriteAttributeHandler( AUTHENTICATION_PROVIDER, SOCKET_BINDING, SECURITY_REALM, SERVER_NAME, SASL_PROTOCOL); resourceRegistration.registerReadWriteAttribute(AUTHENTICATION_PROVIDER, null, writeHandler); resourceRegistration.registerReadWriteAttribute(SOCKET_BINDING, null, writeHandler); resourceRegistration.registerReadWriteAttribute(SECURITY_REALM, null, writeHandler); resourceRegistration.registerReadWriteAttribute(SERVER_NAME, null, writeHandler); resourceRegistration.registerReadWriteAttribute(SASL_PROTOCOL, null, writeHandler); }
@Override public void registerOperations(final ManagementResourceRegistration registration) { super.registerOperations(registration); registration.registerOperationHandler( new SimpleOperationDefinition( CHANGE_FILE_OPERATION_NAME, getResourceDescriptionResolver(), CommonAttributes.FILE), HandlerOperations.CHANGE_FILE); if (resolvePathHandler != null) registration.registerOperationHandler( resolvePathHandler.getOperationDefinition(), resolvePathHandler); }
@Override public void unregisterRunningServer(String serverName) { PathAddress pa = PathAddress.pathAddress( PathElement.pathElement(HOST, hostControllerInfo.getLocalHostName())); PathElement pe = PathElement.pathElement(RUNNING_SERVER, serverName); ROOT_LOGGER.unregisteringServer(serverName); ManagementResourceRegistration hostRegistration = modelNodeRegistration.getSubModel(pa); hostRegistration.unregisterProxyController(pe); serverProxies.remove(serverName); }
@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)); }