/** * @param userName * @return * never null * @throws BundleException * if the bundle could not be installed */ private Bundle installURPBundle(String userName) throws BundleException { Bundle b = null; try { b = this.osgi.installBundle("urp:" + userName); logger.info(String.format("User rights proxy installed: %s", b.getLocation())); b.start(); } catch (BundleException e) { logger.error("BundleException.TYPE: {}", e.getType(), e); if (b == null) { logger.info("Installation of user rights proxy bundle failed."); throw e; } else { logger.error("URP bundle failed to start."); } } return b; }
private static ClassLoader getBundleClassLoader(String symbolicName) throws BundleException { Bundle bundle = Activator.getBundle(symbolicName); if (bundle == null) { throw new RuntimeException("Bundle " + symbolicName + " is not found"); } try { bundle.start(); } catch (BundleException ex) { if (ex.getType() == BundleException.RESOLVE_ERROR) { System.err.println("Resolution errors for " + bundle.toString()); Set<ResolverError> errors = Activator.getResolutionErrors(bundle); if (errors.size() > 0) { for (ResolverError error : errors) { System.err.println("\t" + error.toString()); } } } else { System.err.println("Could not start test bundle: " + bundle.getSymbolicName()); ex.printStackTrace(); } throw ex; } return new BundleClassLoader(bundle); }
private void start(Module module, StartOptions... options) { try { secureAction.start(module, options); } catch (BundleException e) { if (e.getType() == BundleException.STATECHANGE_ERROR) { if (Module.ACTIVE_SET.contains(module.getState())) { // There is still a timing issue here; // but at least try to detect that another thread is starting the module return; } } adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e); } catch (IllegalStateException e) { // been uninstalled return; } }
private void start(Module module, StartOptions... options) { try { secureAction.start(module, options); } catch (BundleException e) { if (e.getType() == BundleException.STATECHANGE_ERROR) { if (Module.ACTIVE_SET.contains(module.getState())) { // There is still a timing issue here; // but at least try to detect that another thread is starting the module return; } } adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e); } catch (IllegalStateException e) { // been uninstalled return; } }
private void start(Module module, StartOptions... options) { try { secureAction.start(module, options); } catch (BundleException e) { if (e.getType() == BundleException.STATECHANGE_ERROR) { if (Module.ACTIVE_SET.contains(module.getState())) { // There is still a timing issue here; // but at least try to detect that another thread is starting the module return; } } adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e); } catch (IllegalStateException e) { // been uninstalled return; } }
private void start(Module module, StartOptions... options) { try { secureAction.start(module, options); } catch (BundleException e) { if (e.getType() == BundleException.STATECHANGE_ERROR) { if (Module.ACTIVE_SET.contains(module.getState())) { // There is still a timing issue here; // but at least try to detect that another thread is starting the module return; } } adaptor.publishContainerEvent(ContainerEvent.ERROR, module, e); } catch (IllegalStateException e) { // been uninstalled return; } }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); return report; }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); return report; }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); return report; }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); return report; }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); return report; }
private ResolutionReport resolve(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) { if (isRefreshingSystemModule()) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Unable to resolve while shutting down the framework.")); //$NON-NLS-1$ } ResolutionReport report = null; try (ResolutionLock.Permits resolutionPermits = _resolutionLock.acquire(1)) { do { try { report = resolveAndApply(triggers, triggersMandatory, restartTriggers, resolutionPermits); } catch (RuntimeException e) { if (e.getCause() instanceof BundleException) { BundleException be = (BundleException) e.getCause(); if (be.getType() == BundleException.REJECTED_BY_HOOK || be.getType() == BundleException.STATECHANGE_ERROR) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException(be)); } } throw e; } } while (report == null); } catch (ResolutionLockException e) { return new ModuleResolutionReport(null, Collections.<Resource, List<Entry>> emptyMap(), new ResolutionException("Timeout acquiring lock for resolution", e, Collections.<Requirement> emptyList())); //$NON-NLS-1$ } return report; }
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
osgiBundle = context.installBundle(initialBundles[i].locationString, in); } catch (BundleException e) { if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { continue;
/** * Install an OSGi deployable * @param osgiDeployable The OSGi deployable to install * @return the installed bundle if the OSGi deployable has been installed. Return null if the bundle is already * installed. * @throws DeployerException */ protected Bundle installBundle(OSGiDeployable osgiDeployable) throws DeployerException { Bundle osgiBundle; try { String url = getURL(osgiDeployable).toExternalForm(); if (osgiDeployable.isReference()) { url = "reference:".concat(url); } //install the bundle osgiBundle = this.bundleContext.installBundle(url); osgiBundle.adapt(BundleStartLevel.class).setStartLevel(osgiDeployable.getStartLevel()); } catch (BundleException e) { // Check the bundle exception type if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { logger.warn("Cannot deploy a bundle that is already installed " + osgiDeployable + ". ", e.getMessage()); return null; } else { throw new DeployerException("Cannot install the bundle '" + osgiDeployable + "'.", e); } } return osgiBundle; }
/** * Install an OSGi deployable * @param osgiDeployable The OSGi deployable to install * @return the installed bundle if the OSGi deployable has been installed. Return null if the bundle is already * installed. * @throws org.ow2.util.ee.deploy.api.deployer.DeployerException */ protected Bundle installBundle(OSGiDeployable osgiDeployable) throws DeployerException { Bundle osgiBundle; try { String url = getURL(osgiDeployable).toExternalForm(); if (osgiDeployable.isReference()) { url = "reference:".concat(url); } //install the bundle osgiBundle = this.bundleContext.installBundle(url); osgiBundle.adapt(BundleStartLevel.class).setStartLevel(osgiDeployable.getStartLevel()); } catch (BundleException e) { // Check the bundle exception type if (e.getType() == BundleException.DUPLICATE_BUNDLE_ERROR) { logger.warn("Cannot deploy a bundle that is already installed " + osgiDeployable + ". ", e.getMessage()); return null; } else { throw new DeployerException("Cannot install the bundle '" + osgiDeployable + "'.", e); } } return osgiBundle; }