Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMAttribute


    boolean bool) throws XMLStreamException {
    if (this.getNamespace() != null)
      this.declareNamespace(this.getNamespace());
    Iterator i = this.getAllAttributes();
    while (i.hasNext()) {
      OMAttribute attr = (OMAttribute) i.next();
      if (attr.getNamespace() != null)
        this.declareNamespace(attr.getNamespace());
    }
    super.internalSerialize(writer, bool);
  }
View Full Code Here


              } else if (el instanceof Element) {
                Element element = (Element) el;
                baseUri = element.getBaseUri();
              }
            } else if (o instanceof OMAttribute) {
              OMAttribute attr = (OMAttribute) o;
              Element element = (Element) context.getNavigator().getParentNode(attr);
              baseUri = element.getBaseUri();
            }
            if (baseUri != null) {
              resolved = baseUri.resolve(value);
View Full Code Here

        }

        executor.init();

        assert conditionsElem != null;
        OMAttribute defPriorityAttr = conditionsElem.getAttribute(
                new QName(EvaluatorConstants.DEFAULT_PRIORITY));
        if (defPriorityAttr != null) {
            parser = new Parser(Integer.parseInt(defPriorityAttr.getAttributeValue()));
        } else {
            parser = new Parser();
        }

        try {
View Full Code Here

        AggregateMediator mediator = new AggregateMediator();
        processAuditStatus(mediator, elem);

        OMElement corelateOn = elem.getFirstChildWithName(CORELATE_ON_Q);
        if (corelateOn != null) {
            OMAttribute corelateExpr = corelateOn.getAttribute(EXPRESSION_Q);
            if (corelateExpr != null) {
                try {
                    mediator.setCorrelateExpression(
                        SynapseXPathFactory.getSynapseXPath(corelateOn, EXPRESSION_Q));
                } catch (JaxenException e) {
                    handleException("Unable to load the corelate XPATH expression", e);
                }
            }
        }

        OMElement completeCond = elem.getFirstChildWithName(COMPLETE_CONDITION_Q);
        if (completeCond != null) {
            OMAttribute completeTimeout = completeCond.getAttribute(TIMEOUT_Q);
            if (completeTimeout != null) {
                mediator.setCompletionTimeoutMillis(
                        Long.parseLong(completeTimeout.getAttributeValue()) * 1000);
            }

            OMElement messageCount = completeCond.getFirstChildWithName(MESSAGE_COUNT_Q);
            if (messageCount != null) {
                OMAttribute min = messageCount.getAttribute(MIN_Q);
                if (min != null) {
                    mediator.setMinMessagesToComplete(Integer.parseInt(min.getAttributeValue()));
                }

                OMAttribute max = messageCount.getAttribute(MAX_Q);
                if (max != null) {
                    mediator.setMaxMessagesToComplete(Integer.parseInt(max.getAttributeValue()));
                }
            }
        }

        OMElement onComplete = elem.getFirstChildWithName(ON_COMPLETE_Q);
        if (onComplete != null) {

            OMAttribute aggregateExpr = onComplete.getAttribute(EXPRESSION_Q);
            if (aggregateExpr != null) {
                try {
                    mediator.setAggregationExpression(
                        SynapseXPathFactory.getSynapseXPath(onComplete, EXPRESSION_Q));
                } catch (JaxenException e) {
                    handleException("Unable to load the aggregating XPATH", e);
                }
            }

            OMAttribute onCompleteSequence = onComplete.getAttribute(SEQUENCE_Q);
            if (onCompleteSequence != null) {
                mediator.setOnCompleteSequenceRef(onCompleteSequence.getAttributeValue());
            } else if (onComplete.getFirstElement() != null) {
                mediator.setOnCompleteSequence((new SequenceMediatorFactory())
                        .createAnonymousSequence(onComplete, properties));
            } else {
                SequenceMediator sequence = new SequenceMediator();
View Full Code Here

        while (schemas.hasNext()) {
            Object o = schemas.next();
            if (o instanceof OMElement) {
                OMElement omElem = (OMElement) o;
                OMAttribute keyAtt = omElem.getAttribute(ATT_KEY);
                if (keyAtt != null) {
                    schemaKeys.add(keyAtt.getAttributeValue());
                } else {
                    handleException("A 'schema' definition must contain a local property 'key'");
                }
            } else {
                handleException("Invalid 'schema' declaration for validate mediator");
            }
        }

        if (schemaKeys.size() == 0) {
            handleException("No schema specified for the validate mediator");
        } else {
            validateMediator.setSchemaKeys(schemaKeys);
        }

        // process source XPath attribute if present
        OMAttribute attSource = elem.getAttribute(ATT_SOURCE);

        if (attSource != null) {
            try {
                validateMediator.setSource(SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE));
            } catch (JaxenException e) {
View Full Code Here

    @SuppressWarnings({"UnusedDeclaration"})
    public static SynapseEventSource createEventSource(OMElement elem, Properties properties) {

        SynapseEventSource eventSource = null;

        OMAttribute name = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
        if (name == null) {
            handleException("The 'name' attribute is required for a event source de");
        } else {
            eventSource = new SynapseEventSource(name.getAttributeValue());
        }

        OMElement subscriptionManagerElem = elem.getFirstChildWithName(SUBSCRIPTION_MANAGER_QNAME);
        if (eventSource != null && subscriptionManagerElem != null) {

            OMAttribute clazz = subscriptionManagerElem
                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
View Full Code Here

            SynapseSubscription synapseSubscription = new SynapseSubscription();
            OMElement elmSubscription = (OMElement) iterator.next();
            synapseSubscription.setId(elmSubscription.getAttribute(ID_QNAME).getAttributeValue());
            //process the filter
            OMElement elmFilter = elmSubscription.getFirstChildWithName(FILTER_QNAME);
            OMAttribute dialectAttr = elmFilter.getAttribute(FILTER_DIALECT_QNAME);
            if (dialectAttr != null && dialectAttr.getAttributeValue() != null) {

                    OMAttribute sourceAttr = elmFilter.getAttribute(FILTER_SOURCE_QNAME);
                    if (sourceAttr != null) {
                        synapseSubscription.setFilterDialect(dialectAttr.getAttributeValue());
                        synapseSubscription.setFilterValue(sourceAttr.getAttributeValue());
                    } else {
                        handleException(
                                "Error in creating static subscription. Filter source not defined");
                    }            
            } else {
                handleException(
                        "Error in creating static subscription. Filter dialect not defined");
            }
            OMElement elmEndpoint = elmSubscription.getFirstChildWithName(ENDPOINT_QNAME);
            if (elmEndpoint != null) {
                OMElement elmAddress = elmEndpoint.getFirstChildWithName(ADDRESS_QNAME);
                if (elmAddress != null) {
                    OMAttribute uriAttr = elmAddress.getAttribute(EP_URI_QNAME);
                    if (uriAttr != null) {
                        synapseSubscription.setEndpointUrl(uriAttr.getAttributeValue());
                        synapseSubscription.setAddressUrl(uriAttr.getAttributeValue());
                    } else {
                        handleException("Error in creating static subscription. URI not defined");
                    }
                } else {
                    handleException("Error in creating static subscription. Address not defined");
View Full Code Here

        return TAG_NAME;
    }

    protected Mediator createSpecificMediator(OMElement elem, Properties properties) {
        EventPublisherMediator eventPublisherMediator = new EventPublisherMediator();
        OMAttribute attEventSource = elem.getAttribute(PROP_NAME);
        if (attEventSource != null) {
            eventPublisherMediator.setEventSourceName(attEventSource.getAttributeValue());
        } else {
            handleException(
                    "The 'eventSourceName' attribute is required for the EventPublisher mediator");
        }
        return eventPublisherMediator;
View Full Code Here

            = new QName(SynapseConstants.SYNAPSE_NAMESPACE, "description");

    @SuppressWarnings({"UnusedDeclaration"})
    public static MessageStore createMessageStore(OMElement elem, Properties properties) {

        OMAttribute clss = elem.getAttribute(CLASS_Q);
        MessageStore messageStore;
        if (clss != null) {
            try {
                Class cls = Class.forName(clss.getAttributeValue());
                messageStore = (MessageStore) cls.newInstance();
            } catch (Exception e) {
                handleException("Error while instantiating the message store", e);
                return null;
            }
        } else {
            messageStore = new InMemoryMessageStore();
        }

        OMAttribute nameAtt = elem.getAttribute(NAME_Q);
        if (nameAtt != null) {
            messageStore.setName(nameAtt.getAttributeValue());
        } else {
            handleException("Message Store name not specified");
        }

        OMAttribute sequenceAtt = elem.getAttribute(SEQUENCE_Q);
        if(sequenceAtt != null) {
            messageStore.setSequence(sequenceAtt.getAttributeValue());
        }

        OMElement redeliveryElem = elem.getFirstChildWithName(REDELIVERY_Q);

        if (redeliveryElem != null) {
View Full Code Here

        while (params.hasNext()) {
            Object o = params.next();
            if (o instanceof OMElement) {
                OMElement prop = (OMElement) o;
                OMAttribute paramName = prop.getAttribute(NAME_Q);
                String paramValue = prop.getText();
                if (paramName != null) {
                    if (paramValue != null) {
                        parameters.put(paramName.getAttributeValue(), paramValue);
                    }
                } else {
                    handleException("Invalid MessageStore parameter - Parameter must have a name ");
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.