void doBundleAndHost(Domain domain, List< ? super Capability> caps) throws Exception { CapReqBuilder bundleBuilder = new CapReqBuilder(Namespaces.NS_WIRING_BUNDLE); CapReqBuilder hostBuilder = new CapReqBuilder(Namespaces.NS_WIRING_HOST); boolean allowFragments = true; if (domain.getFragmentHost() != null) return; Map.Entry<String,Attrs> bsn = domain.getBundleSymbolicName(); Version version = Version.parseVersion(bsn.getValue().getVersion()); bundleBuilder.addAttribute(Namespaces.NS_WIRING_BUNDLE, bsn.getKey()).addAttribute( Constants.BUNDLE_VERSION_ATTRIBUTE, version); hostBuilder.addAttribute(Namespaces.NS_WIRING_HOST, bsn.getKey()).addAttribute( Constants.BUNDLE_VERSION_ATTRIBUTE, version); for (Entry<String,String> entry : bsn.getValue().entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) { String directiveName = key.substring(0, key.length() - 1); if (Constants.FRAGMENT_ATTACHMENT_DIRECTIVE.equalsIgnoreCase(directiveName)) { if (Constants.FRAGMENT_ATTACHMENT_NEVER.equalsIgnoreCase(entry.getValue())) allowFragments = false; } else if (!Constants.SINGLETON_DIRECTIVE.equalsIgnoreCase(directiveName)) { bundleBuilder.addDirective(directiveName, entry.getValue()); } } else { bundleBuilder.addAttribute(key, entry.getValue()); } } caps.add(bundleBuilder.buildCapability()); if (allowFragments) caps.add(hostBuilder.buildCapability()); }
void doBundleAndHost(Domain domain, List< ? super Capability> caps) throws Exception { CapReqBuilder bundleBuilder = new CapReqBuilder(Namespaces.NS_WIRING_BUNDLE); CapReqBuilder hostBuilder = new CapReqBuilder(Namespaces.NS_WIRING_HOST); boolean allowFragments = true; if (domain.getFragmentHost() != null) return; Map.Entry<String,Attrs> bsn = domain.getBundleSymbolicName(); Version version = Version.parseVersion(bsn.getValue().getVersion()); bundleBuilder.addAttribute(Namespaces.NS_WIRING_BUNDLE, bsn.getKey()).addAttribute( Constants.BUNDLE_VERSION_ATTRIBUTE, version); hostBuilder.addAttribute(Namespaces.NS_WIRING_HOST, bsn.getKey()).addAttribute( Constants.BUNDLE_VERSION_ATTRIBUTE, version); for (Entry<String,String> entry : bsn.getValue().entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) { String directiveName = key.substring(0, key.length() - 1); if (Constants.FRAGMENT_ATTACHMENT_DIRECTIVE.equalsIgnoreCase(directiveName)) { if (Constants.FRAGMENT_ATTACHMENT_NEVER.equalsIgnoreCase(entry.getValue())) allowFragments = false; } else if (!Constants.SINGLETON_DIRECTIVE.equalsIgnoreCase(directiveName)) { bundleBuilder.addDirective(directiveName, entry.getValue()); } } else { bundleBuilder.addAttribute(key, entry.getValue()); } } caps.add(bundleBuilder.buildCapability()); if (allowFragments) caps.add(hostBuilder.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()); }
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()); }
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()); } }
Entry<String, Attrs> bundleSymbolicName = domain.getBundleSymbolicName(); if (bundleSymbolicName != null) { bsn = bundleSymbolicName.getKey();
Entry<String, Attrs> bundleSymbolicName = domain.getBundleSymbolicName(); if (bundleSymbolicName != null) { bsn = bundleSymbolicName.getKey();
name = manifest.getBundleSymbolicName() .getKey();
name = manifest.getBundleSymbolicName() .getKey();
Entry<String,Attrs> bundleSymbolicName = d.getBundleSymbolicName();
Entry<String,Attrs> bundleSymbolicName = d.getBundleSymbolicName();
Entry<String, Attrs> bundleSymbolicName = d.getBundleSymbolicName();
Entry<String, Attrs> bundleSymbolicName = d.getBundleSymbolicName();
Entry<String, Attrs> bsn = manifest.getBundleSymbolicName();
Entry<String, Attrs> bsn = manifest.getBundleSymbolicName();