org.ungoverned.oscar
Class OSGiSelectionPolicy

java.lang.Object
  extended by org.ungoverned.oscar.OSGiSelectionPolicy
All Implemented Interfaces:
java.util.EventListener, ModuleListener, SelectionPolicy

public class OSGiSelectionPolicy
extends java.lang.Object
implements SelectionPolicy, ModuleListener


Constructor Summary
OSGiSelectionPolicy(Oscar oscar)
           
 
Method Summary
 void moduleAdded(ModuleEvent event)
           This method is called after a module is added to the ModuleManager.
 void moduleRemoved(ModuleEvent event)
           This method is called after a module is remove from the ModuleManager.
 void moduleReset(ModuleEvent event)
           This method is called after a module has been reset by the ModuleManager.
 Module select(Module module, java.lang.Object identifier, java.lang.Object v, Module[] candidates, CompatibilityPolicy compatPolicy)
          Selects a single module to resolve the specified import from the array of compatible candidate modules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiSelectionPolicy

public OSGiSelectionPolicy(Oscar oscar)
Method Detail

select

public Module select(Module module,
                     java.lang.Object identifier,
                     java.lang.Object v,
                     Module[] candidates,
                     CompatibilityPolicy compatPolicy)
Selects a single module to resolve the specified import from the array of compatible candidate modules. If the import target has not been resolved before, then this selection policy chooses the module that exports the newest version of the import target. If the import target has been resolved already, then the same module that was chosen before is chosen again. This ensures that all modules use the same version of all exported classes, as described in the OSGi specification.

Specified by:
select in interface SelectionPolicy
Parameters:
module - the module that is importing the target.
identifier - the identifier of the import target.
version - the version number of the import target.
candidates - array of compatible candidate modules from which to choose.
compatPolicy - the compatibility policy that is being used.
Returns:
the selected module or null if no module can be selected.

moduleAdded

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

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

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

moduleReset

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

This method is called after a module has been reset by the ModuleManager.

Specified by:
moduleReset 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 ModuleManager.

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