at.ac.tuwien.dslab.rmi.common.interfaces
Interface IFileManager

All Superinterfaces:
java.rmi.Remote

public interface IFileManager
extends java.rmi.Remote

The IFileManager implements the base class of the DSGFileMan server. All this methods have to be implemented according to the specification. Please also read the JavaDoc very carefully. It describes each method in detail (e.g., method arguments, which exception to throw in which case, etc.).


Method Summary
 void addRepositoryListener(java.lang.String repoName, IUser user, IRepositoryListener listener)
          Add a repository listener to the repository to get notifications when certain events on the server occur.
 IDocument[] checkout(java.lang.String repoName, IUser user)
          Checks out all documents from the repository.
 long commitDocument(java.lang.String repoName, IUser user, IDocument doc)
          Commits an existing document to the repository.
 void createRepository(java.lang.String name, IUser owner, java.lang.String... allowedUserNames)
          Creates a new repository on the document server.
 void importDocument(java.lang.String repoName, IUser user, IDocument doc)
          Imports a new document to the repository.
 void removeDocument(java.lang.String repoName, IUser user, java.lang.String documentName)
          Removes a document from the repository and ALSO deletes it locally.
 void removeRepository(java.lang.String name, IUser owner)
          Removes the repository and all the documents it contains, if the given user matches the owner of the repository.
 void removeRespositoryListener(java.lang.String repoName, IRepositoryListener listener)
          Removes a repository listener to stop listening to notifications.
 IDocument[] updateAllDocuments(java.lang.String repoName, IUser user)
          Updates all documents from the repository.
 IDocument updateDocument(java.lang.String repoName, IUser user, java.lang.String filename, long version)
          Updates a local document with the most recent (or a specific) version from the repository.
 

Method Detail

createRepository

void createRepository(java.lang.String name,
                      IUser owner,
                      java.lang.String... allowedUserNames)
                      throws RepositoryExistsException,
                             RepositoryNamingException,
                             UserAccessException,
                             FileManException,
                             java.rmi.RemoteException
Creates a new repository on the document server.

Parameters:
name - The name of the repository. The repository has to start with dsgfm_ as prefix (e.g., dsgfm001_reponame) otherwise you get a RepositoryNamingException. You can find the dsgfm account information in your account directory.
owner - The owner of the repository (use your dsgfm username and password).
allowedUserNames - A list of users which have access to the repository (the owner has always access).
Throws:
RepositoryExistsException - If the repository already exists on the server.
RepositoryNamingException - If you do not stick to the naming convention 'dsgfmXXX_' as prefix.
UserAccessException - If the owner is not a valid user (either the owner does not exist, or the password is wrong).
FileManException - If an error occurs while creating the repository.
java.rmi.RemoteException - If a communication error occurs.

removeRepository

void removeRepository(java.lang.String name,
                      IUser owner)
                      throws RepositoryNotExistsException,
                             UserAccessException,
                             FileManException,
                             java.rmi.RemoteException
Removes the repository and all the documents it contains, if the given user matches the owner of the repository.

Parameters:
name - The name of the repository.
owner - The owner of the repository.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to delete the repository.
FileManException - If an error occurs while deleting the repository.
java.rmi.RemoteException - If a communication error occurs.

commitDocument

long commitDocument(java.lang.String repoName,
                    IUser user,
                    IDocument doc)
                    throws RepositoryNotExistsException,
                           UserAccessException,
                           DocumentNotExistsException,
                           FileManException,
                           java.rmi.RemoteException
Commits an existing document to the repository.

Parameters:
repoName - The name of the repository.
user - The user who wants to commit a document.
doc - The document to commit.
Returns:
The updated version information of the document.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
DocumentNotExistsException - If the document does not exist in the repository (i.e., the document has not been imported, or has already been deleted).
FileManException - If the version number of the document is not correct (for instance, a more recent document version is alreay in the repository).
java.rmi.RemoteException - If a communication error occurs.

