org.biomoby.registry.sync.handler
Class AbstractMobyHandler<T extends Comparable<T> & LSIDAccessible>
java.lang.Object
org.biomoby.registry.sync.handler.AbstractMobyHandler<T>
- All Implemented Interfaces:
- MobyHandler<T>
- Direct Known Subclasses:
- DataTypeHandler, NamespaceHandler, ServiceHandler, ServiceTypeHandler
public abstract class AbstractMobyHandler<T extends Comparable<T> & LSIDAccessible>
- extends Object
- implements MobyHandler<T>
Basic abstract implementation of the MobyHandler
interface.
The implementing classes are responsible for the synchronization of the centrals
- Author:
- groscurt
Method Summary |
boolean |
change(T object)
Changes the given object in the local repository. |
boolean |
hasChanged(String localLSID,
String centralLSID)
Checks whether the local object (represented by the lsid) is older than the central object (represented by the
lsid) |
void |
synchronizeCentrals(T[] centralList,
T[] local)
Synchronize the two centrals. |
AbstractMobyHandler
public AbstractMobyHandler(String authority)
throws MobyException
- Throws:
MobyException
hasChanged
public boolean hasChanged(String localLSID,
String centralLSID)
- Checks whether the local object (represented by the lsid) is older than the central object (represented by the
lsid)
- Parameters:
localLSID
- the lsid of the local objectcentralLSID
- the lsid of the central object
- Returns:
- if the local object is older than the central one
change
public boolean change(T object)
- Description copied from interface:
MobyHandler
- Changes the given object in the local repository. First the existing one is unregistered and
then the new one is registered.
- Specified by:
change
in interface MobyHandler<T extends Comparable<T> & LSIDAccessible>
- Parameters:
object
- the object to change
- Returns:
- whether the changing was successfull
synchronizeCentrals
public void synchronizeCentrals(T[] centralList,
T[] local)
- Synchronize the two centrals.
The list parameters are representing the collection of the entries currently found at the centrals. Each entry in
the central list is checked whether it exists in the local central.
If not, the object is registered at the local central
If yes, the object is tested whether the local one is out of date, and if so, the changes are applied.
At the end all entries which havent been found in the master list, but in the local list are unregistered from
the local central.
- Parameters:
centralList
- the entries of the master centrallocal
- the entries of the local central
Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010