com.optrak.tools.repository
Interface Repository

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
LocalRepository, RemoteRepository

public interface Repository
extends java.rmi.Remote

Store unique resources for WebStart. Manage the versioning of WebStart resources.


Field Summary
static int NAME_BASE_VERSION
          File name in the repository includes the base version, but not the extra bit added by the repository.
static int NAME_UNCHANGED
          File name in the repository is as submitted.
static int NAME_VERSIONED
          File name in the repository includes the full version.
static int PACK_200
          Try PACK-200 compression.
static int PACK_GZ
          Try GZIP compression of jar files
static int SIGN_JARS
          Sign any jar file submitted with the repository signature.
static int VERSION_AS_GIVEN
          Override automatic version assignment.
 
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.
 

Field Detail

NAME_VERSIONED

static final int NAME_VERSIONED
File name in the repository includes the full version.

See Also:
Constant Field Values

NAME_UNCHANGED

static final int NAME_UNCHANGED
File name in the repository is as submitted.

See Also:
Constant Field Values

NAME_BASE_VERSION

static final int NAME_BASE_VERSION
File name in the repository includes the base version, but not the extra bit added by the repository.

See Also:
Constant Field Values

VERSION_AS_GIVEN

static final int VERSION_AS_GIVEN
Override automatic version assignment. This is usually used for third party items with well defined versions.

See Also:
Constant Field Values

SIGN_JARS

static final int SIGN_JARS
Sign any jar file submitted with the repository signature.

See Also:
Constant Field Values

PACK_200

static final int PACK_200
Try PACK-200 compression. If both pack200 and gzip compression are selected, only the smaller of the two will be retained.

See Also:
Constant Field Values

PACK_GZ

static final int PACK_GZ
Try GZIP compression of jar files

See Also:
Constant Field Values
Method Detail

newIdentity

UserIdentity newIdentity(java.lang.String user,
                         java.lang.String machine)
                         throws java.rmi.RemoteException
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.

Parameters:
user - name of the user
machine - name of the machine
Returns:
identity token
Throws:
java.rmi.RemoteException

getURI

java.net.URI getURI()
                    throws java.rmi.RemoteException
Location of the repository

Returns:
URI for retrieving entries in the repository.
Throws:
java.rmi.RemoteException

getDigestAlgorithm

java.lang.String getDigestAlgorithm()
                                    throws java.rmi.RemoteException
get Digest algorithm used for all resources. Usually SHA-256.

Returns:
algorithm name
Throws:
java.rmi.RemoteException

getEntry

ResourceEntry getEntry(Digest digest)
                       throws java.io.IOException
Find entry with specified digest. There can only be one entry in the repository with a given digest.

Parameters:
digest - Digest of required entry.
Returns:
entry requested or null if not present
Throws:
java.io.IOException

getEntry

ResourceEntry getEntry(java.lang.String path,
                       Digest digest)
                       throws java.io.IOException
Lookup entry with specified path and digest

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

getEntries

ResourceEntry[] getEntries(java.lang.String path)
                           throws java.io.IOException
Enumerate entries with specified path.

Parameters:
path - path of entries
Returns:
an array of all the versions of this resource
Throws:
java.io.IOException

addEntry

NewEntry addEntry(UserIdentity id,
                  ResourceEntry entry)
                  throws java.io.IOException
Offer new resource with default options.

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

addEntry

NewEntry addEntry(UserIdentity id,
                  ResourceEntry entry,
                  int options)
                  throws java.io.IOException
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.

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

flush

void flush()
           throws java.io.IOException
Ensure repository changes are flushed to disk.

Throws:
java.io.IOException - if there are errors writing to disk

listNames

java.lang.String[] listNames(java.lang.String path)
                             throws java.io.IOException
List names of entries.

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

listChildren

java.lang.String[] listChildren(java.lang.String path)
                                throws java.io.IOException
List child directories.

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