[savara-commits] savara SVN: r688 - in branches/experimental/2.0.x: bundles/org.savara.activity/src/main/java/org/savara/activity/model and 15 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Feb 18 12:34:22 EST 2011
Author: objectiser
Date: 2011-02-18 12:34:20 -0500 (Fri, 18 Feb 2011)
New Revision: 688
Added:
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ExchangeType.java
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/MessageUtils.java
branches/experimental/2.0.x/bundles/org.savara.common/src/test/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/util/
branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/util/MessageUtilsTest.java
Removed:
branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/ValidatorFilter.java
Modified:
branches/experimental/2.0.x/bundles/org.savara.activity/schema/Activity.xsd
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Activity.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Analysis.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ComponentActivity.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Context.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/InteractionActivity.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/MessageParameter.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ObjectFactory.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ProtocolAnalysis.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Status.java
branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/package-info.java
branches/experimental/2.0.x/bundles/org.savara.common/pom.xml
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/XMLUtils.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java
branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java
branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java
branches/experimental/2.0.x/integration/jboss/wsnative/pom.xml
branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java
branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java
branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java
branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
Log:
Updated activity model to represent the message exchange pattern type (e.g. request/response) as an enumeration, which could optionally be left 'undefined'. Also hooked the ESB interceptor into the ActivityProcessor instead of using the old service validator manager approach.
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/schema/Activity.xsd
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/schema/Activity.xsd 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/schema/Activity.xsd 2011-02-18 17:34:20 UTC (rev 688)
@@ -50,7 +50,7 @@
<attribute name="replyToAddress" type="string"></attribute>
<attribute name="operationName" type="string"></attribute>
<attribute name="faultName" type="string"></attribute>
- <attribute name="request" type="boolean" default="true"></attribute>
+ <attribute name="exchangeType" type="tns:ExchangeType" default="undefined"></attribute>
<attribute name="outbound" type="boolean" default="true"></attribute>
</extension>
</complexContent>
@@ -63,6 +63,14 @@
<attribute name="type" type="string"></attribute>
</complexType>
+ <simpleType name="ExchangeType">
+ <restriction base="string">
+ <enumeration value="undefined"></enumeration>
+ <enumeration value="request"></enumeration>
+ <enumeration value="response"></enumeration>
+ </restriction>
+ </simpleType>
+
<complexType name="ProtocolAnalysis">
<complexContent>
<extension base="tns:Analysis">
@@ -73,6 +81,6 @@
</complexContent>
</complexType>
+ <element name="activity" type="tns:Activity"></element>
- <element name="activity" type="tns:Activity"></element>
</schema>
\ No newline at end of file
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Activity.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Activity.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Activity.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Analysis.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Analysis.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Analysis.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ComponentActivity.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ComponentActivity.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ComponentActivity.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Context.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Context.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Context.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Added: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ExchangeType.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ExchangeType.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ExchangeType.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -0,0 +1,61 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
+//
+
+
+package org.savara.activity.model;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for ExchangeType.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * <simpleType name="ExchangeType">
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * <enumeration value="undefined"/>
+ * <enumeration value="request"/>
+ * <enumeration value="response"/>
+ * </restriction>
+ * </simpleType>
+ * </pre>
+ *
+ */
+ at XmlType(name = "ExchangeType")
+ at XmlEnum
+public enum ExchangeType {
+
+ @XmlEnumValue("undefined")
+ UNDEFINED("undefined"),
+ @XmlEnumValue("request")
+ REQUEST("request"),
+ @XmlEnumValue("response")
+ RESPONSE("response");
+ private final String value;
+
+ ExchangeType(String v) {
+ value = v;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ public static ExchangeType fromValue(String v) {
+ for (ExchangeType c: ExchangeType.values()) {
+ if (c.value.equals(v)) {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+
+}
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/InteractionActivity.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/InteractionActivity.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/InteractionActivity.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
@@ -33,7 +33,7 @@
* <attribute name="replyToAddress" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="operationName" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="faultName" type="{http://www.w3.org/2001/XMLSchema}string" />
- * <attribute name="request" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
+ * <attribute name="exchangeType" type="{http://www.savara.org/activity}ExchangeType" default="undefined" />
* <attribute name="outbound" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
* </extension>
* </complexContent>
@@ -62,7 +62,7 @@
@XmlAttribute
protected String faultName;
@XmlAttribute
- protected Boolean request;
+ protected ExchangeType exchangeType;
@XmlAttribute
protected Boolean outbound;
@@ -216,31 +216,31 @@
}
/**
- * Gets the value of the request property.
+ * Gets the value of the exchangeType property.
*
* @return
* possible object is
- * {@link Boolean }
+ * {@link ExchangeType }
*
*/
- public boolean isRequest() {
- if (request == null) {
- return true;
+ public ExchangeType getExchangeType() {
+ if (exchangeType == null) {
+ return ExchangeType.UNDEFINED;
} else {
- return request;
+ return exchangeType;
}
}
/**
- * Sets the value of the request property.
+ * Sets the value of the exchangeType property.
*
* @param value
* allowed object is
- * {@link Boolean }
+ * {@link ExchangeType }
*
*/
- public void setRequest(Boolean value) {
- this.request = value;
+ public void setExchangeType(ExchangeType value) {
+ this.exchangeType = value;
}
/**
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/MessageParameter.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/MessageParameter.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/MessageParameter.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ObjectFactory.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ObjectFactory.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ObjectFactory.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
@@ -49,43 +49,43 @@
}
/**
- * Create an instance of {@link InteractionActivity }
+ * Create an instance of {@link ComponentActivity }
*
*/
- public InteractionActivity createInteractionActivity() {
- return new InteractionActivity();
+ public ComponentActivity createComponentActivity() {
+ return new ComponentActivity();
}
/**
- * Create an instance of {@link MessageParameter }
+ * Create an instance of {@link ProtocolAnalysis }
*
*/
- public MessageParameter createMessageParameter() {
- return new MessageParameter();
+ public ProtocolAnalysis createProtocolAnalysis() {
+ return new ProtocolAnalysis();
}
/**
- * Create an instance of {@link ComponentActivity }
+ * Create an instance of {@link Context }
*
*/
- public ComponentActivity createComponentActivity() {
- return new ComponentActivity();
+ public Context createContext() {
+ return new Context();
}
/**
- * Create an instance of {@link ProtocolAnalysis }
+ * Create an instance of {@link InteractionActivity }
*
*/
- public ProtocolAnalysis createProtocolAnalysis() {
- return new ProtocolAnalysis();
+ public InteractionActivity createInteractionActivity() {
+ return new InteractionActivity();
}
/**
- * Create an instance of {@link Context }
+ * Create an instance of {@link MessageParameter }
*
*/
- public Context createContext() {
- return new Context();
+ public MessageParameter createMessageParameter() {
+ return new MessageParameter();
}
/**
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ProtocolAnalysis.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ProtocolAnalysis.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/ProtocolAnalysis.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Status.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Status.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/Status.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
Modified: branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/package-info.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/package-info.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.activity/src/main/java/org/savara/activity/model/package-info.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2011.02.12 at 11:24:50 PM GMT
+// Generated on: 2011.02.18 at 12:20:19 PM GMT
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.savara.org/activity", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Modified: branches/experimental/2.0.x/bundles/org.savara.common/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/pom.xml 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.common/pom.xml 2011-02-18 17:34:20 UTC (rev 688)
@@ -24,5 +24,11 @@
<artifactId>org.osgi.core</artifactId>
<version>${osgi.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Added: branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/MessageUtils.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/MessageUtils.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/MessageUtils.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.common.util;
+
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+public class MessageUtils {
+
+ private static Logger logger = Logger.getLogger(MessageUtils.class.getName());
+
+ /**
+ * This method returns the type name associated with the supplied message
+ * value. This method assumes the value is either XML based, or a Java
+ * type.
+ *
+ * @param value The value
+ * @return The type name
+ */
+ public static String getMessageType(Object value) {
+ String ret=null;
+
+ if (value instanceof org.w3c.dom.Node) {
+ String namespace=((org.w3c.dom.Node)value).getNamespaceURI();
+ String localpart=((org.w3c.dom.Node)value).getLocalName();
+
+ if (value instanceof org.w3c.dom.Element &&
+ ((org.w3c.dom.Element)value).hasAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type")) {
+ String type=((org.w3c.dom.Element)value).getAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type");
+
+ String prefix=XMLUtils.getPrefix(type);
+
+ localpart = XMLUtils.getLocalname(type);
+
+ if (prefix == null) {
+ namespace = null;
+ } else {
+ namespace = ((org.w3c.dom.Element)value).
+ getAttribute("xmlns:"+prefix);
+ if (namespace != null && namespace.trim().length() == 0) {
+ namespace = null;
+ }
+ }
+ }
+
+ if (namespace == null) {
+ ret = localpart;
+ } else {
+ ret = new QName(namespace, localpart).toString();
+ }
+ } else if (value instanceof String) {
+ ret = String.class.getName();
+
+ try {
+ org.w3c.dom.Node node=XMLUtils.getNode((String)value);
+
+ ret = getMessageType(node);
+ } catch(Exception e) {
+ logger.warning("Failed to obtain message type from value: "+value);
+ }
+
+ } else {
+ ret = value.getClass().getName();
+ }
+
+ return(ret);
+ }
+
+}
Modified: branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/XMLUtils.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/XMLUtils.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/util/XMLUtils.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -209,13 +209,31 @@
}
/**
+ * This method returns the prefix part of the supplied
+ * qualified name.
+ *
+ * @param qname The qualified name
+ * @return The prefix
+ */
+ public static String getPrefix(String qname) {
+ String ret=qname;
+ int pos=0;
+
+ if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
+ ret = qname.substring(0, pos);
+ }
+
+ return(ret);
+ }
+
+ /**
* This method returns the prefix associated with the supplied namespace.
*
* @param namespace The namespace
* @param nsMap The existing namespace prefix mappings
* @return The prefix
*/
- public static String getPrefix(String namespace, java.util.Map<String,String> nsMap) {
+ public static String getPrefixForNamespace(String namespace, java.util.Map<String,String> nsMap) {
String prefix=null;
prefix = nsMap.get(namespace);
Added: branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/util/MessageUtilsTest.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/util/MessageUtilsTest.java (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common/src/test/java/org/savara/common/util/MessageUtilsTest.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.savara.common.util;
+
+import static org.junit.Assert.*;
+
+import javax.xml.namespace.QName;
+
+public class MessageUtilsTest {
+
+ @org.junit.Test
+ public void testXMLElement() {
+ String ns="http://www.savara.org/types";
+ String lp="MyType";
+
+ String xml="<ns1:"+lp+" xmlns:ns1=\""+ns+"\" />";
+
+ String type=MessageUtils.getMessageType(xml);
+
+ if (type == null) {
+ fail("Failed to get message type");
+ }
+
+ QName qname=new QName(ns, lp);
+
+ if (qname.toString().equals(type) == false) {
+ fail("Was expecting '"+qname+"', but got '"+type+"'");
+ }
+ }
+}
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/pi4soa/JMSServiceTracker.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -62,6 +62,7 @@
import org.pi4soa.service.tracker.ServiceTracker;
import org.pi4soa.service.tracker.TrackerEvent;
import org.savara.activity.model.Activity;
+import org.savara.activity.model.ExchangeType;
import org.savara.activity.model.InteractionActivity;
import org.savara.activity.model.MessageParameter;
import org.savara.activity.model.ProtocolAnalysis;
@@ -435,7 +436,9 @@
ia.setFaultName(activity.getFaultName());
ia.setDestinationType(mesg.getServiceType());
- ia.setRequest(activity.getMessageDefinition().getClassification() == MessageClassification.REQUEST);
+ ia.setExchangeType(activity.getMessageDefinition().getClassification() ==
+ MessageClassification.REQUEST ?
+ ExchangeType.REQUEST : ExchangeType.RESPONSE);
MessageParameter mp=new MessageParameter();
mp.setType(mesg.getType());
Modified: branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/common/src/main/java/org/savara/validator/service/ServiceValidatorService.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -25,6 +25,7 @@
import org.savara.activity.ActivityValidator;
import org.savara.activity.DefaultActivityProcessor;
import org.savara.activity.model.Activity;
+import org.savara.activity.model.ExchangeType;
import org.savara.activity.model.InteractionActivity;
import org.savara.activity.model.ProtocolAnalysis;
import org.savara.activity.notifier.jms.JMSActivityNotifier;
@@ -184,16 +185,43 @@
Endpoint endpoint=new Endpoint(ia.getDestinationType() != null ?
ia.getDestinationType() : ia.getDestinationAddress());
- if (ia.isOutbound() == ia.isRequest()) {
+ if (isOutputValidator(ia)) {
validators = m_serviceValidatorManager.getOutputServiceValidators(endpoint);
} else {
validators = m_serviceValidatorManager.getInputServiceValidators(endpoint);
}
process(validators, ia);
+
+ // Check whether a dynamic reply is expected
+ if (isOutputValidator(ia)) {
+ if (m_serviceValidatorManager.isOutputDynamicReplyTo(endpoint) &&
+ ia.getReplyToAddress() != null) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
+
+ m_serviceValidatorManager.registerInputReplyToValidators(replyTo,
+ validators);
+ }
+ } else if (m_serviceValidatorManager.isInputDynamicReplyTo(endpoint) &&
+ ia.getReplyToAddress() != null) {
+
+ // Register interest in the 'reply-to' endpoint
+ Endpoint replyTo=new Endpoint(ia.getReplyToAddress());
+
+ m_serviceValidatorManager.registerOutputReplyToValidators(replyTo,
+ validators);
+ }
}
}
+ protected boolean isOutputValidator(InteractionActivity ia) {
+ return((ia.getExchangeType() == ExchangeType.UNDEFINED && ia.isOutbound()) ||
+ (ia.getExchangeType() != ExchangeType.UNDEFINED &&
+ (ia.getExchangeType() == ExchangeType.REQUEST) == ia.isOutbound()));
+ }
+
public void process(java.util.List<ServiceValidator> validators, InteractionActivity ia) {
if (validators != null && validators.size() > 0 && ia.getParameter().size() == 1) {
Modified: branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/JBossESBInterceptor.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -22,6 +22,11 @@
import org.apache.log4j.Logger;
+import org.savara.activity.ActivityProcessor;
+import org.savara.activity.ActivityProcessorFactory;
+import org.savara.activity.model.InteractionActivity;
+import org.savara.activity.model.MessageParameter;
+import org.savara.common.util.MessageUtils;
import org.savara.validator.Endpoint;
import org.savara.validator.ServiceValidator;
import org.savara.validator.ServiceValidatorManager;
@@ -49,25 +54,6 @@
}
/**
- * This method returns the service validator manager.
- *
- * @return The service validator manager
- */
- protected ServiceValidatorManager getServiceValidatorManager() {
- if (m_serviceValidatorManager == null) {
- try {
- InitialContext ctx = new InitialContext();
- m_serviceValidatorManager =
- (ServiceValidatorManager)ctx.lookup("savara/ServiceValidatorManager");
- } catch (NamingException e) {
- throw new RuntimeException("Failed to locate Savara Service Validator Manager");
- }
- }
-
- return(m_serviceValidatorManager);
- }
-
- /**
* This method is invoked when a message is sent by an
* ESB service.
*
@@ -80,7 +66,37 @@
Endpoint endpoint=getEndpoint(msg);
- if (endpoint != null) {
+ java.io.Serializable message=ESBUtil.getMessage(msg);
+
+ if (endpoint != null && message instanceof String) {
+
+ try {
+ ActivityProcessor ap=ActivityProcessorFactory.getActivityProcessor();
+
+ InteractionActivity ia=new InteractionActivity();
+
+ ia.setDestinationAddress(endpoint.getDestination());
+
+ ia.setOutbound(true);
+
+ MessageParameter mp=new MessageParameter();
+ mp.setType(MessageUtils.getMessageType(message));
+ mp.setValue((String)message);
+
+ ia.getParameter().add(mp);
+
+ Endpoint replyTo=getReplyToEndpoint(msg);
+
+ if (replyTo != null) {
+ ia.setReplyToAddress(replyTo.getDestination());
+ }
+
+ ap.process(ia);
+
+ } catch(Exception e) {
+ logger.error("Failed to report interaction activity", e);
+ }
+ /*
java.util.List<ServiceValidator> validators=
getServiceValidatorManager().getOutputServiceValidators(endpoint);
@@ -140,6 +156,7 @@
}
}
}
+ */
}
return(msg);
@@ -158,7 +175,38 @@
Endpoint endpoint=getEndpoint(msg);
- if (endpoint != null) {
+ java.io.Serializable message=ESBUtil.getMessage(msg);
+
+ if (endpoint != null && message instanceof String) {
+
+ try {
+ ActivityProcessor ap=ActivityProcessorFactory.getActivityProcessor();
+
+ InteractionActivity ia=new InteractionActivity();
+
+ ia.setDestinationAddress(endpoint.getDestination());
+
+ ia.setOutbound(false);
+
+ MessageParameter mp=new MessageParameter();
+ mp.setType(MessageUtils.getMessageType(message));
+ mp.setValue((String)message);
+
+ ia.getParameter().add(mp);
+
+ Endpoint replyTo=getReplyToEndpoint(msg);
+
+ if (replyTo != null) {
+ ia.setReplyToAddress(replyTo.getDestination());
+ }
+
+ ap.process(ia);
+
+ } catch(Exception e) {
+ logger.error("Failed to report interaction activity", e);
+ }
+
+ /*
java.util.List<ServiceValidator> validators=
getServiceValidatorManager().getInputServiceValidators(endpoint);
@@ -218,6 +266,7 @@
}
}
}
+ */
}
return(msg);
Deleted: branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/ValidatorFilter.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/ValidatorFilter.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/esb/src/main/java/org/savara/validator/jbossesb/ValidatorFilter.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.savara.validator.jbossesb;
-
-/**
- *
- * @deprecated Use JBossESBInterceptor instead
- */
-public class ValidatorFilter extends JBossESBInterceptor {
-
- /**
- * The default constructor.
- */
- public ValidatorFilter() {
- }
-
-}
Modified: branches/experimental/2.0.x/integration/jboss/wsnative/pom.xml
===================================================================
--- branches/experimental/2.0.x/integration/jboss/wsnative/pom.xml 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/wsnative/pom.xml 2011-02-18 17:34:20 UTC (rev 688)
@@ -17,6 +17,11 @@
<dependencies>
<dependency>
<groupId>org.savara.bundles</groupId>
+ <artifactId>org.savara.common</artifactId>
+ <version>${savara.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.savara.bundles</groupId>
<artifactId>org.savara.activity</artifactId>
<version>${savara.version}</version>
</dependency>
Modified: branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -36,6 +36,7 @@
import org.pi4soa.common.util.NamesUtil;
import org.pi4soa.common.xml.NameSpaceUtil;
import org.pi4soa.common.xml.XMLUtils;
+import org.savara.common.util.MessageUtils;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
import org.jboss.wsf.common.DOMWriter;
@@ -114,7 +115,7 @@
if (ret == null) {
try {
- ret = getMessageType(getMessage(soapCtx));
+ ret = MessageUtils.getMessageType(getMessage(soapCtx));
logger.debug("Message type (derived from content)="+ret);
} catch(Exception e) {
logger.error("Failed to get message type from message content", e);
@@ -125,59 +126,7 @@
return(ret);
}
-
- private static String getMessageType(Object value) {
- String ret=null;
-
- if (value instanceof org.w3c.dom.Node) {
- String namespace=((org.w3c.dom.Node)value).getNamespaceURI();
- String localpart=((org.w3c.dom.Node)value).getLocalName();
-
- if (value instanceof org.w3c.dom.Element &&
- ((org.w3c.dom.Element)value).hasAttributeNS(
- "http://www.w3.org/2001/XMLSchema-instance", "type")) {
- String type=((org.w3c.dom.Element)value).getAttributeNS(
- "http://www.w3.org/2001/XMLSchema-instance", "type");
-
- String prefix=org.pi4soa.common.xml.XMLUtils.getPrefix(type);
-
- localpart = org.pi4soa.common.xml.XMLUtils.getLocalname(type);
- if (prefix == null) {
- namespace = null;
- } else {
- namespace = ((org.w3c.dom.Element)value).
- getAttribute("xmlns:"+prefix);
- if (NamesUtil.isSet(namespace) == false) {
- namespace = null;
- }
- }
- }
-
- if (namespace == null) {
- ret = localpart;
- } else {
- ret = NameSpaceUtil.getFullyQualifiedName(namespace,
- localpart);
- }
- } else if (value instanceof String) {
- ret = String.class.getName();
-
- try {
- org.w3c.dom.Node node=XMLUtils.getNode((String)value);
-
- ret = getMessageType(node);
- } catch(Exception e) {
- logger.warn("Failed to obtain message type from value: "+value);
- }
-
- } else {
- ret = value.getClass().getName();
- }
-
- return(ret);
- }
-
protected static SOAPElement getMessageBody(SOAPMessageContext soapCtx) throws SOAPException {
SOAPElement ret=null;
Modified: branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.savara.activity.ActivityProcessor;
import org.savara.activity.ActivityProcessorFactory;
+import org.savara.activity.model.ExchangeType;
import org.savara.activity.model.InteractionActivity;
import org.savara.activity.model.MessageParameter;
@@ -53,11 +54,11 @@
ia.setDestinationType(endpoint.toString());
- ia.setRequest(false);
+ ia.setExchangeType(ExchangeType.RESPONSE);
ia.setOutbound(false);
MessageParameter mp=new MessageParameter();
- mp.setType(getMessageType(soapCtx, ia.isRequest()));
+ mp.setType(getMessageType(soapCtx, false));
mp.setValue(getMessage(soapCtx));
ia.getParameter().add(mp);
@@ -87,11 +88,11 @@
ia.setDestinationType(endpoint.toString());
- ia.setRequest(true);
+ ia.setExchangeType(ExchangeType.REQUEST);
ia.setOutbound(true);
MessageParameter mp=new MessageParameter();
- mp.setType(getMessageType(soapCtx, ia.isRequest()));
+ mp.setType(getMessageType(soapCtx, true));
mp.setValue(getMessage(soapCtx));
ia.getParameter().add(mp);
Modified: branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java
===================================================================
--- branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/integration/jboss/wsnative/src/main/java/org/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -25,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import org.savara.activity.ActivityProcessor;
import org.savara.activity.ActivityProcessorFactory;
+import org.savara.activity.model.ExchangeType;
import org.savara.activity.model.InteractionActivity;
import org.savara.activity.model.MessageParameter;
@@ -53,11 +54,11 @@
ia.setDestinationType(endpoint.toString());
- ia.setRequest(true);
+ ia.setExchangeType(ExchangeType.REQUEST);
ia.setOutbound(false);
MessageParameter mp=new MessageParameter();
- mp.setType(getMessageType(soapCtx, ia.isRequest()));
+ mp.setType(getMessageType(soapCtx, true));
mp.setValue(getMessage(soapCtx));
ia.getParameter().add(mp);
@@ -87,11 +88,11 @@
ia.setDestinationType(endpoint.toString());
- ia.setRequest(false);
+ ia.setExchangeType(ExchangeType.RESPONSE);
ia.setOutbound(true);
MessageParameter mp=new MessageParameter();
- mp.setType(getMessageType(soapCtx, ia.isRequest()));
+ mp.setType(getMessageType(soapCtx, false));
mp.setValue(getMessage(soapCtx));
ia.getParameter().add(mp);
Modified: branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java 2011-02-17 20:01:07 UTC (rev 687)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java 2011-02-18 17:34:20 UTC (rev 688)
@@ -648,7 +648,7 @@
String portType=intf.getName();
if (intf.getNamespace() != null) {
- prefix = XMLUtils.getPrefix(intf.getNamespace(), nsMap);
+ prefix = XMLUtils.getPrefixForNamespace(intf.getNamespace(), nsMap);
portType = prefix+":"+portType;
}
@@ -689,7 +689,7 @@
String portType=intf.getName();
if (intf.getNamespace() != null) {
- prefix = XMLUtils.getPrefix(intf.getNamespace(), nsMap);
+ prefix = XMLUtils.getPrefixForNamespace(intf.getNamespace(), nsMap);
portType = prefix+":"+portType;
}
@@ -764,7 +764,7 @@
String name=bpelProcess.getName();
if (bpelProcess.getTargetNamespace() != null) {
- String prefix=XMLUtils.getPrefix(bpelProcess.getTargetNamespace(), nsMap);
+ String prefix=XMLUtils.getPrefixForNamespace(bpelProcess.getTargetNamespace(), nsMap);
name = prefix+":"+name;
}
More information about the savara-commits
mailing list