//
// Parse bundle symbolic name.
//
BundleCapabilityImpl bundleCap = parseBundleSymbolicName(owner, m_headerMap);
if (bundleCap != null)
{
m_bundleSymbolicName = (String)
bundleCap.getAttributes().get(BundleRevision.BUNDLE_NAMESPACE);
// Add a bundle capability and a host capability to all
// non-fragment bundles. A host capability is the same
// as a require capability, but with a different capability
// namespace. Bundle capabilities resolve required-bundle
// dependencies, while host capabilities resolve fragment-host
// dependencies.
if (headerMap.get(Constants.FRAGMENT_HOST) == null)
{
// All non-fragment bundles have host capabilities.
capList.add(bundleCap);
// A non-fragment bundle can choose to not have a host capability.
String attachment =
bundleCap.getDirectives().get(Constants.FRAGMENT_ATTACHMENT_DIRECTIVE);
attachment = (attachment == null)
? Constants.FRAGMENT_ATTACHMENT_RESOLVETIME
: attachment;
if (!attachment.equalsIgnoreCase(Constants.FRAGMENT_ATTACHMENT_NEVER))
{
Map<String, Object> hostAttrs =
new HashMap<String, Object>(bundleCap.getAttributes());
Object value = hostAttrs.remove(BundleRevision.BUNDLE_NAMESPACE);
hostAttrs.put(BundleRevision.HOST_NAMESPACE, value);
capList.add(new BundleCapabilityImpl(
owner, BundleRevision.HOST_NAMESPACE,
bundleCap.getDirectives(),
hostAttrs));
}
}
}