From 14d95519d85be2af6576b0e96cdc29adfdb2fe1c Mon Sep 17 00:00:00 2001
From: Xavier Hanin
A repository supports the following fundamental operations + *
{@link #get} retrieves a resource specified by a provided identifier creating a new file .
+ * + *{@link #put} transfers a file to the repository. + *
+ * + *{@link #list} returns a listing of file like objects + * belonging to a specified parent directory.
+ * + */ public interface Repository { + + /** + * Return the resource associated with a specified identifier. + * + * @param source A string identifying the resource. + * @return The resource associated with the resource identifier. + * @throws IOException On failure to get resource. + */ Resource getResource(String source) throws IOException; - void get(String source, File destination) throws IOException; - void put(File source, String destination, boolean overwrite) throws IOException; + /** - * Returns the list of all resources names that can be found in the given - * parent. - * @param parent - * @return a List of String, the names of the resources that can be found in the given - * parent + * Fetch a resource from the repository. + * + * @param source A string identifying the resource to be fetched. + * @param destination Where to place the fetched resource. + * @throws IOException On retrieval failure. + */ + void get(String source, File destination) throws IOException; + + + /** + * Transfer a resource to the repository + * + * @param source The local file to be transferred. + * @param destination Where to transfer the resource. + * @param overwrite Whether the transfer should overwrite an existing resource. + * @throws IOException On publication failure. + */ + void put(File source, String destination, boolean overwrite) throws IOException; + + /** + * Return a listing of resources + * + * @param parent The parent directory from which to generate the listing. + * @return A listing of the parent directory's file content. + * @throws IOException On listing failure. */ List list(String parent) throws IOException; + /** + * Add a listener to the repository. + * + * @param listener The listener to attach to the repository. + */ void addTransferListener(TransferListener listener); + + /** + * Remove a listener on the repository + * + * @param listener The listener to remove + */ void removeTransferListener(TransferListener listener); + + /** + * Determine if a given listener is attached to the repository. + * + * @param listener The listener being quireied + * @returntrue if the provided listener is attached to the repository,
+ * false if not.
+ */
boolean hasTransferListener(TransferListener listener);
+
+ /**
+ * Get the repository's file separator string.
+ *
+ * @return The repository's file separator delimiter
+ */
String getFileSeparator();
+
+ /**
+ * Normalize a string.
+ *
+ * @param source The string to normalize.
+ * @return The normalized string.
+ */
String standardize(String source);
+
+ /**
+ * Return the name of the repository
+ *
+ */
String getName();
}