com.sas.drugdev.remote.repository
Interface RepositoryService


public interface RepositoryService

The RepositoryService is the entry point to the content of SDD. It mostly deals with Node objects. These can be one of two types: RemoteNode and NodeBean. A RemoteNode is constructed by the service when information about a Node is retrieved from the server. This type of Node is immutable. A NodeBean is constructed on the client by the consumer of the API. It is used to describe a server-side Node that you would like to update or create. One common practice is to construct the NodeBean using a RemoteNode using FileBean.FileBean(RemoteFile) or ContainerBean.ContainerBean(RemoteContainer). This is useful, for instance, when you have gotten a List of RemoteNode objects using getChildren(Container) and would like to update the properties on one of the children.

When a NodeBean is passed into a method, the Node is looked up by the path if the path is defined in the NodeBean, then by the id if the path isn't specified in the bean.


Method Summary
 RemoteFile checkinFile(File file)
          Check in the file described by the given File.
 RemoteFile checkinFile(File file, java.lang.String comment)
          Check in the file described by the given File.
 RemoteFile checkoutFile(File file)
          Checkout the file described by the given File.
 RemoteNode copyNode(Node srcNode, Node destNode)
          Copy the node described by srcNode to destNode.
 RemoteContainer createContainer(ContainerBean containerBean)
          Create the container described by the given ContainerBean.
 RemoteFile createFile(FileBean fileBean)
          Create the file described by the given FileBean.
 void deleteNode(Node node)
          Delete the node described by the given Node.
 RemoteFile enableVersioning(File file)
          Enable versioning on the file described by the given File.
 AccessControlList getAccessControlList(Node node)
          Get the AccessControlList of the given node
 java.util.List getChildren(Container container)
          Get the children of the container described by the given Container.
 RemoteContainer getContainer(ContainerBean container)
          Get the Container described by the given ContainerBean.
 void getContents(File file, java.io.OutputStream stream)
          Get the contents of the file described by the given file, including the version specified in file.
 RemoteFile getFile(FileBean file)
          Get the File described by the given FileBean.
 RemoteNode getNode(NodeBean node)
          Get the RemoteNode specified by the given NodeBean.
 RemoteNode moveNode(Node srcNode, Node destNode)
          Move the node described by srcNode to destNode.
 boolean nodeExists(NodeBean node)
          Test whether the node described by the given NodeBean exists.
 RemoteNode renameNode(Node srcNode, java.lang.String newName)
          Rename the node desribed by srcNode to the newName.
 RemoteContainer setDefaultContainerVersioning(Container container, ContainerDepth depth, boolean onOff)
          Turn on default versioning for the specified container, to the given depth.
 RemoteContainer setOwnerOnContainer(Container container, ContainerDepth depth, java.lang.String userid)
          Set the owner of the given container to the given userid.
 RemoteFile setOwnerOnFile(File file, java.lang.String userid)
          Set the owner of the given file to the given userid.
 RemoteFile undoCheckout(File file)
          Undo the check out of the file described by the given File.
 void updateContainerAccessControlList(AccessControlList acl, AclRecurseBehavior recurseBehavior)
          Apply the changes that have been made on the given AccessControlList on the server side.
 void updateFileAccessControlList(AccessControlList acl)
          Apply the changes that have been made on the given AccessControlList on the server side.
 RemoteNode updateNode(NodeBean nodeBean)
          Apply the changes that have been made on the given Node on the server side.
 

Method Detail

getNode

RemoteNode getNode(NodeBean node)
                   throws RemoteException,
                          InvalidSessionException
Get the RemoteNode specified by the given NodeBean. The Node is looked up by the id if the id is defined in the NodeBean, then by the path if the id isn't specified in the bean.

Returns null if the Node doesn't exist or if the user doesn't have read permissions on the Node.

Parameters:
node -
Returns:
The RemoteNode described by the NodeBean, null if the RemoteNode doesn't exist.
Throws:
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

nodeExists

boolean nodeExists(NodeBean node)
                   throws RemoteException,
                          InvalidSessionException
Test whether the node described by the given NodeBean exists. The node is looked up by the id if the id is defined in the NodeBean, then by the path if the id isn't specified in the bean.

