Java Code Examples for org.jboss.as.controller.registry.ManagementResourceRegistration#registerOperationHandler()

The following examples show how to use org.jboss.as.controller.registry.ManagementResourceRegistration#registerOperationHandler() . 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: ServerDeploymentResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    resourceRegistration.registerOperationHandler(DeploymentAttributes.DEPLOY_DEFINITION, new DeploymentDeployHandler(vaultReader));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.UNDEPLOY_DEFINITION, new DeploymentUndeployHandler(vaultReader));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.REDEPLOY_DEFINITION, new DeploymentRedeployHandler(vaultReader));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.EXPLODE_DEFINITION, new DeploymentExplodeHandler(contentRepository));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.DEPLOYMENT_ADD_CONTENT_DEFINITION, new ExplodedDeploymentAddContentHandler(contentRepository, serverEnvironment));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.DEPLOYMENT_REMOVE_CONTENT_DEFINITION, new ExplodedDeploymentRemoveContentHandler(contentRepository, serverEnvironment));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.DEPLOYMENT_READ_CONTENT_DEFINITION, new ManagedDeploymentReadContentHandler(contentRepository));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.DEPLOYMENT_BROWSE_CONTENT_DEFINITION, new ManagedDeploymentBrowseContentHandler(contentRepository));
    resourceRegistration.registerOperationHandler(DeploymentAttributes.LIST_MODULES, new DeploymentListModulesHandler());
}
 
Example 2
Source File: PatchResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void registerPatchingOperations(ManagementResourceRegistration registry, boolean patchOp) {
    registry.registerOperationHandler(ROLLBACK, LocalPatchRollbackHandler.INSTANCE);
    registry.registerOperationHandler(ROLLBACK_LAST, LocalPatchRollbackLastHandler.INSTANCE);
    if(patchOp) {
        registry.registerOperationHandler(PATCH, LocalPatchOperationStepHandler.INSTANCE);
    }
    registry.registerOperationHandler(SHOW_HISTORY, LocalShowHistoryHandler.INSTANCE);
    registry.registerOperationHandler(AGEOUT_HISTORY, LocalAgeoutHistoryHandler.INSTANCE);
    registry.registerOperationHandler(PATCH_INFO, PatchInfoHandler.INSTANCE);
}
 
Example 3
Source File: SimpleResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Deprecated
@SuppressWarnings("deprecation")
protected void registerRemoveOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler,
                                       OperationEntry.Flag... flags) {
    if (handler instanceof DescriptionProvider) {
        registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.REMOVE,
                                        (DescriptionProvider) handler, Collections.emptyList(), OperationEntry.EntryType.PUBLIC,flags)
                                       , handler);
    } else {
        OperationDefinition opDef = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, descriptionResolver)
                .withFlags(flags)
                .build();
        registration.registerOperationHandler(opDef, handler);
    }
}
 
Example 4
Source File: TestModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void initExtraModel(ManagementModel managementModel) {
    Resource rootResource = managementModel.getRootResource();
    ManagementResourceRegistration rootRegistration = managementModel.getRootResourceRegistration();
    initExtraModelInternal(rootResource, rootRegistration);
    additionalInit.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration,
            managementModel.getCapabilityRegistry());
    rootRegistration.registerOperationHandler(TransformerAttachmentGrabber.DESC, new TransformerAttachmentGrabber());
    // register the global notifications so there is no warning that emitted notifications are not described by the resource.
    GlobalNotifications.registerGlobalNotifications(managementModel.getRootResourceRegistration(), processType);
}
 
Example 5
Source File: LoggerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration registration) {
    super.registerOperations(registration);

    registration.registerOperationHandler(CHANGE_LEVEL_OPERATION, LoggerOperations.CHANGE_LEVEL);
    registration.registerOperationHandler(ADD_HANDLER_OPERATION, LoggerOperations.ADD_HANDLER);
    registration.registerOperationHandler(REMOVE_HANDLER_OPERATION, LoggerOperations.REMOVE_HANDLER);
    registration.registerOperationHandler(LEGACY_ADD_HANDLER_OPERATION, LoggerOperations.ADD_HANDLER);
    registration.registerOperationHandler(LEGACY_REMOVE_HANDLER_OPERATION, LoggerOperations.REMOVE_HANDLER);
}
 
