protected Bundle install(String url) throws BundleException { try { return Osgis.install(framework, url); } catch (Exception e) { throw new IllegalStateException("test resources not available; may be an IDE issue, so try a mvn rebuild of this project", e); } }
/** installs the given JAR file as an OSGi bundle; all manifest info should be already set up. * bundle-start semantics are TBD. * * @deprecated since 0.12.0, use {@link OsgiManager#installUploadedBundle(org.apache.brooklyn.api.typereg.ManagedBundle, InputStream)}*/ @Deprecated public Bundle installBundle(File f, boolean start) { try { Bundle b = Osgis.install( framework, "file://"+f.getAbsolutePath() ); if (start) { // benefits of start: // a) we get wiring issues thrown here, and // b) catalog.bom in root will be scanned synchronously here // however drawbacks: // c) other code doesn't always do it (method above) // d) heavier-weight earlier // e) tests in IDE break (but mvn fine) b.start(); } return b; } catch (Exception e) { throw Exceptions.propagateAnnotated("Error starting bundle from "+f, e); } }
/** @deprecated since 0.12.0 use {@link #install(ManagedBundle, InputStream, boolean, boolean)} */ @Deprecated public synchronized Bundle registerBundle(CatalogBundle bundleMetadata) { try { Bundle alreadyBundle = checkBundleInstalledThrowIfInconsistent(bundleMetadata, true); if (alreadyBundle!=null) { return alreadyBundle; } Bundle bundleInstalled = Osgis.install(framework, bundleMetadata.getUrl()); checkCorrectlyInstalled(bundleMetadata, bundleInstalled); return bundleInstalled; } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Bundle from "+bundleMetadata.getUrl()+" failed to install: " + e.getMessage(), e); } }
protected Bundle installFromClasspath(String resourceName) throws BundleException { TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), resourceName); try { return Osgis.install(framework, String.format("classpath:%s", resourceName)); } catch (Exception e) { throw Exceptions.propagate(e); } }
private Bundle installBundle(ManagementContext mgmt, String bundleUrl) throws Exception { OsgiManager osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager().get(); Framework framework = osgiManager.getFramework(); return Osgis.install(framework, bundleUrl); }
private Bundle installBundle(ManagementContext mgmt, String bundleUrl) throws Exception { OsgiManager osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager().get(); Framework framework = osgiManager.getFramework(); return Osgis.install(framework, bundleUrl); }
private Bundle installBundle(ManagementContext mgmt, String bundleUrl) throws Exception { OsgiManager osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager().get(); Framework framework = osgiManager.getFramework(); return Osgis.install(framework, bundleUrl); } }
private Bundle installBundle(ManagementContext mgmt, String bundleUrl) throws Exception { OsgiManager osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager().get(); Framework framework = osgiManager.getFramework(); return Osgis.install(framework, bundleUrl); }
public static void preinstallLibrariesLowLevelToPreventCatalogBomParsing(ManagementContext mgmt, String ...libraries) { // catalog BOM CAMP syntax not available in core; need to pre-install // to prevent Brooklyn from installing BOMs in those libraries for (String lib: libraries) { // install libs manually to prevent catalog BOM loading // (could do OsgiManager.installDeferredStart also, then just ignore the start) try { Osgis.install(((ManagementContextInternal)mgmt).getOsgiManager().get().getFramework(), lib); } catch (BundleException e) { throw Exceptions.propagate(e); } } }
InternalEntityFactory factory = new InternalEntityFactory(managementContext, managementContext.getEntityManager().getEntityTypeRegistry(), policyFactory); Bundle bundle = Osgis.install(framework, BROOKLYN_TEST_OSGI_ENTITIES_PATH); @SuppressWarnings("unchecked") Class<? extends Entity> bundleCls = (Class<? extends Entity>) bundle.loadClass("org.apache.brooklyn.test.osgi.entities.SimpleEntityImpl");