Author: ron.sigal(a)jboss.com
Date: 2009-04-19 02:22:45 -0400 (Sun, 19 Apr 2009)
New Revision: 5069
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java
Log:
JBREM-1124: Added option for configuration map parameter values to override InvokerLocator
parameter values.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java 2009-04-19
04:35:10 UTC (rev 5068)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/AbstractInvoker.java 2009-04-19
06:22:45 UTC (rev 5069)
@@ -94,12 +94,22 @@
}
this.locator = locator;
- if (configuration != null)
- this.configuration.putAll(configuration);
+ if (checkConfigOverridesLocator(locator, configuration))
+ {
+ if (locator.getParameters() != null)
+ this.configuration.putAll(locator.getParameters());
+
+ if (configuration != null)
+ this.configuration.putAll(configuration);
+ }
+ else
+ {
+ if (configuration != null)
+ this.configuration.putAll(configuration);
- if (locator.getParameters() != null)
- this.configuration.putAll(locator.getParameters());
-
+ if (locator.getParameters() != null)
+ this.configuration.putAll(locator.getParameters());
+ }
try
{
InvokerLocator loaderLocator = MarshallLoaderFactory.convertLocator(locator);
@@ -396,6 +406,44 @@
{
return configuration;
}
+
+ protected boolean checkConfigOverridesLocator(InvokerLocator locator, Map config)
+ {
+ boolean result = false;
+ if (config != null)
+ {
+ Object o = config.get(Remoting.CONFIG_OVERRIDES_LOCATOR);
+ if (o != null)
+ {
+ if (o instanceof String)
+ {
+ result = Boolean.valueOf((String) o).booleanValue();
+ }
+ else
+ {
+ log.warn("value of " + Remoting.CONFIG_OVERRIDES_LOCATOR +
" in configuration Map should be a String instead of: " + o);
+ }
+ }
+ }
+ Map map = locator.parameters;
+ if (map != null)
+ {
+ Object o = map.get(Remoting.CONFIG_OVERRIDES_LOCATOR);
+ if (o != null)
+ {
+ if (o instanceof String)
+ {
+ result = Boolean.valueOf((String) o).booleanValue();
+ }
+ else
+ {
+ log.warn("value of " + Remoting.CONFIG_OVERRIDES_LOCATOR +
" in " + locator + " should be a String");
+ }
+ }
+ }
+
+ return result;
+ }
static public SocketFactory wrapSocketFactory(SocketFactory socketFactory, Map
config)
{
Show replies by date