tang7526
3/15/2016 - 7:12 PM

Dynamic Install OSGi Bundle

Dynamic Install OSGi Bundle

public void start(BundleContext context) throws Exception {

	// download bundle from url
	String url = "https://dl.dropboxusercontent.com/u/6098562/TestBundle_1.0.jar";
	String FileNamePath = "E://test//TestBundle_1.0.jar";
	getFile(url, FileNamePath);

	// install bundle
	String fileLocation = "file:///e://test//TestBundle_1.0.jar";
	Bundle testBundle = context.getBundle(fileLocation);
	if (testBundle == null) {
		testBundle = context.installBundle(fileLocation);
	}
	
	// start bundle
	testBundle.start();
}