1 package org
.argeo
.slc
.internal
.runtime
.osgi
;
3 import org
.argeo
.api
.init
.RuntimeManager
;
4 import org
.osgi
.framework
.BundleActivator
;
5 import org
.osgi
.framework
.BundleContext
;
6 import org
.osgi
.framework
.ServiceReference
;
7 import org
.osgi
.util
.tracker
.ServiceTracker
;
9 public class SlcInitActivator
implements BundleActivator
{
10 // private final static CmsLog log = CmsLog.getLog(SlcInitActivator.class);
12 private ServiceTracker
<RuntimeManager
, RuntimeManager
> runtimeManagerSt
;
15 public void start(BundleContext context
) throws Exception
{
16 // Path userHome = Paths.get(System.getProperty("user.home"));
19 // EquinoxFactory equinoxFactory = new EquinoxFactory();
20 // Map<String, String> config = new HashMap<>();
21 // config.put("osgi.console", "host1:2023");
22 // config.put("osgi.frameworkParentClassloader", "app");
23 // config.put("osgi.parentClassLoader", "app");
24 // RuntimeManager.loadConfig(Paths.get("/usr/local/etc/argeo/user/cms/test3"), config);
25 // Framework framework = equinoxFactory.newFramework(config);
27 // OsgiBoot osgiBoot = new OsgiBoot(framework.getBundleContext());
28 // osgiBoot.bootstrap(config);
31 // OsgiCmsDeployment.test();
33 runtimeManagerSt
= new ServiceTracker
<>(context
, RuntimeManager
.class, null) {
36 public RuntimeManager
addingService(ServiceReference
<RuntimeManager
> reference
) {
37 RuntimeManager runtimeManager
= super.addingService(reference
);
41 // Thread.sleep(5000);
42 // } catch (InterruptedException e) {
46 // runtimeManager.startRuntime("rcp/test1", (config) -> {
47 // config.put("osgi.console", "host1:2023");
48 // config.put(CmsDeployProperty.SSHD_PORT.getProperty(), "2222");
49 //// config.put(CmsDeployProperty.HTTP_PORT.getProperty(), "7070");
50 // config.put(CmsDeployProperty.HOST.getProperty(), "host1");
51 //// config.put("argeo.osgi.start.6", "org.argeo.swt.minidesktop");
54 runtimeManager
.startRuntime("rap/test2", (config
) -> {
55 config
.put("osgi.console", "host2:2023");
56 config
.put("argeo.sshd.port", "2222");
57 config
.put("argeo.http.port", "7070");
58 config
.put("argeo.host", "host2");
59 String a2Source
= config
.get("argeo.osgi.sources");
60 config
.put("argeo.osgi.sources", a2Source
61 + ",a2+reference:///home/mbaudier/dev/git/unstable/output/a2?include=eu.netiket.on.apaf");
62 config
.put("argeo.osgi.start.6", "eu.netiket.on.apaf");
63 //// config.put("argeo.directory", "ipa:///");
68 return runtimeManager
;
72 runtimeManagerSt
.open(false);
76 public void stop(BundleContext context
) throws Exception
{