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();
+ public abstract VorbaId makeVorbaId(object vobject);
public abstract SessionHandle getSessionHandle();
super();
id = Id;
}
- protected static VorbaId newId(IVorbaIdFactory vorbaObject) {
+ /**
+ *
+ * @param vorbaObject the source of vorba Ids
+ * @param vobject the object to be registered with a new vorba id
+ * @return
+ */
+ protected static VorbaId newId(IVorbaIdFactory vorbaObject, object vobject) {
// Make unique id from appSpace info in vorbaObject
synchronized (vorbaObject) {
- return vorbaObject.makeVorbaId();
+ return vorbaObject.makeVorbaId(vobject);
}
}
protected static VorbaId newId(String id) {
* @return valid VorbaId for session, or null if VorbaIdFactory not configured
* correctly.
*/
- public abstract VorbaId makeVorbaId();
+ public abstract VorbaId makeVorbaId(object vobject);
/**
* internal method to access the protected VorbaId object constructor
if (registerable && vorbaId == null) {
// Try to use the associated factory.
if (__vorba != null)
- if ((vorbaId = __vorba.makeVorbaId()) == null)
+ if ((vorbaId = __vorba.makeVorbaId(this)) == null)
return null; // Factory not valid.
else {
this.setInstanceIdField();
import org.vamsas.client.UserHandle;
import org.vamsas.client.VorbaId;
import org.vamsas.client.VorbaIdFactory;
+import org.vamsas.client.object;
import org.vamsas.objects.utils.document.VersionEntries;
import java.util.Hashtable;
/* (non-Javadoc)
* @see org.vamsas.client.VorbaIdFactory#makeVorbaId()
*/
- public VorbaId makeVorbaId() {
+ public VorbaId makeVorbaId(object vobject) {
if (session==null)
throw new Error("makeVorbaId called on improperly initialised IdFactory object!");
String newidstring;
}
newidstring=idstring+Integer.toString(sequence);
} while (extantids.containsKey(newidstring));
+ extantids.put(newidstring, vobject); // hash the object by its new Id
VorbaId id = newId(newidstring);
return id;
}
if (provenance_user==null)
provenance_user = "org.vamsas.simpleclient.VamsasArchive";
if (provenance_action == null)
- provenance_action="Created new empty document");
+ provenance_action="Created new empty document";
if (version==null)
version = VersionEntries.latestVersion();
// Create a new document and return it
}
// register an update listener and a close listener.
// get document data
- processVamsasDocument(vorbaclient.getClientDocument());
+ try {
+ IClientDocument cdoc = vorbaclient.getClientDocument();
+ processVamsasDocument(cdoc);
+ } catch (Exception e) {
+ System.err.println("Unexpected exception when retrieving the client document for the first time!");
+ e.printStackTrace(System.err);
+ System.exit(1);
+ }
// Main application event loop - wait around and do stuff...
while (!isShuttingdown) {