[jboss-svn-commits] JBL Code SVN: r22886 - in labs/jbossesb/workspace/skeagh: api/service/src/main/java/org/jboss/esb/invocation and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 18 11:52:44 EDT 2008
Author: tfennelly
Date: 2008-09-18 11:52:44 -0400 (Thu, 18 Sep 2008)
New Revision: 22886
Removed:
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java
Modified:
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
Log:
Got rid of the InvocationParameters type and just using a map instead. Passing the InvocationParameters with the BusMessage now - not passing the InvocationContext.
Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/DeploymentContext.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -106,7 +106,7 @@
* @param key The context key.
* @return The Object bound under the supplied context key, otherwise null.
*/
- public final Object get(final Object key)
+ public final Object getContextObject(final Object key)
{
return contextMap.get(key);
}
@@ -117,7 +117,7 @@
* @param key The context key.
* @param value The value object to be set in the context.
*/
- public final void set(final Object key, final Object value)
+ public final void setContextObject(final Object key, final Object value)
{
contextMap.put(key, value);
}
Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/ESBContext.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -39,7 +39,7 @@
* @return The Object instance, or null if the Object is not bound to the
* context instance.
*/
- Object get(final Object key);
+ Object getContextObject(final Object key);
/**
* Set an object on the context.
@@ -47,7 +47,7 @@
* @param key The context object key.
* @param value The object instance.
*/
- void set(final Object key, final Object value);
+ void setContextObject(final Object key, final Object value);
/**
* Get all the context objects.
Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -19,11 +19,9 @@
*/
package org.jboss.esb.context;
-import org.jboss.esb.invocation.InvocationParameters;
-
+import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.io.Serializable;
/**
* InvocationContext Context.
@@ -42,11 +40,35 @@
*/
private Map<Object, Object> contextMap = new LinkedHashMap<Object, Object>();
/**
+ * Invocation Parameters.
+ */
+ private Map<String, String> invocationParameters = new LinkedHashMap<String, String>();
+ /**
* Context ThreadLocal.
*/
private static ThreadLocal<InvocationContext> contextTL = new ThreadLocal<InvocationContext>();
/**
+ * Public default constructor.
+ */
+ public InvocationContext()
+ {
+ }
+
+ /**
+ * Public constructor.
+ * <p/>
+ * The invocation parameters pass along with the
+ * {@link org.jboss.esb.message.Message}.
+ *
+ * @param invocationParameters The invocation parameters.
+ */
+ public InvocationContext(final Map<String, String> invocationParameters)
+ {
+ this.invocationParameters = invocationParameters;
+ }
+
+ /**
* Set the {@link InvocationContext} associated with the current thread.
*
* @param context The {@link InvocationContext} associated with the current thread.
@@ -80,7 +102,7 @@
* @param key The context key.
* @return The Object bound under the supplied context key, otherwise false.
*/
- public final Object get(final Object key)
+ public final Object getContextObject(final Object key)
{
return contextMap.get(key);
}
@@ -91,7 +113,7 @@
* @param key The context key.
* @param value The value object to be set in the context.
*/
- public final void set(final Object key, final Object value)
+ public final void setContextObject(final Object key, final Object value)
{
contextMap.put(key, value);
}
@@ -107,17 +129,15 @@
}
/**
- * Get the {@link org.jboss.esb.invocation.InvocationParameters} associated with this
- * Invocation.
+ * Get the invocation parameters provided with the initial
+ * service invocation.
* <p/>
- * TODO: Should we have this as a non-static method on this class?
+ * These parameters pass along with the {@link org.jboss.esb.message.Message}
*
- * @return The InvocationParameters instance, or null if no
- * InvocationParameters were sent with the {@link org.jboss.esb.message.Message}
- * during the Service Invocation.
+ * @return The invocation parameters.
*/
- public static InvocationParameters getInvocationParameters()
+ public final Map<String, String> getInvocationParameters()
{
- return null;
+ return invocationParameters;
}
}
Deleted: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/invocation/InvocationParameters.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -1,78 +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.invocation;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Imutable Service Invocation Parameters.
- * <p/>
- * An ESB {@link org.jboss.esb.message.Message} is an integral part of
- * any Service Invocation. That's not the full picture however. Sometimes
- * it is necessary to send "Invocation Parameters" in parallel with the
- * basic ESB {@link org.jboss.esb.message.Message} e.g. parameters that
- * identify a process instance on the target Service.
- * <p/>
- * A Service can access the InvocationParameters instance (associated with the
- * Message it is currently processing) via the
- * {@link org.jboss.esb.context.InvocationContext#getInvocationParameters()} method.
- *
- * @author <a href="mailto:Kevin.Conner at jboss.com">Kevin Conner</a>
- * @author <a href="mailto:tcunning at redhat.com">Tom Cunningham</a>
- * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
- * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
- */
-public class InvocationParameters
-{
-
- /**
- * Invocation Parameters.
- */
- private Map<String, Object> parameters = new LinkedHashMap<String, Object>();
-
- /**
- * Public constructor.
- * @param parameters The invocation parameters.
- */
- public InvocationParameters(final Map<String, Object> parameters)
- {
- this.parameters = parameters;
- }
-
- /**
- * Get the named invocation parameter value.
- * @param name The name of the invocation parameter.
- * @return The invocation parameter value, or null if not specified.
- */
- public final Object getParameter(final String name)
- {
- return parameters.get(name);
- }
-
- /**
- * Get the parameter Map.
- * @return The parameter Map.
- */
- public final Map<String, Object> getParameters()
- {
- return parameters;
- }
-}
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-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsInboundRouter.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -20,27 +20,25 @@
*/
package org.jboss.esb.jms;
-import static org.jboss.esb.jms.JmsConstants.CONNECTION_FACTORY;
-
-import java.util.Properties;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.naming.Context;
-
import org.apache.log4j.Logger;
import org.jboss.esb.annotations.Initialize;
import org.jboss.esb.annotations.Property;
-import org.jboss.esb.annotations.Uninitialize;
import org.jboss.esb.annotations.Property.Use;
+import org.jboss.esb.annotations.Uninitialize;
import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
+import static org.jboss.esb.jms.JmsConstants.CONNECTION_FACTORY;
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.InboundRouter;
import org.jboss.esb.routing.MessageDispatcher;
import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.service.ServiceName;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.naming.Context;
+import java.util.Properties;
+
/**
* Inbound router for JMS.
* <br><br>
@@ -272,8 +270,8 @@
if (extractProperties)
{
Properties properties = JmsInformationExtractor.extractJmsProperties(jmsMessage);
- context.set(JmsConstants.PROPERTIES, properties);
- log.debug(context.get(JmsConstants.PROPERTIES));
+ context.setContextObject(JmsConstants.PROPERTIES, properties);
+ log.debug(context.getContextObject(JmsConstants.PROPERTIES));
}
dispatcher.dispatch(esbMessage, context);
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -59,7 +59,7 @@
}
AddressingContext addressingContext = busMessage.getAddressingContext();
- InvocationContext invocationContext = busMessage.getInvocationContext();
+ InvocationContext invocationContext = new InvocationContext(busMessage.getInvocationParameters());
Message esbMessage = busMessage.getMessage();
AddressingContext.setContext(addressingContext);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -20,10 +20,11 @@
package org.jboss.esb.federate.bus;
import org.jboss.esb.context.AddressingContext;
-import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.message.Message;
import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
* ESB Bus Message.
@@ -36,9 +37,9 @@
public final class BusMessage implements Serializable
{
/**
- * Invocation Context.
+ * Invocation Parameters.
*/
- private InvocationContext invocationContext;
+ private Map<String, String> invocationParameters = new LinkedHashMap<String, String>();
/**
* Addressing Context.
*/
@@ -49,21 +50,29 @@
private Message message;
/**
- * Get the message Invocation Context.
- * @return The message Invocation Context.
+ * Get the invocation parameters provided with the initial
+ * service invocation.
+ * <p/>
+ * These parameters pass along with the {@link org.jboss.esb.message.Message}
+ *
+ * @return The invocation parameters.
*/
- public InvocationContext getInvocationContext()
+ public final Map<String, String> getInvocationParameters()
{
- return invocationContext;
+ return invocationParameters;
}
/**
- * Set the message Invocation Context.
- * @param invocationContext The message Invocation Context.
+ * Set the invocation parameters provided with the initial
+ * service invocation.
+ * <p/>
+ * These parameters pass along with the {@link org.jboss.esb.message.Message}
+ *
+ * @param invocationParameters The invocation parameters.
*/
- public void setInvocationContext(final InvocationContext invocationContext)
+ public void setInvocationParameters(Map<String, String> invocationParameters)
{
- this.invocationContext = invocationContext;
+ this.invocationParameters = invocationParameters;
}
/**
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-09-18 15:41:00 UTC (rev 22885)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-09-18 15:52:44 UTC (rev 22886)
@@ -81,7 +81,7 @@
// Package up the message for shiping over the bus...
BusMessage busMessage = new BusMessage();
busMessage.setAddressingContext(addressingContext);
- busMessage.setInvocationContext(InvocationContext.getContext());
+ busMessage.setInvocationParameters(InvocationContext.getContext().getInvocationParameters());
busMessage.setMessage(message);
boolean localServiceApplied = (from != null && from.equals(serviceName));
More information about the jboss-svn-commits
mailing list