+
+ int bundleState = fromBundle.getState();
+ if (Bundle.INSTALLED == bundleState)
+ throw new IllegalStateException("Bundle " + fromBundle.getSymbolicName() + " is not resolved");
+ if (Bundle.RESOLVED == bundleState) {
+ try {
+ fromBundle.start();
+ } catch (BundleException e) {
+ throw new IllegalStateException("Cannot start bundle " + fromBundle.getSymbolicName(), e);
+ }
+ while (Bundle.ACTIVE != fromBundle.getState())
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // we assume the session has been closed
+ throw new RuntimeException("Bundle " + fromBundle.getSymbolicName() + " is not active", e);
+ }
+ }
+