@Override public Bundle[] getFragments(Bundle bundle) { return osgi.getRegistry().getFragments(bundle.getSymbolicName()); }
@Override @Deprecated public RuntimeContext deployTestContrib(String bundle, URL contrib) throws Exception { Bundle b = bundleLoader.getOSGi().getRegistry().getBundle(bundle); if (b == null) { b = osgi.getSystemBundle(); } OSGiRuntimeContext ctx = new OSGiRuntimeContext(runtime, b); ctx.deploy(contrib); return ctx; }
public URL getBlobManagerContrib(FeaturesRunner runner) { String bundleName = "org.nuxeo.ecm.core.test"; String contribPath = "OSGI-INF/test-storage-blob-contrib.xml"; RuntimeHarness harness = runner.getFeature(RuntimeFeature.class).getHarness(); Bundle bundle = harness.getOSGiAdapter().getRegistry().getBundle(bundleName); URL contribURL = bundle.getEntry(contribPath); assertNotNull("deployment contrib " + contribPath + " not found", contribURL); return contribURL; }
@Override public void deployBundle(String name) throws Exception { // install only if not yet installed Bundle bundle = bundleLoader.getOSGi().getRegistry().getBundle(name); if (bundle == null) { BundleFile bundleFile = lookupBundle(name); bundleLoader.loadBundle(bundleFile); bundleLoader.installBundle(bundleFile); bundle = bundleLoader.getOSGi().getRegistry().getBundle(name); } else { log.info("A bundle with name {} has been found. Deploy is ignored.", name); } if (runtime.getContext(bundle) == null) { runtime.createContext(bundle); } }
@Override public Enumeration<URL> findEntries(String path, String filePattern, boolean recurse) { Enumeration<URL> hostEntries = file.findEntries(path, filePattern, recurse); Bundle[] fragments = osgi.getRegistry().getFragments(symbolicName); if (fragments.length == 0) { return hostEntries; } CompoundEnumerationBuilder builder = new CompoundEnumerationBuilder(); if (!allowHostOverride) { builder.add(hostEntries); } for (Bundle fragment : fragments) { Enumeration<URL> fragmentEntries = fragment.findEntries(path, filePattern, recurse); builder.add(fragmentEntries); } if (allowHostOverride) { builder.add(hostEntries); } return builder.build(); }
Bundle bundle = harness.getOSGiAdapter().getRegistry().getBundle(bundleName); URL contribURL = bundle.getEntry(contribPath); assertNotNull("deployment contrib " + contribPath + " not found", contribURL);