summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorogattaz <olivier@gattaz.com>2014-07-24 15:57:16 +0200
committerogattaz <olivier@gattaz.com>2014-07-24 15:57:16 +0200
commitb9d5ea3901f175b8e9819a896b99a88178e2987e (patch)
treeb7a198d72ff92647cce7975af04709191a4149f1
parente5e52bc8ae094192f9a4bd24af6f31b8c19c48f7 (diff)
parent650b3ce0a90c4b764f94f46ea8c8dfc5e14a4469 (diff)
Merge branch 'master' of ssh://dev.cccs.uwe.ac.uk:22/var/git/cristal-kernel
-rw-r--r--bin/openldap/README5
-rw-r--r--bin/openldap/cristal.schema37
-rw-r--r--bin/openldap/slapd.conf13
-rw-r--r--src/main/java/com/c2kernel/entity/proxy/AgentProxy.java2
-rw-r--r--src/main/java/com/c2kernel/process/AbstractMain.java75
-rw-r--r--src/main/java/com/c2kernel/process/Gateway.java3
-rw-r--r--src/main/java/com/c2kernel/utils/ObjectProperties.java2
7 files changed, 68 insertions, 69 deletions
diff --git a/bin/openldap/README b/bin/openldap/README
deleted file mode 100644
index daa0b9c..0000000
--- a/bin/openldap/README
+++ /dev/null
@@ -1,5 +0,0 @@
-cristal2.schema goes in OpenLDAP/schemas, or change the include line to point to it here.
-
-edit your slapd.conf to include it.
-edit the suffix and rootdn and rootpass
-use this slapd to help you
diff --git a/bin/openldap/cristal.schema b/bin/openldap/cristal.schema
deleted file mode 100644
index 495c576..0000000
--- a/bin/openldap/cristal.schema
+++ /dev/null
@@ -1,37 +0,0 @@
-attributetype ( 1.3.6.1.4.1.96.64.10.1 NAME 'intsyskey'
- EQUALITY integerMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
-
-attributetype ( 1.3.6.1.4.1.96.64.10.6 NAME 'ior'
- EQUALITY caseIgnoreMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
- SINGLE-VALUE )
-
-attributetype ( 1.3.6.1.4.1.96.64.10.7 NAME 'cristalprop'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
-
-objectclass ( 1.3.6.1.4.1.96.64.10.10 NAME 'cristalentity' SUP top STRUCTURAL
- MUST ( cn $ objectclass )
- MAY ( intsyskey $ ior $ cristalprop ) )
-
-objectclass ( 1.3.6.1.4.1.96.64.10.13 NAME 'cristalcontext' SUP top STRUCTURAL
- MUST ( cn $ objectclass )
- MAY ( intsyskey ) )
-
-objectclass ( 1.3.6.1.4.1.96.64.10.15 NAME 'aliasObject' SUP alias STRUCTURAL
- MUST ( cn $ objectclass $ aliasedObjectName ) )
-
-# agent
-attributetype ( 1.3.6.1.4.1.96.64.10.8 NAME 'jobList'
- EQUALITY booleanMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )
-
- # uid must store userName if agent (for authentication to work)
-objectclass ( 1.3.6.1.4.1.96.64.10.14 NAME 'cristalagent' SUP cristalentity STRUCTURAL
- MUST ( userPassword $ uid ) )
-
-objectclass ( 1.3.6.1.4.1.96.64.10.16 NAME 'cristalrole' SUP cristalentity STRUCTURAL
- MAY ( jobList $ uniqueMember ) )
-
diff --git a/bin/openldap/slapd.conf b/bin/openldap/slapd.conf
deleted file mode 100644
index ebf42df..0000000
--- a/bin/openldap/slapd.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-include /etc/openldap/schema/core.schema
-include cristal-kernel/bin/openldap/cristal.schema
-pidfile /var/run/slapd/slapd.pid
-argsfile /var/run/slapd/slapd.args
-
-moduleload back_bdb.la
-
-database bdb
-suffix "o=cern,c=ch"
-rootdn "cn=admin,o=cern,c=ch"
-rootpw cristal
-index objectClass eq
-index cn eq,pres,sub
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) {