Parameters:
node -
Returns:
true the node exists, false otherwise or if the user doesn't have permission to read the node
Throws:
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

getFile

RemoteFile getFile(FileBean file)
                   throws InvalidVersionException,
                          InvalidTypeException,
                          RemoteException,
                          InvalidSessionException
Get the File described by the given FileBean. The file is looked up by the id if the id is defined in the FileBean, then by the path if the id isn't specified in the bean.

If a version is specified in the FileBean, then that is the version that is returned in the RemoteFile. If a version isn't specified, then the latest version is returned.

Returns null if the file doesn't exist or if the user doesn't have read permissions on the file. Note that this call doesn't fetch the contents of the file, only its metadata. In order to get the contents of a file, use getContents(File, OutputStream).

Parameters:
file -
Returns:
The RemoteFile described by the FileBean, null if the RemoteFile doesn't exist.
Throws:
InvalidVersionException - if the file exists, but the version doesn't
InvalidTypeException - if the path is a container
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

getContainer

RemoteContainer getContainer(ContainerBean container)
                             throws InvalidTypeException,
                                    RemoteException,
                                    InvalidSessionException
Get the Container described by the given ContainerBean. The container is looked up by the id if the id is defined in the ContainerBean, then by the path if the id isn't specified in the bean.

Parameters:
container -
Returns:
The RemoteContainer described by the ContainerBean, null if the RemoteContainer doesn't exist.
Throws:
InvalidTypeException - if the node pointed to by the container bean is a file
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

getChildren

java.util.List getChildren(Container container)
                           throws InvalidTypeException,
                                  InvalidNodeException,
                                  RemoteException,
                                  InvalidSessionException
Get the children of the container described by the given Container. This method will never return null. If the container at the given path doesn't have any children, an empty list will be returned.

Parameters:
container - this can be either a ContainerBean or a RemoteContainer
Returns:
Unmodifiable list of RemoteNode objects
Throws:
InvalidTypeException - if the node at described by the container is a file
InvalidNodeException - if container doesn't exist
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

moveNode

RemoteNode moveNode(Node srcNode,
                    Node destNode)
                    throws InvalidNodeException,
                           PermissionException,
                           ContainmentException,
                           NodeModifiedException,
                           ValidationException,
                           RemoteException,
                           InvalidSessionException
Move the node described by srcNode to destNode. If the destination node is a container that exists, the srcNode will be moved into that container, keeping its original name. If the destNode doesn't exist, but the parent node of that node does, the node is assumed to decribe a full path including the name. Therefore, the node will be moved and its name changed to what is in the destNode.

Parameters:
srcNode - Node describing the source
destNode - Node describing the destination
Returns:
the resulting RemoteNode after the move
Throws:
InvalidNodeException - srcNode doesn't exist, parent path at destination doesn't exist, destination node already exists and is a file
PermissionException - if the user doesn't have necessary permissions
ContainmentException - if destination can't contain the type of the source
NodeModifiedException - if either src or dest are RemoteNode objects and have been modified since they have been retrieved
ValidationException - if name of destination doesn't validate
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

renameNode

RemoteNode renameNode(Node srcNode,
                      java.lang.String newName)
                      throws InvalidNodeException,
                             PermissionException,
                             NodeModifiedException,
                             ValidationException,
                             RemoteException,
                             InvalidSessionException
Rename the node desribed by srcNode to the newName.

Parameters:
srcNode -
newName - new name of the source node, this doesn't include a path.
Returns:
the resulting RemoteNode after the rename
Throws:
InvalidNodeException - if node already exists with the new name or srcNode doesn't exist
PermissionException - if the user doesn't have necessary permissions
NodeModifiedException - if src is a RemoteNode and has been modified since they have been retrieved
ValidationException - if name of destination doesn't validate
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

copyNode

RemoteNode copyNode(Node srcNode,
                    Node destNode)
                    throws InvalidNodeException,
                           PermissionException,
                           ContainmentException,
                           NodeModifiedException,
                           ValidationException,
                           RemoteException,
                           InvalidSessionException
