- // Initializes logging and log arguments
- initLogging(properties);
- if (log.isDebugEnabled()) {
- log.debug("Mode: " + mode);
- if (runtimeStr != null)
- log.debug("Runtime: " + runtimeStr);
- log.debug("User properties: " + properties);
- if (script != null)
- log.debug("Script: " + script);
- if (targets != null)
- log.debug("Targets: " + targets);
- }
-
- // Execution
- if (mode.equals(Mode.single)) {
- try {
- // DefaultSlcRuntime runtime = new DefaultSlcRuntime();
- // FIXME: inject this more cleanly
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class clss = cl.loadClass("org.argeo.slc.ant.AntSlcRuntime");
- SlcRuntime<? extends SlcExecutionContext> runtime = (SlcRuntime<? extends SlcExecutionContext>) clss
- .newInstance();
- runtime.executeScript(runtimeStr, script, targets, properties,
- null, null);
- // System.exit(0);
- } catch (Exception e) {
- log.error("SLC client terminated with an error: ", e);
- System.exit(1);
- }
- }
- // Agent
- else if (mode.equals(Mode.agent)) {
- if (runtimeStr == null)
- runtimeStr = "agent.xml";
- final ConfigurableApplicationContext applicationContext = new FileSystemXmlApplicationContext(
- "agent.xml");
- applicationContext.start();
- log.info("SLC Agent context started.");
-
- Thread shutdownHook = new Thread("SLC agent shutdown hook") {
- public void run() {
- applicationContext.stop();
- applicationContext.close();
- log.info("Closed agent application context.");
- }
- };
- Runtime.getRuntime().addShutdownHook(shutdownHook);
-
- while (applicationContext.isActive()) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // silent
- }
- }
- }
+ // if (debug) {
+ // debug("Mode: " + type);
+ // if (urlStr != null)
+ // debug("Runtime: " + urlStr);
+ // debug("User properties: " + properties);
+ // if (module != null)
+ // debug("Module: " + module);
+ // if (flows != null)
+ // debug("Flows: " + flows);
+ // }
+ //
+ // // Standalone
+ // if (type.equals(Type.standalone)) {
+ // }
+ // // Agent
+ // else if (type.equals(Type.agent)) {
+ // }