use of org.jboss.as.controller.parsing.ParseUtils.unexpectedElement in project wildfly by wildfly.
the class MessagingSubsystemParser method processConnectors.
void processConnectors(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> updates) throws XMLStreamException {
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
String name = null;
String socketBinding = null;
String serverId = null;
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String attrValue = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case NAME:
{
name = attrValue;
break;
}
case SOCKET_BINDING:
{
socketBinding = attrValue;
break;
}
case SERVER_ID:
{
serverId = attrValue;
break;
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (name == null) {
throw missingRequired(reader, Collections.singleton(Attribute.NAME));
}
final ModelNode connectorAddress = address.clone();
final ModelNode operation = new ModelNode();
operation.get(OP).set(ADD);
boolean generic = false;
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case CONNECTOR:
{
operation.get(OP_ADDR).set(connectorAddress.add(CONNECTOR, name));
if (socketBinding != null) {
operation.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).set(socketBinding);
}
generic = true;
break;
}
case NETTY_CONNECTOR:
{
operation.get(OP_ADDR).set(connectorAddress.add(REMOTE_CONNECTOR, name));
if (socketBinding == null) {
throw missingRequired(reader, Collections.singleton(Attribute.SOCKET_BINDING));
}
operation.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).set(socketBinding);
break;
}
case IN_VM_CONNECTOR:
{
operation.get(OP_ADDR).set(connectorAddress.add(IN_VM_CONNECTOR, name));
if (serverId != null) {
InVMTransportDefinition.SERVER_ID.parseAndSetParameter(serverId, operation, reader);
}
break;
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
updates.add(operation);
parseTransportConfiguration(reader, operation, generic, updates);
}
}
use of org.jboss.as.controller.parsing.ParseUtils.unexpectedElement in project wildfly by wildfly.
the class MessagingSubsystemParser method processJMSTopic.
static void processJMSTopic(final XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> updates) throws XMLStreamException {
final String name = reader.getAttributeValue(0);
if (name == null) {
throw missingRequired(reader, Collections.singleton("name"));
}
final ModelNode topic = new ModelNode();
topic.get(OP).set(ADD);
topic.get(OP_ADDR).set(address).add(JMS_TOPIC, name);
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case ENTRY:
{
final String entry = readStringAttributeElement(reader, CommonAttributes.NAME);
CommonAttributes.DESTINATION_ENTRIES.parseAndAddParameterElement(entry, topic, reader);
break;
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
}
updates.add(topic);
}
use of org.jboss.as.controller.parsing.ParseUtils.unexpectedElement in project wildfly by wildfly.
the class MessagingSubsystemParser method processJmsConnectors.
static ModelNode processJmsConnectors(final XMLExtendedStreamReader reader) throws XMLStreamException {
final ModelNode connectors = new ModelNode();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
String name = null;
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case CONNECTOR_NAME:
{
name = value.trim();
break;
}
case BACKUP_CONNECTOR_NAME:
{
MessagingLogger.ROOT_LOGGER.deprecatedXMLAttribute(attribute.toString());
break;
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (name == null) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.CONNECTOR_NAME));
}
final Element element = Element.forName(reader.getLocalName());
if (element != Element.CONNECTOR_REF) {
throw ParseUtils.unexpectedElement(reader);
}
ParseUtils.requireNoContent(reader);
// create the connector node
connectors.get(name);
}
return connectors;
}
use of org.jboss.as.controller.parsing.ParseUtils.unexpectedElement in project wildfly by wildfly.
the class MessagingSubsystemParser method processAcceptors.
void processAcceptors(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> updates) throws XMLStreamException {
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
String name = null;
String socketBinding = null;
String serverId = null;
int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String attrValue = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case NAME:
{
name = attrValue;
break;
}
case SOCKET_BINDING:
{
socketBinding = attrValue;
break;
}
case SERVER_ID:
{
serverId = attrValue;
break;
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (name == null) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.NAME));
}
final ModelNode acceptorAddress = address.clone();
final ModelNode operation = new ModelNode();
operation.get(OP).set(ADD);
boolean generic = false;
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case ACCEPTOR:
{
operation.get(OP_ADDR).set(acceptorAddress.add(ACCEPTOR, name));
if (socketBinding != null) {
operation.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).set(socketBinding);
}
generic = true;
break;
}
case NETTY_ACCEPTOR:
{
operation.get(OP_ADDR).set(acceptorAddress.add(REMOTE_ACCEPTOR, name));
if (socketBinding == null) {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.SOCKET_BINDING));
}
operation.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).set(socketBinding);
break;
}
case IN_VM_ACCEPTOR:
{
operation.get(OP_ADDR).set(acceptorAddress.add(IN_VM_ACCEPTOR, name));
if (serverId != null) {
InVMTransportDefinition.SERVER_ID.parseAndSetParameter(serverId, operation, reader);
}
break;
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
updates.add(operation);
parseTransportConfiguration(reader, operation, generic, updates);
}
}
use of org.jboss.as.controller.parsing.ParseUtils.unexpectedElement in project wildfly by wildfly.
the class Messaging13SubsystemParser method processJmsBridgeResource.
private void processJmsBridgeResource(XMLExtendedStreamReader reader, ModelNode operation, String modelName) throws XMLStreamException {
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch(element) {
case USER:
case PASSWORD:
handleElementText(reader, element, modelName, operation);
break;
case CONNECTION_FACTORY:
case DESTINATION:
handleSingleAttribute(reader, element, modelName, CommonAttributes.NAME, operation);
break;
case CONTEXT:
ModelNode context = operation.get(element.getDefinition(modelName).getName());
processContext(reader, context);
break;
default:
throw ParseUtils.unexpectedElement(reader);
}
}
}
Aggregations