Author: rickhall
Date: Tue Jun 7 18:00:08 2011
New Revision: 1133117
URL: http://svn.apache.org/viewvc?rev=1133117&view=rev
Log:
Use R4.3 capability namespaces where possible. (FELIX-2950)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionDependencies.java
Tue Jun 7 18:00:08 2011
@@ -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 @@ class BundleRevisionDependencies
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 @@ class BundleRevisionDependencies
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())
{
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Tue Jun 7 18:00:08 2011
@@ -202,7 +202,7 @@ public class BundleWiringImpl implements
capIdx++)
{
if (caps.get(capIdx).getNamespace().equals(
- BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ BundleRevision.PACKAGE_NAMESPACE))
{
capList.add(
new HostedCapability(
@@ -225,9 +225,9 @@ public class BundleWiringImpl implements
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 @@ public class BundleWiringImpl implements
? 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 @@ public class BundleWiringImpl implements
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 @@ public class BundleWiringImpl implements
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)
{
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=1133117&r1=1133116&r2=1133117&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 Jun 7 18:00:08 2011
@@ -93,7 +93,7 @@ class ExtensionManager extends URLStream
{
// 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 @@ class ExtensionManager extends URLStream
{
// 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 @@ class ExtensionManager extends URLStream
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)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Tue Jun 7 18:00:08 2011
@@ -3425,7 +3425,7 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
{
// 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 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
// 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 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
// 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 @@ public class Felix extends BundleImpl im
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 @@ public class Felix extends BundleImpl im
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);
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/ResolverStateImpl.java
Tue Jun 7 18:00:08 2011
@@ -78,15 +78,15 @@ class ResolverStateImpl implements Resol
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 @@ class ResolverStateImpl implements Resol
// 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 @@ class ResolverStateImpl implements Resol
{
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 @@ class ResolverStateImpl implements Resol
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 @@ class ResolverStateImpl implements Resol
{
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 @@ class ResolverStateImpl implements Resol
}
}
- if
(req.getNamespace().equals(BundleCapabilityImpl.HOST_NAMESPACE)
+ if (req.getNamespace().equals(BundleRevision.HOST_NAMESPACE)
&& (cap.getRevision().getWiring() != null))
{
continue;
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
Tue Jun 7 18:00:08 2011
@@ -23,6 +23,7 @@ import org.apache.felix.framework.wiring
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 @@ public class CandidateComparator impleme
}
// 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 @@ public class CandidateComparator impleme
}
}
// 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));
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
Tue Jun 7 18:00:08 2011
@@ -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 @@ class Candidates
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 @@ class Candidates
// 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 @@ class Candidates
**/
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 @@ class Candidates
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 @@ class Candidates
actual.add(req);
}
}
- }
+ }
}
/**
@@ -856,7 +856,7 @@ class Candidates
**/
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 @@ class Candidates
{
final List<BundleCapability> modCaps =
Util.getCapabilityByNamespace(
- revision, BundleCapabilityImpl.BUNDLE_NAMESPACE);
+ revision, BundleRevision.BUNDLE_NAMESPACE);
if (modCaps == null || modCaps.isEmpty())
{
return false;
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostBundleRevision.java
Tue Jun 7 18:00:08 2011
@@ -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 @@ class HostBundleRevision implements Bund
{
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 @@ class HostBundleRevision implements Bund
{
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));
}
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/HostedCapability.java
Tue Jun 7 18:00:08 2011
@@ -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 @@ public class HostedCapability extends Bu
{
return getAttributes().toString();
}
- if (getNamespace().equals(BundleCapabilityImpl.PACKAGE_NAMESPACE))
+ if (getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
{
return "[" + m_host + "] "
+ getNamespace() + "; " +
getAttributes().get(BundleCapabilityImpl.PACKAGE_ATTR);
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
Tue Jun 7 18:00:08 2011
@@ -91,7 +91,7 @@ public class ResolverImpl implements Res
// 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 @@ public class ResolverImpl implements Res
// 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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
: 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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
{
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
: 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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
// 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 @@ public class ResolverImpl implements Res
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 @@ public class ResolverImpl implements Res
}
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 @@ public class ResolverImpl implements Res
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("=");
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/Util.java
Tue Jun 7 18:00:08 2011
@@ -356,7 +356,7 @@ public class Util
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))
{
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
Tue Jun 7 18:00:08 2011
@@ -111,7 +111,7 @@ public class ManifestParser
{
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 @@ public class ManifestParser
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 @@ public class ManifestParser
reqList.add(
new BundleRequirementImpl(
owner,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
@@ -820,7 +820,7 @@ public class ManifestParser
capList.add(
new BundleCapabilityImpl(
owner,
- BundleCapabilityImpl.PACKAGE_NAMESPACE,
+ BundleRevision.PACKAGE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
@@ -1173,7 +1173,7 @@ public class ManifestParser
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 @@ public class ManifestParser
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 @@ public class ManifestParser
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 @@ public class ManifestParser
reqList.add(
new BundleRequirementImpl(
owner,
- BundleCapabilityImpl.BUNDLE_NAMESPACE,
+ BundleRevision.BUNDLE_NAMESPACE,
clause.m_dirs,
newAttrs));
}
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java?rev=1133117&r1=1133116&r2=1133117&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
Tue Jun 7 18:00:08 2011
@@ -34,9 +34,6 @@ import org.osgi.framework.wiring.BundleR
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 @@ public class BundleCapabilityImpl implem
{
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);