Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EBF2981F for ; Tue, 8 Nov 2011 08:33:04 +0000 (UTC) Received: (qmail 24871 invoked by uid 500); 8 Nov 2011 08:33:04 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 24802 invoked by uid 500); 8 Nov 2011 08:33:03 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 24795 invoked by uid 99); 8 Nov 2011 08:33:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2011 08:33:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Nov 2011 08:33:00 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 009B5238890B for ; Tue, 8 Nov 2011 08:32:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1199155 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Date: Tue, 08 Nov 2011 08:32:38 -0000 To: commits@felix.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111108083239.009B5238890B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rickhall Date: Tue Nov 8 08:32:38 2011 New Revision: 1199155 URL: http://svn.apache.org/viewvc?rev=1199155&view=rev Log: Need to alias system bundle name for bundle/host capabilities. (FELIX-3205) Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java?rev=1199155&r1=1199154&r2=1199155&view=diff ============================================================================== --- felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java (original) +++ felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java Tue Nov 8 08:32:38 2011 @@ -241,10 +241,34 @@ class ExtensionManager extends URLStream List aliasCaps = new ArrayList(caps); + String[] aliases = { + FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME, + Constants.SYSTEM_BUNDLE_SYMBOLICNAME }; + for (int capIdx = 0; capIdx < aliasCaps.size(); capIdx++) { - // Get the attributes and search for bundle symbolic name. - for (Entry entry : aliasCaps.get(capIdx).getAttributes().entrySet()) + 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 aliasAttrs = + new HashMap(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 entry : cap.getAttributes().entrySet()) { // If there is a bundle symbolic name attribute, add the // standard alias as a value. @@ -252,18 +276,14 @@ class ExtensionManager extends URLStream { // Make a copy of the attribute array. Map aliasAttrs = - new HashMap(aliasCaps.get(capIdx).getAttributes()); + new HashMap(cap.getAttributes()); // Add the aliased value. - aliasAttrs.put( - Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, - new String[] { - (String) entry.getValue(), - Constants.SYSTEM_BUNDLE_SYMBOLICNAME}); + aliasAttrs.put(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, aliases); // Create the aliased capability to replace the old capability. aliasCaps.set(capIdx, new BundleCapabilityImpl( - caps.get(capIdx).getRevision(), - caps.get(capIdx).getNamespace(), - caps.get(capIdx).getDirectives(), + cap.getRevision(), + cap.getNamespace(), + cap.getDirectives(), aliasAttrs)); // Continue with the next capability. break;