!--a11y-->
Extending AbstractManager 
You derive the central class for the new repository manager from the abstract class AbstractManager.
The AbstractManager class includes default functions for the start-up procedures and the configuration of the repository manager.
The
mandatory method that you must implement for every specific repository manager
implementation is lookup(IRid
rid):
public IResourceHandle lookup(IRid rid)
throws ResourceException {
if( rid == null ) {
return null;
}
If the
passed IRidobject cannot be mapped to a backend object, the
method can either return null or throw a ResourceException. The method can return null, for example, if
the RID can be mapped but the backend object is not accessible because the
connection has been broken.
The lookup()method also handles the root of the repository manager implementation:
if (rid.equals(this.root.getRid())) {
return new SimpleHandle(
this.root,
this.getUser(rid),
this.getLocale(rid)
);
}
For all other cases, you have to distinguish between a collection and a resource representation:
IResourceHandle parent = this.lookup(rid.parent());
Node node = ((SimpleHandle) parent).getNode();
if( node.isCollection() ) {
Node child = ((FolderNode) node).getChild(rid.name()
.getPath());
if (child != null) {
return new SimpleHandle(
child,
this.getUser(rid),
this.getLocale(rid)
);
}
}
If a
resource exists for the specified RID, the lookup() method must return a valid IResourceHandle object that refers to the corresponding
backend object, otherwise it returns null.
Additional signatures of the lookup() method support mass calls of the
repository framework. You must implement them, if you want to enable mass
calls, for example, for search operations.
To add configuration data that is backend-specific to the repository manager, you use the config member variable of the AbstractManager implementation. The configuration framework fills this member variable with all the configuration data that is defined for the manager instance (see Configuring and Deploying the Repository Manager)..
The configuration can be read within the method startUpImpl(), when the repository manager starts up or at any time after passing the startUpImpl() method:
protected void startUpImpl()
throws ConfigurationException,
StartupException {
…
SimpleRepositoryManager.OSRoot = this.config.getAttribute("OSRoot");
this.root = new FolderNode(this.getRidPrefix().substring(1), null);
…
}
We recommend that you initialize the root resource of the manager in the startUpImpl() method as shown above.
The table shows the methods of AbstractManager class that you have to override or implement:
lookup(IRid rid) |
Returns a valid IResourceHandle object to the corresponding RID object |
startUpImpl() |
Method for handling initialization of the repository manager |