Package net.handle.api
Interface HSAdapter
-
public interface HSAdapter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addHandleValues(java.lang.String handle, HandleValue[] values)
Adds new handle records.HandleValue
createAdminValue(java.lang.String adminHandle, int keyIndex, int index)
Creates an administrative record with the adminHandle and adminIndex at the index.void
createHandle(java.lang.String handle, HandleValue[] values)
Creates a new handle.HandleValue
createHandleValue(int index, java.lang.String type, java.lang.String data)
Creates a new handle value.void
deleteHandle(java.lang.String handle)
Deletes an existing Handle from the handle server.void
deleteHandleValues(java.lang.String handle, HandleValue[] values)
Deletes a specific set of handle values in a Handle.int
getTcpTimeout()
Get how long to wait for responses to TCP and HTTP requests.HandleValue[]
resolveHandle(java.lang.String handle, java.lang.String[] types, int[] indexes)
Resolves a handle and returns a set of handle values that satisfy the type filter specified.HandleValue[]
resolveHandle(java.lang.String handle, java.lang.String[] types, int[] indexes, boolean auth)
Resolves a handle and returns a set of handle values that satisfy the type filter specified.void
setTcpTimeout(int newTcpTimeout)
Set how long to wait for responses to TCP and HTTP requests.void
setUseUDP(boolean useUDP)
Adds and prioritizes the UDP for communication with the Handle server.void
updateHandleValues(java.lang.String handle, HandleValue[] values)
Updates the specified data handle values.
-
-
-
Method Detail
-
addHandleValues
void addHandleValues(java.lang.String handle, HandleValue[] values) throws HandleException
Adds new handle records. Note:- The administrative priveleges have to be valid for this method to perform without any exception
- Parameters:
handle
- The handle into which new values are to be addedvalues
- The array of handle values to deposit- Throws:
HandleException
-
createAdminValue
HandleValue createAdminValue(java.lang.String adminHandle, int keyIndex, int index) throws HandleException
Creates an administrative record with the adminHandle and adminIndex at the index. Note this does not get added to any handle. Also, the administrator has complete permissions. For the types of permissions, please refer to the Handle.net Technical Manual.- Parameters:
adminHandle
- The admin handle for this handle valuekeyIndex
- The index of the public key in the admin Handleindex
- Which index to put this information at.- Returns:
- A new HandleValue containing the admin value
- Throws:
HandleException
-
createHandle
void createHandle(java.lang.String handle, HandleValue[] values) throws HandleException
Creates a new handle. If the handle already exists, the method will throw an exception. The proper course of action is then to delete the handle and call the method again.- Parameters:
handle
- The handle to createvalues
- An array of handle values to add to the handle. Note: Note:- It is important to add admin handle value in order to administer this handle at a later point.
- The administrative priveleges have to be valid for this method to perform without any exception
- Throws:
HandleException
- Describes the error that occured in the process of creating the handle.
-
createHandleValue
HandleValue createHandleValue(int index, java.lang.String type, java.lang.String data) throws HandleException
Creates a new handle value. Note this does not get added to any handle. The default permissions are adminRead=true, adminWrite=true, publicRead=true, and publicWrite=false. Override the permissions once the HandleValue is created for enforcing different permissions.- Parameters:
index
- Which index to put this information at.type
- The type of the handle valuedata
- The data for this handle value Otherwise not.- Throws:
HandleException
-
deleteHandle
void deleteHandle(java.lang.String handle) throws HandleException
Deletes an existing Handle from the handle server. Note:- The administrative priveleges have to be valid for this method to perform without any exception
- Parameters:
handle
- The handle to delete.- Throws:
HandleException
-
deleteHandleValues
void deleteHandleValues(java.lang.String handle, HandleValue[] values) throws HandleException
Deletes a specific set of handle values in a Handle. Note:- The administrative priveleges have to be valid for this method to perform without any exception
- Parameters:
handle
- The Handle that we want to delete values fromvalues
- An array of handle values to delete.- Throws:
HandleException
- Describes the error that occured while executing the method.
-
resolveHandle
HandleValue[] resolveHandle(java.lang.String handle, java.lang.String[] types, int[] indexes, boolean auth) throws HandleException
Resolves a handle and returns a set of handle values that satisfy the type filter specified. If the resolution is to retrieve all handle values, specify null for both filter and indexes. If the administrative priveleges are applicable, the restricted values will also be returned.- Parameters:
handle
- The value of the handle to resolvetypes
- The types of the handle values that we are looking for.auth
- Whether to perform an authoritative resolution- Throws:
HandleException
- Describes the error in resolution
-
resolveHandle
HandleValue[] resolveHandle(java.lang.String handle, java.lang.String[] types, int[] indexes) throws HandleException
Resolves a handle and returns a set of handle values that satisfy the type filter specified. If the resolution is to retrieve all handle values, specify null for both filter and indexes. If the administrative priveleges are applicable, the restricted values will also be returned. Also, the resolution request is not authoritative.- Parameters:
handle
- The value of the handle to resolvetypes
- The types of the handle values that we are looking for.- Throws:
HandleException
- Describes the error in resolution
-
setTcpTimeout
void setTcpTimeout(int newTcpTimeout)
Set how long to wait for responses to TCP and HTTP requests.- Parameters:
newTcpTimeout
- Milliseconds to use for timeout.
-
getTcpTimeout
int getTcpTimeout()
Get how long to wait for responses to TCP and HTTP requests.
-
setUseUDP
void setUseUDP(boolean useUDP)
Adds and prioritizes the UDP for communication with the Handle server.- Parameters:
useUDP
- The boolean flag that specifies the use of UDP.
-
updateHandleValues
void updateHandleValues(java.lang.String handle, HandleValue[] values) throws HandleException
Updates the specified data handle values. Note:- Make sure that the index value is specified in the array of handle values or else this method will not work well.
- The administrative priveleges have to be valid for this method to perform without any exception
- Parameters:
handle
-values
-- Throws:
HandleException
-
-