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

The following examples show how to use org.jboss.as.controller.registry.ManagementResourceRegistration#registerReadOnlyAttribute() . 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: FilteringKeyStoreDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    for (AttributeDefinition current : CONFIG_ATTRIBUTES) {
        resourceRegistration.registerReadWriteAttribute(current, null, WRITE);
    }

    if (isServerOrHostController(resourceRegistration)) {
        resourceRegistration.registerReadOnlyAttribute(STATE, new ElytronRuntimeOnlyHandler() {

            @Override
            protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
                ServiceName keyStoreName = FILTERING_KEY_STORE_UTIL.serviceName(operation);
                ServiceController<?> serviceController = context.getServiceRegistry(false).getRequiredService(keyStoreName);

                populateResponse(context.getResult(), serviceController);
            }

        });
    }
}
 
Example 2
Source File: MetricsRegistrationTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerMetric(METRIC, (context, operation) -> context.getResult().set(1000));
    resourceRegistration.registerMetric(METRIC_2, (context, operation) -> context.getResult().set(2000));
    resourceRegistration.registerReadOnlyAttribute(RUNTIME_ATTRIBUTE, ((context, operation) -> context.getResult().set(3000)));
    resourceRegistration.registerReadOnlyAttribute(RUNTIME_ATTRIBUTE_2, ((context, operation) -> context.getResult().set(4000)));
}
 
Example 3
Source File: AccessAuthorizationResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);
    WritableAuthorizerConfiguration authorizerConfiguration = configurableAuthorizer.getWritableAuthorizerConfiguration();
    resourceRegistration.registerReadWriteAttribute(PROVIDER, null, new AccessAuthorizationProviderWriteAttributeHander(configurableAuthorizer));
    resourceRegistration.registerReadWriteAttribute(USE_IDENTITY_ROLES, null, new AccessAuthorizationUseIdentityRolesWriteAttributeHander(configurableAuthorizer.getWritableAuthorizerConfiguration()));
    resourceRegistration.registerReadWriteAttribute(PERMISSION_COMBINATION_POLICY, null,
            new AccessAuthorizationCombinationPolicyWriteAttributeHandler(authorizerConfiguration));

    resourceRegistration.registerReadOnlyAttribute(STANDARD_ROLE_NAMES,
            AccessAuthorizationRolesHandler.getStandardRolesHandler(authorizerConfiguration));
    resourceRegistration.registerReadOnlyAttribute(ALL_ROLE_NAMES,
            AccessAuthorizationRolesHandler.getAllRolesHandler(authorizerConfiguration));
}
 
Example 4
Source File: ModelControllerImplUnitTestCase.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();
    rootRegistration.registerOperationHandler(getOD("setup"), new ModelControllerImplUnitTestCase.SetupHandler(),true);
    rootRegistration.registerOperationHandler(getOD("composite"), CompositeOperationHandler.INSTANCE,true);
    rootRegistration.registerOperationHandler(getOD("good"), new ModelControllerImplUnitTestCase.ModelStageGoodHandler(),true);
    rootRegistration.registerOperationHandler(getOD("bad"), new ModelControllerImplUnitTestCase.ModelStageFailsHandler(),true);
    rootRegistration.registerOperationHandler(getOD("evil"), new ModelControllerImplUnitTestCase.ModelStageThrowsExceptionHandler(),true);
    rootRegistration.registerOperationHandler(getOD("handleFailed"), new ModelControllerImplUnitTestCase.RuntimeStageFailsHandler(state),true);
    rootRegistration.registerOperationHandler(getOD("runtimeException"), new ModelControllerImplUnitTestCase.RuntimeStageThrowsExceptionHandler(state),true);
    rootRegistration.registerOperationHandler(getOD("operationFailedException"), new ModelControllerImplUnitTestCase.RuntimeStageThrowsOFEHandler(),true);
    rootRegistration.registerOperationHandler(getOD("good-service"), new ModelControllerImplUnitTestCase.GoodServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("bad-service"), new ModelControllerImplUnitTestCase.BadServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("remove-bad-service"), new ModelControllerImplUnitTestCase.RemoveBadServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("missing-service"), new ModelControllerImplUnitTestCase.MissingServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("reload-required"), new ModelControllerImplUnitTestCase.ReloadRequiredHandler(),true);
    rootRegistration.registerOperationHandler(getOD("restart-required"), new ModelControllerImplUnitTestCase.RestartRequiredHandler(),true);
    rootRegistration.registerOperationHandler(getOD("dependent-service"), new ModelControllerImplUnitTestCase.DependentServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("remove-dependent-service"), new ModelControllerImplUnitTestCase.RemoveDependentServiceHandler(),true);
    rootRegistration.registerOperationHandler(getOD("read-wildcards"), new ModelControllerImplUnitTestCase.WildcardReadHandler(),true);
    rootRegistration.registerOperationHandler(getOD("invalid-service-update"), new ModelControllerImplUnitTestCase.InvalidServiceUpdateHandler(),true);
    rootRegistration.registerOperationHandler(getODBuilder("deprecated-op").setDeprecated(ModelVersion.create(1)).build(), new DeprecatedHandler(), true);

    GlobalOperationHandlers.registerGlobalOperations(rootRegistration, processType);

    GlobalNotifications.registerGlobalNotifications(rootRegistration, processType);

    rootRegistration.registerReadOnlyAttribute(TestUtils.createNillableAttribute("attr1", ModelType.INT), null);
    rootRegistration.registerReadOnlyAttribute(TestUtils.createNillableAttribute("attr2", ModelType.INT), null);

    SimpleResourceDefinition childResource = new SimpleResourceDefinition(
            PathElement.pathElement("child"),
            new NonResolvingResourceDescriptionResolver()
    );
    ManagementResourceRegistration childRegistration = rootRegistration.registerSubModel(childResource);
    childRegistration.registerReadOnlyAttribute(TestUtils.createNillableAttribute("attribute1", ModelType.INT), null);
    childRegistration.registerReadOnlyAttribute(TestUtils.createNillableAttribute("attribute2", ModelType.INT, true), null);
}
 
