org.apache.felix.framework.searchpolicy
Class R4SearchPolicyCore

java.lang.Object
  extended by org.apache.felix.framework.searchpolicy.R4SearchPolicyCore
All Implemented Interfaces:
java.util.EventListener, ModuleListener

public class R4SearchPolicyCore
extends java.lang.Object
implements ModuleListener


Nested Class Summary
 class R4SearchPolicyCore.PackageSource
          This utility class represents a source for a given package, where the package is indicated by a particular module and the module's capability associated with that package.
protected  class R4SearchPolicyCore.ResolvedPackage
          This utility class a resolved package, which is comprised of a set of PackageSources that is calculated by the resolver algorithm.
 
Field Summary
static ICapability[] m_emptyCapabilities
           
static IModule[] m_emptyModules
           
static R4SearchPolicyCore.PackageSource[] m_emptySources
           
 
Constructor Summary
R4SearchPolicyCore(Logger logger, java.util.Map configMap)
           
 
Method Summary
 void addResolverListener(ResolveListener l)
          Adds a resolver listener to the search policy.
 java.lang.Object[] definePackage(IModule module, java.lang.String pkgName)
           
 java.lang.Class findClass(IModule module, java.lang.String name)
           
 java.lang.String findLibrary(IModule module, java.lang.String name)
           
 java.net.URL findResource(IModule module, java.lang.String name)
           
 java.util.Enumeration findResources(IModule module, java.lang.String name)
           
static ICapability getExportPackageCapability(IModule m, java.lang.String pkgName)
           
 R4SearchPolicyCore.PackageSource[] getInUseCandidates(IRequirement req)
           
 IModuleFactory getModuleFactory()
           
 R4SearchPolicyCore.PackageSource[] getUnusedCandidates(IRequirement req)
           
 void moduleAdded(ModuleEvent event)
           This method is called after a module is added to the IModuleFactory.
 void moduleRefreshed(ModuleEvent event)
          This is an experimental method that is likely to change or go away - so don't use it for now.
 void moduleRemoved(ModuleEvent event)
           This method is called after a module is remove from the IModuleFactory.
 void removeResolverListener(ResolveListener l)
          Removes a resolver listener to this search policy.
 void resolve(IModule rootModule)
           
 void setModuleFactory(IModuleFactory factory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_emptyModules

public static final IModule[] m_emptyModules

m_emptyCapabilities

public static final ICapability[] m_emptyCapabilities

m_emptySources

public static final R4SearchPolicyCore.PackageSource[] m_emptySources
Constructor Detail

R4SearchPolicyCore

public R4SearchPolicyCore(Logger logger,
                          java.util.Map configMap)
Method Detail

getModuleFactory

public IModuleFactory getModuleFactory()

setModuleFactory

public void setModuleFactory(IModuleFactory factory)
                      throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

definePackage

public java.lang.Object[] definePackage(IModule module,
                                        java.lang.String pkgName)

findClass

public java.lang.Class findClass(IModule module,
                                 java.lang.String name)
                          throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

findResource

public java.net.URL findResource(IModule module,
                                 java.lang.String name)
                          throws ResourceNotFoundException
Throws:
ResourceNotFoundException

findResources

public java.util.Enumeration findResources(IModule module,
                                           java.lang.String name)
                                    throws ResourceNotFoundException
Throws:
ResourceNotFoundException

findLibrary

public java.lang.String findLibrary(IModule module,
                                    java.lang.String name)

getInUseCandidates

public R4SearchPolicyCore.PackageSource[] getInUseCandidates(IRequirement req)

getUnusedCandidates

public R4SearchPolicyCore.PackageSource[] getUnusedCandidates(IRequirement req)

resolve

public void resolve(IModule rootModule)
             throws ResolveException
Throws:
ResolveException

addResolverListener

public void addResolverListener(ResolveListener l)
Adds a resolver listener to the search policy. Resolver listeners are notified when a module is resolve and/or unresolved by the search policy.

Parameters:
l - the resolver listener to add.

removeResolverListener

public void removeResolverListener(ResolveListener l)
Removes a resolver listener to this search policy.

Parameters:
l - the resolver listener to remove.

moduleAdded

public void moduleAdded(ModuleEvent event)
Description copied from interface: ModuleListener

This method is called after a module is added to the IModuleFactory.

Specified by:
moduleAdded in interface ModuleListener
Parameters:
event - the event object containing the event details.

moduleRemoved

public void moduleRemoved(ModuleEvent event)
Description copied from interface: ModuleListener

This method is called after a module is remove from the IModuleFactory.

Specified by:
moduleRemoved in interface ModuleListener
Parameters:
event - the event object containing the event details.

moduleRefreshed

public void moduleRefreshed(ModuleEvent event)
This is an experimental method that is likely to change or go away - so don't use it for now. Note to self, we need to think about what the implications of this are and whether we are fine with them.

Specified by:
moduleRefreshed in interface ModuleListener

getExportPackageCapability

public static ICapability getExportPackageCapability(IModule m,
                                                     java.lang.String pkgName)