Package org.jgroups.protocols
Class RACKSPACE_PING.RackspaceClient
java.lang.Object
org.jgroups.protocols.RACKSPACE_PING.RackspaceClient
- Enclosing class:
RACKSPACE_PING
A thread safe Rackspace ReST client
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classBuild HttpURLConnections with adequate headers and methodprivate classResult of an successfully authenticated sessionprivate classResponse for a Rackspace API call -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRackspaceClient(URL apiEndpoint, String username, String apiKey) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAuthenticatevoidcreateContainer(String containerName) Create a container, which is equivalent to a bucketvoidcreateObject(String containerName, String objectName, byte[] contents) Create an object (=file)voiddeleteObject(String containerName, String objectName) Delete a object (=file) from the storagedoAuthOperation(HttpURLConnection urlConnection) Do a http auth operation, will not handle 401 permission denied errorsdoOperation(HttpURLConnection urlConnection, byte[] inputData, boolean hasOutput) Do a http operationdoReadOperation(HttpURLConnection urlConnection) Do a operation that reads from the httpconnectiondoSendOperation(HttpURLConnection urlConnection, byte[] content) Do a operation that writes content to the HttpURLConnectiondoVoidOperation(HttpURLConnection urlConnection) Do a operation that does not write or read from HttpURLConnection, except for the headerslistObjects(String containerName) List files in a folder(package private) RACKSPACE_PING.RackspaceClientbyte[]readObject(String containerName, String objectName) Read the content of a file
-
Field Details
-
ACCEPT_HEADER
- See Also:
-
AUTH_HEADER
- See Also:
-
AUTH_KEY_HEADER
- See Also:
-
STORAGE_TOKEN_HEADER
- See Also:
-
STORAGE_URL_HEADER
- See Also:
-
CONTENT_LENGTH_HEADER
- See Also:
-
apiEndpoint
-
username
-
apiKey
-
credentials
-
log
-
-
Constructor Details
-
RackspaceClient
Constructor- Parameters:
apiEndpoint- UK or US authentication endpointusername- Rackspace usernameapiKey- Rackspace apiKey
-
-
Method Details
-
log
-
authenticate
public void authenticate()Authenticate -
deleteObject
Delete a object (=file) from the storage- Parameters:
containerName- Folder nameobjectName- File name
-
createContainer
Create a container, which is equivalent to a bucket- Parameters:
containerName- Name of the container
-
createObject
Create an object (=file)- Parameters:
containerName- Name of the containerobjectName- Name of the filecontents- Binary content of the file
-
readObject
Read the content of a file- Parameters:
containerName- Name of the folderobjectName- name of the file- Returns:
- Content of the files
-
listObjects
List files in a folder- Parameters:
containerName- Folder name- Returns:
- List of file names
-
doOperation
private RACKSPACE_PING.RackspaceClient.Response doOperation(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
Do a http auth operation, will not handle 401 permission denied errors- Parameters:
urlConnection- the HttpURLConnection to be used- Returns:
- Response Response
-
doVoidOperation
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(HttpURLConnection urlConnection, byte[] content) Do a operation that writes content to the HttpURLConnection- Parameters:
urlConnection- the connectioncontent- The content to send- Returns:
- Response
-
doReadOperation
Do a operation that reads from the httpconnection- Parameters:
urlConnection- The connections- Returns:
- Response
-