use of org.jboss.dmr.Property in project wildfly by wildfly.
the class BatchSubsystemParser method writeContent.
@Override
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode model = context.getModelNode();
BatchSubsystemDefinition.JOB_REPOSITORY_TYPE.marshallAsElement(model, writer);
// Write the thread pool
if (model.hasDefined(BatchConstants.THREAD_POOL)) {
final List<Property> threadPools = model.get(BatchConstants.THREAD_POOL).asPropertyList();
for (Property threadPool : threadPools) {
threadsParser.writeUnboundedQueueThreadPool(writer, threadPool, Element.THREAD_POOL.getLocalName(), false);
}
}
// Write out the thread factory
if (model.hasDefined(BatchConstants.THREAD_FACTORY)) {
final List<Property> threadFactories = model.get(BatchConstants.THREAD_FACTORY).asPropertyList();
for (Property threadFactory : threadFactories) {
threadsParser.writeThreadFactory(writer, threadFactory);
}
}
writer.writeEndElement();
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class LegacyPropertyAddOperationTransformer method transformOperation.
@Override
public ModelNode transformOperation(ModelNode operation) {
if (operation.hasDefined(PROPERTIES)) {
final ModelNode addOp = operation.clone();
final ModelNode properties = addOp.remove(PROPERTIES);
final ModelNode composite = new ModelNode();
composite.get(OP).set(COMPOSITE);
composite.get(OP_ADDR).setEmptyList();
composite.get(STEPS).add(addOp);
// Handle odd jgroups-specific legacy case, where :add operation for the protocol is :add-protocol on the parent
PathAddress propertyAddress = Operations.getName(addOp).equals("add-protocol") ? Operations.getPathAddress(addOp).append("protocol", addOp.get("type").asString()) : Operations.getPathAddress(addOp);
for (final Property property : properties.asPropertyList()) {
String key = property.getName();
ModelNode value = property.getValue();
ModelNode propAddOp = Util.createAddOperation(propertyAddress.append(PathElement.pathElement(PROPERTY, key)));
propAddOp.get(VALUE).set(value);
composite.get(STEPS).add(propAddOp);
}
return composite;
}
return operation;
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class LegacyPropertyResourceTransformer method transformPropertiesToChildrenResources.
public static void transformPropertiesToChildrenResources(ModelNode properties, PathAddress address, ResourceTransformationContext parentContext) {
if (properties.isDefined()) {
for (final Property property : properties.asPropertyList()) {
String key = property.getName();
ModelNode value = property.getValue();
Resource propertyResource = Resource.Factory.create();
propertyResource.getModel().get(VALUE).set(value);
PathAddress absoluteAddress = address.append(PROPERTY, key);
parentContext.addTransformedResourceFromRoot(absoluteAddress, propertyResource);
}
}
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class BackupsBuilder method configure.
@Override
public Builder<SitesConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.backups.clear();
if (model.hasDefined(BackupResourceDefinition.WILDCARD_PATH.getKey())) {
SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
for (Property property : model.get(BackupResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
String siteName = property.getName();
ModelNode backup = property.getValue();
BackupConfigurationBuilder backupBuilder = builder.addBackup();
backupBuilder.site(siteName).enabled(ENABLED.resolveModelAttribute(context, backup).asBoolean()).backupFailurePolicy(ModelNodes.asEnum(FAILURE_POLICY.resolveModelAttribute(context, backup), BackupFailurePolicy.class)).replicationTimeout(TIMEOUT.resolveModelAttribute(context, backup).asLong()).strategy(ModelNodes.asEnum(STRATEGY.resolveModelAttribute(context, backup), BackupStrategy.class)).takeOffline().afterFailures(AFTER_FAILURES.resolveModelAttribute(context, backup).asInt()).minTimeToWait(MIN_WAIT.resolveModelAttribute(context, backup).asLong());
this.backups.put(siteName, backupBuilder.create());
}
}
return this;
}
use of org.jboss.dmr.Property in project wildfly by wildfly.
the class CmpSubsystem10Parser method writeContent.
public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode model = context.getModelNode();
if (model.hasDefined(UUID_KEY_GENERATOR) || model.hasDefined(HILO_KEY_GENERATOR)) {
writer.writeStartElement(Element.KEY_GENERATORS.getLocalName());
if (model.hasDefined(UUID_KEY_GENERATOR)) {
for (Property keyGen : model.get(UUID_KEY_GENERATOR).asPropertyList()) {
final String name = keyGen.getName();
final ModelNode keyGenModel = keyGen.getValue();
writeUuid(writer, name, keyGenModel);
}
}
if (model.hasDefined(HILO_KEY_GENERATOR)) {
for (Property keyGen : model.get(HILO_KEY_GENERATOR).asPropertyList()) {
final String name = keyGen.getName();
final ModelNode keyGenModel = keyGen.getValue();
writeHilo(writer, name, keyGenModel);
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}
Aggregations