Package org.jgroups.protocols
Class RACKSPACE_PING.RackspaceClient
- java.lang.Object
-
- org.jgroups.protocols.RACKSPACE_PING.RackspaceClient
-
- Enclosing class:
- RACKSPACE_PING
protected static class RACKSPACE_PING.RackspaceClient extends java.lang.ObjectA thread safe Rackspace ReST client
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRACKSPACE_PING.RackspaceClient.ConnBuilderBuild HttpURLConnections with adequate headers and methodprivate classRACKSPACE_PING.RackspaceClient.CredentialsResult of an successfully authenticated sessionprivate classRACKSPACE_PING.RackspaceClient.ResponseResponse for a Rackspace API call
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringACCEPT_HEADERprivate java.net.URLapiEndpointprivate java.lang.StringapiKeyprivate static java.lang.StringAUTH_HEADERprivate static java.lang.StringAUTH_KEY_HEADERprivate static java.lang.StringCONTENT_LENGTH_HEADERprivate RACKSPACE_PING.RackspaceClient.Credentialscredentialsprivate Loglogprivate static java.lang.StringSTORAGE_TOKEN_HEADERprivate static java.lang.StringSTORAGE_URL_HEADERprivate java.lang.Stringusername
-
Constructor Summary
Constructors Constructor Description RackspaceClient(java.net.URL apiEndpoint, java.lang.String username, java.lang.String apiKey)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidauthenticate()AuthenticatevoidcreateContainer(java.lang.String containerName)Create a container, which is equivalent to a bucketvoidcreateObject(java.lang.String containerName, java.lang.String objectName, byte[] contents)Create an object (=file)voiddeleteObject(java.lang.String containerName, java.lang.String objectName)Delete a object (=file) from the storageprivate RACKSPACE_PING.RackspaceClient.ResponsedoAuthOperation(java.net.HttpURLConnection urlConnection)Do a http auth operation, will not handle 401 permission denied errorsprivate RACKSPACE_PING.RackspaceClient.ResponsedoOperation(java.net.HttpURLConnection urlConnection, byte[] inputData, boolean hasOutput)Do a http operationprivate RACKSPACE_PING.RackspaceClient.ResponsedoReadOperation(java.net.HttpURLConnection urlConnection)Do a operation that reads from the httpconnectionprivate RACKSPACE_PING.RackspaceClient.ResponsedoSendOperation(java.net.HttpURLConnection urlConnection, byte[] content)Do a operation that writes content to the HttpURLConnectionprivate RACKSPACE_PING.RackspaceClient.ResponsedoVoidOperation(java.net.HttpURLConnection urlConnection)Do a operation that does not write or read from HttpURLConnection, except for the headersjava.util.List<java.lang.String>listObjects(java.lang.String containerName)List files in a folder(package private) RACKSPACE_PING.RackspaceClientlog(Log l)byte[]readObject(java.lang.String containerName, java.lang.String objectName)Read the content of a file
-
-
-
Field Detail
-
ACCEPT_HEADER
private static final java.lang.String ACCEPT_HEADER
- See Also:
- Constant Field Values
-
AUTH_HEADER
private static final java.lang.String AUTH_HEADER
- See Also:
- Constant Field Values
-
AUTH_KEY_HEADER
private static final java.lang.String AUTH_KEY_HEADER
- See Also:
- Constant Field Values
-
STORAGE_TOKEN_HEADER
private static final java.lang.String STORAGE_TOKEN_HEADER
- See Also:
- Constant Field Values
-
STORAGE_URL_HEADER
private static final java.lang.String STORAGE_URL_HEADER
- See Also:
- Constant Field Values
-
CONTENT_LENGTH_HEADER
private static final java.lang.String CONTENT_LENGTH_HEADER
- See Also:
- Constant Field Values
-
apiEndpoint
private final java.net.URL apiEndpoint
-
username
private final java.lang.String username
-
apiKey
private final java.lang.String apiKey
-
credentials
private volatile RACKSPACE_PING.RackspaceClient.Credentials credentials
-
log
private Log log
-
-
Method Detail
-
log
RACKSPACE_PING.RackspaceClient log(Log l)
-
authenticate
public void authenticate()
Authenticate
-
deleteObject
public void deleteObject(java.lang.String containerName, java.lang.String objectName)Delete a object (=file) from the storage- Parameters:
containerName- Folder nameobjectName- File name
-
createContainer
public void createContainer(java.lang.String containerName)
Create a container, which is equivalent to a bucket- Parameters:
containerName- Name of the container
-
createObject
public void createObject(java.lang.String containerName, java.lang.String objectName, byte[] contents)Create an object (=file)- Parameters:
containerName- Name of the containerobjectName- Name of the filecontents- Binary content of the file
-
readObject
public byte[] readObject(java.lang.String containerName, java.lang.String objectName)Read the content of a file- Parameters:
containerName- Name of the folderobjectName- name of the file- Returns:
- Content of the files
-
listObjects
public java.util.List<java.lang.String> listObjects(java.lang.String containerName)
List files in a folder- Parameters:
containerName- Folder name- Returns:
- List of file names
-
doOperation
private RACKSPACE_PING.RackspaceClient.Response doOperation(java.net.HttpURLConnection urlConnection, byte[] inputData, boolean hasOutput)
Do a http operation- Parameters:
urlConnection- the HttpURLConnection to be usedinputData- if not null,will be written to the urlconnection.hasOutput- if true, read content back from the urlconnection- Returns:
- Response
-
doAuthOperation
private RACKSPACE_PING.RackspaceClient.Response doAuthOperation(java.net.HttpURLConnection urlConnection)
Do a http auth operation, will not handle 401 permission denied errors- Parameters:
urlConnection- the HttpURLConnection to be used- Returns:
- Response Response
-
doVoidOperation
private RACKSPACE_PING.RackspaceClient.Response doVoidOperation(java.net.HttpURLConnection urlConnection)
Do a operation that does not write or read from HttpURLConnection, except for the headers- Parameters:
urlConnection- the connection- Returns:
- Response
-
doSendOperation
private RACKSPACE_PING.RackspaceClient.Response doSendOperation(java.net.HttpURLConnection urlConnection, byte[] content)
Do a operation that writes content to the HttpURLConnection- Parameters:
urlConnection- the connectioncontent- The content to send- Returns:
- Response
-
doReadOperation
private RACKSPACE_PING.RackspaceClient.Response doReadOperation(java.net.HttpURLConnection urlConnection)
Do a operation that reads from the httpconnection- Parameters:
urlConnection- The connections- Returns:
- Response
-
-