Stardust/Knowledge Base/Java API/Queries/Partitions

From Eclipsepedia

Jump to: navigation, search

Listing the Partitions in a multi-partition Audit Trail

A partition is a logical separation in the audit trail database used to support multi-tenancy. In this context the term does not refer to a database partition.

(Versions: 7.0.0)
This example uses undocumented API (ForkingServiceFactory and IJobManager) to get a list of the partitions in an audit trail.

public List<String> listPartitions() 
 
   {
    ForkingServiceFactory factory = (ForkingServiceFactory) Parameters.instance().get(
          EngineProperties.FORKING_SERVICE_HOME);
    IJobManager jobManager = factory.getJobManager();
    if (null!= jobManager)
    {
       final List<String> result = newArrayList();
 
         jobManager.performSynchronousJob(new Procedure<Void>()
       {
          @Override
          protected void invoke()
          {
             for (Iterator<IAuditTrailPartition> i = AuditTrailPartitionBean.findAll(); i.hasNext(); )
             {
                IAuditTrailPartition partition = i.next();
 
                  result.add(partition.getId());
             }
 
               Collections.sort(result);
          }
       });
 
         return result;
    }
    else
    {
       trace.warn("Not able to list partitions, the component is not fully configured.");
 
         return emptyList();
    }
 }