uk.ac.vamsas.test.simpleclient
Class ArchiveClient

java.lang.Object
  extended byuk.ac.vamsas.client.VorbaIdFactory
      extended byuk.ac.vamsas.client.simpleclient.IdFactory
          extended byuk.ac.vamsas.test.simpleclient.ArchiveClient
All Implemented Interfaces:
IVorbaIdFactory
Direct Known Subclasses:
VamsasClient

public class ArchiveClient
extends IdFactory

Author:
jimp test the VamsasFile routines for watching, reading and updating a vamsas document jar file. simple document access base class.

Field Summary
static int WATCH_SLEEP
           
protected  boolean watchForChange
          set this to false if watch loop should end immediately
 
Fields inherited from class uk.ac.vamsas.client.VorbaIdFactory
extanthashv, extantids, newobj
 
Constructor Summary
ArchiveClient(java.lang.String username, java.lang.String organization, java.io.File vsess)
           
ArchiveClient(java.lang.String username, java.lang.String organization, java.lang.String clientName, java.lang.String clientVersion, java.io.File vsess)
           
ArchiveClient(UserHandle user, VamsasFile vsess)
           
 
Method Summary
protected  ClientDoc _getReadonly(VamsasArchiveReader vreader)
           
 boolean doUpdate(ClientDoc cdoc)
          trust client to not do anything stupid to the document roots which will now be written to the archive.
 Vobject getObject(VorbaId id)
           
protected  java.lang.String getProvenanceUser()
          from SimpleClient
 ClientDoc getUpdateable()
           
 ClientDoc getUpdateable(Lock lock)
           
static void main(java.lang.String[] args)
           
static void usage()
           
 void valid()
           
 ClientDoc watch(long time)
          watch the document file for updates.
 
Methods inherited from class uk.ac.vamsas.client.simpleclient.IdFactory
getClientHandle, getDummyFactory, getSessionHandle, getUserHandle, getVobjhashVals, getVorbaIdHash, makeVorbaId, setClient, setSession, setUser
 
Methods inherited from class uk.ac.vamsas.client.VorbaIdFactory
newId, setNewIdHash, updateHashValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

watchForChange

protected boolean watchForChange
set this to false if watch loop should end immediately


WATCH_SLEEP

public static int WATCH_SLEEP
Constructor Detail

ArchiveClient

public ArchiveClient(UserHandle user,
                     VamsasFile vsess)
Parameters:
user -
vsess -

ArchiveClient

public ArchiveClient(java.lang.String username,
                     java.lang.String organization,
                     java.io.File vsess)

ArchiveClient

public ArchiveClient(java.lang.String username,
                     java.lang.String organization,
                     java.lang.String clientName,
                     java.lang.String clientVersion,
                     java.io.File vsess)
Method Detail

valid

public void valid()

watch

public ClientDoc watch(long time)
watch the document file for updates.

Parameters:
time - - length of time to watch for.
Returns:
read only IO interface for session document.

_getReadonly

protected ClientDoc _getReadonly(VamsasArchiveReader vreader)
                          throws java.io.IOException,
                                 org.exolab.castor.xml.ValidationException,
                                 org.exolab.castor.xml.MarshalException
Throws:
java.io.IOException
org.exolab.castor.xml.ValidationException
org.exolab.castor.xml.MarshalException

getProvenanceUser

protected java.lang.String getProvenanceUser()
from SimpleClient

Returns:
user field for a provenance entry

getUpdateable

public ClientDoc getUpdateable()

getUpdateable

public ClientDoc getUpdateable(Lock lock)

doUpdate

public boolean doUpdate(ClientDoc cdoc)
trust client to not do anything stupid to the document roots which will now be written to the archive.

Parameters:
cdoc -
Returns:
true if write was a success.

usage

public static void usage()

main

public static void main(java.lang.String[] args)

getObject

public Vobject getObject(VorbaId id)