latest schema.
[vamsas.git] / src / org / vamsas / client / object.java
1 /**
2  * 
3  */
4 package org.vamsas.client;
5 /**
6  * Base class for all Vamsas objects extracted 
7  * from an IClientDocument. 
8  * An object maybe registered or unregistered.
9  * 
10  * @author jimp
11  *
12  */
13 public abstract class object {
14
15     /**
16      * unique id for all vamsas objects
17      * allows unambiguous referencing
18      * to any object in the vamsas document
19      */
20         protected boolean __stored_in_document=false;
21     protected long __last_hash=0;
22     protected VorbaId vorbaId=null;
23     protected IVorbaIdFactory __vorba=null;
24     /**
25      * 
26      * @return true if object is registered
27      */
28     public boolean isRegistered() {
29       return (vorbaId!=null);
30     }
31     /**
32      * Method to get fixed reference for
33      * the object in the vamsas document.
34      * @returns null if object is neither registered 
35      * or not associated with a properly instantiated 
36      * VorbaIdFactory.
37      */
38     public String getVorbaId() {
39       if (vorbaId==null) {
40         // Try to use the associated factory.
41         if (__vorba!=null) 
42           if ((vorbaId = __vorba.makeVorbaId())==null)
43             return null; // Factory not valid.
44         else
45           return null;
46       }
47       return vorbaId.getId();
48     }
49     /**
50      * used by the IClient implementation
51      * to generate unique Id based on
52      * client applications current namespace.
53      */
54     protected void setVorbaId(VorbaId newid) {
55       vorbaId = newid;
56     }
57     
58     /**
59      * @return true if object is present in Vamsas Document.
60      */
61     public boolean is__stored_in_document() {
62       return __stored_in_document;
63     }
64     /**
65      * for use by Vorba agent to reflect state of 
66      * vamsas object to client application.
67      * @param __stored_in_document The __stored_in_document to set.
68      */
69     protected void set__stored_in_document(boolean __stored_in_document) {
70       this.__stored_in_document = __stored_in_document;
71     }
72     /**
73      * __last_hash is the hash value computed 
74      * when the object was last checked against 
75      * a IClientDocument generated by the 
76      * object's parent IClient instance.
77      * @return Returns the __last_hash.
78      */
79     public long get__last_hash() {
80       return __last_hash;
81     }
82 }