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

All Superinterfaces:
java.io.Serializable

public interface IRepository
extends java.io.Serializable

The IRepository specifies the basic operations of a repository which have to be implemented on the server side.


Method Summary
 void create()
          Creates the repository physically on the disk.
 void createDocument(IDocument doc)
          Creates a new document and add it to the repository.
 void delete(IUser user)
          Deletes the repository physically from the disk by deleting all its content and the repository directory itself.
 IDocument[] getAllDocuments()
          Gets all documents which are in the repository.
 java.lang.String[] getAllowedUsers()
          Gets the users which are allowed to access the repository or null if only the owner is allowed.
 IDocument getDocument(java.lang.String filename, long version)
          Gets one specific document from the repository.
 java.lang.String getName()
          Gets the name of the repository or null if not set.
 IUser getOwner()
          Gets the owner of the repository or null if not set.
 java.lang.String getServerUrl()
          Gets the URL of the DSGFileMan server or null if not set.
 void load()
          Loads the repository from the disk.
 IDocument removeDocument(java.lang.String documentName)
          Removes a document from the repository.
 void setAllowedUsers(java.lang.String[] users)
          Sets the users which are allowed to access the repository.
 void setName(java.lang.String name)
          Sets the name of the repository.
 void setOwner(IUser user)
          Sets the owner of the repository.
 void setServerUrl(java.lang.String url)
          Sets the URL of the DSGFileMan server
 void updateDocument(IDocument doc)
          Updates the given document in the repository.
 

Method Detail

setName

void setName(java.lang.String name)
Sets the name of the repository.

Parameters:
name - The name of the repository.

getName

java.lang.String getName()
Gets the name of the repository or null if not set.

Returns:
The name of the repository.

setServerUrl

void setServerUrl(java.lang.String url)
Sets the URL of the DSGFileMan server

Parameters:
url - The URL of the server

getServerUrl

java.lang.String getServerUrl()
Gets the URL of the DSGFileMan server or null if not set.

Returns:
The URL of the server

setOwner

void setOwner(IUser user)
Sets the owner of the repository.

Parameters:
user - the owner of the repository.

getOwner

IUser getOwner()
Gets the owner of the repository or null if not set.

Returns:
The owner of the repository.

setAllowedUsers

void setAllowedUsers(java.lang.String[] users)
Sets the users which are allowed to access the repository.

Parameters:
users - The users which are allowed to access the repository.

getAllowedUsers

java.lang.String[] getAllowedUsers()
Gets the users which are allowed to access the repository or null if only the owner is allowed.

Returns:
The users which are allowed to access the repository.

create

void create()
            throws java.io.IOException,
                   RepositoryExistsException
Creates the repository physically on the disk.

Throws:
java.io.IOException - If an error occurs while writing repository to disk.
RepositoryExistsException - If the repository already exists.

load

void load()
          throws java.io.IOException,
                 RepositoryNotExistsException
Loads the repository from the disk.

Throws:
java.io.IOException - If an error occurs while deleting the repository physically.
RepositoryNotExistsException - If the repository does not exist.

delete

void delete(IUser user)
            throws java.io.IOException,
                   UserAccessException,
                   RepositoryNotExistsException
Deletes the repository physically from the disk by deleting all its content and the repository directory itself.

Parameters:
user - The user who wants to delete the repository.
Throws:
UserAccessException - If the user is not allowed to delete the repository.
RepositoryNotExistsException - If the repository does not exist.
java.io.IOException - If an error occurs while deleting the repository physically.

createDocument

void createDocument(IDocument doc)
                    throws java.io.IOException,
                           DocumentAlreadyExistsException
Creates a new document and add it to the repository.

Parameters:
doc - The document to create.
Throws:
java.io.IOException - If an error occurs while deleting the repository physically.
DocumentAlreadyExistsException - If the given document already exists in the repository.

getAllDocuments

IDocument[] getAllDocuments()
                            throws java.io.IOException
Gets all documents which are in the repository.

Returns:
All repository documents.
Throws:
java.io.IOException - If an error occurs while accessing the repository.

getDocument

IDocument getDocument(java.lang.String filename,
                      long version)
                      throws java.io.IOException,
                             DocumentNotExistsException
Gets one specific document from the repository.

Parameters:
filename - The name of the document to get from the repository.
version - The version of the document to get from the repository or -1 if the most recent document should be retrieved.
Returns:
The requested document.
Throws:
java.io.IOException - If an error occurs while accessing the repository.
DocumentNotExistsException - If the requested document does not exist in the repository.

updateDocument

void updateDocument(IDocument doc)
                    throws java.io.IOException,
                           FileManException,
                           DocumentNotExistsException
Updates the given document in the repository.

Parameters:
doc - The document to update.
Throws:
java.io.IOException - If an error occurs while accessing the repository.
DocumentNotExistsException - If the given document does not exist in the repository.
FileManException - If the version number of the given document is not correct.

removeDocument

IDocument removeDocument(java.lang.String documentName)
                         throws java.io.IOException,
                                DocumentNotExistsException
Removes a document from the repository.

Parameters:
documentName - The document that should be removed.
Returns:
The removed document.
Throws:
java.io.IOException - If an error occurs while accessing the repository.
DocumentNotExistsException - If the given document does not exist in the repository.