RAS repository API example

The com.ibm.ras.example.repository package provides examples of how to programmatically perform queries and create, remove, or list RAS assets.

com.ibm.ras.example.repository package

You can use the CompoundQueryLocal pluglet to query assets in a repository or the CompoundQueryPatterns pluglet for a query in the patterns repository. To create or remove assets, use the CreateRemoveLocalRepository or the CreateRemoveWorkgroupRepository pluglets. To search, list, move, or publish assets, use the KeyWordSearch, ListAvailableRepositories, MoveAsset or PublishRemove pluglet.

To successfully run this pluglet you must install a workgroup repository. For details about how to install a workgroup repository, go to the IBM alphaWorks Web site and search for RAS. After setting up and configuring your workgroup repository, change the connection URL in the pluglet code to connect to it.

The com.ibm.ras.example.repository package contains the following pluglets that can be used to work with assets:

Pluglet Description Results
CompoundQueryLocal Provides an example of how to perform a compound query on the assets in a repository. The pluglet in the example demonstrates the following operations:
  • Retrieving the repository service
  • Creating a local repository
  • Retrieving the repository query factory
  • Creating a compound repository query
  • Searching the assets of the repository using the compound query
  • Iterating through the results of the query
When run successfully, the assets matching the query are listed in the Console view.
CompoundQueryPatterns Provides an example of how to perform a compound query on the assets in the patterns repository. The pluglet in the example demonstrates the following operations:
  • Retrieving the repository service
  • Retrieving all repository client instances of a particular type
  • Retrieving the repository query factory
  • Creating a compound repository query
  • Searching the assets of the repository using the compound query
  • Iterating through the results of the query
When run successfully, the assets matching the query are listed in the Console view.
CreateRemoveLocalRepository Provides an example of how to create and remove a local repository connection. The pluglet in the example demonstrates the following operations:
  • Retrieving the repository service
  • Creating a connection to a local repository
  • Acquiring the metrics from the repository client
  • Removing the connection to the repository
When run successfully, the metrics about the local repository created are sent to the Console view.
CreateRemoveWorkgroupRepository Provides an example of how to create and remove a workgroup repository connection. The pluglet in the example demonstrates the following operations:
  • Retrieving the repository service
  • Creating a connection to a workgroup repository
  • Acquiring the metrics from the repository client
  • Removing the connection to the workgroup repository
When run successfully, the metrics about the workgroup repository created are sent to the Console view.
KeyWordSearch Provides an example of how to perform a key word search on the assets in a repository. The pluglet in the example demonstrates the following operations:
  • Creating a connection to a local repository
  • Creating a keyword repository query
  • Searching the assets of the repository using the keyword query
  • Iterating through the results of the search
  • Removing the connection to the repository
When run successfully, the assets containing the keywords are listed in the Console view.
ListAvailableRepositories Provides an example of how to acquire a list of repository instances. The pluglet in the example demonstrates the following operations:
  • Acquiring the repository service
  • Retrieving all repository client instances
  • Iterating through the repository client instances
  • Retrieving the closed repository client instances
When run successfully, the repository client instance names are sent to the Console view.
MoveAsset Provides an example of how to move an asset between logical views in the repository. The pluglet in the example demonstrates the following operations:
  • Retrieving the repository service
  • Creating a connection to a local repository
  • Retrieving all the asset views at the root of the repository
  • Creating a logical folder view in the repository
  • Moving all the asset views at the root to the newly created logical view
  • Removing the connection to the repository
When run successfully, the name of each asset view and its parent are sent to the Console view before and after the move in the repository.
PublishRemove Provides an example of how to publish to and remove an asset from a local repository. The pluglet in the example demonstrates the following operations:
  • Creating a connection to a local repository
  • Retrieving the metrics from the repository client
  • Publishing an asset to a repository client
  • Removing an asset from the repository
  • Removing the connection to the repository
When run successfully, this pluglet provides the following output in the Console view:
  • The metrics of the local repository before and after the publish operation
  • A message indicating the success or the failure of the publish operation.

Feedback