From bf343dd62ca1c1610b8b2cc5a1af2879e57e6ff3 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Wed, 17 Jun 2009 09:18:44 +0000 Subject: [PATCH] Restructure HTTP service client git-svn-id: https://svn.argeo.org/slc/trunk@2558 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.slc.it.webapp/pom.xml | 7 + runtime/org.argeo.slc.launcher/pom.xml | 10 +- .../java/org/argeo/slc/cli/Log4jUtils.java | 79 ------- .../java/org/argeo/slc/cli/OsgiLauncher.java | 213 ------------------ .../main/java/org/argeo/slc/cli/SlcMain.java | 160 +++++-------- .../slc/server/client/HttpServicesClient.java | 0 .../server/client/SlcServerHttpClient.java | 14 +- .../impl/AbstractHttpServicesClient.java | 0 .../client/impl/SlcServerHttpClientImpl.java | 0 .../unit/AbstractHttpClientTestCase.java | 0 .../{spring-agent-default.xml => spring.xml} | 0 .../org/argeo/slc/server/client/spring.xml | 0 .../org/argeo/slc/server/HttpServices.java | 15 ++ .../main/java/org/argeo/slc/ant/AntRun.java | 18 +- 14 files changed, 108 insertions(+), 408 deletions(-) delete mode 100644 runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/Log4jUtils.java delete mode 100644 runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/OsgiLauncher.java rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/java/org/argeo/slc/server/client/HttpServicesClient.java (100%) rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java (67%) rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/java/org/argeo/slc/server/client/impl/AbstractHttpServicesClient.java (100%) rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/java/org/argeo/slc/server/client/impl/SlcServerHttpClientImpl.java (100%) rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/java/org/argeo/slc/server/unit/AbstractHttpClientTestCase.java (100%) rename runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/cli/{spring-agent-default.xml => spring.xml} (100%) rename runtime/{org.argeo.slc.server => org.argeo.slc.launcher}/src/main/resources/org/argeo/slc/server/client/spring.xml (100%) create mode 100644 runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/server/HttpServices.java diff --git a/integration-tests/org.argeo.slc.it.webapp/pom.xml b/integration-tests/org.argeo.slc.it.webapp/pom.xml index 88679ee92..f5933836f 100644 --- a/integration-tests/org.argeo.slc.it.webapp/pom.xml +++ b/integration-tests/org.argeo.slc.it.webapp/pom.xml @@ -91,5 +91,12 @@ org.argeo.slc.server org.argeo.slc.ria + + + + org.argeo.slc.runtime + org.argeo.slc.launcher + test + \ No newline at end of file diff --git a/runtime/org.argeo.slc.launcher/pom.xml b/runtime/org.argeo.slc.launcher/pom.xml index 0ca25a959..5663d4542 100644 --- a/runtime/org.argeo.slc.launcher/pom.xml +++ b/runtime/org.argeo.slc.launcher/pom.xml @@ -63,15 +63,19 @@ + + org.argeo.slc.runtime + org.argeo.slc.support.castor + + org.argeo.dep.osgi org.argeo.dep.osgi.commons.cli - org.argeo.slc.dep - org.argeo.slc.dep.agent - ${project.version} + org.eclipse.osgi + org.eclipse.osgi \ No newline at end of file diff --git a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/Log4jUtils.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/Log4jUtils.java deleted file mode 100644 index ba5dd1ff3..000000000 --- a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/Log4jUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.argeo.slc.cli; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.apache.commons.io.IOUtils; -import org.apache.log4j.LogManager; -import org.apache.log4j.PropertyConfigurator; -import org.argeo.slc.SlcException; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.util.ResourceUtils; -import org.springframework.util.SystemPropertyUtils; - -public class Log4jUtils { - - /** - * Configure log4j based on properties, with the following priorities (from - * highest to lowest):
- * 1. System properties
- * 2. configuration file itself - */ - public static void initLog4j(String configuration) { - // clears previous configuration - shutDownLog4j(); - - ClassLoader cl = Log4jUtils.class.getClassLoader(); - Properties properties = new Properties(); - if (configuration != null) { - InputStream in = null; - try { - if (configuration - .startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) { - String path = configuration - .substring(ResourceUtils.CLASSPATH_URL_PREFIX - .length()); - in = cl.getResourceAsStream(path); - } else { - in = new DefaultResourceLoader(cl).getResource( - configuration).getInputStream(); - } - - properties.load(in); - } catch (IOException e) { - throw new SlcException("Cannot load properties from " - + configuration); - } finally { - IOUtils.closeQuietly(in); - } - } - - // Overrides with System properties - overrideLog4jProperties(properties, System.getProperties()); - - PropertyConfigurator.configure(properties); - } - - private static void overrideLog4jProperties(Properties target, - Properties additional) { - for (Object obj : additional.keySet()) { - String key = obj.toString(); - if (key.startsWith("log4j.")) { - if (!key.equals("log4j.configuration")) { - String value = SystemPropertyUtils - .resolvePlaceholders(additional.getProperty(key)); - target.put(key, value); - } - } - } - } - - public static void shutDownLog4j() { - LogManager.shutdown(); - } - - private Log4jUtils() { - - } -} diff --git a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/OsgiLauncher.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/OsgiLauncher.java deleted file mode 100644 index f9d3ef0d7..000000000 --- a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/OsgiLauncher.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.argeo.slc.cli; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.adaptor.EclipseStarter; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; - -public class OsgiLauncher { - public final static String PROP_SLC_OSGI_EQUINOX_ARGS = "slc.osgi.equinox.args"; - public final static String PROP_SLC_OSGI_START = "slc.osgi.start"; - - public static void main(String[] args) { - try { - String baseUrl = args[0]; - String config = args[1]; - - List mavenFiles = new ArrayList(); - BufferedReader in = new BufferedReader(new FileReader(config)); - String line = null; - while ((line = in.readLine()) != null) { - try { - line = line.trim(); - if (line.equals("") - || line - .startsWith("The following files have been resolved:")) - continue;// skip - - mavenFiles.add(convert(line)); - } catch (Exception e) { - System.err.println("Could not load line " + line); - } - } - - List urls = asUrls(baseUrl, mavenFiles); - - // Start Equinox - File baseDir = new File(System.getProperty("user.dir")) - .getCanonicalFile(); - String equinoxConfigurationPath = baseDir.getPath() - + File.separator + "slc-detached" + File.separator - + "equinoxConfiguration"; - - String equinoxArgsLineDefault = "-console -noExit -clean -debug -configuration " - + equinoxConfigurationPath; - String equinoxArgsLine = System.getProperty( - PROP_SLC_OSGI_EQUINOX_ARGS, equinoxArgsLineDefault); - String[] equinoxArgs = equinoxArgsLine.split(" "); - - BundleContext bundleContext = EclipseStarter.startup(equinoxArgs, - null); - - Map installedBundles = getInstalledBundles(bundleContext); - for (String url : urls) { - try { - - if (installedBundles.containsKey(url)) { - Bundle bundle = installedBundles.get(url); - // bundle.update(); - info("Bundle " + bundle.getSymbolicName() - + " already installed from " + url); - } else { - Bundle bundle = bundleContext.installBundle(url); - info("Installed bundle " + bundle.getSymbolicName() - + " from " + url); - } - } catch (BundleException e) { - warn("Could not install bundle from " + url + ": " - + e.getMessage()); - } - } - - String bundlesToStart = System.getProperty(PROP_SLC_OSGI_START, - "org.springframework.osgi.extender"); - StringTokenizer st = new StringTokenizer(bundlesToStart, ","); - Map bundles = getBundles(bundleContext); - while (st.hasMoreTokens()) { - String name = st.nextToken().trim(); - Bundle bundle = bundles.get(name); - bundle.start(); - - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - protected static Map getInstalledBundles( - BundleContext bundleContext) { - Map installedBundles = new HashMap(); - for (Bundle bundle : bundleContext.getBundles()) - installedBundles.put(bundle.getLocation(), bundle); - return installedBundles; - } - - protected static Map getBundles(BundleContext bundleContext) { - Map installedBundles = new HashMap(); - for (Bundle bundle : bundleContext.getBundles()) - installedBundles.put(bundle.getSymbolicName(), bundle); - return installedBundles; - } - - protected static List asUrls(String baseUrl, - List mavenFiles) { - List urls = new ArrayList(); - for (MavenFile mf : mavenFiles) - urls.add(convertToUrl(baseUrl, mf)); - return urls; - } - - protected static String convertToUrl(String baseUrl, MavenFile mf) { - return baseUrl + mf.getGroupId().replace('.', '/') + '/' - + mf.getArtifactId() + '/' + mf.getVersion() + '/' - + mf.getArtifactId() + '-' + mf.getVersion() + '.' - + mf.getType(); - } - - protected static MavenFile convert(String str) { - StringTokenizer st = new StringTokenizer(str, ":"); - MavenFile component = new MavenFile(); - component.setGroupId(st.nextToken()); - component.setArtifactId(st.nextToken()); - component.setType(st.nextToken()); - component.setVersion(st.nextToken()); - component.setScope(st.nextToken()); - return component; - } - - private static void info(Object obj) { - System.out.println("[INFO] " + obj); - } - - private static void warn(Object obj) { - System.err.println("[WARN] " + obj); - } - - static class MavenFile { - private String groupId; - private String artifactId; - private String version; - private String type; - private String classifier; - private String scope; - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - private String distributionId; - - public String getDistributionId() { - return distributionId; - } - - public void setDistributionId(String distributionId) { - this.distributionId = distributionId; - } - - public String getGroupId() { - return groupId; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getClassifier() { - return classifier; - } - - public void setClassifier(String classifier) { - this.classifier = classifier; - } - - } - -} diff --git a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/SlcMain.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/SlcMain.java index 946099eae..14fad229b 100644 --- a/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/SlcMain.java +++ b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/cli/SlcMain.java @@ -12,29 +12,23 @@ import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.slc.SlcException; -import org.argeo.slc.runtime.SlcExecutionContext; -import org.argeo.slc.runtime.SlcRuntime; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; +import org.argeo.slc.server.client.SlcServerHttpClient; +import org.argeo.slc.server.client.impl.SlcServerHttpClientImpl; public class SlcMain { - public enum Mode { - single, agent, osgi + public enum Type { + standalone, agent, server } - private static Log log = null; + private static Boolean debug = true; private final static String BOOTSTRAP_LOG4J_CONFIG = "org/argeo/slc/cli/bootstrapLog4j.properties"; private final static String DEFAULT_AGENT_CONTEXT = "classpath:org/argeo/slc/cli/spring-agent-default.xml"; - private final static Option modeOpt = OptionBuilder.withLongOpt("mode") + private final static Option typeOpt = OptionBuilder.withLongOpt("mode") .withArgName("mode").hasArg().withDescription( - "SLC execution mode, one of: " + listModeValues()).create( - 'm'); + "Execution type, one of: " + listTypeValues()).create('t'); private final static Option propertyOpt = OptionBuilder.withLongOpt( "property").withArgName("prop1=val1,prop2=val2").hasArgs() @@ -46,18 +40,17 @@ public class SlcMain { .withValueSeparator(',').withDescription( "load properties from file (-p has priority)").create('P'); - private final static Option scriptOpt = OptionBuilder.withLongOpt("script") - .withArgName("script").hasArg().withDescription( - "SLC script to execute").create('s'); + private final static Option moduleOpt = OptionBuilder.withLongOpt("module") + .withArgName("module").hasArg().withDescription("Execution module") + .create('m'); - private final static Option targetsOpt = OptionBuilder.withLongOpt( - "targets").withArgName("targets").hasArg().withDescription( - "Targets to execute").create('t'); + private final static Option flowsOpt = OptionBuilder.withLongOpt("flows") + .withArgName("flows").hasArg().withDescription("Flows to execute") + .create('f'); private final static Option runtimeOpt = OptionBuilder.withLongOpt( "runtime").withArgName("runtime").hasArg().withDescription( - "Runtime to use, either a full path or relative to slc app conf dir: " - + "/runtime//.xml").create('r'); + "Runtime URL").create('r'); private final static Options options; @@ -65,20 +58,20 @@ public class SlcMain { static { options = new Options(); - options.addOption(modeOpt); - options.addOption(scriptOpt); - options.addOption(targetsOpt); + options.addOption(typeOpt); + options.addOption(moduleOpt); + options.addOption(flowsOpt); options.addOption(propertyOpt); options.addOption(propertiesOpt); options.addOption(runtimeOpt); } public static void main(String[] args) { - Mode mode = null; + Type type = null; Properties properties = new Properties(); - String script = null; - String targets = null; - String runtimeStr = null; + String module = null; + String flows = null; + String urlStr = null; try { @@ -86,29 +79,29 @@ public class SlcMain { CommandLine cl = clParser.parse(options, args); // Mode - String modeStr = cl.getOptionValue(modeOpt.getOpt()); - if (modeStr == null) { - mode = Mode.single; + String typeStr = cl.getOptionValue(typeOpt.getOpt()); + if (typeStr == null) { + type = Type.standalone; } else { try { - mode = Mode.valueOf(modeStr); + type = Type.valueOf(typeStr); } catch (IllegalArgumentException e) { - throw new SlcException("Unrecognized mode '" + modeStr + throw new SlcException("Unrecognized mode '" + typeStr + "'", e); } } // Script - if (mode.equals(Mode.single)) { - if (!cl.hasOption(scriptOpt.getOpt())) - throw new SlcException("Mode " + Mode.single - + " requires option '" + scriptOpt.getLongOpt() + if (type.equals(Type.standalone)) { + if (!cl.hasOption(moduleOpt.getOpt())) + throw new SlcException("Type " + Type.standalone + + " requires option '" + moduleOpt.getLongOpt() + "'"); - script = cl.getOptionValue(scriptOpt.getOpt()); + module = cl.getOptionValue(moduleOpt.getOpt()); // Targets - if (cl.hasOption(targetsOpt.getOpt())) - targets = cl.getOptionValue(targetsOpt.getOpt()); + if (cl.hasOption(flowsOpt.getOpt())) + flows = cl.getOptionValue(flowsOpt.getOpt()); } // Properties @@ -126,7 +119,7 @@ public class SlcMain { // Runtime if (cl.hasOption(runtimeOpt.getOpt())) { - runtimeStr = cl.getOptionValue(runtimeOpt.getOpt()); + urlStr = cl.getOptionValue(runtimeOpt.getOpt()); } } catch (ParseException e) { System.err.println("Problem with command line arguments. " @@ -141,52 +134,27 @@ public class SlcMain { badExit(); } - // 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); + 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); } - // 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 runtime = (SlcRuntime) 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); - } + // Standalone + if (type.equals(Type.standalone)) { } // Agent - else if (mode.equals(Mode.agent)) { - final ConfigurableApplicationContext applicationContext; - if (runtimeStr == null) { - applicationContext = new ClassPathXmlApplicationContext( - DEFAULT_AGENT_CONTEXT); - } else { - applicationContext = new FileSystemXmlApplicationContext( - runtimeStr); - } - applicationContext.registerShutdownHook(); - applicationContext.start(); - log.info("SLC Agent context started."); + else if (type.equals(Type.agent)) { } - // OSGi - else if (mode.equals(Mode.osgi)) { + // Server + else if (type.equals(Type.server)) { + SlcServerHttpClientImpl slcServerHttpClient = new SlcServerHttpClientImpl(); + slcServerHttpClient.setBaseUrl(urlStr); } } @@ -194,9 +162,9 @@ public class SlcMain { new HelpFormatter().printHelp(commandName, options, true); } - private static String listModeValues() { + private static String listTypeValues() { StringBuffer buf = new StringBuffer(""); - for (Mode mode : Mode.values()) { + for (Type mode : Type.values()) { buf.append(mode).append(", "); } String str = buf.toString(); @@ -233,24 +201,16 @@ public class SlcMain { } } - private static void initLogging(Properties userProperties) { - System.setProperty("log4j.defaultInitOverride", "true"); - - // Add log4j user properties to System properties - for (Object obj : userProperties.keySet()) { - String key = obj.toString(); - if (key.startsWith("log4j.")) { - System.setProperty(key, userProperties.getProperty(key)); - } - } - Log4jUtils.initLog4j(System.getProperty("log4j.configuration", - "classpath:" + BOOTSTRAP_LOG4J_CONFIG)); - log = LogFactory.getLog(SlcMain.class); - - } - private static void badExit() { printUsage(); System.exit(1); } + + protected static void info(Object msg) { + System.out.println(msg); + } + + protected static void debug(Object msg) { + System.out.println(msg); + } } diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/HttpServicesClient.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/HttpServicesClient.java similarity index 100% rename from runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/HttpServicesClient.java rename to runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/HttpServicesClient.java diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java similarity index 67% rename from runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java rename to runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java index 59c49b0f6..52e9c8dda 100644 --- a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java +++ b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/SlcServerHttpClient.java @@ -9,20 +9,10 @@ import org.argeo.slc.msg.event.SlcEvent; import org.argeo.slc.process.RealizedFlow; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.runtime.SlcAgentDescriptor; +import org.argeo.slc.server.HttpServices; /** Abstraction of the access to HTTP services of an SLC Server. */ -public interface SlcServerHttpClient extends HttpServicesClient { - public final static String LIST_AGENTS = "listAgents.service"; - public final static String IS_SERVER_READY = "isServerReady.service"; - public final static String NEW_SLC_EXECUTION = "newSlcExecution.service"; - public final static String LIST_SLC_EXECUTIONS = "listSlcExecutions.service"; - public final static String GET_MODULE_DESCRIPTOR = "getExecutionDescriptor.service"; - public final static String LIST_MODULE_DESCRIPTORS = "listModulesDescriptors.service"; - public final static String LIST_RESULTS = "listResults.service"; - public final static String ADD_EVENT_LISTENER = "addEventListener.service"; - public final static String REMOVE_EVENT_LISTENER = "removeEventListener.service"; - public final static String POLL_EVENT = "pollEvent.service"; - +public interface SlcServerHttpClient extends HttpServicesClient,HttpServices { /** Wait for the provided SlcExecution to be finished. */ public void waitForSlcExecutionFinished(SlcExecution slcExecution, Long timeout); diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/impl/AbstractHttpServicesClient.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/impl/AbstractHttpServicesClient.java similarity index 100% rename from runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/impl/AbstractHttpServicesClient.java rename to runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/impl/AbstractHttpServicesClient.java diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/impl/SlcServerHttpClientImpl.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/impl/SlcServerHttpClientImpl.java similarity index 100% rename from runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/client/impl/SlcServerHttpClientImpl.java rename to runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/client/impl/SlcServerHttpClientImpl.java diff --git a/runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/unit/AbstractHttpClientTestCase.java b/runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/unit/AbstractHttpClientTestCase.java similarity index 100% rename from runtime/org.argeo.slc.server/src/main/java/org/argeo/slc/server/unit/AbstractHttpClientTestCase.java rename to runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/server/unit/AbstractHttpClientTestCase.java diff --git a/runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/cli/spring-agent-default.xml b/runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/cli/spring.xml similarity index 100% rename from runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/cli/spring-agent-default.xml rename to runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/cli/spring.xml diff --git a/runtime/org.argeo.slc.server/src/main/resources/org/argeo/slc/server/client/spring.xml b/runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/server/client/spring.xml similarity index 100% rename from runtime/org.argeo.slc.server/src/main/resources/org/argeo/slc/server/client/spring.xml rename to runtime/org.argeo.slc.launcher/src/main/resources/org/argeo/slc/server/client/spring.xml diff --git a/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/server/HttpServices.java b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/server/HttpServices.java new file mode 100644 index 000000000..5d32e2c6f --- /dev/null +++ b/runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/server/HttpServices.java @@ -0,0 +1,15 @@ +package org.argeo.slc.server; + +public interface HttpServices { + public final static String LIST_AGENTS = "listAgents.service"; + public final static String IS_SERVER_READY = "isServerReady.service"; + public final static String NEW_SLC_EXECUTION = "newSlcExecution.service"; + public final static String LIST_SLC_EXECUTIONS = "listSlcExecutions.service"; + public final static String GET_MODULE_DESCRIPTOR = "getExecutionDescriptor.service"; + public final static String LIST_MODULE_DESCRIPTORS = "listModulesDescriptors.service"; + public final static String LIST_RESULTS = "listResults.service"; + public final static String ADD_EVENT_LISTENER = "addEventListener.service"; + public final static String REMOVE_EVENT_LISTENER = "removeEventListener.service"; + public final static String POLL_EVENT = "pollEvent.service"; + +} diff --git a/runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/AntRun.java b/runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/AntRun.java index a49c5be1d..d2921f747 100644 --- a/runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/AntRun.java +++ b/runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/AntRun.java @@ -111,7 +111,23 @@ public class AntRun implements Runnable { } public void messageLogged(BuildEvent event) { - log.info(event.getMessage()); + if (event.getPriority() == Project.MSG_DEBUG) { + if (log.isTraceEnabled()) + log.trace(event.getMessage()); + } else if (event.getPriority() == Project.MSG_VERBOSE) { + if (log.isDebugEnabled()) + log.debug(event.getMessage()); + } else if (event.getPriority() == Project.MSG_INFO) { + log.info(event.getMessage()); + + } else if (event.getPriority() == Project.MSG_WARN) { + log.warn(event.getMessage()); + + } else if (event.getPriority() == Project.MSG_ERR) { + log.error(event.getMessage()); + } else { + log.error(event.getMessage()); + } } public void targetFinished(BuildEvent event) { -- 2.39.2