[jboss-svn-commits] JBL Code SVN: r22681 - in labs/jbossesb/workspace/skeagh: commons/src/main/java/org/jboss/esb/properties and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 11 08:10:16 EDT 2008
Author: tfennelly
Date: 2008-09-11 08:10:16 -0400 (Thu, 11 Sep 2008)
New Revision: 22681
Added:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBusDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/JMSBusDispatcher.java
Modified:
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/JMSSession.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/MockMessageListener.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java
labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/jms/MessageSendAndListenTest.java
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInformationExtractor.java
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/digest/CreateObject.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java
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/notify/AbstractDeploymentNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
labs/jbossesb/workspace/skeagh/testutil/src/main/java/org/jboss/esb/jms/JMSTestRunner.java
Log:
Checkstyle fixes.
Modified: 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/AbstractMessageHandler.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageHandler.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -60,9 +60,8 @@
*
* @param destinationName The JMS destination name.
* @param jmsSession The The JMS Session on which this handler is created.
- * @throws JMSException Failed to connect.
*/
- public AbstractMessageHandler(final String destinationName, final JMSSession jmsSession) throws JMSException
+ public AbstractMessageHandler(final String destinationName, final JMSSession jmsSession)
{
AssertArgument.isNotNullAndNotEmpty(destinationName, "destinationName");
AssertArgument.isNotNull(jmsSession, "jmsSession");
@@ -148,7 +147,7 @@
* JMS Exception handler.
* @param e The JMS Exception.
*/
- public void onException(JMSException e)
+ public final void onException(final JMSException e)
{
close();
while (!isConnected())
Modified: 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/AbstractMessageListener.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/AbstractMessageListener.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -74,9 +74,8 @@
* @param destinationName The destination name.
* @param jmsSession The JMS Session on which this handler is created.
* @param properties Listener properties.
- * @throws JMSException Failed to connect.
*/
- protected AbstractMessageListener(final String destinationName, final JMSSession jmsSession, final Properties properties) throws JMSException
+ protected AbstractMessageListener(final String destinationName, final JMSSession jmsSession, final Properties properties)
{
super(destinationName, jmsSession);
logger = Logger.getLogger(getClass());
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/JMSSession.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -82,7 +82,7 @@
* @param destinationType The JMS destination type.
* @param jndiProperties The JNDI properties for creating the JMS session.
*/
- public JMSSession(Class<? extends Destination> destinationType, final Properties jndiProperties)
+ public JMSSession(final Class<? extends Destination> destinationType, final Properties jndiProperties)
{
AssertArgument.isNotNull(destinationType, "destinationType");
AssertArgument.isNotNull(jndiProperties, "jndiProperties");
@@ -103,9 +103,9 @@
}
/**
- * Get the JNDI Properties from which this session was created.
+ * Get the JNDI Properties in use by this session instance.
*
- * @return
+ * @return The JNDI Properties in use by this session instance.
*/
public final Properties getProperties()
{
Modified: 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/MessageSender.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MessageSender.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -53,9 +53,9 @@
* Connects the sender to the destination.
*
* @param destinationName The destination name.
- * @param jmsSession The JMS Session instance.
+ * @param jmsSession The JMS Session instance.
*/
- public MessageSender(final String destinationName, final JMSSession jmsSession) throws JMSException
+ public MessageSender(final String destinationName, final JMSSession jmsSession)
{
super(destinationName, jmsSession);
logger = Logger.getLogger(getClass());
@@ -78,16 +78,19 @@
if (getDestination() instanceof Topic)
{
messageProducer = ((TopicSession) getSession()).createPublisher((Topic) getDestination());
- } else
+ }
+ else
{
messageProducer = ((QueueSession) getSession()).createSender((Queue) getDestination());
}
- } catch (JMSException e)
+ }
+ 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
+ }
+ finally
{
// If we failed to create the message sender, close and clean up....
if (messageProducer == null)
@@ -105,6 +108,10 @@
*/
public final void send(final Message message) throws JMSException
{
+ if (!isConnected())
+ {
+ throw new IllegalStateException("Sender not connected to JMS Destination. The connect() method must be called before send(Message) can be called.");
+ }
messageProducer.send(message);
}
@@ -120,10 +127,12 @@
messageProducer.close();
logger.debug("Closed JMS MessageConsumer for connected sender '" + getClass().getName() + "' on JMS destination '" + getDestinationName() + "'.");
}
- } catch (Throwable e)
+ }
+ catch (Throwable e)
{
logger.error("Failed to close JMS Consumer.", e);
- } finally
+ }
+ finally
{
messageProducer = null;
}
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MockMessageListener.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MockMessageListener.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/jms/MockMessageListener.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -19,37 +19,70 @@
*/
package org.jboss.esb.jms;
-import javax.jms.TextMessage;
import javax.jms.Message;
-import javax.jms.JMSException;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
import java.util.Properties;
/**
* Mock MessageListener implementation.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
-*/
-class MockMessageListener extends AbstractMessageListener {
-
- public final List<TextMessage> messagesReceived = new ArrayList<TextMessage>();
+ * @param <T> JMS Message type.
+ */
+class MockMessageListener<T extends Message> extends AbstractMessageListener
+{
+ /**
+ * Messages received.
+ */
+ private List<T> messages = new ArrayList<T>();
- protected MockMessageListener(final String destinationName, final JMSSession jmsSession, final Properties jndiProperties, final String messageSelector) throws JMSException
+ /**
+ * Public constructor.
+ *
+ * @param destinationName The JMS Destination.
+ * @param jmsSession The JMS Session on which the listener is to be created.
+ * @param messageSelector JMS message selector.
+ */
+ public MockMessageListener(final String destinationName, final JMSSession jmsSession, final String messageSelector)
{
- super(destinationName, jmsSession, addMessageSelector(jndiProperties, messageSelector));
+ super(destinationName, jmsSession, addMessageSelector(jmsSession.getProperties(), messageSelector));
}
- public void onMessage(Message message)
+ /**
+ * Message handler.
+ *
+ * @param message The JMS Message.
+ */
+ public final void onMessage(final Message message)
{
- messagesReceived.add((TextMessage) message);
+ messages.add((T) message);
}
- private static Properties addMessageSelector(Properties jndiProperties, String selector)
+ /**
+ * Get the list of messages received by this listener.
+ * @return The list of messages received by this listener.
+ */
+ public final List<T> getMessages()
{
- if(selector != null) {
- jndiProperties = (Properties) jndiProperties.clone();
- jndiProperties.setProperty(AbstractMessageListener.MESSAGE_SELECTOR, selector);
+ return messages;
+ }
+
+ /**
+ * Add the message selector to the properties.
+ *
+ * @param listenerProperties The listener connection properties.
+ * @param selector The JMS Selector to be added.
+ * @return The new connection properties.
+ */
+ private static Properties addMessageSelector(final Properties listenerProperties, final String selector)
+ {
+ Properties properties = listenerProperties;
+ if (selector != null)
+ {
+ properties = (Properties) properties.clone();
+ properties.setProperty(AbstractMessageListener.MESSAGE_SELECTOR, selector);
}
- return jndiProperties;
+ return properties;
}
}
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -21,7 +21,11 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
/**
* ApplicationProperties class.
@@ -117,11 +121,12 @@
/**
* Get a boolean property value.
- * @param key Property key.
+ *
+ * @param key Property key.
* @param defaultVal Default property value.
* @return True if the value of the property is "true", otherwise the defaultVal.
*/
- public boolean getBooleanProperty(String key, boolean defaultVal)
+ public final boolean getBooleanProperty(final String key, final boolean defaultVal)
{
String value = getProperty(key, Boolean.toString(defaultVal));
return value.trim().equals("true");
@@ -129,11 +134,12 @@
/**
* Get a long property value.
- * @param key Property key.
+ *
+ * @param key Property key.
* @param defaultVal Default property value.
* @return The long value of the property if it is a valid long, otherwise the defaultVal.
*/
- public long getLongProperty(String key, long defaultVal)
+ public final long getLongProperty(final String key, final long defaultVal)
{
String value = getProperty(key, Long.toString(defaultVal));
try
Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/util/JNDIUtil.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -27,7 +27,7 @@
/**
* JNDI Utilitiy methods.
- *
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public abstract class JNDIUtil
@@ -44,6 +44,7 @@
* <p/>
* Don't forget to close it when done!
*
+ * @param jndiProperties JNDI properties.
* @return The context.
* @throws javax.jms.JMSException Error getting context.
*/
@@ -65,5 +66,5 @@
}
return context;
- }
+ }
}
Modified: labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/jms/MessageSendAndListenTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/jms/MessageSendAndListenTest.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/jms/MessageSendAndListenTest.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -70,7 +70,7 @@
jndiProperties.setProperty("queue." + destName, destName);
}
- MockMessageListener listener = new MockMessageListener(destName, jmsSession, jndiProperties, null);
+ MockMessageListener<TextMessage> listener = new MockMessageListener<TextMessage>(destName, jmsSession, null);
listener.connect();
assertTrue(destType.isAssignableFrom(listener.getDestination().getClass()));
@@ -90,10 +90,10 @@
}
Thread.sleep(1000);
- assertEquals(3, listener.messagesReceived.size());
- assertTrue(messagesSent.contains(listener.messagesReceived.get(0).getText()));
- assertTrue(messagesSent.contains(listener.messagesReceived.get(1).getText()));
- assertTrue(messagesSent.contains(listener.messagesReceived.get(2).getText()));
+ assertEquals(3, listener.getMessages().size());
+ assertTrue(messagesSent.contains(listener.getMessages().get(0).getText()));
+ assertTrue(messagesSent.contains(listener.getMessages().get(1).getText()));
+ assertTrue(messagesSent.contains(listener.getMessages().get(2).getText()));
} finally {
listener.close();
}
@@ -122,8 +122,8 @@
jndiProperties.setProperty("queue." + destName, destName);
}
- MockMessageListener service1 = new MockMessageListener(destName, jmsSession, jndiProperties, "serviceId='service1'");
- MockMessageListener service2 = new MockMessageListener(destName, jmsSession, jndiProperties, "serviceId='service2'");
+ MockMessageListener<TextMessage> service1 = new MockMessageListener<TextMessage>(destName, jmsSession, "serviceId='service1'");
+ MockMessageListener<TextMessage> service2 = new MockMessageListener<TextMessage>(destName, jmsSession, "serviceId='service2'");
List<String> service1Messages = Arrays.asList(new String[] {"message 1", "message 2", "message 3"});
List<String> service2Messages = Arrays.asList(new String[] {"message 4", "message 5", "message 6"});
@@ -149,15 +149,15 @@
Thread.sleep(1000);
- assertEquals(3, service1.messagesReceived.size());
- assertTrue(service1Messages.contains(service1.messagesReceived.get(0).getText()));
- assertTrue(service1Messages.contains(service1.messagesReceived.get(1).getText()));
- assertTrue(service1Messages.contains(service1.messagesReceived.get(2).getText()));
+ assertEquals(3, service1.getMessages().size());
+ assertTrue(service1Messages.contains(service1.getMessages().get(0).getText()));
+ assertTrue(service1Messages.contains(service1.getMessages().get(1).getText()));
+ assertTrue(service1Messages.contains(service1.getMessages().get(2).getText()));
- assertEquals(3, service2.messagesReceived.size());
- assertTrue(service2Messages.contains(service2.messagesReceived.get(0).getText()));
- assertTrue(service2Messages.contains(service2.messagesReceived.get(1).getText()));
- assertTrue(service2Messages.contains(service2.messagesReceived.get(2).getText()));
+ assertEquals(3, service2.getMessages().size());
+ assertTrue(service2Messages.contains(service2.getMessages().get(0).getText()));
+ assertTrue(service2Messages.contains(service2.getMessages().get(1).getText()));
+ assertTrue(service2Messages.contains(service2.getMessages().get(2).getText()));
} finally {
service2.close();
}
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -67,7 +67,7 @@
private final Properties jmsProperties = getDefaultProperties();
/**
- * Should JMSHeaders and user properties be extrated from the JMS Message
+ * Should JMSHeaders and user properties be extrated from the JMS Message.
*/
@Property(use = Use.OPTIONAL, defaultVal = "true")
private boolean extractProperties;
@@ -202,10 +202,11 @@
* Protected contstructor.
*
* @param destinationName the JMS destination name.
+ * @param jmsSession The JMS Session.
* @param jndiProperties the jndi properties to be used for jndi lookups.
* @param dispatcher the {@link MessageDispatcher} to be used.
*/
- protected JmsMessageListener(final String destinationName, final JMSSession jmsSession, final Properties jndiProperties, final MessageDispatcher dispatcher) throws JMSException
+ protected JmsMessageListener(final String destinationName, final JMSSession jmsSession, final Properties jndiProperties, final MessageDispatcher dispatcher)
{
super(destinationName, jmsSession, jndiProperties);
this.dispatcher = dispatcher;
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInformationExtractor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInformationExtractor.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInformationExtractor.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -20,12 +20,16 @@
*/
package org.jboss.esb.jms;
-import static org.jboss.esb.jms.JmsConstants.*;
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
+import static org.jboss.esb.jms.JmsConstants.CORRELATION_ID;
+import static org.jboss.esb.jms.JmsConstants.DELIVERY_MODE;
+import static org.jboss.esb.jms.JmsConstants.EXPIRATION;
+import static org.jboss.esb.jms.JmsConstants.MESSAGE_ID;
+import static org.jboss.esb.jms.JmsConstants.PRIORITY;
+import static org.jboss.esb.jms.JmsConstants.REDELIVERED;
+import static org.jboss.esb.jms.JmsConstants.REPLY_TO;
+import static org.jboss.esb.jms.JmsConstants.TIMESTAMP;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.RoutingException;
import javax.jms.BytesMessage;
import javax.jms.Destination;
@@ -34,14 +38,16 @@
import javax.jms.ObjectMessage;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.RoutingException;
-
/**
+ * JMS Information extractor.
*
* @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- *
*/
public final class JmsInformationExtractor
{
@@ -58,18 +64,18 @@
* <br>
* The following conversions are done bases on the message type:
* <lu>
- * <li>TestMessage -> java.lang.String</li>
- * <li>ObjectMessage -> java.lang.Object</li>
- * <li>BytesMessage -> byte[]</li>
- * <li>MapMessage -> java.util.Map</li>
- * <li>StreamMessage -> org.jboss.esb.jms.StreamMessageInputStream</li>
+ * <li>TestMessage -> java.lang.String</li>
+ * <li>ObjectMessage -> java.lang.Object</li>
+ * <li>BytesMessage -> byte[]</li>
+ * <li>MapMessage -> java.util.Map</li>
+ * <li>StreamMessage -> org.jboss.esb.jms.StreamMessageInputStream</li>
* </lu>
*
- * @param jmsMessage the JMS Message object instance
+ * @param jmsMessage the JMS Message object instance
* @return Message the populated ESB Message object instance.
* @throws RoutingException if an error occurs while trying to extract the JMS messages contents.
*/
- public static Message extractPayload(final javax.jms.Message jmsMessage) throws JMSException, RoutingException
+ public static Message extractPayload(final javax.jms.Message jmsMessage) throws RoutingException
{
final Message esbMessage = new Message();
try
@@ -85,7 +91,7 @@
}
else if (jmsMessage instanceof ObjectMessage)
{
- final Serializable object = ((ObjectMessage)jmsMessage).getObject();
+ final Serializable object = ((ObjectMessage) jmsMessage).getObject();
if (object == null)
{
throw new RoutingException("Content in JMSMessage [" + jmsMessage + "] was null");
@@ -94,18 +100,18 @@
}
else if (jmsMessage instanceof BytesMessage)
{
- byte[] content = readBytes(jmsMessage);
+ byte[] content = readBytes((BytesMessage) jmsMessage);
esbMessage.setPayload(content);
}
else if (jmsMessage instanceof MapMessage)
{
- final MapMessage jmsMap = (MapMessage)jmsMessage;
- final Map<String,Object> esbMap = new HashMap<String,Object>();
+ final MapMessage jmsMap = (MapMessage) jmsMessage;
+ final Map<String, Object> esbMap = new HashMap<String, Object>();
final Enumeration<?> mapNames = jmsMap.getMapNames();
while (mapNames.hasMoreElements())
{
- final String key = (String)mapNames.nextElement();
+ final String key = (String) mapNames.nextElement();
final Object value = jmsMap.getObject(key);
esbMap.put(key, value);
}
@@ -117,7 +123,7 @@
}
else if (jmsMessage instanceof StreamMessage)
{
- StreamMessage streamMessage = (StreamMessage)jmsMessage;
+ StreamMessage streamMessage = (StreamMessage) jmsMessage;
esbMessage.setPayload(new StreamMessageInputStream(streamMessage));
}
else
@@ -134,9 +140,10 @@
/**
* Will extract all the properties that have been set on the JMS Message and
- * also extract all the set JMS Headers
+ * also extract all the set JMS Headers.
+ * <p/>
* The following JMS Headers are extracted:
- * <lu>
+ * <ul>
* <li>JMSCorrelationID -> get(JmsConstants.CORRELATION_ID</li>
* <li>JMSExpiration -> get(JmsConstants.EXPIRATOIN</li>
* <li>JMSRedelivered -> get(JmsConstants.REDELIVERED</li>
@@ -144,11 +151,11 @@
* <li>JMSTimestamp -> get(JmsConstants.TIMESTAMP</li>
* <li>JMSReplyTo -> get(JmsConstants.REPLY_TO</li>
* <li>JMSPriority -> get(JmsConstants.PRIORITY</li>
- * <li></li>
+ * </ul>
*
- * @param jmsMessage
- * @return
- * @throws JMSException
+ * @param jmsMessage The JMS Message.
+ * @return The JMS Properties.
+ * @throws JMSException Error extracting properties.
*/
public static Properties extractJmsProperties(final javax.jms.Message jmsMessage) throws JMSException
{
@@ -170,9 +177,9 @@
}
final long expiration = jmsMessage.getJMSExpiration();
- if (expiration > 0l)
+ if (expiration > 0L)
{
- properties.put(EXPIRATION, expiration);
+ properties.put(EXPIRATION, expiration);
}
final boolean redelivered = jmsMessage.getJMSRedelivered();
@@ -185,7 +192,7 @@
final String messageId = jmsMessage.getJMSMessageID();
if (messageId != null)
{
- properties.put(MESSAGE_ID, messageId);
+ properties.put(MESSAGE_ID, messageId);
}
/*
@@ -194,7 +201,7 @@
* case this timestamp might have been set to 0.
*/
final long timestamp = jmsMessage.getJMSTimestamp();
- if (timestamp > 0l)
+ if (timestamp > 0L)
{
properties.put(TIMESTAMP, timestamp);
}
@@ -206,7 +213,7 @@
}
int priority = jmsMessage.getJMSPriority();
- if ( priority >= 0 && priority <= 9 )
+ if (priority >= 0 && priority <= 9)
{
properties.put(PRIORITY, priority);
}
@@ -217,17 +224,22 @@
return properties;
}
- private static byte[] readBytes(final javax.jms.Message jmsMessage) throws JMSException, RoutingException
+ /**
+ * Read the bytes from the supplied JMS Message.
+ * @param jmsMessage The JMS Message.
+ * @return The message bytes.
+ * @throws JMSException Error Access message bytes.
+ */
+ private static byte[] readBytes(final BytesMessage jmsMessage) throws JMSException
{
- final BytesMessage bytesMessage = (BytesMessage)jmsMessage;
- bytesMessage.reset();
+ jmsMessage.reset();
int msgLength = 0;
final int buffSize = 50000;
byte[] data = new byte[buffSize];
// calculate the nr of bytes in the message
while (true)
{
- int len = bytesMessage.readBytes(data);
+ int len = jmsMessage.readBytes(data);
if (len > 0)
{
msgLength += len;
@@ -239,7 +251,7 @@
}
if (msgLength == 0)
{
- throw new RoutingException("Content in JMSMessage [" + jmsMessage + "] was of zero length");
+ throw new JMSException("Content in JMSMessage [" + jmsMessage + "] was of zero length");
}
byte[] content = new byte[msgLength];
if (msgLength <= buffSize)
@@ -248,8 +260,8 @@
}
else
{
- bytesMessage.reset();
- bytesMessage.readBytes(content);
+ jmsMessage.reset();
+ jmsMessage.readBytes(content);
}
return content;
}
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-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -32,12 +32,12 @@
import org.jboss.esb.dispatch.LocalDispatcher;
import org.jboss.esb.federate.DeploymentCoordinator;
import org.jboss.esb.message.MessageTransformer;
+import org.jboss.esb.properties.ApplicationProperties;
import org.jboss.esb.schedule.JobScheduler;
import org.jboss.esb.schedule.SimpleSchedule;
import org.jboss.esb.service.Service;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
-import org.jboss.esb.properties.ApplicationProperties;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -127,6 +127,7 @@
/**
* Get the deployment ID.
+ *
* @return The deployment ID.
*/
public final String getDeploymentId()
@@ -136,6 +137,7 @@
/**
* Set the deployment ID.
+ *
* @param deploymentId The deployment ID.
*/
public final void setDeploymentId(final String deploymentId)
@@ -194,7 +196,7 @@
{
assertConfigurationsAdded();
- if(context != null)
+ if (context != null)
{
throw new DeploymentException("Runtime already deployed.");
}
@@ -330,10 +332,10 @@
*
* @param key Resource key.
* @param resource Resource object instance.
- * @param deployedResources The list of already deployed resources.
+ * @param resources The list of already deployed resources.
* @throws DeploymentException Unable to deploy resource.
*/
- private void deployResource(final String key, final Object resource, final Map<String, Object> deployedResources) throws DeploymentException
+ private void deployResource(final String key, final Object resource, final Map<String, Object> resources) throws DeploymentException
{
if (!deployedObjects.containsValue(resource))
{
@@ -341,7 +343,7 @@
{
deployObject(resource, key, null);
logger.debug("Deployed resource '" + key + "' (" + resource.getClass().getName() + ").");
- deployedResources.put(key, resource);
+ resources.put(key, resource);
}
catch (InvocationTargetException e)
{
@@ -444,6 +446,7 @@
/**
* Deploy the deployment coordinator.
+ *
* @throws DeploymentException Unable to deploy DeploymentCoordinator.
*/
private void deployDeploymentCoordinator() throws DeploymentException
@@ -468,6 +471,7 @@
/**
* Get the deployment coordintaor for the deployment.
+ *
* @return The deployment coordinator.
*/
public final DeploymentCoordinator getDeploymentCoordinator()
@@ -587,7 +591,7 @@
ClassUtil.setFieldValue(object, "serviceName", serviceName);
}
ClassUtil.execAnnotatedMethod(object, Initialize.class);
- deployedObjects.put((objectName != null?objectName:object), object);
+ deployedObjects.put((objectName != null ? objectName : object), object);
}
/**
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -39,13 +39,9 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
/**
* Create an object and set it in the Smooks bean repository.
@@ -93,7 +89,8 @@
try
{
expectedType = ClassUtil.forName(expectedTypeName, CreateObject.class);
- } catch (ClassNotFoundException e)
+ }
+ catch (ClassNotFoundException e)
{
throw new SmooksConfigurationException("Unable to load expected type class '" + expectedTypeName + "'.", e);
}
@@ -114,14 +111,16 @@
if (className != null)
{
objectClassName = className;
- } else if (classAttrib != null)
+ }
+ else if (classAttrib != null)
{
objectClassName = DomUtils.getAttributeValue(element, classAttrib);
if (objectClassName == null)
{
throw new SmooksException("Class naming attribute '" + classAttrib + "' not specified on element '" + element + "'.");
}
- } else
+ }
+ else
{
throw new SmooksException("One of the attributes 'className' or 'classAttrib' must be defined on the '" + CreateObject.class.getName() + "' resource.");
}
@@ -139,7 +138,8 @@
try
{
defaultConstructor = objectClass.getDeclaredConstructor();
- } catch (NoSuchMethodException e)
+ }
+ catch (NoSuchMethodException e)
{
throw new SmooksException("Class '" + objectClassName + "' doesn't define a default constructor (public, protected or private).");
}
@@ -153,44 +153,62 @@
// Store the bean in the Smooks bean repository...
BeanRepositoryManager.getBeanRepository(executionContext).addBean(beanId, objectInstance);
- } finally
+ }
+ finally
{
defaultConstructor.setAccessible(isAccessible);
}
- } catch (Exception e)
+ }
+ catch (Exception e)
{
throw new SmooksException("Unable to create class instance for class '" + objectClassName + "'.", e);
}
}
- public void visitAfter(final Element element, final ExecutionContext executionContext) throws SmooksException
+ /**
+ * Visit after.
+ * <p/>
+ * Look at the created bean and check that all required fields are set.
+ *
+ * @param element The event element.
+ * @param executionContext The Smooks execution context.
+ * @throws SmooksException Visit exception.
+ */
+ public final void visitAfter(final Element element, final ExecutionContext executionContext) throws SmooksException
{
final Object bean = BeanRepositoryManager.getBeanRepository(executionContext).getBean(beanId);
final NodeList childNodes = element.getChildNodes();
final int length = childNodes.getLength();
- final Map<String,String> propertiesMap = new HashMap<String,String>(length);
+ final Map<String, String> propertiesMap = new HashMap<String, String>(length);
- for (int i = 0 ; i < length ; i++)
+ for (int i = 0; i < length; i++)
{
- final Node node = childNodes.item(i);
- if (node.getNodeName().equals("property"))
- {
- propertiesMap.put(node.getAttributes().getNamedItem("name").getNodeValue(), node.getTextContent());
- }
+ final Node node = childNodes.item(i);
+ if (node.getNodeName().equals("property"))
+ {
+ propertiesMap.put(node.getAttributes().getNamedItem("name").getNodeValue(), node.getTextContent());
+ }
}
- checkFieldAnnoations(bean.getClass(), bean, propertiesMap) ;
+ checkFieldAnnoations(bean.getClass(), bean, propertiesMap);
}
- final void checkFieldAnnoations(final Class clazz, final Object instance, Map<String,String> properties)
+ /**
+ * Check field annotations.
+ *
+ * @param hierarchyClass The Class hierarchy level to be checked.
+ * @param instance The object instance.
+ * @param properties The config properties.
+ */
+ final void checkFieldAnnoations(final Class hierarchyClass, final Object instance, final Map<String, String> properties)
{
final Set<String> propertyNameInConfig = properties.keySet();
- final Class<?> superclass = clazz.getSuperclass();
- if (superclass != null )
+ final Class<?> superclass = hierarchyClass.getSuperclass();
+ if (superclass != null)
{
checkFieldAnnoations(superclass, instance, properties);
}
- for (Field field : clazz.getDeclaredFields())
+ for (Field field : hierarchyClass.getDeclaredFields())
{
final Property annotation = field.getAnnotation(Property.class);
@@ -208,7 +226,7 @@
// get the value of the field
Object fieldValue = ClassUtil.getFieldValue(field, instance);
- if (fieldValue == null || fieldValue.equals(false) )
+ if (fieldValue == null || fieldValue.equals(false))
{
throw new SmooksException("Configuration property '" + field.getName() + " was annotated as required but not specified in configuration file or given a 'defaultVal for bean: " + instance.getClass().getName());
}
@@ -222,7 +240,7 @@
{
try
{
- if ( !annotation.defaultVal().equals(AnnotationConstants.UNASSIGNED))
+ if (!annotation.defaultVal().equals(AnnotationConstants.UNASSIGNED))
{
DataDecoder decoder = DataDecoder.Factory.create(field.getType());
Object objValue = decoder.decode(annotation.defaultVal());
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/SetProperty.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -19,11 +19,6 @@
*/
package org.jboss.esb.deploy.config.digest;
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Properties;
-
import org.jboss.esb.annotations.AnnotationConstants;
import org.jboss.esb.annotations.Property;
import org.jboss.esb.classpath.ClassUtil;
@@ -36,6 +31,11 @@
import org.milyn.xml.DomUtils;
import org.w3c.dom.Element;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
/**
* Set the value of a property of a bean (from the Smooks bean repository).
*
@@ -74,12 +74,9 @@
/**
* Visit Before event handler method.
*
- * @param element
- * The element.
- * @param executionContext
- * The Smooks exec context.
- * @throws SmooksException
- * Error processing event.
+ * @param element The element.
+ * @param executionContext The Smooks exec context.
+ * @throws SmooksException Error processing event.
*/
public final void visitBefore(final Element element, final ExecutionContext executionContext) throws SmooksException
{
@@ -91,12 +88,14 @@
if (instance instanceof Map)
{
((Map) instance).put(propertyName, value);
- } else
+ }
+ else
{
try
{
attemptAnnotationFieldSet(objectClass, instance, propertyName, value);
- } catch (final IllegalAccessException e)
+ }
+ catch (final IllegalAccessException e)
{
throw new SmooksException("Property '" + propertyName + "' unknown on class '" + objectClass + "' (or super class).", e);
}
@@ -106,22 +105,17 @@
/**
* Will set the value of the instance field annotated with {@link Property}.
*
- * @param clazz
- * Class object on which the field should be set. Needed to be
- * able to find superclasses.
- * @param instance
- * the instance that contains the field to be set
- * @param configPropertyName
- * the name of the configuration property
- * @param value
- * the value to set the field to
- * @throws IllegalAccessException
- * if the field was not accessible.
+ * @param clazz Class object on which the field should be set. Needed to be
+ * able to find superclasses.
+ * @param instance the instance that contains the field to be set
+ * @param configPropertyName the name of the configuration property
+ * @param value the value to set the field to
+ * @throws IllegalAccessException if the field was not accessible.
*/
final void attemptAnnotationFieldSet(final Class<?> clazz, final Object instance, final String configPropertyName, final String value) throws IllegalAccessException
{
final Class<?> superclass = clazz.getSuperclass();
- if (superclass != null )
+ if (superclass != null)
{
attemptAnnotationFieldSet(superclass, instance, configPropertyName, value);
}
@@ -141,7 +135,8 @@
setPropertyValue(field, instance, (value == null ? propertyAnno.defaultVal() : value));
break;
}
- } else if (propertiesAnno != null)
+ }
+ else if (propertiesAnno != null)
{
attemptPropertiesFieldSet(instance, field, configPropertyName, value);
break;
@@ -152,18 +147,15 @@
/**
* Verifies that the passed in paramValue if a valid choice.
*
- * @param choices
- * the choices available
- * @param name
- * the name of the paramter
- * @param paramValue
- * the property value
+ * @param choices the choices available
+ * @param name the name of the paramter
+ * @param paramValue the property value
*/
private void assertValidChoice(final String[] choices, final String name, final String paramValue)
{
if (choices == null || choices.length == 0)
{
- throw new RuntimeException( "Unexpected annotation default choice value. Should not be null or empty. Code may have changed incompatibly.");
+ throw new RuntimeException("Unexpected annotation default choice value. Should not be null or empty. Code may have changed incompatibly.");
}
else if (choices.length == 1 && AnnotationConstants.NULL_STRING.equals(choices[0]))
{
@@ -188,14 +180,10 @@
/**
* Set property value.
*
- * @param field
- * The property field.
- * @param instance
- * The Object instance.
- * @param value
- * The property value.
- * @throws IllegalAccessException
- * Property access exception.
+ * @param field The property field.
+ * @param instance The Object instance.
+ * @param value The property value.
+ * @throws IllegalAccessException Property access exception.
*/
private void setPropertyValue(final Field field, final Object instance, final String value) throws IllegalAccessException
{
@@ -209,14 +197,10 @@
* Attempt to set the property value on a "properties" field (type
* {@link Properties}) on the object, if such a field exists.
*
- * @param instance
- * The object instance.
- * @param field
- * The field to be set.
- * @param propertyName
- * The property name.
- * @param value
- * The property value.
+ * @param instance The object instance.
+ * @param field The field to be set.
+ * @param propertyName The property name.
+ * @param value The property value.
* @return True if the property was successfully set, otherwise false.
*/
private boolean attemptPropertiesFieldSet(final Object instance, final Field field, final String propertyName, final String value)
@@ -225,7 +209,7 @@
{
if (Properties.class.isAssignableFrom(field.getType()))
{
- Properties properties = (Properties) ClassUtil.getFieldValue( field, instance);
+ Properties properties = (Properties) ClassUtil.getFieldValue(field, instance);
if (properties == null)
{
properties = new Properties();
@@ -234,7 +218,8 @@
properties.put(propertyName, value);
return true;
}
- } catch (IllegalAccessException ignored)
+ }
+ catch (IllegalAccessException ignored)
{
// Ignore... fall through...
}
@@ -244,11 +229,9 @@
/**
* Get the property bean instance from the supplied Smooks ExecutionContext.
*
- * @param executionContext
- * The Smooks Execution Context.
+ * @param executionContext The Smooks Execution Context.
* @return The bean object instance.
- * @throws SmooksException
- * Unable to find bean in context.
+ * @throws SmooksException Unable to find bean in context.
*/
private Object getObject(final ExecutionContext executionContext) throws SmooksException
{
@@ -256,7 +239,7 @@
if (bean == null)
{
- throw new SmooksException( "Bean '" + beanId + "' not set in bean repository. Need to create the bean using the '" + CreateObject.class.getName() + "' visitor.");
+ throw new SmooksException("Bean '" + beanId + "' not set in bean repository. Need to create the bean using the '" + CreateObject.class.getName() + "' visitor.");
}
return bean;
}
@@ -264,8 +247,7 @@
/**
* Get the property name from the supplied property DOM element.
*
- * @param element
- * The property DOM element.
+ * @param element The property DOM element.
* @return The property name.
*/
private String getPropertyName(final Element element)
@@ -275,16 +257,18 @@
if (property != null)
{
propertyName = property;
- } else if (nameAttrib != null)
+ }
+ else if (nameAttrib != null)
{
propertyName = DomUtils.getAttributeValue(element, nameAttrib);
if (propertyName == null)
{
throw new SmooksException("Class property naming attribute '" + nameAttrib + "' not specified on element '" + element + "'.");
}
- } else
+ }
+ else
{
- throw new SmooksException( "One of the attributes 'property' or 'nameAttrib' must be defined on the '" + SetProperty.class.getName() + "' resource.");
+ throw new SmooksException("One of the attributes 'property' or 'nameAttrib' must be defined on the '" + SetProperty.class.getName() + "' resource.");
}
return propertyName;
@@ -293,8 +277,7 @@
/**
* Get the property value from the supplied property DOM element.
*
- * @param element
- * The property DOM element.
+ * @param element The property DOM element.
* @return The property String value.
*/
private String getPropertyValue(final Element element)
@@ -302,7 +285,8 @@
if (valueAttrib != null)
{
return DomUtils.getAttributeValue(element, valueAttrib);
- } else
+ }
+ else
{
return DomUtils.getAllText(element, true);
}
Modified: 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 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -144,9 +144,10 @@
/**
* Initialize the coordinator.
+ * @throws DeploymentException Initialization exception.
*/
@Initialize
- public void initialize() throws DeploymentException
+ public final void initialize() throws DeploymentException
{
ApplicationProperties localBusProperties;
try
@@ -162,7 +163,7 @@
{
intialiseJMSSessions(localBusProperties);
- if(topicSession != null)
+ if (topicSession != null)
{
try
{
@@ -199,7 +200,7 @@
* Uninitialize the coordinator.
*/
@Uninitialize
- public void uninitialize()
+ public final void uninitialize()
{
try
{
@@ -249,7 +250,7 @@
{
try
{
- if(broadcastHeartbeat)
+ if (broadcastHeartbeat)
{
// Tell all other deployments we're alive...
sendNotification(heartbeatNotification);
@@ -306,7 +307,7 @@
* @param destinationName Destination name.
* @param jndiProperties JNDI properties.
*/
- protected CoordinationListener(final String destinationName, final Properties jndiProperties) throws JMSException
+ protected CoordinationListener(final String destinationName, final Properties jndiProperties)
{
super(destinationName, topicSession, jndiProperties);
}
@@ -316,7 +317,7 @@
*
* @param message Coordination message.
*/
- public void onMessage(Message message)
+ public final void onMessage(final Message message)
{
if (message instanceof ObjectMessage)
{
@@ -380,7 +381,7 @@
* @param notification The notification to be sent.
* @throws JMSException An error occured while sending notification.
*/
- private void sendNotification(AbstractDeploymentNotification notification) throws JMSException
+ private void sendNotification(final AbstractDeploymentNotification notification) throws JMSException
{
if (coordinationBroadcaster != null)
{
@@ -443,11 +444,11 @@
return readConfig(configStream);
}
- logger.debug("Unable to find JBoss ESB Bus configuration for protocol '" + protocol + "', deployment '" + deploymentName + "'. Tried:\n" +
- "\t1. File: " + firstCheckPath + "\n" +
- "\t2. Classpath: " + secondCheckPath + "\n" +
- "\t3. File: " + thirdCheckPath + "\n" +
- "\t4. Classpath: " + fourthCheckPath);
+ logger.debug("Unable to find JBoss ESB Bus configuration for protocol '" + protocol + "', deployment '" + deploymentName + "'. Tried:\n"
+ + "\t1. File: " + firstCheckPath + "\n"
+ + "\t2. Classpath: " + secondCheckPath + "\n"
+ + "\t3. File: " + thirdCheckPath + "\n"
+ + "\t4. Classpath: " + fourthCheckPath);
return null;
}
@@ -459,7 +460,7 @@
* @return The {@link Properties} instance.
* @throws IOException Unable to read the configuration.
*/
- private static ApplicationProperties readConfig(InputStream configStream) throws IOException
+ private static ApplicationProperties readConfig(final InputStream configStream) throws IOException
{
try
{
@@ -478,7 +479,7 @@
*
* @param localBusProperties Bus configuration properties.
*/
- private void connectCoordinationListener(Properties localBusProperties) throws JMSException
+ private void connectCoordinationListener(final Properties localBusProperties)
{
String coordinationTopicName = localBusProperties.getProperty(DEPLOYMENT_COORDINTATION_TOPIC_KEY, DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
@@ -493,9 +494,9 @@
logger.info("Deployment '" + runtime.getDeploymentName() + "' is not being coordinated with any other local deployment. Turn on deug logging for more details.");
if (logger.isDebugEnabled())
{
- logger.debug("Deployment '" + runtime.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: " + localBusProperties);
+ logger.debug("Deployment '" + runtime.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: " + localBusProperties);
}
}
}
@@ -504,8 +505,9 @@
* Connect the deployment coordination broadcaster.
*
* @param localBusProperties Bus configuration properties.
+ * @throws DeploymentException Failed to connect deployment coordination broadcaster.
*/
- private void connectCoordinationBroadcaster(Properties localBusProperties) throws DeploymentException, JMSException
+ private void connectCoordinationBroadcaster(final Properties localBusProperties) throws DeploymentException
{
String coordinationTopicName = localBusProperties.getProperty(DEPLOYMENT_COORDINTATION_TOPIC_KEY, DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME);
@@ -517,16 +519,16 @@
catch (JMSException e)
{
coordinationBroadcaster = null;
- throw new DeploymentException("Deployment '" + runtime.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: " + localBusProperties, e);
+ throw new DeploymentException("Deployment '" + runtime.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: " + localBusProperties, e);
}
}
/**
* Deployment Monitor.
*/
- public static class DeploymentMonitor
+ public final class DeploymentMonitor
{
/**
@@ -549,7 +551,7 @@
*
* @param serviceSets Deployment Service sets.
*/
- private DeploymentMonitor(DeploymentServiceSets serviceSets)
+ private DeploymentMonitor(final DeploymentServiceSets serviceSets)
{
this.lastHeartbeat = System.currentTimeMillis();
this.serviceSets = serviceSets;
@@ -561,7 +563,7 @@
*
* @return True if the deployment is online, otherwise false.
*/
- public final boolean isOnline()
+ public boolean isOnline()
{
return online;
}
@@ -571,7 +573,7 @@
*
* @return The DeploymentServiceSets.
*/
- public final DeploymentServiceSets getServiceSets()
+ public DeploymentServiceSets getServiceSets()
{
return serviceSets;
}
@@ -590,7 +592,7 @@
/**
* Initialize the shared JMS Sessions.
- *
+ *
* @param localBusProperties Local JMS Bus properties.
*/
private void intialiseJMSSessions(final ApplicationProperties localBusProperties)
@@ -624,17 +626,17 @@
private void closeJMSSessions()
{
// Close the sessions...
- if(topicSession != null)
+ if (topicSession != null)
{
- if(topicSession.isConnected())
+ if (topicSession.isConnected())
{
topicSession.close();
}
topicSession = null;
}
- if(queueSession != null)
+ if (queueSession != null)
{
- if(queueSession.isConnected())
+ if (queueSession.isConnected())
{
queueSession.close();
}
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/JMSBusDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/JMSBusDispatcher.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/JMSBusDispatcher.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -1,36 +0,0 @@
-/*
- * 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.bus;
-
-import org.jboss.esb.routing.MessageDispatcher;
-import org.jboss.esb.routing.RoutingException;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.context.InvocationContext;
-
-/**
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JMSBusDispatcher implements MessageDispatcher
-{
- public void dispatch(Message message, InvocationContext invocationContext) throws RoutingException
- {
- }
-}
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBusDispatcher.java (from rev 22680, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/JMSBusDispatcher.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBusDispatcher.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBusDispatcher.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -0,0 +1,46 @@
+/*
+ * 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.bus.jms;
+
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+
+/**
+ * JMS Bus Dispatcher.
+ * <p/>
+ * Dispatches a message from a JMS Bus to a Service or OutboundRouter.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JMSBusDispatcher implements MessageDispatcher
+{
+ /**
+ * Dispatch the message from the Bus.
+ * @param message The message.
+ * @param invocationContext Message invocation context.
+ * @throws RoutingException Dispatch failure.
+ */
+ public final void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
+ {
+ // TODO...
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBusDispatcher.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html (from rev 22680, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/package.html 2008-09-11 12:10:16 UTC (rev 22681)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+JMS Bus.
+
+<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/bus/jms/package.html
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -23,7 +23,7 @@
/**
* Deployment notification base type.
- *
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public abstract class AbstractDeploymentNotification implements Serializable
@@ -39,6 +39,7 @@
/**
* Get the deployment name.
+ *
* @return The deployment name.
*/
public final String getName()
@@ -48,6 +49,7 @@
/**
* Set the deployment name.
+ *
* @param name The deployment name.
*/
public final void setName(final String name)
@@ -57,6 +59,7 @@
/**
* Get the deployment ID.
+ *
* @return The deployment ID.
*/
public final String getId()
@@ -66,6 +69,7 @@
/**
* Set the deployment ID.
+ *
* @param id The deployment ID.
*/
public final void setId(final String id)
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -42,24 +42,27 @@
/**
* Get the Deployment Service Sets.
+ *
* @return The Deployment Service Sets.
*/
- public DeploymentServiceSets getServiceSet()
+ public final DeploymentServiceSets getServiceSet()
{
return serviceSet;
}
/**
* Set the Deployment Service Sets.
+ *
* @param serviceSet The Deployment Service Sets.
*/
- public void setServiceSet(DeploymentServiceSets serviceSet)
+ public final void setServiceSet(final DeploymentServiceSets serviceSet)
{
this.serviceSet = serviceSet;
}
/**
* DeploymentRuntime to DeploymentDetailsNotification helper method.
+ *
* @param runtime The DeploymentRuntime instance.
* @return The DeploymentDetailsNotification instance.
*/
@@ -75,16 +78,16 @@
List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
for (DeploymentUnit deploymentUnit : deploymentUnits)
{
- if(deploymentUnit.getServices() != null)
+ if (deploymentUnit.getServices() != null)
{
notification.serviceSet.getServices().addAll(deploymentUnit.getServices().keySet());
}
- if(deploymentUnit.getOutboundRouters() != null)
+ if (deploymentUnit.getOutboundRouters() != null)
{
notification.serviceSet.getOutboundRoutedServices().addAll(deploymentUnit.getOutboundRouters().keySet());
}
}
-
+
return notification;
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -26,14 +26,15 @@
* <p/>
* Used to signal to other deployments that a particular deployment is still
* running.
- *
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class DeploymentHeartbeatNotification extends AbstractDeploymentNotification
-{
+{
/**
* DeploymentRuntime to DeploymentHeartbeatNotification helper method.
+ *
* @param runtime The DeploymentRuntime instance.
* @return The DeploymentHeartbeatNotification instance.
*/
Modified: labs/jbossesb/workspace/skeagh/testutil/src/main/java/org/jboss/esb/jms/JMSTestRunner.java
===================================================================
--- labs/jbossesb/workspace/skeagh/testutil/src/main/java/org/jboss/esb/jms/JMSTestRunner.java 2008-09-11 10:55:11 UTC (rev 22680)
+++ labs/jbossesb/workspace/skeagh/testutil/src/main/java/org/jboss/esb/jms/JMSTestRunner.java 2008-09-11 12:10:16 UTC (rev 22681)
@@ -35,11 +35,22 @@
*/
public abstract class JMSTestRunner
{
+ /**
+ * Default provider URL.
+ */
public static final String DEFAULT_PROVIDER_URL = "tcp://localhost:61717";
-
+ /**
+ * JNDI properties.
+ */
private Properties jndiProperties;
+ /**
+ * Default JNDI Provider URL.
+ */
private String providerUrl = DEFAULT_PROVIDER_URL;
+ /**
+ * Public constructor.
+ */
public JMSTestRunner()
{
jndiProperties = new Properties();
@@ -47,19 +58,34 @@
jndiProperties.setProperty(Context.PROVIDER_URL, DEFAULT_PROVIDER_URL);
}
- public JMSTestRunner(String providerUrl)
+ /**
+ * Public constructor.
+ *
+ * @param providerUrl Provider URL.
+ */
+ public JMSTestRunner(final String providerUrl)
{
this();
jndiProperties.setProperty(Context.PROVIDER_URL, providerUrl);
this.providerUrl = providerUrl;
}
- public Properties getJndiProperties()
+ /**
+ * Get the JNDI properties in use by this test runner instance.
+ *
+ * @return The JNDI properties.
+ */
+ public final Properties getJndiProperties()
{
return (Properties) jndiProperties.clone();
}
- public void run() throws Exception
+ /**
+ * Run the test.
+ *
+ * @throws Exception Error running test.
+ */
+ public final void run() throws Exception
{
BrokerService broker = new BrokerService();
@@ -69,12 +95,20 @@
broker.start();
- try {
+ try
+ {
test();
- } finally {
+ }
+ finally
+ {
broker.stop();
}
}
+ /**
+ * Test method.
+ *
+ * @throws Exception Test exception.
+ */
public abstract void test() throws Exception;
}
More information about the jboss-svn-commits
mailing list