<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="output" path="bin"/>
</plugins>
</build>
<dependencies>
- <!--
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- -->
-
- <!-- OSGi
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.0</version>
- </dependency>
- -->
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
<version>2.0.8</version>
</dependency>
-
+ <dependency>
+ <groupId>org.codehaus.castor</groupId>
+ <artifactId>castor</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
+++ /dev/null
-package org.argeo.slc.autoui;
-
-import java.net.URL;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.UrlResource;
-
-public class AbstractAutoActivator implements BundleActivator {
- private AbstractApplicationContext applicationContext;
-
- public final void start(BundleContext context) throws Exception {
- ClassLoader classLoader = getClass().getClassLoader();
-
- Thread cur = Thread.currentThread();
- ClassLoader save = cur.getContextClassLoader();
- cur.setContextClassLoader(classLoader);
-
- try {
- // applicationContext = new ClassPathXmlApplicationContext(
- // "/slc/conf/applicationContext.xml");
-
- applicationContext = new GenericApplicationContext();
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
- (BeanDefinitionRegistry) applicationContext);
- Bundle bundle = context.getBundle();
-
- URL url = bundle
- .getResource("META-INF/slc/conf/applicationContext.xml");
- if (url != null) {
- System.out.println("Loads application context from bundle "
- + bundle.getSymbolicName() + " (url=" + url + ")");
- xmlReader.loadBeanDefinitions(new UrlResource(url));
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new Exception("Could not initialize application context");
- } finally {
- cur.setContextClassLoader(save);
- }
-
- startAutoBundle(context);
- }
-
- /** Does nothing by default. */
- protected void startAutoBundle(BundleContext context) throws Exception {
-
- }
-
- public final void stop(BundleContext context) throws Exception {
- stopAutoBundle(context);
-
- if (applicationContext != null) {
- applicationContext.close();
- }
-
- }
-
- /** Does nothing by default. */
- protected void stopAutoBundle(BundleContext context) throws Exception {
-
- }
-
- public Object getStaticRef(String id) {
- return applicationContext.getBean(id);
- }
-
-}
--- /dev/null
+package org.argeo.slc.autoui;
+
+import java.net.URL;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.UrlResource;
+
+public class AbstractDetachedActivator implements BundleActivator {
+ private AbstractApplicationContext applicationContext;
+
+ public final void start(BundleContext context) throws Exception {
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ Thread cur = Thread.currentThread();
+ ClassLoader save = cur.getContextClassLoader();
+ cur.setContextClassLoader(classLoader);
+
+ try {
+ // applicationContext = new ClassPathXmlApplicationContext(
+ // "/slc/conf/applicationContext.xml");
+
+ applicationContext = new GenericApplicationContext();
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
+ (BeanDefinitionRegistry) applicationContext);
+ Bundle bundle = context.getBundle();
+
+ URL url = bundle
+ .getResource("META-INF/slc/conf/applicationContext.xml");
+ if (url != null) {
+ System.out.println("Loads application context from bundle "
+ + bundle.getSymbolicName() + " (url=" + url + ")");
+ xmlReader.loadBeanDefinitions(new UrlResource(url));
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new Exception("Could not initialize application context");
+ } finally {
+ cur.setContextClassLoader(save);
+ }
+
+ startAutoBundle(context);
+ }
+
+ /** Does nothing by default. */
+ protected void startAutoBundle(BundleContext context) throws Exception {
+
+ }
+
+ public final void stop(BundleContext context) throws Exception {
+ stopAutoBundle(context);
+
+ if (applicationContext != null) {
+ applicationContext.close();
+ }
+
+ }
+
+ /** Does nothing by default. */
+ protected void stopAutoBundle(BundleContext context) throws Exception {
+
+ }
+
+ public Object getStaticRef(String id) {
+ return applicationContext.getBean(id);
+ }
+
+}
+++ /dev/null
-package org.argeo.slc.autoui;
-
-public interface AutoUiApplication {
- public Object execute(Object object) throws Exception;
-}
+++ /dev/null
-package org.argeo.slc.autoui;
-
-public interface AutoUiStep {
- /** Runs synchronously. */
- public void run();
-
- /** Closes and releases the associated resources. */
- public void close();
-
- /**
- * Sets an input parameter. Value can be various Java type and implementors
- * are supposed to document which data types are supported.
- */
- public void setInputParameter(Object key, Object value);
-
- /**
- * Gets an output parameter. Implementors are supposed to convert the
- * returned value to the appropriate data type.
- */
- public Object getOutputParameter(Object key);
-
-}
--- /dev/null
+package org.argeo.slc.autoui;
+
+import java.util.List;
+
+public interface DetachedContext {
+ public Object getDynamicRef(String ref);
+
+ public void setDynamicRef(String ref, Object obj);
+
+ public String getCurrentPath();
+
+ public List getExecutedPaths();
+}
--- /dev/null
+package org.argeo.slc.autoui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Vector;
+
+public class DetachedContextImpl implements DetachedContext {
+ private List executedPaths = new Vector();
+ private String currentPath;
+ private Map dynamicRefs = new TreeMap();
+
+ public String getCurrentPath() {
+ return currentPath;
+ }
+
+ public void setDynamicRef(String ref, Object obj) {
+ dynamicRefs.put(ref, obj);
+ }
+
+ public Object getDynamicRef(String ref) {
+ if (dynamicRefs.containsKey(ref))
+ return dynamicRefs.get(ref);
+ else
+ return null;
+ }
+
+ public List getExecutedPaths() {
+ return new ArrayList(executedPaths);
+ }
+
+}
--- /dev/null
+package org.argeo.slc.autoui;
+
+
+public interface DetachedStep {
+ public DetachedStepAnswer execute(DetachedContext detachedContext,
+ DetachedStepRequest detachedStepRequest);
+}
--- /dev/null
+package org.argeo.slc.autoui;
+
+import java.util.Properties;
+
+public class DetachedStepAnswer {
+ public static int PROCESSED = 0;
+ public static int ERROR = 1;
+ public static int SKIPPED = 2;
+
+ private Properties outputParameters;
+ private int outputStatus;
+ private String log;
+
+ public Properties getOutputParameters() {
+ return outputParameters;
+ }
+
+ public void setOutputParameters(Properties outputParameters) {
+ this.outputParameters = outputParameters;
+ }
+
+ public int getOutputStatus() {
+ return outputStatus;
+ }
+
+ public void setOutputStatus(int outputStatus) {
+ this.outputStatus = outputStatus;
+ }
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
+
+}
--- /dev/null
+package org.argeo.slc.autoui;
+
+import java.util.Properties;
+
+public class DetachedStepRequest {
+ private Properties inputParameters;
+ private String stepRef;
+ private String path;
+}