diff options
Diffstat (limited to 'src')
4 files changed, 68 insertions, 14 deletions
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index e5a52f0..173f239 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -92,7 +92,7 @@ public class AgentProxy extends ItemProxy * @param job - the job to execute
* @throws ScriptErrorException
*/
- public String execute(ItemProxy item, Job job)
+ protected String execute(ItemProxy item, Job job)
throws AccessRightsException,
InvalidTransitionException,
ObjectNotFoundException,
diff --git a/src/main/java/com/c2kernel/process/AbstractMain.java b/src/main/java/com/c2kernel/process/AbstractMain.java index 202ae9e..ad21b78 100644 --- a/src/main/java/com/c2kernel/process/AbstractMain.java +++ b/src/main/java/com/c2kernel/process/AbstractMain.java @@ -30,11 +30,55 @@ abstract public class AbstractMain {
public static boolean isServer = false;
private static ShutdownHandler shutdownHandler;
-
-
- /**************************************************************************
- * reading and setting input paramaters
- **************************************************************************/
+
+ public static String MAIN_ARG_NONEWLOGSTREAM = "noNewLogStream";
+ public static String MAIN_ARG_CONFIG = "config";
+ public static String MAIN_ARG_LOGLEVEL = "logLevel";
+ public static String MAIN_ARG_LOGFILE = "logFile";
+ public static String MAIN_ARG_CONNECT = "connect";
+ public static String MAIN_ARG_HELP = "help";
+ public static String MAIN_ARG_HELPSHORT = "h";
+
+ /**
+ *
+ * -noNewLogStream: if present no new Logstream is added to the logger (
+ * considers that the Logger is already configured)
+ *
+ * @return help informations
+ */
+ public static String usageHelp() {
+
+ return "USAGE: com.c2kernel.process.AbstractMain \n"
+ + " -config <server/client config file> \n"
+ + " [-connect <LC connect file> ] (or LocalCentre in conf)\n"
+ + " [-h] [-help] \n" + " [-logLevel 0-19] \n"
+ + " [-logFile <path to log file>]"
+ + " [-noNewLogStream ]";
+ }
+
+
+
+ /**************************************************************************
+ * reading and setting input paramaters
+ **************************************************************************
+ *
+ * Known arguments :
+ * <ul>
+ * <li>logLevel: the log level 0-9 (+10 to have time, +20 to have only one level)</li>
+ * <li>logFile: the full path of the target log file. if none, the Logstream is the stdOut</li>
+ * <li>noNewLogStream: if present no new Logstream is added to the logger (
+ * considers that the Logger is already configured)</li>
+ *
+ * <li>config</li>
+ * <li>connect</li>
+ * <li>LocalCentre</li>
+ * </ul>
+ *
+ *
+ * @param args
+ * @return
+ * @throws BadArgumentsException
+ */
public static Properties readC2KArgs( String[] args ) throws BadArgumentsException {
Properties c2kProps;
Properties argProps = new Properties();
@@ -66,13 +110,24 @@ abstract public class AbstractMain throw new BadArgumentsException("Logfile "+argProps.getProperty("logFile")+" cannot be created");
}
- // Set up log stream
- if (argProps.containsKey("logLevel"))
- logLevel = Integer.parseInt(argProps.getProperty("logLevel"));
- Logger.addLogStream(logStream, logLevel);
- // Dump params if log high enough
+ // if the optional arg "noNewLogStream" isn't present => add a
+ // new LogStream
+ boolean wMustAddNewLogStream = !argProps.contains(MAIN_ARG_NONEWLOGSTREAM);
+ if (wMustAddNewLogStream) {
+
+ // Set up log stream
+ if (argProps.containsKey("logLevel"))
+ logLevel = Integer.parseInt(argProps.getProperty("logLevel"));
+
+ Logger.addLogStream(logStream, logLevel);
+ }
+ Logger.msg(0, String.format(
+ "AbstractMain.readC2KArgs(): New logStream added = [%b]",
+ wMustAddNewLogStream));
+
+ // Dump params if log high enough
if (Logger.doLog(3)) for (Enumeration<?> e = argProps.propertyNames(); e.hasMoreElements();) {
String next = (String)e.nextElement();
System.out.println("AbstractMain: Param "+next+": "+argProps.getProperty(next));
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index adbaeb6..8a34e72 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -281,7 +281,8 @@ public class Gateway public static void close()
{
// run shutdown module scripts
- mModules.runScripts("shutdown");
+ if (mModules != null)
+ mModules.runScripts("shutdown");
// shut down servers if running
if (mCorbaServer != null)
diff --git a/src/main/java/com/c2kernel/utils/ObjectProperties.java b/src/main/java/com/c2kernel/utils/ObjectProperties.java index 731b009..8dacd2c 100644 --- a/src/main/java/com/c2kernel/utils/ObjectProperties.java +++ b/src/main/java/com/c2kernel/utils/ObjectProperties.java @@ -6,12 +6,10 @@ import java.util.Properties; public class ObjectProperties extends Properties {
public ObjectProperties() {
- // TODO Auto-generated constructor stub
}
public ObjectProperties(Properties defaults) {
super(defaults);
- // TODO Auto-generated constructor stub
}
public String getString(String propName) {
|
