archiveOrModuleName = model.get(MODULE.getName()).asString(); final ModelNode compensating = Util.getEmptyOperation(ADD, opAddr); ModelNode raCompensatingNode = raNode.clone(); compensating.get(RESOURCEADAPTERS_NAME).add(raCompensatingNode);
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); }
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); } }
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); }
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); }
/** * 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); }
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); }
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); }
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); } }
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); } } }
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); }
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); }
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;
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); }
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); } }
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); } } }
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); }
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;
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); }
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); } } }