[jboss-svn-commits] JBL Code SVN: r22458 - in labs/jbossesb/workspace/skeagh: commons/src/main/java/org/jboss/esb and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Sep 5 16:44:18 EDT 2008
Author: tfennelly
Date: 2008-09-05 16:44:17 -0400 (Fri, 05 Sep 2008)
New Revision: 22458
Added:
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/package.html
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/
Modified:
labs/jbossesb/workspace/skeagh/commons/pom.xml
labs/jbossesb/workspace/skeagh/routing/pom.xml
labs/jbossesb/workspace/skeagh/runtime/pom.xml
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java
Log:
moved the JMS stuff into commons
Modified: labs/jbossesb/workspace/skeagh/commons/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/pom.xml 2008-09-05 19:51:24 UTC (rev 22457)
+++ labs/jbossesb/workspace/skeagh/commons/pom.xml 2008-09-05 20:44:17 UTC (rev 22458)
@@ -13,4 +13,29 @@
<version>${jboss.esb.version}</version>
<url>http://www.jboss.org/jbossesb/</url>
+ <dependencies>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <version>4.2.0.GA</version>
+ </dependency>
+
+ <!-- Test Dependencies - can we embed JBM without the JBoss MC -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>4.1.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
</project>
\ No newline at end of file
Copied: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java (from rev 22457, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,348 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.jms;
+
+import org.apache.log4j.Logger;
+
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Properties;
+
+/**
+ * Abstract Message Handler.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class AbstractMessageHandler
+{
+ /**
+ * Logger.
+ */
+ private Logger logger;
+ /**
+ * JMS destination name.
+ */
+ private String destinationName;
+ /**
+ * JNDI Properties.
+ */
+ private Properties jndiProperties;
+ /**
+ * JMS Connection.
+ */
+ private Connection conn = null;
+ /**
+ * JMS Session.
+ */
+ private Session session = null;
+ /**
+ * JMS Destination.
+ */
+ private Destination destination = null;
+
+ public AbstractMessageHandler(final Properties jndiProperties, final String destinationName)
+ {
+ logger = Logger.getLogger(getClass());
+ this.jndiProperties = jndiProperties;
+ this.destinationName = destinationName;
+ }
+
+ /**
+ * Get the JMS Destination name.
+ *
+ * @return The JMS Destination name.
+ */
+ public final String getDestinationName()
+ {
+ return destinationName;
+ }
+
+ /**
+ * Get the JMS Session.
+ *
+ * @return The JMS Session.
+ */
+ public final Session getSession()
+ {
+ return session;
+ }
+
+ /**
+ * Get the JMS Destination.
+ *
+ * @return The JMS Destination.
+ */
+ public final Destination getDestination()
+ {
+ return destination;
+ }
+
+ /**
+ * Connect to the configured destination.
+ *
+ * @throws JMSException Failed to connect.
+ */
+ protected void connect() throws JMSException
+ {
+ ConnectionFactory connectionFactory;
+
+ // Get the Destination ConnectionFactory...
+ try
+ {
+ connectionFactory = getJmsConnectionFactory();
+ } catch (ClassCastException e)
+ {
+ throw (JMSException) (new JMSException("Invalid JMS ConnectionFactory config. ConnectionFactory doesn't implement " + TopicConnectionFactory.class.getName() + ".").initCause(e));
+ }
+
+ // Create the destination connection...
+ if (connectionFactory instanceof TopicConnectionFactory)
+ {
+ conn = ((TopicConnectionFactory) connectionFactory).createTopicConnection();
+ } else
+ {
+ conn = ((QueueConnectionFactory) connectionFactory).createQueueConnection();
+ }
+
+ // Lookup the destination...
+ try
+ {
+ Context context = getNamingContext();
+ try
+ {
+ destination = (Destination) context.lookup(destinationName);
+ } finally
+ {
+ context.close();
+ }
+ } catch (NamingException e)
+ {
+ throw (JMSException) (new JMSException("Destination lookup failed. Destination name '" + destinationName + "'.").initCause(e));
+ }
+
+ // Create the Destination Session...
+ if (conn instanceof TopicConnection)
+ {
+ session = ((TopicConnection) conn).createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
+ } else
+ {
+ session = ((QueueConnection) conn).createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ }
+
+ // Start the connection...
+ conn.start();
+
+ // Listen for exceptions on the connection...
+ if (this instanceof ExceptionListener)
+ {
+ conn.setExceptionListener((ExceptionListener) this);
+ } else
+ {
+ conn.setExceptionListener(new DefaultExceptionListener());
+ }
+ }
+
+ /**
+ * Get the JMS Connection factory.
+ *
+ * @return Connection Factory.
+ * @throws JMSException Error getting factory.
+ */
+ private ConnectionFactory getJmsConnectionFactory() throws JMSException
+ {
+ ConnectionFactory factory = null;
+ Context context;
+ String connectionFactoryRuntime = jndiProperties.getProperty(ConnectionFactory.class.getName(), "ConnectionFactory");
+
+ context = getNamingContext();
+ try
+ {
+ factory = (ConnectionFactory) context.lookup(connectionFactoryRuntime);
+ } catch (NamingException e)
+ {
+ throw (JMSException) (new JMSException("JNDI lookup of JMS Connection Factory [" + connectionFactoryRuntime + "] failed.").initCause(e));
+ } catch (ClassCastException e)
+ {
+ throw (JMSException) (new JMSException("JNDI lookup of JMS Connection Factory failed. Class [" + connectionFactoryRuntime + "] is not an instance of [" + ConnectionFactory.class.getName() + "].").initCause(e));
+ } finally
+ {
+ if (context != null)
+ {
+ try
+ {
+ context.close();
+ } catch (NamingException ne)
+ {
+ logger.error("Failed to close Naming Context.", ne);
+ }
+ }
+ }
+
+ return factory;
+ }
+
+ /**
+ * Get the JNDI Context.
+ *
+ * @return The context.
+ * @throws JMSException Error getting context.
+ */
+ private Context getNamingContext() throws JMSException
+ {
+ Context context;
+
+ try
+ {
+ context = new InitialContext(jndiProperties);
+ } catch (NamingException e)
+ {
+ throw new JMSException("Failed to load InitialContext: " + jndiProperties);
+ }
+ if (context == null)
+ {
+ throw new JMSException("Failed to create JMS Server JNDI context. Check that '" + Context.PROVIDER_URL + "', '" + Context.INITIAL_CONTEXT_FACTORY + "', '" + Context.URL_PKG_PREFIXES + "' are correctly configured in the supplied JNDI properties.");
+ }
+
+ return context;
+ }
+
+ /**
+ * Close out the handler and all it's resources.
+ */
+ public void close()
+ {
+ try
+ {
+ if (conn != null)
+ {
+ conn.stop();
+ logger.debug("Stopping JMS Connection for connected handler '" + getClass().getName() + "' on JMS destination '" + destinationName + "'.");
+ }
+ } catch (Throwable e)
+ {
+ logger.error("Failed to stop JMS connection.", e);
+ conn = null;
+ }
+ try
+ {
+ if (session != null)
+ {
+ session.close();
+ logger.debug("Closing JMS Session for connected handler '" + getClass().getName() + "' on JMS destination '" + destinationName + "'.");
+ }
+ } catch (Throwable e)
+ {
+ logger.error("Failed to close JMS session.", e);
+ } finally
+ {
+ session = null;
+ }
+ try
+ {
+ if (conn != null)
+ {
+ conn.close();
+ logger.debug("Closing JMS Connection for connected handler '" + getClass().getName() + "' on JMS destination '" + destinationName + "'.");
+ }
+ } catch (Throwable e)
+ {
+ logger.error("Failed to close JMS connection.", e);
+ } finally
+ {
+ conn = null;
+ }
+ destination = null;
+ logger.debug("JMS handler '" + getClass().getName() + "' on JMS destination '" + destinationName + "' is now closed.");
+ }
+
+ /**
+ * The Default JMS Exception Listener.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ private class DefaultExceptionListener implements ExceptionListener
+ {
+
+ /**
+ * We want this handler to handle only one exception.
+ * It will close all existing resources and create a new instance
+ * once it successfully reconnects.
+ */
+ private boolean hasHandledOneException = false;
+
+ /**
+ * JMS Exception handler.
+ *
+ * @param e The exception.
+ */
+ public final void onException(final JMSException e)
+ {
+ synchronized (AbstractMessageHandler.DefaultExceptionListener.class)
+ {
+ if (!hasHandledOneException)
+ {
+ if (!logger.isDebugEnabled())
+ {
+ logger.warn("JMS Exception on '" + getClass().getName() + "' on JMS destination '" + destinationName + "' is now closed (turn on debugging for more): " + e.getMessage());
+ } else
+ {
+ logger.warn("JMS Exception on '" + getClass().getName() + "' on JMS destination '" + destinationName + "' is now closed.", e);
+ }
+ close();
+ while (!isConnected())
+ {
+ try
+ {
+ connect();
+ } catch (JMSException e1)
+ {
+ // Keep trying...
+ continue;
+ }
+
+ // We've reconnected...
+ try
+ {
+ Thread.sleep(5000);
+ } catch (InterruptedException e1)
+ {
+ if (!logger.isDebugEnabled())
+ {
+ logger.warn("Interrupted during reconnect attempt. Aborting reconnect! Will need restart to reconnect (turn on debugging for more): " + e.getMessage());
+ } else
+ {
+ logger.debug("Interrupted during reconnect attempt. Aborting reconnect! Will need restart to reconnect.", e);
+ }
+ }
+ }
+ hasHandledOneException = true;
+ }
+ }
+ }
+ }
+
+ /**
+ * Is the handler connected.
+ * @return True if the connector is connected, otherwise false.
+ */
+ public abstract boolean isConnected();
+}
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java (from rev 22457, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.jms;
+
+import org.apache.log4j.Logger;
+
+import javax.jms.*;
+import java.util.Properties;
+
+/**
+ * Abstract JMS Listener.
+ * <p/>
+ * Manages destination connection, close and cleanup.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class AbstractMessageListener extends AbstractMessageHandler implements MessageListener
+{
+ /**
+ * Logger.
+ */
+ private Logger logger;
+ /**
+ * JMS Listener.
+ */
+ private MessageConsumer messageConsumer;
+
+ /**
+ * Public constructor.
+ * <p/>
+ * Connects the listener to the destination.
+ *
+ * @param destinationName The destination name.
+ * @param jndiProperties The JNDI properties.
+ */
+ protected AbstractMessageListener(final String destinationName, final Properties jndiProperties)
+ {
+ super(jndiProperties, destinationName);
+ logger = Logger.getLogger(getClass());
+ }
+
+ /**
+ * Connect to the configured destination.
+ *
+ * @throws JMSException Failed to connect.
+ */
+ public final void connect() throws JMSException
+ {
+ try
+ {
+ logger.debug("Attempting to connect listener '" + getClass().getName() + "' to JMS Destination '" + getDestinationName() + "'.");
+
+ // Call super first to connect etc...
+ super.connect();
+
+ // Bind "this" listener to the destination...
+ if (getSession() instanceof TopicSession)
+ {
+ messageConsumer = ((TopicSession) getSession()).createSubscriber((Topic) getDestination());
+ messageConsumer.setMessageListener(this);
+ } else
+ {
+ messageConsumer = ((QueueSession) getSession()).createReceiver((Queue) getDestination());
+ messageConsumer.setMessageListener(this);
+ }
+
+ logger.debug("Successfully connected listener '" + getClass().getName() + "' to JMS destination '" + getDestinationName() + "'.");
+ } finally
+ {
+ // If we failed to create the message listener, close and clean up....
+ if (messageConsumer == null)
+ {
+ close();
+ }
+ }
+ }
+
+ /**
+ * Close out the listener and all it's resources.
+ */
+ public void close()
+ {
+ try
+ {
+ try
+ {
+ if (messageConsumer != null)
+ {
+ messageConsumer.close();
+ logger.debug("Closed JMS MessageConsumer for connected listener '" + getClass().getName() + "' on JMS destination '" + getDestinationName() + "'.");
+ }
+ } catch (Throwable e)
+ {
+ logger.error("Failed to close JMS Consumer.", e);
+ } finally
+ {
+ messageConsumer = null;
+ }
+ } finally
+ {
+ super.close();
+ }
+ }
+
+ /**
+ * Is the handler connected.
+ * @return True if the connector is connected, otherwise false.
+ */
+ public boolean isConnected()
+ {
+ return (messageConsumer != null);
+ }
+}
Copied: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java (from rev 22457, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,146 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.jms;
+
+import org.apache.log4j.Logger;
+
+import javax.jms.*;
+import java.util.Properties;
+
+/**
+ * JMS Message sender.
+ * <p/>
+ * Manages destination connection, close and cleanup.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MessageSender extends AbstractMessageHandler
+{
+ /**
+ * Logger.
+ */
+ private Logger logger;
+ /**
+ * JMS Listener.
+ */
+ private MessageProducer messageProducer;
+
+ /**
+ * Public constructor.
+ * <p/>
+ * Connects the sender to the destination.
+ *
+ * @param destinationName The destination name.
+ * @param jndiProperties The JNDI properties.
+ */
+ protected MessageSender(final String destinationName, final Properties jndiProperties)
+ {
+ super(jndiProperties, destinationName);
+ logger = Logger.getLogger(getClass());
+ }
+
+ /**
+ * Connect to the configured destination.
+ *
+ * @throws JMSException Failed to connect.
+ */
+ public final void connect() throws JMSException
+ {
+ try
+ {
+ logger.debug("Attempting to connect sender '" + getClass().getName() + "' to JMS Destination '" + getDestinationName() + "'.");
+
+ // Call super first to connect etc...
+ super.connect();
+
+ // Bind "this" sender to the destination...
+ try
+ {
+ if (getSession() instanceof TopicSession)
+ {
+ messageProducer = ((TopicSession) getSession()).createPublisher((Topic) getDestination());
+ } else
+ {
+ messageProducer = ((QueueSession) getSession()).createSender((Queue) getDestination());
+ }
+ } catch (JMSException e)
+ {
+ throw (JMSException) (new JMSException("Failed to start JMS Destination Connection.").initCause(e));
+ }
+ logger.debug("Successfully connected sender '" + getClass().getName() + "' to JMS destination '" + getDestinationName() + "'.");
+ } finally
+ {
+ // If we failed to create the message sender, close and clean up....
+ if (messageProducer == null)
+ {
+ close();
+ }
+ }
+ }
+
+ /**
+ * Send the message to the destination.
+ *
+ * @param message The message to be sent.
+ * @throws JMSException Failed to send message.
+ */
+ public final void send(final Message message) throws JMSException
+ {
+ messageProducer.send(message);
+ }
+
+
+ /**
+ * Close out the sender and all it's resources.
+ */
+ public final void close()
+ {
+ try
+ {
+ try
+ {
+ if (messageProducer != null)
+ {
+ messageProducer.close();
+ logger.debug("Closed JMS MessageConsumer for connected sender '" + getClass().getName() + "' on JMS destination '" + getDestinationName() + "'.");
+ }
+ } catch (Throwable e)
+ {
+ logger.error("Failed to close JMS Consumer.", e);
+ } finally
+ {
+ messageProducer = null;
+ }
+ } finally
+ {
+ super.close();
+ }
+ }
+
+ /**
+ * Is the handler connected.
+ *
+ * @return True if the connector is connected, otherwise false.
+ */
+ public final boolean isConnected()
+ {
+ return (messageProducer != null);
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/package.html (from rev 22452, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/jms/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/package.html 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+JMS utilities.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/package.html
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossesb/workspace/skeagh/routing/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/pom.xml 2008-09-05 19:51:24 UTC (rev 22457)
+++ labs/jbossesb/workspace/skeagh/routing/pom.xml 2008-09-05 20:44:17 UTC (rev 22458)
@@ -15,7 +15,7 @@
<url>http://www.jboss.org/jbossesb/</url>
<modules>
- <module>file</module>
+ <!-- module>file</module -->
<module>jms</module>
</modules>
Modified: labs/jbossesb/workspace/skeagh/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/pom.xml 2008-09-05 19:51:24 UTC (rev 22457)
+++ labs/jbossesb/workspace/skeagh/runtime/pom.xml 2008-09-05 20:44:17 UTC (rev 22458)
@@ -30,11 +30,6 @@
<version>${jboss.esb.version}</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <version>4.2.0.GA</version>
- </dependency>
- <dependency>
<groupId>org.milyn</groupId>
<artifactId>milyn-smooks-javabean</artifactId>
<version>1.1-SNAPSHOT</version>
@@ -44,21 +39,6 @@
<artifactId>quartz</artifactId>
<version>1.5.2</version>
</dependency>
-
- <!-- Test Dependencies - can we embed JBM without the JBoss MC -->
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>4.1.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.1.1.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<repositories>
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-05 19:51:24 UTC (rev 22457)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -29,6 +29,7 @@
import org.jboss.esb.deploy.config.OutboundRouterConfig;
import org.jboss.esb.deploy.config.ServiceConfig;
import org.jboss.esb.dispatch.LocalDispatcher;
+import org.jboss.esb.dispatch.DispatcherProxy;
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.schedule.JobScheduler;
import org.jboss.esb.service.Service;
@@ -364,15 +365,22 @@
// Deploy the transformers first...
deployTransformers(serviceName, routerConfig.getTransformers(), routerConfig.getName());
- // Create a dispatcher and hook it into the inRouter...
+ // Create a LocalDispatcher and hook it into the DispatcherProxy. This may
+ // get updated later...
LocalDispatcher dispatcher = new LocalDispatcher(context);
dispatcher.setServiceName(serviceName);
dispatcher.setService(getService(deploymentUnit, serviceName));
dispatcher.setTransformers(routerConfig.getTransformers());
dispatcher.setOutboundRouters(deploymentUnit.getOutboundRouters().get(serviceName));
dispatcher.initialize();
- routerConfig.getRouter().setDispatcher(dispatcher);
+ // We set a DispatcherProxy on the actual router because we may need to update
+ // the "effective" dispatcher later, depending on other deployments that
+ // come online...
+ DispatcherProxy dispatcherProxy = new DispatcherProxy(dispatcher);
+ routerConfig.setDispatcherProxy(dispatcherProxy);
+ routerConfig.getRouter().setDispatcher(dispatcherProxy);
+
// Now deploy the router...
deployObject(routerConfig.getRouter(), routerConfig.getName(), serviceName);
logger.debug("Deployed InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").");
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java 2008-09-05 19:51:24 UTC (rev 22457)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -21,6 +21,7 @@
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.routing.InboundRouter;
+import org.jboss.esb.dispatch.DispatcherProxy;
import java.util.List;
@@ -40,6 +41,10 @@
*/
private InboundRouter router;
/**
+ * Dispatcher proxy.
+ */
+ private DispatcherProxy dispatcherProxy;
+ /**
* Router transformers.
*/
private List<MessageTransformer> transformers;
@@ -85,6 +90,24 @@
}
/**
+ * Get the {@link DispatcherProxy} associated with this router config.
+ * @return The DispatcherProxy instance.
+ */
+ public final DispatcherProxy getDispatcherProxy()
+ {
+ return dispatcherProxy;
+ }
+
+ /**
+ * Get the {@link DispatcherProxy} associated with this router config.
+ * @param dispatcherProxy The DispatcherProxy instance.
+ */
+ public final void setDispatcherProxy(final DispatcherProxy dispatcherProxy)
+ {
+ this.dispatcherProxy = dispatcherProxy;
+ }
+
+ /**
* Get message transformers.
*
* @return The message transformers.
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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.dispatch;
+
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+
+/**
+ * Dispatcher proxy.
+ * <p/>
+ * This dispatcher allows post deployment update of the effective dispatcher
+ * used by an {@link org.jboss.esb.routing.InboundRouter}.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DispatcherProxy implements MessageDispatcher
+{
+ /**
+ * The effective dispacher.
+ */
+ private MessageDispatcher dispatcher;
+
+ /**
+ * Public constructor.
+ * @param dispatcher The effective dispatcher.
+ */
+ public DispatcherProxy(final MessageDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ /**
+ * Dispatch the message to the target service.
+ *
+ * @param message The message to be dispatched.
+ * @param invocationContext The InvocationContext for the message dispatch.
+ * @throws RoutingException An exception occured while dispatching the message.
+ */
+ public final void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
+ {
+ dispatcher.dispatch(message, invocationContext);
+ }
+
+ /**
+ * Get the effective dispatcher instance.
+ * @return The dispatcher instance.
+ */
+ public final MessageDispatcher getDispatcher()
+ {
+ return dispatcher;
+ }
+
+ /**
+ * Set the effective dispatcher instance.
+ * @param dispatcher The dispatcher instance.
+ */
+ public final void setDispatcher(final MessageDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, 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;
+
+import org.jboss.esb.schedule.AbstractScheduleListener;
+import org.jboss.esb.schedule.SchedulingException;
+import org.jboss.esb.deploy.config.DeploymentUnit;
+
+/**
+ * Deployment Coordinator.
+ * <p/>
+ * Manages relationships between local deployments e.g. deployed in the same
+ * container.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentCoordinator extends AbstractScheduleListener
+{
+ /**
+ * Deployment Unit.
+ */
+ private DeploymentUnit deploymentUnit;
+
+ /**
+ * Public constructor.
+ * @param deploymentUnit The DeploymentUnit for the local deployment.
+ */
+ public DeploymentCoordinator(final DeploymentUnit deploymentUnit)
+ {
+ this.deploymentUnit = deploymentUnit;
+ }
+
+ /**
+ * Deployment management schedule handler.
+ * @throws SchedulingException
+ */
+ public final void onSchedule() throws SchedulingException
+ {
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html (from rev 22387, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/schedule/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html 2008-09-05 20:44:17 UTC (rev 22458)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Deployment Federation.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html
___________________________________________________________________
Name: svn:mergeinfo
+
More information about the jboss-svn-commits
mailing list