|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.taverna.raven.spi.InstanceRegistry<IType>
IType - The interface type implemented by all instances of the SPI to be
tracked by this InstanceRegistry. This must be the type
corresponding to the interface name specified in the SpiRegistry
to which this binds.public class InstanceRegistry<IType>
Instance registry to sit on top of the SpiRegistry object. When changes occur within the list of available SPI classes this object is responsible for creating new instances of those classes and notifying any interested listeners that this has changed.
Instantiation is lazy (as is the underlying scan for Classes in the SpiRegistry) so may incur a delay the first time the getInstances() method is called. Once this method has been called any subsequent events from the SpiRegistry will cause a regeneration of the instance list although this is conservative and will keep any instances of existing unchanged Class objects rather than creating new ones.
| Constructor Summary | |
|---|---|
InstanceRegistry(SpiRegistry registry,
java.lang.Object[] cArgs)
Build a new InstanceRegistry which will listen to events from an underlying SpiRegistry and automatically construct a single instance of each class found by that registry using the specified arguments to the constructor. |
|
| Method Summary | |
|---|---|
void |
addRegistryListener(InstanceRegistryListener l)
Add a new registry listener to be notified of any updates to this SpiRegistry |
void |
finalize()
|
java.util.List<IType> |
getInstances()
Return a copy of the List of instances of classes within the underlying SpiRegistry |
java.util.Iterator<IType> |
iterator()
Returns an iterator over a copy of the instance list to avoid potential concurrent modification exceptions when update events occur in the underlying registry. |
void |
removeRegistryListener(InstanceRegistryListener l)
Remove a listener from this SpiRegistry |
void |
spiRegistryUpdated(SpiRegistry registry)
If the instance list exists then update it, if set to null then we don't need to as it will be updated automatically when the list is first accessed through the getInstances method |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InstanceRegistry(SpiRegistry registry,
java.lang.Object[] cArgs)
registry - The SpiRegistry which provides Class objects implementing the
generic type defined here.cArgs - Arguments for the constructors of the new objects
java.lang.ClassCastException - if the underlying classname for the SpiRegistry and the
declared generic type for this object don't match.| Method Detail |
|---|
public void addRegistryListener(InstanceRegistryListener l)
l - public void finalize()
finalize in class java.lang.Objectpublic java.util.List<IType> getInstances()
public java.util.Iterator<IType> iterator()
iterator in interface java.lang.Iterable<IType>public void removeRegistryListener(InstanceRegistryListener l)
l - public void spiRegistryUpdated(SpiRegistry registry)
spiRegistryUpdated in interface RegistryListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||