Copy the node described by srcNode to destNode. If the destination node is a container that exists, the src node will be copied into that container, keeping its original name. If the destNode doesn't exist, but the parent node of that node does, the node is assumed to decribe a full path including the name. Therefore, the node will be copied and its name changed to what is in the destNode.

Parameters:
srcNode - Node describing the source
destNode - Node describing the destination
Returns:
the resulting RemoteNode after the copy
Throws:
InvalidNodeException - srcNode doesn't exist, parent path at destination doesn't exist, destination node already exists and is a file
PermissionException - if the user doesn't have necessary permissions
ContainmentException - if destination can't contain the type of the source
NodeModifiedException - if either src or dest are RemoteNode objects and have been modified since they have been retrieved
ValidationException - if name of destination doesn't validate
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

checkoutFile

RemoteFile checkoutFile(File file)
                        throws InvalidNodeException,
                               PermissionException,
                               java.lang.IllegalStateException,
                               InvalidTypeException,
                               RemoteException,
                               InvalidSessionException
Checkout the file described by the given File. This method ignores the version specified in the file, since it isn't possible to check out older versions of files.

Parameters:
file -
Returns:
the resulting RemoteFile object after the checkout
Throws:
InvalidNodeException - if file at specified path doesn't exist
PermissionException - if user doesn't have permissions
java.lang.IllegalStateException - file is already checked out by another user or file isn't versioned
InvalidTypeException - if file is a container
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

checkinFile

RemoteFile checkinFile(File file)
                       throws InvalidNodeException,
                              InvalidTypeException,
                              java.lang.IllegalStateException,
                              RemoteException,
                              InvalidSessionException
Check in the file described by the given File. This method ignores the version specified in the file, since it isn't possible to check in older versions of files.

Parameters:
file -
Returns:
the resulting RemoteFile object after the checkin
Throws:
InvalidNodeException - if file doesn't exist
InvalidTypeException - if file is a container
java.lang.IllegalStateException - if isn't checked out or is checked out by another user
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

checkinFile

RemoteFile checkinFile(File file,
                       java.lang.String comment)
                       throws InvalidNodeException,
                              InvalidTypeException,
                              java.lang.IllegalStateException,
                              RemoteException,
                              InvalidSessionException
Check in the file described by the given File. This method ignores the version specified in the file, since it isn't possible to check in older versions of files.

Parameters:
file -
comment - comment to be associated with the new version of this file
Returns:
the resulting RemoteFile object after the checkin
Throws:
InvalidNodeException - if file doesn't exist
InvalidTypeException - if file is a container
java.lang.IllegalStateException - if isn't checked out or is checked out by another user
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

undoCheckout

RemoteFile undoCheckout(File file)
                        throws InvalidNodeException,
                               InvalidTypeException,
                               java.lang.IllegalStateException,
                               RemoteException,
                               InvalidSessionException
Undo the check out of the file described by the given File. This method ignores the version specified in the file, since it isn't possible to undo check out of older versions of files.

Parameters:
file -
Returns:
the resulting RemoteFile object after the undoCheckout
Throws:
InvalidNodeException - if file doesn't exist
InvalidTypeException - if file is a container
java.lang.IllegalStateException - if file isn't checked out
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

enableVersioning

RemoteFile enableVersioning(File file)
                            throws InvalidTypeException,
                                   PermissionException,
                                   InvalidNodeException,
                                   RemoteException,
                                   InvalidSessionException
Enable versioning on the file described by the given File. When versioning is enabled on a file, delete permissions are removed for that file. If versioning is already enabled on the file, this method doesn't do anything.

Parameters:
file -
Returns:
the resulting RemoteFile object after versioning was enabled
Throws:
InvalidTypeException - if the file is a container
PermissionException - if user doesn't have permissions
InvalidNodeException - if file doesn't exist
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

updateNode

RemoteNode updateNode(NodeBean nodeBean)
                      throws InvalidNodeException,
                             InvalidNodeBeanException,
                             InvalidTypeException,
                             NodeModifiedException,
                             ValidationException,
                             PermissionException,
                             RemoteException,
                             InvalidSessionException
Apply the changes that have been made on the given Node on the server side.

