com.optrak.tools.repository.client
Class RepositoryUpdater

java.lang.Object
  extended by com.optrak.tools.repository.client.RepositoryUpdater

public class RepositoryUpdater
extends java.lang.Object

Update a JNLP repository. Submits all resources referenced (recursively) by a JNLP file to the repository. References in JNLP files are updated with the version and size. References to icons also get the height, width and depth attributes set.

Deployment Properties

The action taken for each type of file can be configured. The standard behaviour is as follows:

TypeActions
jnlp/applicationNAME_BASE_VERSION
jnlp/appletNAME_BASE_VERSION
jnlp/componentNAME_VERSIONED
jnlp/installerNAME_VERSIONED
jarNAME_VERSIONED PACK_200 PACK_GZ
htmlNAME_UNCHANGED
defaultNAME_VERSIONED
Note that the various types of JNLP files are distinguished. The html action also applies to .htm files.

This behaviour can be modified by deploy.properties files in the source directories. The properties inherit the properties of containing directories and the default properties.


Constructor Summary
RepositoryUpdater(Repository repository)
           
 
Method Summary
 void clearResourceCache()
          Clear cached data.
 java.io.File findLocalResource(java.lang.String path)
           
 java.lang.String getDefaultVersion()
          Base version for submitted resources.
 UserIdentity getIdentity()
           
 Repository getRepository()
           
 java.util.List<java.io.File> getResourceSearchPath()
           
 void setDefaultVersion(java.lang.String ver)
           
 void setIdentity(UserIdentity id)
           
 void setResourceSearchPath(java.util.List<java.io.File> path)
          List of places to search for resources.
 ResourceEntry submit(java.io.File source, java.lang.String path)
          Submit a resource from a specified file.
 ResourceEntry submit(java.lang.String path)
          Submit a resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryUpdater

public RepositoryUpdater(Repository repository)
                  throws java.security.NoSuchAlgorithmException,
                         java.rmi.RemoteException
Throws:
java.security.NoSuchAlgorithmException
java.rmi.RemoteException
Method Detail

getRepository

public Repository getRepository()

setIdentity

public void setIdentity(UserIdentity id)

getIdentity

public UserIdentity getIdentity()

clearResourceCache

public void clearResourceCache()
Clear cached data. ResourceEntry's are cached.


getDefaultVersion

public java.lang.String getDefaultVersion()
Base version for submitted resources. If this is "1", then a submitted resource will end up with a version like "1.1", "1.2" etc. If a JNLP file specifies a version, that will be use instead.

Returns:
version

setDefaultVersion

public void setDefaultVersion(java.lang.String ver)

setResourceSearchPath

public void setResourceSearchPath(java.util.List<java.io.File> path)
List of places to search for resources. This specifies where to find the local copy of resources to be submitted.

Parameters:
path -

getResourceSearchPath

public java.util.List<java.io.File> getResourceSearchPath()

findLocalResource

public java.io.File findLocalResource(java.lang.String path)
                               throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

submit

public ResourceEntry submit(java.lang.String path)
                     throws java.io.IOException
Submit a resource. Searches for the resource using the resource search path. JNLP and HTML files are processed to submit any resources they reference (recursively) and replaces references with the actual reference and version relative to the repository. For JNLP files resource attributes (size, height, width, depth) are also added. After processing, a digest is computed and if not already present in the repository, the resource is added to it.

Parameters:
path -
Returns:
entry representing this resource. Note the path may not match the path supplied to this method if the resource was already present in the repository at a different location.
Throws:
java.io.IOException

submit

public ResourceEntry submit(java.io.File source,
                            java.lang.String path)
                     throws java.io.IOException
Submit a resource from a specified file.

Parameters:
source - file containing the resource
path - Intended path in the repository.
Returns:
resource entry matching submitted file. This may not have the same path as that submitted (if the resource already existed)
Throws:
java.io.IOException