本文整理了Java中org.jboss.as.controller.operations.common.Util.getEmptyOperation()
方法的一些代码示例,展示了Util.getEmptyOperation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getEmptyOperation()
方法的具体详情如下:
包路径:org.jboss.as.controller.operations.common.Util
类名称:Util
方法名:getEmptyOperation
暂无
代码示例来源:origin: wildfly/wildfly
archiveOrModuleName = model.get(MODULE.getName()).asString();
final ModelNode compensating = Util.getEmptyOperation(ADD, opAddr);
ModelNode raCompensatingNode = raNode.clone();
compensating.get(RESOURCEADAPTERS_NAME).add(raCompensatingNode);
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void initializeRolloutPlans(ModelNode address, List<ModelNode> list) {
ModelNode addAddress = address.clone().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS);
ModelNode addOp = Util.getEmptyOperation(ADD, addAddress);
list.add(addOp);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void addSystemProperties(List<ModelNode> updates) {
Map<String, String> props = getAllSystemProperties(false);
for (Map.Entry<String, String> entry : props.entrySet()) {
ModelNode address = new ModelNode();
address.add(SYSTEM_PROPERTY, entry.getKey());
ModelNode op = Util.getEmptyOperation(SystemPropertyAddHandler.OPERATION_NAME, address);
if (entry.getValue() != null) {
op.get(VALUE).set(entry.getValue());
}
updates.add(op);
}
}
代码示例来源:origin: ModeShape/modeshape
private void parseWebApp( final XMLExtendedStreamReader reader,
final ModelNode address,
final List<ModelNode> webapps ) throws XMLStreamException {
final ModelNode webappAddress = address.clone();
final ModelNode webapp = Util.getEmptyOperation(ModelDescriptionConstants.ADD, webappAddress);
String webappName = null;
for (int i = 0; i < reader.getAttributeCount(); i++) {
String attrName = reader.getAttributeLocalName(i);
String attrValue = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(attrName);
switch (attribute) {
case NAME: {
webappName = attrValue;
webappAddress.add(ModelKeys.WEBAPP, webappName);
webappAddress.protect();
webapp.get(OP).set(ADD);
webapp.get(OP_ADDR).set(webappAddress);
webapps.add(webapp);
break;
}
case EXPLODED: {
ModelAttributes.EXPLODED.parseAndSetParameter(attrValue, webapp, reader);
break;
}
default:
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
requireNoElements(reader);
}
代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan
private void parseClusterLoader(XMLExtendedStreamReader reader, ModelNode cache, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
// ModelNode for the cluster loader add operation
ModelNode loader = Util.getEmptyOperation(ModelDescriptionConstants.ADD, null);
String name = ModelKeys.CLUSTER_LOADER_NAME;
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case REMOTE_TIMEOUT: {
ClusterLoaderConfigurationResource.REMOTE_TIMEOUT.parseAndSetParameter(value, loader, reader);
break;
}
default: {
name = this.parseLoaderAttribute(name, reader, i, attribute, value, loader);
}
}
}
// update the cache address with the loader name
PathAddress loaderAddress = setStoreOperationAddress(loader, PathAddress.pathAddress(cache.get(OP_ADDR)), ClusterLoaderConfigurationResource.PATH, name);
Map<PathAddress, ModelNode> additionalConfigurationOperations = new LinkedHashMap<>();
this.parseLoaderElements(reader, loader, additionalConfigurationOperations);
operations.put(loaderAddress, loader);
operations.putAll(additionalConfigurationOperations);
}
代码示例来源:origin: org.wildfly/wildfly-picketlink
/**
* Creates the root subsystem's root address.
*
* @return
*/
private ModelNode createSubsystemRoot() {
ModelNode subsystemAddress = new ModelNode();
subsystemAddress.add(ModelDescriptionConstants.SUBSYSTEM, IDMExtension.SUBSYSTEM_NAME);
subsystemAddress.protect();
return Util.getEmptyOperation(ADD, subsystemAddress);
}
代码示例来源:origin: org.jboss.as/jboss-as-clustering-jgroups
private void parseProperty(XMLExtendedStreamReader reader, ModelNode transportOrProtocolAddress, List<ModelNode> operations) throws XMLStreamException {
ModelNode property = Util.getEmptyOperation(ModelDescriptionConstants.ADD, null);
String propertyName = null;
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case NAME: {
propertyName = value;
break;
}
default: {
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (property == null) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.NAME));
}
String propertyValue = reader.getElementText();
// ModelNode for the property add operation
ModelNode propertyAddress = transportOrProtocolAddress.clone();
propertyAddress.add(ModelKeys.PROPERTY, propertyName);
propertyAddress.protect();
property.get(OP_ADDR).set(propertyAddress);
// assign the value
PropertyResource.VALUE.parseAndSetParameter(propertyValue, property, reader);
operations.add(property);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void initializeRolloutPlans(ModelNode address, List<ModelNode> list) {
ModelNode addAddress = address.clone().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS);
ModelNode addOp = Util.getEmptyOperation(ADD, addAddress);
list.add(addOp);
}
代码示例来源:origin: org.jboss.as/jboss-as-host-controller
private void addSystemProperties(List<ModelNode> updates) {
Map<String, String> props = getAllSystemProperties(false);
for (Map.Entry<String, String> entry : props.entrySet()) {
ModelNode address = new ModelNode();
address.add(SYSTEM_PROPERTY, entry.getKey());
ModelNode op = Util.getEmptyOperation(SystemPropertyAddHandler.OPERATION_NAME, address);
if (entry.getValue() != null) {
op.get(VALUE).set(entry.getValue());
}
updates.add(op);
}
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private static void convertSimpleResources(ModelNode model, String type, ModelNode baseAddress, ModelNodeList updates) {
if (model.hasDefined(type)) {
for (Property prop : model.get(type).asPropertyList()) {
ModelNode address = baseAddress.clone().add(type, prop.getName());
ModelNode addOp = Util.getEmptyOperation(ADD, address);
convertAttributesToParams(prop.getValue(), addOp);
updates.add(addOp);
}
}
}
代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan
private void parseLocalCache(XMLExtendedStreamReader reader, PathAddress containerAddress, Map<PathAddress, ModelNode> operations, boolean configurationOnly) throws XMLStreamException {
// ModelNode for the cache add operation
ModelNode cacheConfiguration = Util.getEmptyOperation(ADD, null);
// NOTE: this list is used to avoid lost attribute updates to the cache
// object once it has been added to the operations list
Map<PathAddress, ModelNode> additionalConfigurationOperations = new LinkedHashMap<>();
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
this.parseCacheAttribute(reader, i, attribute, value, cacheConfiguration);
}
if (!cacheConfiguration.hasDefined(ModelKeys.NAME)) {
throw ParseUtils.missingRequired(reader, EnumSet.of(Attribute.NAME));
}
// update the cache configuration address with the cache name
PathAddress cacheConfigurationAddress = addNameToAddress(cacheConfiguration, containerAddress, ModelKeys.LOCAL_CACHE) ;
initPersistenceConfiguration(cacheConfigurationAddress, additionalConfigurationOperations);
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
Element element = Element.forName(reader.getLocalName());
this.parseCacheElement(reader, element, cacheConfiguration, additionalConfigurationOperations);
}
addCacheConfiguration(ModelKeys.LOCAL_CACHE, containerAddress, operations, configurationOnly, cacheConfiguration,
additionalConfigurationOperations, cacheConfigurationAddress);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void startServers() {
ModelNode addr = new ModelNode();
addr.add(HOST, hostControllerInfo.getLocalHostName());
ModelNode op = Util.getEmptyOperation(StartServersHandler.OPERATION_NAME, addr);
getValue().execute(op, null, null, null);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
final ModelNode discoveryOptionAddress = address.clone();
discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
throw ParseUtils.duplicateNamedElement(reader, value);
addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
break;
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void initializeRolloutPlans(ModelNode address, List<ModelNode> list) {
ModelNode addAddress = address.clone().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS);
ModelNode addOp = Util.getEmptyOperation(ADD, addAddress);
list.add(addOp);
}
代码示例来源:origin: wildfly/wildfly-core
private void addSystemProperties(List<ModelNode> updates) {
Map<String, String> props = getAllSystemProperties(false);
for (Map.Entry<String, String> entry : props.entrySet()) {
ModelNode address = new ModelNode();
address.add(SYSTEM_PROPERTY, entry.getKey());
ModelNode op = Util.getEmptyOperation(SystemPropertyAddHandler.OPERATION_NAME, address);
if (entry.getValue() != null) {
op.get(VALUE).set(entry.getValue());
}
updates.add(op);
}
}
代码示例来源:origin: wildfly/wildfly-core
private static void convertSimpleResources(ModelNode model, String type, ModelNode baseAddress, ModelNodeList updates) {
if (model.hasDefined(type)) {
for (Property prop : model.get(type).asPropertyList()) {
ModelNode address = baseAddress.clone().add(type, prop.getName());
ModelNode addOp = Util.getEmptyOperation(ADD, address);
convertAttributesToParams(prop.getValue(), addOp);
updates.add(addOp);
}
}
}
代码示例来源:origin: org.infinispan.server/infinispan-server-infinispan
private void parseInvalidationCache(XMLExtendedStreamReader reader, PathAddress containerAddress, Map<PathAddress, ModelNode> operations, boolean configurationOnly) throws XMLStreamException {
// ModelNode for the cache add operation
ModelNode cacheConfiguration = Util.getEmptyOperation(ModelDescriptionConstants.ADD, null);
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
this.parseClusteredCacheAttribute(reader, i, attribute, value, cacheConfiguration);
}
validateClusteredCacheAttributes(reader, cacheConfiguration);
// update the cache address with the cache name
PathAddress cacheConfigurationAddress = addNameToAddress(cacheConfiguration, containerAddress, ModelKeys.INVALIDATION_CACHE);
Map<PathAddress, ModelNode> additionalConfigurationOperations = new LinkedHashMap<>();
initPersistenceConfiguration(cacheConfigurationAddress, additionalConfigurationOperations);
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
Element element = Element.forName(reader.getLocalName());
switch (element) {
default: {
this.parseCacheElement(reader, element, cacheConfiguration, additionalConfigurationOperations);
}
}
}
addCacheConfiguration(ModelKeys.INVALIDATION_CACHE, containerAddress, operations, configurationOnly, cacheConfiguration,
additionalConfigurationOperations, cacheConfigurationAddress);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
final ModelNode discoveryOptionAddress = address.clone();
discoveryOptionAddress.add(CORE_SERVICE, DISCOVERY_OPTIONS);
final ModelNode addOp = Util.getEmptyOperation(ADD, new ModelNode());
list.add(addOp);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
requireNoNamespaceAttribute(reader, i);
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
throw ParseUtils.duplicateNamedElement(reader, value);
addOp.get(OP_ADDR).set(discoveryOptionAddress).add(DISCOVERY_OPTION, value);
break;
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void initializeRolloutPlans(ModelNode address, List<ModelNode> list) {
ModelNode addAddress = address.clone().add(MANAGEMENT_CLIENT_CONTENT, ROLLOUT_PLANS);
ModelNode addOp = Util.getEmptyOperation(ADD, addAddress);
list.add(addOp);
}
代码示例来源:origin: org.wildfly.core/wildfly-host-controller
private void addRoleMappings(ModelNode accessControl, ModelNode baseAddress, ModelNodeList updates) {
if (accessControl.hasDefined(ROLE_MAPPING)) {
for (Property roleProp : accessControl.get(ROLE_MAPPING).asPropertyList()) {
ModelNode roleAddress = baseAddress.clone().add(ROLE_MAPPING, roleProp.getName());
updates.add(Util.getEmptyOperation(ADD, roleAddress));
ModelNode roleMapping = roleProp.getValue();
convertSimpleResources(roleMapping, INCLUDE, roleAddress, updates);
convertSimpleResources(roleMapping, EXCLUDE, roleAddress, updates);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!