]> git.argeo.org Git - gpl/argeo-slc.git/blob - SlcInitActivator.java
547cda11b437ce710e51b919cc42764e81e81cbb
[gpl/argeo-slc.git] / SlcInitActivator.java
1 package org.argeo.slc.internal.runtime.osgi;
2
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;
8
9 public class SlcInitActivator implements BundleActivator {
10 // private final static CmsLog log = CmsLog.getLog(SlcInitActivator.class);
11
12 private ServiceTracker<RuntimeManager, RuntimeManager> runtimeManagerSt;
13
14 @Override
15 public void start(BundleContext context) throws Exception {
16 // Path userHome = Paths.get(System.getProperty("user.home"));
17
18 // {
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);
26 // framework.start();
27 // OsgiBoot osgiBoot = new OsgiBoot(framework.getBundleContext());
28 // osgiBoot.bootstrap(config);
29 // }
30
31 // OsgiCmsDeployment.test();
32
33 runtimeManagerSt = new ServiceTracker<>(context, RuntimeManager.class, null) {
34
35 @Override
36 public RuntimeManager addingService(ServiceReference<RuntimeManager> reference) {
37 RuntimeManager runtimeManager = super.addingService(reference);
38 new Thread() {
39 public void run() {
40 // try {
41 // Thread.sleep(5000);
42 // } catch (InterruptedException e) {
43 // return;
44 // }
45
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");
52 // });
53
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:///");
64 });
65 }
66 }.start();
67
68 return runtimeManager;
69 }
70
71 };
72 runtimeManagerSt.open(false);
73 }
74
75 @Override
76 public void stop(BundleContext context) throws Exception {
77 }
78
79 }