...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/** * Retrieves the current list of of IRepository Services. * * @return List of repository services * @throws KettleException in case something goes horribly wrong. */ public List<Class<? extends IRepositoryService>> getServiceInterfaces() throws KettleException; /** * Retrieves a given repository service * @param service class name * @return repository service * * @throws KettleException in case something goes horribly wrong. */ public IRepositoryService getService(Class<? extends IRepositoryService> clazz) throws KettleException; /** * Checks whether a given repository service is available or not * * @param repository service class that needs to be checked for support * @throws KettleException in case something goes horribly wrong. */ public boolean hasService(Class<? extends IRepositoryService> clazz) throws KettleException; |
...
Registering services to repository
To add a new service to repository, create an interface for the service and provide an implementation. This new service needs to extend IRepositoryService. This is a marker interface which identifies this new service as a repository service. Once the service is defined, it needs to register itself in the repository implementation. In future we can have this registration done using spring which will even more pluggable.
...
Adding service in detail
To explain this we will use an example of a repository service that provided management of access control list for the repository objects. We created an interface for this service which is described below
...
IAclManager aclImpl = new AclManagerImpl();
registerRepositoryService(IAclManager.class, aclImpl);
RegisiterRepositoryService is a convenience method. All this is doing is adding the service interface and its implementation in a map. Once the services are registered you can the retrieve these service by calling getService method in the Repository API
...
Associating UISupport to a repository service
If this new service has a UI component associated to itSupport, you need create a UISupport class to register them in the UISupportRegistery class.
...
UISupport class needs to register with the corresponding service in order to get consumed correctly.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
UISupportRegistery.getInstance().registerUISupport(IAclManager.class, AclUISupport.class);
|
...
Consuming UISupport classes
The UISupport classes gives us an opportunity to enable ,disable add or remove section(s) of UI based on the services offered by a given repository. For example, if a repository does not support access control on its objects then the UI will never expose these features. At present these UI Support objects are currently getting being consumed in by the repository explorer. We
Finally we need to extend these UISupport object to be applicable to the whole spoon UI. This will give us a complete flexibility in add or removing the UI portions from spoon.