Author: ron.sigal(a)jboss.com
Date: 2009-03-24 23:56:06 -0400 (Tue, 24 Mar 2009)
New Revision: 4905
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshalFactory.java
Log:
JBREM-1102: getMarshaller() and getUnMarshaller() can look in configuration map as well as
InvokerLocator.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshalFactory.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshalFactory.java 2009-03-25
03:55:11 UTC (rev 4904)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/MarshalFactory.java 2009-03-25
03:56:06 UTC (rev 4905)
@@ -305,11 +305,37 @@
*/
public static Marshaller getMarshaller(InvokerLocator locator, ClassLoader
classLoader)
{
+ return getMarshaller(locator, classLoader, null);
+ }
+
+ /**
+ * Will try to look up marshaller by first looking for data type parameter within
locator and config and then using that
+ * to look up marhsaller locally. If can not find it, will then look to see if can
find the 'marshaller' parameter
+ * within the locator parameters or config parameters. If found, will try to load the
marshaller by the class name specified
+ * as the parameter value. If still can not find the class within the local VM, will
look to see if there is a parameter for
+ * the server's marshaller loader port. If this exists, will then try calling on
the remote server to load the
+ * marshaller (and its related classes) within the local VM. If still can not be
found, will return null.
+ *
+ * @param locator
+ * @param classLoader
+ * @param config
+ * @return
+ */
+ public static Marshaller getMarshaller(InvokerLocator locator, ClassLoader
classLoader, Map config)
+ {
String serializationType = locator.findSerializationType();
Marshaller marshaller = null;
- if(locator != null)
+ if(locator != null || config != null)
{
- Map params = locator.getParameters();
+ Map params = new HashMap();
+ if (locator.getParameters() != null)
+ {
+ params.putAll(locator.getParameters());
+ }
+ if (config != null)
+ {
+ params.putAll(config);
+ }
if(params != null)
{
// start with data type as is prefered method of getting
marshaller/unmarshaller
@@ -430,11 +456,37 @@
*/
public static UnMarshaller getUnMarshaller(InvokerLocator locator, ClassLoader
classLoader)
{
+ return getUnMarshaller(locator, classLoader, null);
+ }
+
+ /**
+ * Will try to look up unmarshaller by first looking for data type parameter within
locator and config map and then using that
+ * to look up unmarshaller locally. If can not find it, will then look to see if can
find the 'unmarshaller' parameter
+ * within the locator parameters or config map. If found, will try to load the
unmarshaller by the class name specified as the
+ * parameter value. If still can not find the class within the local VM, will look to
see if there is a parameter for
+ * the server's marshaller loader port. If this exists, will then try calling on
the remote server to load the
+ * unmarshaller (and its related classes) within the local VM. If still can not be
found, will return null.
+ *
+ * @param locator
+ * @param classLoader
+ * @param config
+ * @return
+ */
+ public static UnMarshaller getUnMarshaller(InvokerLocator locator, ClassLoader
classLoader, Map config)
+ {
String serializationType = locator.findSerializationType();
UnMarshaller unmarshaller = null;
- if(locator != null)
+ if(locator != null || config != null)
{
- Map params = locator.getParameters();
+ Map params = new HashMap();
+ if (locator.getParameters() != null)
+ {
+ params.putAll(locator.getParameters());
+ }
+ if (config != null)
+ {
+ params.putAll(config);
+ }
if(params != null)
{
// start with data type as is prefered method of getting
marshaller/unmarshaller
Show replies by date