[jboss-svn-commits] JBL Code SVN: r6484 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Sep 30 18:58:54 EDT 2006
Author: mark.little at jboss.com
Date: 2006-09-30 18:58:50 -0400 (Sat, 30 Sep 2006)
New Revision: 6484
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/XMLUtil.java
Log:
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2006-09-30 22:54:12 UTC (rev 6483)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/Call.java 2006-09-30 22:58:50 UTC (rev 6484)
@@ -0,0 +1,145 @@
+package org.jboss.soa.esb.addressing;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+
+/**
+ * A call represents an exchange pattern for this message. It is built up as the message
+ * flows through the ESB and identifies where the message should go, along with any
+ * routing information for faults, replies etc.
+ */
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+public class Call
+{
+ public Call ()
+ {
+ }
+
+ public Call (EPR epr)
+ {
+ _to = epr;
+ }
+
+ public void setTo (EPR epr)
+ {
+ _to = epr;
+ }
+
+ public EPR getTo () throws URISyntaxException
+ {
+ return _to;
+ }
+
+ public void setFrom (EPR from)
+ {
+ _from = from;
+ }
+
+ public EPR getFrom () throws URISyntaxException
+ {
+ return _from;
+ }
+
+ public void setReplyTo (EPR replyTo)
+ {
+ _replyTo = replyTo;
+ }
+
+ public EPR getReplyTo () throws URISyntaxException
+ {
+ return _replyTo;
+ }
+
+ public void setFaultTo (EPR uri)
+ {
+ _faultTo = uri;
+ }
+
+ public EPR getFaultTo () throws URISyntaxException
+ {
+ return _faultTo;
+ }
+
+ public void setRelatesTo (URI uri)
+ {
+ _relatesTo = uri;
+ }
+
+ public URI getRelatesTo () throws URISyntaxException
+ {
+ return _relatesTo;
+ }
+
+ public void setAction (URI uri)
+ {
+ _action = uri;
+ }
+
+ public URI getAction () throws URISyntaxException
+ {
+ return _action;
+ }
+
+ public void setMessageID (URI uri)
+ {
+ _messageID = uri;
+ }
+
+ public URI getMessageID () throws URISyntaxException
+ {
+ return _messageID;
+ }
+
+ public void copy (Call from)
+ {
+ Call fromImpl = (Call) from;
+
+ _to = fromImpl._to;
+ _from = fromImpl._from;
+ _replyTo = fromImpl._replyTo;
+ _relatesTo = fromImpl._relatesTo;
+ _faultTo = fromImpl._faultTo;
+ _action = fromImpl._action;
+ _messageID = fromImpl._messageID;
+ }
+
+// public void setMetaData (MetaData md);
+// public MetaData getMetaData ();
+// public void addReferenceParameter (...);
+
+ public String toString ()
+ {
+ return "To: "+_to+" From: "+_from+" ReplyTo: "+_replyTo+" FaultTo: "+_faultTo+" Action: "+_action;
+ }
+
+ private EPR _to = null;
+ private EPR _from = null;
+ private EPR _faultTo = null;
+ private EPR _replyTo = null;
+ private URI _relatesTo = null;
+ private URI _action = null;
+ private URI _messageID = null;
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/EPR.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2006-09-30 22:54:12 UTC (rev 6483)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/EPR.java 2006-09-30 22:58:50 UTC (rev 6484)
@@ -0,0 +1,90 @@
+package org.jboss.soa.esb.addressing;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+
+/**
+ * This class represents the endpoint reference for services.
+ */
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+public class EPR
+{
+ public EPR ()
+ {
+ _addr = new PortReference();
+ }
+
+ public EPR (PortReference addr)
+ {
+ _addr = addr;
+ }
+
+ public EPR (URI uri)
+ {
+ _addr = new PortReference(uri.toString());
+ }
+
+ public void setAddr (PortReference uri)
+ {
+ _addr = uri;
+ }
+
+ public PortReference getAddr () throws URISyntaxException
+ {
+ return _addr;
+ }
+
+ public void copy (EPR from)
+ {
+ EPR fromImpl = (EPR) from;
+
+ _addr = fromImpl._addr;
+ }
+
+// public void setMetaData (MetaData md);
+// public MetaData getMetaData ();
+// public void addReferenceParameter (...);
+
+ public String toString ()
+ {
+ return "EPR: "+_addr;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (obj == this)
+ return true;
+ else
+ {
+ if (obj instanceof EPR)
+ return ((EPR) obj)._addr.equals(_addr);
+ }
+
+ return false;
+ }
+
+ private PortReference _addr;
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-09-30 22:54:12 UTC (rev 6483)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/PortReference.java 2006-09-30 22:58:50 UTC (rev 6484)
@@ -0,0 +1,382 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/*
+ * Copyright (c) 2002, 2003, Arjuna Technologies Limited.
+ *
+ * PortReference.java
+ */
+
+package org.jboss.soa.esb.addressing;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.HashMap;
+
+/**
+ * An implementation of a WS-Addressing EPR. It needs completely rewriting after
+ * the interoperability workshop as it is not extensible and not guaranteed to
+ * work in the general case. It's morphed with the changing WS-C/WS-T and
+ * WS-Addr specifications and their quirks; now that WS-Addr is finalized the
+ * old quirks no longer need to be supported so it's best to rewrite this from
+ * scratch.
+ *
+ * An instance of a PortReference represents a single element in WS-A.
+ */
+
+public class PortReference
+{
+ public PortReference()
+ {
+ }
+
+ public PortReference(String address)
+ {
+ setAddress(address);
+ }
+
+ public void setAddress(String address)
+ {
+ _address = address;
+ }
+
+ public String getAddress()
+ {
+ return _address;
+ }
+
+ public void addExtension(PortReference.Extension extension)
+ {
+ _extensions.add(extension);
+ }
+
+ // all extensions are added as the Arjuna namespace.
+
+ public void addExtension(String value)
+ {
+ addExtension(XMLUtil.INSTANCE_IDENTIFIER_TAG, XMLUtil.WSARJADDR_PREFIX,
+ XMLUtil.WSARJADDR_NAMESPACE_URI, value,
+ Extension.REFERENCE_PROPERTIES);
+ }
+
+ public void addExtension(String tag, String value)
+ {
+ addExtension(tag, XMLUtil.WSARJADDR_PREFIX,
+ XMLUtil.WSARJADDR_NAMESPACE_URI, value,
+ Extension.REFERENCE_PROPERTIES);
+ }
+
+ /**
+ * Define the tag, prefix and namespace URI for the extension value. The
+ * parent is a refProperty.
+ */
+
+ public void addExtension(String tag, String prefix, String uri, String value)
+ {
+ _extensions.add(new Extension(tag, prefix, uri, value,
+ Extension.REFERENCE_PROPERTIES));
+ }
+
+ /**
+ * Define the tag, prefix and namespace URI for the extension value. The
+ * parent field defines whether the attribute has a refParam, refProp or
+ * neither as its parent.
+ */
+
+ public void addExtension(String tag, String prefix, String uri,
+ String value, int parent)
+ {
+ _extensions.add(new Extension(tag, prefix, uri, value, parent));
+ }
+
+ // placeholders only
+
+ public void addPortType(String qName)
+ {
+ }
+
+ public void addServiceName(String portName, String qName)
+ {
+ }
+
+ public void addPolicy()
+ {
+ }
+
+ public String getExtensionValue(String tag)
+ {
+ String extensionValue = null;
+ Iterator iterator = _extensions.iterator();
+
+ while (iterator.hasNext() && (extensionValue == null))
+ {
+ Extension extension = (Extension) iterator.next();
+
+ if (tag.equals(extension.getTag()))
+ extensionValue = extension.getValue();
+ }
+
+ return extensionValue;
+ }
+
+ public Iterator getExtensions()
+ {
+ return _extensions.iterator();
+ }
+
+ public void clearExtensions()
+ {
+ _extensions.clear();
+ }
+
+ public String toString()
+ {
+ return "PortReference < " + _address + " >";
+ }
+
+ public String extendedToString()
+ {
+ String addr = "<" + XMLUtil.WSA_PREFIX + ":Address " + _address + "/>";
+
+ Iterator extensions = getExtensions();
+
+ while (extensions.hasNext())
+ {
+ Extension ext = (Extension) extensions.next();
+
+ addr += ", <" + XMLUtil.WSA_PREFIX + ":"
+ + XMLUtil.REFERENCE_PROPERTIES_TAG + " " + ext.getPrefix()
+ + ":" + ext.getTag() + " : " + ext.getValue() + "/>";
+ }
+
+ return "PortReference : " + addr;
+ }
+
+ /**
+ * Is this object equal to the specified parameter?
+ *
+ * @param rhs
+ * The rhs object.
+ * @return true if the specified object is equal, false otherwise.
+ */
+ public boolean equals(final Object rhs)
+ {
+ if ((rhs != null) && (rhs.getClass() == getClass()))
+ {
+ // This should really only include reference property extensions
+ final PortReference rhsPortReference = (PortReference) rhs;
+ return (equalsObject(_address, rhsPortReference._address)
+ && equalsObject(_extensions, rhsPortReference._extensions)
+ && equalsObject(_portType, rhsPortReference._portType)
+ && equalsObject(_serviceName, rhsPortReference._serviceName) && equalsObject(
+ _policies, rhsPortReference._policies));
+ }
+ return false;
+ }
+
+ /**
+ * Return the hash code for this object.
+ *
+ * @return the hash code value.
+ */
+ public int hashCode()
+ {
+ // Not checked for spread.
+ return (objectHashCode(_address, 0x1)
+ ^ objectHashCode(_extensions, 0x2)
+ ^ objectHashCode(_portType, 0x4)
+ ^ objectHashCode(_serviceName, 0x8) ^ objectHashCode(_policies,
+ 0x10));
+ }
+
+ public static class Extension
+ {
+ public static final int REFERENCE_PROPERTIES = 0;
+
+ public static final int REFERENCE_PARAMETERS = 1;
+
+ public static final int NEITHER = 2;
+
+ public Extension(String tag, String prefix, String uri)
+ {
+ this(tag, prefix, uri, null, REFERENCE_PROPERTIES);
+ }
+
+ public Extension(String tag, String prefix, String uri, String value)
+ {
+ this(tag, prefix, uri, value, REFERENCE_PROPERTIES);
+ }
+
+ public Extension(String tag, String prefix, String uri, String value,
+ int parent)
+ {
+ _tag = tag;
+ _prefix = prefix;
+ _uri = uri;
+ _value = value;
+ _parent = parent;
+ }
+
+ public int getParent()
+ {
+ return _parent;
+ }
+
+ public String getTag()
+ {
+ return _tag;
+ }
+
+ public String getPrefix()
+ {
+ return _prefix;
+ }
+
+ public String getURI()
+ {
+ return _uri;
+ }
+
+ public String getValue()
+ {
+ return _value;
+ }
+
+ public LinkedList getChildren()
+ {
+ return _extensions;
+ }
+
+ public HashMap getAttributes()
+ {
+ return _attributes;
+ }
+
+ public void addAttributes(HashMap props)
+ {
+ _attributes = props;
+ }
+
+ public void addChild(Extension child)
+ {
+ if (_extensions == null)
+ _extensions = new LinkedList();
+
+ _extensions.add(child);
+ }
+
+ public String toString()
+ {
+ return new String("< " + _tag + ", " + _prefix + ", " + _uri + ", "
+ + _value + " >");
+ }
+
+ /**
+ * Is this object equal to the specified parameter (ignoring prefix)?
+ *
+ * @param rhs
+ * The rhs object.
+ * @return true if the specified object is equal, false otherwise.
+ */
+ public boolean equals(final Object rhs)
+ {
+ if ((rhs != null) && (rhs.getClass() == getClass()))
+ {
+ final Extension rhsExtension = (Extension) rhs;
+ return (equalsObject(_tag, rhsExtension._tag)
+ && equalsObject(_uri, rhsExtension._uri)
+ && equalsObject(_value, rhsExtension._value)
+ && equalsObject(_extensions, rhsExtension._extensions) && (_parent == rhsExtension._parent));
+ }
+ return false;
+ }
+
+ /**
+ * Return the hash code for this object.
+ *
+ * @return the hash code value.
+ */
+ public int hashCode()
+ {
+ // Not checked for spread.
+ return (_parent ^ objectHashCode(_tag, 0x4)
+ ^ objectHashCode(_uri, 0x8) ^ objectHashCode(_value, 0x10) ^ objectHashCode(
+ _extensions, 0x20));
+ }
+
+ private String _tag = null;
+
+ private String _prefix = null;
+
+ private String _uri = null;
+
+ private String _value = null;
+
+ private int _parent = NEITHER;
+
+ private LinkedList _extensions = null;
+
+ private HashMap _attributes = null;
+
+ }
+
+ /**
+ * Get the hash code from the object or use the default if null.
+ *
+ * @param obj
+ * The object.
+ * @param defaultHashCode
+ * The default hash code.
+ * @return The hash code.
+ */
+ static int objectHashCode(final Object obj, final int defaultHashCode)
+ {
+ return (obj == null ? defaultHashCode : obj.hashCode());
+ }
+
+ /**
+ * Are the two objects equal?
+ *
+ * @param lhs
+ * The lhs object.
+ * @param rhs
+ * The rhs object.
+ * @return true if equal or both null, false otherwise.
+ */
+ static boolean equalsObject(final Object lhs, final Object rhs)
+ {
+ if (lhs == null)
+ {
+ return (rhs == null);
+ } else
+ {
+ return lhs.equals(rhs);
+ }
+ }
+
+ private String _address = null;
+ private LinkedList _extensions = new LinkedList();
+ private Extension _portType = null;
+ private Extension _serviceName = null;
+ private List _policies = null;
+
+}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/XMLUtil.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/XMLUtil.java 2006-09-30 22:54:12 UTC (rev 6483)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/XMLUtil.java 2006-09-30 22:58:50 UTC (rev 6484)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., 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.
+ *
+ * (C) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/*
+ * Copyright (c) 2002, 2003, Arjuna Technologies Limited.
+ *
+ * XMLUtil.java
+ */
+
+package org.jboss.soa.esb.addressing;
+
+public class XMLUtil
+{
+ // WS-Addr
+
+ public static final String WSA_PREFIX = "wsa";
+ public static final String WSA_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+
+ public static final String ENDPOINT_REFERENCE_TAG = "EndpointReference";
+ public static final String MESSAGE_IDENTIFIER_TAG = "MessageID";
+ public static final String REFERENCE_PROPERTIES_TAG = "ReferenceProperties";
+ public static final String REFERENCE_PARAMETERS_TAG = "ReferenceParameters";
+ public static final String REPLY_TO_TAG = "ReplyTo";
+ public static final String FROM_TAG = "From";
+
+ public static final String TO_TAG = "To";
+ public static final String ADDRESS_TAG = "Address";
+ public static final String ACTION_TAG = "Action";
+ public static final String RELATES_TO_TAG = "RelatesTo";
+ public static final String FAULT_TO_TAG = "FaultTo";
+
+ // WS-ARJADDR
+
+ public static final String WSARJADDR_PREFIX = "wsarjaddr";
+ public static final String WSARJADDR_NAMESPACE_URI = "http://schemas.arjuna.com/ws/2004/06/wsarjaddr";
+
+ public static final String INSTANCE_IDENTIFIER_TAG = "InstanceIdentifier";
+
+ public static final String UNKNOWNERROR_ERROR_CODE = "UnknownError";
+
+ // XML Namespace
+ public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/" ;
+ public static final String XMLNS_PREFIX = "xmlns:" ;
+}
More information about the jboss-svn-commits
mailing list