Use R4.3 capability namespaces where possible. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1133117 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java b/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
index 1a397a6..ee50cb4 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -170,10 +170,10 @@
for (Entry<BundleCapability, Set<BundleRevision>> entry : caps.entrySet())
{
BundleCapability cap = entry.getKey();
- if ((cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ if ((cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
&& cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR)
.equals(pkgName))
- || cap.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ || cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
for (BundleRevision dependent : entry.getValue())
{
@@ -203,7 +203,7 @@
for (Entry<BundleCapability, Set<BundleRevision>> entry : caps.entrySet())
{
if (entry.getKey().getNamespace()
- .equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ .equals(BundleRevision.BUNDLE_NAMESPACE))
{
for (BundleRevision dependent : entry.getValue())
{
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index d45490e..ea0ca0a 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -202,7 +202,7 @@
capIdx++)
{
if (caps.get(capIdx).getNamespace().equals(
- BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ BundleRevision.PACKAGE_NAMESPACE))
{
capList.add(
new HostedCapability(
@@ -225,9 +225,9 @@
reqIdx++)
{
if (reqs.get(reqIdx).getNamespace().equals(
- BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ BundleRevision.PACKAGE_NAMESPACE)
|| reqs.get(reqIdx).getNamespace().equals(
- BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ BundleRevision.BUNDLE_NAMESPACE))
{
reqList.add(
new HostedRequirement(
@@ -1863,7 +1863,7 @@
? null : revision.getWiring().getProvidedWires(null);
for (int i = 0; (wires != null) && (i < wires.size()); i++)
{
- if (wires.get(i).getCapability().getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE) &&
+ if (wires.get(i).getCapability().getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE) &&
wires.get(i).getCapability().getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR).equals(pkgName))
{
String exporter = wires.get(i).getProviderWiring().getBundle().toString();
@@ -1957,7 +1957,7 @@
Map<String, Object> attrs = new HashMap<String, Object>(1);
attrs.put(BundleCapabilityImpl.PACKAGE_ATTR, pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
- revision, BundleCapabilityImpl.PACKAGE_NAMESPACE, dirs, attrs);
+ revision, BundleRevision.PACKAGE_NAMESPACE, dirs, attrs);
Set<BundleCapability> exporters = resolver.getCandidates(req, false);
BundleRevision provider = null;
@@ -1996,7 +1996,7 @@
Map<String, Object> attrs = new HashMap<String, Object>(1);
attrs.put(BundleCapabilityImpl.PACKAGE_ATTR, pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
- revision, BundleCapabilityImpl.PACKAGE_NAMESPACE, dirs, attrs);
+ revision, BundleRevision.PACKAGE_NAMESPACE, dirs, attrs);
Set<BundleCapability> exports = resolver.getCandidates(req, false);
if (exports.size() > 0)
{
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index b30a70b..5c63347 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -93,7 +93,7 @@
{
// pre-init the url sub-system as otherwise we don't work on gnu/classpath
ExtensionManager extensionManager = new ExtensionManager();
- try
+ try
{
(new URL("http://felix.extensions:9/")).openConnection();
}
@@ -101,7 +101,7 @@
{
// This doesn't matter much - we only need the above to init the url subsystem
}
-
+
// We use the secure action of Felix to add a new instance to the parent
// classloader.
try
@@ -440,7 +440,7 @@
for (int i = 0; (m_capabilities != null) && (i < m_capabilities.size()); i++)
{
- if (m_capabilities.get(i).getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (m_capabilities.get(i).getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
// Add a comma separate if there is an existing package.
if (exportSB.length() > 0)
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 2effc1a..b362f2a 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3425,7 +3425,7 @@
attrs.put(BundleCapabilityImpl.PACKAGE_ATTR, pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
null,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs);
Set<BundleCapability> exports = m_resolver.getCandidates(req, false);
@@ -3569,7 +3569,7 @@
{
// See if the target bundle's revisions is one of the
// resolved exporters of the package.
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
String pkgName = (String)
cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR);
@@ -3578,7 +3578,7 @@
BundleRequirementImpl req =
new BundleRequirementImpl(
null,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs);
Set<BundleCapability> providers = m_resolver.getCandidates(req, false);
@@ -4495,7 +4495,7 @@
// attempt to dynamically import it.
for (BundleCapability cap : revision.getWiring().getCapabilities(null))
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
&& cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR).equals(pkgName))
{
return false;
@@ -4516,7 +4516,7 @@
attrs.put(BundleCapabilityImpl.PACKAGE_ATTR, pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs);
Set<BundleCapability> candidates = m_resolverState.getCandidates(req, false);
@@ -4607,7 +4607,7 @@
m_logger.log(Logger.LOG_DEBUG, "WIRE: " + rw.toString());
if (rw.getCapability().getNamespace()
- .equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ .equals(BundleRevision.PACKAGE_NAMESPACE))
{
importedPkgs.put(
(String) rw.getCapability().getAttributes()
@@ -4615,7 +4615,7 @@
rw.getProvider());
}
else if (rw.getCapability().getNamespace()
- .equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ .equals(BundleRevision.BUNDLE_NAMESPACE))
{
Set<String> pkgs = calculateExportedAndReexportedPackages(
rw.getProvider(),
@@ -4793,7 +4793,7 @@
// Add all exported packages.
for (BundleCapability cap : br.getDeclaredCapabilities(null))
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
pkgs.add((String)
cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR));
@@ -4807,7 +4807,7 @@
for (ResolverWire rw : wireMap.get(br))
{
if (rw.getCapability().getNamespace().equals(
- BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ BundleRevision.BUNDLE_NAMESPACE))
{
String dir = rw.getRequirement()
.getDirectives().get(Constants.VISIBILITY_DIRECTIVE);
@@ -4827,7 +4827,7 @@
for (BundleWire bw : br.getWiring().getRequiredWires(null))
{
if (bw.getCapability().getNamespace().equals(
- BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ BundleRevision.BUNDLE_NAMESPACE))
{
String dir = bw.getRequirement()
.getDirectives().get(Constants.VISIBILITY_DIRECTIVE);
diff --git a/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java b/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
index a663de5..fc4ce43 100644
--- a/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
@@ -78,15 +78,15 @@
List<String> indices = new ArrayList<String>();
indices.add(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE);
- m_capSets.put(BundleCapabilityImpl.BUNDLE_NAMESPACE, new CapabilitySet(indices, true));
+ m_capSets.put(BundleRevision.BUNDLE_NAMESPACE, new CapabilitySet(indices, true));
indices = new ArrayList<String>();
indices.add(BundleCapabilityImpl.PACKAGE_ATTR);
- m_capSets.put(BundleCapabilityImpl.PACKAGE_NAMESPACE, new CapabilitySet(indices, true));
+ m_capSets.put(BundleRevision.PACKAGE_NAMESPACE, new CapabilitySet(indices, true));
indices = new ArrayList<String>();
indices.add(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE);
- m_capSets.put(BundleCapabilityImpl.HOST_NAMESPACE, new CapabilitySet(indices, true));
+ m_capSets.put(BundleRevision.HOST_NAMESPACE, new CapabilitySet(indices, true));
}
synchronized void addRevision(BundleRevision br)
@@ -157,15 +157,15 @@
// corresponding package capability from the package capability set.
for (BundleWire w : br.getWiring().getRequiredWires(null))
{
- if (w.getCapability().getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (w.getCapability().getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
for (BundleCapability cap : br.getWiring().getCapabilities(null))
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
&& w.getCapability().getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR)
.equals(cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR)))
{
- m_capSets.get(BundleCapabilityImpl.PACKAGE_NAMESPACE).removeCapability(cap);
+ m_capSets.get(BundleRevision.PACKAGE_NAMESPACE).removeCapability(cap);
break;
}
}
@@ -193,7 +193,7 @@
{
if (System.getSecurityManager() != null)
{
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE) && (
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE) && (
!((BundleProtectionDomain) ((BundleRevisionImpl) cap.getRevision()).getProtectionDomain()).impliesDirect(
new PackagePermission((String) cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR),
PackagePermission.EXPORTONLY)) ||
@@ -208,7 +208,7 @@
continue;
}
}
- else if (req.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE) && (
+ else if (req.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE) && (
!((BundleProtectionDomain) ((BundleRevisionImpl) cap.getRevision()).getProtectionDomain()).impliesDirect(
new BundlePermission(cap.getRevision().getSymbolicName(), BundlePermission.PROVIDE)) ||
!((reqRevision == null) ||
@@ -218,7 +218,7 @@
{
continue;
}
- else if (req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE) &&
+ else if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE) &&
(!((BundleProtectionDomain) reqRevision.getProtectionDomain())
.impliesDirect(new BundlePermission(
reqRevision.getSymbolicName(),
@@ -232,7 +232,7 @@
}
}
- if (req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE)
+ if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE)
&& (cap.getRevision().getWiring() != null))
{
continue;
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java b/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
index 7a96ad1..3140a1c 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
@@ -23,6 +23,7 @@
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.BundleCapability;
+import org.osgi.framework.wiring.BundleRevision;
public class CandidateComparator implements Comparator<BundleCapability>
{
@@ -44,7 +45,7 @@
}
// Compare revision capabilities.
- if ((c == 0) && cap1.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ if ((c == 0) && cap1.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
c = ((Comparable) cap1.getAttributes().get(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE))
.compareTo(cap2.getAttributes().get(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE));
@@ -62,7 +63,7 @@
}
}
// Compare package capabilities.
- else if ((c == 0) && cap1.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ else if ((c == 0) && cap1.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
c = ((Comparable) cap1.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR))
.compareTo(cap2.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR));
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
index bd61f3d..b5c09cf 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -361,7 +361,7 @@
it.hasNext(); )
{
BundleRequirement r = it.next();
- if (r.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE))
+ if (r.getNamespace().equals(BundleRevision.HOST_NAMESPACE))
{
hostReq = r;
it.remove();
@@ -391,7 +391,7 @@
// If there are populates host candidates, then finish up
// some other checks and prepopulate the result cache with
// the work we've done so far.
-
+
// Verify that any required execution environment is satisfied.
state.checkExecutionEnvironment(revision);
@@ -485,7 +485,7 @@
**/
private void add(BundleRequirement req, SortedSet<BundleCapability> candidates)
{
- if (req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE))
{
m_fragmentsPresent = true;
}
@@ -769,7 +769,7 @@
dependents.add(req);
// Keep track of hosts and associated fragments.
- if (req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE))
{
Map<String, Map<Version, List<BundleRequirement>>>
fragments = m_hostFragments.get(cap);
@@ -795,7 +795,7 @@
actual.add(req);
}
}
- }
+ }
}
/**
@@ -856,7 +856,7 @@
**/
private void remove(BundleRequirement req)
{
- boolean isFragment = req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE);
+ boolean isFragment = req.getNamespace().equals(BundleRevision.HOST_NAMESPACE);
SortedSet<BundleCapability> candidates = m_candidateMap.remove(req);
if (candidates != null)
@@ -1028,7 +1028,7 @@
{
final List<BundleCapability> modCaps =
Util.getCapabilityByNamespace(
- revision, BundleCapabilityImpl.BUNDLE_NAMESPACE);
+ revision, BundleRevision.BUNDLE_NAMESPACE);
if (modCaps == null || modCaps.isEmpty())
{
return false;
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java b/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
index 9551ec1..ec47d5a 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -82,7 +82,7 @@
{
for (BundleCapability cap : fragment.getDeclaredCapabilities(null))
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
caps.add(new HostedCapability(this, (BundleCapabilityImpl) cap));
}
@@ -113,8 +113,8 @@
{
for (BundleRequirement req : fragment.getDeclaredRequirements(null))
{
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
- || req.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
+ || req.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
reqs.add(new HostedRequirement(this, (BundleRequirementImpl) req));
}
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java b/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
index 70c282e..abe24e4 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -110,7 +110,7 @@
{
return getAttributes().toString();
}
- if (getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
return "[" + m_host + "] "
+ getNamespace() + "; " + getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR);
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
index d949df7..c0ea759 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
@@ -91,7 +91,7 @@
// If the requested revision is a fragment, then
// ultimately we will verify the host.
List<BundleRequirement> hostReqs =
- revision.getDeclaredRequirements(BundleCapabilityImpl.HOST_NAMESPACE);
+ revision.getDeclaredRequirements(BundleRevision.HOST_NAMESPACE);
BundleRevision target = revision;
@@ -348,7 +348,7 @@
// attempt to dynamically import it.
for (BundleCapability cap : revision.getWiring().getCapabilities(null))
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
&& cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR).equals(pkgName))
{
return null;
@@ -369,7 +369,7 @@
attrs.put(BundleCapabilityImpl.PACKAGE_ATTR, pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs);
SortedSet<BundleCapability> candidates = state.getCandidates(req, false);
@@ -619,12 +619,12 @@
Map<BundleRevision, Packages> revisionPkgMap,
Candidates allCandidates)
{
- if (candCap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (candCap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
mergeCandidatePackage(
current, false, currentReq, candCap, revisionPkgMap);
}
- else if (candCap.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ else if (candCap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
// TODO: FELIX3 - THIS NEXT LINE IS A HACK. IMPROVE HOW/WHEN WE CALCULATE EXPORTS.
calculateExportedPackages(
@@ -653,7 +653,7 @@
: candCap.getRevision().getDeclaredRequirements(null);
for (BundleRequirement req : reqs)
{
- if (req.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
String value = req.getDirectives().get(Constants.VISIBILITY_DIRECTIVE);
if ((value != null) && value.equals(Constants.VISIBILITY_REEXPORT)
@@ -676,7 +676,7 @@
BundleRequirement currentReq, BundleCapability candCap,
Map<BundleRevision, Packages> revisionPkgMap)
{
- if (candCap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (candCap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
// Merge the candidate capability into the revision's package space
// for imported or required packages, appropriately.
@@ -1144,7 +1144,7 @@
new HashMap<String, BundleCapability>(caps.size());
for (BundleCapability cap : caps)
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
exports.put(
(String) cap.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR),
@@ -1162,7 +1162,7 @@
for (BundleWire wire : revision.getWiring().getRequiredWires(null))
{
if (wire.getRequirement().getNamespace().equals(
- BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ BundleRevision.PACKAGE_NAMESPACE))
{
String pkgName = (String) wire.getCapability()
.getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR);
@@ -1174,7 +1174,7 @@
{
for (BundleRequirement req : revision.getDeclaredRequirements(null))
{
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
Set<BundleCapability> cands =
allCandidates.getCandidates((BundleRequirementImpl) req);
@@ -1231,7 +1231,7 @@
private List<BundleCapability> getPackageSources(
BundleCapability cap, Map<BundleRevision, Packages> revisionPkgMap)
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
List<BundleCapability> sources = m_packageSourcesCache.get(cap);
if (sources == null)
@@ -1257,7 +1257,7 @@
BundleCapability cap, Map<BundleRevision, Packages> revisionPkgMap,
List<BundleCapability> sources, Set<BundleCapability> cycleMap)
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
if (cycleMap.contains(cap))
{
@@ -1276,7 +1276,7 @@
: cap.getRevision().getDeclaredCapabilities(null);
for (int capIdx = 0; capIdx < caps.size(); capIdx++)
{
- if (caps.get(capIdx).getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE)
+ if (caps.get(capIdx).getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)
&& caps.get(capIdx).getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR).equals(pkgName))
{
sources.add(caps.get(capIdx));
@@ -1360,11 +1360,11 @@
getActualRequirement(req),
getActualBundleRevision(cand.getRevision()),
getActualCapability(cand));
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
packageWires.add(wire);
}
- else if (req.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ else if (req.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
bundleWires.add(wire);
}
@@ -1397,10 +1397,10 @@
new ResolverWireImpl(
getActualBundleRevision(fragment),
fragment.getDeclaredRequirements(
- BundleCapabilityImpl.HOST_NAMESPACE).get(0),
+ BundleRevision.HOST_NAMESPACE).get(0),
unwrappedRevision,
unwrappedRevision.getDeclaredCapabilities(
- BundleCapabilityImpl.HOST_NAMESPACE).get(0)));
+ BundleRevision.HOST_NAMESPACE).get(0)));
}
}
}
@@ -1443,7 +1443,7 @@
// conflict with previous ones.
new BundleRequirementImpl(
revision,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
Collections.EMPTY_MAP,
attrs),
getActualBundleRevision(blame.m_cap.getRevision()),
@@ -1505,7 +1505,7 @@
sb.append(" [");
sb.append(req.getRevision().toString());
sb.append("]\n");
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
sb.append(" import: ");
}
@@ -1515,7 +1515,7 @@
}
sb.append(((BundleRequirementImpl) req).getFilter().toString());
sb.append("\n |");
- if (req.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
sb.append("\n export: ");
}
@@ -1528,7 +1528,7 @@
BundleCapability cap = Util.getSatisfyingCapability(
blame.m_reqs.get(i + 1).getRevision(),
(BundleRequirementImpl) blame.m_reqs.get(i));
- if (cap.getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
sb.append(BundleCapabilityImpl.PACKAGE_ATTR);
sb.append("=");
diff --git a/framework/src/main/java/org/apache/felix/framework/util/Util.java b/framework/src/main/java/org/apache/felix/framework/util/Util.java
index c52e1a5..3bdf0c3 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/Util.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/Util.java
@@ -356,7 +356,7 @@
for (BundleWire w : wires)
{
if (w.getCapability().getNamespace()
- .equals(BundleCapabilityImpl.PACKAGE_NAMESPACE) &&
+ .equals(BundleRevision.PACKAGE_NAMESPACE) &&
w.getCapability().getAttributes()
.get(BundleCapabilityImpl.PACKAGE_ATTR).equals(name))
{
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
index 78073f2..f862ced 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
@@ -111,7 +111,7 @@
{
capList.add(requireCap);
capList.add(new BundleCapabilityImpl(
- owner, BundleCapabilityImpl.HOST_NAMESPACE,
+ owner, BundleRevision.HOST_NAMESPACE,
Collections.EMPTY_MAP,
// TODO: OSGi R4.3 - Wraps map as unmodifiable twice.
requireCap.getAttributes()));
@@ -270,7 +270,7 @@
private static boolean isSingleton(BundleCapabilityImpl cap)
{
- if (cap.getNamespace().equals(BundleCapabilityImpl.BUNDLE_NAMESPACE))
+ if (cap.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE))
{
String value = cap.getDirectives().get(Constants.SINGLETON_DIRECTIVE);
if ((value != null) && Boolean.valueOf(value))
@@ -426,7 +426,7 @@
reqList.add(
new BundleRequirementImpl(
owner,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
@@ -820,7 +820,7 @@
capList.add(
new BundleCapabilityImpl(
owner,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
@@ -1173,7 +1173,7 @@
dirs.put(Constants.USES_DIRECTIVE, usesValue);
exports.set(i, new BundleCapabilityImpl(
exports.get(i).getRevision(),
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
dirs,
exports.get(i).getAttributes()));
}
@@ -1256,7 +1256,7 @@
attrs.put(Constants.BUNDLE_VERSION_ATTRIBUTE, bundleVersion);
return new BundleCapabilityImpl(
owner,
- BundleCapabilityImpl.BUNDLE_NAMESPACE,
+ BundleRevision.BUNDLE_NAMESPACE,
clauses.get(0).m_dirs,
attrs);
}
@@ -1322,7 +1322,7 @@
newAttrs.putAll(attrs);
reqs.add(new BundleRequirementImpl(
- owner, BundleCapabilityImpl.HOST_NAMESPACE,
+ owner, BundleRevision.HOST_NAMESPACE,
clauses.get(0).m_dirs,
newAttrs));
}
@@ -1411,7 +1411,7 @@
reqList.add(
new BundleRequirementImpl(
owner,
- BundleCapabilityImpl.BUNDLE_NAMESPACE,
+ BundleRevision.BUNDLE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
diff --git a/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java b/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
index f7400b4..77c24ae 100644
--- a/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
@@ -34,9 +34,6 @@
public class BundleCapabilityImpl implements BundleCapability
{
- public static final String BUNDLE_NAMESPACE = "module";
- public static final String HOST_NAMESPACE = "host";
- public static final String PACKAGE_NAMESPACE = "package";
public static final String SINGLETON_NAMESPACE = "singleton";
public static final String PACKAGE_ATTR = "package";
@@ -199,7 +196,7 @@
{
return m_attrs.toString();
}
- if (m_namespace.equals(PACKAGE_NAMESPACE))
+ if (m_namespace.equals(BundleRevision.PACKAGE_NAMESPACE))
{
return "[" + m_revision + "] "
+ m_namespace + "; " + m_attrs.get(PACKAGE_ATTR);