Example 6
Source File: VersionedExtensionCommon.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected ManagementResourceRegistration initializeSubsystem(final SubsystemRegistration registration) {
    // Common subsystem tasks
    registration.registerXMLElementWriter(getParser());

    final ManagementResourceRegistration reg = registration.registerSubsystemModel(new TestResourceDefinition(SUBSYSTEM_PATH, new TestModelOnlyAddHandler(TEST_ATTRIBUTE)) {
        @Override
        public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
            resourceRegistration.registerReadWriteAttribute(TEST_ATTRIBUTE, null, new BasicAttributeWriteHandler(TEST_ATTRIBUTE));
        }
    });
    reg.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    return reg;
}
 
Example 7
Source File: MainSubsystemExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, ModelVersion.create(1));
    final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new SimpleResourceDefinition(
            PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME),
            new NonResolvingResourceDescriptionResolver(),
            MainSubsystemAdd.INSTANCE,
            ReloadRequiredRemoveStepHandler.INSTANCE
    ));
    //We always need to add a 'describe' operation
    registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);

    subsystem.registerXMLElementWriter(parser);
}
 
Example 8
Source File: ModifiableRealmDecorator.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void register(ManagementResourceRegistration resourceRegistration, ResourceDescriptionResolver descriptionResolver) {
    resourceRegistration.registerOperationHandler(
            new SimpleOperationDefinitionBuilder(ElytronDescriptionConstants.READ_IDENTITY, descriptionResolver)
                    .setParameters(IDENTITY)
                    .setRuntimeOnly()
                    .setReadOnly()
                    .build(),
            new ReadIdentityHandler());
}
 
Example 9
Source File: AccessAuthorizationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    if (isDomain) {
        // Op to apply config from the master to a slave
        resourceRegistration.registerOperationHandler(AccessAuthorizationDomainSlaveConfigHandler.DEFINITION,
                new AccessAuthorizationDomainSlaveConfigHandler(configurableAuthorizer));
    }
}
 
Example 10
Source File: PlatformMBeanTestModelControllerService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void initModel(ManagementModel managementModel, Resource modelControllerResource) {
    ManagementResourceRegistration rootRegistration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(rootRegistration, processType);
    rootRegistration.registerOperationHandler(ValidateAddressOperationHandler.DEFINITION, ValidateAddressOperationHandler.INSTANCE);

    GlobalNotifications.registerGlobalNotifications(rootRegistration, processType);

    // Platform mbeans
    PlatformMBeanResourceRegistrar.registerPlatformMBeanResources(rootRegistration);
    managementModel.getRootResource().registerChild(PlatformMBeanConstants.ROOT_PATH, new RootPlatformMBeanResource());
}
 
Example 11
Source File: AdvancedModifiableKeyStoreDecorator.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void register(ManagementResourceRegistration resourceRegistration, ResourceDescriptionResolver descriptionResolver) {
    resourceRegistration.registerOperationHandler(
            new SimpleOperationDefinitionBuilder(ElytronDescriptionConstants.OBTAIN_CERTIFICATE, descriptionResolver)
                    .setParameters(ALIAS, DOMAIN_NAMES, CERTIFICATE_AUTHORITY_ACCOUNT, AGREE_TO_TERMS_OF_SERVICE, STAGING, ALGORITHM, KEY_SIZE, CREDENTIAL_REFERENCE)
                    .setRuntimeOnly()
                    .build(),
            new ObtainCertificateHandler());
}
 
