public class BookKeeperClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_REMOTE_USAGE_ID |
Modifier | Constructor and Description |
---|---|
protected |
BookKeeperClient()
A private constructor
|
Modifier and Type | Method and Description |
---|---|
int |
createUsage(org.dataone.bookkeeper.api.Usage usage)
Create a usage record for a given quota identifier in the book keeper service.
|
int |
deleteUsage(int quotaId,
java.lang.String instanceId)
Delete the usage with the given quota type and instance id in the remote book keeper service
|
static BookKeeperClient |
getInstance()
Get the singleton instance of the BookKeeplerClient class
|
java.util.List<org.dataone.bookkeeper.api.Quota> |
listQuotas(java.lang.String quotaSubject,
java.lang.String requestor,
java.lang.String quotaType)
List the quotas associated with the given subject
|
int |
updateUsage(int quotaId,
java.lang.String instanceId,
org.dataone.bookkeeper.api.Usage usage)
Update an existing usage with the given quota id and instance id
|
public static final int DEFAULT_REMOTE_USAGE_ID
protected BookKeeperClient() throws org.dataone.service.exceptions.ServiceFailure
java.io.IOException
org.dataone.service.exceptions.ServiceFailure
public static BookKeeperClient getInstance() throws org.dataone.service.exceptions.ServiceFailure
java.io.IOException
org.dataone.service.exceptions.ServiceFailure
public java.util.List<org.dataone.bookkeeper.api.Quota> listQuotas(java.lang.String quotaSubject, java.lang.String requestor, java.lang.String quotaType) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.InvalidRequest, java.io.UnsupportedEncodingException
quotaSubject
- the subject who owns the quotasrequestor
- the subject of user who will request a usagequotaType
- the type of the quotas (storage or portal)java.io.IOException
org.apache.http.client.ClientProtocolException
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidRequest
java.io.UnsupportedEncodingException
public int createUsage(org.dataone.bookkeeper.api.Usage usage) throws org.apache.http.client.ClientProtocolException, java.io.IOException, org.dataone.service.exceptions.ServiceFailure
usage
- the object of the usage will be createdorg.apache.http.client.ClientProtocolException
java.io.IOException
org.dataone.service.exceptions.ServiceFailure
public int deleteUsage(int quotaId, java.lang.String instanceId) throws org.dataone.service.exceptions.InvalidRequest, org.apache.http.client.ClientProtocolException, org.dataone.service.exceptions.ServiceFailure, java.io.IOException
quotaType
- the quota type associated with the usageinstanceId
- the instance id associated with the usageorg.dataone.service.exceptions.InvalidRequest
org.apache.http.client.ClientProtocolException
org.dataone.service.exceptions.ServiceFailure
java.io.IOException
public int updateUsage(int quotaId, java.lang.String instanceId, org.dataone.bookkeeper.api.Usage usage) throws org.dataone.service.exceptions.InvalidRequest, org.apache.http.client.ClientProtocolException, org.dataone.service.exceptions.ServiceFailure, java.io.IOException
quotaId
- the quota id which the existing usage matchesinstanceId
- the instance id which the existing usage matchesusage
- the new usage value will be usedorg.dataone.service.exceptions.InvalidRequest
org.apache.http.client.ClientProtocolException
org.dataone.service.exceptions.ServiceFailure
java.io.IOException
Copyright © 2023 Regents of the University of California. All Rights Reserved.