You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/03/17 17:18:47 UTC
svn commit: r519363 [3/16] - in /webservices/synapse/trunk/java:
modules/core/ modules/core/src/main/java/org/apache/synapse/
modules/core/src/main/java/org/apache/synapse/config/
modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/s...
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,193 +1,193 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.mediators.transform.FaultMediator;
-import org.jaxen.JaxenException;
-
-import javax.xml.namespace.QName;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * Creates a fault mediator instance
- *
- * <pre>
- * <makefault [version="soap11|soap12"]>
- * <code (value="literal" | expression="xpath")/>
- * <reason (value="literal" | expression="xpath")>
- * <node>?
- * <role>?
- * <detail>?
- * </makefault>
- * </pre>
- */
-public class FaultMediatorFactory extends AbstractMediatorFactory {
-
- private static final QName FAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "makefault");
-
- private static final QName ATT_VERSION_Q = new QName(Constants.NULL_NAMESPACE, "version");
- private static final QName CODE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "code");
- private static final QName REASON_Q = new QName(Constants.SYNAPSE_NAMESPACE, "reason");
- private static final QName NODE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "node");
- private static final QName ROLE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "role");
- private static final QName DETAIL_Q = new QName(Constants.SYNAPSE_NAMESPACE, "detail");
-
- private static final QName ATT_VALUE_Q = new QName(Constants.NULL_NAMESPACE, "value");
- private static final QName ATT_EXPR_Q = new QName(Constants.NULL_NAMESPACE, "expression");
-
- private static final String SOAP11 = "soap11";
- private static final String SOAP12 = "soap12";
-
- private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
-
- public Mediator createMediator(OMElement elem) {
-
- FaultMediator faultMediator = new FaultMediator();
-
- OMAttribute version = elem.getAttribute(ATT_VERSION_Q);
- if (version != null) {
- if (SOAP11.equals(version.getAttributeValue())) {
- faultMediator.setSoapVersion(FaultMediator.SOAP11);
- } else if (SOAP12.equals(version.getAttributeValue())) {
- faultMediator.setSoapVersion(FaultMediator.SOAP12);
- }else {
- String msg = "Invalid SOAP version";
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
-
- OMElement code = elem.getFirstChildWithName(CODE_Q);
- if (code != null) {
- OMAttribute value = code.getAttribute(ATT_VALUE_Q);
- OMAttribute expression = code.getAttribute(ATT_EXPR_Q);
-
- if (value != null) {
- String strValue = value.getAttributeValue();
- String prefix, name;
- if (strValue.indexOf(":") != -1) {
- prefix = strValue.substring(0, strValue.indexOf(":"));
- name = strValue.substring(strValue.indexOf(":")+1);
- } else {
- String msg = "A QName is expected for fault code as prefix:name";
- log.error(msg);
- throw new SynapseException(msg);
- }
- faultMediator.setFaultCodeValue(
- new QName(OMElementUtils.getNameSpaceWithPrefix(prefix, code), name, prefix));
-
- } else if (expression != null) {
- try {
- AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
- OMElementUtils.addNameSpaces(xp, code, log);
- faultMediator.setFaultCodeExpr(xp);
- } catch (JaxenException je) {
- String msg = "Invalid fault code expression : " + je.getMessage();
- log.error(msg);
- throw new SynapseException(msg, je);
- }
- } else {
- String msg = "A 'value' or 'expression' attribute must specify the fault code";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- } else {
- String msg = "The fault code is a required attribute for the makefault mediator";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- OMElement reason = elem.getFirstChildWithName(REASON_Q);
- if (reason != null) {
- OMAttribute value = reason.getAttribute(ATT_VALUE_Q);
- OMAttribute expression = reason.getAttribute(ATT_EXPR_Q);
-
- if (value != null) {
- faultMediator.setFaultReasonValue(value.getAttributeValue());
- } else if (expression != null) {
- try {
- AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
- OMElementUtils.addNameSpaces(xp, reason, log);
- faultMediator.setFaultReasonExpr(xp);
-
- } catch (JaxenException je) {
- String msg = "Invalid fault reason expression : " + je.getMessage();
- log.error(msg);
- throw new SynapseException(msg, je);
- }
- } else {
- String msg = "A 'value' or 'expression' attribute must specify the fault code";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- } else {
- String msg = "The fault reason is a required attribute for the makefault mediator";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(faultMediator,elem);
-
- OMElement node = elem.getFirstChildWithName(NODE_Q);
- if (node != null && node.getText() != null) {
- try {
- faultMediator.setFaultNode(new URI(node.getText()));
- } catch (URISyntaxException e) {
- String msg = "Invalid URI specified for fault node : " + node.getText();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
-
- OMElement role = elem.getFirstChildWithName(ROLE_Q);
- if (role != null && role.getText() != null) {
- try {
- faultMediator.setFaultRole(new URI(role.getText()));
- } catch (URISyntaxException e) {
- String msg = "Invalid URI specified for fault role : " + role.getText();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
-
- OMElement detail = elem.getFirstChildWithName(DETAIL_Q);
- if (detail != null && detail.getText() != null) {
- faultMediator.setFaultDetail(detail.getText());
- }
-
- return faultMediator;
- }
-
- public QName getTagQName() {
- return FAULT_Q;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.mediators.transform.FaultMediator;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * Creates a fault mediator instance
+ *
+ * <pre>
+ * <makefault [version="soap11|soap12"]>
+ * <code (value="literal" | expression="xpath")/>
+ * <reason (value="literal" | expression="xpath")>
+ * <node>?
+ * <role>?
+ * <detail>?
+ * </makefault>
+ * </pre>
+ */
+public class FaultMediatorFactory extends AbstractMediatorFactory {
+
+ private static final QName FAULT_Q = new QName(Constants.SYNAPSE_NAMESPACE, "makefault");
+
+ private static final QName ATT_VERSION_Q = new QName(Constants.NULL_NAMESPACE, "version");
+ private static final QName CODE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "code");
+ private static final QName REASON_Q = new QName(Constants.SYNAPSE_NAMESPACE, "reason");
+ private static final QName NODE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "node");
+ private static final QName ROLE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "role");
+ private static final QName DETAIL_Q = new QName(Constants.SYNAPSE_NAMESPACE, "detail");
+
+ private static final QName ATT_VALUE_Q = new QName(Constants.NULL_NAMESPACE, "value");
+ private static final QName ATT_EXPR_Q = new QName(Constants.NULL_NAMESPACE, "expression");
+
+ private static final String SOAP11 = "soap11";
+ private static final String SOAP12 = "soap12";
+
+ private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
+
+ public Mediator createMediator(OMElement elem) {
+
+ FaultMediator faultMediator = new FaultMediator();
+
+ OMAttribute version = elem.getAttribute(ATT_VERSION_Q);
+ if (version != null) {
+ if (SOAP11.equals(version.getAttributeValue())) {
+ faultMediator.setSoapVersion(FaultMediator.SOAP11);
+ } else if (SOAP12.equals(version.getAttributeValue())) {
+ faultMediator.setSoapVersion(FaultMediator.SOAP12);
+ }else {
+ String msg = "Invalid SOAP version";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+
+ OMElement code = elem.getFirstChildWithName(CODE_Q);
+ if (code != null) {
+ OMAttribute value = code.getAttribute(ATT_VALUE_Q);
+ OMAttribute expression = code.getAttribute(ATT_EXPR_Q);
+
+ if (value != null) {
+ String strValue = value.getAttributeValue();
+ String prefix, name;
+ if (strValue.indexOf(":") != -1) {
+ prefix = strValue.substring(0, strValue.indexOf(":"));
+ name = strValue.substring(strValue.indexOf(":")+1);
+ } else {
+ String msg = "A QName is expected for fault code as prefix:name";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ faultMediator.setFaultCodeValue(
+ new QName(OMElementUtils.getNameSpaceWithPrefix(prefix, code), name, prefix));
+
+ } else if (expression != null) {
+ try {
+ AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
+ OMElementUtils.addNameSpaces(xp, code, log);
+ faultMediator.setFaultCodeExpr(xp);
+ } catch (JaxenException je) {
+ String msg = "Invalid fault code expression : " + je.getMessage();
+ log.error(msg);
+ throw new SynapseException(msg, je);
+ }
+ } else {
+ String msg = "A 'value' or 'expression' attribute must specify the fault code";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ } else {
+ String msg = "The fault code is a required attribute for the makefault mediator";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ OMElement reason = elem.getFirstChildWithName(REASON_Q);
+ if (reason != null) {
+ OMAttribute value = reason.getAttribute(ATT_VALUE_Q);
+ OMAttribute expression = reason.getAttribute(ATT_EXPR_Q);
+
+ if (value != null) {
+ faultMediator.setFaultReasonValue(value.getAttributeValue());
+ } else if (expression != null) {
+ try {
+ AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
+ OMElementUtils.addNameSpaces(xp, reason, log);
+ faultMediator.setFaultReasonExpr(xp);
+
+ } catch (JaxenException je) {
+ String msg = "Invalid fault reason expression : " + je.getMessage();
+ log.error(msg);
+ throw new SynapseException(msg, je);
+ }
+ } else {
+ String msg = "A 'value' or 'expression' attribute must specify the fault code";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ } else {
+ String msg = "The fault reason is a required attribute for the makefault mediator";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(faultMediator,elem);
+
+ OMElement node = elem.getFirstChildWithName(NODE_Q);
+ if (node != null && node.getText() != null) {
+ try {
+ faultMediator.setFaultNode(new URI(node.getText()));
+ } catch (URISyntaxException e) {
+ String msg = "Invalid URI specified for fault node : " + node.getText();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+
+ OMElement role = elem.getFirstChildWithName(ROLE_Q);
+ if (role != null && role.getText() != null) {
+ try {
+ faultMediator.setFaultRole(new URI(role.getText()));
+ } catch (URISyntaxException e) {
+ String msg = "Invalid URI specified for fault role : " + role.getText();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+
+ OMElement detail = elem.getFirstChildWithName(DETAIL_Q);
+ if (detail != null && detail.getText() != null) {
+ faultMediator.setFaultDetail(detail.getText());
+ }
+
+ return faultMediator;
+ }
+
+ public QName getTagQName() {
+ return FAULT_Q;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FaultMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,117 +1,117 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.mediators.filters.FilterMediator;
-import org.jaxen.JaxenException;
-
-import javax.xml.namespace.QName;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-/**
- * Creates a filter mediator instance
- *
- * <pre>
- * <filter (source="xpath" regex="string") | xpath="xpath">
- * mediator+
- * </filter>
- * </pre>
- */
-public class FilterMediatorFactory extends AbstractListMediatorFactory {
-
- private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
-
- private static final QName FILTER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
-
- public Mediator createMediator(OMElement elem) {
- FilterMediator filter = new FilterMediator();
-
- OMAttribute attXpath = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xpath"));
- OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
- OMAttribute attRegex = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
-
- if (attXpath != null) {
- if (attXpath.getAttributeValue() != null && attXpath.getAttributeValue().trim().length() == 0) {
- String msg = "Invalid attribute value specified for xpath";
- log.error(msg);
- throw new SynapseException(msg);
-
- } else {
- try {
- filter.setXpath(new AXIOMXPath(attXpath.getAttributeValue()));
- } catch (JaxenException e) {
- String msg = "Invalid XPath expression for attribute xpath : " + attXpath.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
- OMElementUtils.addNameSpaces(filter.getXpath(), elem, log);
-
- } else if (attSource != null && attRegex != null) {
-
- if (
- (attSource.getAttributeValue() != null && attSource.getAttributeValue().trim().length() == 0) ||
- (attRegex.getAttributeValue() != null && attRegex.getAttributeValue().trim().length() == 0) ){
- String msg = "Invalid attribute values for source and/or regex specified";
- log.error(msg);
- throw new SynapseException(msg);
-
- } else {
- try {
- filter.setSource(new AXIOMXPath(attSource.getAttributeValue()));
- } catch (JaxenException e) {
- String msg = "Invalid XPath expression for attribute source : " + attSource.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- try {
- filter.setRegex(Pattern.compile(attRegex.getAttributeValue()));
- } catch (PatternSyntaxException pse) {
- String msg = "Invalid Regular Expression for attribute regex : " + attRegex.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
- OMElementUtils.addNameSpaces(filter.getSource(), elem, log);
-
- } else {
- String msg = "An xpath or (source, regex) attributes are required for a filter";
- log.error(msg);
- throw new SynapseException(msg);
- }
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(filter,elem);
- addChildren(elem, filter);
- return filter;
- }
-
- public QName getTagQName() {
- return FILTER_Q;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.mediators.filters.FilterMediator;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * Creates a filter mediator instance
+ *
+ * <pre>
+ * <filter (source="xpath" regex="string") | xpath="xpath">
+ * mediator+
+ * </filter>
+ * </pre>
+ */
+public class FilterMediatorFactory extends AbstractListMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(FaultMediatorFactory.class);
+
+ private static final QName FILTER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "filter");
+
+ public Mediator createMediator(OMElement elem) {
+ FilterMediator filter = new FilterMediator();
+
+ OMAttribute attXpath = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "xpath"));
+ OMAttribute attSource = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "source"));
+ OMAttribute attRegex = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "regex"));
+
+ if (attXpath != null) {
+ if (attXpath.getAttributeValue() != null && attXpath.getAttributeValue().trim().length() == 0) {
+ String msg = "Invalid attribute value specified for xpath";
+ log.error(msg);
+ throw new SynapseException(msg);
+
+ } else {
+ try {
+ filter.setXpath(new AXIOMXPath(attXpath.getAttributeValue()));
+ } catch (JaxenException e) {
+ String msg = "Invalid XPath expression for attribute xpath : " + attXpath.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ OMElementUtils.addNameSpaces(filter.getXpath(), elem, log);
+
+ } else if (attSource != null && attRegex != null) {
+
+ if (
+ (attSource.getAttributeValue() != null && attSource.getAttributeValue().trim().length() == 0) ||
+ (attRegex.getAttributeValue() != null && attRegex.getAttributeValue().trim().length() == 0) ){
+ String msg = "Invalid attribute values for source and/or regex specified";
+ log.error(msg);
+ throw new SynapseException(msg);
+
+ } else {
+ try {
+ filter.setSource(new AXIOMXPath(attSource.getAttributeValue()));
+ } catch (JaxenException e) {
+ String msg = "Invalid XPath expression for attribute source : " + attSource.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ try {
+ filter.setRegex(Pattern.compile(attRegex.getAttributeValue()));
+ } catch (PatternSyntaxException pse) {
+ String msg = "Invalid Regular Expression for attribute regex : " + attRegex.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ OMElementUtils.addNameSpaces(filter.getSource(), elem, log);
+
+ } else {
+ String msg = "An xpath or (source, regex) attributes are required for a filter";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(filter,elem);
+ addChildren(elem, filter);
+ return filter;
+ }
+
+ public QName getTagQName() {
+ return FILTER_Q;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/FilterMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,125 +1,125 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.mediators.transform.HeaderMediator;
-import org.jaxen.JaxenException;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-
-/**
- * This builds a Header Mediator parsing the XML configuration supplied
- *
- * Set header
- * <pre>
- * <header name="qname" (value="literal" | expression="xpath")/>
- * </pre>
- *
- * Remove header
- * <pre>
- * <header name="qname" action="remove"/>
- * </pre>
- */
-public class HeaderMediatorFactory extends AbstractMediatorFactory {
-
- private static final Log log = LogFactory.getLog(HeaderMediatorFactory.class);
-
- private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "header");
-
- public Mediator createMediator(OMElement elem) {
-
- HeaderMediator headerMediator = new HeaderMediator();
- OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
- OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
- OMAttribute exprn = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
- OMAttribute action = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "action"));
-
- if (name == null || name.getAttributeValue() == null) {
- String msg = "A valid name attribute is required for the header mediator";
- log.error(msg);
- throw new SynapseException(msg);
- } else {
- String nameAtt = name.getAttributeValue();
- int colonPos = nameAtt.indexOf(":");
- if (colonPos != -1) {
- // has a NS prefix.. find it and the NS it maps into
- String prefix = nameAtt.substring(0, colonPos);
- Iterator it = elem.getAllDeclaredNamespaces();
- while (it.hasNext()) {
- OMNamespace n = (OMNamespace) it.next();
- if (prefix.equals(n.getPrefix())) {
- headerMediator.setQName(
- new QName(n.getNamespaceURI(), nameAtt.substring(colonPos+1), prefix));
- }
- }
- } else {
- // no prefix
- headerMediator.setQName(new QName(nameAtt));
- }
- }
-
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(headerMediator,elem);
-
- // The action attribute is optional, if provided and equals to 'remove' the
- // header mediator will act as a header remove mediator
- if (action != null && "remove".equals(action.getAttributeValue())) {
- headerMediator.setAction(HeaderMediator.ACTION_REMOVE);
- }
-
- if (headerMediator.getAction() == HeaderMediator.ACTION_SET &&
- value == null && exprn == null) {
- String msg = "A 'value' or 'expression' attribute is required for a [set] header mediator";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- if (value != null && value.getAttributeValue() != null) {
- headerMediator.setValue(value.getAttributeValue());
-
- } else if (exprn != null && exprn.getAttributeValue() != null) {
- try {
- AXIOMXPath xp = new AXIOMXPath(exprn.getAttributeValue());
- OMElementUtils.addNameSpaces(xp, elem, log);
- headerMediator.setExpression(xp);
- } catch (JaxenException je) {
- String msg = "Invalid XPath expression : " + exprn.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg, je);
- }
- }
-
- return headerMediator;
- }
-
- public QName getTagQName() {
- return HEADER_Q;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.mediators.transform.HeaderMediator;
+import org.jaxen.JaxenException;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * This builds a Header Mediator parsing the XML configuration supplied
+ *
+ * Set header
+ * <pre>
+ * <header name="qname" (value="literal" | expression="xpath")/>
+ * </pre>
+ *
+ * Remove header
+ * <pre>
+ * <header name="qname" action="remove"/>
+ * </pre>
+ */
+public class HeaderMediatorFactory extends AbstractMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(HeaderMediatorFactory.class);
+
+ private static final QName HEADER_Q = new QName(Constants.SYNAPSE_NAMESPACE, "header");
+
+ public Mediator createMediator(OMElement elem) {
+
+ HeaderMediator headerMediator = new HeaderMediator();
+ OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
+ OMAttribute value = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "value"));
+ OMAttribute exprn = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "expression"));
+ OMAttribute action = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "action"));
+
+ if (name == null || name.getAttributeValue() == null) {
+ String msg = "A valid name attribute is required for the header mediator";
+ log.error(msg);
+ throw new SynapseException(msg);
+ } else {
+ String nameAtt = name.getAttributeValue();
+ int colonPos = nameAtt.indexOf(":");
+ if (colonPos != -1) {
+ // has a NS prefix.. find it and the NS it maps into
+ String prefix = nameAtt.substring(0, colonPos);
+ Iterator it = elem.getAllDeclaredNamespaces();
+ while (it.hasNext()) {
+ OMNamespace n = (OMNamespace) it.next();
+ if (prefix.equals(n.getPrefix())) {
+ headerMediator.setQName(
+ new QName(n.getNamespaceURI(), nameAtt.substring(colonPos+1), prefix));
+ }
+ }
+ } else {
+ // no prefix
+ headerMediator.setQName(new QName(nameAtt));
+ }
+ }
+
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(headerMediator,elem);
+
+ // The action attribute is optional, if provided and equals to 'remove' the
+ // header mediator will act as a header remove mediator
+ if (action != null && "remove".equals(action.getAttributeValue())) {
+ headerMediator.setAction(HeaderMediator.ACTION_REMOVE);
+ }
+
+ if (headerMediator.getAction() == HeaderMediator.ACTION_SET &&
+ value == null && exprn == null) {
+ String msg = "A 'value' or 'expression' attribute is required for a [set] header mediator";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ if (value != null && value.getAttributeValue() != null) {
+ headerMediator.setValue(value.getAttributeValue());
+
+ } else if (exprn != null && exprn.getAttributeValue() != null) {
+ try {
+ AXIOMXPath xp = new AXIOMXPath(exprn.getAttributeValue());
+ OMElementUtils.addNameSpaces(xp, elem, log);
+ headerMediator.setExpression(xp);
+ } catch (JaxenException je) {
+ String msg = "Invalid XPath expression : " + exprn.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg, je);
+ }
+ }
+
+ return headerMediator;
+ }
+
+ public QName getTagQName() {
+ return HEADER_Q;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/HeaderMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/InMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/InMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,87 +1,87 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.mediators.builtin.LogMediator;
-
-import javax.xml.namespace.QName;
-
-/**
- * Created a Log mediator that logs messages using commons-logging.
- *
- * <pre>
- * <log [level="simple|headers|full|custom"]>
- * <property> *
- * </log>
- * </pre>
- */
-public class LogMediatorFactory extends AbstractMediatorFactory {
-
- private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
-
- private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE, "log");
- private static final String SIMPLE = "simple";
- private static final String HEADERS = "headers";
- private static final String FULL = "full";
- private static final String CUSTOM = "custom";
-
- public QName getTagQName() {
- return LOG_Q;
- }
-
- public Mediator createMediator(OMElement elem) {
-
- LogMediator logMediator = new LogMediator();
-
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(logMediator,elem);
-
- // Set the high level set of properties to be logged (i.e. log level)
- OMAttribute level = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "level"));
- if (level != null) {
- String levelstr = level.getAttributeValue();
- if (SIMPLE.equals(levelstr)) {
- logMediator.setLogLevel(LogMediator.SIMPLE);
- } else if (HEADERS.equals(levelstr)) {
- logMediator.setLogLevel(LogMediator.HEADERS);
- } else if (FULL.equals(levelstr)) {
- logMediator.setLogLevel(LogMediator.FULL);
- } else if (CUSTOM.equals(levelstr)) {
- logMediator.setLogLevel(LogMediator.CUSTOM);
- }
- }
-
- // check if a custom separator has been supplied, if so use it
- OMAttribute separator = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "separator"));
- if (separator != null) {
- logMediator.setSeparator(separator.getAttributeValue());
- }
-
- logMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
-
- return logMediator;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.mediators.builtin.LogMediator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Created a Log mediator that logs messages using commons-logging.
+ *
+ * <pre>
+ * <log [level="simple|headers|full|custom"]>
+ * <property> *
+ * </log>
+ * </pre>
+ */
+public class LogMediatorFactory extends AbstractMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+ private static final QName LOG_Q = new QName(Constants.SYNAPSE_NAMESPACE, "log");
+ private static final String SIMPLE = "simple";
+ private static final String HEADERS = "headers";
+ private static final String FULL = "full";
+ private static final String CUSTOM = "custom";
+
+ public QName getTagQName() {
+ return LOG_Q;
+ }
+
+ public Mediator createMediator(OMElement elem) {
+
+ LogMediator logMediator = new LogMediator();
+
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(logMediator,elem);
+
+ // Set the high level set of properties to be logged (i.e. log level)
+ OMAttribute level = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "level"));
+ if (level != null) {
+ String levelstr = level.getAttributeValue();
+ if (SIMPLE.equals(levelstr)) {
+ logMediator.setLogLevel(LogMediator.SIMPLE);
+ } else if (HEADERS.equals(levelstr)) {
+ logMediator.setLogLevel(LogMediator.HEADERS);
+ } else if (FULL.equals(levelstr)) {
+ logMediator.setLogLevel(LogMediator.FULL);
+ } else if (CUSTOM.equals(levelstr)) {
+ logMediator.setLogLevel(LogMediator.CUSTOM);
+ }
+ }
+
+ // check if a custom separator has been supplied, if so use it
+ OMAttribute separator = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "separator"));
+ if (separator != null) {
+ logMediator.setSeparator(separator.getAttributeValue());
+ }
+
+ logMediator.addAllProperties(MediatorPropertyFactory.getMediatorProperties(elem));
+
+ return logMediator;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/LogMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.synapse.Mediator;
-
-import javax.xml.namespace.QName;
-
-/**
- * A mediator factory capable of creating an instance of a mediator through a given
- * XML should implement this interface
- */
-public interface MediatorFactory {
- /**
- * Creates an instance of the mediator using the OMElement
- * @param elem
- * @return the created mediator
- */
- public Mediator createMediator(OMElement elem);
-
- /**
- * The QName of this mediator element in the XML config
- * @return QName of the mediator element
- */
- public QName getTagQName();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.synapse.Mediator;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A mediator factory capable of creating an instance of a mediator through a given
+ * XML should implement this interface
+ */
+public interface MediatorFactory {
+ /**
+ * Creates an instance of the mediator using the OMElement
+ * @param elem
+ * @return the created mediator
+ */
+ public Mediator createMediator(OMElement elem);
+
+ /**
+ * The QName of this mediator element in the XML config
+ * @return QName of the mediator element
+ */
+ public QName getTagQName();
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactoryFinder.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactoryFinder.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactoryFinder.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactoryFinder.java Sat Mar 17 09:18:32 2007
@@ -1,203 +1,203 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.synapse.config.xml;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.config.XMLToObjectMapper;
-import sun.misc.Service;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- *
- *
- * This class is based on J2SE Service Provider model
- * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
- */
-
-public class MediatorFactoryFinder implements XMLToObjectMapper {
-
- private static final Log log = LogFactory.getLog(MediatorFactoryFinder.class);
-
- private static final Class[] mediatorFactories = {
- SequenceMediatorFactory.class,
- LogMediatorFactory.class,
- SendMediatorFactory.class,
- FilterMediatorFactory.class,
- SynapseMediatorFactory.class,
- DropMediatorFactory.class,
- HeaderMediatorFactory.class,
- FaultMediatorFactory.class,
- PropertyMediatorFactory.class,
- SwitchMediatorFactory.class,
- InMediatorFactory.class,
- OutMediatorFactory.class,
- RMSequenceMediatorFactory.class,
- ClassMediatorFactory.class,
- };
-
- private static MediatorFactoryFinder instance = null;
-
- /**
- * A map of mediator QNames to implementation class
- */
- private static Map factoryMap = new HashMap();
-
- public static synchronized MediatorFactoryFinder getInstance() {
- if (instance == null) {
- instance = new MediatorFactoryFinder();
- }
- return instance;
- }
-
- /**
- * Force re initialization next time
- */
- public synchronized void reset() {
- factoryMap.clear();
- instance = null;
- }
-
- private MediatorFactoryFinder() {
-
- factoryMap = new HashMap();
-
- for (int i = 0; i < mediatorFactories.length; i++) {
- Class c = mediatorFactories[i];
- try {
- MediatorFactory fac = (MediatorFactory) c.newInstance();
- factoryMap.put(fac.getTagQName(), c);
- } catch (Exception e) {
- throw new SynapseException("Error instantiating " + c.getName(), e);
- }
- }
- // now iterate through the available pluggable mediator factories
- registerExtensions();
- }
-
- private void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new SynapseException(msg, e);
- }
-
- private void handleException(String msg) {
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- /**
- * Register pluggable mediator factories from the classpath
- *
- * This looks for JAR files containing a META-INF/services that adheres to the following
- * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
- */
- private void registerExtensions() {
-
- //log.debug("Registering mediator extensions found in the classpath : " + System.getResource("java.class.path"));
-
- // register MediatorFactory extensions
- Iterator it = Service.providers(MediatorFactory.class);
- while (it.hasNext()) {
- MediatorFactory mf = (MediatorFactory) it.next();
- QName tag = mf.getTagQName();
- factoryMap.put(tag, mf.getClass());
- log.debug("Added MediatorFactory " + mf.getClass() + " to handle " + tag);
- }
- }
-
- /**
- * This method returns a Processor given an OMElement. This will be used
- * recursively by the elements which contain processor elements themselves
- * (e.g. rules)
- *
- * @param element
- * @return Processor
- */
- public Mediator getMediator(OMElement element) {
-
- String localName = element.getLocalName();
- QName qName = null;
- if (element.getNamespace() != null) {
- qName = new QName(element.getNamespace().getNamespaceURI(), localName);
- } else {
- qName = new QName(localName);
- }
- log.debug("getMediator(" + qName + ")");
- Class cls = (Class) factoryMap.get(qName);
-
- if (cls == null && localName.indexOf('.') > -1) {
- String newLocalName = localName.substring(0, localName.indexOf('.'));
- qName = new QName(element.getNamespace().getNamespaceURI(), newLocalName);
- log.debug("getMediator.2(" + qName + ")");
- cls = (Class) factoryMap.get(qName);
- }
-
- if (cls == null) {
- String msg = "Unknown mediator referenced by configuration element : " + qName;
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- try {
- MediatorFactory mf = (MediatorFactory) cls.newInstance();
- return mf.createMediator(element);
-
- } catch (InstantiationException e) {
- String msg = "Error initializing mediator factory : " + cls;
- log.error(msg);
- throw new SynapseException(msg, e);
-
- } catch (IllegalAccessException e) {
- String msg = "Error initializing mediator factory : " + cls;
- log.error(msg);
- throw new SynapseException(msg, e);
- }
- }
- /*
- This method exposes all the MediatorFactories and its Extensions
- */
- public Map getFactoryMap() {
- return factoryMap;
- }
-
- /**
- * Allow the mediator factory finder to act as an XMLToObjectMapper for Mediators
- * (i.e. Sequence Mediator) loaded dynamically from a Registry
- * @param om
- * @return
- */
- public Object getObjectFromOMNode(OMNode om) {
- if (om instanceof OMElement) {
- return getMediator((OMElement) om);
- } else {
- handleException("Invalid mediator configuration XML : " + om);
- }
- return null;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.synapse.config.xml;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.config.XMLToObjectMapper;
+import sun.misc.Service;
+
+import javax.xml.namespace.QName;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ *
+ *
+ * This class is based on J2SE Service Provider model
+ * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
+ */
+
+public class MediatorFactoryFinder implements XMLToObjectMapper {
+
+ private static final Log log = LogFactory.getLog(MediatorFactoryFinder.class);
+
+ private static final Class[] mediatorFactories = {
+ SequenceMediatorFactory.class,
+ LogMediatorFactory.class,
+ SendMediatorFactory.class,
+ FilterMediatorFactory.class,
+ SynapseMediatorFactory.class,
+ DropMediatorFactory.class,
+ HeaderMediatorFactory.class,
+ FaultMediatorFactory.class,
+ PropertyMediatorFactory.class,
+ SwitchMediatorFactory.class,
+ InMediatorFactory.class,
+ OutMediatorFactory.class,
+ RMSequenceMediatorFactory.class,
+ ClassMediatorFactory.class,
+ };
+
+ private static MediatorFactoryFinder instance = null;
+
+ /**
+ * A map of mediator QNames to implementation class
+ */
+ private static Map factoryMap = new HashMap();
+
+ public static synchronized MediatorFactoryFinder getInstance() {
+ if (instance == null) {
+ instance = new MediatorFactoryFinder();
+ }
+ return instance;
+ }
+
+ /**
+ * Force re initialization next time
+ */
+ public synchronized void reset() {
+ factoryMap.clear();
+ instance = null;
+ }
+
+ private MediatorFactoryFinder() {
+
+ factoryMap = new HashMap();
+
+ for (int i = 0; i < mediatorFactories.length; i++) {
+ Class c = mediatorFactories[i];
+ try {
+ MediatorFactory fac = (MediatorFactory) c.newInstance();
+ factoryMap.put(fac.getTagQName(), c);
+ } catch (Exception e) {
+ throw new SynapseException("Error instantiating " + c.getName(), e);
+ }
+ }
+ // now iterate through the available pluggable mediator factories
+ registerExtensions();
+ }
+
+ private void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+
+ private void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ /**
+ * Register pluggable mediator factories from the classpath
+ *
+ * This looks for JAR files containing a META-INF/services that adheres to the following
+ * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
+ */
+ private void registerExtensions() {
+
+ //log.debug("Registering mediator extensions found in the classpath : " + System.getResource("java.class.path"));
+
+ // register MediatorFactory extensions
+ Iterator it = Service.providers(MediatorFactory.class);
+ while (it.hasNext()) {
+ MediatorFactory mf = (MediatorFactory) it.next();
+ QName tag = mf.getTagQName();
+ factoryMap.put(tag, mf.getClass());
+ log.debug("Added MediatorFactory " + mf.getClass() + " to handle " + tag);
+ }
+ }
+
+ /**
+ * This method returns a Processor given an OMElement. This will be used
+ * recursively by the elements which contain processor elements themselves
+ * (e.g. rules)
+ *
+ * @param element
+ * @return Processor
+ */
+ public Mediator getMediator(OMElement element) {
+
+ String localName = element.getLocalName();
+ QName qName = null;
+ if (element.getNamespace() != null) {
+ qName = new QName(element.getNamespace().getNamespaceURI(), localName);
+ } else {
+ qName = new QName(localName);
+ }
+ log.debug("getMediator(" + qName + ")");
+ Class cls = (Class) factoryMap.get(qName);
+
+ if (cls == null && localName.indexOf('.') > -1) {
+ String newLocalName = localName.substring(0, localName.indexOf('.'));
+ qName = new QName(element.getNamespace().getNamespaceURI(), newLocalName);
+ log.debug("getMediator.2(" + qName + ")");
+ cls = (Class) factoryMap.get(qName);
+ }
+
+ if (cls == null) {
+ String msg = "Unknown mediator referenced by configuration element : " + qName;
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ try {
+ MediatorFactory mf = (MediatorFactory) cls.newInstance();
+ return mf.createMediator(element);
+
+ } catch (InstantiationException e) {
+ String msg = "Error initializing mediator factory : " + cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+
+ } catch (IllegalAccessException e) {
+ String msg = "Error initializing mediator factory : " + cls;
+ log.error(msg);
+ throw new SynapseException(msg, e);
+ }
+ }
+ /*
+ This method exposes all the MediatorFactories and its Extensions
+ */
+ public Map getFactoryMap() {
+ return factoryMap;
+ }
+
+ /**
+ * Allow the mediator factory finder to act as an XMLToObjectMapper for Mediators
+ * (i.e. Sequence Mediator) loaded dynamically from a Registry
+ * @param om
+ * @return
+ */
+ public Object getObjectFromOMNode(OMNode om) {
+ if (om instanceof OMElement) {
+ return getMediator((OMElement) om);
+ } else {
+ handleException("Invalid mediator configuration XML : " + om);
+ }
+ return null;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorFactoryFinder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorPropertyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/MediatorSerializerFinder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/OMElementUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/OutMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/OutMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/PropertyMediatorSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RMSequenceMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RMSequenceMediatorFactory.java?view=diff&rev=519363&r1=519362&r2=519363
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RMSequenceMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RMSequenceMediatorFactory.java Sat Mar 17 09:18:32 2007
@@ -1,151 +1,151 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.synapse.config.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.Mediator;
-import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.RMSequenceMediator;
-import org.jaxen.JaxenException;
-
-/**
- * Creates a RMSequence mediator through the supplied XML configuration
- * <p/>
- * <pre>
- * <RMSequence (correlation="xpath" [last-message="xpath"]) | single="true" [version="1.0|1.1"]/>
- * </pre>
- */
-public class RMSequenceMediatorFactory extends AbstractMediatorFactory {
-
- private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
-
- private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "RMSequence");
-
- public Mediator createMediator(OMElement elem) {
-
- RMSequenceMediator sequenceMediator = new RMSequenceMediator();
- OMAttribute correlation =
- elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "correlation"));
- OMAttribute lastMessage =
- elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "last-message"));
- OMAttribute single = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "single"));
- OMAttribute version = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "version"));
-
- if (single == null && correlation == null) {
- String msg = "The 'single' attribute value of true or a 'correlation' attribute is " +
- "required for the configuration of a RMSequence mediator";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- if (correlation != null) {
- if (correlation.getAttributeValue() != null &&
- correlation.getAttributeValue().trim().length() == 0) {
- String msg = "Invalid attribute value specified for correlation";
- log.error(msg);
- throw new SynapseException(msg);
-
- } else {
- try {
- sequenceMediator.setCorrelation(new AXIOMXPath(correlation.getAttributeValue()));
- } catch (JaxenException e) {
- String msg = "Invalid XPath expression for attribute correlation : "
- + correlation.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
- OMElementUtils.addNameSpaces(sequenceMediator.getCorrelation(), elem, log);
- }
-
- if (single != null) {
- sequenceMediator.setSingle(Boolean.valueOf(single.getAttributeValue()));
- }
-
- if (sequenceMediator.isSingle() && sequenceMediator.getCorrelation() != null) {
- String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
- + "single attribute value of true and a correlation attribute specified.";
- log.error(msg);
- throw new SynapseException(msg);
-
- } else if (!sequenceMediator.isSingle() && sequenceMediator.getCorrelation() == null) {
- String msg = "Invalid RMSequence mediator. A RMSequence must have a "
- + "single attribute value of true or a correlation attribute specified.";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- if (lastMessage != null) {
- if (lastMessage.getAttributeValue() != null &&
- lastMessage.getAttributeValue().trim().length() == 0) {
- String msg = "Invalid attribute value specified for last-message";
- log.error(msg);
- throw new SynapseException(msg);
-
- } else {
- try {
- sequenceMediator.setLastMessage(new AXIOMXPath(lastMessage.getAttributeValue()));
- } catch (JaxenException e) {
- String msg = "Invalid XPath expression for attribute last-message : "
- + lastMessage.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- }
- OMElementUtils.addNameSpaces(sequenceMediator.getLastMessage(), elem, log);
- }
-
- if (sequenceMediator.isSingle() && sequenceMediator.getLastMessage() != null) {
- String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
- + "single attribute value of true and a last-message attribute specified.";
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- if (version != null) {
- if (!Constants.SEQUENCE_VERSION_1_0.equals(version.getAttributeValue()) &&
- !Constants.SEQUENCE_VERSION_1_1.equals(version.getAttributeValue())) {
- String msg = "Only '" + Constants.SEQUENCE_VERSION_1_0 + "' or '" +
- Constants.SEQUENCE_VERSION_1_1
- + "' values are allowed for attribute version for a RMSequence mediator"
- + ", Unsupported version " + version.getAttributeValue();
- log.error(msg);
- throw new SynapseException(msg);
- }
- sequenceMediator.setVersion(version.getAttributeValue());
- }
-
- // after successfully creating the mediator
- // set its common attributes such as tracing etc
- initMediator(sequenceMediator, elem);
-
- return sequenceMediator;
- }
-
- public QName getTagQName() {
- return SEQUENCE_Q;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.synapse.config.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.xpath.AXIOMXPath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.Mediator;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.mediators.builtin.RMSequenceMediator;
+import org.jaxen.JaxenException;
+
+/**
+ * Creates a RMSequence mediator through the supplied XML configuration
+ * <p/>
+ * <pre>
+ * <RMSequence (correlation="xpath" [last-message="xpath"]) | single="true" [version="1.0|1.1"]/>
+ * </pre>
+ */
+public class RMSequenceMediatorFactory extends AbstractMediatorFactory {
+
+ private static final Log log = LogFactory.getLog(LogMediatorFactory.class);
+
+ private static final QName SEQUENCE_Q = new QName(Constants.SYNAPSE_NAMESPACE, "RMSequence");
+
+ public Mediator createMediator(OMElement elem) {
+
+ RMSequenceMediator sequenceMediator = new RMSequenceMediator();
+ OMAttribute correlation =
+ elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "correlation"));
+ OMAttribute lastMessage =
+ elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "last-message"));
+ OMAttribute single = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "single"));
+ OMAttribute version = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "version"));
+
+ if (single == null && correlation == null) {
+ String msg = "The 'single' attribute value of true or a 'correlation' attribute is " +
+ "required for the configuration of a RMSequence mediator";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ if (correlation != null) {
+ if (correlation.getAttributeValue() != null &&
+ correlation.getAttributeValue().trim().length() == 0) {
+ String msg = "Invalid attribute value specified for correlation";
+ log.error(msg);
+ throw new SynapseException(msg);
+
+ } else {
+ try {
+ sequenceMediator.setCorrelation(new AXIOMXPath(correlation.getAttributeValue()));
+ } catch (JaxenException e) {
+ String msg = "Invalid XPath expression for attribute correlation : "
+ + correlation.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ OMElementUtils.addNameSpaces(sequenceMediator.getCorrelation(), elem, log);
+ }
+
+ if (single != null) {
+ sequenceMediator.setSingle(Boolean.valueOf(single.getAttributeValue()));
+ }
+
+ if (sequenceMediator.isSingle() && sequenceMediator.getCorrelation() != null) {
+ String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
+ + "single attribute value of true and a correlation attribute specified.";
+ log.error(msg);
+ throw new SynapseException(msg);
+
+ } else if (!sequenceMediator.isSingle() && sequenceMediator.getCorrelation() == null) {
+ String msg = "Invalid RMSequence mediator. A RMSequence must have a "
+ + "single attribute value of true or a correlation attribute specified.";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ if (lastMessage != null) {
+ if (lastMessage.getAttributeValue() != null &&
+ lastMessage.getAttributeValue().trim().length() == 0) {
+ String msg = "Invalid attribute value specified for last-message";
+ log.error(msg);
+ throw new SynapseException(msg);
+
+ } else {
+ try {
+ sequenceMediator.setLastMessage(new AXIOMXPath(lastMessage.getAttributeValue()));
+ } catch (JaxenException e) {
+ String msg = "Invalid XPath expression for attribute last-message : "
+ + lastMessage.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ }
+ OMElementUtils.addNameSpaces(sequenceMediator.getLastMessage(), elem, log);
+ }
+
+ if (sequenceMediator.isSingle() && sequenceMediator.getLastMessage() != null) {
+ String msg = "Invalid RMSequence mediator. A RMSequence can't have both a "
+ + "single attribute value of true and a last-message attribute specified.";
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ if (version != null) {
+ if (!Constants.SEQUENCE_VERSION_1_0.equals(version.getAttributeValue()) &&
+ !Constants.SEQUENCE_VERSION_1_1.equals(version.getAttributeValue())) {
+ String msg = "Only '" + Constants.SEQUENCE_VERSION_1_0 + "' or '" +
+ Constants.SEQUENCE_VERSION_1_1
+ + "' values are allowed for attribute version for a RMSequence mediator"
+ + ", Unsupported version " + version.getAttributeValue();
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+ sequenceMediator.setVersion(version.getAttributeValue());
+ }
+
+ // after successfully creating the mediator
+ // set its common attributes such as tracing etc
+ initMediator(sequenceMediator, elem);
+
+ return sequenceMediator;
+ }
+
+ public QName getTagQName() {
+ return SEQUENCE_Q;
+ }
+}
Propchange: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RMSequenceMediatorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org