summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-30 15:50:31 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-08-30 15:50:31 -0230
commiteae073a8a99eee7cc01ceb91e200384d8f46ccdf (patch)
treec032e38d8eae681d904daf2feb2b568f4aae4ce5 /java/src
parentbug 2347 - added book demos to python (diff)
downloadice-eae073a8a99eee7cc01ceb91e200384d8f46ccdf.tar.bz2
ice-eae073a8a99eee7cc01ceb91e200384d8f46ccdf.tar.xz
ice-eae073a8a99eee7cc01ceb91e200384d8f46ccdf.zip
bug 2433 - use Ice.Plugin.Logger instead of Ice.LoggerPlugin to load logger from properties
Diffstat (limited to 'java/src')
-rw-r--r--java/src/Ice/PluginManagerI.java100
-rw-r--r--java/src/IceInternal/PropertyNames.java3
2 files changed, 36 insertions, 67 deletions
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index 6453aabe10c..4b6b13d69c7 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -171,7 +171,7 @@ public final class PluginManagerI implements PluginManager
if(hasKey)
{
final String value = (String)plugins.get(key);
- loadPlugin(names[i], value, cmdArgs, false);
+ loadPlugin(names[i], value, cmdArgs);
plugins.remove(key);
}
else
@@ -208,7 +208,7 @@ public final class PluginManagerI implements PluginManager
{
name = name.substring(0, dotPos);
String value = (String)entry.getValue();
- loadPlugin(name, value, cmdArgs, false);
+ loadPlugin(name, value, cmdArgs);
p.remove();
}
else
@@ -234,24 +234,11 @@ public final class PluginManagerI implements PluginManager
value = javaValue;
}
- loadPlugin(name, value, cmdArgs, false);
+ loadPlugin(name, value, cmdArgs);
}
}
//
- // Check for a Logger Plugin
- //
- String loggerStr = properties.getProperty("Ice.LoggerPlugin.java");
- if(loggerStr.length() == 0)
- {
- loggerStr = properties.getProperty("Ice.LoggerPlugin");
- }
- if(loggerStr.length() != 0)
- {
- loadPlugin("Logger", loggerStr, cmdArgs, true);
- }
-
- //
// An application can set Ice.InitPlugins=0 if it wants to postpone
// initialization until after it has interacted directly with the
// plugins.
@@ -263,7 +250,7 @@ public final class PluginManagerI implements PluginManager
}
private void
- loadPlugin(String name, String pluginSpec, StringSeqHolder cmdArgs, boolean isLogger)
+ loadPlugin(String name, String pluginSpec, StringSeqHolder cmdArgs)
{
assert(_communicator != null);
@@ -305,27 +292,18 @@ public final class PluginManagerI implements PluginManager
// Instantiate the class.
//
PluginFactory pluginFactory = null;
- LoggerFactory loggerFactory = null;
try
{
Class c = Class.forName(className);
java.lang.Object obj = c.newInstance();
try
{
- if(isLogger)
- {
- loggerFactory = (LoggerFactory)obj;
- }
- else
- {
- pluginFactory = (PluginFactory)obj;
- }
+ pluginFactory = (PluginFactory)obj;
}
catch(ClassCastException ex)
{
PluginInitializationException e = new PluginInitializationException();
- e.reason = "class " + className + " does not implement " +
- (isLogger ? "Ice.LoggerFactory" : "Ice.PluginFactory");
+ e.reason = "class " + className + " does not implement Ice.PluginFactory";
e.initCause(ex);
throw e;
}
@@ -355,56 +333,48 @@ public final class PluginManagerI implements PluginManager
//
// Invoke the factory.
//
- if(isLogger)
+ Plugin plugin = null;
+ try
{
- try
- {
- _logger = loggerFactory.create(_communicator, args);
- }
- catch(Throwable ex)
- {
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "exception in factory " + className;
- e.initCause(ex);
- throw e;
- }
+ plugin = pluginFactory.create(_communicator, name, args);
+ }
+ catch(PluginInitializationException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "exception in factory " + className;
+ e.initCause(ex);
+ throw e;
+ }
- if(_logger == null)
- {
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "failure in factory " + className;
- throw e;
- }
+ if(plugin == null)
+ {
+ PluginInitializationException e = new PluginInitializationException();
+ e.reason = "failure in factory " + className;
+ throw e;
}
- else
+
+ if(name.equals("Logger"))
{
- Plugin plugin = null;
try
{
- plugin = pluginFactory.create(_communicator, name, args);
- }
- catch(PluginInitializationException ex)
- {
- throw ex;
+ LoggerPlugin loggerPlugin = (LoggerPlugin)plugin;
+ _logger = loggerPlugin.getLogger();
}
- catch(Throwable ex)
+ catch(ClassCastException ex)
{
PluginInitializationException e = new PluginInitializationException();
- e.reason = "exception in factory " + className;
+ e.reason = "Ice.Plugin.Logger does not implement an Ice.LoggerPlugin";
e.initCause(ex);
throw e;
}
-
- if(plugin == null)
- {
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "failure in factory " + className;
- throw e;
- }
-
- _plugins.put(name, plugin);
- _initOrder.add(plugin);
}
+
+ _plugins.put(name, plugin);
+ _initOrder.add(plugin);
}
public Logger
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index 5bfed278b61..18d0c84c56a 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -7,7 +7,7 @@
//
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Aug 20 15:53:16 2007
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Aug 30 13:57:41 2007
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -54,7 +54,6 @@ public final class PropertyNames
new Property("Ice\\.GC\\.Interval", false, null),
new Property("Ice\\.ImplicitContext", false, null),
new Property("Ice\\.InitPlugins", false, null),
- new Property("Ice\\.LoggerPlugin", false, null),
new Property("Ice\\.MessageSizeMax", false, null),
new Property("Ice\\.MonitorConnections", false, null),
new Property("Ice\\.Nohup", false, null),