com.optrak.tools.repository.server
Class RemoteRepository

java.lang.Object
  extended by com.optrak.tools.repository.server.RemoteRepository
All Implemented Interfaces:
Repository, java.rmi.Remote

public class RemoteRepository
extends java.lang.Object
implements Repository


Field Summary
 
Fields inherited from interface com.optrak.tools.repository.Repository
NAME_BASE_VERSION, NAME_UNCHANGED, NAME_VERSIONED, PACK_200, PACK_GZ, SIGN_JARS, VERSION_AS_GIVEN
 
Constructor Summary
RemoteRepository(LocalRepository local)
           
 
Method Summary
 NewEntry addEntry(UserIdentity id, ResourceEntry entry)
          Offer new resource with default options.
 NewEntry addEntry(UserIdentity id, ResourceEntry entry, int options)
          Offer a new resource to the repository.
 void flush()
          Ensure repository changes are flushed to disk.
 java.lang.String getDigestAlgorithm()
          get Digest algorithm used for all resources.
 ResourceEntry[] getEntries(java.lang.String path)
          Enumerate entries with specified path.
 ResourceEntry getEntry(Digest digest)
          Find entry with specified digest.
 ResourceEntry getEntry(java.lang.String path, Digest digest)
          Lookup entry with specified path and digest
 java.net.URI getURI()
          Location of the repository
 java.lang.String[] listChildren(java.lang.String path)
          List child directories.
 java.lang.String[] listNames(java.lang.String path)
          List names of entries.
 UserIdentity newIdentity(java.lang.String user, java.lang.String machine)
          create an identity object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteRepository

public RemoteRepository(LocalRepository local)
Method Detail

newIdentity

public UserIdentity newIdentity(java.lang.String user,
                                java.lang.String machine)
                         throws java.rmi.RemoteException
Description copied from interface: Repository
create an identity object. The returned object is supplied when submitting new resources. The name and machine are then recorded in the version.xml file, and also added to jar file manifests. In future the returned identity may require authentication before it can be used to submit resources.

Specified by:
newIdentity in interface Repository
Parameters:
user - name of the user
machine - name of the machine
Returns:
identity token
Throws:
java.rmi.RemoteException

getURI

public java.net.URI getURI()
                    throws java.rmi.RemoteException
Description copied from interface: Repository
Location of the repository

Specified by:
getURI in interface Repository
Returns:
URI for retrieving entries in the repository.
Throws:
java.rmi.RemoteException

getDigestAlgorithm

public java.lang.String getDigestAlgorithm()
                                    throws java.rmi.RemoteException
Description copied from interface: Repository
get Digest algorithm used for all resources. Usually SHA-256.

Specified by:
getDigestAlgorithm in interface Repository
Returns:
algorithm name
Throws:
java.rmi.RemoteException

getEntries

public ResourceEntry[] getEntries(java.lang.String path)
                           throws java.io.IOException
Description copied from interface: Repository
Enumerate entries with specified path.

Specified by:
getEntries in interface Repository
Parameters:
path - path of entries
Returns:
an array of all the versions of this resource
Throws:
java.io.IOException

getEntry

public ResourceEntry getEntry(Digest digest)
                       throws java.io.IOException
Description copied from interface: Repository
Find entry with specified digest. There can only be one entry in the repository with a given digest.

Specified by:
getEntry in interface Repository
Parameters:
digest - Digest of required entry.
Returns:
entry requested or null if not present
Throws:
java.io.IOException

getEntry

public ResourceEntry getEntry(java.lang.String path,
                              Digest digest)
                       throws java.io.IOException
Description copied from interface: Repository
Lookup entry with specified path and digest

Specified by:
getEntry in interface Repository
Parameters:
path - entry must match this path
digest - entry must have this digest
Returns:
matching entry if one exists, otherwise null
Throws:
java.io.IOException

addEntry

public NewEntry addEntry(UserIdentity id,
                         ResourceEntry entry,
                         int options)
                  throws java.io.IOException
Description copied from interface: Repository
Offer a new resource to the repository. If the resource already exists anywhere in the repository, then the entry for that resource can be obtained from the result. If the resource does not yet exist, then the resource can be submitted via the methods on NewEntry. The options parameter should probably be replaced by two parameters; an enum for the name handling choice, and an EnumSet for the other options.

Specified by:
addEntry in interface Repository
Parameters:
id - identity of user submitting resource
entry - Details of the resource to be submitted. The path, version and digest attributes must be set.
options - At most one of NAME_*, plus any combination of the other options.
Returns:
The returned NewEntry object will indicate if the resource is already present, and if not provide the mechanism to complete the submission.
Throws:
java.io.IOException

addEntry

public NewEntry addEntry(UserIdentity id,
                         ResourceEntry entry)
                  throws java.io.IOException
Description copied from interface: Repository
Offer new resource with default options.

Specified by:
addEntry in interface Repository
Parameters:
id - identity of user submitting resource
entry - Details of the resource to be submitted. The path, version and digest attributes must be set.
Returns:
The returned NewEntry object will indicate if the resource is already present, and if not provide the mechanism to complete the submission.
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Description copied from interface: Repository
Ensure repository changes are flushed to disk.

Specified by:
flush in interface Repository
Throws:
java.io.IOException - if there are errors writing to disk

listChildren

public java.lang.String[] listChildren(java.lang.String path)
                                throws java.io.IOException
Description copied from interface: Repository
List child directories.

Specified by:
listChildren in interface Repository
Parameters:
path - directory for which to list subdirectories, null or "" to list the root of the repository
Returns:
array of subdirectory names.
Throws:
java.io.IOException - if the path does not exist

listNames

public java.lang.String[] listNames(java.lang.String path)
                             throws java.io.IOException
Description copied from interface: Repository
List names of entries.

Specified by:
listNames in interface Repository
Parameters:
path - directory to list, null or "" to list the root of the repository
Returns:
array of entry names
Throws:
java.io.IOException - if the path does not exist