Parameters:
nodeBean -
Returns:
the updated RemoteNode
Throws:
InvalidNodeException - node doesn't exist
InvalidNodeBeanException - NodeBean is a FileBean whose contents have been set to a local file that doesn't exist
InvalidTypeException - if NodeBean is a ContainerBean and points to a file or vice versa
NodeModifiedException - if the NodeBean was constructed with a RemoteNode and the node has been modified since it was retrieved
ValidationException - if any properties set on the node fail validation
PermissionException - if user doesn't have required permissions
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

getContents

void getContents(File file,
                 java.io.OutputStream stream)
                 throws InvalidNodeException,
                        InvalidTypeException,
                        java.io.IOException,
                        RemoteException,
                        InvalidSessionException
Get the contents of the file described by the given file, including the version specified in file.

Parameters:
file -
stream - stream to write the contents to
Throws:
InvalidNodeException - if file doesn't exist
InvalidTypeException - if node is a container
java.io.IOException - if an error occurs writing to the OutputStream
RemoteException - if an error occurs in the transport
InvalidSessionException - if the current session is expired or has been invalidated

deleteNode

void deleteNode(Node node)
                throws InvalidNodeException,
                       PermissionException,
                       RemoteException,
                       InvalidSessionException
Delete the node described by the given Node. If it is a container, all children will be deleted as well. If the user doesn't have permissions to delete node below this container, nothing will be deleted and an exception will be thrown.

Parameters:
node -
Throws:
InvalidNodeException - node doesn't exist
PermissionException - user doesn't have permission to delete
InvalidSessionException - if the current session is expired or has been invalidated
RemoteException - if a server or transport error occurs

createContainer

RemoteContainer createContainer(ContainerBean containerBean)
                                throws PermissionException,
                                       InvalidNodeException,
                                       InvalidNodeBeanException,
                                       InvalidTypeException,
                                       ValidationException,
                                       ContainmentException,
                                       RemoteException,
                                       InvalidSessionException
Create the container described by the given ContainerBean. The id cannot be specified in the containerBean. Ids are assigned on the server.

Parameters:
containerBean -
Returns:
RemoteContainer that was created
Throws:
PermissionException - user doesn't have permission
InvalidNodeException - parent path doesn't exist, object already exists at the given path, or parent path is a file
InvalidNodeBeanException - ContainerBean doesn't have enough information to create the Container or a NodeId is specified in the ContainerBean
InvalidTypeException - if the type passed in doesn't exist or is a file type
ValidationException - if the properties specified don't validate
ContainmentException - if the type can't live here
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

createFile

RemoteFile createFile(FileBean fileBean)
                      throws PermissionException,
                             InvalidNodeException,
                             InvalidNodeBeanException,
                             InvalidTypeException,
                             ValidationException,
                             ContainmentException,
                             RemoteException,
                             InvalidSessionException
Create the file described by the given FileBean. The id and version cannot be specified in the fileBean. Ids and versions are assigned by the server. A path, a type, and contents must be specified in the fileBean.

Parameters:
fileBean -
Returns:
RemoteFile that was created
Throws:
PermissionException - user doesn't have permission
InvalidNodeException - parent path doesn't exist, object already exists at the given path, or parent path is a file
InvalidNodeBeanException - FileBean doesn't have enough information to create the File or an NodeId or version is specified in the FileBean, or if java.io.File set as the contents doesn't exist
InvalidTypeException - if the type passed in doesn't exist or is a container type
ValidationException - if the properties specified don't validate
ContainmentException - if the type can't live here
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

getAccessControlList

AccessControlList getAccessControlList(Node node)
                                       throws InvalidNodeException,
                                              PermissionException,
                                              RemoteException,
                                              InvalidSessionException
Get the AccessControlList of the given node

Parameters:
node -
Returns:
the AccessControlList of the given node
Throws:
InvalidNodeException - node doesn't exist
PermissionException - user doesn't have permissions
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

updateFileAccessControlList

void updateFileAccessControlList(AccessControlList acl)
                                 throws InvalidNodeException,
                                        InvalidTypeException,
                                        java.lang.IllegalArgumentException,
                                        NodeModifiedException,
                                        PermissionException,
                                        RemoteException,
                                        InvalidSessionException
