public static synchronized void initialize(ClassLoader cl, File home, List<File> bundleFiles, Map<String, Object> hostEnv) { if (isInitialized) { return; } FrameworkLoader.home = home; FrameworkLoader.bundleFiles = bundleFiles == null ? new ArrayList<>() : bundleFiles; Collections.sort(FrameworkLoader.bundleFiles); loader = cl; doInitialize(hostEnv); osgi = new OSGiAdapter(home); isInitialized = true; }
public synchronized void start() { if (osgi != null) { throw new IllegalStateException("Nuxeo Runtime already started"); } osgi = new OSGiAdapter(env.getHome(), env.getData(), env.getProperties()); }
public static void main(String[] args) throws Exception { File home = new File("/tmp/test_osgi_loader"); OSGiAdapter osgi = new OSGiAdapter(home); System.out.println("Starting ..."); StandaloneBundleLoader loader = new StandaloneBundleLoader(osgi); Thread.currentThread().setContextClassLoader(loader.loader.getLoader()); double s = System.currentTimeMillis(); try { loader.setExtractNestedJARs(true); loader.setScanForNestedJARs(true); List<BundleFile> bundles = new ArrayList<BundleFile>(); List<BundleFile> jars = new ArrayList<BundleFile>(); loader.load(new File("/opt/jboss/server/default/deploy/nuxeo.ear"), bundles, jars); loader.installAll(bundles); System.out.println(">>>> Loading done!!!!"); } finally { System.out.println("Shutting down"); osgi.shutdown(); } double e = System.currentTimeMillis(); System.out.println("Total time: " + ((e - s) / 1000) + " sec."); System.exit(0); }
throw e; osgi = new OSGiAdapter(workingDir); BundleFile bf = new SystemBundleFile(workingDir); bundleLoader = new StandaloneBundleLoader(osgi, RuntimeHarnessImpl.class.getClassLoader());