renamed base class for all vamsas document objects (now org.vamsas.client.Vobject)
[vamsas.git] / src / org / vamsas / client / VorbaIdFactory.java
1 /*
2  * Created on 12-Sep-2005
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */
7 package org.vamsas.client;
8
9 import java.util.Hashtable;
10
11 /**
12  * A VorbaIdFactory is constructed by an IClient instance.
13  * It guarantees that any new VorbaId objects are unique 
14  * within the VAMSAS session.
15  * 
16  * @author jimp
17  */
18 public abstract class VorbaIdFactory implements IVorbaIdFactory {
19   protected Hashtable extantids=null;
20   /**
21    * construct a new id appropriate for this client in the vamsas session.
22    * 
23    * @return valid VorbaId for session, or null if VorbaIdFactory not configured
24    *         correctly.
25    */
26   public abstract VorbaId makeVorbaId(Vobject vobject);
27   
28   /**
29    * internal method to access the protected VorbaId object constructor
30    * This shennanigan is to prevent casual generation of VorbaIds 
31    * (which may destroy the integrity of a Vamsas Document!)
32    * @param id
33    * @return new VorbaId object
34    */
35   protected VorbaId newId(String id) {
36     return VorbaId.newId(id);
37   }
38   /**
39    * Called by VorbaXmlBinder so the record of newly unmarshalled Vobject Ids
40    * is accessible to the Document's VorbaIdFactory instance. 
41    * @param idtable
42    */
43   protected void setNewIdHash(Hashtable idtable) {
44     extantids = idtable;
45   }
46   /**
47    * TODO: decide if these are needed.
48    * 
49    * @param sessionHandle
50    */
51   protected abstract void setSession(SessionHandle sessionhandle);
52
53   public abstract SessionHandle getSessionHandle();
54
55   protected abstract void setClient(ClientHandle appHandle);
56
57   public abstract ClientHandle getClientHandle();
58
59   protected abstract void setUser(UserHandle userHandle);
60
61   public abstract UserHandle getUserHandle();
62 }