From ea8b10ee787a2b1e2b35f2acb4dccaf12fd2a6fd Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 14 Dec 2006 17:54:15 +0000 Subject: [PATCH] refactored org to uk git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@271 be28352e-c001-0410-b1a7-c7978e42abec --- src/uk/ac/vamsas/client/ClientDocument.java | 52 +++ src/uk/ac/vamsas/client/ClientHandle.java | 97 ++++ src/uk/ac/vamsas/client/Events.java | 92 ++++ src/uk/ac/vamsas/client/IClient.java | 142 ++++++ src/uk/ac/vamsas/client/IClientAppdata.java | 61 +++ src/uk/ac/vamsas/client/IClientDocument.java | 99 +++++ src/uk/ac/vamsas/client/IClientFactory.java | 56 +++ src/uk/ac/vamsas/client/IObjectUpdate.java | 26 ++ src/uk/ac/vamsas/client/IVorbaIdFactory.java | 37 ++ src/uk/ac/vamsas/client/Iapp.java | 12 + .../vamsas/client/InvalidSessionUrnException.java | 38 ++ .../vamsas/client/NoDefaultSessionException.java | 46 ++ src/uk/ac/vamsas/client/SessionHandle.java | 38 ++ src/uk/ac/vamsas/client/SessionUrn.java | 40 ++ src/uk/ac/vamsas/client/UserHandle.java | 50 +++ src/uk/ac/vamsas/client/Vobject.java | 464 ++++++++++++++++++++ src/uk/ac/vamsas/client/Vobjhash.java | 25 ++ src/uk/ac/vamsas/client/VorbaId.java | 73 +++ src/uk/ac/vamsas/client/VorbaIdFactory.java | 84 ++++ src/uk/ac/vamsas/client/VorbaXmlBinder.java | 241 ++++++++++ .../ac/vamsas/client/simpleclient/ArchiveUrn.java | 2 +- .../vamsas/client/simpleclient/ClientDocument.java | 29 +- .../ac/vamsas/client/simpleclient/ClientsFile.java | 2 +- .../client/simpleclient/EventGeneratorThread.java | 19 +- .../ac/vamsas/client/simpleclient/IdFactory.java | 29 +- .../ac/vamsas/client/simpleclient/SessionUrn.java | 2 +- .../vamsas/client/simpleclient/SessionsFile.java | 3 +- .../vamsas/client/simpleclient/SimpleClient.java | 47 +- .../client/simpleclient/SimpleClientAppdata.java | 23 +- .../client/simpleclient/SimpleClientFactory.java | 25 +- .../client/simpleclient/SimpleDocBinding.java | 7 +- .../vamsas/client/simpleclient/SimpleDocument.java | 3 +- .../vamsas/client/simpleclient/VamsasArchive.java | 15 +- .../vamsas/client/simpleclient/VamsasSession.java | 7 +- 34 files changed, 1885 insertions(+), 101 deletions(-) create mode 100644 src/uk/ac/vamsas/client/ClientDocument.java create mode 100644 src/uk/ac/vamsas/client/ClientHandle.java create mode 100644 src/uk/ac/vamsas/client/Events.java create mode 100644 src/uk/ac/vamsas/client/IClient.java create mode 100644 src/uk/ac/vamsas/client/IClientAppdata.java create mode 100644 src/uk/ac/vamsas/client/IClientDocument.java create mode 100644 src/uk/ac/vamsas/client/IClientFactory.java create mode 100644 src/uk/ac/vamsas/client/IObjectUpdate.java create mode 100644 src/uk/ac/vamsas/client/IVorbaIdFactory.java create mode 100644 src/uk/ac/vamsas/client/Iapp.java create mode 100644 src/uk/ac/vamsas/client/InvalidSessionUrnException.java create mode 100644 src/uk/ac/vamsas/client/NoDefaultSessionException.java create mode 100644 src/uk/ac/vamsas/client/SessionHandle.java create mode 100644 src/uk/ac/vamsas/client/SessionUrn.java create mode 100644 src/uk/ac/vamsas/client/UserHandle.java create mode 100644 src/uk/ac/vamsas/client/Vobject.java create mode 100644 src/uk/ac/vamsas/client/Vobjhash.java create mode 100644 src/uk/ac/vamsas/client/VorbaId.java create mode 100644 src/uk/ac/vamsas/client/VorbaIdFactory.java create mode 100644 src/uk/ac/vamsas/client/VorbaXmlBinder.java diff --git a/src/uk/ac/vamsas/client/ClientDocument.java b/src/uk/ac/vamsas/client/ClientDocument.java new file mode 100644 index 0000000..a66ed9d --- /dev/null +++ b/src/uk/ac/vamsas/client/ClientDocument.java @@ -0,0 +1,52 @@ +/* + * + */ +package uk.ac.vamsas.client; + +import java.util.Hashtable; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.vamsas.objects.core.VAMSAS; + +/** + * skeleton abstract class to allow client implementations + * access to vamsas.client.Vobject registry mechanism. + */ +public abstract class ClientDocument implements IClientDocument { + static Log log = LogFactory.getLog(ClientDocument.class); + + /** + * collection of uk.ac.vamsas.client.Vobject references + */ + protected Hashtable vamsasObjects; + protected IVorbaIdFactory vorbafactory; + + protected ClientDocument(Hashtable objects, IVorbaIdFactory factory) { + vamsasObjects = objects; + vorbafactory = factory; + } + + /** + * @see IClientHandle.registerObject(Vobject unregistered) + */ + protected VorbaId _registerObject(Vobject unregistered) { + // be ultra safe here because the user may be trying to mix different factories + if (unregistered.__vorba==null) + unregistered.__vorba = vorbafactory; + else + if (unregistered.__vorba!=vorbafactory) { + // LATER: decide if this is allowed - it isn't for the moment. + log.error("Attempt to overwrite info in a registered vorba Vobject (under a different IVorbaIdFactory) ! - Implementation fix needed."); + return null; + } else { + // probably didn't need to call registerObject. + log.debug("Redundant call to registerObject"); + } + // TODO: add default provenance. + // TODO: decide if we need to do call __ensure_instance_ids here + // TODO: check if __ensure_instance_ids works correctly with new 'visit flag' mechanism + unregistered.__ensure_instance_ids(); // call cascade method here : + return unregistered.getVorbaId(); + } +} diff --git a/src/uk/ac/vamsas/client/ClientHandle.java b/src/uk/ac/vamsas/client/ClientHandle.java new file mode 100644 index 0000000..6f86bce --- /dev/null +++ b/src/uk/ac/vamsas/client/ClientHandle.java @@ -0,0 +1,97 @@ +/* + */ +package uk.ac.vamsas.client; + +import java.io.Serializable; + +/** + * Uniquely describes a vamsas client application. + * @author jimp + */ +public class ClientHandle implements Serializable { + static final long serialVersionUID = 0; + /** + * @param clientName + * @param version + */ + public ClientHandle(String clientName, String version) { + super(); + this.clientName = clientName; + this.version = version; + this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application) + } + /** + * (non-unique) human readable vamsas client name + */ + String clientName; + + /** + * the unambiguous client identifier + * This may be rewritten by the Vorba object if + * other clients with the same name, version + * and user are involved in a session. + * + */ + String clientUrn; + + /** + * version modifier to tag application space + */ + String version; + + /** + * @return Returns the clientUrn. + */ + public String getClientUrn() { + return clientUrn; + } + + /** + * May become protected - should only be set by a Vorba object. + * @param clientUrn + * The clientUrn to set. + */ + public void setClientUrn(String clientUrn) { + this.clientUrn = clientUrn; + } + + /** + * @return Returns the version. + */ + public String getVersion() { + return version; + } + + /** + * @param version + * The version to set. + */ + public void setVersion(String version) { + this.version = version; + } + + + /** + * @return Returns the clientName. + */ + public String getClientName() { + return clientName; + } + + /** + * @param clientName + * The clientName to set. + */ + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public boolean equals(Object that) { + if (that instanceof ClientHandle) + return this.equals((ClientHandle) that); + return false; + } + public boolean equals(ClientHandle that) { + return (clientName.equals(that.clientName) && version.equals(that.version) && clientUrn.equals(that.clientUrn)); + } +} diff --git a/src/uk/ac/vamsas/client/Events.java b/src/uk/ac/vamsas/client/Events.java new file mode 100644 index 0000000..65f632a --- /dev/null +++ b/src/uk/ac/vamsas/client/Events.java @@ -0,0 +1,92 @@ +package uk.ac.vamsas.client; + +/** + * Enumerates the event types generated during the lifecycle of a Vamsas + * session. + * See the excel spreadsheet in VamsasClient/docs/VamsasSessionEventAnalysis.xls for + * some more information about when these are generated and how they should be + * handled. + * + */ + +public class Events { + /** + * Generated when a client has finished updating the document. + * Client which has completed an update should + * not receive the event. + * NewValue: uk.ac.vamsas.client.IClient for session. + */ + public static final String DOCUMENT_UPDATE = "uk.ac.vamsas.client.events.documentUpdateEvent"; + + /** + * Generated when a new vamsas document is created (perhaps from some existing + * Vamsas data) so an application may do its own data space initialization. + * Raised for a new application connecting to a vamsas document + * NewValue: uk.ac.vamsas.client.IClient for session. + * LATER: DOCUMENT_CREATE event may be redundant + */ + public static final String DOCUMENT_CREATE = "uk.ac.vamsas.client.events.documentCreateEvent"; + + /** + * Generated when a new vamsas client is attached to a session (Handle is + * passed) Note: the newly created client does not receive the event. + */ + public static final String CLIENT_CREATION = "uk.ac.vamsas.client.events.clientCreateEvent"; + + /** + * Generated when a vamsas client leaves a session (Handle is passed to all + * others). + */ + public static final String CLIENT_FINALIZATION = "uk.ac.vamsas.client.events.clientFinalizationEvent"; + + /** + * Generated prior to session Shutdown, after the last participating vamsas + * client has finalized. + * Probably only useful to IClientFactory implementations. + * NewValue: + */ + public static final String SESSION_SHUTDOWN = "uk.ac.vamsas.client.events.SessionShutdownEvent"; + + /** + * Generated for all clients when any client calls IClient.storeDocument() to + * allow them to store any updates before an offline copy of the session is + * created. + * Any client that handles this should call the + * IClient.getDocument(), update and then IClient.updateDocument in the same + * handler thread (the lock on the document is held until the handler exits). + * EventName: + * NewValue: uk.ac.vamsas.client.IClient for session. + */ + public static final String DOCUMENT_FINALIZEAPPDATA = "uk.ac.vamsas.client.events.DocumentFinalizeAppData"; + + /** + * Generated by Vorba stub for the sole remaining client instance in a session, + * when it makes a call to finalizeClient(). + * It is only raised if the session has been modified since the + * last call to storeDocument() by any application. + * LATER: copies of a document should be on a per-user basis for multi-user sessions. + * Sequence is as follows : 1. All other vamsas clients have + * called finalizeClient() 2. Final living client monitors closures, and + * realises that it is last. 3. Final client generates event to prompt + * associated application to inquire if the user wishes to save the document + * for future reference. + * * Any call to finalizeClient in a thread other than the registered + * EventListener will block until the RequestToClose handler has exited. + * NewValue: uk.ac.vamsas.client.IClient for session. + */ + public static final String DOCUMENT_REQUESTTOCLOSE = "org.vamas.client.DocumentRequestToCloseEvent"; + + public static java.util.Vector EventList = initList(); + + private static java.util.Vector initList() { + java.util.Vector vec = new java.util.Vector(); + vec.add((Object) DOCUMENT_UPDATE); + vec.add((Object) DOCUMENT_CREATE); + vec.add((Object) CLIENT_CREATION); + vec.add((Object) CLIENT_FINALIZATION); + vec.add((Object) SESSION_SHUTDOWN); + vec.add((Object) DOCUMENT_REQUESTTOCLOSE); + vec.add((Object) DOCUMENT_FINALIZEAPPDATA); + return vec; + } +} diff --git a/src/uk/ac/vamsas/client/IClient.java b/src/uk/ac/vamsas/client/IClient.java new file mode 100644 index 0000000..5df2f20 --- /dev/null +++ b/src/uk/ac/vamsas/client/IClient.java @@ -0,0 +1,142 @@ +/** + * uk.ac.vamsas.client.IClient + * + */ +package uk.ac.vamsas.client; + +import java.beans.PropertyChangeListener; +import java.io.IOException; + +/** + * Defines the methods availabable to a vamsas + * application for interacting with its Vorba agent + * created by an IClientFactory instance for a particular session, + * user, and application handle. + * (it's VORBA, not CORBA!) + * LATER: add exceptions for timeouts raised when there are problems accessing session data (because another application is hogging it). + * LATER: think about situations when two applications both want a ClientDocument at the same time - can one have read-only access (and be told that another is about to update) + */ + +public interface IClient { + + /** + * Self-documenting/describing info for the application to present + * to the user. + * LATER: formalise this for describing VAMSAS system, a particular + * Vorba client agent, and a particular session. + * @return string like VamsasClient v.1.1.1 (GPL) and whatever + */ + public String getAbout(); + + /** + * convenience method to get the SessionUrn as a string (for passing directly to a text box...). + * @return current SessionUrn + */ + public String getSessionUrn(); + /** + * Returns a valid URN for other applications to connect to + * the vamsas session. + * @return session handle for this session. + */ + public SessionHandle getSessionHandle(); + /** + * Included for applications with several ClientHandle + * identities. + * @return ClientHandle used to interact with + * other Vamsas applications. + */ + public ClientHandle getClientHandle(); + /** + * + * @return UserHandle used when interacting + * with other Vamsas applications. + */ + public UserHandle getUserHandle(); + /** + * Method called by client application on exit. + * Vorba will inform other clients if they exist. + * If this is the last application in the session + * then the session will be closed. + * Note: The application should be ready to handle + * 'RequestToCloseDocument' events from the Vorba + * agent in the latter case and so prompt the user + * to save the session locally. + * LATER: pick a better name ? + */ + public void finalizeClient(); + /** + * register handler for updates for the current session + */ + public void addDocumentUpdateHandler(PropertyChangeListener evt); + /** + * get vamsas document with + * user and app specific data + * IClientDocuments are not thread-safe. + * TODO: New exception for failed document lock. + * @throws IOException if lock is not obtainable for the document in the session + */ + public IClientDocument getClientDocument() throws IOException; + /** + * Queue new Vorba objects for storage and propagation + * to other clients (via Event.DOCUMENT_UPDATE based + * notification of document change) + * New objects without provenance information will be + * given a default entry using the IClient's application, + * user (and session) handles + * Validity of IClientDocument object instances after this call is implementation dependent + * TODO: consider refactoring to remove the redundant IClientDocument parameter for this method + */ + public void updateDocument(IClientDocument newdoc); + /** + * Any application may call storeDocument to + * save a local copy of the current vamsas document + * including all application specific entries. + * + * @param location to write zip file + */ + public void storeDocument(java.io.File location); + /** + * Any application may call importDocument to merge a stored + * vamsasDocument into the current session. + * Note: use a IClientFactory's implementation to make sessions out of vamsas documnts + * LATER: VAMSAS: The IClient implementation will handle all ID 'relocations' + * @param location + */ + public void importDocument(java.io.File location); + /** + * Add a listener to a particular event chain. + * See uk.ac.vamsas.client.Events for allowed + * values for EventChain. + * The EventChain value is passed as the + * propertyName in the java.bean.PropertyChangeEvent + * LATER: extend class to form own vamsas Event/Listener model. + * @param EventChain Name of event. Blank/null registers handler for all events. + * @param evt - event handler function. + */ + public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt); + /** + * Sets the update handler that will be called when any updates occur to objects of type rootObject. + * @param rootObject + * @param handler + */ + public void setUpdateHandler(IObjectUpdate handler); + public IObjectUpdate getUpdateHandler(Class rootObject); + public void removeUpdateHandler(Class rootObject); + public IObjectUpdate[] getUpdateHandlers(); + /** + * client application calls this to force the + * Vorba client to check for updates immediately. + * + */ + public void pollUpdate(); + + /** + * Client application calls this after any pre-session initialization + * (registering of Handlers, etc) + * Exceptions are raised for any failures. Any stateful calls to the session prior to + * this will result in an implicit call to joinSession - if that results in an exception + * then the VamsasClient should raise an Error. + * LATER: create VAMSAS exception hierarchy (in a language agnostic manner) + */ + public void joinSession() throws Exception; +} diff --git a/src/uk/ac/vamsas/client/IClientAppdata.java b/src/uk/ac/vamsas/client/IClientAppdata.java new file mode 100644 index 0000000..c718d22 --- /dev/null +++ b/src/uk/ac/vamsas/client/IClientAppdata.java @@ -0,0 +1,61 @@ +/** + * + */ +package uk.ac.vamsas.client; + +import java.io.DataInput; +import java.io.DataOutput; + +/** + * Object for accessing Client and User specific data + * in an IClientDocument instance. + * + */ +public interface IClientAppdata { + /** + * @return true if Client's non-user specific application data is non-zero length. + */ + boolean hasClientAppdata(); + /** + * @return true if User's Client Application data is non-zero length + */ + boolean hasUserAppdata(); + /** + * + * @return byte array containing the Client's non-user specific application data + */ + byte[] getClientAppdata(); + /** + * + * @return byte array containing the Client's user specific application data + */ + byte[] getUserAppdata(); + /** + * set the non-User-specific application data + * @param data - the new non-user-specific data + */ + void setClientAppdata(byte[] data); + /** + * set the User-specific application data + * @param data - the new user-specific data + */ + void setUserAppdata(byte[] data); + /** + * @return non-user specific data output stream + */ + DataOutput getClientOutputStream(); + /** + * @return non-user specific data input stream + */ + DataInput getClientInputStream(); + /** + * + * @return user specific data output stream + */ + DataOutput getUserOutputStream(); + /** + * + * @return user specific data input stream + */ + DataInput getUserInputStream(); +} diff --git a/src/uk/ac/vamsas/client/IClientDocument.java b/src/uk/ac/vamsas/client/IClientDocument.java new file mode 100644 index 0000000..1a58d2f --- /dev/null +++ b/src/uk/ac/vamsas/client/IClientDocument.java @@ -0,0 +1,99 @@ +/* + * Created on 13-Sep-2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package uk.ac.vamsas.client; + +import org.vamsas.objects.core.VAMSAS; + + +/** + * Defines the API for the Vamsas XML Document + * as accessed by a Vamsas SimpleClient Application. + * An instance of this interface is valid for a + * particular set of user, session and application + * handles. + * + * It initially represents a snapshot of the + * XML document at a particular time - queriable by + * reference or by retrieval of root objects. + * It provides methods to make new Vobject references, + * These are guaranteed to be unique amongst existing + * objects in the document, all other references created + * by this Vobject's instance and all other references + * constructed by any other vamsas agents in the session. + * TODO: LATER: finegrained access control for public/private user access + * Finegrained access control: Since a clientDocument is created for a particular + * UserHandle, there is scope for fine grain data access + * control based on user identity. + * A user may also want to make private notes, not + * available to other people using the same application + * in the same session. + * TODO: LATER: implement a more sophisticated query interface for quickly identifying new data in a vamsas document and manipulating existing objects + * @author jimp + */ +public interface IClientDocument { + + /** + * Get a single Vobject. + * @param id + * @return Vobject referred to by id or null if it doesn't exist. + */ + Vobject getObject(VorbaId id); + /** + * Get a list of objects. + * @param ids + * @return array of objects using a vector of VorbaId ids. + */ + Vobject[] getObjects(VorbaId[] ids); + /** + * Returns all root objects in document. All objects inherit + * from uk.ac.vamsas.client.Vobject and have valid VorbaIds and provenance entries. + * @return array of root Vamsas element objects. + */ + VAMSAS[] getVamsasRoots(); + /** + * set the VAMSAS roots in the document + * TODO: decide if objects are verified for provenance and VorbaIds by this call or when document is stored + * TODO: decide if this call should throw InvalidVamsasObject exceptions. + * TODO: decide how this call deals with applications that 'forget' to include all VAMSAS roots (this is where reference counting/garbage collection happens) + * @param roots + */ + void setVamsasRoots(VAMSAS[] roots); + /** + * Adds a new VAMSAS root entry + * TODO: decide on same InvalidVamsasObject exceptions. + * TODO: decide if a 'removeVamsasRoot' method is really needed. + * @param newroot + */ + void addVamsasRoot(VAMSAS newroot); + /** + * Returns an Vobject with a valid VorbaId, and provenance element. + * The VorbaId is so the application may refer to it in + * its own dataspace. + * + * Note: An Vobject with valid VorbaId will not be reregistered. + * Advice: Calling this method for a high-level Vobject + * (such as org.vamsas.objects.core.VAMSAS) will + * register all its component objects too. + * + * @param unregistered unregistered vamsas Vobject + * @return VorbaId registered for vamsas Vobject + */ + VorbaId registerObject(Vobject unregistered); + /** + * Returns an array of objects, each with a valid VorbaId + * (and completed provenance entry). + * Note: An Vobject with valid VorbaId will not be reregistered. + * @param unregistered array of unregistered objects. + * @return array of VorbaIds for the registered objects + */ + VorbaId[] registerObjects(Vobject[] unregistered); + /** + * Get instance of Client and User specific vamsas document data access interface. + * @return Interface to Client and user specific application data + */ + IClientAppdata getClientAppdata(); +} \ No newline at end of file diff --git a/src/uk/ac/vamsas/client/IClientFactory.java b/src/uk/ac/vamsas/client/IClientFactory.java new file mode 100644 index 0000000..64250dc --- /dev/null +++ b/src/uk/ac/vamsas/client/IClientFactory.java @@ -0,0 +1,56 @@ +/* + * Created on 13-Sep-2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package uk.ac.vamsas.client; + +/** + * Defines methods for instantiating Vorba client application agents + * @author jimp + * + * (it's VORBA, not CORBA!) + */ + +public interface IClientFactory { + + /** + * Create a new Vorba Session + * @param applicationHandle is the application's VAMSAS handle string + * @throws NoDefaultSessionException if more than one session exists that the client may connect to + */ + IClient getIClient(ClientHandle applicationHandle) throws NoDefaultSessionException; + /** + * returns new Vorba for a given session. + * @param applicationHandle + * @param sessionUrn session to connect to (or null to create a new session) + * @return + */ + IClient getIClient(ClientHandle applicationHandle, String sessionUrn); + /** + * returns new vorba for a given session acting as a particular identity + * @param applicationHandle + * @param userId + * @param sessionUrn session to connect to (or null to create a new session) + * @return + */ + IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn); + /** + * New session for application and specific user + * @param applicationHandle + * @param userId + * @return + * @throws NoDefaultSessionException if more than one session exists that the client may connect to + */ + IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException; + + /** + * enumerate the active sessions this IClientFactory instance knows about. + * Can be used by caller to pick a session on catching a NoDefaultSessionException. + * LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way) + * @return possibly empty array of sessionUrn strings + */ + public String[] getCurrentSessions(); + +} diff --git a/src/uk/ac/vamsas/client/IObjectUpdate.java b/src/uk/ac/vamsas/client/IObjectUpdate.java new file mode 100644 index 0000000..941321b --- /dev/null +++ b/src/uk/ac/vamsas/client/IObjectUpdate.java @@ -0,0 +1,26 @@ +package uk.ac.vamsas.client; + +/** + * Methods implemented by a Vamsas Application's Object Update handler + * @author vamsas + * Introduced November 2006 Vamsas Meeting + * TODO: verify this is sufficient for the per-object update event mechanism + */ +public interface IObjectUpdate { + /** + * Called by the library to find out which vamsas document object this update handler is interested in + * @return class that extends org.vamsas.Vobject + */ + Class getRootVobject(); + /** + * Called to test if this handler is to be called for updates to any Vobjects below the Root Vobject in the vamsas document. + * @return false means IObjectUpdate.update(updated, cdoc) will only be called with instances of type getRootVobject(). + */ + boolean handlesSubtreeUpdates(); + /** + * Method called by Vamsas Client Library for all updated objects that the handler is registered for. + * @param updated + * @param cdoc + */ + void update(uk.ac.vamsas.client.Vobject updated, uk.ac.vamsas.client.IClientDocument cdoc); +} diff --git a/src/uk/ac/vamsas/client/IVorbaIdFactory.java b/src/uk/ac/vamsas/client/IVorbaIdFactory.java new file mode 100644 index 0000000..5a478c9 --- /dev/null +++ b/src/uk/ac/vamsas/client/IVorbaIdFactory.java @@ -0,0 +1,37 @@ +/* + * Created on 14-Sep-2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package uk.ac.vamsas.client; + +/** + * @author jimp + * middleware interface for generating new VorbaId objects + * for a particular vamsas client based on the current + * session, user and client handle. Generally implemented + * by instances of the vamsas library api only. + */ +public interface IVorbaIdFactory { + /** + * construct a new id appropriate for this client in the vamsas session. + * @param vobject TODO + * + * @return valid VorbaId for session, or null if VorbaIdFactory not configured + * correctly. + */ + public abstract VorbaId makeVorbaId(Vobject vobject); + + public abstract SessionHandle getSessionHandle(); + + public abstract ClientHandle getClientHandle(); + + public abstract UserHandle getUserHandle(); + /** + * called when an object is touched by the vamsas library prior to writing + * to record last hash for the object's VorbaId + * @param vobject + */ + public abstract void updateHashValue(Vobject vobject); +} \ No newline at end of file diff --git a/src/uk/ac/vamsas/client/Iapp.java b/src/uk/ac/vamsas/client/Iapp.java new file mode 100644 index 0000000..43ea8ec --- /dev/null +++ b/src/uk/ac/vamsas/client/Iapp.java @@ -0,0 +1,12 @@ +/** + * uk.ac.vamsas.client.Iapp + */ +package uk.ac.vamsas.client; +public interface Iapp { + /** + * Define core callback functionality that a fully + * fledged vamsas application Vobject must implement + * TODO: define some Application Callbacks and create use cases for them + */ + +}; diff --git a/src/uk/ac/vamsas/client/InvalidSessionUrnException.java b/src/uk/ac/vamsas/client/InvalidSessionUrnException.java new file mode 100644 index 0000000..baabebf --- /dev/null +++ b/src/uk/ac/vamsas/client/InvalidSessionUrnException.java @@ -0,0 +1,38 @@ +package uk.ac.vamsas.client; + +public class InvalidSessionUrnException extends Exception { + + /** + * + */ + public InvalidSessionUrnException() { + super("Invalid Vamsas Session URN."); + // TODO Auto-generated constructor stub + } + + /** + * @param message + * @param cause + */ + public InvalidSessionUrnException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + + /** + * @param message + */ + public InvalidSessionUrnException(String message) { + super("Invalid Vamsas Session URN: "+message); + // TODO Auto-generated constructor stub + } + + /** + * @param cause + */ + public InvalidSessionUrnException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/uk/ac/vamsas/client/NoDefaultSessionException.java b/src/uk/ac/vamsas/client/NoDefaultSessionException.java new file mode 100644 index 0000000..f9aab17 --- /dev/null +++ b/src/uk/ac/vamsas/client/NoDefaultSessionException.java @@ -0,0 +1,46 @@ +/** + * + */ +package uk.ac.vamsas.client; + +/** + * @author jimp + * Raised if an IClient instance is requested without + * specifying a particular vamsas session handle + * when more than one candidate session exists. + */ +public class NoDefaultSessionException extends Exception { + + /** + * + */ + public NoDefaultSessionException() { + super("No Default Session Defined"); + } + + /** + * @param message + */ + public NoDefaultSessionException(String message) { + super(message); + // TODO Auto-generated constructor stub + } + + /** + * @param cause + */ + public NoDefaultSessionException(Throwable cause) { + super(cause); + // TODO Auto-generated constructor stub + } + + /** + * @param message + * @param cause + */ + public NoDefaultSessionException(String message, Throwable cause) { + super(message, cause); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/uk/ac/vamsas/client/SessionHandle.java b/src/uk/ac/vamsas/client/SessionHandle.java new file mode 100644 index 0000000..04874c7 --- /dev/null +++ b/src/uk/ac/vamsas/client/SessionHandle.java @@ -0,0 +1,38 @@ +/* + * Created on 12-Sep-2005 + * + */ +package uk.ac.vamsas.client; + +/** + * Uniquely locates a particular VAMSAS session. + * @author jimp + * + */ +public class SessionHandle { + + /** + * @param sessionUrn + */ + public SessionHandle(String sessionUrn) { + super(); + SessionUrn = sessionUrn; + } + /** + * @return Returns the sessionUrn. + */ + public String getSessionUrn() { + return SessionUrn; + } + /** + * @param sessionUrn The sessionUrn to set. + */ + public void setSessionUrn(String sessionUrn) { + SessionUrn = sessionUrn; + } + /** + * The path to the vamsas session file. + */ + String SessionUrn; + +} diff --git a/src/uk/ac/vamsas/client/SessionUrn.java b/src/uk/ac/vamsas/client/SessionUrn.java new file mode 100644 index 0000000..519c287 --- /dev/null +++ b/src/uk/ac/vamsas/client/SessionUrn.java @@ -0,0 +1,40 @@ +/** + * + */ +package uk.ac.vamsas.client; + +import java.net.URI; +import java.util.Hashtable; +import java.util.Vector; + +/** + * @author jimp + * base class for vamsas session/document types + * uses java.net.URI internally for construction of URN + */ +public abstract class SessionUrn { + protected URI urn; + /** + * The types of URI protocols we understand + */ + protected static final Hashtable TYPES=new Hashtable(); + + /** + * construct urn for a locally stored session file + * @param type + * @param url + */ + protected SessionUrn(String type, java.net.URL url) { + if (!TYPES.containsKey(type.toLowerCase())) + throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for URL '"+url+"'"); + try { + urn = URI.create(type+"://"+url.getPath()); + } catch (Exception e) { + // TODO: something better than throwing an error should be done here. + throw new Error(e); + } + } + public String getSessionUrn() { + return urn.toString(); + } +} diff --git a/src/uk/ac/vamsas/client/UserHandle.java b/src/uk/ac/vamsas/client/UserHandle.java new file mode 100644 index 0000000..688d5ac --- /dev/null +++ b/src/uk/ac/vamsas/client/UserHandle.java @@ -0,0 +1,50 @@ +/* + * Created on 12-Sep-2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package uk.ac.vamsas.client; + +/** + * Unique user identifier for a vamsas session. + * Used to write user provenance information, and + * track view/access control in multiuser sessions. + * @author jimp + */ +public class UserHandle { + /** + * @param fullName + * @param organization + */ + public UserHandle(String fullName, String organization) { + this.fullName = fullName; + Organization = organization; + } + String fullName; + String Organization; + /** + * @return Returns the fullName. + */ + public String getFullName() { + return fullName; + } + /** + * @param fullName The fullName to set. + */ + public void setFullName(String fullname) { + fullName = fullname; + } + /** + * @return Returns the organization. + */ + public String getOrganization() { + return Organization; + } + /** + * @param organization The organization to set. + */ + public void setOrganization(String organization) { + Organization = organization; + } +} diff --git a/src/uk/ac/vamsas/client/Vobject.java b/src/uk/ac/vamsas/client/Vobject.java new file mode 100644 index 0000000..a8a32e4 --- /dev/null +++ b/src/uk/ac/vamsas/client/Vobject.java @@ -0,0 +1,464 @@ +/** + * + */ +package uk.ac.vamsas.client; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Iterator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.exolab.castor.mapping.FieldDescriptor; +import org.exolab.castor.mapping.FieldHandler; +import org.exolab.castor.xml.util.XMLClassDescriptorImpl; +import org.vamsas.test.simpleclient.VamsasArchive; + +/** + * Base class for all Vamsas objects extracted from an IClientDocument. An + * Vobject maybe registered or unregistered. + * + * @author jimp + * + */ +public abstract class Vobject { + static Log log = LogFactory.getLog(Vobject.class); + + /** + * true if Vobject was stored in a vamsas Document or has been retrieved from it + */ + protected boolean __stored_in_document = false; + /** + * true if Vobject was updated since the vamsas library last read a Vobj with the same VorbaId from a document. + */ + protected boolean __updated_since_last_read = false; + /** + * memory of the last doHash() value computed for the Vobject + * @see doHash() + */ + protected int __last_hash = 0; + /** + * set by testInstanceForIdField() if Vobject should have a VorbaId + */ + protected boolean registerable = false; + protected boolean __visited = false; + /** + * reference to containing object for this Vobject. + */ + protected Vobject V_parent=null; + /** + * unique id for all vamsas objects allows unambiguous referencing to any + * Vobject in the vamsas document + */ + protected VorbaId vorbaId = null; + + /** + * the source of unique VorbaIds. + */ + protected IVorbaIdFactory __vorba = null; + + /* (non-Javadoc) + * @see java.lang.Object#finalize() + */ + protected void finalize() throws Throwable { + V_parent=null; + __vorba=null; + vorbaId=null; + super.finalize(); + } + + /** + * + */ + protected Vobject() { + super(); + testInstanceForIdField(); + } + java.lang.reflect.Field ___id_field=null; // set to ease pain of reflection + /** + * set the isRegisterable flag based on the presence of a 'private String _id' field in + * the reflected class instance. + */ + private void testInstanceForIdField() { + // TODO: decide if 'id' is an appropriate reserved attribute name for the VorbaId + // look for the id field in all castor classes (should be an NCName string) + + Class thisclass=this.getClass(); + setRegisterable(false); + while (!thisclass.equals(Vobject.class)) { + try { + java.lang.reflect.Field fd = thisclass.getDeclaredField("_id"); + if (String.class.isAssignableFrom(fd.getType())) { + ___id_field=fd; + this.setRegisterable(true); + break; + } + } catch (SecurityException e) { + log.error("Unexpected Security Exception whilst finding id fields to set!",e); + } catch (NoSuchFieldException e) { + thisclass=thisclass.getSuperclass(); + } + } + } + // boolean __testedInstance=false; + /** + * update the Vobject instance's _id field, based on the contents of the + * VorbaId. Only call this if you mean to do it! + */ + protected void setInstanceIdField() { + /*if (!registerable && !__testedInstance) { + testInstanceForIdField(); + __testedInstance=true; + }*/ + if (registerable) { + if (__vorba != null) + try { + Method fd = this.getClass().getMethod("setId", new Class[] { String.class }); + fd.invoke((Object) this, new Object[] {new String(this.getVorbaId().id)}); + log.debug(this.getClass().getName()+" called setInstanceIdField!"); + } catch (InvocationTargetException e) { + log.error("SourceGeneration of " + + this.getClass().toString() + + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e); + } + catch (IllegalAccessException e) { + log.error("SourceGeneration of " + + this.getClass().toString() + + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e); + } catch (SecurityException e) { + log.error("Security access violation for "+this.getClass().toString(),e); + } catch (NoSuchMethodException e) { + log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)"); + this.setRegisterable(false); + } + } else { + System.err.println("Client error. Trying to setInstanceIdField on a " + + this.getClass().toString() + " (which cannot be given a vorbaId)"); + } + } + + protected String __getInstanceIdField() { + /*if (!registerable && !__testedInstance) { + testInstanceForIdField(); + __testedInstance=true; + }*/ + if (registerable) { + if (__vorba != null) + try { + Method fd = this.getClass().getMethod("getId", (Class[]) null); + Object idstring = fd.invoke((Object) this, (Object[]) null); + log.debug(this.getClass().getName()+" called getInstanceIdField!"); + if (idstring!=null && idstring instanceof String) { + if (((String) idstring).length()>0) + return (String) idstring; + } + } catch (InvocationTargetException e) { + log.error("SourceGeneration of " + + this.getClass().toString() + + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e); + } + catch (IllegalAccessException e) { + log.error("SourceGeneration of " + + this.getClass().toString() + + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e); + } catch (SecurityException e) { + log.error("Security access violation for "+this.getClass().toString(),e); + } catch (NoSuchMethodException e) { + log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)"); + this.setRegisterable(false); + } + } else { + System.err.println("Client error. Trying to getInstanceIdField on a " + + this.getClass().toString() + " (which cannot be given a vorbaId)"); + } + return null; + } + + /** + * calculate a hash for the Vobject with all housekeeping fields at standard + * values. (isRegisterable is an immutable attribute property) + * TODO: decide if __stored_in_document should be included in the hash or not. + * @return true if new hash different to last hash + */ + synchronized protected boolean doHash() { + long __old_hash = __last_hash; + __last_hash = 0; + Vobject _V_parent=V_parent; + V_parent=null; + VorbaId thisid = vorbaId; + IVorbaIdFactory factory = __vorba; + boolean stored = __stored_in_document; + boolean updated = __updated_since_last_read; + boolean visited = __visited; + java.lang.reflect.Field idfield = ___id_field; + ___id_field=null; + __updated_since_last_read=false; + vorbaId = null; + __vorba = null; + __visited=false; + // compute hash + __last_hash = this.hashCode(); + // reset houseskeeping variables + ___id_field=idfield; + vorbaId = thisid; + __vorba = factory; + __stored_in_document = stored; + __updated_since_last_read=updated; + V_parent=_V_parent; + __visited=visited; + return (__old_hash==0) || (__old_hash == __last_hash); + } + + /** + * TODO: combine two versions of the same collection Vobject to resolve + * asynchronous updates to the same vamsas Vobject Merges two vamsas objects, + * one of which is a later version of the earlier (ie they have the same + * vorbaId but one is a later version recently read from the vamsasDocument + * collection. + * + * @return + */ + protected boolean merge(Vobject laterCopy) { + log.warn(this.getClass().getName()+".merge() not implemented."); + return true; + } + + /** + * + * @return true if Vobject is registered + */ + public boolean isRegistered() { + return (registerable) ? (vorbaId != null) : false; + } + + /** + * Method to get fixed reference for the Vobject in the vamsas document. + * + * @returns null if Vobject is neither registered or not associated with a + * properly instantiated VorbaIdFactory. + */ + public VorbaId getVorbaId() { + if (registerable && vorbaId == null) { + if (this.__stored_in_document) { + if (__vorba!=null) + vorbaId=uk.ac.vamsas.client.VorbaId.newId(this.__getInstanceIdField()); + } + // Try to use the associated factory. + if (__vorba != null) + if ((vorbaId = __vorba.makeVorbaId(this)) == null) + return null; // Factory not valid. + else { + this.setInstanceIdField(); + return vorbaId; + } + } + return vorbaId; + } + + /** + * used by the IClient implementation to generate unique Id based on client + * applications current namespace. + */ + protected void setVorbaId(VorbaId newid) { + vorbaId = newid; + } + + /** + * @return true if Vobject is present in Vamsas Document. + */ + public boolean is__stored_in_document() { + return __stored_in_document; + } + + /** + * @return true if this object has been updated in the currently stored document since the last time a Vobject with the same ID was read from a Vamsas Document + */ + public boolean is__updated_since_last_read() { + return __updated_since_last_read; + } + + /** + * Set internal flag to indicate this object was updated since the last document read + * @param __updated_since_last_read the __updated_since_last_read to set + */ + protected void set__updated_since_last_read(boolean __updated_since_last_read) { + this.__updated_since_last_read = __updated_since_last_read; + } + + /** + * for use by Vorba agent to reflect state of vamsas Vobject to client + * application. + * Setting stored_in_document on a registerable Vobject without a + * vorbaId will mean is will *never* get a vorbaId and + * horrible things will happen. + * @param __stored_in_document true if Vobject has been marshalled into current document. + */ + protected void set__stored_in_document(boolean __stored_in_document) { + this.__stored_in_document = __stored_in_document; + } + + /** + * __last_hash is the hash value computed when the Vobject was last checked + * against a IClientDocument generated by the Vobject's parent IClient + * instance. + * + * @return Returns the __last_hash. + */ + public int get__last_hash() { + return __last_hash; + } + + /** + * @return true if Vobject can have a vorbaId + */ + public boolean isRegisterable() { + return registerable; + } + + /** + * Called by __testInstanceForidField and the post-unmarshalling handler + * to indicate if Vobject will have a vorbaId. + * @param registerable + */ + protected void setRegisterable(boolean registerable) { + this.registerable = registerable; + } + /** + * ensure's internal id field corresponds to vorbaId and + * cascade through all fields referring to an instance of Vobject + * calling the same method on them. + * TODO: LATER: properly apply castors own field mechanisms to get at accessors + * TODO: FIX CYCLIC __ensure+instance_ids + * Implementation note for the todo: + * this works like a depth-first search over all vamsas objects in an vamsasDocument. + * __visited is the visited flag, any Vobj who's flag is of a different parity + * to the visited argument will be recursed on. + * note - the doHash() function used to be used as the 'visited' flag - + * this *is not* a valid heuristic, although it will work "most of the time". + * TODO: LATER? Add another method for setDefaultProvenanceField (in the spirit of setInstanceIdField) using the info from the __vorba.getClient/User/Session methods + */ + protected void __ensure_instance_ids() { + __ensure_instance_ids(!__visited); + } + protected void __ensure_instance_ids(boolean visited) { + if (__vorba==null) + throw new Error("Improperly intialised uk.ac.vamsas.client.Vobject - no VorbaFactory given."); + log.debug("doing "+this.getClass()+".__ensure_instance_ids()"); + if (!__stored_in_document && registerable) + setInstanceIdField(); + if (__visited==visited) + return; + __visited=visited; + __vorba.updateHashValue(this); + + Class descriptor = null; + XMLClassDescriptorImpl descimpl = null; + try { + // castor descriptor resolver magic + descriptor = this.getClass().getClassLoader().loadClass(this.getClass().getName()+"Descriptor"); + descimpl = (XMLClassDescriptorImpl) descriptor.getConstructor((Class[])null).newInstance((Object[])null); + } catch (Exception e) { + log.fatal("Source Generation Error!: Couldn't resolve descriptor for " + +this.getClass().getName() + +" was 'generate descriptors' set for castorbuilder.properties?"); + return; + } + FieldDescriptor fields[] = descimpl.getFields(); + for (int i=0,j=fields.length; i 0) { + nobj.setVorbaId(VorbaId.newId(idstring)); + if (objrefs.containsKey(nobj_id=nobj.getVorbaId()) && !objrefs.get(nobj.getVorbaId()).equals(nobj)) { + System.err.println("Serious problem : duplicate id '"+idstring+"' found! expect badness."); + // TODO: HANDLE duplicate XML ids correctly + } + objrefs.put(nobj_id, nobj); + } else { + // add to list of objects without a valid vorbaId + obj.add(nobj); + } + } else { + // TODO: add to list of objects without a valid vorbaId + obj.add(nobj); + } + + nobj.doHash(); + // check to see if new object was present in old object hash + if (oldobjhashes.containsKey(nobj.getVorbaId())) { + Vobjhash oldhash = (Vobjhash) oldobjhashes.get(nobj.getVorbaId()); + if (oldhash.isUpdated(nobj)) { + // mark the object as updated in this document read. + nobj.set__updated_since_last_read(true); + oldobjhashes.put(nobj_id, new Vobjhash(nobj)); + updatedobjs.addElement(nobj); + } + } + } + } catch (Exception e) { + return; + }; + + } + } + + /** + * writes the VamsasDocument to the given stream. + * TODO: ensure that (at least) default provenance entries are written for objects. + * @param outstream + * @param vorba valid VorbaIdFactory to construct any missing IDs + * @param doc + * @throws IOException + * @throws MarshalException + * @throws ValidationException + */ + public static void putVamsasDocument(PrintWriter outstream, VorbaIdFactory vorba, VamsasDocument doc) + throws IOException, MarshalException, ValidationException { + // Ensure references + if (vorba==null) + throw new Error("Null VorbaIdFactory Parameter"); + if (doc.__vorba==null) + doc.__vorba = vorba; + doc.__ensure_instance_ids(); // this may take a while. Do we allow for cyclic references ? + doc.marshal(outstream); + + } + /** + * creates new VorbaId references where necessary for newly unmarshalled objects + * @param unrefed + * @param objrefs + * @return false if any new object references were made + */ + private static boolean ensure_references(Vector unrefed, Hashtable objrefs) { + boolean sync=true; + if (unrefed.size()>0) { + sync=false; // document is out of sync - ids have been created. + java.util.Iterator newobj = unrefed.listIterator(); + while (newobj.hasNext()) { + Vobject o = (Vobject) newobj.next(); + // forces registration and id field update. + VorbaId id = o.getVorbaId(); + if (!objrefs.containsKey(id)) { + objrefs.put(id, o); + } else { + if (!objrefs.get(id).equals(o)) + throw new Error("Serious! Duplicate reference made by vorbaIdFactory!"); + } + } + } + return sync; + } + /** + * Unmarshals a vamsasDocument Vobject from a stream, registers + * unregistered objects, records existing VorbaIds, and completes + * the uk.ac.vamsas.client.Vobject housekeeping fields. + * For a valid unmarshalling, the array of returned objects also includes + * a sync parameter which is true if new VorbaIds + * were created. If sync is false, then the caller should ensure that the + * vamsasDocument is written back to disk to propagate the new VorbaIds. + * TODO: ensure that provenance is correct for newly registered objects + * as getVamsasObjects but will detect updated objects based on differing hash values + * obtained from the VorbaIdFactory's VorbaId, Vobject.get__last_Hash() pairs (if any) + * @param instream - the XML input stream + * @param factory - the SimpleClient's properly configured VorbaId factory to make new references. + * @param root the root element's org.vamsas.objects.core Vobject. + * @return null or {(Object) VamsasDocument Vobject, (Object) Hashtable of Vobject references, (Object) Boolean(sync), (Object) Vector of updated objects in document } + */ + public static Object[] getVamsasObjects(Reader instream, + VorbaIdFactory factory, Vobject root) { + Unmarshaller unmarshaller = new Unmarshaller(root); + unmarshaller.setIDResolver(new IDResolver() { + public Object resolve(String id) { + VorbaXmlBinder.log.warn("Warning - id " + id + + " is not found in the Vamsas XML!"); + return null; + } + }); + final Hashtable objrefs = new Hashtable(); + if (factory.extanthashv==null) + factory.extanthashv=new Hashtable(); + final Hashtable oobjhashes=factory.extanthashv; + final VorbaIdFactory vorbafactory = factory; + final Vector unrefedObj = new Vector(); + final Vector updatedObj = new Vector(); + unmarshaller.setUnmarshalListener(new VorbaXmlBinder(vorbafactory, unrefedObj, objrefs, oobjhashes, updatedObj)); + // Call the unmarshaller. + try { + while (instream.ready()) { + // TODO: mark objects in oobjhash prior to unmarshalling, to detect when objects have been lost through an update. + //tohere + Object obj = unmarshaller.unmarshal(instream); + boolean sync=ensure_references(unrefedObj, objrefs); + if (!(obj instanceof Vobject)) + return null; + vorbafactory.setNewIdHash(objrefs); // update the Document IO Handler's set of vorbaId<>Object bindings. + return new Object[] { obj, objrefs, new Boolean(sync),updatedObj}; + } + } catch (MarshalException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ValidationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } +} \ No newline at end of file diff --git a/src/uk/ac/vamsas/client/simpleclient/ArchiveUrn.java b/src/uk/ac/vamsas/client/simpleclient/ArchiveUrn.java index e3cdd3d..e6184eb 100644 --- a/src/uk/ac/vamsas/client/simpleclient/ArchiveUrn.java +++ b/src/uk/ac/vamsas/client/simpleclient/ArchiveUrn.java @@ -10,7 +10,7 @@ import java.net.MalformedURLException; * @author jimp * */ -public class ArchiveUrn extends org.vamsas.client.SessionUrn { +public class ArchiveUrn extends uk.ac.vamsas.client.SessionUrn { /** * a simple vamsas document urn prefix */ diff --git a/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java b/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java index dde9632..86294be 100644 --- a/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java +++ b/src/uk/ac/vamsas/client/simpleclient/ClientDocument.java @@ -8,12 +8,6 @@ import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.IClientAppdata; -import org.vamsas.client.IClientDocument; -import org.vamsas.client.UserHandle; -import org.vamsas.client.Vobject; -import org.vamsas.client.VorbaId; import org.vamsas.objects.core.ApplicationData; import org.vamsas.objects.core.User; import org.vamsas.objects.core.VAMSAS; @@ -21,11 +15,18 @@ import org.vamsas.objects.core.VamsasDocument; import org.vamsas.objects.utils.AppDataReference; import org.vamsas.test.objects.Core; +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.IClientAppdata; +import uk.ac.vamsas.client.IClientDocument; +import uk.ac.vamsas.client.UserHandle; +import uk.ac.vamsas.client.Vobject; +import uk.ac.vamsas.client.VorbaId; + /** * Maintains a collection of vamsas objects, appdatas and states, and provides api for a SimpleClient's client. * @author jimp */ -public class ClientDocument extends org.vamsas.client.ClientDocument implements IClientDocument { +public class ClientDocument extends uk.ac.vamsas.client.ClientDocument implements IClientDocument { private static Log log = LogFactory.getLog(ClientDocument.class); private VamsasDocument doc; protected SimpleClient sclient; @@ -66,7 +67,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements /* * (non-Javadoc) * - * @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId) + * @see uk.ac.vamsas.client.IClientDocument#getObject(uk.ac.vamsas.client.VorbaId) */ public Vobject getObject(VorbaId id) { if (vamsasObjects==null) { @@ -82,7 +83,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements /* * (non-Javadoc) * - * @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[]) + * @see uk.ac.vamsas.client.IClientDocument#getObjects(uk.ac.vamsas.client.VorbaId[]) */ public Vobject[] getObjects(VorbaId[] ids) { if (vamsasObjects==null) { @@ -104,7 +105,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements /* * (non-Javadoc) * LATER: currently there is only one Vector of roots ever passed to client - decide if this is correct (means this is not thread safe and may behave unexpectedly) - * @see org.vamsas.client.IClientDocument#getVamsasRoots() + * @see uk.ac.vamsas.client.IClientDocument#getVamsasRoots() */ public VAMSAS[] getVamsasRoots() { if (doc==null) { @@ -292,7 +293,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements /* (non-Javadoc) * LATER: decide: this affects the next call to getVamsasRoots() - * @see org.vamsas.client.IClientDocument#addVamsasRoot(org.vamsas.objects.core.VAMSAS) + * @see uk.ac.vamsas.client.IClientDocument#addVamsasRoot(org.vamsas.objects.core.VAMSAS) */ public void addVamsasRoot(VAMSAS newroot) { if (doc==null) { @@ -306,7 +307,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements /* * (non-Javadoc) * - * @see org.vamsas.client.IClientDocument#registerObjects(org.vamsas.client.Vobject[]) + * @see uk.ac.vamsas.client.IClientDocument#registerObjects(uk.ac.vamsas.client.Vobject[]) */ public VorbaId[] registerObjects(Vobject[] unregistered) { if (doc==null) { @@ -332,7 +333,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements return null; } /* (non-Javadoc) - * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.Vobject) + * @see uk.ac.vamsas.client.IClientDocument#registerObject(uk.ac.vamsas.client.Vobject) */ public VorbaId registerObject(Vobject unregistered) { if (doc==null) { @@ -356,7 +357,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements */ SimpleClientAppdata scappd = null; /* (non-Javadoc) - * @see org.vamsas.client.IClientDocument#getClientAppdata() + * @see uk.ac.vamsas.client.IClientDocument#getClientAppdata() */ public IClientAppdata getClientAppdata() { if (doc==null) { diff --git a/src/uk/ac/vamsas/client/simpleclient/ClientsFile.java b/src/uk/ac/vamsas/client/simpleclient/ClientsFile.java index 89d5b41..17af085 100644 --- a/src/uk/ac/vamsas/client/simpleclient/ClientsFile.java +++ b/src/uk/ac/vamsas/client/simpleclient/ClientsFile.java @@ -1,6 +1,6 @@ package uk.ac.vamsas.client.simpleclient; -import org.vamsas.client.*; +import uk.ac.vamsas.client.*; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; diff --git a/src/uk/ac/vamsas/client/simpleclient/EventGeneratorThread.java b/src/uk/ac/vamsas/client/simpleclient/EventGeneratorThread.java index 8d028ef..b53210f 100644 --- a/src/uk/ac/vamsas/client/simpleclient/EventGeneratorThread.java +++ b/src/uk/ac/vamsas/client/simpleclient/EventGeneratorThread.java @@ -7,7 +7,8 @@ import java.util.Hashtable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.Events; + +import uk.ac.vamsas.client.Events; /** * monitors watcher objects and generates events. @@ -85,12 +86,12 @@ public class EventGeneratorThread extends Thread implements Runnable { * Generated when a new vamsas client is attached to a session (Handle is * passed) Note: the newly created client does not receive the event. * - public static final String CLIENT_CREATION = "org.vamsas.client.events.clientCreateEvent"; + public static final String CLIENT_CREATION = "uk.ac.vamsas.client.events.clientCreateEvent"; */ // as the test /** * Generated when a vamsas client leaves a session (Handle is passed to all * others). - public static final String CLIENT_FINALIZATION = "org.vamsas.client.events.clientFinalizationEvent"; + public static final String CLIENT_FINALIZATION = "uk.ac.vamsas.client.events.clientFinalizationEvent"; */ // again - as the test. raised++; } @@ -100,7 +101,7 @@ public class EventGeneratorThread extends Thread implements Runnable { * Generated when a client has finished updating the document. Passes * applicationHandle of client so the updating client can recognise its own * updates. - public static final String DOCUMENT_UPDATE = "org.vamsas.client.events.documentUpdateEvent"; + public static final String DOCUMENT_UPDATE = "uk.ac.vamsas.client.events.documentUpdateEvent"; */ // read apphandle from 'lastUpdate' session file. // pass apphandle name to appHandler ? @@ -111,7 +112,7 @@ public class EventGeneratorThread extends Thread implements Runnable { * Vamsas data) so an application may do its own data space initialization. * TODO: decide if this is called when an app is connected to a stored * session... - public static final String DOCUMENT_CREATE = "org.vamsas.client.events.documentCreateEvent"; + public static final String DOCUMENT_CREATE = "uk.ac.vamsas.client.events.documentCreateEvent"; */ // check if this session's appInit flag is set - if not - generate event for this app. // prolly don't need this at the moment - when an app does getDocument it can to the initing then. @@ -121,7 +122,7 @@ public class EventGeneratorThread extends Thread implements Runnable { * Generated prior to session Shutdown, after the last participating vamsas * client has finalized. * TODO: decide on purpose of this ? is this for benefit of multi-session Apps only ? - public static final String SESSION_SHUTDOWN = "org.vamsas.client.events.SessionShutdownEvent"; + public static final String SESSION_SHUTDOWN = "uk.ac.vamsas.client.events.SessionShutdownEvent"; */ /** @@ -131,9 +132,9 @@ public class EventGeneratorThread extends Thread implements Runnable { * IClient.getDocument(), update and then IClient.updateDocument in the same * handler thread. * EventName: - * NewValue: org.vamsas.client.IClient for session. + * NewValue: uk.ac.vamsas.client.IClient for session. * - public static final String DOCUMENT_FINALIZEAPPDATA = "org.vamsas.client.events.DocumentFinalizeAppData"; + public static final String DOCUMENT_FINALIZEAPPDATA = "uk.ac.vamsas.client.events.DocumentFinalizeAppData"; */ // watch for finalization semaphore (last finalised sessionFile). @@ -229,7 +230,7 @@ public class EventGeneratorThread extends Thread implements Runnable { } /** * count handlers for a particular vamsas event - * @param event string enumeration from org.vamsas.client.Events + * @param event string enumeration from uk.ac.vamsas.client.Events * @return -1 for an invalid event, otherwise the number of handlers */ protected int countHandlersFor(String event) { diff --git a/src/uk/ac/vamsas/client/simpleclient/IdFactory.java b/src/uk/ac/vamsas/client/simpleclient/IdFactory.java index 3a7f2bb..a5f3879 100644 --- a/src/uk/ac/vamsas/client/simpleclient/IdFactory.java +++ b/src/uk/ac/vamsas/client/simpleclient/IdFactory.java @@ -5,14 +5,15 @@ package uk.ac.vamsas.client.simpleclient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.SessionHandle; -import org.vamsas.client.UserHandle; -import org.vamsas.client.VorbaId; -import org.vamsas.client.VorbaIdFactory; -import org.vamsas.client.Vobject; import org.vamsas.objects.utils.document.VersionEntries; +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.SessionHandle; +import uk.ac.vamsas.client.UserHandle; +import uk.ac.vamsas.client.Vobject; +import uk.ac.vamsas.client.VorbaId; +import uk.ac.vamsas.client.VorbaIdFactory; + import java.util.Hashtable; import java.util.zip.CRC32; /** @@ -54,7 +55,7 @@ public class IdFactory extends VorbaIdFactory { this.extanthashv=new Hashtable(); } /** - * values for keys in this hash can be used to reference the org.vamsas.client.Vobject instance for the VorbaId string. + * values for keys in this hash can be used to reference the uk.ac.vamsas.client.Vobject instance for the VorbaId string. * @return the hash of all VorbaIds */ protected Hashtable getVorbaIdHash() { @@ -69,7 +70,7 @@ public class IdFactory extends VorbaIdFactory { return extanthashv; } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#makeVorbaId() + * @see uk.ac.vamsas.client.VorbaIdFactory#makeVorbaId() */ public VorbaId makeVorbaId(Vobject vobject) { if (session==null) @@ -94,7 +95,7 @@ public class IdFactory extends VorbaIdFactory { } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#setSession(org.vamsas.client.SessionHandle) + * @see uk.ac.vamsas.client.VorbaIdFactory#setSession(uk.ac.vamsas.client.SessionHandle) */ protected void setSession(SessionHandle sessionhandle) { if (sessionhandle!=null) @@ -104,14 +105,14 @@ public class IdFactory extends VorbaIdFactory { } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#getSessionHandle() + * @see uk.ac.vamsas.client.VorbaIdFactory#getSessionHandle() */ public SessionHandle getSessionHandle() { return session; } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#setClient(org.vamsas.client.ClientHandle) + * @see uk.ac.vamsas.client.VorbaIdFactory#setClient(uk.ac.vamsas.client.ClientHandle) */ protected void setClient(ClientHandle appHandle) { if (appHandle!=null) @@ -121,14 +122,14 @@ public class IdFactory extends VorbaIdFactory { } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#getClientHandle() + * @see uk.ac.vamsas.client.VorbaIdFactory#getClientHandle() */ public ClientHandle getClientHandle() { return client; } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#setUser(org.vamsas.client.UserHandle) + * @see uk.ac.vamsas.client.VorbaIdFactory#setUser(uk.ac.vamsas.client.UserHandle) */ protected void setUser(UserHandle userHandle) { if (userHandle!=null) @@ -138,7 +139,7 @@ public class IdFactory extends VorbaIdFactory { } /* (non-Javadoc) - * @see org.vamsas.client.VorbaIdFactory#getUserHandle() + * @see uk.ac.vamsas.client.VorbaIdFactory#getUserHandle() */ public UserHandle getUserHandle() { return user; diff --git a/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java b/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java index 08516cd..dfcd5b3 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java +++ b/src/uk/ac/vamsas/client/simpleclient/SessionUrn.java @@ -9,7 +9,7 @@ import java.net.MalformedURLException; * @author jimp * */ -public class SessionUrn extends org.vamsas.client.SessionUrn { +public class SessionUrn extends uk.ac.vamsas.client.SessionUrn { /** * a simple client session urn prefix */ diff --git a/src/uk/ac/vamsas/client/simpleclient/SessionsFile.java b/src/uk/ac/vamsas/client/simpleclient/SessionsFile.java index f931118..d391d0a 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SessionsFile.java +++ b/src/uk/ac/vamsas/client/simpleclient/SessionsFile.java @@ -63,7 +63,8 @@ import java.io.ObjectOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.SessionHandle; + +import uk.ac.vamsas.client.SessionHandle; /** * @author Pierre MARGUERITE diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java index 2858dd3..e93df6c 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java @@ -19,14 +19,6 @@ import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.Events; -import org.vamsas.client.IClient; -import org.vamsas.client.IClientDocument; -import org.vamsas.client.IObjectUpdate; -import org.vamsas.client.InvalidSessionUrnException; -import org.vamsas.client.SessionHandle; -import org.vamsas.client.UserHandle; import org.vamsas.objects.core.ApplicationData; import org.vamsas.objects.core.Entry; import org.vamsas.objects.core.LockFile; @@ -35,6 +27,15 @@ import org.vamsas.objects.utils.AppDataReference; import org.vamsas.objects.utils.ProvenanceStuff; import org.vamsas.objects.utils.document.VersionEntries; +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.Events; +import uk.ac.vamsas.client.IClient; +import uk.ac.vamsas.client.IClientDocument; +import uk.ac.vamsas.client.IObjectUpdate; +import uk.ac.vamsas.client.InvalidSessionUrnException; +import uk.ac.vamsas.client.SessionHandle; +import uk.ac.vamsas.client.UserHandle; + /** * @author jimp */ @@ -109,7 +110,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * LATER: check that build substitution variables are correct - * @see org.vamsas.client.IClient#getAbout() + * @see uk.ac.vamsas.client.IClient#getAbout() */ public String getAbout() { return new String("VORBA SimpleClient version $version$ build $build$"); @@ -118,7 +119,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#getSessionUrn() + * @see uk.ac.vamsas.client.IClient#getSessionUrn() */ public String getSessionUrn() { return session.getSessionUrn(); @@ -127,7 +128,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#getSessionHandle() + * @see uk.ac.vamsas.client.IClient#getSessionHandle() */ public SessionHandle getSessionHandle() { // TODO: eliminate SessionHandle ? need to refactor interfaces. @@ -138,7 +139,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#getClientHandle() + * @see uk.ac.vamsas.client.IClient#getClientHandle() */ public ClientHandle getClientHandle() { return client; @@ -147,7 +148,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#getUserHandle() + * @see uk.ac.vamsas.client.IClient#getUserHandle() */ public UserHandle getUserHandle() { return user; @@ -174,7 +175,7 @@ public class SimpleClient implements IClient { /** * make all the PropertyChangeSupport objects for the - * events described in org.vamsas.client.Event + * events described in uk.ac.vamsas.client.Event * @return */ private static Hashtable initHandlers() { @@ -190,7 +191,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener) + * @see uk.ac.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener) */ public void addDocumentUpdateHandler(PropertyChangeListener evt) { if (handlers.containsKey(Events.DOCUMENT_UPDATE)) { @@ -205,7 +206,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#finalizeClient() + * @see uk.ac.vamsas.client.IClient#finalizeClient() */ public void finalizeClient() { // TODO: determine if this is last client in session @@ -220,7 +221,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#getClientDocument() + * @see uk.ac.vamsas.client.IClient#getClientDocument() */ public IClientDocument getClientDocument() throws IOException { if (cdocument!=null) { @@ -263,7 +264,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * @throws Errors for invalid newdoc parameter - * @see org.vamsas.client.IClient#updateDocument(org.vamsas.client.IClientDocument) + * @see uk.ac.vamsas.client.IClient#updateDocument(uk.ac.vamsas.client.IClientDocument) */ public void updateDocument(IClientDocument newdoc) { if (!(newdoc instanceof ClientDocument)) { @@ -302,7 +303,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#storeDocument(java.io.File) + * @see uk.ac.vamsas.client.IClient#storeDocument(java.io.File) */ public void storeDocument(File location) { @@ -322,7 +323,7 @@ public class SimpleClient implements IClient { /* * (non-Javadoc) * - * @see org.vamsas.client.IClient#addVorbaEventHandler(java.lang.String, + * @see uk.ac.vamsas.client.IClient#addVorbaEventHandler(java.lang.String, * java.beans.PropertyChangeListener) */ public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt) { @@ -336,7 +337,7 @@ public class SimpleClient implements IClient { } /* (non-Javadoc) - * @see org.vamsas.client.IClient#pollUpdate() + * @see uk.ac.vamsas.client.IClient#pollUpdate() */ public void pollUpdate() { @@ -361,7 +362,7 @@ public class SimpleClient implements IClient { } /* (non-Javadoc) - * @see org.vamsas.client.IClient#joinSession() + * @see uk.ac.vamsas.client.IClient#joinSession() */ public void joinSession() throws Exception { // start the EventGenerator thread. @@ -387,7 +388,7 @@ public class SimpleClient implements IClient { /* (non-Javadoc) - * @see org.vamsas.client.IClient#importDocument(java.io.File) + * @see uk.ac.vamsas.client.IClient#importDocument(java.io.File) */ public void importDocument(File location) { // TODO LATER: implement SimpleClient.importDocument() diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java index dcaedee..705f024 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java @@ -21,12 +21,13 @@ import java.util.jar.JarOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.IClientAppdata; import org.vamsas.objects.core.AppData; import org.vamsas.objects.core.ApplicationData; import org.vamsas.objects.core.User; import org.vamsas.objects.utils.AppDataReference; +import uk.ac.vamsas.client.IClientAppdata; + /** * @author jimp * Access interface to data chunks read from a VamsasArchiveReader stream @@ -283,27 +284,27 @@ public class SimpleClientAppdata implements IClientAppdata { return null; } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getClientAppdata() + * @see uk.ac.vamsas.client.IClientAppdata#getClientAppdata() */ public byte[] getClientAppdata() { return _getappdataByteArray(false); } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getClientInputStream() + * @see uk.ac.vamsas.client.IClientAppdata#getClientInputStream() */ public DataInput getClientInputStream() { return _getappdataInputStream(false); } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getUserAppdata() + * @see uk.ac.vamsas.client.IClientAppdata#getUserAppdata() */ public byte[] getUserAppdata() { return _getappdataByteArray(true); } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getUserInputStream() + * @see uk.ac.vamsas.client.IClientAppdata#getUserInputStream() */ public DataInput getUserInputStream() { return _getappdataInputStream(true); @@ -400,7 +401,7 @@ public class SimpleClientAppdata implements IClientAppdata { istrm.close(); } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getClientOutputStream() + * @see uk.ac.vamsas.client.IClientAppdata#getClientOutputStream() */ public DataOutput getClientOutputStream() { if (clientdoc==null) @@ -411,7 +412,7 @@ public class SimpleClientAppdata implements IClientAppdata { } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#getUserOutputStream() + * @see uk.ac.vamsas.client.IClientAppdata#getUserOutputStream() */ public DataOutput getUserOutputStream() { if (clientdoc==null) @@ -423,7 +424,7 @@ public class SimpleClientAppdata implements IClientAppdata { } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#hasClientAppdata() + * @see uk.ac.vamsas.client.IClientAppdata#hasClientAppdata() */ public boolean hasClientAppdata() { if (clientdoc==null) @@ -436,7 +437,7 @@ public class SimpleClientAppdata implements IClientAppdata { } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#hasUserAppdata() + * @see uk.ac.vamsas.client.IClientAppdata#hasUserAppdata() */ public boolean hasUserAppdata() { if (clientdoc==null) @@ -460,7 +461,7 @@ public class SimpleClientAppdata implements IClientAppdata { return false; } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#setClientAppdata(byte[]) + * @see uk.ac.vamsas.client.IClientAppdata#setClientAppdata(byte[]) */ public void setClientAppdata(byte[] data) { if (clientdoc==null) @@ -476,7 +477,7 @@ public class SimpleClientAppdata implements IClientAppdata { } /* (non-Javadoc) - * @see org.vamsas.client.IClientAppdata#setUserAppdata(byte[]) + * @see uk.ac.vamsas.client.IClientAppdata#setUserAppdata(byte[]) */ public void setUserAppdata(byte[] data) { if (clientdoc==null) diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClientFactory.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClientFactory.java index cd05e26..f3dfb52 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClientFactory.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClientFactory.java @@ -16,13 +16,14 @@ import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.IClient; -import org.vamsas.client.IClientFactory; -import org.vamsas.client.InvalidSessionUrnException; -import org.vamsas.client.NoDefaultSessionException; -import org.vamsas.client.SessionHandle; -import org.vamsas.client.UserHandle; + +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.IClient; +import uk.ac.vamsas.client.IClientFactory; +import uk.ac.vamsas.client.InvalidSessionUrnException; +import uk.ac.vamsas.client.NoDefaultSessionException; +import uk.ac.vamsas.client.SessionHandle; +import uk.ac.vamsas.client.UserHandle; /** * @@ -113,7 +114,7 @@ public class SimpleClientFactory implements IClientFactory { } /** - * @see org.vamsas.client.IClientFactory#getCurrentSessions() + * @see uk.ac.vamsas.client.IClientFactory#getCurrentSessions() */ public String[] getCurrentSessions() { @@ -141,7 +142,7 @@ public class SimpleClientFactory implements IClientFactory { } /** - * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle) + * @see uk.ac.vamsas.client.IClientFactory#getIClient(uk.ac.vamsas.client.ClientHandle) * * Creates a IClient object, using default UserHandle with system variables:"user.name" or "USERNAME")), "host.name" or "HOSTNAME" @@ -153,7 +154,7 @@ public class SimpleClientFactory implements IClientFactory { } /** - * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String) + * @see uk.ac.vamsas.client.IClientFactory#getIClient(uk.ac.vamsas.client.ClientHandle, java.lang.String) */ public IClient getIClient(ClientHandle applicationHandle, String sessionUrn) { // TODO Auto-generated method stub @@ -161,7 +162,7 @@ public class SimpleClientFactory implements IClientFactory { } /** - * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String) + * @see uk.ac.vamsas.client.IClientFactory#getIClient(uk.ac.vamsas.client.ClientHandle, uk.ac.vamsas.client.UserHandle, java.lang.String) */ public IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn) { @@ -170,7 +171,7 @@ public class SimpleClientFactory implements IClientFactory { } /** - * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle) + * @see uk.ac.vamsas.client.IClientFactory#getIClient(uk.ac.vamsas.client.ClientHandle, uk.ac.vamsas.client.UserHandle) */ public IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException { diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleDocBinding.java b/src/uk/ac/vamsas/client/simpleclient/SimpleDocBinding.java index 9eee917..1790572 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleDocBinding.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleDocBinding.java @@ -7,9 +7,6 @@ import java.io.InputStreamReader; import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.Vobject; -import org.vamsas.client.VorbaIdFactory; -import org.vamsas.client.VorbaXmlBinder; import org.vamsas.objects.core.VAMSAS; import org.vamsas.objects.core.VamsasDocument; import org.vamsas.objects.utils.AppDataReference; @@ -17,6 +14,10 @@ import org.vamsas.objects.utils.DocumentStuff; import org.vamsas.objects.utils.ProvenanceStuff; import org.vamsas.objects.utils.document.VersionEntries; +import uk.ac.vamsas.client.Vobject; +import uk.ac.vamsas.client.VorbaIdFactory; +import uk.ac.vamsas.client.VorbaXmlBinder; + /** * Base class for SimpleClient Vamsas Document Object Manipulation * holds static vamsasDocument from XML routines and diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleDocument.java b/src/uk/ac/vamsas/client/simpleclient/SimpleDocument.java index 6a0d198..b569afb 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleDocument.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleDocument.java @@ -2,7 +2,8 @@ package uk.ac.vamsas.client.simpleclient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.VorbaIdFactory; + +import uk.ac.vamsas.client.VorbaIdFactory; /** * @see SimpleDocBinding diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasArchive.java b/src/uk/ac/vamsas/client/simpleclient/VamsasArchive.java index a94b688..4f875e3 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasArchive.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasArchive.java @@ -19,13 +19,6 @@ import java.util.jar.Manifest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.IVorbaIdFactory; -import org.vamsas.client.SessionHandle; -import org.vamsas.client.UserHandle; -import org.vamsas.client.VorbaIdFactory; -import org.vamsas.client.VorbaXmlBinder; -import org.vamsas.client.Vobject; import org.vamsas.objects.core.ApplicationData; import org.vamsas.objects.core.VAMSAS; import org.vamsas.objects.core.VamsasDocument; @@ -34,6 +27,14 @@ import org.vamsas.objects.utils.DocumentStuff; import org.vamsas.objects.utils.ProvenanceStuff; import org.vamsas.objects.utils.document.VersionEntries; +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.IVorbaIdFactory; +import uk.ac.vamsas.client.SessionHandle; +import uk.ac.vamsas.client.UserHandle; +import uk.ac.vamsas.client.Vobject; +import uk.ac.vamsas.client.VorbaIdFactory; +import uk.ac.vamsas.client.VorbaXmlBinder; + /** * Class for high-level io and Jar manipulation involved in creating * or updating a vamsas archive (with backups). diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java index d230ead..a70fe54 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java @@ -13,8 +13,9 @@ import org.apache.commons.logging.LogFactory; import org.apache.log4j.Appender; import org.apache.log4j.Logger; import org.apache.log4j.FileAppender; -import org.vamsas.client.ClientHandle; -import org.vamsas.client.UserHandle; + +import uk.ac.vamsas.client.ClientHandle; +import uk.ac.vamsas.client.UserHandle; /** * Does all the IO operations for a SimpleClient instance accessing * a SimpleClient vamsas session. @@ -108,7 +109,7 @@ public class VamsasSession { */ public static final String SESSION_LOG="Log.txt"; private static Log log = LogFactory.getLog(VamsasSession.class); - protected Logger slog = Logger.getLogger("org.vamsas.client.SessionLog"); + protected Logger slog = Logger.getLogger("uk.ac.vamsas.client.SessionLog"); /** * setup the sessionLog using Log4j. * @throws IOException -- 1.7.10.2