本文整理汇总了Java中org.jboss.as.controller.AttributeDefinition.NameAndGroup方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeDefinition.NameAndGroup方法的具体用法?Java AttributeDefinition.NameAndGroup怎么用?Java AttributeDefinition.NameAndGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.controller.AttributeDefinition
的用法示例。
在下文中一共展示了AttributeDefinition.NameAndGroup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addReadAttributeStep
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
private void addReadAttributeStep(OperationContext context, PathAddress address, boolean defaults, boolean resolve, FilteredData localFilteredData,
ImmutableManagementResourceRegistration registry,
AttributeDefinition.NameAndGroup attributeKey, Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> responseMap) {
// See if there was an override registered for the standard :read-attribute handling (unlikely!!!)
OperationStepHandler overrideHandler = registry.getOperationHandler(PathAddress.EMPTY_ADDRESS, READ_ATTRIBUTE_OPERATION);
if (overrideHandler != null &&
(overrideHandler == ReadAttributeHandler.INSTANCE || overrideHandler == ReadAttributeHandler.RESOLVE_INSTANCE)) {
// not an override
overrideHandler = null;
}
OperationStepHandler readAttributeHandler = new ReadAttributeHandler(localFilteredData, overrideHandler, (resolve && resolvable));
final ModelNode attributeOperation = Util.getReadAttributeOperation(address, attributeKey.getName());
attributeOperation.get(ModelDescriptionConstants.INCLUDE_DEFAULTS).set(defaults);
attributeOperation.get(ModelDescriptionConstants.RESOLVE_EXPRESSIONS).set(resolve);
final ModelNode attrResponse = new ModelNode();
GlobalOperationHandlers.AvailableResponse availableResponse = new GlobalOperationHandlers.AvailableResponse(attrResponse);
responseMap.put(attributeKey, availableResponse);
GlobalOperationHandlers.AvailableResponseWrapper wrapper = new GlobalOperationHandlers.AvailableResponseWrapper(readAttributeHandler, availableResponse);
context.addStep(attrResponse, attributeOperation, wrapper, OperationContext.Stage.MODEL, true);
}
示例2: addReadAttributeStep
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
private void addReadAttributeStep(OperationContext context, PathAddress address, boolean defaults, boolean resolve,
FilteredData localFilteredData,
ImmutableManagementResourceRegistration registry,
AttributeDefinition.NameAndGroup attributeKey, Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> responseMap) {
// See if there was an override registered for the standard :read-attribute handling (unlikely!!!)
OperationStepHandler overrideHandler = registry.getOperationHandler(PathAddress.EMPTY_ADDRESS, READ_ATTRIBUTE_OPERATION);
if (overrideHandler != null
&& (overrideHandler == ReadAttributeHandler.INSTANCE || overrideHandler == ReadAttributeHandler.RESOLVE_INSTANCE)) {
// not an override
overrideHandler = null;
}
OperationStepHandler readAttributeHandler = new ReadAttributeHandler(localFilteredData, overrideHandler, (resolve && resolvable));
final ModelNode attributeOperation = Util.getReadAttributeOperation(address, attributeKey.getName());
attributeOperation.get(ModelDescriptionConstants.INCLUDE_DEFAULTS).set(defaults);
attributeOperation.get(ModelDescriptionConstants.RESOLVE_EXPRESSIONS).set(resolve);
final ModelNode attrResponse = new ModelNode();
GlobalOperationHandlers.AvailableResponse availableResponse = new GlobalOperationHandlers.AvailableResponse(attrResponse);
responseMap.put(attributeKey, availableResponse);
GlobalOperationHandlers.AvailableResponseWrapper wrapper = new GlobalOperationHandlers.AvailableResponseWrapper(readAttributeHandler, availableResponse);
context.addStep(attrResponse, attributeOperation, wrapper, OperationContext.Stage.MODEL, true);
}
示例3: doExecute
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
@Override
void doExecute(OperationContext context, ModelNode operation, FilteredData filteredData, boolean ignoreMissingResource) throws OperationFailedException {
validator.validate(operation);
final PathAddress address = context.getCurrentAddress();
final boolean includeRutime = operation.get(ModelDescriptionConstants.INCLUDE_RUNTIME).asBoolean(false);
final boolean aliases = operation.get(ModelDescriptionConstants.INCLUDE_ALIASES).asBoolean(false);
final boolean defaults = operation.get(ModelDescriptionConstants.INCLUDE_DEFAULTS).asBoolean(true);
final boolean resolve = RESOLVE.resolveModelAttribute(context, operation).asBoolean();
final ModelNode groupNameNode = NAME.resolveModelAttribute(context, operation);
final String groupName = groupNameNode.isDefined() ? groupNameNode.asString() : null;
final FilteredData localFilteredData = new FilteredData(address);
final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> metrics = includeRutime
? new HashMap<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse>()
: Collections.<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse>emptyMap();
final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> otherAttributes = new HashMap<>();
final ReadAttributeGroupAssemblyHandler assemblyHandler = new ReadAttributeGroupAssemblyHandler(metrics, otherAttributes, filteredData, ignoreMissingResource);
context.addStep(assemblyHandler, includeRutime ? OperationContext.Stage.VERIFY : OperationContext.Stage.MODEL, true);
final ImmutableManagementResourceRegistration registry = context.getResourceRegistration();
final Set<String> attributeNames = registry != null ? registry.getAttributeNames(PathAddress.EMPTY_ADDRESS) : Collections.<String>emptySet();
for (final String attributeName : attributeNames) {
final AttributeAccess access = registry.getAttributeAccess(PathAddress.EMPTY_ADDRESS, attributeName);
final AttributeDefinition ad = access.getAttributeDefinition();
if ((aliases || !access.getFlags().contains(AttributeAccess.Flag.ALIAS))
&& (includeRutime || access.getStorageType() == AttributeAccess.Storage.CONFIGURATION)
&& (groupName == null || groupName.equals(ad.getAttributeGroup()))) {
Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> responseMap = access.getAccessType() == AttributeAccess.AccessType.METRIC ? metrics : otherAttributes;
AttributeDefinition.NameAndGroup nag = ad == null ? new AttributeDefinition.NameAndGroup(attributeName) : new AttributeDefinition.NameAndGroup(ad);
addReadAttributeStep(context, address, defaults, resolve, localFilteredData, registry, nag, responseMap);
}
}
}
示例4: getModelDescription
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
@Override
public ModelNode getModelDescription(Locale locale) {
ModelNode result = new ModelNode();
final ResourceBundle bundle = descriptionResolver.getResourceBundle(locale);
result.get(OPERATION_NAME).set(ADD);
result.get(DESCRIPTION).set(descriptionResolver.getOperationDescription(ADD, locale, bundle));
// Sort the attribute descriptions based on attribute group and then attribute name
Set<String> attributeNames = registration.getAttributeNames(PathAddress.EMPTY_ADDRESS);
Map<AttributeDefinition.NameAndGroup, ModelNode> sortedDescriptions = new TreeMap<>();
for (String attr : attributeNames) {
AttributeAccess attributeAccess = registration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, attr);
if (attributeAccess.getStorageType() == AttributeAccess.Storage.CONFIGURATION) {
AttributeDefinition def = attributeAccess.getAttributeDefinition();
if (def != null) {
if (!def.isResourceOnly()){
addAttributeDescriptionToMap(sortedDescriptions, def, locale, bundle);
}
} else {
// Just stick in a placeholder;
sortedDescriptions.put(new AttributeDefinition.NameAndGroup(attr), new ModelNode());
}
}
}
if (orderedChildResource) {
//Add the index property to the add operation
addAttributeDescriptionToMap(sortedDescriptions, INDEX, locale, bundle);
}
// Store the sorted descriptions into the overall result
final ModelNode params = result.get(REQUEST_PROPERTIES).setEmptyObject();
for (Map.Entry<AttributeDefinition.NameAndGroup, ModelNode> entry : sortedDescriptions.entrySet()) {
params.get(entry.getKey().getName()).set(entry.getValue());
}
//This is auto-generated so don't add any access constraints
result.get(REPLY_PROPERTIES).setEmptyObject();
return result;
}
示例5: addAttributeDescriptionToMap
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
private void addAttributeDescriptionToMap(Map<AttributeDefinition.NameAndGroup, ModelNode> sortedDescriptions, AttributeDefinition def, Locale locale, ResourceBundle bundle) {
ModelNode attrDesc = new ModelNode();
// def will add the description to attrDesc under "request-properties" => { attr
def.addOperationParameterDescription(attrDesc, ADD, descriptionResolver, locale, bundle);
sortedDescriptions.put(new AttributeDefinition.NameAndGroup(def), attrDesc.get(REQUEST_PROPERTIES, def.getName()));
}
示例6: ReadResourceAssemblyHandler
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
/**
* Creates a ReadResourceAssemblyHandler that will assemble the response using the contents
* of the given maps.
* @param address address of the resource
* @param metrics map of attributes of AccessType.METRIC. Keys are the attribute names, values are the full
* read-attribute response from invoking the attribute's read handler. Will not be {@code null}
* @param otherAttributes map of attributes not of AccessType.METRIC that have a read handler registered. Keys
* are the attribute names, values are the full read-attribute response from invoking the
* attribute's read handler. Will not be {@code null}
* @param directChildren Children names read directly from the parent resource where we didn't call read-resource
* to gather data. We wouldn't call read-resource if the recursive=false
* @param childResources read-resource response from child resources, where the key is the PathAddress
* relative to the address of the operation this handler is handling and the
* value is the full read-resource response. Will not be {@code null}
* @param nonExistentChildTypes names of child types where no data is available
* @param filteredData information about resources and attributes that were filtered
* @param ignoreMissingResource {@code true} if we should ignore occasions when the targeted resource
* does not exist; {@code false} if we should throw
* {@link org.jboss.as.controller.registry.Resource.NoSuchResourceException}
* in such cases
*/
private ReadResourceAssemblyHandler(final PathAddress address,
final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> metrics,
final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> otherAttributes, final Map<String, ModelNode> directChildren,
final Map<PathElement, ModelNode> childResources, final Set<String> nonExistentChildTypes,
FilteredData filteredData, boolean ignoreMissingResource) {
this.address = address;
this.metrics = metrics;
this.otherAttributes = otherAttributes;
this.directChildren = directChildren;
this.childResources = childResources;
this.nonExistentChildTypes = nonExistentChildTypes;
this.filteredData = filteredData;
this.ignoreMissingResource = ignoreMissingResource;
}
示例7: ReadAttributeGroupAssemblyHandler
import org.jboss.as.controller.AttributeDefinition; //导入方法依赖的package包/类
/**
* Creates a ReadAttributeGroupAssemblyHandler that will assemble the response using the contents of the given
* maps.
* @param metrics map of attributes of AccessType.METRIC. Keys are the attribute names, values are the full
* read-attribute response from invoking the attribute's read handler. Will not be {@code null}
* @param otherAttributes map of attributes not of AccessType.METRIC that have a read handler registered. Keys
* are the attribute names, values are the full read-attribute response from invoking the attribute's read
* handler. Will not be {@code null}
* @param filteredData information about resources and attributes that were filtered
* @param ignoreMissingResource {@code true} if we should ignore occasions when the targeted resource
* does not exist; {@code false} if we should throw
* {@link org.jboss.as.controller.registry.Resource.NoSuchResourceException}
* in such cases
*/
private ReadAttributeGroupAssemblyHandler(final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> metrics,
final Map<AttributeDefinition.NameAndGroup, GlobalOperationHandlers.AvailableResponse> otherAttributes,
final FilteredData filteredData, final boolean ignoreMissingResource) {
this.metrics = metrics;
this.otherAttributes = otherAttributes;
this.filteredData = filteredData;
this.ignoreMissingResource = ignoreMissingResource;
}