2 * Created on 12-Sep-2005
4 * TODO To change the template for this generated file go to
5 * Window - Preferences - Java - Code Style - Code Templates
7 package uk.ac.vamsas.client;
9 import java.util.Hashtable;
10 import java.util.Vector;
13 * A VorbaIdFactory is constructed by an IClient instance.
14 * It guarantees that any new VorbaId objects are unique
15 * within the VAMSAS session.
19 public abstract class VorbaIdFactory implements IVorbaIdFactory {
21 * hash of VorbaIds to Vobject.
23 protected Hashtable extantids=null;
25 * hash of VorbaIds to persisted hash values
27 protected Hashtable extanthashv=null;
29 * list of Vobjects added since last Document read.
31 protected Vector newobj=null;
34 * construct a new id appropriate for this client in the vamsas session.
36 * @return valid VorbaId for session, or null if VorbaIdFactory not configured
39 public abstract VorbaId makeVorbaId(Vobject vobject);
42 * internal method to access the protected VorbaId object constructor
43 * This shennanigan is to prevent casual generation of VorbaIds
44 * (which may destroy the integrity of a Vamsas Document!)
46 * @return new VorbaId object
48 protected VorbaId newId(String id) {
49 return VorbaId.newId(id);
52 * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids
53 * is accessible to the Document's VorbaIdFactory instance.
56 protected void setNewIdHash(Hashtable idtable) {
61 * @see uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client.Vobject)
63 public void updateHashValue(Vobject vobject) {
64 if (vobject.isRegisterable())
65 extanthashv.put(vobject.getVorbaId(), new Vobjhash(vobject));
69 * TODO: decide if these are needed.
71 * @param sessionHandle
73 protected abstract void setSession(SessionHandle sessionhandle);
75 public abstract SessionHandle getSessionHandle();
77 protected abstract void setClient(ClientHandle appHandle);
79 public abstract ClientHandle getClientHandle();
81 protected abstract void setUser(UserHandle userHandle);
83 public abstract UserHandle getUserHandle();