DataPool.java - write a New Connector

0 Likes
over 7 years ago
If you don’t find a connector for your repository on the Borland Community then you can implement your own using the Java connector API.

DataPool.java – contains methods for querying the repository for items to synchronize.

The DataPool is responsible for establishing and managing the connection to a repository and fetching or creating the items in the repository when requested.

Each DataPool instance that is created by Borland Connect is a representation of the project to synchronize and a single item type and it’s property data



Implementing DataPool integration

Each DataPool instance must implement the following abstract methods in order to provide Borland Connect with the data/items from the repository to synchronize.

  • SyncItem[] getAllItems() – returns the full set of Items from the repository matching the project and type context of the DataPool instance.
  • prepareToSync(SyncItem[] items) – populates each of the ‘items’ with the full set of values for the synchronized properties. The ‘items’ passed in will be a subset of those returned from getAllItems().

  • boolean haveAnyItemsChanged(Date lastSyncTime) – returns true if there are any changed items in the project since the ‘lastSyncTime’.
  • boolean haveAnyItemsBeenDeleted(Date lastSyncTime) – returns true if there are any deleted items in the project since the ‘lastSyncTime’.
  • String getDeletedBy(String id) – returns the full name of the user that deleted the specified item ID.
  • Date getDeletedOn(String id) – returns the Date that the specified item ID was deleted from the project.

  • SyncItem createSyncItem(SyncItem parentSyncItem) – creates a new item in the project with ‘parentSyncItem’ (if specified) as the parent and returns the new item as a SyncItem.

Additionally, the base DataPool class provides the following methods for initialization and shutdown that can be overwritten to provide further custom implementation for the repository

  • onSetup() - called the DataPool is initially created
  • onStartSync (Date lastSyncTime) - called at the beginning of each synchronisation
  • onEndSync() - called when Borland Connect is shutting down DataPool
  • impersonate (string username) - called prior to an update where the specific user should be persisted as the Author

Further information on  DataPool.Java  can be found:

  • Javadocs
  • Sample Connectors

Comment List
Anonymous
Related Discussions
Recommended