/* * 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; import java.util.Hashtable; import java.util.Vector; /** * A VorbaIdFactory is constructed by an IClient instance. * It guarantees that any new VorbaId objects are unique * within the VAMSAS session. * * @author jimp */ public abstract class VorbaIdFactory implements IVorbaIdFactory { /** * hash of VorbaIds to Vobject. */ protected Hashtable extantids=null; /** * hash of VorbaIds to persisted hash values */ protected Hashtable extanthashv=null; /** * list of Vobjects added since last Document read. */ protected Vector newobj=null; /** * construct a new id appropriate for this client in the vamsas session. * * @return valid VorbaId for session, or null if VorbaIdFactory not configured * correctly. */ public abstract VorbaId makeVorbaId(Vobject vobject); /** * internal method to access the protected VorbaId object constructor * This shennanigan is to prevent casual generation of VorbaIds * (which may destroy the integrity of a Vamsas Document!) * @param id * @return new VorbaId object */ protected VorbaId newId(String id) { return VorbaId.newId(id); } /** * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids * is accessible to the Document's VorbaIdFactory instance. * @param idtable */ protected void setNewIdHash(Hashtable idtable) { extantids = idtable; } /* (non-Javadoc) * @see uk.ac.vamsas.client.IVorbaIdFactory#updateHashValue(uk.ac.vamsas.client.Vobject) */ public void updateHashValue(Vobject vobject) { if (vobject.isRegisterable()) extanthashv.put(vobject.getVorbaId(), new Vobjhash(vobject)); } /** * TODO: decide if these are needed. * * @param sessionHandle */ protected abstract void setSession(SessionHandle sessionhandle); public abstract SessionHandle getSessionHandle(); protected abstract void setClient(ClientHandle appHandle); public abstract ClientHandle getClientHandle(); protected abstract void setUser(UserHandle userHandle); public abstract UserHandle getUserHandle(); }