/** * Delete a object (=file) from the storage * * @param containerName Folder name * @param objectName File name */ public void deleteObject(String containerName, String objectName) { HttpURLConnection urlConnection = new ConnBuilder(credentials, containerName, objectName) .method("DELETE") .getConnection(); Response response = doVoidOperation(urlConnection); if (!response.isSuccessCode()) { if (response.isAuthDenied()) { log.warn("Refreshing credentials and retrying"); authenticate(); deleteObject(containerName, objectName); } else { log.error(Util.getMessage("ErrorDeletingObject") + objectName + " from container " + containerName + ",code = " + response.code); } } }
/** * Create a container, which is equivalent to a bucket * * @param containerName Name of the container */ public void createContainer(String containerName) { HttpURLConnection urlConnection = new ConnBuilder(credentials, containerName, null) .method("PUT") .getConnection(); Response response = doVoidOperation(urlConnection); if (!response.isSuccessCode()) { if (response.isAuthDenied()) { log.warn("Refreshing credentials and retrying"); authenticate(); createContainer(containerName); } else { log.error(Util.getMessage("ErrorCreatingContainer") + containerName + " ,code = " + response.code); } } }
/** * Create a container, which is equivalent to a bucket * * @param containerName Name of the container */ public void createContainer(String containerName) { HttpURLConnection urlConnection = new ConnBuilder(credentials, containerName, null) .method("PUT") .getConnection(); Response response = doVoidOperation(urlConnection); if (!response.isSuccessCode()) { if (response.isAuthDenied()) { log.warn("Refreshing credentials and retrying"); authenticate(); createContainer(containerName); } else { log.error(Util.getMessage("ErrorCreatingContainer") + containerName + " ,code = " + response.code); } } }
/** * Delete a object (=file) from the storage * * @param containerName Folder name * @param objectName File name */ public void deleteObject(String containerName, String objectName) { HttpURLConnection urlConnection = new ConnBuilder(credentials, containerName, objectName) .method("DELETE") .getConnection(); Response response = doVoidOperation(urlConnection); if (!response.isSuccessCode()) { if (response.isAuthDenied()) { log.warn("Refreshing credentials and retrying"); authenticate(); deleteObject(containerName, objectName); } else { log.error(Util.getMessage("ErrorDeletingObject") + objectName + " from container " + containerName + ",code = " + response.code); } } }