[jboss-svn-commits] JBL Code SVN: r8380 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 18 06:51:12 EST 2006
Author: mark.little at jboss.com
Date: 2006-12-18 06:51:10 -0500 (Mon, 18 Dec 2006)
New Revision: 8380
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java
Log:
tidy-up.
Modified: 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/JMSEpr.java 2006-12-18 11:21:12 UTC (rev 8379)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/addressing/eprs/JMSEpr.java 2006-12-18 11:51:10 UTC (rev 8380)
@@ -42,259 +42,270 @@
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_PKG_PREFIX_TAG = "jndi-pkg-prefix";
- public static final String JNDI_URL_TAG = "jndi-URL";
- public static final String JNDI_CONTEXT_FACTORY = "jndi-context-factory";
- 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);
- }
+ public static final String JMS_PROTOCOL = "jms";
- /**
- * 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 static final String PROTOCOL_SEPARATOR = "://";
- public JMSEpr(String destinationType, String destinationName,
- String connection)
- {
- this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
- NamingContext.JBOSS_PROVIDER_URL, NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY,null, null);
- }
+ public static final String ONE_ONE_PROTOCOL = "1.1";
- /**
- * 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 static final String ONE_ZERO_TWO_PROTOCOL = "1.0.2b";
- public JMSEpr(String destinationType, String destinationName,
- String connection, String jndiUrl, String jndiContextFactory, String jndiPkgPrefix,
- String messageSelector)
- {
- this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
- jndiUrl, jndiContextFactory, jndiPkgPrefix, messageSelector);
- }
+ public static final String SPECIFICATION_VERSION_TAG = "specification-version";
- /**
- * 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 static final String DESTINATION_TYPE_TAG = "destination-type";
- public JMSEpr(String protocol, String destinationType,
- String destinationName, String connection,
- String jndiUrl, String jndiContextFactory, String jndiPkgPrefix, String messageSelector)
- {
- // how many of these do we really need? modify accordingly.
+ public static final String DESTINATION_NAME_TAG = "destination-name";
- if ((protocol == null) || (destinationType == null)
- || (destinationName == null) || (connection == null))
- throw new IllegalArgumentException();
+ public static final String CONNECTION_FACTORY_TAG = "connection-factory";
- if (protocol.equals(ONE_ONE_PROTOCOL)
- || (protocol.equals(ONE_ZERO_TWO_PROTOCOL)))
+ public static final String JNDI_PKG_PREFIX_TAG = "jndi-pkg-prefix";
+
+ public static final String JNDI_URL_TAG = "jndi-URL";
+
+ public static final String JNDI_CONTEXT_FACTORY = "jndi-context-factory";
+
+ 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)
{
- if (destinationType.equals(QUEUE_TYPE)
- || destinationType.equals(TOPIC_TYPE))
- {
- PortReference addr = new PortReference(JMS_PROTOCOL
- + PROTOCOL_SEPARATOR + destinationType);
+ copy(epr);
+ }
- addr.addExtension(SPECIFICATION_VERSION_TAG, protocol);
+ /**
+ * 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.
+ */
- if (destinationName != null)
- addr.addExtension(DESTINATION_NAME_TAG, destinationName);
+ public JMSEpr(String destinationType, String destinationName,
+ String connection)
+ {
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
+ NamingContext.JBOSS_PROVIDER_URL,
+ NamingContext.JBOSS_INITIAL_CONTEXT_FACTORY, null, null);
+ }
- if (connection != null)
- addr.addExtension(CONNECTION_FACTORY_TAG, connection);
+ /**
+ * 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.
+ */
- if (jndiContextFactory != null)
- addr.addExtension(JNDI_CONTEXT_FACTORY, jndiContextFactory);
-
- if (jndiPkgPrefix != null)
- addr.addExtension(JNDI_PKG_PREFIX_TAG, jndiPkgPrefix);
+ public JMSEpr(String destinationType, String destinationName,
+ String connection, String jndiUrl, String jndiContextFactory,
+ String jndiPkgPrefix, String messageSelector)
+ {
+ this(ONE_ONE_PROTOCOL, destinationType, destinationName, connection,
+ jndiUrl, jndiContextFactory, jndiPkgPrefix, messageSelector);
+ }
- if (jndiUrl != null)
- addr.addExtension(JNDI_URL_TAG, jndiUrl);
+ /**
+ * 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.
+ */
- if (messageSelector != null)
- addr.addExtension(MESSAGE_SELECTOR_TAG, messageSelector);
+ public JMSEpr(String protocol, String destinationType,
+ String destinationName, String connection, String jndiUrl,
+ String jndiContextFactory, String jndiPkgPrefix,
+ String messageSelector)
+ {
+ // how many of these do we really need? modify accordingly.
- setAddr(addr);
- }
- else
- throw new IllegalArgumentException("Invalid destination type!");
+ 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 (jndiContextFactory != null)
+ addr.addExtension(JNDI_CONTEXT_FACTORY, jndiContextFactory);
+
+ if (jndiPkgPrefix != null)
+ addr.addExtension(JNDI_PKG_PREFIX_TAG, jndiPkgPrefix);
+
+ 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!");
}
- else
- throw new IllegalArgumentException("Invalid specification version!");
- }
- /*
- * There are deliberately no setters for the values once the EPR is
- * created.
- */
+ /*
+ * 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.
- */
+ /**
+ * @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());
+ public final String getDestinationType() throws URISyntaxException
+ {
+ URI uri = new URI(getAddr().getAddress());
- return uri.getHost(); // ;-)
- }
+ return uri.getHost(); // ;-)
+ }
- /**
- * @return the specification version used.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
+ /**
+ * @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);
- }
+ 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.
- */
+ /**
+ * @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);
- }
+ 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.
- */
+ /**
+ * @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);
- }
+ public final String getConnectionFactory() throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(CONNECTION_FACTORY_TAG);
+ }
- /**
- * @return the jndi context factory for this EPR, or <code>null</code> if none is
- * set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
+ /**
+ * @return the jndi context factory for this EPR, or <code>null</code> if
+ * none is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
- public final String getJndiContextFactory () throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_CONTEXT_FACTORY);
- }
-
- /**
- * @return the jndi pkg prefix for this EPR, or <code>null</code> if none is
- * set.
- * @throws URISyntaxException
- * thrown if the address is malformed.
- */
+ public final String getJndiContextFactory() throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_CONTEXT_FACTORY);
+ }
- public final String getJndiPkgPrefix () throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_PKG_PREFIX_TAG);
- }
+ /**
+ * @return the jndi pkg prefix for this EPR, or <code>null</code> if none
+ * is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
- /**
- * @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 getJndiPkgPrefix() throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_PKG_PREFIX_TAG);
+ }
- public final String getJndiURL () throws URISyntaxException
- {
- return getAddr().getExtensionValue(JNDI_URL_TAG);
- }
+ /**
+ * @return the jndi URL for this EPR, or <code>null</code> if none is set.
+ * @throws URISyntaxException
+ * thrown if the address is malformed.
+ */
- /**
- * @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 getJndiURL() throws URISyntaxException
+ {
+ return getAddr().getExtensionValue(JNDI_URL_TAG);
+ }
- public final String getMessageSelector () throws URISyntaxException
- {
- return getAddr().getExtensionValue(MESSAGE_SELECTOR_TAG);
- }
-
- public static final URI type ()
- {
- return _type;
- }
-
- private static URI _type;
-
- static
+ /**
+ * @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
{
- try
+ 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");
+ _type = new URI("urn:jboss:esb:epr:type:jms");
}
catch (Exception ex)
{
- ex.printStackTrace();
-
- throw new ExceptionInInitializerError(ex.toString());
+ ex.printStackTrace();
+
+ throw new ExceptionInInitializerError(ex.toString());
}
}
More information about the jboss-svn-commits
mailing list