public static ResourceImpl build(ResourceImpl resource, String uri, Map<String, String> headerMap) throws BundleException { return build(resource, uri, headerMap, false); }
public static ResourceImpl build(ResourceImpl resource, String uri, Map<String, String> headerMap) throws BundleException { return build(resource, uri, headerMap, false); }
ResourceImpl createResource(String uri, Map<String, String> headers, boolean removeServiceRequirements) throws Exception { try { return ResourceBuilder.build(uri, headers, removeServiceRequirements); } catch (BundleException e) { throw new Exception("Unable to create resource for bundle " + uri, e); } }
public FakeBundleRevision(final Hashtable<String, String> headers, final String location, final long bundleId) throws BundleException { ResourceBuilder.build(this, location, headers); this.bundle = (Bundle) Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{Bundle.class}, new BundleRevisionInvocationHandler(headers, location, bundleId)); }
protected void buildResource(String uri, Map<String, String> headerMap) throws IOException { try { Resource resource = ResourceBuilder.build(uri, headerMap); addResource(resource); } catch (BundleException e) { throw new IOException("Unable to read resource: " + uri, e); } }
protected void buildResource(String uri, Map<String, String> headerMap) throws IOException { try { Resource resource = ResourceBuilder.build(uri, headerMap); addResource(resource); } catch (BundleException e) { throw new IOException("Unable to read resource: " + uri, e); } }
public FakeBundleRevision(final Hashtable<String, String> headers, final String location, final long bundleId) throws BundleException { ResourceBuilder.build(this, location, headers); this.bundle = (Bundle) Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{Bundle.class}, new BundleRevisionInvocationHandler(headers, location, bundleId)); }
public static ResourceImpl build(String uri, Map<String, String> headerMap, boolean removeServiceRequirements) throws BundleException { return build(new ResourceImpl(), uri, headerMap, removeServiceRequirements); }
public static ResourceImpl build(String uri, Map<String, String> headerMap) throws BundleException { return build(new ResourceImpl(), uri, headerMap, false); }
public static ResourceImpl build(String uri, Map<String, String> headerMap, boolean removeServiceRequirements) throws BundleException { return build(new ResourceImpl(), uri, headerMap, removeServiceRequirements); }
public static ResourceImpl build(String uri, Map<String, String> headerMap) throws BundleException { return build(new ResourceImpl(), uri, headerMap, false); }
public FakeBundleRevision(final Hashtable<String, String> headers, final String location, final long bundleId) throws BundleException { ResourceBuilder.build(this, location, headers); this.bundle = (Bundle) Proxy.newProxyInstance( getClass().getClassLoader(),
public FakeBundleRevision(final Hashtable<String, String> headers, final String location, final long bundleId) throws BundleException { ResourceBuilder.build(this, location, headers); this.bundle = (Bundle) Proxy.newProxyInstance( getClass().getClassLoader(),
private List<Capability> calculateSystemCapabilities(final Map<String,String> fwkProps) throws IOException { Map<String, String> mf = new HashMap<>(); mf.put(Constants.PROVIDE_CAPABILITY, Stream.of( fwkProps.get(Constants.FRAMEWORK_SYSTEMCAPABILITIES), fwkProps.get(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA) ) .filter(Objects::nonNull) .collect(Collectors.joining(","))); mf.put(Constants.EXPORT_PACKAGE, Stream.of( fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES), fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA) ).filter(Objects::nonNull) .collect(Collectors.joining(","))); mf.put(Constants.BUNDLE_SYMBOLICNAME, Constants.SYSTEM_BUNDLE_SYMBOLICNAME); mf.put(Constants.BUNDLE_MANIFESTVERSION, "2"); try { return ResourceBuilder.build(null, mf).getCapabilities(null); } catch (Exception ex) { throw new IOException(ex); } }
protected void analyze() throws IOException { final String name = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); if ( name != null ) { final String version = this.manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION); if ( version == null ) { throw new IOException("Unable to get bundle version from artifact " + getArtifact().getId().toMvnId()); } this.symbolicName = name; this.bundleVersion = version; final String newBundleName = this.getArtifact().getMetadata().get("bundle:rename-bsn"); if (newBundleName != null) { this.symbolicName = newBundleName; } this.getExportedPackages().addAll(extractExportedPackages(this.manifest)); this.getImportedPackages().addAll(extractImportedPackages(this.manifest)); this.getDynamicImportedPackages().addAll(extractDynamicImportedPackages(this.manifest)); try { ResourceImpl resource = ResourceBuilder.build(null, this.manifest.getMainAttributes().entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey().toString(), entry -> entry.getValue().toString()))); this.getCapabilities().addAll(resource.getCapabilities(null)); this.getRequirements().addAll(resource.getRequirements(null)); } catch (Exception ex) { throw new IOException(ex); } } else { throw new IOException("Unable to get bundle symbolic name from artifact " + getArtifact().getId().toMvnId()); } }
/** * Optional resource URIs will be made available through OSGi {@link Repository} * @param manager * @param optionals * @return * @throws Exception */ private Repository repositoryOfOptionalResources(DownloadManager manager, Collection<String> optionals) throws Exception { final List<Resource> resources = new ArrayList<>(); Downloader downloader = manager.createDownloader(); for (String optional : optionals) { downloader.download(optional, provider -> { Resource resource = ResourceBuilder.build(provider.getUrl(), getHeaders(provider)); synchronized (resources) { resources.add(resource); } }); } downloader.await(); return new BaseRepository(resources); }
/** * Optional resource URIs will be made available through OSGi {@link Repository} * @param manager * @param optionals * @return * @throws Exception */ private Repository repositoryOfOptionalResources(DownloadManager manager, Collection<String> optionals) throws Exception { final List<Resource> resources = new ArrayList<>(); Downloader downloader = manager.createDownloader(); for (String optional : optionals) { downloader.download(optional, provider -> { Resource resource = ResourceBuilder.build(provider.getUrl(), getHeaders(provider)); synchronized (resources) { resources.add(resource); } }); } downloader.await(); return new BaseRepository(resources); }
Resource tmp = ResourceBuilder.build(res.getBundle().getLocation(), headers); for (Capability cap : tmp.getCapabilities(ServiceNamespace.SERVICE_NAMESPACE)) { dummy.addCapability(new CapabilityImpl(dummy, cap.getNamespace(), cap.getDirectives(), cap.getAttributes()));