From 6244fae0aeb2e0986593387ed8fece48fba847fd Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 23 Jul 2014 11:08:05 +0200 Subject: Move openldap files to ldap package Mark execute(ItemProxy, Job) non-public - should not be part of API, Jobs are fixed to a particular Item. Check null on module manager before calling shutdown scripts during close(). Remove auto-generated lines in ObjectProperties --- src/main/java/com/c2kernel/entity/proxy/AgentProxy.java | 2 +- src/main/java/com/c2kernel/process/Gateway.java | 3 ++- src/main/java/com/c2kernel/utils/ObjectProperties.java | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/com') 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/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) { -- cgit v1.2.3 From 650b3ce0a90c4b764f94f46ea8c8dfc5e14a4469 Mon Sep 17 00:00:00 2001 From: ogattaz Date: Thu, 24 Jul 2014 15:37:48 +0200 Subject: Modification of the management of the Logger during the reading of the starting arguments --- .../java/com/c2kernel/process/AbstractMain.java | 75 +++++++++++++++++++--- 1 file changed, 65 insertions(+), 10 deletions(-) (limited to 'src/main/java/com') 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 \n" + + " [-connect ] (or LocalCentre in conf)\n" + + " [-h] [-help] \n" + " [-logLevel 0-19] \n" + + " [-logFile ]" + + " [-noNewLogStream ]"; + } + + + + /************************************************************************** + * reading and setting input paramaters + ************************************************************************** + * + * Known arguments : + *
    + *
  • logLevel: the log level 0-9 (+10 to have time, +20 to have only one level)
  • + *
  • logFile: the full path of the target log file. if none, the Logstream is the stdOut
  • + *
  • noNewLogStream: if present no new Logstream is added to the logger ( + * considers that the Logger is already configured)
  • + * + *
  • config
  • + *
  • connect
  • + *
  • LocalCentre
  • + *
+ * + * + * @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)); -- cgit v1.2.3