]> git.argeo.org Git - lgpl/argeo-commons.git/blob - Main.java
fdabd995c91f3fe61d76190ac4fd41884247eb42
[lgpl/argeo-commons.git] / Main.java
1 package org.argeo.osgi.boot;
2
3 import java.lang.management.ManagementFactory;
4
5 public class Main {
6
7 public static void main(String[] args) {
8 String mainClass = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS);
9 if (mainClass == null) {
10 throw new IllegalArgumentException(
11 "System property " + OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS + " must be specified");
12 }
13
14 OsgiBuilder osgi = new OsgiBuilder();
15 String distributionUrl = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_DISTRIBUTION_URL);
16 if (distributionUrl != null)
17 osgi.install(distributionUrl);
18 // osgi.conf("argeo.node.useradmin.uris", "os:///");
19 // osgi.conf("osgi.clean", "true");
20 // osgi.conf("osgi.console", "true");
21 osgi.launch();
22 osgi.main(mainClass, args);
23
24 long jvmUptime = ManagementFactory.getRuntimeMXBean().getUptime();
25 String jvmUptimeStr = (jvmUptime / 1000) + "." + (jvmUptime % 1000) + "s";
26 System.out.println("Command " + mainClass + " executed in " + jvmUptimeStr);
27
28 osgi.shutdown();
29
30 }
31
32 }