Managing Audit Trail Partitions

The class AuditTrailPartitionManager provides methods to create and drop partitions via API instead of using the Sysconsole command.

Creating a Partition

The following method creates a new partition with a given partitionId if no partition having this ID currently exists.

   public static void createAuditTrailPartition(String partitionId, String password)
         throws SQLException
   {
      SchemaHelper.alterAuditTrailCreatePartition(password, partitionId, null, null);
   }

You need to provide the password of the Sysconsole as parameter password along with the ID of the partition. An SQLException is thrown in case an error occurs during the creation.

Deleting a Partition

To delete a partition with a given partitionId, use the method dropAuditTrailPartition:

   public static void dropAuditTrailPartition(String partitionId, String password)
   {
      Utils.initCarnotEngine(partitionId);
      SchemaHelper.alterAuditTrailDropPartition(partitionId, password);
   }

Along with the ID of the partition you need to provide the password of the Sysconsole as parameter password.

Example Usage

The following shows a snippet of a class that uses the AuditTrailPartitionManager methods for creating and deleting audit trail partitions with a given ID and Sysconsole password:

import org.eclipse.stardust.engine.api.pojo.AuditTrailPartitionManager;
...
   public static void createPartitionUsingAPI() throws SQLException
   {     
      AuditTrailPartitionManager.createAuditTrailPartition("NewPartition", "sysop"); 
   }
   
   public static void dropPartitionUsingAPI() throws SQLException
   {
      AuditTrailPartitionManager.dropAuditTrailPartition("NewPartition", "sysop");   
   }