- Author:
- Tom Oinn
|
Constructor Summary |
SpiRegistry(Repository r,
java.lang.String classname,
java.lang.ClassLoader parentLoader)
Create a new SpiRegistry based on a particular repository and searching
for the specified SPI classname. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpiRegistry
public SpiRegistry(Repository r,
java.lang.String classname,
java.lang.ClassLoader parentLoader)
- Create a new SpiRegistry based on a particular repository and searching
for the specified SPI classname. Note that no scan for implementations is
done at this point to allow interested parties to register SpiListener
instances first.
- Parameters:
r - the Repository which will be used to locate implementations of
the SPIclassname - of the SPI to search forparentLoader - a ClassLoader to use as the parent for any entries loaded
here, or null for no parent (most likely behaviour is to leave
as null)
addFilter
public void addFilter(ArtifactFilter af)
- Add a new ArtifactFilter
addNewArtifact
public void addNewArtifact(Artifact a)
addRegistryListener
public void addRegistryListener(RegistryListener l)
- Add a new registry listener to be notified of any updates to this
SpiRegistry
- Parameters:
l -
clearFilters
public void clearFilters()
- Clear all ArtifactFilter objects
filterChanged
public void filterChanged(ArtifactFilter filter)
- Specified by:
filterChanged in interface ArtifactFilterListener
finalize
public void finalize()
- Overrides:
finalize in class java.lang.Object
getClasses
public java.util.List<java.lang.Class> getClasses()
- Get the Class objects for all implementations of this SPI currently known
getClassName
public java.lang.String getClassName()
- The class name for the registry to search over
iterator
public java.util.Iterator<java.lang.Class> iterator()
- Specified by:
iterator in interface java.lang.Iterable<java.lang.Class>
removeRegistryListener
public void removeRegistryListener(RegistryListener l)
- Remove a listener from this SpiRegistry
- Parameters:
l -
setFilters
public void setFilters(java.util.List<ArtifactFilter> newFilters)
- Set the filter list
updateRegistry
public void updateRegistry()
- Apply all filters to the set of new artifacts in turn, then for each
Artifact which passes all the filters see if it contains a service entry
for the SPI we're meant to be looking after. If it does then parse the
entry and extract the list of implementation classnames. Class objects
corresponding to these are then added to the set of current known
implementations.