Apply the changes that have been made on the given AccessControlList on the server side. The AccessControlList that is passed in must point to a File.

Parameters:
acl -
Throws:
InvalidNodeException - path doesn't exist or node has been deleted
InvalidTypeException - if the AccessControlEntry passes in points to a Container
java.lang.IllegalArgumentException - if recurse isn't valid or a userid or groupname specified in a new AccessControlEntry doesn't exist
NodeModifiedException - object associated with this acl has been modified since the ACL was retrieved
PermissionException - user doesn't have permission
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

updateContainerAccessControlList

void updateContainerAccessControlList(AccessControlList acl,
                                      AclRecurseBehavior recurseBehavior)
                                      throws InvalidNodeException,
                                             InvalidTypeException,
                                             java.lang.IllegalArgumentException,
                                             NodeModifiedException,
                                             PermissionException,
                                             RemoteException,
                                             InvalidSessionException
Apply the changes that have been made on the given AccessControlList on the server side. The AccessControlList that is passed in must point to a Container.

Parameters:
acl -
recurseBehavior -
Throws:
InvalidNodeException - path doesn't exist or node has been deleted
InvalidTypeException - if the AccessControlEntry passes in points to a Container
java.lang.IllegalArgumentException - if a userid or groupname specified in a new AccessControlEntry doesn't exist
NodeModifiedException - object associated with this acl has been modified since the ACL was retrieved
PermissionException - user doesn't have permission
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

setOwnerOnFile

RemoteFile setOwnerOnFile(File file,
                          java.lang.String userid)
                          throws InvalidNodeException,
                                 InvalidTypeException,
                                 java.lang.IllegalArgumentException,
                                 PermissionException,
                                 RemoteException,
                                 InvalidSessionException
Set the owner of the given file to the given userid.

Parameters:
file -
userid -
Throws:
InvalidNodeException - file doesn't exist
InvalidTypeException - path is a container
java.lang.IllegalArgumentException - userid doesn't exist
PermissionException - current user doesn't have required privileges
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

setOwnerOnContainer

RemoteContainer setOwnerOnContainer(Container container,
                                    ContainerDepth depth,
                                    java.lang.String userid)
                                    throws InvalidNodeException,
                                           InvalidTypeException,
                                           java.lang.IllegalArgumentException,
                                           PermissionException,
                                           RemoteException,
                                           InvalidSessionException
Set the owner of the given container to the given userid. Cascades to the depth specified.

Parameters:
container -
depth - ContainerDepth.DEPTH_ZERO, ContainerDepth.DEPTH_ONE, ContainerDepth.DEPTH_INFINITE
userid -
Returns:
The resulting RemoteContainer after the owner is set on it
Throws:
InvalidNodeException - container doesn't exist
InvalidTypeException - path is a file
java.lang.IllegalArgumentException - userid doesn't exist
PermissionException - current user doesn't have required permissions
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated

setDefaultContainerVersioning

RemoteContainer setDefaultContainerVersioning(Container container,
                                              ContainerDepth depth,
                                              boolean onOff)
                                              throws InvalidNodeException,
                                                     InvalidTypeException,
                                                     java.lang.IllegalArgumentException,
                                                     PermissionException,
                                                     RemoteException,
                                                     InvalidSessionException
Turn on default versioning for the specified container, to the given depth.

Parameters:
container -
depth - ContainerDepth.DEPTH_ZERO or ContainerDepth.DEPTH_INFINITE, ContainerDepth.DEPTH_ONE is not supported. Versioning on a container can only be set for the folder (DEPTH_ZERO) or all subfolders (DEPTH_INFINITE)
onOff -
Returns:
the resulting RemoteContainer after the default versioning is set on it
Throws:
InvalidNodeException - container doesn't exist
InvalidTypeException - path is a file
java.lang.IllegalArgumentException - userid doesn't exist or the depth isn't valid
PermissionException - current user doesn't have required permissions
RemoteException - if a server or transport error occurs
InvalidSessionException - if the current session is expired or has been invalidated