From 136445daa700aaf50a0081672df4c124177ab0fa Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sat, 27 Sep 2008 11:40:52 +0000 Subject: [PATCH] Introduce detached execution server. git-svn-id: https://svn.argeo.org/slc/trunk@1645 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/slc/autoui/launcher/Main.java | 17 ++++-- .../slc/autoui/launcher/felix.properties | 4 +- org.argeo.slc.autoui/pom.xml | 2 +- .../slc/autoui/AbstractDetachedActivator.java | 23 +++++--- .../org/argeo/slc/autoui/AutoUiActivator.java | 31 +++++++--- .../org/argeo/slc/autoui/DetachedDriver.java | 6 ++ .../argeo/slc/autoui/DetachedException.java | 14 +++++ .../slc/autoui/DetachedExecutionServer.java | 5 ++ .../argeo/slc/autoui/DetachedStepRequest.java | 24 ++++++++ .../slc/autoui/SpringStaticRefProvider.java | 26 +++++++++ .../argeo/slc/autoui/StaticRefProvider.java | 6 ++ .../internal/DetachedExecutionServerImpl.java | 58 +++++++++++++++++++ .../src/main/resources/META-INF/MANIFEST.MF | 28 +++++++++ .../META-INF/slc/conf/applicationContext.xml | 10 ++++ sandbox/argeo.slc.jemmytest/.classpath | 1 + sandbox/argeo.slc.jemmytest/pom.xml | 6 +- .../org/argeo/slc/jemmytest/DummyStep.java | 6 +- .../slc/jemmytest/JemmyTestActivator.java | 21 ++++--- .../src/main/resources/META-INF/MANIFEST.MF | 18 ++++++ .../META-INF/slc/conf/applicationContext.xml | 12 ++++ .../META-INF/slc/conf/common/import.xml | 10 ++++ 21 files changed, 290 insertions(+), 38 deletions(-) create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedDriver.java create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedException.java create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedExecutionServer.java create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/SpringStaticRefProvider.java create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/StaticRefProvider.java create mode 100644 org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/DetachedExecutionServerImpl.java create mode 100644 org.argeo.slc.autoui/src/main/resources/META-INF/MANIFEST.MF create mode 100644 org.argeo.slc.autoui/src/main/resources/META-INF/slc/conf/applicationContext.xml create mode 100644 sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/MANIFEST.MF create mode 100644 sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/applicationContext.xml create mode 100644 sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/common/import.xml diff --git a/org.argeo.slc.autoui.launcher/src/main/java/org/argeo/slc/autoui/launcher/Main.java b/org.argeo.slc.autoui.launcher/src/main/java/org/argeo/slc/autoui/launcher/Main.java index 0aa79afa3..73d628be3 100644 --- a/org.argeo.slc.autoui.launcher/src/main/java/org/argeo/slc/autoui/launcher/Main.java +++ b/org.argeo.slc.autoui.launcher/src/main/java/org/argeo/slc/autoui/launcher/Main.java @@ -10,15 +10,20 @@ import java.util.List; import java.util.Properties; import java.util.Vector; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.felix.framework.Felix; import org.apache.felix.framework.cache.BundleCache; import org.apache.felix.main.AutoActivator; import org.argeo.slc.autoui.AutoUiActivator; +import org.argeo.slc.autoui.DetachedExecutionServer; import org.argeo.slc.autoui.DetachedStep; +import org.argeo.slc.autoui.DetachedStepRequest; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; public class Main { + private final static Log log = LogFactory.getLog(Main.class); public static void main(String[] args) { try { @@ -34,7 +39,7 @@ public class Main { // Automate automateUi(felix.getBundleContext()); - felix.stop(); + // felix.stop(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); @@ -116,12 +121,14 @@ public class Main { throws Exception { // Retrieve service and execute it ServiceReference ref = bundleContext - .getServiceReference("org.argeo.slc.autoui.DetachedStep"); + .getServiceReference(DetachedExecutionServer.class.getName()); Object service = bundleContext.getService(ref); - AutoUiActivator.stdOut("service.class=" + service.getClass()); - DetachedStep app = (DetachedStep) service; - app.execute(null, null); + log.debug("service.class=" + service.getClass()); + DetachedExecutionServer app = (DetachedExecutionServer) service; + DetachedStepRequest request = new DetachedStepRequest(); + request.setStepRef("jemmyTest"); + app.executeStep(request); } /* UTILITIES */ diff --git a/org.argeo.slc.autoui.launcher/src/main/resources/org/argeo/slc/autoui/launcher/felix.properties b/org.argeo.slc.autoui.launcher/src/main/resources/org/argeo/slc/autoui/launcher/felix.properties index d3b022065..698b8712b 100644 --- a/org.argeo.slc.autoui.launcher/src/main/resources/org/argeo/slc/autoui/launcher/felix.properties +++ b/org.argeo.slc.autoui.launcher/src/main/resources/org/argeo/slc/autoui/launcher/felix.properties @@ -15,6 +15,7 @@ org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \ org.osgi.util.tracker; version=1.3.3, \ org.argeo.slc.autoui; version=0.10.3.SNAPSHOT, \ org.argeo.slc.testui, \ + org.apache.commons.logging, \ org.springframework.beans.factory.support,\ org.springframework.beans.factory.xml,\ org.springframework.context,\ @@ -33,7 +34,8 @@ felix.auto.start.1= \ ${argeo.slc.mavenBase}org/apache/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar \ ${argeo.slc.mavenBase}org/apache/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar \ ${argeo.slc.mavenBase}org/argeo/dep/jemmy/org.argeo.dep.jemmy.nb61/0.2.2/org.argeo.dep.jemmy.nb61-0.2.2.jar \ - ${argeo.slc.mavenBase}org/argeo/slc/sandbox/org.argeo.slc.sandbox.jemmytest/0.1.2-SNAPSHOT/org.argeo.slc.sandbox.jemmytest-0.1.2-SNAPSHOT.jar" + reference:file:/home/mbaudier/dev/src/slc/sandbox/argeo.slc.jemmytest/bin/ +# ${argeo.slc.mavenBase}org/argeo/slc/sandbox/org.argeo.slc.sandbox.jemmytest/0.1.2-SNAPSHOT/org.argeo.slc.sandbox.jemmytest-0.1.2-SNAPSHOT.jar" felix.log.level=1 diff --git a/org.argeo.slc.autoui/pom.xml b/org.argeo.slc.autoui/pom.xml index c47610cc3..85d7ed8ca 100644 --- a/org.argeo.slc.autoui/pom.xml +++ b/org.argeo.slc.autoui/pom.xml @@ -20,7 +20,7 @@ 1.4.3 true - META-INF + src/main/resources/META-INF ${pom.artifactId} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AbstractDetachedActivator.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AbstractDetachedActivator.java index 7f18d50a4..b1fe56922 100644 --- a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AbstractDetachedActivator.java +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AbstractDetachedActivator.java @@ -1,6 +1,7 @@ package org.argeo.slc.autoui; import java.net.URL; +import java.util.Properties; import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; @@ -12,11 +13,12 @@ import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.UrlResource; public class AbstractDetachedActivator implements BundleActivator { - private AbstractApplicationContext applicationContext; + private SpringStaticRefProvider staticRefProvider; public final void start(BundleContext context) throws Exception { ClassLoader classLoader = getClass().getClassLoader(); + // Creates application context Thread cur = Thread.currentThread(); ClassLoader save = cur.getContextClassLoader(); cur.setContextClassLoader(classLoader); @@ -25,7 +27,7 @@ public class AbstractDetachedActivator implements BundleActivator { // applicationContext = new ClassPathXmlApplicationContext( // "/slc/conf/applicationContext.xml"); - applicationContext = new GenericApplicationContext(); + AbstractApplicationContext applicationContext = new GenericApplicationContext(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader( (BeanDefinitionRegistry) applicationContext); Bundle bundle = context.getBundle(); @@ -38,6 +40,14 @@ public class AbstractDetachedActivator implements BundleActivator { xmlReader.loadBeanDefinitions(new UrlResource(url)); } + // Register static ref provider + staticRefProvider = new SpringStaticRefProvider(applicationContext); + Properties properties = new Properties(); + properties.setProperty("slc.detached.bundle", bundle + .getSymbolicName()); + context.registerService(StaticRefProvider.class.getName(), + staticRefProvider, properties); + } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not initialize application context"); @@ -56,8 +66,8 @@ public class AbstractDetachedActivator implements BundleActivator { public final void stop(BundleContext context) throws Exception { stopAutoBundle(context); - if (applicationContext != null) { - applicationContext.close(); + if (staticRefProvider != null) { + staticRefProvider.close(); } } @@ -67,8 +77,7 @@ public class AbstractDetachedActivator implements BundleActivator { } - public Object getStaticRef(String id) { - return applicationContext.getBean(id); + protected StaticRefProvider getStaticRefProvider() { + return staticRefProvider; } - } diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java index cc78b2911..b95d6b4b9 100644 --- a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java @@ -1,19 +1,32 @@ package org.argeo.slc.autoui; -import org.osgi.framework.BundleActivator; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.autoui.internal.DetachedExecutionServerImpl; import org.osgi.framework.BundleContext; -public class AutoUiActivator implements BundleActivator { +public class AutoUiActivator extends AbstractDetachedActivator { + private final Log log = LogFactory.getLog(getClass()); - public void start(BundleContext context) throws Exception { - stdOut("AutoUi started"); - } + private DetachedExecutionServerImpl executionServer; + + public void startAutoBundle(BundleContext context) throws Exception { + Object obj = getStaticRefProvider().getStaticRef("executionServer"); + if (obj != null) + executionServer = (DetachedExecutionServerImpl) obj; + else + throw new DetachedException("Could not find execution server."); + + executionServer.setBundleContext(context); - public void stop(BundleContext context) throws Exception { - stdOut("AutoUi stopped"); + context.registerService(DetachedExecutionServer.class.getName(), + executionServer, new Properties()); + log.info("AutoUi started"); } - public static void stdOut(Object obj) { - System.out.println(obj); + public void stopAutoBundle(BundleContext context) throws Exception { + log.info("AutoUi stopped"); } } diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedDriver.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedDriver.java new file mode 100644 index 000000000..dbfa3a321 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedDriver.java @@ -0,0 +1,6 @@ +package org.argeo.slc.autoui; + +public interface DetachedDriver { + /** Blocks until it receives a request. */ + public DetachedStepRequest receiveRequest(); +} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedException.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedException.java new file mode 100644 index 000000000..f6ba5d168 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedException.java @@ -0,0 +1,14 @@ +package org.argeo.slc.autoui; + +public class DetachedException extends RuntimeException { + private Exception cause; + + public DetachedException(String message) { + super(message); + } + + public DetachedException(String message, Exception cause) { + super(message); + this.cause = cause; + } +} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedExecutionServer.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedExecutionServer.java new file mode 100644 index 000000000..637eab8dd --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedExecutionServer.java @@ -0,0 +1,5 @@ +package org.argeo.slc.autoui; + +public interface DetachedExecutionServer { + public DetachedStepAnswer executeStep(DetachedStepRequest request); +} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedStepRequest.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedStepRequest.java index 9c61afc83..25737496d 100644 --- a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedStepRequest.java +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/DetachedStepRequest.java @@ -6,4 +6,28 @@ public class DetachedStepRequest { private Properties inputParameters; private String stepRef; private String path; + + public Properties getInputParameters() { + return inputParameters; + } + + public void setInputParameters(Properties inputParameters) { + this.inputParameters = inputParameters; + } + + public String getStepRef() { + return stepRef; + } + + public void setStepRef(String stepRef) { + this.stepRef = stepRef; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } } diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/SpringStaticRefProvider.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/SpringStaticRefProvider.java new file mode 100644 index 000000000..8fb757f36 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/SpringStaticRefProvider.java @@ -0,0 +1,26 @@ +package org.argeo.slc.autoui; + +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.context.ConfigurableApplicationContext; + +public class SpringStaticRefProvider implements StaticRefProvider { + private final ConfigurableApplicationContext applicationContext; + + public SpringStaticRefProvider( + ConfigurableApplicationContext applicationContext) { + this.applicationContext = applicationContext; + } + + public Object getStaticRef(String id) { + try { + return applicationContext.getBean(id); + } catch (NoSuchBeanDefinitionException e) { + // silent + return null; + } + } + + public void close(){ + applicationContext.close(); + } +} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/StaticRefProvider.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/StaticRefProvider.java new file mode 100644 index 000000000..d0f2b07c5 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/StaticRefProvider.java @@ -0,0 +1,6 @@ +package org.argeo.slc.autoui; + +public interface StaticRefProvider { + /** Returns null if no such ref. */ + public Object getStaticRef(String id); +} diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/DetachedExecutionServerImpl.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/DetachedExecutionServerImpl.java new file mode 100644 index 000000000..2edf08ec2 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/DetachedExecutionServerImpl.java @@ -0,0 +1,58 @@ +package org.argeo.slc.autoui.internal; + +import org.argeo.slc.autoui.DetachedContextImpl; +import org.argeo.slc.autoui.DetachedException; +import org.argeo.slc.autoui.DetachedExecutionServer; +import org.argeo.slc.autoui.DetachedStep; +import org.argeo.slc.autoui.DetachedStepAnswer; +import org.argeo.slc.autoui.DetachedStepRequest; +import org.argeo.slc.autoui.StaticRefProvider; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +public class DetachedExecutionServerImpl implements DetachedExecutionServer { + private final DetachedContextImpl detachedContext; + + private BundleContext bundleContext; + + public DetachedExecutionServerImpl() { + detachedContext = new DetachedContextImpl(); + } + + public DetachedStepAnswer executeStep(DetachedStepRequest request) { + try { + DetachedStep step = null; + + // Find step + ServiceReference[] refs = bundleContext.getAllServiceReferences( + StaticRefProvider.class.getName(), null); + for (int i = 0; i < refs.length; i++) { + StaticRefProvider provider = (StaticRefProvider) bundleContext + .getService(refs[i]); + Object obj = provider.getStaticRef(request.getStepRef()); + if (obj != null) { + step = (DetachedStep) obj; + break; + } + } + + if (step == null) + throw new DetachedException("Could not find step with ref " + + request.getStepRef()); + + return step.execute(detachedContext, request); + } catch (DetachedException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + throw new DetachedException( + "Unexpected exception while executing request " + request, + e); + } + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + +} diff --git a/org.argeo.slc.autoui/src/main/resources/META-INF/MANIFEST.MF b/org.argeo.slc.autoui/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..0e594c4a1 --- /dev/null +++ b/org.argeo.slc.autoui/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,28 @@ +Manifest-Version: 1.0 +Export-Package: org.argeo.slc.autoui.rmi,org.argeo.slc.autoui;uses:="o + rg.springframework.beans.factory.support,org.apache.commons.logging,o + rg.springframework.context.support,org.springframework.core.io,org.os + gi.framework,org.springframework.beans.factory.xml,org.springframewor + k.context,org.springframework.beans.factory",org.argeo.slc.autoui.int + ernal;uses:="org.argeo.slc.autoui" +Built-By: mbaudier +Tool: Bnd-0.0.255 +Bundle-Name: SLC Auto UI +Created-By: Apache Maven Bundle Plugin +Bundle-Vendor: Argeo +Build-Jdk: 1.6.0_0 +Bundle-Version: 0.11.1.SNAPSHOT +Bnd-LastModified: 1222511849722 +Bundle-ManifestVersion: 2 +Bundle-Activator: org.argeo.slc.autoui.AutoUiActivator +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Import-Package: org.apache.commons.logging,org.argeo.slc.autoui,org.ar + geo.slc.autoui.internal,org.argeo.slc.autoui.rmi,org.osgi.framework;v + ersion="1.4",org.springframework.beans.factory,org.springframework.be + ans.factory.support,org.springframework.beans.factory.xml,org.springf + ramework.context,org.springframework.context.support,org.springframew + ork.core.io +Bundle-SymbolicName: org.argeo.slc.autoui +Bundle-DocURL: http://www.argeo.org +Originally-Created-By: Apache Maven Bundle Plugin + diff --git a/org.argeo.slc.autoui/src/main/resources/META-INF/slc/conf/applicationContext.xml b/org.argeo.slc.autoui/src/main/resources/META-INF/slc/conf/applicationContext.xml new file mode 100644 index 000000000..a2f3e138e --- /dev/null +++ b/org.argeo.slc.autoui/src/main/resources/META-INF/slc/conf/applicationContext.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/sandbox/argeo.slc.jemmytest/.classpath b/sandbox/argeo.slc.jemmytest/.classpath index c3624f87c..1aa73cdbf 100644 --- a/sandbox/argeo.slc.jemmytest/.classpath +++ b/sandbox/argeo.slc.jemmytest/.classpath @@ -1,6 +1,7 @@ + diff --git a/sandbox/argeo.slc.jemmytest/pom.xml b/sandbox/argeo.slc.jemmytest/pom.xml index 1f41d1b8d..a78a89d8b 100644 --- a/sandbox/argeo.slc.jemmytest/pom.xml +++ b/sandbox/argeo.slc.jemmytest/pom.xml @@ -7,7 +7,7 @@ SLC Sandbox JemmyTest 0.1.2-SNAPSHOT bundle - + org.apache.felix @@ -24,7 +24,7 @@ 1.4.3 true - META-INF + src/main/resources/META-INF ${pom.artifactId} diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/DummyStep.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/DummyStep.java index d06661f7f..6213dd2a4 100644 --- a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/DummyStep.java +++ b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/DummyStep.java @@ -1,5 +1,7 @@ package org.argeo.slc.jemmytest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.slc.autoui.AutoUiActivator; import org.argeo.slc.autoui.DetachedContext; import org.argeo.slc.autoui.DetachedStep; @@ -10,6 +12,8 @@ import org.netbeans.jemmy.operators.JFrameOperator; import org.netbeans.jemmy.operators.JLabelOperator; public class DummyStep implements DetachedStep { + private final static Log log = LogFactory.getLog(DummyStep.class); + public DetachedStepAnswer execute(DetachedContext detachedContext, DetachedStepRequest detachedStepRequest) { @@ -25,7 +29,7 @@ public class DummyStep implements DetachedStep { // Performs checks String textAfterPush = jLabelOperator.getText(); - AutoUiActivator.stdOut("textAfterPush=" + textAfterPush); + log.info("textAfterPush=" + textAfterPush); return null; } diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/JemmyTestActivator.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/JemmyTestActivator.java index a67dc5ab2..cfadbd5bc 100644 --- a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/JemmyTestActivator.java +++ b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/JemmyTestActivator.java @@ -2,25 +2,24 @@ package org.argeo.slc.jemmytest; import java.util.Properties; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.slc.autoui.AbstractDetachedActivator; import org.argeo.slc.autoui.DetachedStep; import org.osgi.framework.BundleContext; public class JemmyTestActivator extends AbstractDetachedActivator { + private final Log log = LogFactory.getLog(getClass()); + protected void startAutoBundle(BundleContext context) throws Exception { - Properties properties = new Properties(); - DummyStep applicationJemmy = (DummyStep) getStaticRef("jemmyTest"); - context.registerService(DetachedStep.class.getName(), - applicationJemmy, properties); - stdOut("JemmyTest started"); +// Properties properties = new Properties(); +// DummyStep applicationJemmy = (DummyStep) getStaticRef("jemmyTest"); +// context.registerService(DetachedStep.class.getName(), +// applicationJemmy, properties); + log.info("JemmyTest started"); } public void stopAutoBundle(BundleContext context) throws Exception { - stdOut("JemmyTest stopped"); + log.info("JemmyTest stopped"); } - - public static void stdOut(Object obj) { - System.out.println(obj); - } - } diff --git a/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/MANIFEST.MF b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..8624b41ae --- /dev/null +++ b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Build-Jdk: 1.5.0 +Bnd-LastModified: 1222510300891 +Bundle-Name: SLC Sandbox JemmyTest +Originally-Created-By: Apache Maven Bundle Plugin +Bundle-SymbolicName: org.argeo.slc.sandbox.jemmytest +Bundle-ManifestVersion: 2 +Bundle-Activator: org.argeo.slc.jemmytest.JemmyTestActivator +Tool: Bnd-0.0.255 +Created-By: Apache Maven Bundle Plugin +Bundle-Version: 0.1.2.SNAPSHOT +Built-By: mbaudier +Import-Package: org.apache.commons.logging,org.argeo.slc.autoui,org.arge + o.slc.jemmytest,org.netbeans.jemmy.operators,org.osgi.framework;version + ="1.4",org.springframework.beans.factory.xml +Export-Package: org.argeo.slc.jemmytest;uses:="org.argeo.slc.autoui,org. + osgi.framework,org.netbeans.jemmy.operators,org.apache.commons.logging" + diff --git a/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/applicationContext.xml b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/applicationContext.xml new file mode 100644 index 000000000..aaa91ce0f --- /dev/null +++ b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/applicationContext.xml @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/common/import.xml b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/common/import.xml new file mode 100644 index 000000000..b895c2175 --- /dev/null +++ b/sandbox/argeo.slc.jemmytest/src/main/resources/META-INF/slc/conf/common/import.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file -- 2.39.5