Example 12
Source File: DetailedOperationsTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);

    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_CONFIG));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_RUNTIME));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_CONFIG));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_RUNTIME));

    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_CONFIG_READ_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_CONFIG, Action.ActionEffect.READ_RUNTIME));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_CONFIG_WRITE_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_CONFIG, Action.ActionEffect.WRITE_RUNTIME));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_CONFIG_READ_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_CONFIG, Action.ActionEffect.READ_RUNTIME));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_CONFIG_WRITE_RUNTIME_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_CONFIG, Action.ActionEffect.WRITE_RUNTIME));

    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_RUNTIME_READ_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_RUNTIME, Action.ActionEffect.READ_CONFIG));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_RUNTIME_READ_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_RUNTIME, Action.ActionEffect.READ_CONFIG));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.READ_RUNTIME_WRITE_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.READ_RUNTIME, Action.ActionEffect.WRITE_CONFIG));
    resourceRegistration.registerOperationHandler(TestOperationStepHandler.WRITE_RUNTIME_WRITE_CONFIG_DEFINITION,
            new TestOperationStepHandler(Action.ActionEffect.WRITE_RUNTIME, Action.ActionEffect.WRITE_CONFIG));
}
 
Example 13
Source File: ReadResourceChildOrderingTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void initModel(ManagementModel managementModel) {
    ManagementResourceRegistration registration = managementModel.getRootResourceRegistration();
    GlobalOperationHandlers.registerGlobalOperations(registration, processType);
    registration.registerOperationHandler(new SimpleOperationDefinitionBuilder("setup", new NonResolvingResourceDescriptionResolver())
            .setPrivateEntry()
            .build()
            , new OperationStepHandler() {
        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            createModel(context, model);
        }
    });

    GlobalNotifications.registerGlobalNotifications(registration, processType);

    ManagementResourceRegistration child = registration.registerSubModel(new SimpleResourceDefinition(testSubsystem, new NonResolvingResourceDescriptionResolver()));
    child.registerReadOnlyAttribute(TestUtils.createNillableAttribute("prop", ModelType.STRING), null);



    for(Map.Entry<String, String> entry : data.entrySet() ) {
        child.registerReadOnlyAttribute(TestUtils.createAttribute(entry.getKey(), ModelType.STRING, entry.getValue(), true), null);
    }

    managementModel.getRootResource().getModel().set(model);
}
 
Example 14
Source File: AdvancedModifiableKeyStoreDecorator.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static void register(ManagementResourceRegistration resourceRegistration, ResourceDescriptionResolver descriptionResolver) {
    resourceRegistration.registerOperationHandler(
            new SimpleOperationDefinitionBuilder(ElytronDescriptionConstants.IMPORT_CERTIFICATE, descriptionResolver)
                    .setParameters(ALIAS, CREDENTIAL_REFERENCE, PATH, RELATIVE_TO, TRUST_CACERTS, VALIDATE)
                    .setRuntimeOnly()
                    .build(),
            new ImportCertificateHandler());
}
 
Example 15
Source File: ServerGroupScopedRoleResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    registerAddOperation(resourceRegistration, addHandler);
    OperationDefinition removeDef = new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, getResourceDescriptionResolver())
            .build();
    resourceRegistration.registerOperationHandler(removeDef, removeHandler);
}
 
Example 16
Source File: BlockerExtension.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    resourceRegistration.registerOperationHandler(BlockHandler.DEFINITION, new BlockHandler());
    if (forHost) {
        resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    }
    // Don't remove this as some tests check for it in the log
    log.info(REGISTERED_MESSAGE);
}
 
Example 17
Source File: DeploymentOverlayDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    for (Entry<OperationDefinition, OperationStepHandler> operation : operations.entrySet()) {
        resourceRegistration.registerOperationHandler(operation.getKey(), operation.getValue());
    }
}
 
Example 18
Source File: KeycloakSubsystemDefinition.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    resourceRegistration.registerOperationHandler(MigrateJsonOperation.DEFINITION, new MigrateJsonOperation());
}
 
Example 19
Source File: RootResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
}
 
Example 20
Source File: RealmDefinition.java    From keycloak with Apache License 2.0 4 votes vote down vote up
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
    super.registerOperations(resourceRegistration);
    resourceRegistration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
}