Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

One of the changes in Pentaho Data Integration 4.0 is the introduction of services for repositories. To support this new concept, the repository API associated with Pentaho Data Integration has changed.

This document describes how you can create these repository services and register them to the repository. In addition, this document also explains how you can dynamically change the UI based on the repository to which the user is connected.

Changes to Repository API

To enable the registering of these repository services, some new methods have been added to the repository API. Details related to these method are described below:

Code Block
java
java
titleRepository.java
/**
  * 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. The new service must extend the IRepositoryService. This is a marker interface that identifies the new service as a repository service. Once the service is defined, it must register itself in the repository's implementation. In the future, registration will be performed using Spring making configuration easier.

Adding service in detail

An example of a repository service that provides management of access control list for the repository objects is shown below. An interface for this service is described as follows:

...

RegisiterRepositoryService is a convenience method. All it does is adding the service interface and its implementation in a map. Once the services are registered you can the retrieve the service by calling the getService method in the Repository API

Associating UISupport to a repository service

If the new service has a UI component associated with it, you will be required to create a UISupport class and register it in the UISupportRegistry class.

Creating UISupport

The IAclManager service has a UI component and for that a UISupport class was created that extends the AbstractRepositoryExplorerUISupport class and implements the setup method.

...

In the setup method all overlays or/and event handlers that this service provides were added. Finally, the UI Support class must be registered.

Registering UISupport

The UISupport class must register with its corresponding service interface to get consumed correctly.

Code Block
java
java
titleRegisterUISupport.java
UISupportRegistery.getInstance().registerUISupport(IAclManager.class,  AclUISupport.class);

Consuming UISupport classes

The UISupport classes gives you 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. Currently,  the UI Support objects are being consumed by the Repository Explorer.

...