You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by wo...@apache.org on 2010/07/29 23:35:07 UTC
svn commit: r980588 - in /incubator/libcloud/sandbox/java/trunk/src/sc: ./
StorageService/ StorageService/Adapter.java
Author: woodser
Date: Thu Jul 29 21:35:06 2010
New Revision: 980588
URL: http://svn.apache.org/viewvc?rev=980588&view=rev
Log:
Adapter interface for SimpleCloud StorageService complete.
Added:
incubator/libcloud/sandbox/java/trunk/src/sc/
incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/
incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/Adapter.java
Added: incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/Adapter.java
URL: http://svn.apache.org/viewvc/incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/Adapter.java?rev=980588&view=auto
==============================================================================
--- incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/Adapter.java (added)
+++ incubator/libcloud/sandbox/java/trunk/src/sc/StorageService/Adapter.java Thu Jul 29 21:35:06 2010
@@ -0,0 +1,126 @@
+package sc.StorageService;
+
+import java.util.List;
+import java.util.Map;
+
+/*
+ * Common interface for unstructured cloud storage.
+ *
+ * TODO: for every return void, why not return status? PHP doesn't.
+ */
+public interface Adapter {
+
+ // TODO: HTTP adapter mapping
+
+ /*
+ * Get an item from the storage service.
+ *
+ * @param path is the path to the item
+ * @param options are provider-specific options for retrieving the item
+ *
+ * @return Object represents the retrieved object
+ */
+ public Object fetchItem(String path, String[] options);
+
+ /*
+ * Store an item in the storage service.
+ *
+ * WARNING: This operation overwrites any item that is located at the
+ * destinationPath.
+ *
+ * @param destinationPath is the path to write the item
+ * @param data is the data to write to the path
+ * @param options are provider-specific options for writing the item
+ *
+ * @return true if the write succeeded, false otherwise
+ */
+ public boolean storeItem(String destinationPath, Object data, String[] options);
+
+ /*
+ * Delete an item in the storage service.
+ *
+ * @param path is the path to the item to delete
+ * @param options are provider-specific options for deleting the item
+ */
+ public void deleteItem(String path, String[] options);
+
+ /*
+ * Copy an item in the storage service to a given path.
+ *
+ * The destinationPath must be a directory.
+ *
+ * @param sourcePath is the path to the item to copy
+ * @param destinationPath is the path to copy the source item to
+ * @param options are provider-specific options to copy the item
+ */
+ public void copyItem(String sourcePath, String destinationPath, String[] options);
+
+ /*
+ * Move an item in the storage service to a given path.
+ *
+ * The destinationPath must be a directory.
+ *
+ * @param sourcePath is the path to the item to move
+ * @param destinationPath is the path to move the source item to
+ * @param options are provider-specific options to move the item
+ */
+ public void moveItem(String sourcePath, String destinationPath, String[] options);
+
+ /*
+ * Rename an item in the storage service to a given name.
+ *
+ * @param path is the path to the item to rename
+ * @param name is the new name to give the item
+ * @param options are provider-specific options to rename the item
+ */
+ public void renameItem(String path, String name, String[] options);
+
+ /*
+ * List items in the given directory in the storage service.
+ *
+ * The given path must be a directory.
+ *
+ * @param path specifies the directory containing the items to list
+ * @param options are provider-specific options to list the items
+ *
+ * @return List<String> are the list of item names in the directory
+ */
+ public List<String> listItems(String path, String[] options);
+
+ /*
+ * Get a key/value map of metadata for the given path.
+ *
+ * @param path is the path to retrieve metadata for
+ * @param options are provider-specific options to retrieve the metadata
+ *
+ * @return Map<String, String> is the item's metadata
+ */
+ public Map<String, String> fetchMetadata(String path, String[] options);
+
+ /*
+ * Store a key/value map of metadata at the given path.
+ *
+ * WARNING: This operation overwrites any metadata that is already located
+ * at the destinationPath.
+ *
+ * @param destinationPath is the path to the store the metadata at
+ * @param metadata is the key/value metadata to store at the given path
+ * @param options are provider-specific options for storing the metadata
+ */
+ public void storeMetadata(String destinationPath, Map<String, String> metadata, String[] options);
+
+ /*
+ * Delete a key/value map of metadata at the given path.
+ *
+ * @param path is the path to delete the metadata from
+ * @param options are provider specific options for deleting the metadata
+ */
+ public void deleteMetadata(String path, String[] options);
+
+ /*
+ * Get the concrete client.
+ *
+ * @return the conrete client representing this adapter
+ */
+ public Adapter getClient();
+}