[jboss-svn-commits] JBL Code SVN: r7199 - in labs/jbossesb/trunk/product/core/rosetta: src/org/jboss/internal/soa/esb/addressing src/org/jboss/internal/soa/esb/addressing/helpers src/org/jboss/internal/soa/esb/message/format/xml src/org/jboss/soa/esb/addressing src/org/jboss/soa/esb/addressing/eprs src/org/jboss/soa/esb/addressing/util tests/src/org/jboss/soa/esb/addressing/helpers/tests tests/src/org/jboss/soa/esb/addressing/util/tests
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Oct 29 12:22:15 EST 2006
Author: mark.little at jboss.com
Date: 2006-10-29 12:21:48 -0500 (Sun, 29 Oct 2006)
New Revision: 7199
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/eprs/
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/PortReferenceHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/SpecificEpr.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java
Removed:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/HeaderImpl.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/EmailUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JDBCUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java
Log:
Allow specific EPR instances to be saved and restored automatically.
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,215 +0,0 @@
-package org.jboss.internal.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
- */
-
-import java.net.URI;
-import java.security.InvalidParameterException;
-
-import org.jboss.soa.esb.addressing.Call;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.XMLUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class CallHelper
-{
-
- public static Element toXML (Call call, Document doc, Element header)
- {
- if (call == null)
- throw new InvalidParameterException();
-
- try
- {
- if (call.getTo() != null)
- {
- Element toElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG);
- PortReferenceHelper.toXML(header, doc, toElement, call.getTo().getAddr(), true);
- header.appendChild(toElement);
- }
-
- if (call.getFrom() != null)
- {
- Element fromElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG);
- PortReferenceHelper.toXML(header, doc, fromElement, call.getFrom().getAddr(), false);
- header.appendChild(fromElement);
- }
-
- if (call.getReplyTo() != null)
- {
- Element replyToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG);
- PortReferenceHelper.toXML(header, doc, replyToElement, call.getReplyTo().getAddr(), false);
- header.appendChild(replyToElement);
- }
-
- if (call.getRelatesTo() != null)
- {
- Element relatesToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG);
- relatesToElement.setNodeValue(call.getRelatesTo().toString());
- header.appendChild(relatesToElement);
- }
-
- if (call.getFaultTo() != null)
- {
- Element faultToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG);
- PortReferenceHelper.toXML(header, doc, faultToElement, call.getFaultTo().getAddr(), false);
- header.appendChild(faultToElement);
- }
-
- if (call.getAction() != null)
- {
- Element actionElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG);
- actionElement.setNodeValue(call.getAction().toString());
- header.appendChild(actionElement);
- }
-
- if (call.getMessageID() != null)
- {
- Element messageIDElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG);
- messageIDElement.setNodeValue(call.getMessageID().toString());
- header.appendChild(messageIDElement);
- }
-
- return header;
- }
- catch (Exception ex)
- {
- // TODO improve error handling.
-
- ex.printStackTrace();
-
- throw new InvalidParameterException(ex.toString());
- }
- }
-
- public static Call fromXML (Element header)
- {
- Call call = null;
-
- try
- {
- call = new Call();
-
- NodeList nl = header.getChildNodes();
-
- for (int i = 0; i < nl.getLength(); i++)
- {
- Node n = nl.item(i);
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG))
- {
- try
- {
- call.setTo(new EPR(PortReferenceHelper.fromXML((Element) n, true)));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG))
- {
- try
- {
- call.setFrom(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG))
- {
- try
- {
- call.setReplyTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG))
- {
- try
- {
- call.setRelatesTo(new URI(n.getNodeValue()));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG))
- {
- try
- {
- call.setFaultTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG))
- {
- try
- {
- call.setAction(new URI(n.getNodeValue()));
- }
- catch (Exception ex)
- {
-
- }
- }
-
- if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG))
- {
- try
- {
- call.setMessageID(new URI(n.getNodeValue()));
- }
- catch (Exception ex)
- {
-
- }
- }
- }
- }
- catch (Exception ex)
- {
- // TODO error checking!!
-
- ex.printStackTrace();
- }
-
- return call;
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,173 +0,0 @@
-package org.jboss.internal.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
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.URISyntaxException;
-import java.security.InvalidParameterException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.addressing.EPR;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
-public class EPRHelper
-{
- public static final String ELEMENT_NAME = "EPR";
-
- public static final Element toXML (EPR epr, Document doc, Element header)
- {
- if (epr == null)
- throw new InvalidParameterException();
-
- try
- {
- PortReferenceHelper.toXML(null, doc, header, epr.getAddr(), false);
-
- return header;
- }
- catch (URISyntaxException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- catch (MarshalException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- }
-
- public static final String toXMLString (EPR epr)
- {
- if (epr == null)
- throw new InvalidParameterException();
-
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
- Element portReferenceElement = doc.createElement(ELEMENT_NAME);
-
- doc.appendChild(portReferenceElement);
-
- toXML(epr, doc, portReferenceElement);
-
- StringWriter sWriter = new StringWriter();
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
-
- XMLSerializer xmlS = new XMLSerializer(sWriter, format);
-
- xmlS.asDOMSerializer();
- xmlS.serialize(doc);
-
- return sWriter.toString();
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- catch (ParserConfigurationException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- }
-
- public static final EPR fromXML (Element header)
- {
- if (header == null)
- throw new InvalidParameterException();
-
- try
- {
- if (header.getNodeName().equals(ELEMENT_NAME))
- return new EPR(PortReferenceHelper.fromXML(header, false));
- else
- return null;
- }
- catch (MarshalException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- }
-
- public static final EPR fromXMLString (String xml)
- {
- if (xml == null)
- throw new InvalidParameterException();
-
- try
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
- Element rootElement = doc.getDocumentElement();
-
- return new EPR(PortReferenceHelper.fromXML(rootElement, false));
- }
- catch (MarshalException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- catch (SAXException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- catch (ParserConfigurationException ex)
- {
- ex.printStackTrace();
-
- return null;
- }
- }
-
-}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,430 +0,0 @@
-/*
- * 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.
- *
- * PortReferenceHelper.java
- */
-
-package org.jboss.internal.soa.esb.addressing;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.jboss.soa.esb.MarshalException;
-import org.jboss.soa.esb.addressing.PortReference;
-import org.jboss.soa.esb.addressing.XMLUtil;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/*
- * This should pack the PortReference into an ERP.
- *
- * It would be better if PortReference had a packToXML and unpackFromXML.
- *
- * This needs rewriting after the interoperability workshop!
- */
-
-public class PortReferenceHelper
-{
- /**
- * WS-Addressing is broken in that the To field is a URI, even if the From
- * field was an EPR! You have to use the EPR bits separately. So, the
- * toField is used to indicate whether we are packing this address as a To
- * field (when we need to treat it differently) or as an EPR.
- */
-
- /** ************************************************** */
- public static void toXML(org.w3c.dom.Element header,
- org.w3c.dom.Document document,
- org.w3c.dom.Element portReferenceElement,
- PortReference portReference, boolean toField)
- throws MarshalException
- {
- try
- {
- if (!toField)
- {
- Element addressElement = document.createElementNS(
- XMLUtil.WSA_NAMESPACE_URI, XMLUtil.ADDRESS_TAG);
- addressElement.setPrefix(XMLUtil.WSA_PREFIX);
- addressElement.appendChild(document
- .createTextNode(portReference.getAddress()));
- portReferenceElement.appendChild(addressElement);
- }
- else
- {
- portReferenceElement.appendChild(document
- .createTextNode(portReference.getAddress()));
- }
-
- Iterator extensions = portReference.getExtensions();
- Element referenceProperties = null;
-
- while (extensions.hasNext())
- {
- PortReference.Extension extension = (PortReference.Extension) extensions
- .next();
-
- /*
- * WS-Addressing is broken in that the To field is a URI, even
- * if the From field was an EPR! You have to use the EPR bits
- * separately. Doh!
- */
-
- if (!toField)
- {
- if (referenceProperties == null)
- {
- referenceProperties = document.createElementNS(
- XMLUtil.WSA_NAMESPACE_URI,
- XMLUtil.REFERENCE_PROPERTIES_TAG);
- referenceProperties.setPrefix(XMLUtil.WSA_PREFIX);
- portReferenceElement.appendChild(referenceProperties);
- }
- }
- else
- referenceProperties = header;
-
- extensionToXML(referenceProperties, document, extension);
- }
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- throw new MarshalException("Marshal failure: " + exception);
- }
- }
-
- /** **************************** */
- public static PortReference fromXML(
- org.w3c.dom.Element portReferenceElement, boolean toField)
- throws MarshalException
- {
- PortReference portReference = new PortReference();
-
- if (toField)
- portReference.setAddress(portReferenceElement.getTextContent());
-
- org.w3c.dom.NodeList elements = portReferenceElement.getChildNodes();
-
- for (int i = 1; i < elements.getLength(); i++)
- {
- final Object extensionObject = elements.item(i);
-
- if (extensionObject instanceof Element)
- {
- int parentNodeType = PortReference.Extension.NEITHER;
- Element extensionElement = (Element) extensionObject;
- NodeList children = extensionElement.getChildNodes();
- String parentName = extensionElement.getNodeName();
- boolean haveChildren = false;
-
- if (parentName.equals(XMLUtil.REFERENCE_PROPERTIES_TAG))
- parentNodeType = PortReference.Extension.REFERENCE_PROPERTIES;
- else
- {
- if (parentName.equals(XMLUtil.REFERENCE_PARAMETERS_TAG))
- parentNodeType = PortReference.Extension.REFERENCE_PARAMETERS;
- else
- {
- if (!toField
- && parentName.equals(XMLUtil.WSA_PREFIX + ":"
- + XMLUtil.ADDRESS_TAG))
- {
- portReference.setAddress(extensionElement
- .getTextContent());
- }
- }
- }
-
- final int numChildren = children.getLength();
-
- for (int count = 0; count < numChildren; count++)
- {
- final Object childObject = children.item(count);
-
- if (childObject instanceof Element)
- {
- Element childElement = (Element) childObject;
-
- portReference
- .addExtension(childrenFromXML(childElement));
- haveChildren = true;
- }
- }
-
- if (!haveChildren && !parentName.equals(XMLUtil.WSA_PREFIX + ":"+ XMLUtil.ADDRESS_TAG))
- {
- PortReference.Extension ext = new PortReference.Extension(
- extensionElement.getNodeName(), null, null,
- extensionElement.getNodeValue(), parentNodeType);
-
- portReference.addExtension(ext);
-
- final NamedNodeMap attrs = extensionElement.getAttributes();
- final int numAttrs = attrs.getLength();
- if (numAttrs > 0)
- {
- final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
- for (int count = 0; count < numAttrs; count++)
- {
- final Attr attr = (Attr) attrs.item(count);
- if (!"http://www.w3.org/2000/xmlns/".equals(attr
- .getNamespaceURI()))
- {
- final ArjunaName name = generateName(attr);
- p.put(name, attr.getValue());
- }
- }
-
- ext.addAttributes(p);
- }
- }
- }
- }
-
- return portReference;
- }
-
- private final static PortReference.Extension childrenFromXML(
- Element childRoot)
- {
- final NodeList children = childRoot.getChildNodes();
- final int numChildNodes = children.getLength();
-
- final PortReference.Extension extension;
- if (numChildNodes > 0)
- {
- Object childObject = children.item(0);
- if (childObject instanceof Element)
- {
- extension = new PortReference.Extension(
- childRoot.getNodeName(), childRoot.getPrefix(),
- childRoot.getNamespaceURI());
-
- for (int count = 1; count < numChildNodes; count++)
- {
- extension.addChild(childrenFromXML((Element) childObject));
- childObject = children.item(count);
- }
- }
- else
- {
- extension = new PortReference.Extension(
- childRoot.getNodeName(), childRoot.getPrefix(),
- childRoot.getNamespaceURI(), ((Node) childObject)
- .getNodeValue());
- }
- }
- else
- {
- extension = new PortReference.Extension(childRoot.getNodeName(),
- childRoot.getPrefix(), childRoot.getNamespaceURI(),
- childRoot.getNodeValue());
- }
-
- final NamedNodeMap attrs = childRoot.getAttributes();
- final int numAttrs = attrs.getLength();
- if (numAttrs > 0)
- {
- final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
- for (int count = 0; count < numAttrs; count++)
- {
- final Attr attr = (Attr) attrs.item(count);
- if (!"http://www.w3.org/2000/xmlns/".equals(attr
- .getNamespaceURI()))
- {
- final ArjunaName name = generateName(attr);
- p.put(name, attr.getValue());
- }
- }
-
- extension.addAttributes(p);
- }
- return extension;
- }
-
- private final static Element extensionToXML(Element packInto,
- org.w3c.dom.Document document, PortReference.Extension toPack)
- throws MarshalException
- {
- final String uri = toPack.getURI();
- final Element element;
- if (uri == null)
- {
- element = document.createElement(toPack.getTag());
- }
- else
- {
- final String prefix = toPack.getPrefix();
- element = document.createElementNS(uri, toPack.getTag());
- element.setPrefix(prefix);
- element.setAttributeNS(XMLUtil.XMLNS_URI, XMLUtil.XMLNS_PREFIX
- + toPack.getPrefix(), uri);
- }
- packInto.appendChild(element);
-
- if (toPack.getValue() != null)
- {
- final Text text = document.createTextNode(toPack.getValue());
- element.appendChild(text);
- }
-
- LinkedList extensions = toPack.getChildren();
-
- if (extensions != null)
- {
- for (int i = 0; i < extensions.size(); i++)
- {
- PortReference.Extension ext = (PortReference.Extension) extensions
- .get(i);
-
- extensionToXML(element, document, ext);
- }
- }
-
- HashMap attrs = toPack.getAttributes();
-
- if (attrs != null)
- {
- Iterator names = attrs.entrySet().iterator();
-
- while (names.hasNext())
- {
- Map.Entry entry = (Map.Entry) names.next();
- ArjunaName name = (ArjunaName) entry.getKey();
- final String value = (String) entry.getValue();
- final String attrURI = name.toString();
- if (attrURI != null)
- {
- element.setAttributeNS(attrURI, name.getQualifiedName(),
- value);
- }
- else
- {
- element.setAttribute(name.getQualifiedName(), value);
- }
- }
- }
-
- return element;
- }
-
- /**
- * Generate a name based on the attribute.
- *
- * @param attr
- * The current attribute.
- * @return The name
- */
- private static ArjunaName generateName(final Attr attr)
- {
- final String localName = attr.getNodeName();
- final String uri = attr.getNamespaceURI();
- final String prefix = attr.getPrefix();
-
- return new ArjunaName(uri, prefix, localName);
- }
-
- private static class ArjunaName
- {
- /**
- * The uri.
- */
- private final String uri;
-
- /**
- * The prefix.
- */
- private final String prefix;
-
- /**
- * The local name.
- */
- private final String localName;
-
- /**
- * Construct the name.
- *
- * @param uri
- * The uri.
- * @param prefix
- * The prefix.
- * @param localName
- * The local name.
- */
- public ArjunaName(final String uri, final String prefix,
- final String localName)
- {
- this.uri = uri;
- this.prefix = prefix;
- this.localName = localName;
- }
-
- /**
- * Get the uri.
- *
- * @return the uri.
- */
- public String getURI()
- {
- return uri;
- }
-
- /**
- * Get the prefix.
- *
- * @return the prefix.
- */
- public String getPrefix()
- {
- return prefix;
- }
-
- /**
- * Get the local name.
- *
- * @return the local name.
- */
- public String getLocalName()
- {
- return localName;
- }
-
- /**
- * Get the qualified name.
- *
- * @return the qualified name.
- */
- public String getQualifiedName()
- {
- return (prefix == null ? localName : prefix + ":" + localName);
- }
- }
-}
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java (from rev 7170, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/CallHelper.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/CallHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,215 @@
+package org.jboss.internal.soa.esb.addressing.helpers;
+
+/*
+ * 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
+ */
+
+import java.net.URI;
+import java.security.InvalidParameterException;
+
+import org.jboss.soa.esb.addressing.Call;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.XMLUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class CallHelper
+{
+
+ public static Element toXML (Call call, Document doc, Element header)
+ {
+ if (call == null)
+ throw new InvalidParameterException();
+
+ try
+ {
+ if (call.getTo() != null)
+ {
+ Element toElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG);
+ PortReferenceHelper.toXML(header, doc, toElement, call.getTo().getAddr(), true);
+ header.appendChild(toElement);
+ }
+
+ if (call.getFrom() != null)
+ {
+ Element fromElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG);
+ PortReferenceHelper.toXML(header, doc, fromElement, call.getFrom().getAddr(), false);
+ header.appendChild(fromElement);
+ }
+
+ if (call.getReplyTo() != null)
+ {
+ Element replyToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG);
+ PortReferenceHelper.toXML(header, doc, replyToElement, call.getReplyTo().getAddr(), false);
+ header.appendChild(replyToElement);
+ }
+
+ if (call.getRelatesTo() != null)
+ {
+ Element relatesToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG);
+ relatesToElement.setNodeValue(call.getRelatesTo().toString());
+ header.appendChild(relatesToElement);
+ }
+
+ if (call.getFaultTo() != null)
+ {
+ Element faultToElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG);
+ PortReferenceHelper.toXML(header, doc, faultToElement, call.getFaultTo().getAddr(), false);
+ header.appendChild(faultToElement);
+ }
+
+ if (call.getAction() != null)
+ {
+ Element actionElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG);
+ actionElement.setNodeValue(call.getAction().toString());
+ header.appendChild(actionElement);
+ }
+
+ if (call.getMessageID() != null)
+ {
+ Element messageIDElement = doc.createElementNS(XMLUtil.WSA_NAMESPACE_URI, XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG);
+ messageIDElement.setNodeValue(call.getMessageID().toString());
+ header.appendChild(messageIDElement);
+ }
+
+ return header;
+ }
+ catch (Exception ex)
+ {
+ // TODO improve error handling.
+
+ ex.printStackTrace();
+
+ throw new InvalidParameterException(ex.toString());
+ }
+ }
+
+ public static Call fromXML (Element header)
+ {
+ Call call = null;
+
+ try
+ {
+ call = new Call();
+
+ NodeList nl = header.getChildNodes();
+
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.TO_TAG))
+ {
+ try
+ {
+ call.setTo(new EPR(PortReferenceHelper.fromXML((Element) n, true)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FROM_TAG))
+ {
+ try
+ {
+ call.setFrom(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.REPLY_TO_TAG))
+ {
+ try
+ {
+ call.setReplyTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.RELATES_TO_TAG))
+ {
+ try
+ {
+ call.setRelatesTo(new URI(n.getNodeValue()));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.FAULT_TO_TAG))
+ {
+ try
+ {
+ call.setFaultTo(new EPR(PortReferenceHelper.fromXML((Element) n, false)));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.ACTION_TAG))
+ {
+ try
+ {
+ call.setAction(new URI(n.getNodeValue()));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ if (n.getNodeName().equals(XMLUtil.WSA_PREFIX+":"+XMLUtil.MESSAGE_IDENTIFIER_TAG))
+ {
+ try
+ {
+ call.setMessageID(new URI(n.getNodeValue()));
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ // TODO error checking!!
+
+ ex.printStackTrace();
+ }
+
+ return call;
+ }
+
+}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java (from rev 7176, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/EPRHelper.java 2006-10-27 16:32:30 UTC (rev 7176)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/EPRHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,219 @@
+package org.jboss.internal.soa.esb.addressing.helpers;
+
+/*
+ * 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
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.URISyntaxException;
+import java.security.InvalidParameterException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.EmailEpr;
+import org.jboss.soa.esb.addressing.eprs.FTPEpr;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
+import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
+import org.jboss.soa.esb.addressing.eprs.SpecificEpr;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
+public class EPRHelper
+{
+ public static final String ELEMENT_NAME = "epr-data";
+
+ public static final String EPR_TYPE = "epr-type";
+
+ public static final Element toXML (EPR epr, Document doc, Element header)
+ {
+ if (epr == null)
+ throw new InvalidParameterException();
+
+ try
+ {
+ PortReferenceHelper.toXML(null, doc, header, epr.getAddr(), false);
+
+ return header;
+ }
+ catch (URISyntaxException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ catch (MarshalException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ }
+
+ public static final EPR fromXML (Element header)
+ {
+ if (header == null)
+ throw new InvalidParameterException();
+
+ try
+ {
+ if (header.getNodeName().equals(ELEMENT_NAME))
+ return getSpecificEPR(new EPR(PortReferenceHelper.fromXML(
+ header, false)));
+ else
+ return null;
+ }
+ catch (MarshalException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ }
+
+ public static final String toXMLString (EPR epr)
+ {
+ if (epr == null)
+ throw new InvalidParameterException();
+
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.newDocument();
+ Element portReferenceElement = doc.createElement(ELEMENT_NAME);
+
+ doc.appendChild(portReferenceElement);
+
+ toXML(epr, doc, portReferenceElement);
+
+ StringWriter sWriter = new StringWriter();
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+
+ XMLSerializer xmlS = new XMLSerializer(sWriter, format);
+
+ xmlS.asDOMSerializer();
+ xmlS.serialize(doc);
+
+ return sWriter.toString();
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ catch (ParserConfigurationException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ }
+
+ public static final EPR fromXMLString (String xml)
+ {
+ if (xml == null)
+ throw new InvalidParameterException();
+
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(new ByteArrayInputStream(xml
+ .getBytes()));
+ Element rootElement = doc.getDocumentElement();
+
+ return getSpecificEPR(new EPR(PortReferenceHelper.fromXML(rootElement, false)));
+ }
+ catch (MarshalException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ catch (SAXException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ catch (ParserConfigurationException ex)
+ {
+ ex.printStackTrace();
+
+ return null;
+ }
+ }
+
+ private final static EPR getSpecificEPR (EPR epr)
+ {
+ try
+ {
+ String eprType = epr.getAddr().getExtensionValue(
+ SpecificEpr.EPR_TYPE);
+
+ if (eprType != null)
+ {
+ if (eprType.equals(EmailEpr.type().toString()))
+ return new EmailEpr(epr);
+ else if (eprType.equals(FTPEpr.type().toString()))
+ return new FTPEpr(epr);
+ else if (eprType.equals(HTTPEpr.type().toString()))
+ return new HTTPEpr(epr);
+ else if (eprType.equals(JDBCEpr.type().toString()))
+ return new JDBCEpr(epr);
+ else if (eprType.equals(JMSEpr.type().toString()))
+ return new JMSEpr(epr);
+ else
+ return epr;
+ }
+ else
+ return epr;
+ }
+ catch (URISyntaxException ex)
+ {
+ ex.printStackTrace();
+
+ return epr;
+ }
+ }
+
+}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/PortReferenceHelper.java (from rev 7170, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/PortReferenceHelper.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/addressing/helpers/PortReferenceHelper.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,430 @@
+/*
+ * 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.
+ *
+ * PortReferenceHelper.java
+ */
+
+package org.jboss.internal.soa.esb.addressing.helpers;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.jboss.soa.esb.MarshalException;
+import org.jboss.soa.esb.addressing.PortReference;
+import org.jboss.soa.esb.addressing.XMLUtil;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+/*
+ * This should pack the PortReference into an ERP.
+ *
+ * It would be better if PortReference had a packToXML and unpackFromXML.
+ *
+ * This needs rewriting after the interoperability workshop!
+ */
+
+public class PortReferenceHelper
+{
+ /**
+ * WS-Addressing is broken in that the To field is a URI, even if the From
+ * field was an EPR! You have to use the EPR bits separately. So, the
+ * toField is used to indicate whether we are packing this address as a To
+ * field (when we need to treat it differently) or as an EPR.
+ */
+
+ /** ************************************************** */
+ public static void toXML(org.w3c.dom.Element header,
+ org.w3c.dom.Document document,
+ org.w3c.dom.Element portReferenceElement,
+ PortReference portReference, boolean toField)
+ throws MarshalException
+ {
+ try
+ {
+ if (!toField)
+ {
+ Element addressElement = document.createElementNS(
+ XMLUtil.WSA_NAMESPACE_URI, XMLUtil.ADDRESS_TAG);
+ addressElement.setPrefix(XMLUtil.WSA_PREFIX);
+ addressElement.appendChild(document
+ .createTextNode(portReference.getAddress()));
+ portReferenceElement.appendChild(addressElement);
+ }
+ else
+ {
+ portReferenceElement.appendChild(document
+ .createTextNode(portReference.getAddress()));
+ }
+
+ Iterator extensions = portReference.getExtensions();
+ Element referenceProperties = null;
+
+ while (extensions.hasNext())
+ {
+ PortReference.Extension extension = (PortReference.Extension) extensions
+ .next();
+
+ /*
+ * WS-Addressing is broken in that the To field is a URI, even
+ * if the From field was an EPR! You have to use the EPR bits
+ * separately. Doh!
+ */
+
+ if (!toField)
+ {
+ if (referenceProperties == null)
+ {
+ referenceProperties = document.createElementNS(
+ XMLUtil.WSA_NAMESPACE_URI,
+ XMLUtil.REFERENCE_PROPERTIES_TAG);
+ referenceProperties.setPrefix(XMLUtil.WSA_PREFIX);
+ portReferenceElement.appendChild(referenceProperties);
+ }
+ }
+ else
+ referenceProperties = header;
+
+ extensionToXML(referenceProperties, document, extension);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ throw new MarshalException("Marshal failure: " + exception);
+ }
+ }
+
+ /** **************************** */
+ public static PortReference fromXML(
+ org.w3c.dom.Element portReferenceElement, boolean toField)
+ throws MarshalException
+ {
+ PortReference portReference = new PortReference();
+
+ if (toField)
+ portReference.setAddress(portReferenceElement.getTextContent());
+
+ org.w3c.dom.NodeList elements = portReferenceElement.getChildNodes();
+
+ for (int i = 1; i < elements.getLength(); i++)
+ {
+ final Object extensionObject = elements.item(i);
+
+ if (extensionObject instanceof Element)
+ {
+ int parentNodeType = PortReference.Extension.NEITHER;
+ Element extensionElement = (Element) extensionObject;
+ NodeList children = extensionElement.getChildNodes();
+ String parentName = extensionElement.getNodeName();
+ boolean haveChildren = false;
+
+ if (parentName.equals(XMLUtil.REFERENCE_PROPERTIES_TAG))
+ parentNodeType = PortReference.Extension.REFERENCE_PROPERTIES;
+ else
+ {
+ if (parentName.equals(XMLUtil.REFERENCE_PARAMETERS_TAG))
+ parentNodeType = PortReference.Extension.REFERENCE_PARAMETERS;
+ else
+ {
+ if (!toField
+ && parentName.equals(XMLUtil.WSA_PREFIX + ":"
+ + XMLUtil.ADDRESS_TAG))
+ {
+ portReference.setAddress(extensionElement
+ .getTextContent());
+ }
+ }
+ }
+
+ final int numChildren = children.getLength();
+
+ for (int count = 0; count < numChildren; count++)
+ {
+ final Object childObject = children.item(count);
+
+ if (childObject instanceof Element)
+ {
+ Element childElement = (Element) childObject;
+
+ portReference
+ .addExtension(childrenFromXML(childElement));
+ haveChildren = true;
+ }
+ }
+
+ if (!haveChildren && !parentName.equals(XMLUtil.WSA_PREFIX + ":"+ XMLUtil.ADDRESS_TAG))
+ {
+ PortReference.Extension ext = new PortReference.Extension(
+ extensionElement.getNodeName(), null, null,
+ extensionElement.getNodeValue(), parentNodeType);
+
+ portReference.addExtension(ext);
+
+ final NamedNodeMap attrs = extensionElement.getAttributes();
+ final int numAttrs = attrs.getLength();
+ if (numAttrs > 0)
+ {
+ final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
+ for (int count = 0; count < numAttrs; count++)
+ {
+ final Attr attr = (Attr) attrs.item(count);
+ if (!"http://www.w3.org/2000/xmlns/".equals(attr
+ .getNamespaceURI()))
+ {
+ final ArjunaName name = generateName(attr);
+ p.put(name, attr.getValue());
+ }
+ }
+
+ ext.addAttributes(p);
+ }
+ }
+ }
+ }
+
+ return portReference;
+ }
+
+ private final static PortReference.Extension childrenFromXML(
+ Element childRoot)
+ {
+ final NodeList children = childRoot.getChildNodes();
+ final int numChildNodes = children.getLength();
+
+ final PortReference.Extension extension;
+ if (numChildNodes > 0)
+ {
+ Object childObject = children.item(0);
+ if (childObject instanceof Element)
+ {
+ extension = new PortReference.Extension(
+ childRoot.getNodeName(), childRoot.getPrefix(),
+ childRoot.getNamespaceURI());
+
+ for (int count = 1; count < numChildNodes; count++)
+ {
+ extension.addChild(childrenFromXML((Element) childObject));
+ childObject = children.item(count);
+ }
+ }
+ else
+ {
+ extension = new PortReference.Extension(
+ childRoot.getNodeName(), childRoot.getPrefix(),
+ childRoot.getNamespaceURI(), ((Node) childObject)
+ .getNodeValue());
+ }
+ }
+ else
+ {
+ extension = new PortReference.Extension(childRoot.getNodeName(),
+ childRoot.getPrefix(), childRoot.getNamespaceURI(),
+ childRoot.getNodeValue());
+ }
+
+ final NamedNodeMap attrs = childRoot.getAttributes();
+ final int numAttrs = attrs.getLength();
+ if (numAttrs > 0)
+ {
+ final HashMap<ArjunaName, String> p = new HashMap<ArjunaName, String>();
+ for (int count = 0; count < numAttrs; count++)
+ {
+ final Attr attr = (Attr) attrs.item(count);
+ if (!"http://www.w3.org/2000/xmlns/".equals(attr
+ .getNamespaceURI()))
+ {
+ final ArjunaName name = generateName(attr);
+ p.put(name, attr.getValue());
+ }
+ }
+
+ extension.addAttributes(p);
+ }
+ return extension;
+ }
+
+ private final static Element extensionToXML(Element packInto,
+ org.w3c.dom.Document document, PortReference.Extension toPack)
+ throws MarshalException
+ {
+ final String uri = toPack.getURI();
+ final Element element;
+ if (uri == null)
+ {
+ element = document.createElement(toPack.getTag());
+ }
+ else
+ {
+ final String prefix = toPack.getPrefix();
+ element = document.createElementNS(uri, toPack.getTag());
+ element.setPrefix(prefix);
+ element.setAttributeNS(XMLUtil.XMLNS_URI, XMLUtil.XMLNS_PREFIX
+ + toPack.getPrefix(), uri);
+ }
+ packInto.appendChild(element);
+
+ if (toPack.getValue() != null)
+ {
+ final Text text = document.createTextNode(toPack.getValue());
+ element.appendChild(text);
+ }
+
+ LinkedList extensions = toPack.getChildren();
+
+ if (extensions != null)
+ {
+ for (int i = 0; i < extensions.size(); i++)
+ {
+ PortReference.Extension ext = (PortReference.Extension) extensions
+ .get(i);
+
+ extensionToXML(element, document, ext);
+ }
+ }
+
+ HashMap attrs = toPack.getAttributes();
+
+ if (attrs != null)
+ {
+ Iterator names = attrs.entrySet().iterator();
+
+ while (names.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) names.next();
+ ArjunaName name = (ArjunaName) entry.getKey();
+ final String value = (String) entry.getValue();
+ final String attrURI = name.toString();
+ if (attrURI != null)
+ {
+ element.setAttributeNS(attrURI, name.getQualifiedName(),
+ value);
+ }
+ else
+ {
+ element.setAttribute(name.getQualifiedName(), value);
+ }
+ }
+ }
+
+ return element;
+ }
+
+ /**
+ * Generate a name based on the attribute.
+ *
+ * @param attr
+ * The current attribute.
+ * @return The name
+ */
+ private static ArjunaName generateName(final Attr attr)
+ {
+ final String localName = attr.getNodeName();
+ final String uri = attr.getNamespaceURI();
+ final String prefix = attr.getPrefix();
+
+ return new ArjunaName(uri, prefix, localName);
+ }
+
+ private static class ArjunaName
+ {
+ /**
+ * The uri.
+ */
+ private final String uri;
+
+ /**
+ * The prefix.
+ */
+ private final String prefix;
+
+ /**
+ * The local name.
+ */
+ private final String localName;
+
+ /**
+ * Construct the name.
+ *
+ * @param uri
+ * The uri.
+ * @param prefix
+ * The prefix.
+ * @param localName
+ * The local name.
+ */
+ public ArjunaName(final String uri, final String prefix,
+ final String localName)
+ {
+ this.uri = uri;
+ this.prefix = prefix;
+ this.localName = localName;
+ }
+
+ /**
+ * Get the uri.
+ *
+ * @return the uri.
+ */
+ public String getURI()
+ {
+ return uri;
+ }
+
+ /**
+ * Get the prefix.
+ *
+ * @return the prefix.
+ */
+ public String getPrefix()
+ {
+ return prefix;
+ }
+
+ /**
+ * Get the local name.
+ *
+ * @return the local name.
+ */
+ public String getLocalName()
+ {
+ return localName;
+ }
+
+ /**
+ * Get the qualified name.
+ *
+ * @return the qualified name.
+ */
+ public String getQualifiedName()
+ {
+ return (prefix == null ? localName : prefix + ":" + localName);
+ }
+ }
+}
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/HeaderImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/HeaderImpl.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/xml/HeaderImpl.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -21,7 +21,7 @@
* @author mark.little at jboss.com
*/
-import org.jboss.internal.soa.esb.addressing.CallHelper;
+import org.jboss.internal.soa.esb.addressing.helpers.CallHelper;
import org.jboss.soa.esb.addressing.Call;
import org.jboss.soa.esb.message.Header;
import org.w3c.dom.Document;
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs (from rev 7170, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers)
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,169 +0,0 @@
-package org.jboss.soa.esb.addressing.helpers;
-
-/*
- * 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;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-
-/**
- * A helper class for using email style EPRs. Simply create and use instances of
- * this type.
- *
- * @author marklittle
- *
- */
-public class EmailEpr extends EPR
-{
- public static final String DEFAULT_PORT = "25";
- public static final String DEFAULT_USERNAME = "";
- public static final String DEFAULT_PASSWORD = "";
-
- public static final String SMTP_PROTOCOL = "smtp";
- public static final String POP_PROTOCOL = "pop";
-
- public static final String USERNAME_TAG = "username";
- public static final String PASSWORD_TAG = "password";
-
- private static final String PROTOCOL_SEPARATOR = "://";
- private static final String PORT_SEPARATOR = ":";
-
- public EmailEpr (EPR epr)
- {
- copy(epr);
- }
-
- /**
- * Create a new email EPR. The port number will be assumed to be 25,
- * and there are no values for username and password.
- *
- * @param protocol the protocol to use.
- * @param host the host name.
- */
-
- public EmailEpr (String protocol, String host)
- {
- this(protocol, host, DEFAULT_PORT, DEFAULT_USERNAME, DEFAULT_PASSWORD);
- }
-
- /**
- * Create a new email EPR.
- *
- * @param protocol the protocol to use.
- * @param host the host name.
- * @param port the port to use.
- * @param username the username for sending/receiving.
- * @param password the password for sending/receiving.
- */
-
- public EmailEpr (String protocol, String host, String port, String username, String password)
- {
- // how many of these do we really need? modify accordingly.
-
- if ((protocol == null) || (host == null) || (port == null))
- throw new IllegalArgumentException();
-
- if ((protocol.equals(SMTP_PROTOCOL) || (protocol.equals(POP_PROTOCOL))))
- {
- PortReference addr = new PortReference(protocol+PROTOCOL_SEPARATOR+host+PORT_SEPARATOR+port);
-
- if (username != null)
- addr.addExtension(USERNAME_TAG, username);
-
- if (password != null)
- addr.addExtension(PASSWORD_TAG, password);
-
- setAddr(addr);
- }
- else
- throw new IllegalArgumentException("Invalid email protocol!");
- }
-
- /**
- * @return the email protocol used.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getProtocol () throws URISyntaxException
- {
- URI addr = new URI(getAddr().getAddress());
-
- return addr.getScheme();
- }
-
- /**
- * @return the email host used.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getHost () throws URISyntaxException
- {
- URI addr = new URI(getAddr().getAddress());
-
- return addr.getHost();
- }
-
- /**
- * @return the email port used, or -1 if not specified.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final int getPort () throws URISyntaxException
- {
- URI addr = new URI(getAddr().getAddress());
-
- return addr.getPort();
- }
-
- /*
- * There are deliberately no setters for the values once the EPR is created.
- */
-
- /**
- * @return the password for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getPassword () throws URISyntaxException
- {
- return getAddr().getExtensionValue(PASSWORD_TAG);
- }
-
- /**
- * @return the username for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getUserName () throws URISyntaxException
- {
- return getAddr().getExtensionValue(USERNAME_TAG);
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java (from rev 7195, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/EmailEpr.java 2006-10-29 16:30:17 UTC (rev 7195)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/EmailEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,193 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+/*
+ * 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;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+
+/**
+ * A helper class for using email style EPRs. Simply create and use instances of
+ * this type.
+ *
+ * @author marklittle
+ *
+ */
+public class EmailEpr extends SpecificEpr
+{
+ public static final String DEFAULT_PORT = "25";
+ public static final String DEFAULT_USERNAME = "";
+ public static final String DEFAULT_PASSWORD = "";
+
+ public static final String SMTP_PROTOCOL = "smtp";
+ public static final String POP_PROTOCOL = "pop";
+
+ public static final String USERNAME_TAG = "username";
+ public static final String PASSWORD_TAG = "password";
+
+ private static final String PROTOCOL_SEPARATOR = "://";
+ private static final String PORT_SEPARATOR = ":";
+
+ public EmailEpr (EPR epr)
+ {
+ copy(epr);
+
+ addType(type());
+ }
+
+ /**
+ * Create a new email EPR. The port number will be assumed to be 25,
+ * and there are no values for username and password.
+ *
+ * @param protocol the protocol to use.
+ * @param host the host name.
+ */
+
+ public EmailEpr (String protocol, String host)
+ {
+ this(protocol, host, DEFAULT_PORT, DEFAULT_USERNAME, DEFAULT_PASSWORD);
+ }
+
+ /**
+ * Create a new email EPR.
+ *
+ * @param protocol the protocol to use.
+ * @param host the host name.
+ * @param port the port to use.
+ * @param username the username for sending/receiving.
+ * @param password the password for sending/receiving.
+ */
+
+ public EmailEpr (String protocol, String host, String port, String username, String password)
+ {
+ // how many of these do we really need? modify accordingly.
+
+ if ((protocol == null) || (host == null) || (port == null))
+ throw new IllegalArgumentException();
+
+ if ((protocol.equals(SMTP_PROTOCOL) || (protocol.equals(POP_PROTOCOL))))
+ {
+ PortReference addr = new PortReference(protocol+PROTOCOL_SEPARATOR+host+PORT_SEPARATOR+port);
+
+ if (username != null)
+ addr.addExtension(USERNAME_TAG, username);
+
+ if (password != null)
+ addr.addExtension(PASSWORD_TAG, password);
+
+ setAddr(addr);
+ }
+ else
+ throw new IllegalArgumentException("Invalid email protocol!");
+
+ addType(type());
+ }
+
+ /**
+ * @return the email protocol used.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getProtocol () throws URISyntaxException
+ {
+ URI addr = new URI(getAddr().getAddress());
+
+ return addr.getScheme();
+ }
+
+ /**
+ * @return the email host used.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getHost () throws URISyntaxException
+ {
+ URI addr = new URI(getAddr().getAddress());
+
+ return addr.getHost();
+ }
+
+ /**
+ * @return the email port used, or -1 if not specified.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final int getPort () throws URISyntaxException
+ {
+ URI addr = new URI(getAddr().getAddress());
+
+ return addr.getPort();
+ }
+
+ /*
+ * There are deliberately no setters for the values once the EPR is created.
+ */
+
+ /**
+ * @return the password for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getPassword () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(PASSWORD_TAG);
+ }
+
+ /**
+ * @return the username for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException thrown if the address is malformed.
+ */
+
+ public final String getUserName () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(USERNAME_TAG);
+ }
+
+ public static final URI type ()
+ {
+ return _type;
+ }
+
+ private static URI _type;
+
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss:esb:epr:type:email");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,149 +0,0 @@
-package org.jboss.soa.esb.addressing.helpers;
-
-/*
- * 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.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-
-/**
- * A helper class for using FTP style EPRs. Simply create instances of this
- * class instead of the base EPR. Since URLs can use FTP, we try to leverage
- * that as much as possible.
- *
- * @author marklittle
- *
- */
-public class FTPEpr extends EPR
-{
- public static final String USERNAME_TAG = "username";
- public static final String PASSWORD_TAG = "password";
-
- public FTPEpr (EPR epr)
- {
- copy(epr);
- }
-
- public FTPEpr (URL url) throws URISyntaxException
- {
- super(new URI(url.toString()));
- }
-
- public FTPEpr (String url) throws URISyntaxException
- {
- super(new URI(url));
- }
-
- /**
- * Set the URL for this endpoint.
- *
- * @param url the address.
- */
-
- public final void setURL (URL url)
- {
- super.setAddr(new PortReference(url.toString()));
- }
-
- /**
- * Get the URL address.
- *
- * @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
- */
-
- public final URL getURL () throws MalformedURLException, URISyntaxException
- {
- return new URL(super.getAddr().getAddress());
- }
-
- /**
- * Set the username for this FTP EPR.
- *
- * @param username the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setUserName (String username) throws URISyntaxException
- {
- if (username == null)
- throw new IllegalArgumentException();
-
- if (userSet)
- throw new IllegalStateException("Username already set.");
-
- getAddr().addExtension(USERNAME_TAG, username);
- userSet = true;
- }
-
- /**
- * @return the user's name associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getUserName () throws URISyntaxException
- {
- return getAddr().getExtensionValue(USERNAME_TAG);
- }
-
- /**
- * Set the password for this FTP EPR.
- *
- * @param password the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setPassword (String password) throws URISyntaxException
- {
- if (password == null)
- throw new IllegalArgumentException();
-
- if (passwordSet)
- throw new IllegalStateException("Cannot change password");
-
- getAddr().addExtension(PASSWORD_TAG, password);
- passwordSet = true;
- }
-
- /**
- * @return the password associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getPassword () throws URISyntaxException
- {
- return getAddr().getExtensionValue(PASSWORD_TAG);
- }
-
- private boolean passwordSet = false;
- private boolean userSet = false;
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java (from rev 7195, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/FTPEpr.java 2006-10-29 16:30:17 UTC (rev 7195)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/FTPEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,177 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+/*
+ * 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.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+
+/**
+ * A helper class for using FTP style EPRs. Simply create instances of this
+ * class instead of the base EPR. Since URLs can use FTP, we try to leverage
+ * that as much as possible.
+ *
+ * @author marklittle
+ *
+ */
+public class FTPEpr extends SpecificEpr
+{
+ public static final String USERNAME_TAG = "username";
+ public static final String PASSWORD_TAG = "password";
+
+ public FTPEpr (EPR epr)
+ {
+ copy(epr);
+
+ addType(type());
+ }
+
+ public FTPEpr (URL url) throws URISyntaxException
+ {
+ super(new URI(url.toString()));
+
+ addType(type());
+ }
+
+ public FTPEpr (String url) throws URISyntaxException
+ {
+ super(new URI(url));
+
+ addType(type());
+ }
+
+ /**
+ * Set the URL for this endpoint.
+ *
+ * @param url the address.
+ */
+
+ public final void setURL (URL url)
+ {
+ super.setAddr(new PortReference(url.toString()));
+
+ addType(type());
+ }
+
+ /**
+ * Get the URL address.
+ *
+ * @return the address.
+ * @throws URISyntaxException thrown if the address is invalid.
+ */
+
+ public final URL getURL () throws MalformedURLException, URISyntaxException
+ {
+ return new URL(super.getAddr().getAddress());
+ }
+
+ /**
+ * Set the username for this FTP EPR.
+ *
+ * @param username the user's name.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setUserName (String username) throws URISyntaxException
+ {
+ if (username == null)
+ throw new IllegalArgumentException();
+
+ if (userSet)
+ throw new IllegalStateException("Username already set.");
+
+ getAddr().addExtension(USERNAME_TAG, username);
+ userSet = true;
+ }
+
+ /**
+ * @return the user's name associated with this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getUserName () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(USERNAME_TAG);
+ }
+
+ /**
+ * Set the password for this FTP EPR.
+ *
+ * @param password the user's name.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setPassword (String password) throws URISyntaxException
+ {
+ if (password == null)
+ throw new IllegalArgumentException();
+
+ if (passwordSet)
+ throw new IllegalStateException("Cannot change password");
+
+ getAddr().addExtension(PASSWORD_TAG, password);
+ passwordSet = true;
+ }
+
+ /**
+ * @return the password associated with this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getPassword () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(PASSWORD_TAG);
+ }
+
+ public static final URI type ()
+ {
+ return _type;
+ }
+
+ private boolean passwordSet = false;
+ private boolean userSet = false;
+
+ private static URI _type;
+
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss:esb:epr:type:ftp");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,85 +0,0 @@
-package org.jboss.soa.esb.addressing.helpers;
-
-/*
- * 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.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-
-/**
- * A helper class for using HTTP style EPRs. Simply create instances of this
- * class instead of the base EPR.
- *
- * @author marklittle
- *
- */
-public class HTTPEpr extends EPR
-{
-
- public HTTPEpr (EPR epr)
- {
- copy(epr);
- }
-
- public HTTPEpr (URL url) throws URISyntaxException
- {
- super(new URI(url.toString()));
- }
-
- public HTTPEpr (String url) throws URISyntaxException
- {
- super(new URI(url));
- }
-
- /**
- * Set the URL for this endpoint.
- *
- * @param url the address.
- */
-
- public final void setURL (URL url)
- {
- super.setAddr(new PortReference(url.toString()));
- }
-
- /**
- * Get the URL address.
- *
- * @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
- */
-
- public final URL getURL () throws MalformedURLException, URISyntaxException
- {
- return new URL(super.getAddr().getAddress());
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java (from rev 7195, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/HTTPEpr.java 2006-10-29 16:30:17 UTC (rev 7195)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/HTTPEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,113 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+/*
+ * 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.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+
+/**
+ * A helper class for using HTTP style EPRs. Simply create instances of this
+ * class instead of the base EPR.
+ *
+ * @author marklittle
+ *
+ */
+public class HTTPEpr extends SpecificEpr
+{
+
+ public HTTPEpr (EPR epr)
+ {
+ copy(epr);
+
+ addType(type());
+ }
+
+ public HTTPEpr (URL url) throws URISyntaxException
+ {
+ super(new URI(url.toString()));
+
+ addType(type());
+ }
+
+ public HTTPEpr (String url) throws URISyntaxException
+ {
+ super(new URI(url));
+
+ addType(type());
+ }
+
+ /**
+ * Set the URL for this endpoint.
+ *
+ * @param url the address.
+ */
+
+ public final void setURL (URL url)
+ {
+ super.setAddr(new PortReference(url.toString()));
+
+ addType(type());
+ }
+
+ /**
+ * Get the URL address.
+ *
+ * @return the address.
+ * @throws URISyntaxException thrown if the address is invalid.
+ */
+
+ public final URL getURL () throws MalformedURLException, URISyntaxException
+ {
+ return new URL(super.getAddr().getAddress());
+ }
+
+ public static final URI type ()
+ {
+ return _type;
+ }
+
+ private static URI _type;
+
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss:esb:epr:type:http");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,208 +0,0 @@
-package org.jboss.soa.esb.addressing.helpers;
-
-/*
- * 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;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-
-/**
- * A helper class for using database style EPRs. Simply create instances of this
- * class instead of the base EPR.
- *
- * @author marklittle
- *
- */
-
-public class JDBCEpr extends EPR
-{
- public static final String JDBC_PROTOCOL = "jdbc";
-
- public static final String USERNAME_TAG = "username";
- public static final String PASSWORD_TAG = "password";
- public static final String SQL_TAG = "sql";
- public static final String DRIVER_TAG = "driver";
-
- public JDBCEpr (EPR epr)
- {
- copy(epr);
- }
-
- public JDBCEpr (String url, String sql) throws URISyntaxException
- {
- super(new URI(url));
-
- setSQL(sql);
- }
-
- /**
- * Set the URL for this endpoint.
- *
- * @param url the address.
- */
-
- public final void setURL (String url)
- {
- super.setAddr(new PortReference(url));
- }
-
- /**
- * Get the URL address.
- *
- * @return the address.
- * @throws URISyntaxException thrown if the address is invalid.
- */
-
- public final String getURL () throws URISyntaxException
- {
- return getAddr().getAddress();
- }
-
- /**
- * Set the username for this FTP EPR.
- *
- * @param username the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setUserName (String username) throws URISyntaxException
- {
- if (username == null)
- throw new IllegalArgumentException();
-
- if (userSet)
- throw new IllegalStateException("Username already set.");
-
- getAddr().addExtension(USERNAME_TAG, username);
- userSet = true;
- }
-
- /**
- * @return the user's name associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getUserName () throws URISyntaxException
- {
- return getAddr().getExtensionValue(USERNAME_TAG);
- }
-
- /**
- * Set the password for this FTP EPR.
- *
- * @param password the user's name.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setPassword (String password) throws URISyntaxException
- {
- if (password == null)
- throw new IllegalArgumentException();
-
- if (passwordSet)
- throw new IllegalStateException("Password already set.");
-
- getAddr().addExtension(PASSWORD_TAG, password);
- passwordSet = true;
- }
-
- /**
- * @return the password associated with this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getPassword () throws URISyntaxException
- {
- return getAddr().getExtensionValue(PASSWORD_TAG);
- }
-
- /**
- * Set the SQL command that is used by this EPR.
- *
- * @param sql the statement.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setSQL (String sql) throws URISyntaxException
- {
- if (sql == null)
- throw new IllegalArgumentException();
-
- if (sqlSet)
- throw new IllegalStateException("SQL already set.");
-
- getAddr().addExtension(SQL_TAG, sql);
- sqlSet = true;
- }
-
- /**
- * @return the SQL statement for this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getSQL () throws URISyntaxException
- {
- return getAddr().getExtensionValue(SQL_TAG);
- }
-
- /**
- * Set the driver that is used by this EPR.
- *
- * @param driver the driver.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final void setDriver (String driver) throws URISyntaxException
- {
- if (driver == null)
- throw new IllegalArgumentException();
-
- if (driverSet)
- throw new IllegalStateException("Driver already set.");
-
- getAddr().addExtension(DRIVER_TAG, driver);
- driverSet = true;
- }
-
- /**
- * @return the driver used by this EPR.
- * @throws URISyntaxException thrown if this EPR is malformed.
- */
-
- public final String getDriver () throws URISyntaxException
- {
- return getAddr().getExtensionValue(DRIVER_TAG);
- }
-
- private boolean userSet = false;
- private boolean passwordSet = false;
- private boolean sqlSet = false;
- private boolean driverSet = false;
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java (from rev 7195, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JDBCEpr.java 2006-10-29 16:30:17 UTC (rev 7195)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JDBCEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,235 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+/*
+ * 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;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+
+/**
+ * A helper class for using database style EPRs. Simply create instances of this
+ * class instead of the base EPR.
+ *
+ * @author marklittle
+ *
+ */
+
+public class JDBCEpr extends SpecificEpr
+{
+ public static final String JDBC_PROTOCOL = "jdbc";
+
+ public static final String USERNAME_TAG = "username";
+ public static final String PASSWORD_TAG = "password";
+ public static final String SQL_TAG = "sql";
+ public static final String DRIVER_TAG = "driver";
+
+ public JDBCEpr (EPR epr)
+ {
+ copy(epr);
+
+ addType(type());
+ }
+
+ public JDBCEpr (String url, String sql) throws URISyntaxException
+ {
+ super(new URI(url));
+
+ setSQL(sql);
+
+ addType(type());
+ }
+
+ /**
+ * Set the URL for this endpoint.
+ *
+ * @param url the address.
+ */
+
+ public final void setURL (String url)
+ {
+ super.setAddr(new PortReference(url));
+
+ addType(type());
+ }
+
+ /**
+ * Get the URL address.
+ *
+ * @return the address.
+ * @throws URISyntaxException thrown if the address is invalid.
+ */
+
+ public final String getURL () throws URISyntaxException
+ {
+ return getAddr().getAddress();
+ }
+
+ /**
+ * Set the username for this FTP EPR.
+ *
+ * @param username the user's name.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setUserName (String username) throws URISyntaxException
+ {
+ if (username == null)
+ throw new IllegalArgumentException();
+
+ if (userSet)
+ throw new IllegalStateException("Username already set.");
+
+ getAddr().addExtension(USERNAME_TAG, username);
+ userSet = true;
+ }
+
+ /**
+ * @return the user's name associated with this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getUserName () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(USERNAME_TAG);
+ }
+
+ /**
+ * Set the password for this FTP EPR.
+ *
+ * @param password the user's name.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setPassword (String password) throws URISyntaxException
+ {
+ if (password == null)
+ throw new IllegalArgumentException();
+
+ if (passwordSet)
+ throw new IllegalStateException("Password already set.");
+
+ getAddr().addExtension(PASSWORD_TAG, password);
+ passwordSet = true;
+ }
+
+ /**
+ * @return the password associated with this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getPassword () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(PASSWORD_TAG);
+ }
+
+ /**
+ * Set the SQL command that is used by this EPR.
+ *
+ * @param sql the statement.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setSQL (String sql) throws URISyntaxException
+ {
+ if (sql == null)
+ throw new IllegalArgumentException();
+
+ if (sqlSet)
+ throw new IllegalStateException("SQL already set.");
+
+ getAddr().addExtension(SQL_TAG, sql);
+ sqlSet = true;
+ }
+
+ /**
+ * @return the SQL statement for this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getSQL () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(SQL_TAG);
+ }
+
+ /**
+ * Set the driver that is used by this EPR.
+ *
+ * @param driver the driver.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final void setDriver (String driver) throws URISyntaxException
+ {
+ if (driver == null)
+ throw new IllegalArgumentException();
+
+ if (driverSet)
+ throw new IllegalStateException("Driver already set.");
+
+ getAddr().addExtension(DRIVER_TAG, driver);
+ driverSet = true;
+ }
+
+ /**
+ * @return the driver used by this EPR.
+ * @throws URISyntaxException thrown if this EPR is malformed.
+ */
+
+ public final String getDriver () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(DRIVER_TAG);
+ }
+
+ public static final URI type ()
+ {
+ return _type;
+ }
+
+ private boolean userSet = false;
+ private boolean passwordSet = false;
+ private boolean sqlSet = false;
+ private boolean driverSet = false;
+
+ private static URI _type;
+
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss:esb:epr:type:jdbc");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -1,226 +0,0 @@
-package org.jboss.soa.esb.addressing.helpers;
-
-/*
- * 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;
-
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.addressing.PortReference;
-
-/**
- * A helper class for using JMS style EPRs. Simply create and use instances of
- * this type.
- *
- * @author marklittle
- *
- */
-
-public class JMSEpr extends EPR
-{
- public static final String JMS_PROTOCOL = "jms";
- public static final String PROTOCOL_SEPARATOR = "://";
-
- public static final String ONE_ONE_PROTOCOL = "1.1";
- public static final String ONE_ZERO_TWO_PROTOCOL = "1.0.2b";
-
- public static final String SPECIFICATION_VERSION_TAG = "specification-version";
- public static final String DESTINATION_TYPE_TAG = "destination-type";
- public static final String DESTINATION_NAME_TAG = "destination-name";
- public static final String CONNECTION_FACTORY_TAG = "connection-factory";
- public static final String JNDI_TYPE_TAG = "jndi-type";
- public static final String JNDI_URL_TAG = "jndi-URL";
- public static final String MESSAGE_SELECTOR_TAG = "message-selector";
-
- public static final String QUEUE_TYPE = "queue";
- public static final String TOPIC_TYPE = "topic";
-
- public JMSEpr (EPR epr)
- {
- copy(epr);
- }
-
- /**
- * Create a new JMS EPR. The protocol version is assumed to be 1.1.
- * , jndi_type=jboss, jndi_url=localhost, messageSelector=null
- *
- * @param destinationType the type of destination (queue/topic).
- * @param destinationName name of the queue/topic.
- * @param connection reference to the connection factory.
- */
-
- public JMSEpr (String destinationType, String destinationName, String connection)
- {
- this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection
- ,"jboss", "localhost", null);
- }
-
- /**
- * Create a new JMS EPR. The protocol version is assumed to be 1.1.
- *
- * @param destinationType the type of destination (queue/topic).
- * @param destinationName name of the queue/topic.
- * @param connection reference to the connection factory.
- * @param jndiType reference to the type of jndi to obtain the JMS objects from
- * @param jndiUrl reference to the location of the jndi to obtain the JMS objects from
- * @param messageSelector reference to the connection factory.
- */
-
- public JMSEpr (String destinationType, String destinationName, String connection, String jndiType, String jndiUrl, String messageSelector)
- {
- this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,jndiType, jndiUrl, messageSelector);
- }
-
- /**
- * Create a new JMS EPR.
- *
- * @param protocol the protocol version.
- * @param destinationType the type of destination (queue/topic).
- * @param destinationName name of the queue/topic.
- * @param connection reference to the connection factory.
- * @param jndiType reference to the type of jndi to obtain the JMS objects from
- * @param jndiUrl reference to the location of the jndi to obtain the JMS objects from
- * @param messageSelector reference to the connection factory.
- */
-
- public JMSEpr (String protocol, String destinationType, String destinationName, String connection, String jndiType, String jndiUrl, String messageSelector)
- {
- // how many of these do we really need? modify accordingly.
-
- if ((protocol == null) || (destinationType == null) || (destinationName == null) || (connection == null))
- throw new IllegalArgumentException();
-
- if (protocol.equals(ONE_ONE_PROTOCOL) || (protocol.equals(ONE_ZERO_TWO_PROTOCOL)))
- {
- if (destinationType.equals(QUEUE_TYPE) || destinationType.equals(TOPIC_TYPE))
- {
- PortReference addr = new PortReference(JMS_PROTOCOL+PROTOCOL_SEPARATOR+destinationType);
-
- addr.addExtension(SPECIFICATION_VERSION_TAG, protocol);
-
- if (destinationName != null)
- addr.addExtension(DESTINATION_NAME_TAG, destinationName);
-
- if (connection != null)
- addr.addExtension(CONNECTION_FACTORY_TAG, connection);
-
- if (jndiType != null)
- addr.addExtension(JNDI_TYPE_TAG, jndiType);
-
- if (jndiUrl != null)
- addr.addExtension(JNDI_URL_TAG, jndiUrl);
-
- if (messageSelector != null)
- addr.addExtension(MESSAGE_SELECTOR_TAG, messageSelector);
-
- setAddr(addr);
- }
- else
- throw new IllegalArgumentException("Invalid destination type!");
- }
- else
- throw new IllegalArgumentException("Invalid specification version!");
- }
-
- /*
- * There are deliberately no setters for the values once the EPR is created.
- */
-
- /**
- * @return the destination type used.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getDestinationType () throws URISyntaxException
- {
- URI uri = new URI(getAddr().getAddress());
-
- return uri.getHost(); // ;-)
- }
-
- /**
- * @return the specification version used.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getVersion () throws URISyntaxException
- {
- return getAddr().getExtensionValue(SPECIFICATION_VERSION_TAG);
- }
-
- /**
- * @return the destination name used.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getDestinationName () throws URISyntaxException
- {
- return getAddr().getExtensionValue(DESTINATION_NAME_TAG);
- }
-
- /**
- * @return the connection factory for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getConnectionFactory () throws URISyntaxException
- {
- return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
- }
-
- /**
- * @return the jndi type for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getJndiType () throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_TYPE_TAG);
- }
-
- /**
- * @return the jndi URL for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getJndiURL () throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_URL_TAG);
- }
-
- /**
- * @return the message selector for this EPR, or <code>null</code> if none is set.
- * @throws URISyntaxException thrown if the address is malformed.
- */
-
- public final String getMessageSelector () throws URISyntaxException
- {
- return getAddr().getExtensionValue(MESSAGE_SELECTOR_TAG);
- }
-
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java (from rev 7195, labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java)
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/JMSEpr.java 2006-10-29 16:30:17 UTC (rev 7195)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,288 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+/*
+ * 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;
+
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.PortReference;
+
+/**
+ * A helper class for using JMS style EPRs. Simply create and use instances of
+ * this type.
+ *
+ * @author marklittle
+ *
+ */
+
+public class JMSEpr extends SpecificEpr
+{
+ public static final String JMS_PROTOCOL = "jms";
+ public static final String PROTOCOL_SEPARATOR = "://";
+ public static final String ONE_ONE_PROTOCOL = "1.1";
+ public static final String ONE_ZERO_TWO_PROTOCOL = "1.0.2b";
+ public static final String SPECIFICATION_VERSION_TAG = "specification-version";
+ public static final String DESTINATION_TYPE_TAG = "destination-type";
+ public static final String DESTINATION_NAME_TAG = "destination-name";
+ public static final String CONNECTION_FACTORY_TAG = "connection-factory";
+ public static final String JNDI_TYPE_TAG = "jndi-type";
+ public static final String JNDI_URL_TAG = "jndi-URL";
+ public static final String MESSAGE_SELECTOR_TAG = "message-selector";
+ public static final String QUEUE_TYPE = "queue";
+ public static final String TOPIC_TYPE = "topic";
+
+ public JMSEpr(EPR epr)
+ {
+ copy(epr);
+
+ addType(type());
+ }
+
+ /**
+ * Create a new JMS EPR. The protocol version is assumed to be 1.1. ,
+ * jndi_type=jboss, jndi_url=localhost, messageSelector=null
+ *
+ * @param destinationType
+ * the type of destination (queue/topic).
+ * @param destinationName
+ * name of the queue/topic.
+ * @param connection
+ * reference to the connection factory.
+ */
+
+ public JMSEpr(String destinationType, String destinationName,
+ String connection)
+ {
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
+ "jboss", "localhost", null);
+ }
+
+ /**
+ * Create a new JMS EPR. The protocol version is assumed to be 1.1.
+ *
+ * @param destinationType
+ * the type of destination (queue/topic).
+ * @param destinationName
+ * name of the queue/topic.
+ * @param connection
+ * reference to the connection factory.
+ * @param jndiType
+ * reference to the type of jndi to obtain the JMS
+ * objects from
+ * @param jndiUrl
+ * reference to the location of the jndi to obtain the
+ * JMS objects from
+ * @param messageSelector
+ * reference to the connection factory.
+ */
+
+ public JMSEpr(String destinationType, String destinationName,
+ String connection, String jndiType, String jndiUrl,
+ String messageSelector)
+ {
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
+ jndiType, jndiUrl, messageSelector);
+ }
+
+ /**
+ * Create a new JMS EPR.
+ *
+ * @param protocol
+ * the protocol version.
+ * @param destinationType
+ * the type of destination (queue/topic).
+ * @param destinationName
+ * name of the queue/topic.
+ * @param connection
+ * reference to the connection factory.
+ * @param jndiType
+ * reference to the type of jndi to obtain the JMS
+ * objects from
+ * @param jndiUrl
+ * reference to the location of the jndi to obtain the
+ * JMS objects from
+ * @param messageSelector
+ * reference to the connection factory.
+ */
+
+ public JMSEpr(String protocol, String destinationType,
+ String destinationName, String connection, String jndiType,
+ String jndiUrl, String messageSelector)
+ {
+ // how many of these do we really need? modify accordingly.
+
+ if ((protocol == null) || (destinationType == null)
+ || (destinationName == null) || (connection == null))
+ throw new IllegalArgumentException();
+
+ if (protocol.equals(ONE_ONE_PROTOCOL)
+ || (protocol.equals(ONE_ZERO_TWO_PROTOCOL)))
+ {
+ if (destinationType.equals(QUEUE_TYPE)
+ || destinationType.equals(TOPIC_TYPE))
+ {
+ PortReference addr = new PortReference(JMS_PROTOCOL
+ + PROTOCOL_SEPARATOR + destinationType);
+
+ addr.addExtension(SPECIFICATION_VERSION_TAG, protocol);
+
+ if (destinationName != null)
+ addr.addExtension(DESTINATION_NAME_TAG, destinationName);
+
+ if (connection != null)
+ addr.addExtension(CONNECTION_FACTORY_TAG, connection);
+
+ if (jndiType != null)
+ addr.addExtension(JNDI_TYPE_TAG, jndiType);
+
+ if (jndiUrl != null)
+ addr.addExtension(JNDI_URL_TAG, jndiUrl);
+
+ if (messageSelector != null)
+ addr.addExtension(MESSAGE_SELECTOR_TAG, messageSelector);
+
+ setAddr(addr);
+ }
+ else
+ throw new IllegalArgumentException("Invalid destination type!");
+ }
+ else
+ throw new IllegalArgumentException("Invalid specification version!");
+
+ addType(type());
+ }
+
+ /*
+ * There are deliberately no setters for the values once the EPR is
+ * created.
+ */
+
+ /**
+ * @return the destination type used.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getDestinationType () throws URISyntaxException
+ {
+ URI uri = new URI(getAddr().getAddress());
+
+ return uri.getHost(); // ;-)
+ }
+
+ /**
+ * @return the specification version used.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getVersion () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(SPECIFICATION_VERSION_TAG);
+ }
+
+ /**
+ * @return the destination name used.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getDestinationName () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(DESTINATION_NAME_TAG);
+ }
+
+ /**
+ * @return the connection factory for this EPR, or <code>null</code>
+ * if none is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getConnectionFactory () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
+ }
+
+ /**
+ * @return the jndi type for this EPR, or <code>null</code> if none is
+ * set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getJndiType () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_TYPE_TAG);
+ }
+
+ /**
+ * @return the jndi URL for this EPR, or <code>null</code> if none is
+ * set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getJndiURL () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_URL_TAG);
+ }
+
+ /**
+ * @return the message selector for this EPR, or <code>null</code> if
+ * none is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
+
+ public final String getMessageSelector () throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(MESSAGE_SELECTOR_TAG);
+ }
+
+ public static final URI type ()
+ {
+ return _type;
+ }
+
+ private static URI _type;
+
+ static
+ {
+ try
+ {
+ _type = new URI("urn:jboss:esb:epr:type:jms");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+ }
+
+}
\ No newline at end of file
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/SpecificEpr.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/helpers/SpecificEpr.java 2006-10-27 03:12:26 UTC (rev 7170)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/SpecificEpr.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,69 @@
+package org.jboss.soa.esb.addressing.eprs;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.soa.esb.addressing.EPR;
+
+/*
+ * 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
+ */
+
+/**
+ * Some common attribute names for specific eprs.
+ *
+ * @author marklittle
+ *
+ */
+
+public class SpecificEpr extends EPR
+{
+ public static final String EPR_TYPE = "epr-type";
+
+ protected SpecificEpr (EPR epr)
+ {
+ copy(epr);
+ }
+
+ protected SpecificEpr (URI uri)
+ {
+ super(uri);
+ }
+
+ protected SpecificEpr ()
+ {
+ super();
+ }
+
+ protected void addType (URI type)
+ {
+ try
+ {
+ // only add if not already set.
+
+ if (getAddr().getExtensionValue(EPR_TYPE) == null)
+ getAddr().addExtension(EPR_TYPE, type.toString());
+ }
+ catch (URISyntaxException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/util/EPRManager.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -31,7 +31,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.internal.soa.esb.addressing.EPRHelper;
+import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
import org.jboss.soa.esb.addressing.EPR;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/EmailUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/EmailUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/EmailUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.EmailEpr;
+import org.jboss.soa.esb.addressing.eprs.EmailEpr;
/**
* Unit tests for the EPR class.
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/FTPUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.FTPEpr;
+import org.jboss.soa.esb.addressing.eprs.FTPEpr;
/**
* Unit tests for the EPR class.
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/HTTPUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.HTTPEpr;
+import org.jboss.soa.esb.addressing.eprs.HTTPEpr;
/**
* Unit tests for the EPR class.
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JDBCUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JDBCUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JDBCUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.JDBCEpr;
+import org.jboss.soa.esb.addressing.eprs.JDBCEpr;
/**
* Unit tests for the EPR class.
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/helpers/tests/JMSUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -24,7 +24,7 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.JMSEpr;
+import org.jboss.soa.esb.addressing.eprs.JMSEpr;
/**
* Unit tests for the EPR class.
Added: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRHelperUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jboss.soa.esb.addressing.util.tests;
+
+import junit.framework.TestCase;
+
+import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.EmailEpr;
+import org.jboss.soa.esb.addressing.util.EPRManager;
+
+/**
+ * Unit tests for the Class class.
+ *
+ * @author Mark Little
+ */
+
+public class EPRHelperUnitTest extends TestCase
+{
+
+ public void testToFromXMLString ()
+ {
+ EmailEpr email = new EmailEpr(EmailEpr.SMTP_PROTOCOL, "foobar", "25", "me", "letmein");
+
+ String xmlString = EPRHelper.toXMLString(email);
+
+ System.err.println(xmlString);
+
+ EPR epr = EPRHelper.fromXMLString(xmlString);
+
+ if (epr instanceof EmailEpr)
+ {
+
+ }
+ else
+ fail();
+ }
+
+}
Modified: labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java 2006-10-29 17:17:45 UTC (rev 7198)
+++ labs/jbossesb/trunk/product/core/rosetta/tests/src/org/jboss/soa/esb/addressing/util/tests/EPRManagerUnitTest.java 2006-10-29 17:21:48 UTC (rev 7199)
@@ -24,7 +24,8 @@
import junit.framework.TestCase;
-import org.jboss.soa.esb.addressing.helpers.EmailEpr;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.addressing.eprs.EmailEpr;
import org.jboss.soa.esb.addressing.util.EPRManager;
/**
@@ -74,4 +75,36 @@
}
}
+ public void testSpecificInputOutput ()
+ {
+ EmailEpr email = new EmailEpr(EmailEpr.SMTP_PROTOCOL, "foobar", "25", "me", "letmein");
+
+ String tmpDir = "/tmp";
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.indexOf("windows")>=0) {
+ tmpDir="/Temp";
+ }
+ EPRManager manager = EPRManager.getInstance(tmpDir);
+
+ try
+ {
+ manager.saveEPR("MyEmail", email);
+
+ EPR epr = manager.loadEPR("MyEmail");
+
+ if (epr instanceof EmailEpr)
+ {
+
+ }
+ else
+ fail();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+
+ fail(ex.toString());
+ }
+ }
+
}
More information about the jboss-svn-commits
mailing list