FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME,
Constants.SYSTEM_BUNDLE_SYMBOLICNAME };
for (int capIdx = 0; capIdx < aliasCaps.size(); capIdx++)
{
BundleCapability cap = aliasCaps.get(capIdx);
// Need to alias bundle and host capabilities.
if (cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE)
|| cap.getNamespace().equals(BundleRevision.HOST_NAMESPACE))
{
// Make a copy of the attribute array.
Map<String, Object> aliasAttrs =
new HashMap<String, Object>(cap.getAttributes());
// Add the aliased value.
aliasAttrs.put(cap.getNamespace(), aliases);
// Create the aliased capability to replace the old capability.
cap = new BundleCapabilityImpl(
cap.getRevision(),
cap.getNamespace(),
cap.getDirectives(),
aliasAttrs);
aliasCaps.set(capIdx, cap);
}
// Further, search attributes for bundle symbolic name and alias it too.
for (Entry<String, Object> entry : cap.getAttributes().entrySet())
{
// If there is a bundle symbolic name attribute, add the
// standard alias as a value.
if (entry.getKey().equalsIgnoreCase(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE))
{
// Make a copy of the attribute array.
Map<String, Object> aliasAttrs =
new HashMap<String, Object>(cap.getAttributes());
// Add the aliased value.
aliasAttrs.put(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, aliases);
// Create the aliased capability to replace the old capability.
aliasCaps.set(capIdx, new BundleCapabilityImpl(
cap.getRevision(),
cap.getNamespace(),
cap.getDirectives(),
aliasAttrs));
// Continue with the next capability.
break;
}
}