Example 5
Source File: AbstractSocketBindingResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(NAME, null);
    resourceRegistration.registerReadWriteAttribute(INTERFACE, null, getInterfaceWriteAttributeHandler());
    resourceRegistration.registerReadWriteAttribute(PORT, null, getPortWriteAttributeHandler());
    resourceRegistration.registerReadWriteAttribute(FIXED_PORT, null, getFixedPortWriteAttributeHandler());
    resourceRegistration.registerReadWriteAttribute(MULTICAST_ADDRESS, null, getMulticastAddressWriteAttributeHandler());
    resourceRegistration.registerReadWriteAttribute(MULTICAST_PORT, null, getMulticastPortWriteAttributeHandler());
    resourceRegistration.registerReadWriteAttribute(CLIENT_MAPPINGS, null, getClientMappingsWriteAttributeHandler());

}
 
Example 6
Source File: PathResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(NAME, ReadResourceNameOperationStepHandler.INSTANCE);
    resourceRegistration.registerReadWriteAttribute(RELATIVE_TO_LOCAL, null, new PathWriteAttributeHandler(pathManager, RELATIVE_TO_LOCAL));
    SimpleAttributeDefinition pathAttr = specified ? PATH_SPECIFIED : PATH_NAMED;
    resourceRegistration.registerReadWriteAttribute(pathAttr, null, new PathWriteAttributeHandler(pathManager, pathAttr));
    resourceRegistration.registerReadOnlyAttribute(READ_ONLY, null);
}
 
Example 7
Source File: ModuleLoadingResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    AttributeDefinition ad = SimpleListAttributeDefinition.Builder.of("module-roots",
            new SimpleAttributeDefinitionBuilder("module-root", ModelType.STRING).build())
            .setStorageRuntime()
            .setRuntimeServiceNotRequired()
            .setDeprecated(ModelVersion.create(1, 4, 0))
            .build();
    resourceRegistration.registerReadOnlyAttribute(ad, new ListModuleRootsHandler());
}
 
Example 8
Source File: LoggerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    for (AttributeDefinition def : writableAttributes) {
        // Filter requires a special reader
        if (def.getName().equals(FILTER.getName())) {
            resourceRegistration.registerReadWriteAttribute(def, ReadFilterOperationStepHandler.INSTANCE, writeHandler);
        } else {
            resourceRegistration.registerReadWriteAttribute(def, null, writeHandler);
        }
    }
    resourceRegistration.registerReadOnlyAttribute(CATEGORY, ReadResourceNameOperationStepHandler.INSTANCE);
}
 
Example 9
Source File: ConstrainedResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);
    resourceRegistration.registerReadOnlyAttribute(PASSWORD, null);
    resourceRegistration.registerReadOnlyAttribute(SECURITY_DOMAIN, null);
    resourceRegistration.registerReadOnlyAttribute(AUTHENTICATION_INFLOW, null);
}
 