importDocument

void importDocument(java.lang.String repoName,
                    IUser user,
                    IDocument doc)
                    throws RepositoryNotExistsException,
                           UserAccessException,
                           DocumentAlreadyExistsException,
                           FileManException,
                           java.rmi.RemoteException
Imports a new document to the repository.

Parameters:
repoName - The name of the repository.
user - The user who wants to import the document.
doc - The document to import.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
DocumentAlreadyExistsException - If the document already exists in the repository.
FileManException - If an error occurs while importing the document.
java.rmi.RemoteException - If a communication error occurs.

removeDocument

void removeDocument(java.lang.String repoName,
                    IUser user,
                    java.lang.String documentName)
                    throws RepositoryNotExistsException,
                           UserAccessException,
                           FileManException,
                           java.rmi.RemoteException
Removes a document from the repository and ALSO deletes it locally.

Parameters:
repoName - The name of repository.
user - The user who want to add the document.
documentName - The name of the document to delete.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
DocumentNotExistsException - If the document does not exist in the repository (i.e., the document has not been imported or has already been deleted)
FileManException - If an error occurs while removing the document.
java.rmi.RemoteException - If a communication error occurs.

updateAllDocuments

IDocument[] updateAllDocuments(java.lang.String repoName,
                               IUser user)
                               throws RepositoryNotExistsException,
                                      UserAccessException,
                                      FileManException,
                                      java.rmi.RemoteException
Updates all documents from the repository.

Parameters:
repoName - The name of the repository.
user - The user who wants to update all documents.
Returns:
The updated documents.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
FileManException - If an error occurs while updating all documents.
java.rmi.RemoteException - If a communication error occurs.

updateDocument

IDocument updateDocument(java.lang.String repoName,
                         IUser user,
                         java.lang.String filename,
                         long version)
                         throws RepositoryNotExistsException,
                                UserAccessException,
                                FileManException,
                                java.rmi.RemoteException
Updates a local document with the most recent (or a specific) version from the repository.

Parameters:
repoName - The name of the repository.
user - The user who wants to update a document.
filename - The name of the document to update.
version - The version of the document to update (-1 means the most recent version).
Returns:
The updated document.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
FileManException - If an error occurs while updating the document.
java.rmi.RemoteException - If a communication error occurs.

checkout

IDocument[] checkout(java.lang.String repoName,
                     IUser user)
                     throws RepositoryNotExistsException,
                            UserAccessException,
                            FileManException,
                            java.rmi.RemoteException
Checks out all documents from the repository.

Parameters:
repoName - The name of the repository to checkout.
user - The user who wants to checkout the repository.
Returns:
The documents to checkout.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
FileManException - If an error occurs while checking out the repository.
java.rmi.RemoteException - If a communication error occurs.

addRepositoryListener

void addRepositoryListener(java.lang.String repoName,
                           IUser user,
                           IRepositoryListener listener)
                           throws RepositoryNotExistsException,
                                  UserAccessException,
                                  FileManException,
                                  java.rmi.RemoteException
Add a repository listener to the repository to get notifications when certain events on the server occur.

Parameters:
repoName - The name of the repository that should be watched.
user - The user who wants to add the repository listener.
listener - The repository listener to add.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
UserAccessException - If the owner is not a valid user, or if the user is not allowed to access the repository.
FileManException - If an error occurs while adding the repository listener.
java.rmi.RemoteException - If a communication error occurs.

removeRespositoryListener

void removeRespositoryListener(java.lang.String repoName,
                               IRepositoryListener listener)
                               throws RepositoryNotExistsException,
                                      FileManException,
                                      java.rmi.RemoteException
Removes a repository listener to stop listening to notifications.

Parameters:
repoName - The name of the repository.
listener - The repository listener to remove.
Throws:
RepositoryNotExistsException - If the given repository does not exist.
FileManException - If an error occurs while removing the repository listener.
java.rmi.RemoteException - If a communication error occurs.