public Capability build() { return super.buildCapability(); }
public Capability build() { return super.buildCapability(); }
public void yield(CapReqBuilder builder) { caps.add(builder.buildCapability()); } });
public void yield(CapReqBuilder builder) { caps.add(builder.buildCapability()); } });
public ResourceBuilder addCapability(CapReqBuilder builder) { if (built) throw new IllegalStateException("Resource already built"); Capability cap = builder.setResource(resource).buildCapability(); capabilities.add(cap); return this; }
private Capability addCapability0(CapReqBuilder builder) { Capability cap = builder.setResource(resource) .buildCapability(); int i = capabilities.indexOf(cap); if (i >= 0) { return capabilities.get(i); } capabilities.add(cap); return cap; }
private Capability addCapability0(CapReqBuilder builder) { Capability cap = builder.setResource(resource) .buildCapability(); int i = capabilities.indexOf(cap); if (i >= 0) { return capabilities.get(i); } capabilities.add(cap); return cap; }
public ResourceBuilder addCapability(CapReqBuilder builder) { if (built) throw new IllegalStateException("Resource already built"); Capability cap = builder.setResource(resource).buildCapability(); capabilities.add(cap); return this; }
public ResourceBuilder addCapability(CapReqBuilder builder) { if (built) throw new IllegalStateException("Resource already built"); Capability cap = builder.setResource(resource).buildCapability(); capabilities.add(cap); return this; }
void doPlainJarIdentity(Jar resource, List< ? super Capability> caps) { String name = resource.getName(); if (name.toLowerCase().endsWith(SUFFIX_JAR)) name = name.substring(0, name.length() - SUFFIX_JAR.length()); Version version = null; int dashIndex = name.lastIndexOf('-'); if (dashIndex > 0) { try { String versionStr = name.substring(dashIndex + 1); version = new Version(versionStr); name = name.substring(0, dashIndex); } catch (Exception e) { version = null; } } CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_IDENTITY).addAttribute(Namespaces.NS_IDENTITY, name) .addAttribute(Namespaces.ATTR_IDENTITY_TYPE, Namespaces.RESOURCE_TYPE_PLAIN_JAR); if (version != null) builder.addAttribute(Namespaces.ATTR_VERSION, version); caps.add(builder.buildCapability()); }
void doPlainJarIdentity(Jar resource, List< ? super Capability> caps) { String name = resource.getName(); if (name.toLowerCase().endsWith(SUFFIX_JAR)) name = name.substring(0, name.length() - SUFFIX_JAR.length()); Version version = null; int dashIndex = name.lastIndexOf('-'); if (dashIndex > 0) { try { String versionStr = name.substring(dashIndex + 1); version = new Version(versionStr); name = name.substring(0, dashIndex); } catch (Exception e) { version = null; } } CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_IDENTITY).addAttribute(Namespaces.NS_IDENTITY, name) .addAttribute(Namespaces.ATTR_IDENTITY_TYPE, Namespaces.RESOURCE_TYPE_PLAIN_JAR); if (version != null) builder.addAttribute(Namespaces.ATTR_VERSION, version); caps.add(builder.buildCapability()); }
void doExportService(Domain domain, List< ? super Capability> caps) throws Exception { @SuppressWarnings("deprecation") Parameters exports = new Parameters(domain.get(Constants.EXPORT_SERVICE)); for (Entry<String,Attrs> export : exports.entrySet()) { String service = Processor.removeDuplicateMarker(export.getKey()); CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_SERVICE).addAttribute(Constants.OBJECTCLASS, service); for (Entry<String,String> attribEntry : export.getValue().entrySet()) builder.addAttribute(attribEntry.getKey(), attribEntry.getValue()); builder.addDirective(Namespaces.DIRECTIVE_EFFECTIVE, Namespaces.EFFECTIVE_ACTIVE); caps.add(builder.buildCapability()); } }
void doExportService(Domain domain, List< ? super Capability> caps) throws Exception { @SuppressWarnings("deprecation") Parameters exports = new Parameters(domain.get(Constants.EXPORT_SERVICE)); for (Entry<String,Attrs> export : exports.entrySet()) { String service = Processor.removeDuplicateMarker(export.getKey()); CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_SERVICE).addAttribute(Constants.OBJECTCLASS, service); for (Entry<String,String> attribEntry : export.getValue().entrySet()) builder.addAttribute(attribEntry.getKey(), attribEntry.getValue()); builder.addDirective(Namespaces.DIRECTIVE_EFFECTIVE, Namespaces.EFFECTIVE_ACTIVE); caps.add(builder.buildCapability()); } }
void addFragmentHostCap(String bsn, aQute.bnd.version.Version version) throws Exception { CapReqBuilder rbb = new CapReqBuilder(resource, HostNamespace.HOST_NAMESPACE); rbb.addAttribute(HostNamespace.HOST_NAMESPACE, bsn); rbb.addAttribute(AbstractWiringNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, version); addCapability(rbb.buildCapability()); }
void addFragmentHostCap(String bsn, aQute.bnd.version.Version version) throws Exception { CapReqBuilder rbb = new CapReqBuilder(resource, HostNamespace.HOST_NAMESPACE); rbb.addAttribute(HostNamespace.HOST_NAMESPACE, bsn); rbb.addAttribute(AbstractWiringNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, version); addCapability(rbb.buildCapability()); }
void doExports(Domain domain, List< ? super Capability> caps) throws Exception { Parameters exports = domain.getExportPackage(); for (Entry<String,Attrs> entry : exports.entrySet()) { CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_WIRING_PACKAGE); String pkgName = Processor.removeDuplicateMarker(entry.getKey()); builder.addAttribute(Namespaces.NS_WIRING_PACKAGE, pkgName); String versionStr = entry.getValue().getVersion(); Version version = Version.parseVersion(versionStr); builder.addAttribute(Namespaces.ATTR_VERSION, version); for (Entry<String,String> attribEntry : entry.getValue().entrySet()) { String key = attribEntry.getKey(); if (!"specification-version".equalsIgnoreCase(key) && !Constants.VERSION_ATTRIBUTE.equalsIgnoreCase(key)) { if (key.endsWith(":")) builder.addDirective(key.substring(0, key.length() - 1), attribEntry.getValue()); else builder.addAttribute(key, attribEntry.getValue()); } } Entry<String,Attrs> bsn = domain.getBundleSymbolicName(); builder.addAttribute(Namespaces.ATTR_BUNDLE_SYMBOLIC_NAME, bsn.getKey()); builder.addAttribute(Namespaces.ATTR_BUNDLE_VERSION, Version.parseVersion(bsn.getValue().getVersion())); caps.add(builder.buildCapability()); } }
void doExports(Domain domain, List< ? super Capability> caps) throws Exception { Parameters exports = domain.getExportPackage(); for (Entry<String,Attrs> entry : exports.entrySet()) { CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_WIRING_PACKAGE); String pkgName = Processor.removeDuplicateMarker(entry.getKey()); builder.addAttribute(Namespaces.NS_WIRING_PACKAGE, pkgName); String versionStr = entry.getValue().getVersion(); Version version = Version.parseVersion(versionStr); builder.addAttribute(Namespaces.ATTR_VERSION, version); for (Entry<String,String> attribEntry : entry.getValue().entrySet()) { String key = attribEntry.getKey(); if (!"specification-version".equalsIgnoreCase(key) && !Constants.VERSION_ATTRIBUTE.equalsIgnoreCase(key)) { if (key.endsWith(":")) builder.addDirective(key.substring(0, key.length() - 1), attribEntry.getValue()); else builder.addAttribute(key, attribEntry.getValue()); } } Entry<String,Attrs> bsn = domain.getBundleSymbolicName(); builder.addAttribute(Namespaces.ATTR_BUNDLE_SYMBOLIC_NAME, bsn.getKey()); builder.addAttribute(Namespaces.ATTR_BUNDLE_VERSION, Version.parseVersion(bsn.getValue().getVersion())); caps.add(builder.buildCapability()); } }
void doBundleIdentity(Domain domain, MimeType mimeType, List< ? super Capability> caps) throws Exception { String type; switch (mimeType) { case Bundle : type = Namespaces.RESOURCE_TYPE_BUNDLE; break; case Fragment : type = Namespaces.RESOURCE_TYPE_FRAGMENT; break; default : type = Namespaces.RESOURCE_TYPE_PLAIN_JAR; break; } Entry<String,Attrs> bundleSymbolicName = domain.getBundleSymbolicName(); String bsn = bundleSymbolicName.getKey(); String s = bundleSymbolicName.getValue().get(Constants.SINGLETON_DIRECTIVE + ":"); boolean singleton = Boolean.TRUE.toString().equalsIgnoreCase(s); Version version = Version.parseVersion(domain.getBundleVersion()); CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_IDENTITY).addAttribute(Namespaces.NS_IDENTITY, bsn) .addAttribute(Namespaces.ATTR_IDENTITY_TYPE, type).addAttribute(Namespaces.ATTR_VERSION, version); if (singleton) builder.addDirective(Namespaces.DIRECTIVE_SINGLETON, Boolean.TRUE.toString()); caps.add(builder.buildCapability()); }
public static Capability copy(Capability c, Resource r) throws Exception { CapReqBuilder from = new CapReqBuilder(c.getNamespace()).from(c); if (r == null) return from.buildSyntheticCapability(); else return from.setResource(r) .buildCapability(); }
public static Capability copy(Capability c, Resource r) throws Exception { CapReqBuilder from = new CapReqBuilder(c.getNamespace()).from(c); if (r == null) return from.buildSyntheticCapability(); else return from.setResource(r) .buildCapability(); }