Refine search
@Override public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { for (ModelNode property : resourceModel.get(attribute.getName()).asList()) { writer.writeStartElement(attribute.getXmlName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeCharacters(property.asProperty().getValue().asString()); writer.writeEndElement(); } }
List<ModelNode> defaultFirst = new ArrayList<>(); for (Property prop : workManagers) { ModelNode workManager = prop.getValue(); if ("default".equals(workManager.get(NAME).asString())) { defaultFirst.add(0, workManager); ThreadsParser.getInstance().writeBoundedQueueThreadPool(writer, workManager.get(WORKMANAGER_SHORT_RUNNING).asProperty(), Element.SHORT_RUNNING_THREADS.getLocalName(), false, true); ThreadsParser.getInstance().writeBoundedQueueThreadPool(writer, workManager.get(WORKMANAGER_LONG_RUNNING).asProperty(), Element.LONG_RUNNING_THREADS.getLocalName(), false, true);
@Override public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { for (ModelNode property : resourceModel.get(attribute.getName()).asList()) { writer.writeStartElement(attribute.getXmlName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeCharacters(property.asProperty().getValue().asString()); writer.writeEndElement(); } }
private void writeLoginModule(XMLExtendedStreamWriter writer, ModelNode modelNode, String key, final String elementName) throws XMLStreamException { if (!modelNode.hasDefined(key)){ return; } final ModelNode modules = modelNode.get(key); for (Property moduleProp : modules.asPropertyList()) { ModelNode module = moduleProp.getValue(); writer.writeStartElement(elementName); if (!moduleProp.getName().equals(module.get(CODE).asString())) { writer.writeAttribute(NAME, moduleProp.getName()); } LoginModuleResourceDefinition.CODE.marshallAsAttribute(module, writer); LoginModuleResourceDefinition.FLAG.marshallAsAttribute(module, writer); MappingModuleDefinition.TYPE.marshallAsAttribute(module, writer); JASPIMappingModuleDefinition.LOGIN_MODULE_STACK_REF.marshallAsAttribute(module, writer); LoginModuleResourceDefinition.MODULE.marshallAsAttribute(module, false, writer); if (module.hasDefined(Constants.MODULE_OPTIONS)) { for (ModelNode option : module.get(Constants.MODULE_OPTIONS).asList()) { writer.writeEmptyElement(Element.MODULE_OPTION.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), option.asProperty().getName()); writer.writeAttribute(Attribute.VALUE.getLocalName(), option.asProperty().getValue().asString()); } } writer.writeEndElement(); } }
@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); } }
if (WORKMANAGER_LONG_RUNNING.equals(prop.getName()) && prop.getValue().isDefined() && prop.getValue().asPropertyList().size() != 0) { ThreadsParser.getInstance().writeBoundedQueueThreadPool(writer, prop.getValue().asProperty(), Element.LONG_RUNNING_THREADS.getLocalName(), false, true); if (WORKMANAGER_SHORT_RUNNING.equals(prop.getName()) && prop.getValue().isDefined() && prop.getValue().asPropertyList().size() != 0) { ThreadsParser.getInstance().writeBoundedQueueThreadPool(writer, prop.getValue().asProperty(), Element.SHORT_RUNNING_THREADS.getLocalName(), false, true);
private static void writeSingletonPolicy(XMLExtendedStreamWriter writer, String name, ModelNode policy) throws XMLStreamException { writer.writeStartElement(XMLElement.SINGLETON_POLICY.getLocalName()); writer.writeAttribute(XMLAttribute.NAME.getLocalName(), name); writeAttributes(writer, policy, SingletonPolicyResourceDefinition.Attribute.class); if (policy.hasDefined(ElectionPolicyResourceDefinition.WILDCARD_PATH.getKey())) { Property property = policy.get(ElectionPolicyResourceDefinition.WILDCARD_PATH.getKey()).asProperty(); writeElectionPolicy(writer, property.getName(), property.getValue()); } writer.writeEndElement(); }
writer.writeStartElement(XMLElement.CHANNEL.getLocalName()); writer.writeAttribute(XMLAttribute.NAME.getLocalName(), property.getName()); ModelNode channel = property.getValue(); writeAttributes(writer, channel, ChannelResourceDefinition.Attribute.class); writer.writeStartElement(XMLElement.FORK.getLocalName()); writer.writeAttribute(XMLAttribute.NAME.getLocalName(), forkProperty.getName()); ModelNode fork = forkProperty.getValue(); if (fork.hasDefined(ProtocolResourceDefinition.WILDCARD_PATH.getKey())) { for (Property protocol: fork.get(ProtocolResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) { writer.writeStartElement(XMLElement.STACK.getLocalName()); writer.writeAttribute(XMLAttribute.NAME.getLocalName(), property.getName()); ModelNode stack = property.getValue(); writeAttributes(writer, stack, StackResourceDefinition.Attribute.class); if (stack.hasDefined(TransportResourceDefinition.WILDCARD_PATH.getKey())) { writeTransport(writer, stack.get(TransportResourceDefinition.WILDCARD_PATH.getKey()).asProperty());
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(REALM_MAPPING); writer.writeAttribute(FROM, property.asProperty().getName()); writer.writeAttribute(TO, property.asProperty().getValue().asString()); } })
private Properties getProperties(ModelNode loader) { final Properties properties = new TypedProperties(); if (loader.hasDefined(ModelKeys.PROPERTY)) { for (Property property : loader.get(ModelKeys.PROPERTY).asPropertyList()) { String propertyName = property.getName(); Property complexValue = property.getValue().asProperty(); String propertyValue = complexValue.getValue().asString(); properties.setProperty(propertyName, propertyValue); } } return properties; }
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode mapping, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(SNI_MAPPING); Property mappingProperty = mapping.asProperty(); writer.writeAttribute(HOST, mappingProperty.getName()); writer.writeAttribute(SSL_CONTEXT, mappingProperty.getValue().asString()); } });
private void writeProperties(XMLExtendedStreamWriter writer, ModelNode sasl) throws XMLStreamException { if (sasl.hasDefined(ModelKeys.PROPERTY)) { for (Property property: sasl.get(ModelKeys.PROPERTY).asPropertyList()) { writer.writeStartElement(Element.PROPERTY.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName()); Property complexValue = property.getValue().asProperty(); writer.writeCharacters(complexValue.getValue().asString()); writer.writeEndElement(); } } }
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(ROLE_MAPPING); writer.writeAttribute(FROM, property.asProperty().getName()); StringBuilder sb = new StringBuilder(); Iterator<ModelNode> iter = property.asProperty().getValue().asList().iterator(); while (iter.hasNext()) { sb.append(iter.next().asString()); if (iter.hasNext()) sb.append(' '); } writer.writeAttribute(TO, sb.toString()); } })
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(elementName); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.VALUE.getLocalName(), property.asProperty().getValue().asString()); } }
@Override public void marshallSingleElement(AttributeDefinition attribute, ModelNode property, boolean marshallDefault, XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(elementName); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.VALUE.getLocalName(), property.asProperty().getValue().asString()); } }
private void validate(ModelNode namespace, ModelNode namespaces) throws OperationFailedException { if (namespaces.isDefined()) { String namespaceString = namespace.asString(); for (ModelNode node : namespaces.asList()) { if (namespaceString.equals(node.asProperty().getName())) { throw new OperationFailedException(new ModelNode().set(MESSAGES.namespaceAlreadyRegistered(namespaceString, node.asProperty().getValue().asString()))); } } } }
@Override public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { for (ModelNode property : resourceModel.get(attribute.getName()).asList()) { writer.writeStartElement(attribute.getXmlName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeCharacters(property.asProperty().getValue().asString()); writer.writeEndElement(); } }
@Override public void marshallAsElement(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { for (ModelNode property : resourceModel.get(attribute.getName()).asList()) { writer.writeStartElement(attribute.getXmlName()); writer.writeAttribute(org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(), property.asProperty().getName()); writer.writeCharacters(property.asProperty().getValue().asString()); writer.writeEndElement(); } }
private void validate(ModelNode namespace, ModelNode namespaces) throws OperationFailedException { if (namespaces.isDefined()) { String namespaceString = namespace.asString(); for (ModelNode node : namespaces.asList()) { if (namespaceString.equals(node.asProperty().getName())) { throw new OperationFailedException(new ModelNode().set(MESSAGES.namespaceAlreadyRegistered(namespaceString, node.asProperty().getValue().asString()))); } } } }
public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { if (value.asProperty().getName().length() < 1) { throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidMinLength(value.asProperty().getName(), parameterName, 1))); } if (valueValidator != null) { valueValidator.validateParameter(parameterName, value.asProperty().getValue()); } } } }