Example 10
Source File: ExtensionSubsystemResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(MAJOR_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(MINOR_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(MICRO_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(XML_NAMESPACES, null);
}
 
Example 11
Source File: ServerRootResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    if (isDomain) {
        resourceRegistration.registerReadOnlyAttribute(NAME, serverEnvironment.getProcessNameReadHandler());
        resourceRegistration.registerReadWriteAttribute(PROFILE_NAME, null, new ModelOnlyWriteAttributeHandler(PROFILE_NAME));
    } else {
        resourceRegistration.registerReadWriteAttribute(NAME, serverEnvironment.getProcessNameReadHandler(), serverEnvironment.getProcessNameWriteHandler());
        // The legacy "undefined" profile-name
        resourceRegistration.registerReadOnlyAttribute(NULL_PROFILE_NAME, null);
        resourceRegistration.registerReadWriteAttribute(ORGANIZATION_IDENTIFIER, null, new ModelOnlyWriteAttributeHandler(ORGANIZATION_IDENTIFIER));
    }
    resourceRegistration.registerReadOnlyAttribute(LAUNCH_TYPE, new LaunchTypeHandler(serverEnvironment.getLaunchType()));

    resourceRegistration.registerReadOnlyAttribute(RUNTIME_CONFIGURATION_STATE, new ProcessStateAttributeHandler(processState));
    resourceRegistration.registerReadOnlyAttribute(SERVER_STATE, new ProcessStateAttributeHandler(processState));
    resourceRegistration.registerReadOnlyAttribute(PROCESS_TYPE, ProcessTypeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(RUNNING_MODE, new RunningModeReadHandler(runningModeControl));
    resourceRegistration.registerReadOnlyAttribute(SUSPEND_STATE, SuspendStateReadHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(UUID, new InstanceUuidReadHandler(serverEnvironment));


    resourceRegistration.registerReadOnlyAttribute(MANAGEMENT_MAJOR_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(MANAGEMENT_MINOR_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(MANAGEMENT_MICRO_VERSION, null);

    resourceRegistration.registerReadOnlyAttribute(RELEASE_VERSION, null);
    resourceRegistration.registerReadOnlyAttribute(RELEASE_CODENAME, null);

    resourceRegistration.registerReadOnlyAttribute(PRODUCT_NAME, null);
    resourceRegistration.registerReadOnlyAttribute(PRODUCT_VERSION, null);

    resourceRegistration.registerReadOnlyAttribute(NAMESPACES, DefaultEmptyListAttributeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(SCHEMA_LOCATIONS, DefaultEmptyListAttributeHandler.INSTANCE);

    if (isDomain) {
        resourceRegistration.registerReadOnlyAttribute(HOST, null);
        resourceRegistration.registerReadOnlyAttribute(SERVER_GROUP, null);
    }
}
 
Example 12
Source File: RemotingSubsystemTestUtil.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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: Subsystem1RootResource.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration profileSub1Reg) {
    super.registerAttributes(profileSub1Reg);

    profileSub1Reg.registerReadOnlyAttribute(new PrimitiveListAttributeDefinition.Builder("attr1", ModelType.INT).setRequired(true).build(), null);

    profileSub1Reg.registerReadOnlyAttribute(createAttribute("read-only", ModelType.INT, null, false, false, true), null);
    final AttributeDefinition attribute = createAttribute("read-write", ModelType.INT, null, false, false, true);
    profileSub1Reg.registerReadWriteAttribute(attribute, null, new ModelOnlyWriteAttributeHandler(attribute));
    profileSub1Reg.registerMetric(createMetric("metric1", ModelType.INT), TestMetricHandler.INSTANCE);
    profileSub1Reg.registerMetric(createMetric("metric2", ModelType.INT), TestMetricHandler.INSTANCE);


}
 
Example 14
Source File: ManagedDMRContentResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(HASH, null);
    resourceRegistration.registerReadWriteAttribute(contentDefinition, null, new ManagedDMRContentWriteAttributeHandler(contentDefinition));
}
 
Example 15
Source File: ThreadFactoryResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(PoolAttributeDefinitions.NAME, ReadResourceNameOperationStepHandler.INSTANCE);
    ThreadFactoryWriteAttributeHandler.INSTANCE.registerAttributes(resourceRegistration);
}
 
Example 16
Source File: PrincipalResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(TYPE, null);
    resourceRegistration.registerReadOnlyAttribute(REALM, null);
    resourceRegistration.registerReadOnlyAttribute(NAME, null);
}
 
Example 17
Source File: RemoveNotEsistingResourceTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);

    resourceRegistration.registerReadOnlyAttribute(ATTRIBUTE_DEFINITION, null);
}
 
Example 18
Source File: BadReadHandlerAttributeTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(BASIC_ATTRIBUTE, null);
    resourceRegistration.registerReadOnlyAttribute(BAD_ATTRIBUTE, null);
}
 
Example 19
Source File: DefaultAttributeTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(ATTRIBUTE_WITH_DEFAULT, null);
}
 
Example 20
Source File: ManagedDMRContentTypeResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    resourceRegistration.registerReadOnlyAttribute(HASH, null);
}