Java Code Examples for org.jboss.as.controller.AttributeDefinition#hasCapabilityRequirements()

The following examples show how to use org.jboss.as.controller.AttributeDefinition#hasCapabilityRequirements() . 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: SecurityRealmChildRemoveHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
    Set<RuntimeCapability> capabilitySet = capabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : capabilities;
    for (RuntimeCapability capability : capabilitySet) {
        if (capability.isDynamicallyNamed()) {
            context.deregisterCapability(capability.getDynamicName(context.getCurrentAddress()));
        } else {
            context.deregisterCapability(capability.getName());
        }
    }
    ModelNode model = resource.getModel();
    ImmutableManagementResourceRegistration mrr = context.getResourceRegistration();
    for (String attr : mrr.getAttributeNames(PathAddress.EMPTY_ADDRESS)) {
        AttributeAccess aa = mrr.getAttributeAccess(PathAddress.EMPTY_ADDRESS, attr);
        if (aa != null) {
            AttributeDefinition ad = aa.getAttributeDefinition();
            if (ad != null && (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements())) {
                ad.removeCapabilityRequirements(context, resource, model.get(ad.getName()));
            }
        }
    }
}
 
Example 2
Source File: SecurityRealmChildAddHandler.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected void recordCapabilitiesAndRequirements(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {
    Set<RuntimeCapability> capabilitySet = capabilities.isEmpty() ? context.getResourceRegistration().getCapabilities() : capabilities;

    for (RuntimeCapability capability : capabilitySet) {
        if (capability.isDynamicallyNamed()) {
            context.registerCapability(capability.fromBaseCapability(context.getCurrentAddress()));
        } else {
            context.registerCapability(capability);
        }
    }

    ModelNode model = resource.getModel();
    for (AttributeDefinition ad : attributeDefinitions) {
        if (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements()) {
            ad.addCapabilityRequirements(context, resource, model.get(ad.getName()));
        }
    }
}
 
Example 3
Source File: DeploymentScannerAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void recordCapabilitiesAndRequirements(final OperationContext context, Resource resource, AttributeDefinition... attributes) throws OperationFailedException {
    Set<RuntimeCapability> capabilitySet = context.getResourceRegistration().getCapabilities();

    for (RuntimeCapability capability : capabilitySet) {
        if (capability.isDynamicallyNamed()) {
            context.registerCapability(capability.fromBaseCapability(context.getCurrentAddress()));
        } else {
            context.registerCapability(capability);
        }
    }

    ModelNode model = resource.getModel();
    for (AttributeDefinition ad : attributes) {
        if (model.hasDefined(ad.getName()) || ad.hasCapabilityRequirements()) {
            ad.addCapabilityRequirements(context, resource, model.get(ad.getName()));
        }
    }
}