From f2c8d34fdf6ba4103b1226b50ce132fe98ff24bf Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 25 Sep 2008 17:13:56 +0000 Subject: [PATCH] Start using Spring git-svn-id: https://svn.argeo.org/slc/trunk@1635 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../argeo.slc.jemmytest/autouiserver.jardesc | 16 --------- sandbox/argeo.slc.jemmytest/build.properties | 5 --- sandbox/argeo.slc.jemmytest/pom.xml | 16 +++++++++ .../slc/jemmytest/JemmyTestActivator.java | 36 +++++++++++++++++++ .../src/main/slc/conf/applicationContext.xml | 10 ++++++ 5 files changed, 62 insertions(+), 21 deletions(-) delete mode 100644 sandbox/argeo.slc.jemmytest/autouiserver.jardesc delete mode 100644 sandbox/argeo.slc.jemmytest/build.properties create mode 100644 sandbox/argeo.slc.jemmytest/src/main/slc/conf/applicationContext.xml diff --git a/sandbox/argeo.slc.jemmytest/autouiserver.jardesc b/sandbox/argeo.slc.jemmytest/autouiserver.jardesc deleted file mode 100644 index fcde756b1..000000000 --- a/sandbox/argeo.slc.jemmytest/autouiserver.jardesc +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/sandbox/argeo.slc.jemmytest/build.properties b/sandbox/argeo.slc.jemmytest/build.properties deleted file mode 100644 index 1cdd7a6bf..000000000 --- a/sandbox/argeo.slc.jemmytest/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/main/java/,\ - src/test/resources/,\ - java/ -bin.includes = META-INF/,\ - . diff --git a/sandbox/argeo.slc.jemmytest/pom.xml b/sandbox/argeo.slc.jemmytest/pom.xml index 41095e0c4..a480695b1 100644 --- a/sandbox/argeo.slc.jemmytest/pom.xml +++ b/sandbox/argeo.slc.jemmytest/pom.xml @@ -8,6 +8,15 @@ 0.1.2-SNAPSHOT bundle + + + src/main/slc + slc + + **/* + + + org.apache.felix @@ -78,6 +87,13 @@ osgi 3.3.0-v20070530 + + + org.springframework + spring-context + 2.0.8 + + 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 ec1e56a7d..5a06369c7 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 @@ -5,12 +5,48 @@ import java.util.Properties; import org.argeo.slc.autoui.AutoUiApplication; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class JemmyTestActivator implements BundleActivator { + private AbstractApplicationContext applicationContext; public void start(BundleContext context) throws Exception { + // ClassLoader classLoader = context.getBundle().getClass() + // .getClassLoader(); + // + // Thread cur = Thread.currentThread(); + // ClassLoader save = cur.getContextClassLoader(); + // cur.setContextClassLoader(classLoader); + // + // try { + // // FIXME: make it more generic + // applicationContext = new ClassPathXmlApplicationContext( + // "/slc/conf/applicationContext.xml"); + // } catch (Exception e) { + // throw new Exception("Could not initialize application context", e); + // } finally { + // cur.setContextClassLoader(save); + // } + + // 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()); + // xmlReader.loadBeanDefinitions(new UrlResource(url)); + // } + Properties properties = new Properties(); AutoUiApplicationJemmy applicationJemmy = new AutoUiApplicationJemmy(); + // AutoUiApplicationJemmy applicationJemmy = (AutoUiApplicationJemmy) + // applicationContext + // .getBean("jemmyTest"); context.registerService(AutoUiApplication.class.getName(), applicationJemmy, properties); stdOut("JemmyTest started"); diff --git a/sandbox/argeo.slc.jemmytest/src/main/slc/conf/applicationContext.xml b/sandbox/argeo.slc.jemmytest/src/main/slc/conf/applicationContext.xml new file mode 100644 index 000000000..cd06c5edb --- /dev/null +++ b/sandbox/argeo.slc.jemmytest/src/main/slc/conf/applicationContext.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file -- 2.39.5