[jboss-svn-commits] JBL Code SVN: r24029 - in labs/jbossesb/workspace/skeagh: runtime/src/main/java/org/jboss/esb/federate/bus and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Nov 21 06:24:34 EST 2008
Author: tfennelly
Date: 2008-11-21 06:24:33 -0500 (Fri, 21 Nov 2008)
New Revision: 24029
Added:
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/package.html
Modified:
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2182
Added: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java 2008-11-21 11:24:33 UTC (rev 24029)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.api.bus;
+
+import java.util.Properties;
+
+/**
+ * Abstract Bus.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class AbstractBus implements Bus
+{
+ /**
+ * Bus Properties.
+ */
+ private Properties properties;
+ /**
+ * Deployment name.
+ */
+ private String deploymentName;
+ /**
+ * The deployment ID.
+ */
+ private String deploymentId;
+ /**
+ * Notification callback.
+ */
+ private BusNotificationListener notificationListener;
+ /**
+ * Bus message callback.
+ */
+ private BusMessageListener messageListener;
+
+ /**
+ * Get the deploymentName for the local deployment.
+ *
+ * @return The deployment Name.
+ */
+ public final String getDeploymentName()
+ {
+ return deploymentName;
+ }
+
+ /**
+ * Set the deploymentName for the local deployment.
+ *
+ * @param deploymentName The deployment Name.
+ */
+ public final void setDeploymentName(final String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
+ /**
+ * Get the deploymentId for the local deployment.
+ *
+ * @return The deployment ID.
+ */
+ public final String getDeploymentId()
+ {
+ return deploymentId;
+ }
+
+ /**
+ * Set the deploymentId for the local deployment.
+ *
+ * @param deploymentId The deployment ID.
+ */
+ public final void setDeploymentId(final String deploymentId)
+ {
+ this.deploymentId = deploymentId;
+ }
+
+ /**
+ * Get the Bus properties.
+ *
+ * @return The Bus properties.
+ */
+ public final Properties getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ * Set the Bus properties.
+ *
+ * @param properties The Bus properties.
+ */
+ public final void setProperties(final Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ * Get the bus message listener.
+ *
+ * @return Message listener.
+ */
+ public final BusMessageListener getMessageListener()
+ {
+ return messageListener;
+ }
+
+ /**
+ * Set the bus message listener.
+ *
+ * @param listener Message listener.
+ */
+ public final void setMessageListener(final BusMessageListener listener)
+ {
+ this.messageListener = listener;
+ }
+
+ /**
+ * Get the bus notification listener.
+ *
+ * @return Notification listener.
+ */
+ public final BusNotificationListener getNotificationListener()
+ {
+ return notificationListener;
+ }
+
+ /**
+ * Set the bus notification listener.
+ *
+ * @param listener Notification listener.
+ */
+ public final void setNotificationListener(final BusNotificationListener listener)
+ {
+ this.notificationListener = listener;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java 2008-11-21 10:45:38 UTC (rev 24028)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java 2008-11-21 11:24:33 UTC (rev 24029)
@@ -55,7 +55,7 @@
void setProperties(Properties properties);
/**
- * Connect the bus.
+ * Connect to the bus.
*
* @throws RoutingException Connection exception.
*/
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java 2008-11-21 10:45:38 UTC (rev 24028)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java 2008-11-21 11:24:33 UTC (rev 24029)
@@ -32,7 +32,7 @@
* ESB Bus Message.
* <p/>
* This class encapsulates the ESB {@link org.jboss.esb.api.message.Message} for transportation
- * on a Bus.
+ * on a Bus. This class is only of interest to {@link Bus} implementers.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java 2008-11-21 11:24:33 UTC (rev 24029)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus.invm;
+
+import org.jboss.esb.api.bus.AbstractNotification;
+import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.api.bus.AbstractBus;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class InVMBus extends AbstractBus
+{
+
+ /**
+ * Connect to the bus.
+ *
+ * @throws RoutingException Connection exception.
+ */
+ public void connect() throws RoutingException
+ {
+ }
+
+ /**
+ * Is the bus connected.
+ *
+ * @return True if the bus is connected, otherwise false.
+ */
+ public boolean isConnected()
+ {
+ return true;
+ }
+
+ /**
+ * Stop listening for ESB messages on the bus.
+ */
+ public void stopListening()
+ {
+ }
+
+ /**
+ * Close the Bus.
+ */
+ public void close()
+ {
+ }
+
+ /**
+ * Send the supplied message to the specified deployment via the bus.
+ *
+ * @param message The message.
+ * @param targetDeploymentId The target deployment ID.
+ * @throws RoutingException Error sending message onto the Bus.
+ */
+ public void sendMessage(BusMessage message, String targetDeploymentId) throws RoutingException
+ {
+ }
+
+ /**
+ * Send a notification message onto the Bus.
+ *
+ * @param notification The notification message to be sent onto the Bus.
+ * @throws RoutingException Error sending notification onto the Bus.
+ */
+ public void sendNotification(AbstractNotification notification) throws RoutingException
+ {
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/package.html (from rev 24027, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/package.html 2008-11-21 11:24:33 UTC (rev 24029)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+InVM Bus.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-11-21 10:45:38 UTC (rev 24028)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-11-21 11:24:33 UTC (rev 24029)
@@ -20,16 +20,14 @@
package org.jboss.esb.federate.bus.jms;
import org.apache.log4j.Logger;
+import org.jboss.esb.api.bus.AbstractNotification;
+import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.context.DeploymentContext;
import org.jboss.esb.api.context.ResourceLocator;
import org.jboss.esb.api.routing.RoutingException;
-import org.jboss.esb.api.bus.BusMessageListener;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.api.bus.Bus;
-import org.jboss.esb.api.bus.BusMessage;
-import org.jboss.esb.api.bus.AbstractNotification;
-import org.jboss.esb.api.bus.BusNotificationListener;
+import org.jboss.esb.api.bus.AbstractBus;
import org.jboss.esb.jms.AbstractMessageHandler;
import org.jboss.esb.jms.AbstractMessageListener;
import org.jboss.esb.jms.JMSSession;
@@ -46,7 +44,7 @@
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public class JMSBus implements Bus
+public class JMSBus extends AbstractBus
{
/**
* Logger.
@@ -73,18 +71,6 @@
*/
public static final String DEPLOYMENT_ID = "jbossesb_deployment_id";
/**
- * Bus Properties.
- */
- private Properties properties;
- /**
- * Deployment name.
- */
- private String deploymentName;
- /**
- * The deployment ID.
- */
- private String deploymentId;
- /**
* Shared JMS Topic Session.
*/
private JMSSession topicSession;
@@ -101,14 +87,6 @@
*/
private JMSQueueMessageListener messageListener;
/**
- * Notification callback.
- */
- private BusNotificationListener notificationCallback;
- /**
- * Bus message callback.
- */
- private BusMessageListener messageCallback;
- /**
* Deployment notification broadcaster.
*/
private MessageSender notificationSender;
@@ -118,51 +96,21 @@
private MessageSender messageSender;
/**
- * Set the deploymentName for the local deployment.
- *
- * @param deploymentName The deployment Name.
- */
- public final void setDeploymentName(final String deploymentName)
- {
- this.deploymentName = deploymentName;
- }
-
- /**
- * Set the deploymentId for the local deployment.
- *
- * @param deploymentId The deployment ID.
- */
- public final void setDeploymentId(final String deploymentId)
- {
- this.deploymentId = deploymentId;
- }
-
- /**
- * Set the Bus properties.
- *
- * @param properties The Bus properties.
- */
- public final void setProperties(final Properties properties)
- {
- this.properties = properties;
- }
-
- /**
* Connect the bus.
*
* @throws RoutingException Connection exception.
*/
public final void connect() throws RoutingException
{
- if (deploymentName == null)
+ if (getDeploymentName() == null)
{
throw new IllegalStateException("'deploymentName' not set on Bus.");
}
- else if (deploymentId == null)
+ else if (getDeploymentId() == null)
{
throw new IllegalStateException("'deploymentId' not set on Bus.");
}
- else if (properties == null)
+ else if (getProperties() == null)
{
throw new IllegalStateException("'properties' not set on Bus.");
}
@@ -179,21 +127,21 @@
{
try
{
- connectJMSSessions(properties);
+ connectJMSSessions(getProperties());
}
catch (DeploymentException e)
{
- throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + deploymentName + "'.", e);
+ throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + getDeploymentName() + "'.", e);
}
if (topicSession != null && queueSession != null)
{
try
{
- connectCoordinationListener(properties);
- connectCoordintationSender(properties);
- connectBusListener(properties);
- connectBusSender(properties);
+ connectCoordinationListener(getProperties());
+ connectCoordintationSender(getProperties());
+ connectBusListener(getProperties());
+ connectBusSender(getProperties());
}
catch (DeploymentException e)
{
@@ -203,16 +151,16 @@
{
if (!logger.isDebugEnabled())
{
- logger.info("Deployment '" + deploymentName + "' is not being coordinated with any other deployment. Turn on deug logging for more details.");
+ logger.info("Deployment '" + getDeploymentName() + "' is not being coordinated with any other deployment. Turn on deug logging for more details.");
}
else
{
- logger.debug("Deployment '" + deploymentName + "' is not being coordinated with any other deployment.", e);
+ logger.debug("Deployment '" + getDeploymentName() + "' is not being coordinated with any other deployment.", e);
}
}
else
{
- throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + deploymentName + "'.", e);
+ throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + getDeploymentName() + "'.", e);
}
}
finally
@@ -223,7 +171,7 @@
catch (Throwable t)
{
closeJMSSessions();
- throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + deploymentName + "'.", t);
+ throw new RoutingException("Unable to connect JMS Bus interface for deployment '" + getDeploymentName() + "'.", t);
}
}
}
@@ -234,6 +182,16 @@
}
/**
+ * Is the bus connected.
+ *
+ * @return True if the bus is connected, otherwise false.
+ */
+ public final boolean isConnected()
+ {
+ return (topicSession != null && queueSession != null);
+ }
+
+ /**
* Close the Bus.
*/
public final void close()
@@ -274,26 +232,6 @@
}
/**
- * Set the
- *
- * @param listener The message dispatcher.
- */
- public final void setMessageListener(final BusMessageListener listener)
- {
- this.messageCallback = listener;
- }
-
- /**
- * Set the bus notification listener.
- *
- * @param listener Notification listener.
- */
- public final void setNotificationListener(final BusNotificationListener listener)
- {
- this.notificationCallback = listener;
- }
-
- /**
* Send a notification message onto the Bus.
* <p/>
* This allows notification messages to be exchanged with other deployments
@@ -318,16 +256,6 @@
}
/**
- * Is the bus connected.
- *
- * @return True if the bus is connected, otherwise false.
- */
- public final boolean isConnected()
- {
- return (topicSession != null && queueSession != null);
- }
-
- /**
* Stop listening for ESB messages on the bus.
*/
public final void stopListening()
@@ -355,7 +283,7 @@
catch (JMSException e)
{
notificationListener = null;
- throw new DeploymentException("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ throw new DeploymentException("Deployment '" + getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
+ "JNDI properties used: " + busProperties, e);
}
@@ -380,7 +308,7 @@
catch (JMSException e)
{
notificationSender = null;
- throw new DeploymentException("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ throw new DeploymentException("Deployment '" + getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ "to connect to the deployment coordination Topic '" + coordinationTopicName + "'. The JMS Server must be running and this Topic must be deployed. "
+ "JNDI properties used: " + busProperties, e);
}
@@ -405,7 +333,7 @@
catch (JMSException e)
{
messageListener = null;
- throw new DeploymentException("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ throw new DeploymentException("Deployment '" + getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ "to connect to the JMS Bus Queue '" + busQueueName + "'. The JMS Server must be running and this Queue must be deployed. "
+ "JNDI properties used: " + busProperties, e);
}
@@ -430,7 +358,7 @@
catch (JMSException e)
{
messageSender = null;
- throw new DeploymentException("Deployment '" + deploymentName + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ throw new DeploymentException("Deployment '" + getDeploymentName() + "' is not being coordinated with any other local deployment. A JMSException occured while trying "
+ "to connect to the JMS Bus Queue '" + busQueueName + "'. The JMS Server must be running and this Queue must be deployed. "
+ "JNDI properties used: " + busProperties, e);
}
@@ -536,11 +464,11 @@
AbstractNotification notification = (AbstractNotification) objectMessage;
try
{
- notificationCallback.onNotification(notification);
+ getNotificationListener().onNotification(notification);
}
catch (RoutingException e)
{
- logger.error("Deployment '" + deploymentId + "' failed to accept notification '" + notification.getClass().getName() + "' from '" + notification.getDeploymentId() + "'.", e);
+ logger.error("Deployment '" + getDeploymentId() + "' failed to accept notification '" + notification.getClass().getName() + "' from '" + notification.getDeploymentId() + "'.", e);
}
}
}
@@ -567,7 +495,7 @@
*/
protected JMSQueueMessageListener(final String destinationName, final Properties jndiProperties)
{
- super(destinationName, queueSession, addDeploymentSelector(jndiProperties, deploymentId));
+ super(destinationName, queueSession, addDeploymentSelector(jndiProperties, getDeploymentId()));
}
/**
@@ -587,7 +515,7 @@
{
try
{
- messageCallback.onMessage((BusMessage) objectMessage);
+ getMessageListener().onMessage((BusMessage) objectMessage);
}
catch (RoutingException e)
{
@@ -635,7 +563,7 @@
}
catch (Throwable t)
{
- logger.warn("Error closing " + name + " for deployment '" + deploymentName + "'.", t);
+ logger.warn("Error closing " + name + " for deployment '" + getDeploymentName() + "'.", t);
}
}
}
More information about the jboss-svn-commits
mailing list