Class UsageTask

java.lang.Object
edu.ucsb.nceas.metacat.dataone.quota.UsageTask
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
CreateUsageTask, DeleteUsageTask, UpdateUsageTask

public abstract class UsageTask extends Object implements Runnable
The parent class reporting usages to the remote book keeper server and logging the quota usages events into the local database. The children classes are CreateUsageTask, UpdateUsageTask and DeleteUsageTask.
Author:
tao
  • Field Details

    • usage

      protected org.dataone.bookkeeper.api.Usage usage
    • bookkeeperClient

      protected BookKeeperClient bookkeeperClient
    • isLoggedLocally

      protected boolean isLoggedLocally
  • Constructor Details

    • UsageTask

      public UsageTask(org.dataone.bookkeeper.api.Usage usage, BookKeeperClient bookkeeperClient)
      Constructor
      Parameters:
      usage - the usage will be reported
      bookkeeperClient - the client to report the usage to the remote server
  • Method Details

    • setIsLoggedLocally

      public void setIsLoggedLocally(boolean isLoggedLocally)
      Set the property if the usage has been logged locally or not
      Parameters:
      isLoggedLocally - true means local database has the record; otherwise false.
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • reportToBookKeeper

      protected abstract int reportToBookKeeper() throws Exception
      The child class needs to implement this method to detail how to report the usage to the remote book keeper server.
      Throws:
      Exception