X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=sandbox%2Fargeo.slc.jemmytest%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fjemmytest%2FJemmyTestActivator.java;h=19e7b5dbe237172d40b2c97d035afd062b2dc3e6;hb=4bafe4b45c92437f769495c038203a048a4e793a;hp=c8c0e357c3cf4ee4407661a0d33c6fb6a9b63c2d;hpb=b2f23cc85abe3bc31711c04746b80244b43bd442;p=gpl%2Fargeo-slc.git 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 c8c0e357c..19e7b5dbe 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 @@ -1,63 +1,6 @@ package org.argeo.slc.jemmytest; -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 = 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) { - e.printStackTrace(); - throw new Exception("Could not initialize application context"); - } 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"); - } - - public void stop(BundleContext context) throws Exception { - stdOut("JemmyTest stopped"); - } - - public static void stdOut(Object obj) { - System.out.println(obj); - } +import org.argeo.slc.autoui.SimpleDetachedActivator; +public class JemmyTestActivator extends SimpleDetachedActivator { }