summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2013-02-13 20:46:52 +0100
committerAndrew Branson <andrew.branson@cern.ch>2013-02-13 20:46:52 +0100
commit538370bda464bf1c51f6bb449f61efe46d7f20f3 (patch)
tree91588197fbc2b50ca9f01ef65e993c12808cc58c /src/main/java/com/c2kernel
parentfa7f9d15e6b8efa1cf10456cd32865355f5337ca (diff)
Removed isServer boolean - implied by AbstractMain.runningAsWrapper
Diffstat (limited to 'src/main/java/com/c2kernel')
-rw-r--r--src/main/java/com/c2kernel/process/Gateway.java6
-rw-r--r--src/main/java/com/c2kernel/process/StandardClient.java12
-rw-r--r--src/main/java/com/c2kernel/process/StandardServer.java4
-rw-r--r--src/main/java/com/c2kernel/process/UserCodeProcess.java2
4 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java
index 1bb451d..70bfb14 100644
--- a/src/main/java/com/c2kernel/process/Gateway.java
+++ b/src/main/java/com/c2kernel/process/Gateway.java
@@ -71,7 +71,7 @@ public class Gateway
* If null, the java system properties are used
* @throws InvalidDataException - invalid properties caused a failure in initialisation
*/
- static public void init(Properties props, boolean isServer) throws InvalidDataException {
+ static public void init(Properties props) throws InvalidDataException {
// Init properties & resources
mC2KProps = new Properties();
@@ -89,7 +89,7 @@ public class Gateway
// init module manager
try {
- mModules = new ModuleManager(ClassLoader.getSystemResources("META-INF/cristal/module.xml"), isServer);
+ mModules = new ModuleManager(ClassLoader.getSystemResources("META-INF/cristal/module.xml"), AbstractMain.runningAsWrapper);
} catch (Exception e) {
Logger.error(e);
throw new InvalidDataException("Could not load module definitions.", "");
@@ -116,7 +116,7 @@ public class Gateway
}
// if client, run module startup scripts. Otherwise bootstrap will do it after all imports
- if (!isServer) mModules.runScripts("startup");
+ if (!AbstractMain.runningAsWrapper) mModules.runScripts("startup");
}
/**
diff --git a/src/main/java/com/c2kernel/process/StandardClient.java b/src/main/java/com/c2kernel/process/StandardClient.java
index c6df6e2..4fa3036 100644
--- a/src/main/java/com/c2kernel/process/StandardClient.java
+++ b/src/main/java/com/c2kernel/process/StandardClient.java
@@ -15,8 +15,18 @@ abstract public class StandardClient extends AbstractMain
{
static public void main(String[] args) throws Exception {
- Gateway.init(readC2KArgs(args), false);
+ Gateway.init(readC2KArgs(args));
//AgentProxy user = Gateway.connect("username", "password");
}
+
+ static public void close() {
+ Gateway.close();
+ // allow waiting threads time to quit
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ }
+ System.exit(0);
+ }
}
diff --git a/src/main/java/com/c2kernel/process/StandardServer.java b/src/main/java/com/c2kernel/process/StandardServer.java
index af432da..546aaa5 100644
--- a/src/main/java/com/c2kernel/process/StandardServer.java
+++ b/src/main/java/com/c2kernel/process/StandardServer.java
@@ -43,7 +43,7 @@ public class StandardServer extends AbstractMain implements WrapperListener
throws Exception
{
// read args and init Gateway
- Gateway.init(readC2KArgs(args), true);
+ Gateway.init(readC2KArgs(args));
// connect to LDAP as root
Gateway.connect();
@@ -79,8 +79,8 @@ public class StandardServer extends AbstractMain implements WrapperListener
}
public static void main(String[] args) {
- server = new StandardServer();
AbstractMain.runningAsWrapper = true;
+ server = new StandardServer();
WrapperManager.start( server, args );
}
diff --git a/src/main/java/com/c2kernel/process/UserCodeProcess.java b/src/main/java/com/c2kernel/process/UserCodeProcess.java
index 2f508bc..1c40194 100644
--- a/src/main/java/com/c2kernel/process/UserCodeProcess.java
+++ b/src/main/java/com/c2kernel/process/UserCodeProcess.java
@@ -212,7 +212,7 @@ public class UserCodeProcess extends StandardClient implements EntityProxyObserv
try
{
- Gateway.init(readC2KArgs(args), false);
+ Gateway.init(readC2KArgs(args));
UserCodeProcess proc = getInstance();
new Thread(proc).start();
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {