You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2006/09/08 16:36:58 UTC
svn commit: r441518 [2/3] - in
/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix:
framework/ framework/searchpolicy/ framework/util/ framework/util/ldap/
moduleloader/
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java Fri Sep 8 07:36:56 2006
@@ -23,15 +23,14 @@
import org.apache.felix.framework.util.*;
import org.apache.felix.moduleloader.*;
import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
+import org.osgi.framework.InvalidSyntaxException;
public class R4SearchPolicyCore implements ModuleListener
{
private Logger m_logger = null;
private PropertyResolver m_config = null;
private IModuleFactory m_factory = null;
- private Map m_availPkgMap = new HashMap();
- private Map m_inUsePkgMap = new HashMap();
+ private Map m_inUseCapMap = new HashMap();
private Map m_moduleDataMap = new HashMap();
// Boot delegation packages.
@@ -44,6 +43,8 @@
// Reusable empty array.
public static final IModule[] m_emptyModules = new IModule[0];
+ public static final ICapability[] m_emptyCapabilities = new ICapability[0];
+ public static final ResolverCandidate[] m_emptyCandidates= new ResolverCandidate[0];
// Re-usable security manager for accessing class context.
private static SecurityManagerEx m_sm = new SecurityManagerEx();
@@ -109,17 +110,25 @@
public Object[] definePackage(IModule module, String pkgName)
{
- R4Package pkg = Util.getExportPackage(module, pkgName);
- if (pkg != null)
+ try
{
- return new Object[] {
- pkgName, // Spec title.
- pkg.getVersion().toString(), // Spec version.
- "", // Spec vendor.
- "", // Impl title.
- "", // Impl version.
- "" // Impl vendor.
- };
+ ICapability cap = Util.getSatisfyingCapability(module,
+ new Requirement(ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")"));
+ if (cap != null)
+ {
+ return new Object[] {
+ pkgName, // Spec title.
+ cap.getProperties().get(ICapability.VERSION_PROPERTY).toString(), // Spec version.
+ "", // Spec vendor.
+ "", // Impl title.
+ "", // Impl version.
+ "" // Impl vendor.
+ };
+ }
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
}
return null;
}
@@ -184,7 +193,7 @@
// potentially leak internal module information.
throw new ClassNotFoundException(
name + ": cannot resolve package "
- + ex.getPackage());
+ + ex.getRequirement());
}
else
{
@@ -200,7 +209,7 @@
// We need to throw a resource not found exception.
throw new ResourceNotFoundException(
name + ": cannot resolve package "
- + ex.getPackage());
+ + ex.getRequirement());
}
}
@@ -358,141 +367,113 @@
return null;
}
- private IWire attemptDynamicImport(IModule module, String pkgName)
+ private IWire attemptDynamicImport(IModule importer, String pkgName)
{
R4Wire wire = null;
- IModule candidate = null;
+ ResolverCandidate candidate = null;
// There is an overriding assumption here that a package is
// never split across bundles. If a package can be split
// across bundles, then this will fail.
- try
- {
- // Get the matching dynamic import, if any.
- R4Import impMatch = createDynamicImportTarget(module, pkgName);
-
- // If the target package does not match any dynamically imported
- // packages or if the module is already wired for the target package,
- // then just return null. The module may be already wired to the target
- // package if the class being searched for does not actually exist.
- if ((impMatch == null) || (Util.getWire(module, impMatch.getName()) != null))
- {
- return null;
- }
-
- // At this point, the target package has matched a dynamically
- // imported package spec. Now we must try to find a candidate
- // exporter for target package and add it to the module's set
- // of wires.
-
- // Lock module manager instance to ensure that nothing changes.
- synchronized (m_factory)
- {
- // Try to add a new entry to the module's import attribute.
- // Select the first candidate that successfully resolves.
-
- // First check already resolved exports for a match.
- IModule[] candidates = getInUseExporters(impMatch, false);
- // If there is an "in use" candidate, just take the first one.
- if (candidates.length > 0)
+ // Only attempt to dynamically import a package if the module does
+ // not already have a wire for the package; this may be the case if
+ // the class being searched for actually does not exist.
+ if (Util.getWire(importer, pkgName) == null)
+ {
+ // Loop through the importer's dynamic requirements to determine if
+ // there is a matching one for the package from which we want to
+ // load a class.
+ IRequirement[] dynamics = importer.getDefinition().getDynamicRequirements();
+ for (int i = 0; (dynamics != null) && (i < dynamics.length); i++)
+ {
+ // Constrain the current dynamic requirement to include
+ // the precise package name for which we are searching; this
+ // is necessary because we cannot easily determine which
+ // package name a given dynamic requirement matches, since
+ // it is only a filter.
+ IRequirement req = null;
+ try
+ {
+ req = new Requirement(
+ ICapability.PACKAGE_NAMESPACE,
+ "(&" + dynamics[i].getFilter().toString()
+ + "(package=" + pkgName + "))");
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
+
+ // See if there is a candidate exporter that satisfies the
+ // constrained dynamic requirement.
+ try
{
- candidate = candidates[0];
- }
-
- // If there were no "in use" candidates, then try "available"
- // candidates.
- if (candidate == null)
- {
- candidates = getAvailableExporters(impMatch, false);
- for (int candIdx = 0;
- (candidate == null) && (candIdx < candidates.length);
- candIdx++)
+ // Lock module manager instance to ensure that nothing changes.
+ synchronized (m_factory)
{
- try
+ // First check "in use" candidates for a match.
+ ResolverCandidate[] candidates = getInUseCandidates(req, false);
+ // If there is an "in use" candidate, just take the first one.
+ if (candidates.length > 0)
{
- resolve(module);
- candidate = candidates[candIdx];
+ candidate = candidates[0];
}
- catch (ResolveException ex)
+
+ // If there were no "in use" candidates, then try "available"
+ // candidates.
+ if (candidate == null)
{
- }
- }
- }
+ candidates = getAvailableCandidates(req, false);
- // If we found a candidate, then add it to the module's
- // wiring attribute.
- if (candidate != null)
- {
- IWire[] wires = module.getWires();
- R4Wire[] newWires = null;
- if (wires == null)
- {
- newWires = new R4Wire[1];
- }
- else
- {
- newWires = new R4Wire[wires.length + 1];
- System.arraycopy(wires, 0, newWires, 0, wires.length);
- }
- // Find the candidate's export package object and
- // use that for creating the wire; this is necessary
- // since it contains "uses" dependency information.
- wire = new R4Wire(
- module, candidate,
- Util.getExportPackage(candidate, impMatch.getName()));
- newWires[newWires.length - 1] = wire;
- ((ModuleImpl) module).setWires(newWires);
-m_logger.log(Logger.LOG_DEBUG, "WIRE: " + newWires[newWires.length - 1]);
- }
- }
- }
- catch (Exception ex)
- {
- m_logger.log(Logger.LOG_ERROR, "Unable to dynamically import package.", ex);
- }
+ // Take the first candidate that can resolve.
+ for (int candIdx = 0;
+ (candidate == null) && (candIdx < candidates.length);
+ candIdx++)
+ {
+ try
+ {
+ resolve(candidates[candIdx].m_module);
+ candidate = candidates[candIdx];
+ }
+ catch (ResolveException ex)
+ {
+ // Ignore candidates that cannot resolve.
+ }
+ }
+ }
- return wire;
- }
+ if (candidate != null)
+ {
+ IWire[] wires = importer.getWires();
+ R4Wire[] newWires = null;
+ if (wires == null)
+ {
+ newWires = new R4Wire[1];
+ }
+ else
+ {
+ newWires = new R4Wire[wires.length + 1];
+ System.arraycopy(wires, 0, newWires, 0, wires.length);
+ }
- private R4Import createDynamicImportTarget(IModule module, String pkgName)
- {
- // Check the dynamic import specs for a match of
- // the target package.
- R4Import[] dynamics = module.getDefinition().getDynamicImports();
- R4Import impMatch = null;
- for (int i = 0; (impMatch == null) && (dynamics != null)
- && (i < dynamics.length); i++)
- {
- // Star matches everything.
- if (dynamics[i].getName().equals("*"))
- {
- // Create a package instance without wildcard.
- impMatch = new R4Import(pkgName, dynamics[i]
- .getDirectives(), dynamics[i].getAttributes());
- }
- // Packages ending in ".*" must match starting strings.
- else if (dynamics[i].getName().endsWith(".*"))
- {
- if (pkgName.regionMatches(0, dynamics[i].getName(), 0,
- dynamics[i].getName().length() - 2))
- {
- // Create a package instance without wildcard.
- impMatch = new R4Import(pkgName, dynamics[i]
- .getDirectives(), dynamics[i].getAttributes());
+ // Create the wire and add it to the module.
+ wire = new R4Wire(
+ importer, candidate.m_module, candidate.m_capability);
+ newWires[newWires.length - 1] = wire;
+ ((ModuleImpl) importer).setWires(newWires);
+m_logger.log(Logger.LOG_DEBUG, "WIRE: " + newWires[newWires.length - 1]);
+ }
+ }
}
- }
- // Or we can have a precise match.
- else
- {
- if (pkgName.equals(dynamics[i].getName()))
+ catch (Exception ex)
{
- impMatch = dynamics[i];
+ m_logger.log(Logger.LOG_ERROR, "Unable to dynamically import package.", ex);
}
}
}
- return impMatch;
+ return wire;
}
public String findLibrary(IModule module, String name)
@@ -518,28 +499,72 @@
return null;
}
- public IModule[] getAvailableExporters(R4Import pkg, boolean includeRemovalPending)
+ public ResolverCandidate[] getInUseCandidates(IRequirement req, boolean includeRemovalPending)
{
// Synchronized on the module manager to make sure that no
// modules are added, removed, or resolved.
synchronized (m_factory)
{
- return getCompatibleExporters(
- (IModule[]) m_availPkgMap.get(pkg.getName()), pkg, includeRemovalPending);
+ ResolverCandidate[] candidates = m_emptyCandidates;
+ Iterator i = m_inUseCapMap.entrySet().iterator();
+ while (i.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) i.next();
+ IModule module = (IModule) entry.getKey();
+ ICapability[] inUseCaps = (ICapability[]) entry.getValue();
+ for (int capIdx = 0; capIdx < inUseCaps.length; capIdx++)
+ {
+ if (req.isSatisfied(inUseCaps[capIdx]))
+ {
+ ResolverCandidate[] tmp = new ResolverCandidate[candidates.length + 1];
+ System.arraycopy(candidates, 0, tmp, 0, candidates.length);
+ tmp[candidates.length] = new ResolverCandidate(module, inUseCaps[capIdx]);
+ candidates = tmp;
+ }
+ }
+ }
+ return candidates;
}
}
- public IModule[] getInUseExporters(R4Import pkg, boolean includeRemovalPending)
+ public ResolverCandidate[] getAvailableCandidates(IRequirement req, boolean includeRemovalPending)
{
// Synchronized on the module manager to make sure that no
// modules are added, removed, or resolved.
synchronized (m_factory)
{
- return getCompatibleExporters(
- (IModule[]) m_inUsePkgMap.get(pkg.getName()), pkg, includeRemovalPending);
+ return getCompatibleCandidates(
+ (IModule[]) m_factory.getModules(), req, includeRemovalPending);
}
}
+ private ResolverCandidate[] getCompatibleCandidates(
+ IModule[] modules, IRequirement req, boolean includeRemovalPending)
+ {
+ // Create list of compatible exporters.
+ ResolverCandidate[] candidates = m_emptyCandidates;
+ for (int modIdx = 0; (modules != null) && (modIdx < modules.length); modIdx++)
+ {
+ // The spec says that we cannot consider modules that
+ // are pending removal, so ignore them.
+ if (includeRemovalPending || !modules[modIdx].isRemovalPending())
+ {
+ // Get the module's export package for the target package.
+ ICapability cap = Util.getSatisfyingCapability(modules[modIdx], req);
+ // If compatible, then add the candidate to the list.
+ if (cap != null)
+ {
+ ResolverCandidate[] tmp = new ResolverCandidate[candidates.length + 1];
+ System.arraycopy(candidates, 0, tmp, 0, candidates.length);
+ tmp[candidates.length] = new ResolverCandidate(modules[modIdx], cap);
+ candidates = tmp;
+ }
+ }
+ }
+
+ return candidates;
+ }
+
public void resolve(IModule rootModule)
throws ResolveException
{
@@ -627,7 +652,7 @@
{
return;
}
- // Map to hold the module's import packages
+ // List to hold the module's import packages
// and their respective resolving candidates.
List nodeList = new ArrayList();
@@ -638,16 +663,17 @@
// Loop through each import and calculate its resolving
// set of candidates.
- R4Import[] imports = module.getDefinition().getImports();
- for (int impIdx = 0; (imports != null) && (impIdx < imports.length); impIdx++)
+ IRequirement[] reqs = module.getDefinition().getRequirements();
+ for (int reqIdx = 0; (reqs != null) && (reqIdx < reqs.length); reqIdx++)
{
// Get the candidates from the "in use" and "available"
// package maps. Candidates "in use" have higher priority
// than "available" ones, so put the "in use" candidates
// at the front of the list of candidates.
- IModule[] inuse = getInUseExporters(imports[impIdx], false);
- IModule[] available = getAvailableExporters(imports[impIdx], false);
- IModule[] candidates = new IModule[inuse.length + available.length];
+ ResolverCandidate[] inuse = getInUseCandidates(reqs[reqIdx], false);
+ ResolverCandidate[] available = getAvailableCandidates(reqs[reqIdx], false);
+ ResolverCandidate[] candidates = new ResolverCandidate[inuse.length + available.length];
+// TODO: ML - This duplicates "in use" candidates from "available" candidates.
System.arraycopy(inuse, 0, candidates, 0, inuse.length);
System.arraycopy(available, 0, candidates, inuse.length, available.length);
@@ -662,9 +688,9 @@
{
// Only populate the resolver map with modules that
// are not already resolved.
- if (!isResolved(candidates[candIdx]))
+ if (!isResolved(candidates[candIdx].m_module))
{
- populateResolverMap(resolverMap, candidates[candIdx]);
+ populateResolverMap(resolverMap, candidates[candIdx].m_module);
}
}
catch (ResolveException ex)
@@ -680,12 +706,12 @@
// Remove any nulled candidates to create the final list
// of available candidates.
- candidates = shrinkModuleArray(candidates);
+ candidates = shrinkCandidateArray(candidates);
}
// If no candidates exist at this point, then throw a
// resolve exception unless the import is optional.
- if ((candidates.length == 0) && !imports[impIdx].isOptional())
+ if ((candidates.length == 0) && !reqs[reqIdx].isOptional())
{
// If we have received an exception while trying to populate
// the resolver map, rethrow that exception since it might
@@ -700,24 +726,25 @@
else
{
throw new ResolveException(
- "Unable to resolve.", module, imports[impIdx]);
+ "Unable to resolve.", module, reqs[reqIdx]);
}
}
else if (candidates.length > 0)
{
nodeList.add(
- new ResolverNode(module, imports[impIdx], candidates));
+ new ResolverNode(module, reqs[reqIdx], candidates));
}
}
}
// TODO: REMOVE THESE DEBUG METHODS.
+/*
private void dumpAvailablePackages()
{
synchronized (this)
{
System.out.println("AVAILABLE PACKAGES:");
- for (Iterator i = m_availPkgMap.entrySet().iterator(); i.hasNext(); )
+ for (Iterator i = m_availCapMap.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
IModule[] modules = (IModule[]) entry.getValue();
@@ -732,56 +759,28 @@
}
}
}
-
+*/
private void dumpUsedPackages()
{
synchronized (this)
{
- System.out.println("USED PACKAGES:");
- for (Iterator i = m_inUsePkgMap.entrySet().iterator(); i.hasNext(); )
+ System.out.println("PACKAGES IN USE:");
+ for (Iterator i = m_inUseCapMap.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
- IModule[] modules = (IModule[]) entry.getValue();
- if ((modules != null) && (modules.length > 0))
+ ICapability[] caps = (ICapability[]) entry.getValue();
+ if ((caps != null) && (caps.length > 0))
{
System.out.println(" " + entry.getKey());
- for (int j = 0; j < modules.length; j++)
+ for (int j = 0; j < caps.length; j++)
{
- System.out.println(" " + modules[j]);
+ System.out.println(" " + caps[j]);
}
}
}
}
}
- private IModule[] getCompatibleExporters(
- IModule[] modules, R4Import target, boolean includeRemovalPending)
- {
- // Create list of compatible exporters.
- IModule[] candidates = null;
- for (int modIdx = 0; (modules != null) && (modIdx < modules.length); modIdx++)
- {
- // The spec says that we cannot consider modules that
- // are pending removal, so ignore them.
- if (includeRemovalPending || !modules[modIdx].isRemovalPending())
- {
- // Get the modules export package for the target package.
- R4Export export = Util.getExportPackage(
- modules[modIdx], target.getName());
- // If compatible, then add the candidate to the list.
- if ((export != null) && (target.isSatisfied(export)))
- {
- candidates = addModuleToArray(candidates, modules[modIdx]);
- }
- }
- }
- if (candidates == null)
- {
- return m_emptyModules;
- }
- return candidates;
- }
-
private void findConsistentClassSpace(Map resolverMap, IModule rootModule)
throws ResolveException
{
@@ -833,29 +832,50 @@
// Add to cycle map for future reference.
cycleMap.put(rootModule, rootModule);
+ // Get the resolver node list for the root module.
+ List nodeList = (List) resolverMap.get(rootModule);
+
// Create an implicit "uses" constraint for every exported package
// of the root module that is not also imported; uses constraints
// for exported packages that are also imported will be taken
// care of as part of normal import package processing.
- R4Export[] exports = rootModule.getDefinition().getExports();
+ ICapability[] caps = rootModule.getDefinition().getCapabilities();
Map usesMap = new HashMap();
- for (int i = 0; (exports != null) && (i < exports.length); i++)
+ for (int capIdx = 0; (caps != null) && (capIdx < caps.length); capIdx++)
{
// Ignore exports that are also imported, since they
// will be taken care of when verifying import constraints.
- if (Util.getImportPackage(rootModule, exports[i].getName()) == null)
+ if (caps[capIdx] instanceof R4ExportCapability)
{
- usesMap.put(exports[i].getName(), rootModule);
+ // To find the import, check current candidates to see if
+ // they are providing an exported package, since we cannot
+ // find the imported package directly from the root module's
+ // requirements, since it is a filter.
+ boolean found = false;
+ for (int nodeIdx = 0; !found && (nodeIdx < nodeList.size()); nodeIdx++)
+ {
+ ResolverNode node = (ResolverNode) nodeList.get(nodeIdx);
+ ICapability candCap = node.m_candidates[node.m_idx].m_capability;
+ if (candCap.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
+ candCap.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(
+ caps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY)))
+ {
+ found = true;
+ }
+ }
+
+ if (!found)
+ {
+ usesMap.put(caps[capIdx].getProperties().get(ICapability.PACKAGE_PROPERTY), rootModule);
+ }
}
}
- // Loop through the current candidates for the module's imports
- // (available in the resolver node list of the resolver map) and
- // calculate the uses constraints for each of the currently
- // selected candidates for resolving the imports. Compare each
- // candidate's constraints to the existing constraints to check
- // for conflicts.
- List nodeList = (List) resolverMap.get(rootModule);
+ // Use the resolver node list to loop through the current candidates
+ // for the root module's imports and calculate the uses constraints
+ // for each of the currently selected candidates for resolving its
+ // imports. Compare each candidate's constraints to the existing
+ // constraints to check for conflicts.
for (int nodeIdx = 0; nodeIdx < nodeList.size(); nodeIdx++)
{
// Verify that the current candidate does not violate
@@ -870,23 +890,23 @@
// Verify that the current candidate itself has a consistent
// class space.
if (!isClassSpaceConsistent(
- resolverMap, node.m_candidates[node.m_idx], cycleMap))
+ resolverMap, node.m_candidates[node.m_idx].m_module, cycleMap))
{
return false;
}
// Get the exported package from the current candidate that
// will be used to resolve the root module's import.
- R4Export candidatePkg = Util.getExportPackage(
- node.m_candidates[node.m_idx], node.m_import.getName());
+ ICapability candidateCap = Util.getSatisfyingCapability(
+ node.m_candidates[node.m_idx].m_module, node.m_requirement);
// Calculate the "uses" dependencies implied by the candidate's
// exported package with respect to the currently selected
// candidates in the resolver map.
Map candUsesMap = calculateUsesDependencies(
resolverMap,
- node.m_candidates[node.m_idx],
- candidatePkg,
+ node.m_candidates[node.m_idx].m_module,
+ candidateCap,
new HashMap());
// Iterate through the root module's current set of transitive
@@ -918,26 +938,26 @@
}
private Map calculateUsesDependencies(
- Map resolverMap, IModule module, R4Export export, Map usesMap)
+ Map resolverMap, IModule module, ICapability cap, Map usesMap)
{
// TODO: CAN THIS BE OPTIMIZED?
// TODO: IS THIS CYCLE CHECK CORRECT??
// TODO: WHAT HAPPENS IF THERE ARE OVERLAPS WHEN CALCULATING USES??
// MAKE AN EXAMPLE WHERE TWO DEPENDENCIES PROVIDE SAME PACKAGE.
// Make sure we are not in a cycle.
- if (usesMap.get(export.getName()) != null)
+ if (usesMap.get(cap.getProperties().get(ICapability.PACKAGE_PROPERTY)) != null)
{
return usesMap;
}
// The target package at least uses itself,
// so add it to the uses map.
- usesMap.put(export.getName(), module);
+ usesMap.put(cap.getProperties().get(ICapability.PACKAGE_PROPERTY), module);
// Get the "uses" constraints for the target export
// package and calculate the transitive uses constraints
// of any used packages.
- String[] uses = export.getUses();
+ String[] uses = cap.getUses();
List nodeList = (List) resolverMap.get(module);
// We need to walk the transitive closure of "uses" relationships
@@ -958,21 +978,30 @@
if (nodeList == null)
{
// Get the actual exporter from the wire or if there
- // is no wire, then get the export is from the module
+ // is no wire, then get the export from the module
// itself.
IWire wire = Util.getWire(module, uses[usesIdx]);
if (wire != null)
{
usesMap = calculateUsesDependencies(
- resolverMap, wire.getExporter(), wire.getExport(), usesMap);
+ resolverMap, wire.getExporter(), wire.getCapability(), usesMap);
}
else
{
- export = Util.getExportPackage(module, uses[usesIdx]);
- if (export != null)
+ try
+ {
+ cap = Util.getSatisfyingCapability(
+ module, new Requirement(
+ ICapability.PACKAGE_NAMESPACE, "(package=" + uses[usesIdx] + ")"));
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
+ if (cap != null)
{
usesMap = calculateUsesDependencies(
- resolverMap, module, export, usesMap);
+ resolverMap, module, cap, usesMap);
}
}
}
@@ -986,7 +1015,10 @@
nodeIdx++)
{
node = (ResolverNode) nodeList.get(nodeIdx);
- if (!node.m_import.getName().equals(uses[usesIdx]))
+ ICapability usedCap = Util.getSatisfyingCapability(node.m_module, node.m_requirement);
+ if ((usedCap == null) ||
+ !usedCap.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) ||
+ !usedCap.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(uses[usesIdx]))
{
node = null;
}
@@ -998,23 +1030,49 @@
// the potential exporting module.
if (node != null)
{
- usesMap = calculateUsesDependencies(
- resolverMap,
- node.m_candidates[node.m_idx],
- Util.getExportPackage(node.m_candidates[node.m_idx], node.m_import.getName()),
- usesMap);
- }
- // If there was no resolver node for the "used" package,
- // then this means that the module exports the package
- // and we need to recursively add the constraints of this
- // other exported package of this module.
- else if (Util.getExportPackage(module, uses[usesIdx]) != null)
+ try
+ {
+ ICapability candCap = Util.getSatisfyingCapability(
+ node.m_candidates[node.m_idx].m_module,
+ new Requirement(
+ ICapability.PACKAGE_NAMESPACE,
+ "(package=" + uses[usesIdx] + ")"));
+ usesMap = calculateUsesDependencies(
+ resolverMap,
+ node.m_candidates[node.m_idx].m_module,
+ candCap,
+ usesMap);
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
+ }
+ else
{
- usesMap = calculateUsesDependencies(
- resolverMap,
- module,
- Util.getExportPackage(module, uses[usesIdx]),
- usesMap);
+ // If there was no resolver node for the "used" package,
+ // then this means that the module exports the package
+ // and we need to recursively add the constraints of the
+ // other exported packages of this module.
+ try
+ {
+ ICapability usedCap = Util.getSatisfyingCapability(
+ module, new Requirement(
+ ICapability.PACKAGE_NAMESPACE,
+ "(package=" + uses[usesIdx] + ")"));
+ if (usedCap != null)
+ {
+ usesMap = calculateUsesDependencies(
+ resolverMap,
+ module,
+ usedCap,
+ usesMap);
+ }
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
}
}
}
@@ -1079,50 +1137,59 @@
wireIdx++)
{
m_logger.log(Logger.LOG_DEBUG, "WIRE: " + wires[wireIdx]);
- // First remove the wire module from "available" package map.
- IModule[] modules = (IModule[]) m_availPkgMap.get(wires[wireIdx].getExport().getName());
- modules = removeModuleFromArray(modules, wires[wireIdx].getExporter());
- m_availPkgMap.put(wires[wireIdx].getExport().getName(), modules);
-
- // Also remove any exported packages from the "available"
- // package map that are from the module associated with
- // the current wires where the exported packages were not
- // actually exported; an export may not be exported if
- // the module also imports the same package and was wired
- // to a different module. If the exported package is not
- // actually exported, then we just want to remove it
- // completely, since it cannot be used.
- if (wires[wireIdx].getExporter() != module)
- {
- modules = (IModule[]) m_availPkgMap.get(wires[wireIdx].getExport().getName());
- modules = removeModuleFromArray(modules, module);
- m_availPkgMap.put(wires[wireIdx].getExport().getName(), modules);
- }
-
// Add the module of the wire to the "in use" package map.
- modules = (IModule[]) m_inUsePkgMap.get(wires[wireIdx].getExport().getName());
- modules = addModuleToArray(modules, wires[wireIdx].getExporter());
- m_inUsePkgMap.put(wires[wireIdx].getExport().getName(), modules);
+ ICapability[] inUseCaps = (ICapability[]) m_inUseCapMap.get(wires[wireIdx].getExporter());
+ inUseCaps = addCapabilityToArray(inUseCaps, wires[wireIdx].getCapability());
+ m_inUseCapMap.put(wires[wireIdx].getExporter(), inUseCaps);
+ }
+
+ // Also add the module's capabilities to the "in use" map
+ // if the capability is not matched by a requirement. If the
+ // capability is matched by a requirement, then it is handled
+ // above when adding the wired modules to the "in use" map.
+// TODO: ML - Bug here because a requirement for a package need not overlap the
+// capability for that package and this assumes it does.
+ ICapability[] caps = module.getDefinition().getCapabilities();
+ IRequirement[] reqs = module.getDefinition().getRequirements();
+ for (int capIdx = 0; (caps != null) && (capIdx < caps.length); capIdx++)
+ {
+ boolean matched = false;
+ for (int reqIdx = 0;
+ !matched && (reqs != null) && (reqIdx < reqs.length);
+ reqIdx++)
+ {
+ if (reqs[reqIdx].isSatisfied(caps[capIdx]))
+ {
+ matched = true;
+ }
+ }
+ if (!matched)
+ {
+ ICapability[] inUseCaps = (ICapability[]) m_inUseCapMap.get(module);
+ inUseCaps = addCapabilityToArray(inUseCaps, caps[capIdx]);
+ m_inUseCapMap.put(module, inUseCaps);
+ }
}
}
+
return resolvedModuleWireMap;
}
- private Map populateWireMap(Map resolverMap, IModule module, Map wireMap)
+ private Map populateWireMap(Map resolverMap, IModule importer, Map wireMap)
{
// If the module is already resolved or it is part of
// a cycle, then just return the wire map.
- if (isResolved(module) || (wireMap.get(module) != null))
+ if (isResolved(importer) || (wireMap.get(importer) != null))
{
return wireMap;
}
- List nodeList = (List) resolverMap.get(module);
+ List nodeList = (List) resolverMap.get(importer);
IWire[] wires = new IWire[nodeList.size()];
// Put the module in the wireMap with an empty wire array;
// we do this early so we can use it to detect cycles.
- wireMap.put(module, wires);
+ wireMap.put(importer, wires);
// Loop through each resolver node and create a wire
// for the selected candidate for the associated import.
@@ -1132,12 +1199,14 @@
ResolverNode node = (ResolverNode) nodeList.get(nodeIdx);
// Add the candidate to the list of wires.
- R4Export export =
- Util.getExportPackage(node.m_candidates[node.m_idx], node.m_import.getName());
- wires[nodeIdx] = new R4Wire(module, node.m_candidates[node.m_idx], export);
+ wires[nodeIdx] = new R4Wire(
+ importer,
+ node.m_candidates[node.m_idx].m_module,
+ node.m_candidates[node.m_idx].m_capability);
// Create the wires for the selected candidate module.
- wireMap = populateWireMap(resolverMap, node.m_candidates[node.m_idx], wireMap);
+ wireMap = populateWireMap(
+ resolverMap, node.m_candidates[node.m_idx].m_module, wireMap);
}
return wireMap;
@@ -1295,17 +1364,18 @@
public void moduleAdded(ModuleEvent event)
{
+/*
synchronized (m_factory)
{
// When a module is added, create an aggregated list of available
// exports to simplify later processing when resolving bundles.
IModule module = event.getModule();
- R4Export[] exports = module.getDefinition().getExports();
+ ICapability[] caps = module.getDefinition().getCapabilities();
// Add exports to available package map.
- for (int i = 0; (exports != null) && (i < exports.length); i++)
+ for (int i = 0; (caps != null) && (i < caps.length); i++)
{
- IModule[] modules = (IModule[]) m_availPkgMap.get(exports[i].getName());
+ IModule[] modules = (IModule[]) m_availCapMap.get(caps[i].getNamespace());
// We want to add the module into the list of available
// exporters in sorted order (descending version and
@@ -1357,9 +1427,10 @@
modules = newMods;
}
- m_availPkgMap.put(exports[i].getName(), modules);
+ m_availCapMap.put(caps[i].getNamespace(), modules);
}
}
+*/
}
public void moduleRemoved(ModuleEvent event)
@@ -1372,26 +1443,31 @@
// bundles to be installed or removed.
synchronized (m_factory)
{
+/*
// Remove exports from package maps.
- R4Export[] exports = event.getModule().getDefinition().getExports();
- for (int i = 0; (exports != null) && (i < exports.length); i++)
+ ICapability[] caps = event.getModule().getDefinition().getCapabilities();
+ for (int i = 0; (caps != null) && (i < caps.length); i++)
{
// Remove from "available" package map.
- IModule[] modules = (IModule[]) m_availPkgMap.get(exports[i].getName());
+ IModule[] modules = (IModule[]) m_availCapMap.get(caps[i].getNamespace());
if (modules != null)
{
modules = removeModuleFromArray(modules, event.getModule());
- m_availPkgMap.put(exports[i].getName(), modules);
+ m_availCapMap.put(caps[i].getNamespace(), modules);
}
+
// Remove from "in use" package map.
- modules = (IModule[]) m_inUsePkgMap.get(exports[i].getName());
+ IModule[] modules = (IModule[]) m_inUseCapMap.get(caps[i].getNamespace());
if (modules != null)
{
modules = removeModuleFromArray(modules, event.getModule());
- m_inUsePkgMap.put(exports[i].getName(), modules);
+ m_inUseCapMap.put(caps[i].getNamespace(), modules);
}
}
-
+*/
+ // Remove the module from the "in use" map.
+// TODO: ML - Maybe this can be merged with ModuleData.
+ m_inUseCapMap.remove(event.getModule());
// Finally, remove module data.
m_moduleDataMap.remove(event.getModule());
}
@@ -1426,7 +1502,7 @@
return modules;
}
-
+/*
private static IModule[] removeModuleFromArray(IModule[] modules, IModule m)
{
if (modules == null)
@@ -1466,35 +1542,129 @@
}
return modules;
}
-
- private static IModule[] shrinkModuleArray(IModule[] modules)
+*/
+ private static ResolverCandidate[] shrinkCandidateArray(ResolverCandidate[] candidates)
{
- if (modules == null)
+ if (candidates == null)
{
- return m_emptyModules;
+ return m_emptyCandidates;
}
// Move all non-null values to one end of the array.
int lower = 0;
- for (int i = 0; i < modules.length; i++)
+ for (int i = 0; i < candidates.length; i++)
{
- if (modules[i] != null)
+ if (candidates[i] != null)
{
- modules[lower++] = modules[i];
+ candidates[lower++] = candidates[i];
}
}
if (lower == 0)
{
- return m_emptyModules;
+ return m_emptyCandidates;
}
// Copy non-null values into a new array and return.
- IModule[] newModules = new IModule[lower];
- System.arraycopy(modules, 0, newModules, 0, lower);
- return newModules;
+ ResolverCandidate[] newCandidates= new ResolverCandidate[lower];
+ System.arraycopy(candidates, 0, newCandidates, 0, lower);
+ return newCandidates;
+ }
+
+ private static ICapability[] addCapabilityToArray(ICapability[] caps, ICapability cap)
+ {
+ // Verify that the inuse is not already in the array.
+ for (int i = 0; (caps != null) && (i < caps.length); i++)
+ {
+ if (caps[i].equals(cap))
+ {
+ return caps;
+ }
+ }
+
+ if (caps != null)
+ {
+ ICapability[] newCaps = new ICapability[caps.length + 1];
+ System.arraycopy(caps, 0, newCaps, 0, caps.length);
+ newCaps[caps.length] = cap;
+ caps = newCaps;
+ }
+ else
+ {
+ caps = new ICapability[] { cap };
+ }
+
+ return caps;
}
+ private static ICapability[] removeCapabilityFromArray(ICapability[] caps, ICapability cap)
+ {
+ if (caps == null)
+ {
+ return m_emptyCapabilities;
+ }
+
+ int idx = -1;
+ for (int i = 0; i < caps.length; i++)
+ {
+ if (caps[i].equals(cap))
+ {
+ idx = i;
+ break;
+ }
+ }
+
+ if (idx >= 0)
+ {
+ // If this is the module, then point to empty list.
+ if ((caps.length - 1) == 0)
+ {
+ caps = m_emptyCapabilities;
+ }
+ // Otherwise, we need to do some array copying.
+ else
+ {
+ ICapability[] newCaps = new ICapability[caps.length - 1];
+ System.arraycopy(caps, 0, newCaps, 0, idx);
+ if (idx < newCaps.length)
+ {
+ System.arraycopy(
+ caps, idx + 1, newCaps, idx, newCaps.length - idx);
+ }
+ caps = newCaps;
+ }
+ }
+ return caps;
+ }
+/*
+ private static InUse[] shrinkInUseArray(InUse[] inuses)
+ {
+ if (inuses == null)
+ {
+ return m_emptyInUse;
+ }
+
+ // Move all non-null values to one end of the array.
+ int lower = 0;
+ for (int i = 0; i < inuses.length; i++)
+ {
+ if (inuses[i] != null)
+ {
+ inuses[lower++] = inuses[i];
+ }
+ }
+
+ if (lower == 0)
+ {
+ return m_emptyInUse;
+ }
+
+ // Copy non-null values into a new array and return.
+ InUse[] newInUse = new InUse[lower];
+ System.arraycopy(inuses, 0, newInUse, 0, lower);
+ return newInUse;
+ }
+*/
//
// Simple utility classes.
//
@@ -1512,14 +1682,14 @@
private class ResolverNode
{
public IModule m_module = null;
- public R4Import m_import = null;
- public IModule[] m_candidates = null;
+ public IRequirement m_requirement = null;
+ public ResolverCandidate[] m_candidates = null;
public int m_idx = 0;
public boolean m_visited = false;
- public ResolverNode(IModule module, R4Import imp, IModule[] candidates)
+ public ResolverNode(IModule module, IRequirement requirement, ResolverCandidate[] candidates)
{
m_module = module;
- m_import = imp;
+ m_requirement = requirement;
m_candidates = candidates;
if (isResolved(m_module))
{
@@ -1528,6 +1698,44 @@
}
}
+ public class ResolverCandidate
+ {
+ public IModule m_module = null;
+ public ICapability m_capability = null;
+
+ public ResolverCandidate(IModule module, ICapability capability)
+ {
+ m_module = module;
+ m_capability = capability;
+ }
+ }
+
+ private class InUse
+ {
+ public IModule m_module = null;
+ public ICapability m_capability = null;
+ public InUse(IModule module, ICapability capability)
+ {
+ m_module = module;
+ m_capability = capability;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof InUse)
+ {
+ return m_module.equals(((InUse) obj).m_module) &&
+ m_capability.equals(((InUse) obj).m_capability);
+ }
+
+ return false;
+ }
+ }
+
+ //
+ // Diagnostics.
+ //
+
private String diagnoseClassLoadError(IModule module, String name)
{
// We will try to do some diagnostics here to help the developer
@@ -1543,7 +1751,8 @@
IWire[] wires = module.getWires();
for (int i = 0; (wires != null) && (i < wires.length); i++)
{
- if (wires[i].getExport().getName().equals(pkgName))
+ if (wires[i].getCapability().getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
+ wires[i].getCapability().getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
{
long expId = Util.getBundleIdFromModuleId(
wires[i].getExporter().getId());
@@ -1570,21 +1779,31 @@
// Next, check to see if the package was optionally imported and
// whether or not there is an exporter available.
- R4Import[] imports = module.getDefinition().getImports();
- for (int i = 0; (imports != null) && (i < imports.length); i++)
+ IRequirement[] reqs = module.getDefinition().getRequirements();
+/*
+ * TODO: ML - Fix diagnostic message for optional imports.
+ for (int i = 0; (reqs != null) && (i < reqs.length); i++)
{
- if (imports[i].getName().equals(pkgName) && imports[i].isOptional())
+ if (reqs[i].getName().equals(pkgName) && reqs[i].isOptional())
{
- // Try to see if there is an exporter available. It may be
- // the case that the package is exported, but the attributes
- // do not match, so check that case too.
- IModule[] exporters = getInUseExporters(imports[i], true);
- exporters = (exporters.length == 0)
- ? getAvailableExporters(imports[i], true) : exporters;
- exporters = (exporters.length == 0)
- ? getInUseExporters(new R4Import(pkgName, null, null), true) : exporters;
+ // Try to see if there is an exporter available.
+ IModule[] exporters = getInUseExporters(reqs[i], true);
exporters = (exporters.length == 0)
- ? getAvailableExporters(new R4Import(pkgName, null, null), true) : exporters;
+ ? getAvailableExporters(reqs[i], true) : exporters;
+
+ // An exporter might be available, but it may have attributes
+ // that do not match the importer's required attributes, so
+ // check that case by simply looking for an exporter of the
+ // desired package without any attributes.
+ if (exporters.length == 0)
+ {
+ IRequirement pkgReq = new Requirement(
+ ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")");
+ exporters = getInUseExporters(pkgReq, true);
+ exporters = (exporters.length == 0)
+ ? getAvailableExporters(pkgReq, true) : exporters;
+ }
+
long expId = (exporters.length == 0)
? -1 : Util.getBundleIdFromModuleId(exporters[0].getId());
@@ -1599,8 +1818,8 @@
{
sb.append(" However, bundle ");
sb.append(expId);
- if (imports[i].isSatisfied(
- Util.getExportPackage(exporters[0], imports[i].getName())))
+ if (reqs[i].isSatisfied(
+ Util.getExportPackage(exporters[0], reqs[i].getName())))
{
sb.append(" does export this package. Bundle ");
sb.append(expId);
@@ -1618,23 +1837,40 @@
return sb.toString();
}
}
-
+*/
// Next, check to see if the package is dynamically imported by the module.
- R4Import imp = createDynamicImportTarget(module, pkgName);
+// TODO: ML - Fix dynamic import diagnostic.
+// IRequirement imp = createDynamicImportTarget(module, pkgName);
+ IRequirement imp = null;
if (imp != null)
{
- // Try to see if there is an exporter available. It may be
- // the case that the package is exported, but the attributes
- // do not match, so check that case too.
- IModule[] exporters = getInUseExporters(imp, true);
+ // Try to see if there is an exporter available.
+ ResolverCandidate[] exporters = getInUseCandidates(imp, true);
exporters = (exporters.length == 0)
- ? getAvailableExporters(imp, true) : exporters;
- exporters = (exporters.length == 0)
- ? getInUseExporters(new R4Import(pkgName, null, null), true) : exporters;
- exporters = (exporters.length == 0)
- ? getAvailableExporters(new R4Import(pkgName, null, null), true) : exporters;
+ ? getAvailableCandidates(imp, true) : exporters;
+
+ // An exporter might be available, but it may have attributes
+ // that do not match the importer's required attributes, so
+ // check that case by simply looking for an exporter of the
+ // desired package without any attributes.
+ if (exporters.length == 0)
+ {
+ try
+ {
+ IRequirement pkgReq = new Requirement(
+ ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")");
+ exporters = getInUseCandidates(pkgReq, true);
+ exporters = (exporters.length == 0)
+ ? getAvailableCandidates(pkgReq, true) : exporters;
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
+ }
+
long expId = (exporters.length == 0)
- ? -1 : Util.getBundleIdFromModuleId(exporters[0].getId());
+ ? -1 : Util.getBundleIdFromModuleId(exporters[0].m_module.getId());
StringBuffer sb = new StringBuffer("*** Class '");
sb.append(name);
@@ -1645,24 +1881,37 @@
sb.append(".");
if (exporters.length > 0)
{
- if (!imp.isSatisfied(
- Util.getExportPackage(exporters[0], imp.getName())))
+ try
{
- sb.append(" However, bundle ");
- sb.append(expId);
- sb.append(" does export this package with attributes that do not match.");
+ if (!imp.isSatisfied(
+ Util.getSatisfyingCapability(exporters[0].m_module,
+ new Requirement(ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")"))))
+ {
+ sb.append(" However, bundle ");
+ sb.append(expId);
+ sb.append(" does export this package with attributes that do not match.");
+ }
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
}
}
sb.append(" ***");
return sb.toString();
}
-
- // Next, if the package is not imported by the module, check to
- // see if there is an exporter for the package.
- IModule[] exporters = getInUseExporters(new R4Import(pkgName, null, null), true);
- exporters = (exporters.length == 0)
- ? getAvailableExporters(new R4Import(pkgName, null, null), true) : exporters;
+ IRequirement pkgReq = null;
+ try
+ {
+ pkgReq = new Requirement(ICapability.PACKAGE_NAMESPACE, "(package=" + pkgName + ")");
+ }
+ catch (InvalidSyntaxException ex)
+ {
+ // This should never happen.
+ }
+ ResolverCandidate[] exporters = getInUseCandidates(pkgReq, true);
+ exporters = (exporters.length == 0) ? getAvailableCandidates(pkgReq, true) : exporters;
if (exporters.length > 0)
{
boolean classpath = false;
@@ -1676,7 +1925,7 @@
// Ignore
}
- long expId = Util.getBundleIdFromModuleId(exporters[0].getId());
+ long expId = Util.getBundleIdFromModuleId(exporters[0].m_module.getId());
StringBuffer sb = new StringBuffer("*** Class '");
sb.append(name);
@@ -1760,4 +2009,4 @@
return sb.toString();
}
-}
+}
\ No newline at end of file
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java Fri Sep 8 07:36:56 2006
@@ -25,13 +25,13 @@
{
private IModule m_importer = null;
private IModule m_exporter = null;
- private R4Export m_export= null;
+ private ICapability m_capability = null;
- public R4Wire(IModule importer, IModule exporter, R4Export export)
+ public R4Wire(IModule importer, IModule exporter, ICapability capability)
{
m_importer = importer;
m_exporter = exporter;
- m_export = export;
+ m_capability = capability;
}
/* (non-Javadoc)
@@ -53,9 +53,9 @@
/* (non-Javadoc)
* @see org.apache.felix.framework.searchpolicy.IWire#getExport()
*/
- public R4Export getExport()
+ public ICapability getCapability()
{
- return m_export;
+ return m_capability;
}
/* (non-Javadoc)
@@ -70,7 +70,8 @@
// Only check when the package of the target class is
// the same as the package for the wire.
- if (m_export.getName().equals(pkgName))
+ if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
+ m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
{
// Before delegating to the exporting module to satisfy
// the class load, we must check the include/exclude filters
@@ -78,7 +79,9 @@
// actually visible. However, if the exporting module is the
// same as the requesting module, then filtering is not
// performed since a module has complete access to itself.
- if ((m_exporter == m_importer) || m_export.isIncluded(name))
+ if ((m_exporter == m_importer) ||
+ ((m_capability instanceof R4ExportCapability) &&
+ ((R4ExportCapability) m_capability).isIncluded(name)))
{
clazz = m_exporter.getContentLoader().getClass(name);
}
@@ -107,7 +110,8 @@
// Only check when the package of the target resource is
// the same as the package for the wire.
- if (m_export.getName().equals(pkgName))
+ if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
+ m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
{
url = m_exporter.getContentLoader().getResource(name);
@@ -125,6 +129,12 @@
public String toString()
{
- return m_importer + " -> " + m_export.getName() + " -> " + m_exporter;
+ if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
+ {
+ return m_importer + " -> "
+ + m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY)
+ + " -> " + m_exporter;
+ }
+ return m_importer + " -> " + m_capability + " -> " + m_exporter;
}
}
Added: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/Requirement.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/Requirement.java?view=auto&rev=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/Requirement.java (added)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/Requirement.java Fri Sep 8 07:36:56 2006
@@ -0,0 +1,50 @@
+package org.apache.felix.framework.searchpolicy;
+
+import org.apache.felix.framework.FilterImpl;
+import org.apache.felix.framework.util.MapToDictionary;
+import org.apache.felix.moduleloader.ICapability;
+import org.apache.felix.moduleloader.IRequirement;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+
+public class Requirement implements IRequirement
+{
+ private String m_namespace = null;
+ private Filter m_filter = null;
+
+ public Requirement(String namespace, String filterStr) throws InvalidSyntaxException
+ {
+ m_namespace = namespace;
+ m_filter = new FilterImpl(filterStr);
+ }
+
+ public String getNamespace()
+ {
+ return m_namespace;
+ }
+
+ public Filter getFilter()
+ {
+ return m_filter;
+ }
+
+ public boolean isMultiple()
+ {
+ return false;
+ }
+
+ public boolean isOptional()
+ {
+ return false;
+ }
+
+ public String getComment()
+ {
+ return null;
+ }
+
+ public boolean isSatisfied(ICapability capability)
+ {
+ return m_filter.match(new MapToDictionary(capability.getProperties()));
+ }
+}
\ No newline at end of file
Propchange: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/Requirement.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/ResolveException.java Fri Sep 8 07:36:56 2006
@@ -17,6 +17,7 @@
package org.apache.felix.framework.searchpolicy;
import org.apache.felix.moduleloader.IModule;
+import org.apache.felix.moduleloader.IRequirement;
/**
* <p>
@@ -30,17 +31,17 @@
public class ResolveException extends Exception
{
private IModule m_module = null;
- private R4Package m_pkg = null;
+ private IRequirement m_req = null;
/**
* Constructs an exception with the specified message, module,
* import identifier, import version number, and propagation flag.
**/
- public ResolveException(String msg, IModule module, R4Package pkg)
+ public ResolveException(String msg, IModule module, IRequirement req)
{
super(msg);
m_module = module;
- m_pkg = pkg;
+ m_req = req;
}
/**
@@ -52,8 +53,8 @@
return m_module;
}
- public R4Package getPackage()
+ public IRequirement getRequirement()
{
- return m_pkg;
+ return m_req;
}
}
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/searchpolicy/VersionRange.java Fri Sep 8 07:36:56 2006
@@ -24,6 +24,7 @@
private boolean m_isLowInclusive = false;
private Version m_high = null;
private boolean m_isHighInclusive = false;
+ private String m_toString = null;
public VersionRange(Version low, boolean isLowInclusive,
Version high, boolean isHighInclusive)
@@ -92,5 +93,45 @@
{
return new VersionRange(new Version(range), true, null, false);
}
+ }
+
+ public String toString()
+ {
+ if (m_toString == null)
+ {
+ if ((m_low == null) && (m_high == null))
+ {
+ m_toString = Version.emptyVersion.toString();
+ }
+ else if (m_high == null)
+ {
+ m_toString = m_low.toString();
+ }
+ else
+ {
+ StringBuffer sb = new StringBuffer();
+ if (m_isLowInclusive)
+ {
+ sb.append('[');
+ }
+ else
+ {
+ sb.append('(');
+ }
+ sb.append(m_low.toString());
+ sb.append(',');
+ sb.append(m_high.toString());
+ if (m_isHighInclusive)
+ {
+ sb.append('[');
+ }
+ else
+ {
+ sb.append('(');
+ }
+ }
+ }
+
+ return m_toString;
}
}
Propchange: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Sep 8 07:36:56 2006
@@ -0,0 +1,2 @@
+Util.java~
+ManifestParser.java~
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ManifestParser.java Fri Sep 8 07:36:56 2006
@@ -22,15 +22,17 @@
import org.apache.felix.framework.Logger;
import org.apache.felix.framework.cache.BundleCache;
import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.moduleloader.ICapability;
+import org.apache.felix.moduleloader.IRequirement;
import org.osgi.framework.*;
public class ManifestParser
{
private Logger m_logger = null;
private Map m_headerMap = null;
- private R4Export[] m_exports = null;
- private R4Import[] m_imports = null;
- private R4Import[] m_dynamics = null;
+ private ICapability[] m_capabilities = null;
+ private IRequirement[] m_requirements = null;
+ private IRequirement[] m_dynamics = null;
private R4LibraryHeader[] m_libraryHeaders = null;
public ManifestParser(Logger logger, Map headerMap) throws BundleException
@@ -86,7 +88,7 @@
throw new BundleException(
"Exporting java.* packages not allowed: " + pkgs[i].getName());
}
- dupeMap.put(pkgs[i].getName(), new R4Export(pkgs[i]));
+ dupeMap.put(pkgs[i].getName(), new R4ExportCapability(pkgs[i]));
}
else
{
@@ -95,7 +97,7 @@
"Duplicate export - " + pkgs[i].getName());
}
}
- m_exports = (R4Export[]) dupeMap.values().toArray(new R4Export[dupeMap.size()]);
+ m_capabilities = (ICapability[]) dupeMap.values().toArray(new ICapability[dupeMap.size()]);
//
// Parse Import-Package.
@@ -117,7 +119,7 @@
throw new BundleException(
"Importing java.* packages not allowed: " + pkgs[i].getName());
}
- dupeMap.put(pkgs[i].getName(), new R4Import(pkgs[i]));
+ dupeMap.put(pkgs[i].getName(), new R4ImportRequirement(pkgs[i]));
}
else
{
@@ -125,7 +127,7 @@
"Duplicate import - " + pkgs[i].getName());
}
}
- m_imports = (R4Import[]) dupeMap.values().toArray(new R4Import[dupeMap.size()]);
+ m_requirements = (IRequirement[]) dupeMap.values().toArray(new IRequirement[dupeMap.size()]);
//
// Parse DynamicImport-Package.
@@ -136,10 +138,10 @@
(String) headerMap.get(Constants.DYNAMICIMPORT_PACKAGE));
// Dynamic imports can have duplicates, so just create an array.
- m_dynamics = new R4Import[pkgs.length];
+ m_dynamics = new IRequirement[pkgs.length];
for (int i = 0; i < pkgs.length; i++)
{
- m_dynamics[i] = new R4Import(pkgs[i]);
+ m_dynamics[i] = new R4ImportRequirement(pkgs[i]);
}
//
@@ -174,17 +176,17 @@
return (manifestVersion == null) ? "1" : manifestVersion;
}
- public R4Export[] getExports()
+ public ICapability[] getCapabilities()
{
- return m_exports;
+ return m_capabilities;
}
- public R4Import[] getImports()
+ public IRequirement[] getRequirements()
{
- return m_imports;
+ return m_requirements;
}
- public R4Import[] getDynamicImports()
+ public IRequirement[] getDynamicRequirements()
{
return m_dynamics;
}
@@ -211,9 +213,10 @@
// Check to make sure that R3 bundles have only specified
// the 'specification-version' attribute and no directives
// on their exports.
- for (int i = 0; (m_exports != null) && (i < m_exports.length); i++)
+ for (int i = 0; (m_capabilities != null) && (i < m_capabilities.length); i++)
{
- if (m_exports[i].getDirectives().length != 0)
+ R4ExportCapability ec = (R4ExportCapability) m_capabilities[i];
+ if (ec.getDirectives().length != 0)
{
throw new BundleException("R3 exports cannot contain directives.");
}
@@ -221,21 +224,22 @@
// because the package class normalizes to "version" to avoid having
// future special cases. This could be changed if more strict behavior
// is required.
- if ((m_exports[i].getAttributes().length > 1) ||
- ((m_exports[i].getAttributes().length == 1) &&
- (!m_exports[i].getAttributes()[0].getName().equals(Constants.VERSION_ATTRIBUTE))))
+ if ((ec.getAttributes().length > 1) ||
+ ((ec.getAttributes().length == 1) &&
+ (!ec.getAttributes()[0].getName().equals(Constants.VERSION_ATTRIBUTE))))
{
throw new BundleException(
- "R3 export syntax does not support attributes: " + m_exports[i]);
+ "R3 export syntax does not support attributes: " + m_capabilities[i]);
}
}
// Check to make sure that R3 bundles have only specified
// the 'specification-version' attribute and no directives
// on their imports.
- for (int i = 0; (m_imports != null) && (i < m_imports.length); i++)
+ for (int i = 0; (m_requirements != null) && (i < m_requirements.length); i++)
{
- if (m_imports[i].getDirectives().length != 0)
+ R4ImportRequirement ir = (R4ImportRequirement) m_requirements[i];
+ if (ir.getDirectives().length != 0)
{
throw new BundleException("R3 imports cannot contain directives.");
}
@@ -243,13 +247,13 @@
// because the package class normalizes to "version" to avoid having
// future special cases. This could be changed if more strict behavior
// is required.
- if ((m_imports[i].getVersionHigh() != null) ||
- (m_imports[i].getAttributes().length > 1) ||
- ((m_imports[i].getAttributes().length == 1) &&
- (!m_imports[i].getAttributes()[0].getName().equals(Constants.VERSION_ATTRIBUTE))))
+ if ((ir.getVersionHigh() != null) ||
+ (ir.getAttributes().length > 1) ||
+ ((ir.getAttributes().length == 1) &&
+ (!ir.getAttributes()[0].getName().equals(Constants.VERSION_ATTRIBUTE))))
{
throw new BundleException(
- "R3 import syntax does not support attributes: " + m_imports[i]);
+ "R3 import syntax does not support attributes: " + m_requirements[i]);
}
}
@@ -257,20 +261,22 @@
// import for each existing export. Create non-duplicated import array.
Map map = new HashMap();
// Add existing imports.
- for (int i = 0; i < m_imports.length; i++)
+ for (int i = 0; i < m_requirements.length; i++)
{
- map.put(m_imports[i].getName(), m_imports[i]);
+ map.put(((R4ImportRequirement) m_requirements[i]).getName(), m_requirements[i]);
}
// Add import for each export.
- for (int i = 0; i < m_exports.length; i++)
+ for (int i = 0; i < m_capabilities.length; i++)
{
- if (map.get(m_exports[i].getName()) == null)
+ if (map.get(((R4ExportCapability) m_capabilities[i]).getName()) == null)
{
- map.put(m_exports[i].getName(), new R4Import(m_exports[i]));
+ map.put(
+ ((R4ExportCapability) m_capabilities[i]).getName(),
+ new R4ImportRequirement((R4Package) m_capabilities[i]));
}
}
- m_imports =
- (R4Import[]) map.values().toArray(new R4Import[map.size()]);
+ m_requirements =
+ (IRequirement[]) map.values().toArray(new IRequirement[map.size()]);
// Add a "uses" directive onto each export of R3 bundles
// that references every other import (which will include
@@ -278,31 +284,31 @@
// necessary since R3 bundles assumed a single class space,
// but R4 allows for multiple class spaces.
String usesValue = "";
- for (int i = 0; (m_imports != null) && (i < m_imports.length); i++)
+ for (int i = 0; (m_requirements != null) && (i < m_requirements.length); i++)
{
usesValue = usesValue
+ ((usesValue.length() > 0) ? "," : "")
- + m_imports[i].getName();
+ + ((R4ImportRequirement) m_requirements[i]).getName();
}
R4Directive uses = new R4Directive(
Constants.USES_DIRECTIVE, usesValue);
- for (int i = 0; (m_exports != null) && (i < m_exports.length); i++)
+ for (int i = 0; (m_capabilities != null) && (i < m_capabilities.length); i++)
{
- m_exports[i] = new R4Export(
- m_exports[i].getName(),
+ m_capabilities[i] = new R4ExportCapability(
+ ((R4ExportCapability) m_capabilities[i]).getName(),
new R4Directive[] { uses },
- m_exports[i].getAttributes());
+ ((R4ExportCapability) m_capabilities[i]).getAttributes());
}
// Check to make sure that R3 bundles have no attributes or
// directives on their dynamic imports.
for (int i = 0; (m_dynamics != null) && (i < m_dynamics.length); i++)
{
- if (m_dynamics[i].getDirectives().length != 0)
+ if (((R4ImportRequirement) m_dynamics[i]).getDirectives().length != 0)
{
throw new BundleException("R3 dynamic imports cannot contain directives.");
}
- if (m_dynamics[i].getAttributes().length != 0)
+ if (((R4ImportRequirement) m_dynamics[i]).getAttributes().length != 0)
{
throw new BundleException("R3 dynamic imports cannot contain attributes.");
}
@@ -320,12 +326,12 @@
// Verify that the exports do not specify bundle symbolic name
// or bundle version.
- for (int i = 0; (m_exports != null) && (i < m_exports.length); i++)
+ for (int i = 0; (m_capabilities != null) && (i < m_capabilities.length); i++)
{
String targetVer = get(Constants.BUNDLE_VERSION);
targetVer = (targetVer == null) ? "0.0.0" : targetVer;
- R4Attribute[] attrs = m_exports[i].getAttributes();
+ R4Attribute[] attrs = ((R4ExportCapability) m_capabilities[i]).getAttributes();
for (int attrIdx = 0; attrIdx < attrs.length; attrIdx++)
{
// Find symbolic name and version attribute, if present.
@@ -345,8 +351,10 @@
Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, symName, false);
newAttrs[attrs.length + 1] = new R4Attribute(
Constants.BUNDLE_VERSION_ATTRIBUTE, Version.parseVersion(targetVer), false);
- m_exports[i] = new R4Export(
- m_exports[i].getName(), m_exports[i].getDirectives(), newAttrs);
+ m_capabilities[i] = new R4ExportCapability(
+ ((R4ExportCapability) m_capabilities[i]).getName(),
+ ((R4ExportCapability) m_capabilities[i]).getDirectives(),
+ newAttrs);
}
}
}
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/Util.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/Util.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/Util.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/Util.java Fri Sep 8 07:36:56 2006
@@ -22,7 +22,9 @@
import org.apache.felix.framework.Logger;
import org.apache.felix.framework.searchpolicy.*;
+import org.apache.felix.moduleloader.ICapability;
import org.apache.felix.moduleloader.IModule;
+import org.apache.felix.moduleloader.IRequirement;
import org.apache.felix.moduleloader.IWire;
public class Util
@@ -189,38 +191,46 @@
return null;
}
- public static R4Export getExportPackage(IModule m, String name)
+ public static ICapability getSatisfyingCapability(IModule m, IRequirement req)
{
- R4Export[] pkgs = m.getDefinition().getExports();
- for (int i = 0; (pkgs != null) && (i < pkgs.length); i++)
+ if (req.getNamespace().equals(ICapability.PACKAGE_NAMESPACE))
{
- if (pkgs[i].getName().equals(name))
+ ICapability[] caps = m.getDefinition().getCapabilities();
+ for (int i = 0; (caps != null) && (i < caps.length); i++)
{
- return pkgs[i];
+ if (caps[i].getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
+ req.isSatisfied(caps[i]))
+ {
+ return caps[i];
+ }
}
}
return null;
}
- public static R4Import getImportPackage(IModule m, String name)
+/*
+ public static IRequirement getImportPackage(IModule m, String name)
{
- R4Import[] pkgs = m.getDefinition().getImports();
- for (int i = 0; (pkgs != null) && (i < pkgs.length); i++)
+ IRequirement[] reqs = m.getDefinition().getRequirements();
+ for (int i = 0; (reqs != null) && (i < reqs.length); i++)
{
- if (pkgs[i].getName().equals(name))
+ if (reqs[i].getNamespace().equals(Capability.PACKAGE_NAMESPACE) &&
+ reqs[i].getProperties().get(Capability.NAME_PROPERTY).equals(name))
{
- return pkgs[i];
+ return caps[i];
}
}
return null;
}
+*/
public static IWire getWire(IModule m, String name)
{
IWire[] wires = m.getWires();
for (int i = 0; (wires != null) && (i < wires.length); i++)
{
- if (wires[i].getExport().getName().equals(name))
+ if ((wires[i].getCapability() instanceof R4ExportCapability) &&
+ ((R4ExportCapability) wires[i].getCapability()).getName().equals(name))
{
return wires[i];
}
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java Fri Sep 8 07:36:56 2006
@@ -1089,11 +1089,11 @@
Boolean result = Boolean.FALSE;
int len = pieces.length;
+ int index = 0;
loop : for (int i = 0; i < len; i++)
{
String piece = (String) pieces[i];
- int index = 0;
if (i == len - 1)
{
// this is the last piece
Propchange: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Sep 8 07:36:56 2006
@@ -0,0 +1,6 @@
+ModuleImpl.java~
+IModuleDefinition.java~
+IRequirement.java~
+ICapability.java~
+IModule.java~
+IWire.java~
Added: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ICapability.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ICapability.java?view=auto&rev=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ICapability.java (added)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ICapability.java Fri Sep 8 07:36:56 2006
@@ -0,0 +1,16 @@
+package org.apache.felix.moduleloader;
+
+import java.util.Map;
+
+public interface ICapability
+{
+ public static final String MODULE_NAMESPACE = "module";
+ public static final String PACKAGE_NAMESPACE = "package";
+
+ public static final String PACKAGE_PROPERTY = "package";
+ public static final String VERSION_PROPERTY = "version";
+
+ String getNamespace();
+ Map getProperties();
+ String[] getUses();
+}
\ No newline at end of file
Propchange: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/ICapability.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModule.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModule.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModule.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModule.java Fri Sep 8 07:36:56 2006
@@ -17,6 +17,7 @@
package org.apache.felix.moduleloader;
import java.net.URL;
+import java.util.Iterator;
public interface IModule
{
@@ -29,4 +30,5 @@
public Class getClass(String name);
public URL getResource(String name);
+ public Iterator getResources(String name);
}
Modified: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java?view=diff&rev=441518&r1=441517&r2=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java (original)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IModuleDefinition.java Fri Sep 8 07:36:56 2006
@@ -20,8 +20,8 @@
public interface IModuleDefinition
{
- public R4Export[] getExports();
- public R4Import[] getImports();
- public R4Import[] getDynamicImports();
+ public ICapability[] getCapabilities();
+ public IRequirement[] getRequirements();
+ public IRequirement[] getDynamicRequirements();
public R4Library[] getLibraries();
}
Added: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IRequirement.java
URL: http://svn.apache.org/viewvc/incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IRequirement.java?view=auto&rev=441518
==============================================================================
--- incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IRequirement.java (added)
+++ incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IRequirement.java Fri Sep 8 07:36:56 2006
@@ -0,0 +1,13 @@
+package org.apache.felix.moduleloader;
+
+import org.osgi.framework.Filter;
+
+public interface IRequirement
+{
+ String getNamespace();
+ Filter getFilter();
+ boolean isMultiple();
+ boolean isOptional();
+ String getComment();
+ boolean isSatisfied(ICapability capability);
+}
\ No newline at end of file
Propchange: incubator/felix/sandbox/rickhall/org.apache.felix.framework/src/main/java/org/apache/felix/moduleloader/IRequirement.java
------------------------------------------------------------------------------
svn:eol-style = native