本文整理了Java中org.jboss.as.clustering.controller.Attribute
类的一些代码示例,展示了Attribute
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute
类的具体详情如下:
包路径:org.jboss.as.clustering.controller.Attribute
类名称:Attribute
[英]Interface to be implemented by attribute enumerations.
[中]要通过属性枚举实现的接口。
代码示例来源:origin: wildfly/wildfly
DeprecatedAttribute(org.jboss.as.clustering.controller.Attribute attribute) {
this.definition = attribute.getDefinition();
}
代码示例来源:origin: wildfly/wildfly
void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = parent.addChildResource(this.definition);
if (JGroupsModel.VERSION_6_0_0.requiresTransformation(version)) {
builder.getAttributeBuilder().setValueConverter(new DefaultValueAttributeConverter(this.queueLength.getDefinition()), this.queueLength.getName());
}
if (JGroupsModel.VERSION_5_0_0.requiresTransformation(version)) {
for (Attribute attribute : Arrays.asList(this.minThreads, this.maxThreads)) {
builder.getAttributeBuilder().setValueConverter(new DefaultValueAttributeConverter(attribute.getDefinition()), attribute.getName());
}
}
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.identifier = this.attribute.resolveModelAttribute(context, model).asString();
return this;
}
代码示例来源:origin: wildfly/wildfly
XMLElement(Attribute attribute) {
this.name = attribute.getName();
}
代码示例来源:origin: wildfly/wildfly
XMLAttribute(Attribute attribute) {
this.name = attribute.getName();
}
代码示例来源:origin: wildfly/wildfly
public ResourceDescriptor addExtraParameters(Iterable<? extends Attribute> parameters) {
for (Attribute parameter : parameters) {
this.parameters.add(parameter.getDefinition());
}
return this;
}
代码示例来源:origin: wildfly/wildfly
private static void require(XMLExtendedStreamReader reader, ModelNode operation, Attribute... attributes) throws XMLStreamException {
for (Attribute attribute : attributes) {
if (!operation.hasDefined(attribute.getName())) {
AttributeDefinition definition = attribute.getDefinition();
Set<String> names = Collections.singleton(definition.getXmlName());
throw definition.getParser().isParseAsElement() ? ParseUtils.missingRequiredElement(reader, names) : ParseUtils.missingRequired(reader, names);
}
}
}
代码示例来源:origin: wildfly/wildfly
<E extends Enum<E> & org.jboss.as.clustering.controller.Attribute> LegacyAddOperationTransformation(Class<E> attributeClass) {
// If none of the specified attributes are defined, then this is a legacy operation
this.legacy = operation -> {
for (org.jboss.as.clustering.controller.Attribute attribute : EnumSet.allOf(attributeClass)) {
if (operation.hasDefined(attribute.getName())) return false;
}
return true;
};
}
代码示例来源:origin: wildfly/wildfly
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
for (ColumnAttribute column : EnumSet.allOf(ColumnAttribute.class)) {
ModelNode columnModel = column.resolveModelAttribute(context, model);
String name = column.getColumnName().resolveModelAttribute(context, columnModel).asString();
String type = column.getColumnType().resolveModelAttribute(context, columnModel).asString();
this.columns.put(column, new AbstractMap.SimpleImmutableEntry<>(name, type));
}
this.fetchSize = FETCH_SIZE.resolveModelAttribute(context, model).asInt();
this.prefix = this.prefixAttribute.resolveModelAttribute(context, model).asString();
return this;
}
代码示例来源:origin: wildfly/wildfly
public ResourceDescriptor addAlias(Attribute alias, Attribute target) {
this.attributeTranslations.put(alias.getDefinition(), () -> target);
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (this.readHandler != null) {
this.readHandler.execute(context, operation);
} else {
try {
// If attribute has no read handler, simulate one
ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS, false).getModel();
ModelNode result = context.getResult();
if (model.hasDefined(this.targetAttribute.getName())) {
result.set(model.get(this.targetAttribute.getName()));
} else if (Operations.isIncludeDefaults(operation)) {
result.set(this.targetAttribute.getDefinition().getDefaultValue());
}
} catch (Resource.NoSuchResourceException ignore) {
// If the target resource does not exist return UNDEFINED
return;
}
}
ModelNode result = context.getResult();
result.set(this.translator.translate(context, result));
}
}
代码示例来源:origin: wildfly/wildfly
private static boolean hasDefined(ModelNode model, Collection<? extends Attribute> attributes) {
for (Attribute attribute : attributes) {
if (model.hasDefined(attribute.getName())) return true;
}
return false;
}
代码示例来源:origin: wildfly/wildfly
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
int maxThreads = this.definition.getMaxThreads().resolveModelAttribute(context, model).asInt();
int minThreads = this.definition.getMinThreads().resolveModelAttribute(context, model).asInt();
int queueLength = this.definition.getQueueLength().resolveModelAttribute(context, model).asInt();
long keepAliveTime = this.definition.getKeepAliveTime().resolveModelAttribute(context, model).asLong();
this.factory = new ExecutorFactory() {
@Override
public ExecutorService getExecutor(Properties property) {
ThreadFactory clThreadFactory = new ClassLoaderThreadFactory(ClientThreadPoolServiceConfigurator.this, AccessController.doPrivileged((PrivilegedAction<ClassLoader>) ClassLoaderThreadFactory.class::getClassLoader));
return new ThreadPoolExecutor(minThreads, maxThreads, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(queueLength), clThreadFactory);
}
};
return this;
}
代码示例来源:origin: wildfly/wildfly
public ResourceDescriptor addAttributes(Iterable<? extends Attribute> attributes) {
for (Attribute attribute : attributes) {
this.attributes.add(attribute.getDefinition());
}
return this;
}
代码示例来源:origin: wildfly/wildfly
@Override
void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = parent.addChildResource(this.getDefinition());
if (JGroupsModel.VERSION_6_0_0.requiresTransformation(version)) {
for (Attribute attribute : Arrays.asList(this.getMinThreads(), this.getMaxThreads(), this.getQueueLength())) {
builder.getAttributeBuilder().setValueConverter(new DefaultValueAttributeConverter(attribute.getDefinition()), attribute.getName());
}
}
}
},
代码示例来源:origin: wildfly/wildfly
public static ModelNode createMapClearOperation(PathAddress address, Attribute attribute) {
ModelNode operation = Util.createOperation(MapOperations.MAP_CLEAR_DEFINITION, address);
operation.get(ModelDescriptionConstants.NAME).set(attribute.getName());
return operation;
}
代码示例来源:origin: wildfly/wildfly
@Override
public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException {
ThreadPoolExecutorFactory<?> factory = new BlockingThreadPoolExecutorFactory(
this.definition.getMaxThreads().resolveModelAttribute(context, model).asInt(),
this.definition.getMinThreads().resolveModelAttribute(context, model).asInt(),
this.definition.getQueueLength().resolveModelAttribute(context, model).asInt(),
this.definition.getKeepAliveTime().resolveModelAttribute(context, model).asLong()
) {
@Override
public ExecutorService createExecutor(ThreadFactory factory) {
return super.createExecutor(new ClassLoaderThreadFactory(factory, WildFlySecurityManager.doUnchecked(GET_CLASS_LOADER_ACTION)));
}
};
this.builder.threadPoolFactory(factory);
return this;
}
代码示例来源:origin: wildfly/wildfly
public ResourceDescriptor addAttributeTranslation(Attribute sourceAttribute, AttributeTranslation translation) {
this.attributeTranslations.put(sourceAttribute.getDefinition(), translation);
return this;
}
代码示例来源:origin: org.jboss.eap/wildfly-clustering-jgroups-extension
void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
ResourceTransformationDescriptionBuilder builder = parent.addChildResource(this.definition);
if (JGroupsModel.VERSION_6_0_0.requiresTransformation(version)) {
builder.getAttributeBuilder().setValueConverter(new DefaultValueAttributeConverter(this.queueLength.getDefinition()), this.queueLength.getName());
}
if (JGroupsModel.VERSION_5_0_0.requiresTransformation(version)) {
for (Attribute attribute : Arrays.asList(this.minThreads, this.maxThreads)) {
builder.getAttributeBuilder().setValueConverter(new DefaultValueAttributeConverter(attribute.getDefinition()), attribute.getName());
}
}
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Creates an add operation using the specified address and parameters
* @param address a path address
* @param parameters a map of values per attribute
* @return an add operation
*/
public static ModelNode createAddOperation(PathAddress address, Map<Attribute, ModelNode> parameters) {
ModelNode operation = Util.createAddOperation(address);
for (Map.Entry<Attribute, ModelNode> entry : parameters.entrySet()) {
operation.get(entry.getKey().getName()).set(entry.getValue());
}
return operation;
}
内容来源于网络,如有侵权,请联系作者删除!