本文整理汇总了Java中org.jboss.as.controller.AttributeDefinition类的典型用法代码示例。如果您正苦于以下问题:Java AttributeDefinition类的具体用法?Java AttributeDefinition怎么用?Java AttributeDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttributeDefinition类属于org.jboss.as.controller包,在下文中一共展示了AttributeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeDefinitions
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
public AttributeDefinition[] getAttributeDefinitions() {
ObjectListAttributeDefinition properties = ObjectListAttributeDefinition.Builder.of(PROPERTIES, PropertyMetaDataMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition vdbimports = ObjectListAttributeDefinition.Builder.of(IMPORT_VDBS, VDBImportMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition models = ObjectListAttributeDefinition.Builder.of(MODELS, ModelMetadataMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition translators = ObjectListAttributeDefinition.Builder.of(OVERRIDE_TRANSLATORS, VDBTranslatorMetaDataMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition policies = ObjectListAttributeDefinition.Builder.of(DATA_POLICIES, DataPolicyMetadataMapper.INSTANCE.getAttributeDefinition()).build();
return new AttributeDefinition[] {
new SimpleAttributeDefinition(VDBNAME, ModelType.STRING, false),
new SimpleAttributeDefinition(CONNECTIONTYPE, ModelType.INT, false),
new SimpleAttributeDefinition(STATUS, ModelType.BOOLEAN, false),
new SimpleAttributeDefinition(VERSION, ModelType.BOOLEAN, false),
new SimpleAttributeDefinition(VDB_DESCRIPTION, ModelType.BOOLEAN, true),
new SimpleAttributeDefinition(XML_DEPLOYMENT, ModelType.BOOLEAN, true),
properties,
vdbimports,
models,
translators,
policies
};
}
示例2: getAttributeDefinition
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
public ObjectTypeAttributeDefinition getAttributeDefinition() {
ObjectListAttributeDefinition properties = ObjectListAttributeDefinition.Builder.of(PROPERTIES, PropertyMetaDataMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition sourceMappings = ObjectListAttributeDefinition.Builder.of(SOURCE_MAPPINGS, SourceMappingMetadataMapper.INSTANCE.getAttributeDefinition()).build();
ObjectListAttributeDefinition errors = ObjectListAttributeDefinition.Builder.of(VALIDITY_ERRORS, ValidationErrorMapper.INSTANCE.getAttributeDefinition()).build();
return ObjectTypeAttributeDefinition.Builder.of("ModelMetadataMapper", //$NON-NLS-1$
new AttributeDefinition[] {
new SimpleAttributeDefinition(MODEL_NAME, ModelType.STRING, false),
new SimpleAttributeDefinition(DESCRIPTION, ModelType.INT, true),
new SimpleAttributeDefinition(VISIBLE, ModelType.INT, true),
new SimpleAttributeDefinition(MODEL_TYPE, ModelType.BOOLEAN, false),
new SimpleAttributeDefinition(MODELPATH, ModelType.BOOLEAN, true),
new SimpleAttributeDefinition(METADATA_STATUS, ModelType.STRING, true),
ObjectTypeAttributeDefinition.Builder.of(PROPERTIES, properties).build(),
ObjectTypeAttributeDefinition.Builder.of(SOURCE_MAPPINGS, sourceMappings).build(),
ObjectTypeAttributeDefinition.Builder.of(VALIDITY_ERRORS, errors).build(),
}).build();
}
示例3: getOperationDefinition
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public OperationDefinition getOperationDefinition() {
final AttributeDefinition[] parameters = new AttributeDefinition[] {OperationsConstants.VDB_NAME, OperationsConstants.VDB_VERSION};
final ResourceDescriptionResolver resolver = new TeiidResourceDescriptionResolver(name());
return new OperationDefinition(name(), OperationEntry.EntryType.PUBLIC, EnumSet.noneOf(OperationEntry.Flag.class), ModelType.OBJECT, null, true, null, null, parameters) {
@Override
public DescriptionProvider getDescriptionProvider() {
return new DefaultOperationDescriptionProvider(name(), resolver, resolver, ModelType.OBJECT, ModelType.OBJECT, null, null, this.parameters) {
@Override
protected ModelNode getReplyValueTypeDescription(ResourceDescriptionResolver descriptionResolver, Locale locale, ResourceBundle bundle) {
return VDBMetadataMapper.INSTANCE.describe( new ModelNode());
}
};
}
};
}
示例4: recordCapabilitiesAndRequirements
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
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()));
}
}
}
示例5: DefaultOperationDescriptionProvider
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
public DefaultOperationDescriptionProvider(final String operationName,
final ResourceDescriptionResolver descriptionResolver,
final ResourceDescriptionResolver attributeDescriptionResolver,
final ModelType replyType,
final ModelType replyValueType,
final boolean replyAllowNull,
final DeprecationData deprecationData,
final AttributeDefinition[] replyParameters,
final AttributeDefinition[] parameters,
final List<AccessConstraintDefinition> accessConstraints) {
this.operationName = operationName;
this.descriptionResolver = descriptionResolver;
this.attributeDescriptionResolver = attributeDescriptionResolver;
this.replyType = replyType;
this.replyValueType = replyValueType;
this.replyAllowNull = replyAllowNull;
this.parameters = parameters;
this.deprecationData = deprecationData;
this.replyParameters = replyParameters;
this.accessConstraints = accessConstraints != null ? accessConstraints : Collections.<AccessConstraintDefinition>emptyList();
}
示例6: getRegexPrincipalTransformerDefinition
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
static ResourceDefinition getRegexPrincipalTransformerDefinition() {
final AttributeDefinition[] attributes = new AttributeDefinition[] { PATTERN, REPLACEMENT, REPLACE_ALL };
AbstractAddStepHandler add = new TrivialAddHandler<PrincipalTransformer>(PrincipalTransformer.class, attributes, PRINCIPAL_TRANSFORMER_RUNTIME_CAPABILITY) {
@Override
protected ValueSupplier<PrincipalTransformer> getValueSupplier(ServiceBuilder<PrincipalTransformer> serviceBuilder,
OperationContext context, ModelNode model) throws OperationFailedException {
final Pattern pattern = Pattern.compile(PATTERN.resolveModelAttribute(context, model).asString());
final String replacement = REPLACEMENT.resolveModelAttribute(context, model).asString();
final boolean replaceAll = REPLACE_ALL.resolveModelAttribute(context, model).asBoolean();
return () -> PrincipalTransformer.from(new RegexNameRewriter(pattern, replacement, replaceAll).asPrincipalRewriter());
}
};
return new TrivialResourceDefinition(REGEX_PRINCIPAL_TRANSFORMER, add, attributes, PRINCIPAL_TRANSFORMER_RUNTIME_CAPABILITY);
}
示例7: AbstractHandlerDefinition
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
protected AbstractHandlerDefinition(final PathElement path,
final boolean registerLegacyOps,
final Class<? extends Handler> type,
final PropertySorter propertySorter,
final AttributeDefinition[] addAttributes,
final AttributeDefinition[] readOnlyAttributes,
final AttributeDefinition[] writableAttributes,
final ConfigurationProperty<?>... constructionProperties) {
super(path,
LoggingExtension.getResourceDescriptionResolver(path.getKey()),
new HandlerOperations.HandlerAddOperationStepHandler(propertySorter, type, addAttributes, constructionProperties),
HandlerOperations.REMOVE_HANDLER);
this.registerLegacyOps = registerLegacyOps;
this.writableAttributes = writableAttributes;
writeHandler = new HandlerOperations.LogHandlerWriteAttributeHandler(propertySorter, this.writableAttributes);
this.readOnlyAttributes = readOnlyAttributes;
this.propertySorter = propertySorter;
}
示例8: registerAttributes
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
for (AttributeDefinition attr : parent.getResourceAttributes()) {
if (attr.getName().equals(DeploymentAttributes.STATUS.getName())) {
resourceRegistration.registerMetric(attr, DeploymentStatusHandler.INSTANCE);
} else if (attr.getName().equals(DeploymentAttributes.NAME.getName())) {
resourceRegistration.registerReadOnlyAttribute(DeploymentAttributes.NAME, ReadResourceNameOperationStepHandler.INSTANCE);
} else if (DeploymentAttributes.MANAGED.getName().equals(attr.getName())) {
resourceRegistration.registerReadOnlyAttribute(DeploymentAttributes.MANAGED, new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS, true).getModel();
if(deployment.hasDefined(CONTENT_RESOURCE_ALL.getName())) {
ModelNode content = deployment.get(CONTENT_RESOURCE_ALL.getName()).asList().get(0);
context.getResult().set(!isUnmanagedContent(content));
}
}
});
} else {
resourceRegistration.registerReadOnlyAttribute(attr, null);
}
}
}
示例9: resolveAttribute
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
static void resolveAttribute(OperationContext context, AttributeDefinition attribute, String attributeSyntax, boolean defaults, boolean enhancedSyntax) throws OperationFailedException {
final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS, false);
final ModelNode subModel = resource.getModel();
if (enhancedSyntax) {
context.getResult().set(EnhancedSyntaxSupport.resolveEnhancedSyntax(attributeSyntax, subModel, attribute));
} else if (subModel.hasDefined(attribute.getName())) {
final ModelNode result = subModel.get(attribute.getName());
context.getResult().set(result);
} else if (defaults && attribute.getDefaultValue() != null) {
// No defined value in the model. See if we should reply with a default from the metadata,
// reply with undefined, or fail because it's a non-existent attribute name
context.getResult().set(attribute.getDefaultValue());
} else {
// model had no defined value, but we treat its existence in the model or the metadata
// as proof that it's a legit attribute name
context.getResult(); // this initializes the "result" to ModelType.UNDEFINED
}
}
示例10: marshallAsElement
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException {
if (isMarshallable(attribute, resourceModel, marshallDefault)) {
writer.writeStartElement(FORMATTER.getXmlName());
writer.writeStartElement(attribute.getXmlName());
String content = resourceModel.get(attribute.getName()).asString();
writer.writeAttribute(CommonAttributes.NAME.getName(), content);
writer.writeEndElement();
writer.writeEndElement();
}
}
示例11: checkEndpointSettings
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
private static void checkEndpointSettings(ModelNode node, Map<String, ModelNode> nonDefaults, boolean expectDefaults) {
for (AttributeDefinition ad : RemotingEndpointResource.ATTRIBUTES.values()) {
ModelNode correct = nonDefaults.get(ad.getName());
if (expectDefaults) {
correct = correct == null ? ad.getDefaultValue() : correct;
}
correct = correct == null ? new ModelNode() : correct;
assertEquals(node.toString() + " wrong for " + ad.getName(), correct, node.get(ad.getName()));
}
}
示例12: registerAttributes
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
OperationStepHandler toParentHandler = new ToParentHandler();
for (AttributeDefinition ad : ATTRIBUTES.values()) {
resourceRegistration.registerReadWriteAttribute(ad, toParentHandler, toParentHandler);
}
}
示例13: registerAttributes
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
AbstractWriteAttributeHandler writeHandler = new ElytronReloadRequiredWriteAttributeHandler(ATTRIBUTES);
for (AttributeDefinition current : ATTRIBUTES) {
resourceRegistration.registerReadWriteAttribute(current, null, writeHandler);
}
}
示例14: registerAttributes
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
super.registerAttributes(resourceRegistration);
for (final AttributeDefinition attribute : DISCOVERY_ATTRIBUTES) {
resourceRegistration.registerReadWriteAttribute(attribute, null, new ModelOnlyWriteAttributeHandler(attribute));
}
}
示例15: performRuntime
import org.jboss.as.controller.AttributeDefinition; //导入依赖的package包/类
@Override
public void performRuntime(final OperationContext context, final ModelNode operation, final LogContextConfiguration logContextConfiguration, final String name, final ModelNode model) throws OperationFailedException {
final String loggerName = getLogManagerLoggerName(name);
LoggerConfiguration configuration = logContextConfiguration.getLoggerConfiguration(loggerName);
if (configuration == null) {
LoggingLogger.ROOT_LOGGER.tracef("Adding logger '%s' at '%s'", name, LoggingOperations.getAddress(operation));
configuration = logContextConfiguration.addLoggerConfiguration(loggerName);
}
for (AttributeDefinition attribute : attributes) {
handleProperty(attribute, context, model, configuration);
}
}