edu.ucsb.nceas.metacat.dataone.quota

## Class PortalQuotaService

- java.lang.Object
- - edu.ucsb.nceas.metacat.dataone.quota.QuotaService
  - - edu.ucsb.nceas.metacat.dataone.quota.PortalQuotaService

-     public class PortalQuotaService
      extends QuotaService

  A class enforce the portal quota service, which controls how many portals users can create
  Author:
    tao

- - ### Field Summary

    - ### Fields inherited from class edu.ucsb.nceas.metacat.dataone.quota.QuotaService

      `client, DEFAULT_QUOTA_ID, executor, nodeId`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `enforce(java.lang.String quotaSubject, org.dataone.service.types.v1.Subject requestor, java.lang.String instanceId, org.dataone.service.types.v2.SystemMetadata sysmeta, java.lang.String method)` The method will be implemented by the child classes to enforce the quota service
    `static QuotaService` | `getInstance(java.util.concurrent.ExecutorService executor, BookKeeperClient client)` Get a singleton class instance

    - ### Methods inherited from class edu.ucsb.nceas.metacat.dataone.quota.QuotaService

      `checkQuota, deleteUsage, isLastUnarchivedInChain, isLastUndeletedInChain, updateUsage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static QuotaService getInstance(java.util.concurrent.ExecutorService executor,
                                                 BookKeeperClient client)

      Get a singleton class instance
      Parameters:
        `executor` - a thread executor service
        `client` - the client to connect the remote book keeper server
      Returns:
        the PortalQuotaService instance

    - #### enforce

          public void enforce(java.lang.String quotaSubject,
                              org.dataone.service.types.v1.Subject requestor,
                              java.lang.String instanceId,
                              org.dataone.service.types.v2.SystemMetadata sysmeta,
                              java.lang.String method)
                       throws org.dataone.service.exceptions.ServiceFailure,
                              org.dataone.service.exceptions.InvalidRequest,
                              org.dataone.service.exceptions.InsufficientResources,
                              org.dataone.service.exceptions.NotImplemented,
                              org.dataone.service.exceptions.NotFound,
                              java.io.UnsupportedEncodingException

      Description copied from class: `QuotaService`
      The method will be implemented by the child classes to enforce the quota service
      Specified by:
        `enforce` in class `QuotaService`
      Parameters:
        `quotaSubject` - the subject of the quota which will be used
        `requestor` - the subject of the user who requests the usage
        `instanceId` - the id of the object will be applied the quota
        `sysmeta` - the system metadata of the object which will use the quota
        `method` - the method name which will call the createUsage method (create or update)
      Throws:
        `org.dataone.service.exceptions.ServiceFailure`
        `org.dataone.service.exceptions.InvalidRequest`
        `org.dataone.service.exceptions.InsufficientResources`
        `org.dataone.service.exceptions.NotImplemented`
        `org.dataone.service.exceptions.NotFound`
        `java.io.UnsupportedEncodingException`

Copyright © 2023 Regents of the University of California. All Rights Reserved.