View Javadoc
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  
23  		if (OsgiBootUtils.isDebug()) {
24  			long jvmUptime = ManagementFactory.getRuntimeMXBean().getUptime();
25  			String jvmUptimeStr = (jvmUptime / 1000) + "." + (jvmUptime % 1000) + "s";
26  			OsgiBootUtils.debug("Ready to launch " + mainClass + " in " + jvmUptimeStr);
27  		}
28  
29  		osgi.main(mainClass, args);
30  
31  		osgi.shutdown();
32  
33  	}
34  
35  }