private static void transformIorSettings(final ModelNode model, final ModelNode legacyValue) { for (final Property category : legacyValue.get(JacORBSubsystemConstants.DEFAULT).get(JacORBSubsystemConstants.SETTING) .asPropertyList()) { for (final Property property : category.getValue().asPropertyList()) { model.get(property.getName()).set(property.getValue()); } } } }
private void checkPropertiesWithExpression(final ModelNode legacyModel, final List<String> warnings) { final List<String> transformedExpressionProperties = new LinkedList<>(); for (Property property : legacyModel.asPropertyList()) { if (property.getValue().getType() == EXPRESSION && TRANSFORMED_PROPERTIES.contains(property.getName())) { transformedExpressionProperties.add(property.getName()); } } if (!transformedExpressionProperties.isEmpty()) { warnings.add(JacORBLogger.ROOT_LOGGER.expressionMigrationWarning(transformedExpressionProperties.toString())); } }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.moduleName = MODULE.resolveModelAttribute(context, model).asString(); this.properties.clear(); for (Property property : ModelNodes.optionalPropertyList(PROPERTIES.resolveModelAttribute(context, model)).orElse(Collections.emptyList())) { this.properties.put(property.getName(), property.getValue().asString()); } this.statisticsEnabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBooleanOrNull(); return this; }
private void addCommonHostListenerDeps(OperationContext context, ServiceBuilder<WebServerService> builder, final PathElement listenerPath) { ModelNode listeners = Resource.Tools.readModel(context.readResource(PathAddress.pathAddress(listenerPath)), 1); if (listeners.isDefined()) { for (Property p : listeners.asPropertyList()) { for (Property listener : p.getValue().asPropertyList()) { builder.requires(ListenerResourceDefinition.LISTENER_CAPABILITY.getCapabilityServiceName(listener.getName())); } } } } }
private static void writeAuthToken(XMLExtendedStreamWriter writer, Property token) throws XMLStreamException { writer.writeStartElement(XMLElement.forAuthTokenName(token.getName()).getLocalName()); if (PlainAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) { writeAttributes(writer, token.getValue(), AuthTokenResourceDefinition.Attribute.class); } if (DigestAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) { writeAttributes(writer, token.getValue(), Stream.concat(EnumSet.allOf(AuthTokenResourceDefinition.Attribute.class).stream(), EnumSet.allOf(DigestAuthTokenResourceDefinition.Attribute.class).stream())); } if (CipherAuthTokenResourceDefinition.PATH.getValue().equals(token.getName())) { writeAttributes(writer, token.getValue(), Stream.concat(EnumSet.allOf(AuthTokenResourceDefinition.Attribute.class).stream(), EnumSet.allOf(CipherAuthTokenResourceDefinition.Attribute.class).stream())); } writer.writeEndElement(); }
private static void readProperties(XMLExtendedStreamReader reader, ModelNode operation) throws XMLStreamException { while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { XMLElement element = XMLElement.forName(reader.getLocalName()); switch (element) { case PROPERTY: { Property property = ParseUtils.readProperty(reader, true); operation.get(LoadMetricResourceDefinition.SharedAttribute.PROPERTY.getName()).get(property.getName()).set(property.getValue()); break; } default: { throw unexpectedElement(reader); } } } }
private Map<String, String> unwrap(final ModelNode model) { if (!model.hasDefined(PARAMETERS.getName())) { return Collections.emptyMap(); } ModelNode modelProps = model.get(PARAMETERS.getName()); Map<String, String> props = new HashMap<String, String>(); for (Property p : modelProps.asPropertyList()) { props.put(p.getName(), p.getValue().asString()); } return props; } }
private void writeLoginModuleStack(XMLExtendedStreamWriter writer, ModelNode modelNode) throws XMLStreamException { if (modelNode.isDefined() && modelNode.asInt() > 0) { List<Property> stacks = modelNode.asPropertyList(); for (Property stack : stacks) { writer.writeStartElement(Element.LOGIN_MODULE_STACK.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), stack.getName()); writeLoginModule(writer, stack.getValue(), Constants.LOGIN_MODULE); writer.writeEndElement(); } } }
private static void writeGenericProtocolAttributes(XMLExtendedStreamWriter writer, Property property) throws XMLStreamException { writer.writeAttribute(XMLAttribute.TYPE.getLocalName(), property.getName()); writeAttributes(writer, property.getValue(), EnumSet.complementOf(EnumSet.of(AbstractProtocolResourceDefinition.Attribute.PROPERTIES))); }
@SuppressWarnings("deprecation") private static void writeProtocolAttributes(XMLExtendedStreamWriter writer, Property property) throws XMLStreamException { writeGenericProtocolAttributes(writer, property); String protocol = property.getName(); if (containsName(ProtocolRegistration.MulticastProtocol.class, protocol)) { writeAttributes(writer, property.getValue(), SocketBindingProtocolResourceDefinition.Attribute.class); } else if (containsName(ProtocolRegistration.JdbcProtocol.class, protocol)) { writeAttributes(writer, property.getValue(), JDBCProtocolResourceDefinition.Attribute.class); } else if (containsName(ProtocolRegistration.EncryptProtocol.class, protocol)) { writeAttributes(writer, property.getValue(), EncryptProtocolResourceDefinition.Attribute.class); } else if (containsName(ProtocolRegistration.InitialHostsProtocol.class, protocol)) { writeAttributes(writer, property.getValue(), SocketDiscoveryProtocolResourceDefinition.Attribute.class); } else if (containsName(ProtocolRegistration.AuthProtocol.class, protocol)) { writeAuthToken(writer, property.getValue().get(AuthTokenResourceDefinition.WILDCARD_PATH.getKey()).asProperty()); } else { writeAttributes(writer, property.getValue(), GenericProtocolResourceDefinition.DeprecatedAttribute.class); } }
@Override public ServiceConfigurator configure(OperationContext context, ModelNode model) throws OperationFailedException { this.passivation = PASSIVATION.resolveModelAttribute(context, model).asBoolean(); this.fetchState = FETCH_STATE.resolveModelAttribute(context, model).asBoolean(); this.preload = PRELOAD.resolveModelAttribute(context, model).asBoolean(); this.purge = PURGE.resolveModelAttribute(context, model).asBoolean(); this.shared = SHARED.resolveModelAttribute(context, model).asBoolean(); this.maxBatchSize = MAX_BATCH_SIZE.resolveModelAttribute(context, model).asInt(); this.properties.clear(); for (Property property : ModelNodes.optionalPropertyList(PROPERTIES.resolveModelAttribute(context, model)).orElse(Collections.emptyList())) { this.properties.setProperty(property.getName(), property.getValue().asString()); } return this; }
static Properties resolvePropertyValue(final OperationContext context, final ModelNode operation, final AttributeDefinition attribute) throws OperationFailedException { // Get the properties final Properties properties = new Properties(); if (operation.hasDefined(attribute.getName())) { for (Property p : resolveValue(context, operation, attribute).asPropertyList()) { properties.put(p.getName(), p.getValue().asString()); } } return properties; }
private void writeManagedExecutorServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException { writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICES.getLocalName()); for (Property property : subModel.asPropertyList()) { writer.writeStartElement(Element.MANAGED_EXECUTOR_SERVICE.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName()); for(SimpleAttributeDefinition ad : ManagedExecutorServiceResourceDefinition.ATTRIBUTES) { ad.marshallAsAttribute(property.getValue(), writer); } writer.writeEndElement(); } writer.writeEndElement(); }
private void writeApplicationSecurityDomain(final XMLExtendedStreamWriter writer, final Property property) throws XMLStreamException { writer.writeStartElement(APPLICATION_SECURITY_DOMAIN); writer.writeAttribute(EJB3SubsystemXMLAttribute.NAME.getLocalName(), property.getName()); ApplicationSecurityDomainDefinition.SECURITY_DOMAIN.marshallAsAttribute(property.getValue(), writer); ApplicationSecurityDomainDefinition.ENABLE_JACC.marshallAsAttribute(property.getValue(), writer); writer.writeEndElement(); }
private void addOpenjdkSubsystem(final PathAddress address, final ModelNode model, final Map<PathAddress, ModelNode> migrateOperations) { final ModelNode operation = Util.createAddOperation(address); for (final Property property : model.asPropertyList()) { if (property.getValue().isDefined()) { operation.get(property.getName()).set(property.getValue()); } } migrateOperations.put(address, operation); }
private void writeContextServices(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException { writer.writeStartElement(Element.CONTEXT_SERVICES.getLocalName()); for (Property property : subModel.asPropertyList()) { writer.writeStartElement(Element.CONTEXT_SERVICE.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName()); for(SimpleAttributeDefinition ad : ContextServiceResourceDefinition.ATTRIBUTES) { ad.marshallAsAttribute(property.getValue(), writer); } writer.writeEndElement(); } writer.writeEndElement(); }
private void writeExternalContext(final Property binding, final XMLExtendedStreamWriter writer) throws XMLStreamException { writer.writeStartElement(NamingSubsystemXMLElement.EXTERNAL_CONTEXT.getLocalName()); writer.writeAttribute(NamingSubsystemXMLAttribute.NAME.getLocalName(), binding.getName()); NamingBindingResourceDefinition.MODULE.marshallAsAttribute(binding.getValue(), writer); NamingBindingResourceDefinition.CLASS.marshallAsAttribute(binding.getValue(), writer); NamingBindingResourceDefinition.CACHE.marshallAsAttribute(binding.getValue(), writer); NamingBindingResourceDefinition.ENVIRONMENT.marshallAsElement(binding.getValue(), writer); writer.writeEndElement(); }
@Override public void marshallAsElement(AttributeDefinition attribute, ModelNode model, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { if (model.hasDefined(attribute.getName())) { for (Property property : model.get(attribute.getName()).asPropertyList()) { writer.writeStartElement(Element.PROPERTY.getLocalName()); writer.writeAttribute(Element.NAME.getLocalName(), property.getName()); writer.writeCharacters(property.getValue().asString()); writer.writeEndElement(); } } } };
private void writeManagedThreadFactories(final XMLExtendedStreamWriter writer, final ModelNode subModel) throws XMLStreamException { writer.writeStartElement(Element.MANAGED_THREAD_FACTORIES.getLocalName()); for (Property property : subModel.asPropertyList()) { writer.writeStartElement(Element.MANAGED_THREAD_FACTORY.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName()); for(SimpleAttributeDefinition ad : ManagedThreadFactoryResourceDefinition.ATTRIBUTES) { ad.marshallAsAttribute(property.getValue(), writer); } writer.writeEndElement(); } writer.writeEndElement(); }
private void writeObjectFactoryBinding(final Property binding, final XMLExtendedStreamWriter writer) throws XMLStreamException { writer.writeStartElement(NamingSubsystemXMLElement.OBJECT_FACTORY.getLocalName()); writer.writeAttribute(NamingSubsystemXMLAttribute.NAME.getLocalName(), binding.getName()); NamingBindingResourceDefinition.MODULE.marshallAsAttribute(binding.getValue(), writer); NamingBindingResourceDefinition.CLASS.marshallAsAttribute(binding.getValue(), writer); NamingBindingResourceDefinition.ENVIRONMENT.marshallAsElement(binding.getValue(), writer); writer.writeEndElement(); }