backtrack
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Dec 2006 17:42:54 +0000 (17:42 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 14 Dec 2006 17:42:54 +0000 (17:42 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@264 be28352e-c001-0410-b1a7-c7978e42abec

149 files changed:
src/org/vamsas/client/ClientDocument.java [new file with mode: 0644]
src/org/vamsas/client/ClientHandle.java [new file with mode: 0644]
src/org/vamsas/client/Events.java [new file with mode: 0644]
src/org/vamsas/client/IClient.java [new file with mode: 0644]
src/org/vamsas/client/IClientAppdata.java [new file with mode: 0644]
src/org/vamsas/client/IClientDocument.java [new file with mode: 0644]
src/org/vamsas/client/IClientFactory.java [new file with mode: 0644]
src/org/vamsas/client/IObjectUpdate.java [new file with mode: 0644]
src/org/vamsas/client/IVorbaIdFactory.java [new file with mode: 0644]
src/org/vamsas/client/Iapp.java [new file with mode: 0644]
src/org/vamsas/client/InvalidSessionUrnException.java [new file with mode: 0644]
src/org/vamsas/client/NoDefaultSessionException.java [new file with mode: 0644]
src/org/vamsas/client/SessionHandle.java [new file with mode: 0644]
src/org/vamsas/client/SessionUrn.java [new file with mode: 0644]
src/org/vamsas/client/UserHandle.java [new file with mode: 0644]
src/org/vamsas/client/Vobject.java [new file with mode: 0644]
src/org/vamsas/client/Vobjhash.java [new file with mode: 0644]
src/org/vamsas/client/VorbaId.java [new file with mode: 0644]
src/org/vamsas/client/VorbaIdFactory.java [new file with mode: 0644]
src/org/vamsas/client/VorbaXmlBinder.java [new file with mode: 0644]
src/org/vamsas/client/picking/PickEndPoint.java [new file with mode: 0644]
src/org/vamsas/client/picking/PickManager.java [new file with mode: 0644]
src/org/vamsas/client/picking/PickServer.java [new file with mode: 0644]
src/org/vamsas/client/picking/TestApp.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/AppDataInputStream.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/AppDataOutputStream.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/ArchiveUrn.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/ClientDocument.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/ClientsFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/EventGeneratorThread.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/FileLock.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/FileWatcher.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/IdFactory.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/ListFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/Lock.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/LockFactory.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/LockTimeoutException.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/LockedFileOutputStream.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/NativeLock.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SessionFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SessionFlagFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SessionUrn.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SessionsFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SimpleClient.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SimpleClientAppdata.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SimpleClientFactory.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SimpleDocBinding.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/SimpleDocument.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/VamsasArchive.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/VamsasArchiveReader.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/VamsasFile.java [new file with mode: 0644]
src/org/vamsas/client/simpleclient/VamsasSession.java [new file with mode: 0644]
src/org/vamsas/objects/core/.castor.cdr [new file with mode: 0644]
src/org/vamsas/objects/core/Alignment.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentAnnotation.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentAnnotationDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentSequence.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentSequenceAnnotation.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentSequenceAnnotationDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/AlignmentSequenceDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/AnnotationElement.java [new file with mode: 0644]
src/org/vamsas/objects/core/AnnotationElementDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/AppData.java [new file with mode: 0644]
src/org/vamsas/objects/core/AppDataDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/ApplicationData.java [new file with mode: 0644]
src/org/vamsas/objects/core/ApplicationDataDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Attachment.java [new file with mode: 0644]
src/org/vamsas/objects/core/AttachmentDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Common.java [new file with mode: 0644]
src/org/vamsas/objects/core/CommonDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/DataSet.java [new file with mode: 0644]
src/org/vamsas/objects/core/DataSetAnnotations.java [new file with mode: 0644]
src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/DataSetDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/DbRef.java [new file with mode: 0644]
src/org/vamsas/objects/core/DbRefDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Entry.java [new file with mode: 0644]
src/org/vamsas/objects/core/EntryDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Glyph.java [new file with mode: 0644]
src/org/vamsas/objects/core/GlyphDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Input.java [new file with mode: 0644]
src/org/vamsas/objects/core/InputDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Instance.java [new file with mode: 0644]
src/org/vamsas/objects/core/InstanceDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Link.java [new file with mode: 0644]
src/org/vamsas/objects/core/LinkDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/LockFile.java [new file with mode: 0644]
src/org/vamsas/objects/core/LockFileDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Map.java [new file with mode: 0644]
src/org/vamsas/objects/core/MapDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/MapList.java [new file with mode: 0644]
src/org/vamsas/objects/core/MapListDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Mapping.java [new file with mode: 0644]
src/org/vamsas/objects/core/MappingDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Newick.java [new file with mode: 0644]
src/org/vamsas/objects/core/NewickDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Param.java [new file with mode: 0644]
src/org/vamsas/objects/core/ParamDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Pos.java [new file with mode: 0644]
src/org/vamsas/objects/core/PosDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Property.java [new file with mode: 0644]
src/org/vamsas/objects/core/PropertyDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Provenance.java [new file with mode: 0644]
src/org/vamsas/objects/core/ProvenanceDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/RangeAnnotation.java [new file with mode: 0644]
src/org/vamsas/objects/core/RangeAnnotationDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/RangeType.java [new file with mode: 0644]
src/org/vamsas/objects/core/RangeTypeDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Score.java [new file with mode: 0644]
src/org/vamsas/objects/core/ScoreDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Seg.java [new file with mode: 0644]
src/org/vamsas/objects/core/SegDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Sequence.java [new file with mode: 0644]
src/org/vamsas/objects/core/SequenceDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/SequenceType.java [new file with mode: 0644]
src/org/vamsas/objects/core/SequenceTypeDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/Tree.java [new file with mode: 0644]
src/org/vamsas/objects/core/TreeDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/User.java [new file with mode: 0644]
src/org/vamsas/objects/core/UserDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/VAMSAS.java [new file with mode: 0644]
src/org/vamsas/objects/core/VAMSASDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/core/VamsasDocument.java [new file with mode: 0644]
src/org/vamsas/objects/core/VamsasDocumentDescriptor.java [new file with mode: 0644]
src/org/vamsas/objects/utils/AppDataReference.java [new file with mode: 0644]
src/org/vamsas/objects/utils/DocumentStuff.java [new file with mode: 0644]
src/org/vamsas/objects/utils/Format.java [new file with mode: 0644]
src/org/vamsas/objects/utils/GlyphDictionary.java [new file with mode: 0644]
src/org/vamsas/objects/utils/ProvenanceStuff.java [new file with mode: 0644]
src/org/vamsas/objects/utils/Seq.java [new file with mode: 0644]
src/org/vamsas/objects/utils/SeqAln.java [new file with mode: 0644]
src/org/vamsas/objects/utils/SeqSet.java [new file with mode: 0644]
src/org/vamsas/objects/utils/SymbolDictionary.java [new file with mode: 0644]
src/org/vamsas/objects/utils/document/VersionEntries.java [new file with mode: 0644]
src/org/vamsas/test/ExampleApplication.java [new file with mode: 0644]
src/org/vamsas/test/objects/Core.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveClient.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveReader.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveReports.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveStreamReader.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveWatcher.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ArchiveWriter.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ClientDoc.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/ClientsFileTest.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/CommandProcessor.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/VamsasArchive.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/simpleapp/VamsasClient.java [new file with mode: 0644]
src/org/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java [new file with mode: 0644]

diff --git a/src/org/vamsas/client/ClientDocument.java b/src/org/vamsas/client/ClientDocument.java
new file mode 100644 (file)
index 0000000..3866a90
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ *
+ */
+package org.vamsas.client;
+
+import java.util.Hashtable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.objects.core.VAMSAS;
+
+/**
+ * skeleton abstract class to allow client implementations 
+ * access to vamsas.client.Vobject registry mechanism.
+ */
+public abstract class ClientDocument implements IClientDocument {
+  static Log log = LogFactory.getLog(ClientDocument.class);
+  
+  /**
+   * collection of org.vamsas.client.Vobject references
+   */
+  protected Hashtable vamsasObjects;
+  protected IVorbaIdFactory vorbafactory;
+  
+  protected ClientDocument(Hashtable objects, IVorbaIdFactory factory) {
+    vamsasObjects = objects;
+    vorbafactory = factory;
+  }
+  
+  /**
+   * @see IClientHandle.registerObject(Vobject unregistered)
+   */
+  protected VorbaId _registerObject(Vobject unregistered) {
+    // be ultra safe here because the user may be trying to mix different factories
+    if (unregistered.__vorba==null)
+        unregistered.__vorba = vorbafactory;
+    else
+      if (unregistered.__vorba!=vorbafactory) {
+        // LATER: decide if this is allowed - it isn't for the moment.
+        log.error("Attempt to overwrite info in a registered vorba Vobject (under a different IVorbaIdFactory) ! - Implementation fix needed.");
+        return null;
+      } else {
+        // probably didn't need to call registerObject.
+        log.debug("Redundant call to registerObject");
+      }
+    // TODO: add default provenance.
+    // TODO: decide if we need to do call __ensure_instance_ids here
+    // TODO: check if __ensure_instance_ids works correctly with new 'visit flag' mechanism
+    unregistered.__ensure_instance_ids(); // call cascade method here : 
+    return unregistered.getVorbaId();
+  }
+}
diff --git a/src/org/vamsas/client/ClientHandle.java b/src/org/vamsas/client/ClientHandle.java
new file mode 100644 (file)
index 0000000..76666f9
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ */
+package org.vamsas.client;
+
+import java.io.Serializable;
+
+/**
+ * Uniquely describes a vamsas client application.
+ * @author jimp 
+ */
+public class ClientHandle implements Serializable {
+  static final long serialVersionUID = 0;
+  /**
+   * @param clientName
+   * @param version
+   */
+  public ClientHandle(String clientName, String version) {
+    super();
+    this.clientName = clientName;
+    this.version = version;
+    this.setClientUrn("vamsas://"+clientName+":"+version+"/"); // TODO: decide on application handle ornthing (used to prefix new ids made by a particular application)
+  }
+  /**
+   * (non-unique) human readable vamsas client name
+   */
+  String clientName;
+
+  /**
+   * the unambiguous client identifier
+   * This may be rewritten by the Vorba object if
+   * other clients with the same name, version 
+   * and user are involved in a session.
+   * 
+   */
+  String clientUrn;
+
+  /**
+   * version modifier to tag application space
+   */
+  String version;
+
+  /**
+   * @return Returns the clientUrn.
+   */
+  public String getClientUrn() {
+    return clientUrn;
+  }
+
+  /**
+   * May become protected - should only be set by a Vorba object.
+   * @param clientUrn
+   *          The clientUrn to set.
+   */
+  public void setClientUrn(String clientUrn) {
+    this.clientUrn = clientUrn;
+  }
+
+  /**
+   * @return Returns the version.
+   */
+  public String getVersion() {
+    return version;
+  }
+
+  /**
+   * @param version
+   *          The version to set.
+   */
+  public void setVersion(String version) {
+    this.version = version;
+  }
+
+
+  /**
+   * @return Returns the clientName.
+   */
+  public String getClientName() {
+    return clientName;
+  }
+
+  /**
+   * @param clientName
+   *          The clientName to set.
+   */
+  public void setClientName(String clientName) {
+    this.clientName = clientName;
+  }
+
+  public boolean equals(Object that) {
+    if (that instanceof ClientHandle)
+      return this.equals((ClientHandle) that); 
+    return false;
+  }
+  public boolean equals(ClientHandle that) {
+    return (clientName.equals(that.clientName) && version.equals(that.version) && clientUrn.equals(that.clientUrn));
+  }
+}
diff --git a/src/org/vamsas/client/Events.java b/src/org/vamsas/client/Events.java
new file mode 100644 (file)
index 0000000..4a91f5a
--- /dev/null
@@ -0,0 +1,92 @@
+package org.vamsas.client;
+
+/**
+ * Enumerates the event types generated during the lifecycle of a Vamsas
+ * session.
+ * See the excel spreadsheet in VamsasClient/docs/VamsasSessionEventAnalysis.xls for
+ * some more information about when these are generated and how they should be
+ * handled.
+ * 
+ */
+
+public class Events {
+  /**
+   * Generated when a client has finished updating the document. 
+   * Client which has completed an update should
+   * not receive the event.
+   * NewValue: org.vamsas.client.IClient for session.
+   */
+  public static final String DOCUMENT_UPDATE = "org.vamsas.client.events.documentUpdateEvent";
+
+  /**
+   * Generated when a new vamsas document is created (perhaps from some existing
+   * Vamsas data) so an application may do its own data space initialization.
+   * Raised for a new application connecting to a vamsas document 
+   * NewValue: org.vamsas.client.IClient for session.
+   * LATER: DOCUMENT_CREATE event may be redundant
+   */
+  public static final String DOCUMENT_CREATE = "org.vamsas.client.events.documentCreateEvent";
+
+  /**
+   * Generated when a new vamsas client is attached to a session (Handle is
+   * passed) Note: the newly created client does not receive the event.
+   */
+  public static final String CLIENT_CREATION = "org.vamsas.client.events.clientCreateEvent";
+
+  /**
+   * Generated when a vamsas client leaves a session (Handle is passed to all
+   * others).
+   */
+  public static final String CLIENT_FINALIZATION = "org.vamsas.client.events.clientFinalizationEvent";
+
+  /**
+   * Generated prior to session Shutdown, after the last participating vamsas
+   * client has finalized.
+   * Probably only useful to IClientFactory implementations.
+   * NewValue: <Vamsas-session URN>
+   */
+  public static final String SESSION_SHUTDOWN = "org.vamsas.client.events.SessionShutdownEvent";
+
+  /**
+   * Generated for all clients when any client calls IClient.storeDocument() to
+   * allow them to store any updates before an offline copy of the session is
+   * created. 
+   * Any client that handles this should call the
+   * IClient.getDocument(), update and then IClient.updateDocument in the same
+   * handler thread (the lock on the document is held until the handler exits).
+   * EventName: <Vamsas-session URN>
+   * NewValue: org.vamsas.client.IClient for session.
+   */
+  public static final String DOCUMENT_FINALIZEAPPDATA = "org.vamsas.client.events.DocumentFinalizeAppData";
+
+  /**
+   * Generated by Vorba stub for the sole remaining client instance in a session, 
+   * when it makes a call to finalizeClient(). 
+   * It is only raised if the session has been modified since the 
+   * last call to storeDocument() by any application.
+   * LATER: copies of a document should be on a per-user basis for multi-user sessions. 
+   *  Sequence is as follows : 1. All other vamsas clients have
+   * called finalizeClient() 2. Final living client monitors closures, and
+   * realises that it is last. 3. Final client generates event to prompt
+   * associated application to inquire if the user wishes to save the document
+   * for future reference.
+   *  * Any call to finalizeClient in a thread other than the registered
+   * EventListener will block until the RequestToClose handler has exited.
+   * NewValue: org.vamsas.client.IClient for session.
+   */
+  public static final String DOCUMENT_REQUESTTOCLOSE = "org.vamas.client.DocumentRequestToCloseEvent";
+
+  public static java.util.Vector EventList = initList();
+
+  private static java.util.Vector initList() {
+    java.util.Vector vec = new java.util.Vector();
+    vec.add((Object) DOCUMENT_UPDATE);
+    vec.add((Object) DOCUMENT_CREATE);
+    vec.add((Object) CLIENT_CREATION);
+    vec.add((Object) CLIENT_FINALIZATION);
+    vec.add((Object) SESSION_SHUTDOWN);
+    vec.add((Object) DOCUMENT_REQUESTTOCLOSE);
+    vec.add((Object) DOCUMENT_FINALIZEAPPDATA);
+    return vec;
+  }
+}
diff --git a/src/org/vamsas/client/IClient.java b/src/org/vamsas/client/IClient.java
new file mode 100644 (file)
index 0000000..aaf855f
--- /dev/null
@@ -0,0 +1,142 @@
+/**
+ * org.vamsas.client.IClient
+ * 
+ */
+package org.vamsas.client;
+
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+
+/**
+ * Defines the methods availabable to a vamsas
+ * application for interacting with its Vorba agent
+ * created by an IClientFactory instance for a particular session, 
+ * user, and application handle.
+ * (it's VORBA, not CORBA!)
+ * LATER: add exceptions for timeouts raised when there are problems accessing session data (because another application is hogging it).
+ * LATER: think about situations when two applications both want a ClientDocument at the same time - can one have read-only access (and be told that another is about to update)
+ */
+
+public interface IClient {
+  
+  /**
+   * Self-documenting/describing info for the application to present 
+   * to the user.
+   * LATER: formalise this for describing VAMSAS system, a particular 
+   * Vorba client agent, and a particular session.
+   * @return string like VamsasClient v.1.1.1 (GPL) and whatever
+   */
+  public String getAbout();
+  
+  /**
+   * convenience method to get the SessionUrn as a string (for passing directly to a text box...).
+   * @return current SessionUrn
+   */
+    public String getSessionUrn();
+    /**
+     * Returns a valid URN for other applications to connect to 
+     * the vamsas session.
+     * @return session handle for this session.
+     */
+    public SessionHandle getSessionHandle();
+    /**
+     * Included for applications with several ClientHandle 
+     * identities.
+     * @return ClientHandle used to interact with 
+     * other Vamsas applications.
+     */
+    public ClientHandle getClientHandle();
+    /**
+     * 
+     * @return UserHandle used when interacting
+     * with other Vamsas applications.
+     */
+    public UserHandle getUserHandle();
+    /**
+     * Method called by client application on exit. 
+     * Vorba will inform other clients if they exist. 
+     * If this is the last application in the session 
+     * then the session will be closed.
+     * Note: The application should be ready to handle 
+     * 'RequestToCloseDocument' events from the Vorba 
+     * agent in the latter case and so prompt the user 
+     * to save the session locally.
+     * LATER: pick a better name ?
+     */
+    public void finalizeClient();
+    /**
+     * register handler for updates for the current session
+     */
+    public void addDocumentUpdateHandler(PropertyChangeListener evt);
+    /**
+     * get vamsas document with 
+     * user and app specific data
+     * IClientDocuments are not thread-safe.
+     * TODO: New exception for failed document lock.
+     * @throws IOException if lock is not obtainable for the document in the session
+     */
+    public IClientDocument getClientDocument() throws IOException;
+    /**
+     * Queue new Vorba objects for storage and propagation 
+     * to other clients (via Event.DOCUMENT_UPDATE based 
+     * notification of document change)
+     * New objects without provenance information will be 
+     * given a default entry using the IClient's application, 
+     * user (and session) handles
+     * Validity of IClientDocument object instances after this call is implementation dependent
+     * TODO: consider refactoring to remove the redundant IClientDocument parameter for this method
+     */
+    public void updateDocument(IClientDocument newdoc);
+    /**
+     * Any application may call storeDocument to 
+     * save a local copy of the current vamsas document
+     * including all application specific entries.
+     * 
+     * @param location to write zip file
+     */
+    public void storeDocument(java.io.File location);
+    /**
+     * Any application may call importDocument to merge a stored
+     * vamsasDocument into the current session.
+     * Note: use a IClientFactory's implementation to make sessions out of vamsas documnts
+     * LATER: VAMSAS: The IClient implementation will handle all ID 'relocations'
+     * @param location
+     */
+    public void importDocument(java.io.File location);
+    /**
+     * Add a listener to a particular event chain.
+     * See org.vamsas.client.Events for allowed 
+     * values for EventChain.
+     * The EventChain value is passed as the 
+     * propertyName in the java.bean.PropertyChangeEvent
+     * LATER: extend class to form own vamsas Event/Listener model.
+     * @param EventChain Name of event. Blank/null registers handler for all events.
+     * @param evt - event handler function.
+     */
+    public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt);
+    /**
+     * Sets the update handler that will be called when any updates occur to objects of type rootObject.
+     * @param rootObject
+     * @param handler
+     */
+    public void setUpdateHandler(IObjectUpdate handler);
+    public IObjectUpdate getUpdateHandler(Class rootObject);
+    public void removeUpdateHandler(Class rootObject);
+    public IObjectUpdate[] getUpdateHandlers();
+    /**
+     * client application calls this to force the 
+     * Vorba client to check for updates immediately.
+     *
+     */
+    public void pollUpdate();
+    
+    /**
+     * Client application calls this after any pre-session initialization 
+     * (registering of Handlers, etc)
+     * Exceptions are raised for any failures. Any stateful calls to the session prior to
+     * this will result in an implicit call to joinSession - if that results in an exception
+     * then the VamsasClient should raise an Error.
+     * LATER: create VAMSAS exception hierarchy (in a language agnostic manner)
+     */
+    public void joinSession() throws Exception;
+}
diff --git a/src/org/vamsas/client/IClientAppdata.java b/src/org/vamsas/client/IClientAppdata.java
new file mode 100644 (file)
index 0000000..965a783
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+ * 
+ */
+package org.vamsas.client;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+
+/**
+ * Object for accessing Client and User specific data
+ * in an IClientDocument instance. 
+ *
+ */
+public interface IClientAppdata {
+  /**
+   * @return true if Client's non-user specific application data is non-zero length.
+   */
+  boolean hasClientAppdata();
+  /**
+   * @return true if User's Client Application data is non-zero length
+   */
+  boolean hasUserAppdata();
+  /**
+   * 
+   * @return byte array containing the Client's non-user specific application data
+   */
+  byte[] getClientAppdata();
+  /**
+   * 
+   * @return byte array containing the Client's user specific application data
+   */
+  byte[] getUserAppdata();
+  /**
+   * set the non-User-specific application data
+   * @param data - the new non-user-specific data
+   */
+  void setClientAppdata(byte[] data);
+  /**
+   * set the User-specific application data
+   * @param data - the new user-specific data
+   */
+  void setUserAppdata(byte[] data);
+  /**
+   * @return non-user specific data output stream 
+   */
+  DataOutput getClientOutputStream();
+  /**
+   * @return non-user specific data input stream 
+   */
+  DataInput getClientInputStream();
+  /**
+   * 
+   * @return user specific data output stream
+   */
+  DataOutput getUserOutputStream();
+  /**
+   * 
+   * @return user specific data input stream
+   */
+  DataInput getUserInputStream();
+}
diff --git a/src/org/vamsas/client/IClientDocument.java b/src/org/vamsas/client/IClientDocument.java
new file mode 100644 (file)
index 0000000..8db697f
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Created on 13-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client;
+
+import org.vamsas.objects.core.VAMSAS;
+
+
+/**
+ * Defines the API for the Vamsas XML Document 
+ * as accessed by a Vamsas SimpleClient Application.
+ * An instance of this interface is valid for a 
+ * particular set of user, session and application 
+ * handles.
+ * 
+ * It initially represents a snapshot of the 
+ * XML document at a particular time - queriable by 
+ * reference or by retrieval of root objects.
+ * It provides methods to make new Vobject references, 
+ * These are guaranteed to be unique amongst existing 
+ * objects in the document, all other references created 
+ * by this Vobject's instance and all other references 
+ * constructed by any other vamsas agents in the session.
+ * TODO: LATER: finegrained access control for public/private user access
+ * Finegrained access control: Since a clientDocument is created for a particular 
+ * UserHandle, there is scope for fine grain data access 
+ * control based on user identity. 
+ * A user may also want to make private notes, not 
+ * available to other people using the same application 
+ * in the same session.
+ * TODO: LATER: implement a more sophisticated query interface for quickly identifying new data in a vamsas document and manipulating existing objects
+ * @author jimp
+ */
+public interface IClientDocument {
+  
+  /**
+   * Get a single Vobject.
+   * @param id
+   * @return Vobject referred to by id or null if it doesn't exist.
+   */
+  Vobject getObject(VorbaId id);
+  /**
+   * Get a list of objects.
+   * @param ids
+   * @return array of objects using a vector of VorbaId ids.
+   */
+  Vobject[] getObjects(VorbaId[] ids);
+  /**
+   * Returns all root objects in document. All objects inherit 
+   * from org.vamsas.client.Vobject and have valid VorbaIds and provenance entries.
+   * @return array of root Vamsas element objects.
+   */
+  VAMSAS[] getVamsasRoots();
+  /**
+   * set the VAMSAS roots in the document
+   * TODO: decide if objects are verified for provenance and VorbaIds by this call or when document is stored
+   * TODO: decide if this call should throw InvalidVamsasObject exceptions.
+   * TODO: decide how this call deals with applications that 'forget' to include all VAMSAS roots (this is where reference counting/garbage collection happens)
+   * @param roots
+   */
+  void setVamsasRoots(VAMSAS[] roots);
+  /**
+   * Adds a new VAMSAS root entry
+   * TODO: decide on same InvalidVamsasObject exceptions.
+   * TODO: decide if a 'removeVamsasRoot' method is really needed.
+   * @param newroot
+   */
+  void addVamsasRoot(VAMSAS newroot);
+  /**
+   * Returns an Vobject with a valid VorbaId, and provenance element. 
+   * The VorbaId is so the application may refer to it in 
+   * its own dataspace.
+   * 
+   * Note: An Vobject with valid VorbaId will not be reregistered.
+   * Advice: Calling this method for a high-level Vobject 
+   * (such as org.vamsas.objects.core.VAMSAS) will 
+   * register all its component objects too.
+   * 
+   * @param unregistered unregistered vamsas Vobject
+   * @return VorbaId registered for vamsas Vobject
+   */
+  VorbaId registerObject(Vobject unregistered);
+  /**
+   * Returns an array of objects, each with a valid VorbaId
+   * (and completed provenance entry).
+   * Note: An Vobject with valid VorbaId will not be reregistered.
+   * @param unregistered array of unregistered objects.
+   * @return array of VorbaIds for the registered objects
+   */
+  VorbaId[] registerObjects(Vobject[] unregistered);
+  /**
+   * Get instance of Client and User specific vamsas document data access interface.
+   * @return Interface to Client and user specific application data
+   */
+  IClientAppdata getClientAppdata();
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/IClientFactory.java b/src/org/vamsas/client/IClientFactory.java
new file mode 100644 (file)
index 0000000..f9a50b4
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Created on 13-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client;
+
+/**
+ * Defines methods for instantiating Vorba client application agents
+ * @author jimp
+ *
+ * (it's VORBA, not CORBA!)
+ */
+
+public interface IClientFactory {
+
+     /**
+      * Create a new Vorba Session
+      * @param applicationHandle is the application's VAMSAS handle string
+     * @throws NoDefaultSessionException if more than one session exists that the client may connect to
+      */
+       IClient getIClient(ClientHandle applicationHandle) throws NoDefaultSessionException;
+       /**
+        * returns new Vorba for a given session.
+        * @param applicationHandle
+        * @param sessionUrn session to connect to (or null to create a new session)
+        * @return
+        */
+       IClient getIClient(ClientHandle applicationHandle, String sessionUrn);
+       /**
+        * returns new vorba for a  given session acting as a particular identity
+        * @param applicationHandle
+        * @param userId
+        * @param sessionUrn session to connect to (or null to create a new session)
+        * @return
+        */
+       IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn);
+       /**
+        * New session for application and specific user
+        * @param applicationHandle
+        * @param userId
+        * @return
+       * @throws NoDefaultSessionException if more than one session exists that the client may connect to
+        */
+       IClient getIClient(ClientHandle applicationHandle, UserHandle userId) throws NoDefaultSessionException;
+       
+       /**
+        * enumerate the active sessions this IClientFactory instance knows about.
+        * Can be used by caller to pick a session on catching a NoDefaultSessionException.
+        * LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way)
+        * @return possibly empty array of sessionUrn strings
+        */
+       public String[] getCurrentSessions();
+
+}
diff --git a/src/org/vamsas/client/IObjectUpdate.java b/src/org/vamsas/client/IObjectUpdate.java
new file mode 100644 (file)
index 0000000..cda754d
--- /dev/null
@@ -0,0 +1,26 @@
+package org.vamsas.client;\r
+\r
+/**\r
+ * Methods implemented by a Vamsas Application's Object Update handler\r
+ * @author vamsas\r
+ * Introduced November 2006 Vamsas Meeting\r
+ * TODO: verify this is sufficient for the per-object update event mechanism\r
+ */\r
+public interface IObjectUpdate {\r
+  /**\r
+   * Called by the library to find out which vamsas document object this update handler is interested in\r
+   * @return class that extends org.vamsas.Vobject\r
+   */\r
+  Class getRootVobject();\r
+  /**\r
+   * Called to test if this handler is to be called for updates to any Vobjects below the Root Vobject in the vamsas document.\r
+   * @return false means IObjectUpdate.update(updated, cdoc) will only be called with instances of type getRootVobject(). \r
+   */\r
+  boolean handlesSubtreeUpdates();\r
+  /**\r
+   * Method called by Vamsas Client Library for all updated objects that the handler is registered for.\r
+   * @param updated\r
+   * @param cdoc\r
+   */\r
+  void update(org.vamsas.client.Vobject updated, org.vamsas.client.IClientDocument cdoc);\r
+}\r
diff --git a/src/org/vamsas/client/IVorbaIdFactory.java b/src/org/vamsas/client/IVorbaIdFactory.java
new file mode 100644 (file)
index 0000000..ea25e8e
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Created on 14-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client;
+
+/**
+ * @author jimp
+ * middleware interface for generating new VorbaId objects 
+ * for a particular vamsas client based on the current 
+ * session, user and client handle. Generally implemented 
+ * by instances of the vamsas library api only.
+ */
+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(Vobject vobject);
+
+  public abstract SessionHandle getSessionHandle();
+
+  public abstract ClientHandle getClientHandle();
+
+  public abstract UserHandle getUserHandle();
+  /**
+   * called when an object is touched by the vamsas library prior to writing
+   * to record last hash for the object's VorbaId
+   * @param vobject
+   */
+  public abstract void updateHashValue(Vobject vobject);
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/Iapp.java b/src/org/vamsas/client/Iapp.java
new file mode 100644 (file)
index 0000000..381e22b
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * org.vamsas.client.Iapp
+ */
+package org.vamsas.client;
+public interface Iapp {
+    /**
+     * Define core callback functionality that a fully 
+     * fledged vamsas application Vobject must implement
+     * TODO: define some Application Callbacks and create use cases for them
+     */
+
+};
diff --git a/src/org/vamsas/client/InvalidSessionUrnException.java b/src/org/vamsas/client/InvalidSessionUrnException.java
new file mode 100644 (file)
index 0000000..d1863a8
--- /dev/null
@@ -0,0 +1,38 @@
+package org.vamsas.client;
+
+public class InvalidSessionUrnException extends Exception {
+
+  /**
+   * 
+   */
+  public InvalidSessionUrnException() {
+    super("Invalid Vamsas Session URN.");
+    // TODO Auto-generated constructor stub
+  }
+
+  /**
+   * @param message
+   * @param cause
+   */
+  public InvalidSessionUrnException(String message, Throwable cause) {
+    super(message, cause);
+    // TODO Auto-generated constructor stub
+  }
+
+  /**
+   * @param message
+   */
+  public InvalidSessionUrnException(String message) {
+    super("Invalid Vamsas Session URN: "+message);
+    // TODO Auto-generated constructor stub
+  }
+
+  /**
+   * @param cause
+   */
+  public InvalidSessionUrnException(Throwable cause) {
+    super(cause);
+    // TODO Auto-generated constructor stub
+  }
+
+}
diff --git a/src/org/vamsas/client/NoDefaultSessionException.java b/src/org/vamsas/client/NoDefaultSessionException.java
new file mode 100644 (file)
index 0000000..bfee0e6
--- /dev/null
@@ -0,0 +1,46 @@
+/**
+ * 
+ */
+package org.vamsas.client;
+
+/**
+ * @author jimp
+ * Raised if an IClient instance is requested without 
+ * specifying a particular vamsas session handle 
+ * when more than one candidate session exists.
+ */
+public class NoDefaultSessionException extends Exception {
+
+  /**
+   * 
+   */
+  public NoDefaultSessionException() {
+    super("No Default Session Defined");
+   }
+
+  /**
+   * @param message
+   */
+  public NoDefaultSessionException(String message) {
+    super(message);
+    // TODO Auto-generated constructor stub
+  }
+
+  /**
+   * @param cause
+   */
+  public NoDefaultSessionException(Throwable cause) {
+    super(cause);
+    // TODO Auto-generated constructor stub
+  }
+
+  /**
+   * @param message
+   * @param cause
+   */
+  public NoDefaultSessionException(String message, Throwable cause) {
+    super(message, cause);
+    // TODO Auto-generated constructor stub
+  }
+
+}
diff --git a/src/org/vamsas/client/SessionHandle.java b/src/org/vamsas/client/SessionHandle.java
new file mode 100644 (file)
index 0000000..736fee3
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Created on 12-Sep-2005
+ *
+ */
+package org.vamsas.client;
+
+/**
+ * Uniquely locates a particular VAMSAS session.
+ * @author jimp
+ *
+ */
+public class SessionHandle {
+  
+  /**
+   * @param sessionUrn
+   */
+  public SessionHandle(String sessionUrn) {
+    super();
+    SessionUrn = sessionUrn;
+  }
+  /**
+   * @return Returns the sessionUrn.
+   */
+  public String getSessionUrn() {
+    return SessionUrn;
+  }
+  /**
+   * @param sessionUrn The sessionUrn to set.
+   */
+  public void setSessionUrn(String sessionUrn) {
+    SessionUrn = sessionUrn;
+  }
+  /**
+   * The path to the vamsas session file.
+   */
+  String SessionUrn;
+
+}
diff --git a/src/org/vamsas/client/SessionUrn.java b/src/org/vamsas/client/SessionUrn.java
new file mode 100644 (file)
index 0000000..4eff113
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * 
+ */
+package org.vamsas.client;
+
+import java.net.URI;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * @author jimp
+ * base class for vamsas session/document types
+ * uses java.net.URI internally for construction of URN
+ */
+public abstract class SessionUrn {
+  protected URI urn;
+  /**
+   * The types of URI protocols we understand
+   */
+  protected static final Hashtable TYPES=new Hashtable();
+  
+  /**
+   * construct urn for a locally stored session file
+   * @param type
+   * @param url
+   */
+  protected SessionUrn(String type, java.net.URL url) {
+    if (!TYPES.containsKey(type.toLowerCase()))
+      throw new Error("Unknown "+this.getClass().getName()+" type '"+type+"' for URL '"+url+"'");
+    try {
+      urn = URI.create(type+"://"+url.getPath());
+    } catch (Exception e) {
+      // TODO: something better than throwing an error should be done here.
+      throw new Error(e);
+    }
+  }
+  public String getSessionUrn() {
+    return urn.toString();
+  }
+}
diff --git a/src/org/vamsas/client/UserHandle.java b/src/org/vamsas/client/UserHandle.java
new file mode 100644 (file)
index 0000000..8bfe16c
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Created on 12-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client;
+
+/**
+ * Unique user identifier for a vamsas session. 
+ * Used to write user provenance information, and 
+ * track view/access control in multiuser sessions.
+ * @author jimp
+ */
+public class UserHandle {
+  /**
+   * @param fullName
+   * @param organization
+   */
+  public UserHandle(String fullName, String organization) {
+    this.fullName = fullName;
+    Organization = organization;
+  }
+  String fullName;
+  String Organization;
+  /**
+   * @return Returns the fullName.
+   */
+  public String getFullName() {
+    return fullName;
+  }
+  /**
+   * @param fullName The fullName to set.
+   */
+  public void setFullName(String fullname) {
+    fullName = fullname;
+  }
+  /**
+   * @return Returns the organization.
+   */
+  public String getOrganization() {
+    return Organization;
+  }
+  /**
+   * @param organization The organization to set.
+   */
+  public void setOrganization(String organization) {
+    Organization = organization;
+  }
+}
diff --git a/src/org/vamsas/client/Vobject.java b/src/org/vamsas/client/Vobject.java
new file mode 100644 (file)
index 0000000..d7bd6eb
--- /dev/null
@@ -0,0 +1,464 @@
+/**
+ * 
+ */
+package org.vamsas.client;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.exolab.castor.mapping.FieldDescriptor;
+import org.exolab.castor.mapping.FieldHandler;
+import org.exolab.castor.xml.util.XMLClassDescriptorImpl;
+import org.vamsas.test.simpleclient.VamsasArchive;
+
+/**
+ * Base class for all Vamsas objects extracted from an IClientDocument. An
+ * Vobject maybe registered or unregistered.
+ * 
+ * @author jimp
+ * 
+ */
+public abstract class Vobject {
+  static Log log = LogFactory.getLog(Vobject.class);
+  
+  /**
+   * true if Vobject was stored in a vamsas Document or has been retrieved from it
+   */
+  protected boolean __stored_in_document = false;
+  /**
+   * true if Vobject was updated since the vamsas library last read a Vobj with the same VorbaId from a document.
+   */
+  protected boolean __updated_since_last_read = false;
+  /**
+   * memory of the last doHash() value computed for the Vobject 
+   * @see doHash()
+   */
+  protected int __last_hash = 0; 
+  /**
+   * set by testInstanceForIdField() if Vobject should have a VorbaId
+   */
+  protected boolean registerable = false; 
+  protected boolean __visited = false;
+  /**
+   * reference to containing object for this Vobject.
+   */
+  protected Vobject V_parent=null;
+  /**
+   * unique id for all vamsas objects allows unambiguous referencing to any
+   * Vobject in the vamsas document
+   */
+  protected VorbaId vorbaId = null;
+
+  /**
+   * the source of unique VorbaIds.
+   */
+  protected IVorbaIdFactory __vorba = null;
+  
+  /* (non-Javadoc)
+   * @see java.lang.Object#finalize()
+   */
+  protected void finalize() throws Throwable {
+    V_parent=null;
+    __vorba=null;
+    vorbaId=null;
+    super.finalize();
+  }
+
+  /**
+   * 
+   */
+  protected Vobject() {
+    super();
+    testInstanceForIdField();
+  }
+  java.lang.reflect.Field ___id_field=null; // set to ease pain of reflection
+  /**
+   * set the isRegisterable flag based on the presence of a 'private String _id' field in
+   * the reflected class instance.
+   */
+  private void testInstanceForIdField() {
+    // TODO: decide if 'id' is an appropriate reserved attribute name for the VorbaId
+    // look for the id field in all castor classes (should be an NCName string)
+    
+    Class thisclass=this.getClass();
+    setRegisterable(false);
+    while (!thisclass.equals(Vobject.class)) {
+      try {
+        java.lang.reflect.Field fd = thisclass.getDeclaredField("_id");
+        if (String.class.isAssignableFrom(fd.getType())) {
+          ___id_field=fd;
+          this.setRegisterable(true);
+          break;
+        }
+      } catch (SecurityException e) {
+        log.error("Unexpected Security Exception whilst finding id fields to set!",e);
+      } catch (NoSuchFieldException e) {
+        thisclass=thisclass.getSuperclass();
+      }
+    }
+  }
+  // boolean __testedInstance=false;
+  /**
+   * update the Vobject instance's _id field, based on the contents of the
+   * VorbaId. Only call this if you mean to do it!
+   */
+  protected void setInstanceIdField() {
+    /*if (!registerable && !__testedInstance) {
+      testInstanceForIdField();
+      __testedInstance=true;
+    }*/
+    if (registerable) {
+      if (__vorba != null)
+        try {
+          Method fd = this.getClass().getMethod("setId", new Class[] { String.class });
+          fd.invoke((Object) this, new Object[] {new String(this.getVorbaId().id)});
+          log.debug(this.getClass().getName()+" called setInstanceIdField!");
+        } catch (InvocationTargetException e) { 
+          log.error("SourceGeneration of "
+              + this.getClass().toString()
+              + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e);
+        }
+        catch (IllegalAccessException e) {
+          log.error("SourceGeneration of "
+                  + this.getClass().toString()
+                  + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId Vobject.", e);
+        } catch (SecurityException e) {
+          log.error("Security access violation for "+this.getClass().toString(),e);
+        } catch (NoSuchMethodException e) {
+          log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)");
+          this.setRegisterable(false);
+        }
+    } else {
+      System.err.println("Client error. Trying to setInstanceIdField on a "
+          + this.getClass().toString() + " (which cannot be given a vorbaId)");
+    }
+  }
+  
+  protected String __getInstanceIdField() {
+    /*if (!registerable && !__testedInstance) {
+      testInstanceForIdField();
+      __testedInstance=true;
+    }*/
+    if (registerable) {
+      if (__vorba != null)
+        try {
+          Method fd = this.getClass().getMethod("getId", (Class[]) null);
+          Object idstring = fd.invoke((Object) this, (Object[]) null);
+          log.debug(this.getClass().getName()+" called getInstanceIdField!");
+          if (idstring!=null && idstring instanceof String) {
+            if (((String) idstring).length()>0)
+              return (String) idstring;
+          }
+        } catch (InvocationTargetException e) { 
+          log.error("SourceGeneration of "
+              + this.getClass().toString()
+              + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e);
+        }
+        catch (IllegalAccessException e) {
+          log.error("SourceGeneration of "
+                  + this.getClass().toString()
+                  + "\n has resulted in an inaccessible 'getId' method!\nCannot set ID from the vorbaId Vobject.", e);
+        } catch (SecurityException e) {
+          log.error("Security access violation for "+this.getClass().toString(),e);
+        } catch (NoSuchMethodException e) {
+          log.warn(this.getClass().toString()+" was erroneously marked as a Vorba Vobject class (Implementation error?)");
+          this.setRegisterable(false);
+        }
+    } else {
+      System.err.println("Client error. Trying to getInstanceIdField on a "
+          + this.getClass().toString() + " (which cannot be given a vorbaId)");
+    }
+    return null;
+  }
+
+  /**
+   * calculate a hash for the Vobject with all housekeeping fields at standard
+   * values. (isRegisterable is an immutable attribute property)
+   * TODO: decide if __stored_in_document should be included in the hash or not.
+   * @return true if new hash different to last hash
+   */
+  synchronized protected boolean doHash() {
+    long __old_hash = __last_hash;
+    __last_hash = 0;
+    Vobject _V_parent=V_parent;
+    V_parent=null;
+    VorbaId thisid = vorbaId;
+    IVorbaIdFactory factory = __vorba;
+    boolean stored = __stored_in_document;
+    boolean updated = __updated_since_last_read;
+    boolean visited = __visited;
+    java.lang.reflect.Field idfield = ___id_field;
+    ___id_field=null;
+    __updated_since_last_read=false;
+    vorbaId = null;
+    __vorba = null;
+    __visited=false;
+    // compute hash
+    __last_hash = this.hashCode();
+    // reset houseskeeping variables
+    ___id_field=idfield;
+    vorbaId = thisid;
+    __vorba = factory;
+    __stored_in_document = stored;
+    __updated_since_last_read=updated;
+    V_parent=_V_parent;
+    __visited=visited;
+    return (__old_hash==0) || (__old_hash == __last_hash);
+  }
+
+  /**
+   * TODO: combine two versions of the same collection Vobject to resolve
+   * asynchronous updates to the same vamsas Vobject Merges two vamsas objects,
+   * one of which is a later version of the earlier (ie they have the same
+   * vorbaId but one is a later version recently read from the vamsasDocument
+   * collection.
+   * 
+   * @return
+   */
+  protected boolean merge(Vobject laterCopy) {
+    log.warn(this.getClass().getName()+".merge() not implemented.");
+    return true;
+  }
+
+  /**
+   * 
+   * @return true if Vobject is registered
+   */
+  public boolean isRegistered() {
+    return (registerable) ? (vorbaId != null) : false;
+  }
+
+  /**
+   * Method to get fixed reference for the Vobject in the vamsas document.
+   * 
+   * @returns null if Vobject is neither registered or not associated with a
+   *          properly instantiated VorbaIdFactory.
+   */
+  public VorbaId getVorbaId() {
+    if (registerable && vorbaId == null) {
+      if (this.__stored_in_document) {
+        if (__vorba!=null)
+          vorbaId=org.vamsas.client.VorbaId.newId(this.__getInstanceIdField());
+      }
+      // Try to use the associated factory.
+      if (__vorba != null)
+        if ((vorbaId = __vorba.makeVorbaId(this)) == null)
+          return null; // Factory not valid.
+        else {
+          this.setInstanceIdField();
+          return vorbaId;
+        }
+    }
+    return vorbaId;
+  }
+
+  /**
+   * used by the IClient implementation to generate unique Id based on client
+   * applications current namespace.
+   */
+  protected void setVorbaId(VorbaId newid) {
+    vorbaId = newid;
+  }
+
+  /**
+   * @return true if Vobject is present in Vamsas Document.
+   */
+  public boolean is__stored_in_document() {
+    return __stored_in_document;
+  }
+
+  /**
+   * @return true if this object has been updated in the currently stored document since the last time a Vobject with the same ID was read from a Vamsas Document
+   */
+  public boolean is__updated_since_last_read() {
+    return __updated_since_last_read;
+  }
+
+  /**
+   * Set internal flag to indicate this object was updated since the last document read
+   * @param __updated_since_last_read the __updated_since_last_read to set
+   */
+  protected void set__updated_since_last_read(boolean __updated_since_last_read) {
+    this.__updated_since_last_read = __updated_since_last_read;
+  }
+
+  /**
+   * for use by Vorba agent to reflect state of vamsas Vobject to client
+   * application.
+   * Setting stored_in_document on a registerable Vobject without a 
+   * vorbaId will mean is will *never* get a vorbaId and 
+   * horrible things will happen.
+   * @param __stored_in_document true if Vobject has been marshalled into current document.
+   */
+  protected void set__stored_in_document(boolean __stored_in_document) {
+    this.__stored_in_document = __stored_in_document;
+  }
+
+  /**
+   * __last_hash is the hash value computed when the Vobject was last checked
+   * against a IClientDocument generated by the Vobject's parent IClient
+   * instance.
+   * 
+   * @return Returns the __last_hash.
+   */
+  public int get__last_hash() {
+    return __last_hash;
+  }
+
+  /**
+   * @return true if Vobject can have a vorbaId
+   */
+  public boolean isRegisterable() {
+    return registerable;
+  }
+
+  /**
+   * Called by __testInstanceForidField and the post-unmarshalling handler
+   * to indicate if Vobject will have a vorbaId.
+   * @param registerable 
+   */
+  protected void setRegisterable(boolean registerable) {
+    this.registerable = registerable;
+  }
+  /**
+   * ensure's internal id field corresponds to vorbaId and
+   * cascade through all fields referring to an instance of Vobject
+   * calling the same method on them.
+   * TODO: LATER: properly apply castors own field mechanisms to get at accessors
+   * TODO: FIX CYCLIC __ensure+instance_ids
+   * Implementation note for the todo:
+   * this works like a depth-first search over all vamsas objects in an vamsasDocument. 
+   * __visited is the visited flag, any Vobj who's flag is of a different parity 
+   * to the visited argument will be recursed on. 
+   * note - the doHash() function used to be used as the 'visited' flag - 
+   * this *is not* a valid heuristic, although it will work "most of the time".
+   * TODO: LATER? Add another method for setDefaultProvenanceField (in the spirit of setInstanceIdField) using the info from the __vorba.getClient/User/Session methods 
+   */
+  protected void __ensure_instance_ids() {
+    __ensure_instance_ids(!__visited);
+  }
+  protected void __ensure_instance_ids(boolean visited) {
+    if (__vorba==null)
+      throw new Error("Improperly intialised org.vamsas.client.Vobject - no VorbaFactory given.");
+    log.debug("doing "+this.getClass()+".__ensure_instance_ids()");
+    if (!__stored_in_document && registerable)
+      setInstanceIdField();
+    if (__visited==visited)
+      return;
+    __visited=visited;
+    __vorba.updateHashValue(this);
+    
+    Class descriptor = null;
+    XMLClassDescriptorImpl descimpl = null;
+    try {
+      // castor descriptor resolver magic
+      descriptor = this.getClass().getClassLoader().loadClass(this.getClass().getName()+"Descriptor");
+      descimpl = (XMLClassDescriptorImpl) descriptor.getConstructor((Class[])null).newInstance((Object[])null);
+    } catch (Exception e) {
+      log.fatal("Source Generation Error!: Couldn't resolve descriptor for "
+          +this.getClass().getName()
+          +" was 'generate descriptors' set for castorbuilder.properties?");
+      return;
+    }
+    FieldDescriptor fields[] = descimpl.getFields();
+    for (int i=0,j=fields.length; i<j; i++) {
+      Class type= fields[i].getFieldType();
+      if (type.isArray()) {
+        if (Vobject[].class.isAssignableFrom(type)) {
+          try {
+            Object val = fields[i].getHandler().getValue(this);
+            if (val!=null) {
+              Vobject vals[] = (Vobject[]) val; 
+              for (int k=0, l=vals.length; k<l; k++) {
+                if (vals[k].__vorba==null)
+                  vals[k].__vorba = __vorba; // propagate IVorbaIdFactory
+                if (vals[k].V_parent==null)
+                  vals[k].V_parent=this; // propagate parent reference to this element.
+                vals[k].__ensure_instance_ids(visited);
+              }
+            }
+          }
+          catch (Exception e) {
+            log.error("Client error - could not access array "+type.getName()+" in "+this.getClass().getName(), e);
+          }
+        }
+      } else
+        if (Vobject.class.isAssignableFrom(type)) {
+          try {
+            FieldHandler fh = fields[i].getHandler();
+            Vobject rf = null;
+            if (fh != null) {
+              Object fval = fh.getValue(this);
+              if (fval!=null) {
+                if (fval.getClass().isArray()) {
+                  //if (Vobject[].class.isAssignableFrom(type)) {
+                    try {
+                      Vobject vals[] = (Vobject[]) fval; 
+                      for (int k=0, l=vals.length; k<l; k++) {
+                        if (vals[k].__vorba==null)
+                          vals[k].__vorba = __vorba; // propagate IVorbaIdFactory
+                        if (vals[k].V_parent==null)
+                          vals[k].V_parent=this; // propagate parent reference to this field object
+                        vals[k].__ensure_instance_ids(visited);
+                      }
+                    }
+                    catch (Exception e) {
+                      log.error("Client error - could not access (fhval)array "+type.getName()+" in "+this.getClass().getName(), e);
+                    }
+                  //}
+                } else {
+                  rf = (Vobject) fval;
+                  log.debug("Got value for "+fields[i].getFieldName());
+                }
+              }
+            } else {
+              // castor's mechanism doesn't work for this object... so...*/
+              // fuck around, fuck around, jump up jump up and get down! */
+              Object o = fields[i].getClassDescriptor();
+              if (o!=null) {
+                // XMLClassDescriptorImpl fclasdes = (XMLClassDescriptorImpl) o;
+                String methname = "get"+fields[i].getFieldName();
+                Method fgetmeth = this.getClass().getMethod(methname,(Class[])null);
+                if (fgetmeth!=null) {
+                  Object fval = fgetmeth.invoke(this,(Object[])null);
+                  if (fval!=null)
+                    rf = (Vobject) fval;
+                } else {
+                  log.warn("Couldn't find "+this.getClass().getName()+"."+methname);
+                }
+              }
+            }
+            if (rf!=null) {
+              if (rf.__vorba==null)
+                rf.__vorba = __vorba; // propagate IVorbaIdFactory
+              if (rf.V_parent==null)
+                rf.V_parent=this; // propagate parent reference
+             rf.__ensure_instance_ids(visited);
+            }
+          }
+          catch (Exception e) {
+            log.error("Client error - could not access "+type.getName()+" in "+this.getClass().getName(), e);
+          }
+        }
+    }
+    
+  }
+
+  /**
+   * @return the __parent
+   */
+  public Vobject getV_parent() {
+    return V_parent;
+  }
+
+  /**
+   * @param __parent the __parent to set
+   */
+  protected void setV_parent(Vobject V_parent) {
+    this.V_parent = V_parent;
+  }
+}
diff --git a/src/org/vamsas/client/Vobjhash.java b/src/org/vamsas/client/Vobjhash.java
new file mode 100644 (file)
index 0000000..116e2ff
--- /dev/null
@@ -0,0 +1,25 @@
+package org.vamsas.client;\r
+\r
+/**\r
+ * Holds information about Vobj instances that is held over between different writes to the document.\r
+ * @author JimP\r
+ *\r
+ */\r
+public class Vobjhash {\r
+  int hashvalue;\r
+  /**\r
+   * creates a record of the hash value for a vamsas document object\r
+   * @param tobemarshalled\r
+   */\r
+  public Vobjhash(Vobject tobemarshalled) {\r
+    hashvalue = tobemarshalled.get__last_hash();\r
+  }\r
+  /**\r
+   * compares the old hash value with the unmarshalled object's most recently computed hash value.\r
+   * @param unmarshalled\r
+   * @return true if the hash values differ\r
+   */\r
+  public boolean isUpdated(Vobject unmarshalled) {\r
+    return hashvalue==unmarshalled.get__last_hash();\r
+  }\r
+}\r
diff --git a/src/org/vamsas/client/VorbaId.java b/src/org/vamsas/client/VorbaId.java
new file mode 100644 (file)
index 0000000..fb87ca8
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Created on 12-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client;
+
+/**
+ * The unique reference id for a Vamsas document Vobject,
+ * used by applications to refer to the vamsas Vobject
+ * within their own data space in the vamsas document.
+ * TODO: decide if VorbaId should contain a reference 
+ * to either the IVorbaIdFactory that made it or the 
+ * IClient that defines the session (it might be 
+ * convenient).
+ * @author jimp
+ */
+public class VorbaId {
+  protected String id;
+  protected VorbaId() {
+    super();
+  }
+  private VorbaId(String Id) {
+    super();
+    id = Id;
+  }
+  /**
+   * 
+   * @param vorbaObject the source of vorba Ids
+   * @param vobject the Vobject to be registered with a new vorba id
+   * @return
+   */
+  protected static VorbaId newId(IVorbaIdFactory vorbaObject, Vobject vobject) {
+    // Make unique id from appSpace info in vorbaObject
+    synchronized (vorbaObject) {
+      vobject.vorbaId=vorbaObject.makeVorbaId(vobject);
+      return vobject.vorbaId;
+    }
+  }
+  protected static VorbaId newId(String id) {
+    return new VorbaId(id);
+  }
+  /**
+   * @return Returns the id.
+   */
+  public String getId() {
+    return id;
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Object#equals(java.lang.Object)
+   */
+  public boolean equals(Object obj) {
+    if (obj instanceof String)
+      return id.equals(obj);
+    else if (obj instanceof VorbaId)
+      return id.equals(((VorbaId)obj).id);
+    return false;
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Object#hashCode()
+   */
+  public int hashCode() {
+    return id.hashCode();
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Object#toString()
+   */
+  public String toString() {
+    return id;
+  }
+  
+}
diff --git a/src/org/vamsas/client/VorbaIdFactory.java b/src/org/vamsas/client/VorbaIdFactory.java
new file mode 100644 (file)
index 0000000..b601dba
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Created on 12-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.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 org.vamsas.client.IVorbaIdFactory#updateHashValue(org.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();
+}
diff --git a/src/org/vamsas/client/VorbaXmlBinder.java b/src/org/vamsas/client/VorbaXmlBinder.java
new file mode 100644 (file)
index 0000000..556386d
--- /dev/null
@@ -0,0 +1,241 @@
+/**
+ * 
+ */
+package org.vamsas.client;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.exolab.castor.mapping.FieldHandler;
+import org.exolab.castor.mapping.GeneralizedFieldHandler;
+import org.exolab.castor.mapping.ValidityException;
+import org.exolab.castor.xml.IDResolver;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.MarshalListener;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.UnmarshalListener;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.vamsas.objects.core.VamsasDocument;
+/**
+ * Implements the Vamsas Vobject ID machinery for translating 
+ * between non-volatile XML IDs and Vobject references. Use the
+ * marshalling and unmarshalling methods in this class in order
+ * to add automatically computed values for required fields in objects,
+ * so as to avoid validation exceptions when marshalling new objects
+ * into the vamsas document.
+ */
+public class VorbaXmlBinder implements UnmarshalListener {
+  private static Log log = LogFactory.getLog(VorbaXmlBinder.class);
+  private final IVorbaIdFactory vorbafactory;
+
+  private final Vector obj;
+  private final Hashtable oldobjhashes;
+  private final Hashtable objrefs;
+  private final Vector updatedobjs;
+  
+  public VorbaXmlBinder(IVorbaIdFactory vorbafactory, Vector obj, Hashtable objrefs, Hashtable oldobjhashes, Vector updatedobjs) {
+    this.vorbafactory = vorbafactory;
+    this.obj = obj;
+    this.objrefs = objrefs;
+    this.oldobjhashes = oldobjhashes;
+    this.updatedobjs = updatedobjs;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.exolab.castor.xml.UnmarshalListener#attributesProcessed(java.lang.Object)
+   */
+  public void attributesProcessed(Object object) {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.exolab.castor.xml.UnmarshalListener#fieldAdded(java.lang.String,
+   *      java.lang.Object, java.lang.Object)
+   */
+  public void fieldAdded(String fieldName, Object parent, Object child) {
+    if (parent instanceof Vobject && child instanceof Vobject) {
+      if (((Vobject) child).V_parent==null) {
+        // System.err.println("Setting parent of "+fieldName);
+        ((Vobject) child).setV_parent((Vobject) parent);
+      }
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.exolab.castor.xml.UnmarshalListener#initialized(java.lang.Object)
+   */
+  public void initialized(Object object) {
+  }
+  
+  /*
+   * Check if the object has an 'id' field - if it does, copy the value into
+   * the VorbaId field of Vobject, and add the Vobject to the VorbaId hash.
+   * 
+   * @see org.exolab.castor.xml.UnmarshalListener#unmarshalled(java.lang.Object)
+   */
+  public void unmarshalled(Object newobj) {
+    if (newobj instanceof Vobject) {
+      Vobject nobj = (Vobject) newobj;
+      nobj.set__stored_in_document(true);
+      try {
+        if (nobj.isRegisterable() && nobj.___id_field!=null) {
+          VorbaId nobj_id=null;
+          // look for the id field (should be an NCName string)
+          nobj.__vorba = vorbafactory;
+          // use the Vobject accessor method to avoid unpleasant security exceptions.
+          String idstring = nobj.__getInstanceIdField();
+          if (idstring!=null) { 
+            if (idstring.length() > 0) {
+              nobj.setVorbaId(VorbaId.newId(idstring));
+              if (objrefs.containsKey(nobj_id=nobj.getVorbaId()) && !objrefs.get(nobj.getVorbaId()).equals(nobj)) {
+                System.err.println("Serious problem : duplicate id '"+idstring+"' found! expect badness.");
+                // TODO: HANDLE duplicate XML ids correctly
+              }
+              objrefs.put(nobj_id, nobj);
+            } else {
+              // add to list of objects without a valid vorbaId
+              obj.add(nobj);
+            }
+          } else {
+            // TODO: add to list of objects without a valid vorbaId
+            obj.add(nobj);
+          }
+          
+        nobj.doHash();
+        // check to see if new object was present in old object hash
+        if (oldobjhashes.containsKey(nobj.getVorbaId())) {
+          Vobjhash oldhash = (Vobjhash) oldobjhashes.get(nobj.getVorbaId());
+          if (oldhash.isUpdated(nobj)) {
+            // mark the object as updated in this document read.
+            nobj.set__updated_since_last_read(true);
+            oldobjhashes.put(nobj_id, new Vobjhash(nobj));
+            updatedobjs.addElement(nobj);
+          }
+        }
+      }
+      } catch (Exception e) {
+        return;
+      };
+      
+    }
+  }
+
+  /**
+   * writes the VamsasDocument to the given stream.
+   * TODO: ensure that (at least) default provenance entries are written for objects.
+   * @param outstream
+   * @param vorba valid VorbaIdFactory to construct any missing IDs 
+   * @param doc
+   * @throws IOException
+   * @throws MarshalException
+   * @throws ValidationException
+   */
+  public static void putVamsasDocument(PrintWriter outstream, VorbaIdFactory vorba, VamsasDocument doc)
+      throws IOException, MarshalException, ValidationException {
+    // Ensure references
+    if (vorba==null)
+      throw new Error("Null VorbaIdFactory Parameter");
+    if (doc.__vorba==null)
+      doc.__vorba = vorba;
+    doc.__ensure_instance_ids(); // this may take a while. Do we allow for cyclic references ? 
+    doc.marshal(outstream);
+    
+  }
+  /**
+   * creates new VorbaId references where necessary for newly unmarshalled objects
+   * @param unrefed
+   * @param objrefs
+   * @return false if any new object references were made
+   */
+  private static boolean ensure_references(Vector unrefed, Hashtable objrefs) {
+    boolean sync=true;
+    if (unrefed.size()>0) {
+      sync=false; // document is out of sync - ids have been created.
+      java.util.Iterator newobj = unrefed.listIterator();
+      while (newobj.hasNext()) {
+        Vobject o = (Vobject) newobj.next();
+        // forces registration and id field update.
+        VorbaId id = o.getVorbaId();
+        if (!objrefs.containsKey(id)) {
+          objrefs.put(id, o);
+        } else {
+          if (!objrefs.get(id).equals(o))
+            throw new Error("Serious! Duplicate reference made by vorbaIdFactory!");
+        }
+      }
+    }
+    return sync;
+  }
+  /**
+     * Unmarshals a vamsasDocument Vobject from a stream, registers
+     * unregistered objects, records existing VorbaIds, and completes 
+     * the org.vamsas.client.Vobject housekeeping fields.
+     * For a valid unmarshalling, the array of returned objects also includes
+     * a <return>sync</return> parameter which is true if new VorbaIds
+     * were created. If sync is false, then the caller should ensure that the
+     * vamsasDocument is written back to disk to propagate the new VorbaIds.
+     *  TODO: ensure that provenance is correct for newly registered objects
+     * as getVamsasObjects but will detect updated objects based on differing hash values
+     * obtained from the VorbaIdFactory's VorbaId, Vobject.get__last_Hash() pairs (if any) 
+     * @param instream - the XML input stream 
+   * @param factory - the SimpleClient's properly configured VorbaId factory to make new references.
+   * @param root the root element's org.vamsas.objects.core Vobject.
+     * @return null or {(Object) VamsasDocument Vobject, (Object) Hashtable of Vobject references, (Object) Boolean(sync), (Object) Vector of updated objects in document }
+     */
+  public static Object[] getVamsasObjects(Reader instream,
+        VorbaIdFactory factory, Vobject root) {  
+    Unmarshaller unmarshaller = new Unmarshaller(root);
+      unmarshaller.setIDResolver(new IDResolver() {
+        public Object resolve(String id) {
+          VorbaXmlBinder.log.warn("Warning - id " + id
+              + " is not found in the Vamsas XML!");
+          return null;
+        }
+      });
+      final Hashtable objrefs = new Hashtable();
+      if (factory.extanthashv==null)
+        factory.extanthashv=new Hashtable();
+      final Hashtable oobjhashes=factory.extanthashv;
+      final VorbaIdFactory vorbafactory = factory;
+      final Vector unrefedObj =  new Vector();
+      final Vector updatedObj = new Vector();
+      unmarshaller.setUnmarshalListener(new VorbaXmlBinder(vorbafactory, unrefedObj, objrefs, oobjhashes, updatedObj));
+      // Call the unmarshaller.
+      try {
+        while (instream.ready()) {
+          // TODO: mark objects in oobjhash prior to unmarshalling, to detect when objects have been lost through an update.
+          //tohere
+          Object obj = unmarshaller.unmarshal(instream);
+          boolean sync=ensure_references(unrefedObj, objrefs);
+          if (!(obj instanceof Vobject))
+            return null;
+          vorbafactory.setNewIdHash(objrefs); // update the Document IO Handler's set of vorbaId<>Object bindings.
+          return new Object[] { obj, objrefs, new Boolean(sync),updatedObj};
+          }
+      } catch (MarshalException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace();
+      } catch (ValidationException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace();
+      } catch (IOException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace();
+      }
+      return null;
+    }
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/picking/PickEndPoint.java b/src/org/vamsas/client/picking/PickEndPoint.java
new file mode 100644 (file)
index 0000000..7a464f1
--- /dev/null
@@ -0,0 +1,101 @@
+package org.vamsas.client.picking;\r
+\r
+import java.io.*;\r
+import java.net.*;\r
+\r
+class PickEndPoint extends Thread\r
+{\r
+       private Socket socket;\r
+       private int rPort;\r
+       private BufferedWriter os;\r
+       private BufferedReader in;\r
+\r
+       private PickManager manager;    \r
+       \r
+       PickEndPoint(PickManager manager, Socket s)\r
+       {\r
+               this.manager = manager;\r
+               socket = s;\r
+       }\r
+       \r
+       boolean openConnection()\r
+       {\r
+               try\r
+               {\r
+                       // Create the socket if it doesn't already exist\r
+                       if (socket == null)\r
+                               socket = new Socket(InetAddress.getLocalHost(), PickServer.PORT);\r
+                       \r
+                       rPort = socket.getPort();\r
+                       socket.setKeepAlive(true);\r
+                                               \r
+                       // Open the streams for reading/writing\r
+                       os = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));\r
+                       in = new BufferedReader(new InputStreamReader(socket.getInputStream()));\r
+               \r
+                       // Start the thread to listen for incoming messages\r
+                       System.out.println("CLIENT: connection successful to port "\r
+                               + socket.getPort() + " via port " + socket.getLocalPort());\r
+                       start();\r
+                       \r
+                       return true;\r
+               }\r
+               catch (Exception e)\r
+               {\r
+                       System.out.println("CLIENT: connection failed: " + e);\r
+                       return false;\r
+               }\r
+       }\r
+       \r
+       void send(String str)\r
+       {\r
+               try\r
+               {\r
+                       System.out.println("CLIENT: send " + str + " to " + rPort);\r
+                       os.write(str);\r
+                       \r
+                       // We use a newline to terminate the message\r
+                       os.newLine();\r
+                       os.flush();\r
+               }\r
+               catch (Exception e)\r
+               {\r
+                       System.out.println("CLIENT: failed to send");\r
+                       \r
+                       // TODO: terminate the connection on a failed send or retry?\r
+                       terminate();\r
+               }\r
+       }\r
+       \r
+       // void receive() (threaded)\r
+       public void run()\r
+       {\r
+               try\r
+               {\r
+                       while (true)\r
+                       {\r
+                               String str = in.readLine();                             \r
+                               System.out.println("CLIENT: recv " + str + " from " + rPort);\r
+                               \r
+                               manager.handleMessage(this, str);\r
+                       }\r
+               }\r
+               catch (Exception e)\r
+               {\r
+                       // Means the other end of the connection has (probably died) so we need\r
+                       // terminate this endpoint (if this is server side)\r
+                       System.out.println("CLIENT: read failed: " + e);\r
+                                               \r
+                       terminate();\r
+               }\r
+       }\r
+       \r
+       private void terminate()\r
+       {\r
+               try { socket.close(); }\r
+               catch (IOException e) {}\r
+               \r
+               System.out.println("CLIENT: closing connection to port " + socket.getPort());\r
+               manager.removeEndPoint(this);\r
+       }\r
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/picking/PickManager.java b/src/org/vamsas/client/picking/PickManager.java
new file mode 100644 (file)
index 0000000..c313e25
--- /dev/null
@@ -0,0 +1,147 @@
+package org.vamsas.client.picking;\r
+\r
+import java.net.*;\r
+import java.util.*;\r
+import java.util.logging.*;\r
+\r
+/**\r
+ * Manager class that maintains a list of connected clients in addition to\r
+ * attempting to run a server to listen for client connections. If the server\r
+ * initialization fails, then an attempt to connect (as a client) to another JVM\r
+ * that is already a server happens instead.\r
+ */\r
+public class PickManager\r
+{\r
+       private static Logger logger = Logger.getLogger("org.vamsas.client.picking");\r
+       \r
+       // Maintains a list of client communication objects - each object represents\r
+       // a way of talking to either:\r
+       //  the server - if this is client side (and in which case, the list will only contain one element\r
+       //  the other clients - if this is server side\r
+       private LinkedList clients;\r
+       \r
+       private PickServer server;\r
+       \r
+       /**\r
+        * Constructs a new PickManager. This method will return immediately, while\r
+        * a looping thread runs that attempts to run the server or connect to an\r
+        * existing server.\r
+        */\r
+       public PickManager()\r
+       {\r
+               server = new PickServer(this);\r
+               clients = new LinkedList();\r
+               \r
+               new InitializeThread().start();\r
+       }\r
+       \r
+       /**\r
+        * Attempts to establish a connection between two client endpoints. This\r
+        * method is called in two ways: 1) by the server when it receives a remote\r
+        * request (in which case the socket will already be established) and 2) by\r
+        * a client that is attempting to connect *to* the server.\r
+        * @param socket a socket endpoint for the connection\r
+        * @return true if the connection is successfully, false otherwise\r
+        */\r
+       boolean addEndPoint(Socket socket)\r
+       {\r
+               PickEndPoint client = new PickEndPoint(this, socket);\r
+               \r
+               if (client.openConnection())\r
+               {\r
+                       clients.add(client);\r
+                       logger.fine("List now contains " + clients.size() + " client(s)");\r
+                       return true;\r
+               }\r
+               \r
+               return false;\r
+       }\r
+       \r
+       /**\r
+        * Sends a message to other clients.\r
+        * @param str the message to send\r
+        */\r
+       public void sendMessage(String str)\r
+       {\r
+               forwardMessage(null, str);\r
+       }\r
+       \r
+       /**\r
+        * Forwards (or sends) a message. When the server (client A) receives a\r
+        * message from client B, it must also forward it to clients C and D (etc),\r
+        * but mustn't forward it *back* to client B.\r
+        * @param origin the client endpoint that received the message (will be null\r
+        * if the message originates from this instance\r
+        * @param str the message to send\r
+        */\r
+       private void forwardMessage(PickEndPoint origin, String str)\r
+       {\r
+               ListIterator itor = clients.listIterator();\r
+               while (itor.hasNext())\r
+               {\r
+                       PickEndPoint client = (PickEndPoint) itor.next();\r
+                       \r
+                       if (client != origin)\r
+                               client.send(str);\r
+               }\r
+       }\r
+       \r
+       /**\r
+        * Handles a received message. If the manager is running in server mode,\r
+        * then it must ensure the message is also forwarded to the other clients.\r
+        * @param origin the client endpoint that received the message\r
+        * @str the message that was received\r
+        */\r
+       void handleMessage(PickEndPoint origin, String str)\r
+       {\r
+               if (server.isServer())\r
+                       forwardMessage(origin, str);\r
+               \r
+               // TODO: pass message to VAMSAS API\r
+       }\r
+       \r
+       /**\r
+        * Removes a client connection from the list when its connection is no\r
+        * longer valid.\r
+        * @param client the client endpoint to remove\r
+        */\r
+       void removeEndPoint(PickEndPoint client)\r
+       {\r
+               clients.remove(client);\r
+               logger.fine("List now contains " + clients.size() + " client(s)");\r
+               \r
+               // If there's no endpoints left, then we've lost all connections and\r
+               // need to reinitialize\r
+               if (clients.size() == 0)\r
+                       new InitializeThread().start();\r
+       }\r
+       \r
+       /**\r
+        * Thread extension class to handle the actual initialization\r
+        */\r
+       private class InitializeThread extends Thread\r
+       {\r
+               public void run()\r
+               {\r
+                       logger.fine("Initializing connection...");\r
+                       boolean connected = false;\r
+                       \r
+                       // Loop until we can get a connection (one way or the other)\r
+                       while (!connected)\r
+                       {\r
+                               // Sleep for a rnd time so we don't end up with all the VAMSAS\r
+                               // apps trying to initialize servers at the same time\r
+                               try { Thread.sleep((int)Math.random()); }\r
+                               catch (InterruptedException e) {}\r
+                                       \r
+                               // Attempt to open the server port...\r
+                               if (server.isServer() || server.createServer())\r
+                                       connected = true;\r
+\r
+                               // If it fails, then attempt to make a client connection...\r
+                               else if (addEndPoint(null))\r
+                                       connected = true;\r
+                       }\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/picking/PickServer.java b/src/org/vamsas/client/picking/PickServer.java
new file mode 100644 (file)
index 0000000..abef55e
--- /dev/null
@@ -0,0 +1,83 @@
+package org.vamsas.client.picking;\r
+\r
+import java.io.*;\r
+import java.net.*;\r
+import java.util.logging.*;\r
+\r
+/**\r
+ * Server class that listens for incoming connections on a predefined port.\r
+ */\r
+class PickServer extends Thread\r
+{\r
+       private static Logger logger = Logger.getLogger("org.vamsas.client.picking");\r
+       \r
+       // The port number we'll listen on\r
+       static final int PORT = 53782;\r
+       \r
+       private ServerSocket serverSocket;\r
+       // Set to true once the server is established\r
+       private boolean isServer = false;\r
+       \r
+       private PickManager manager;\r
+       \r
+       /**\r
+        * Constructs a new instance of the server (but doesn't start it).\r
+        * @param manager a reference to the pick manager that owns this server\r
+        */\r
+       PickServer(PickManager manager)\r
+       {\r
+               this.manager = manager;\r
+       }\r
+       \r
+       /**\r
+        * Returns true if this server instance is running.\r
+        * Return true if this server instance is running\r
+        */\r
+       boolean isServer()\r
+               { return isServer; }\r
+       \r
+       /**\r
+        * Attempts to create the server by opening a server socket on the port.\r
+        * @return true if the server was created; false otherwise\r
+        */\r
+       boolean createServer()\r
+       {\r
+               try\r
+               {\r
+                       serverSocket = new ServerSocket(PORT);\r
+                       start();                        \r
+                       \r
+                       return isServer = true;\r
+               }\r
+               catch (IOException e)\r
+               {\r
+                       logger.info("SERVER: " + e);\r
+                       return false;\r
+               }\r
+       }\r
+       \r
+       /**\r
+        * Thread listening method - loops indefinitely listening for connections.\r
+        * When one is received, the socket object is passed to the manager so it\r
+        * can make a full client connection for further comms.\r
+        */\r
+       public void run()\r
+       {\r
+               logger.fine("SERVER: listening on " + PORT + " - SERVER");\r
+               \r
+               // Loop forever, accepting connectons from other clients\r
+               // TODO: add in the ability to terminate the server if a VAMSAS session\r
+               // is ended\r
+               while (true)\r
+               {\r
+                       try\r
+                       {\r
+                               Socket socket = serverSocket.accept();                          \r
+                               logger.fine("SERVER: connection detected");\r
+                               \r
+                               manager.addEndPoint(socket);\r
+                       }\r
+                       catch (IOException e) {}\r
+               }\r
+       }\r
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/picking/TestApp.java b/src/org/vamsas/client/picking/TestApp.java
new file mode 100644 (file)
index 0000000..96924b5
--- /dev/null
@@ -0,0 +1,33 @@
+package org.vamsas.client.picking;\r
+\r
+import java.util.logging.*;\r
+\r
+public class TestApp\r
+{\r
+       private static Logger logger = Logger.getLogger("org.vamsas.client.picking");\r
+       \r
+       public static void main(String[] args)\r
+               throws Exception\r
+       {\r
+//             logger.setLevel(Level.INFO);\r
+               \r
+               TestApp app = new TestApp();\r
+               \r
+               PickManager manager = new PickManager();\r
+               \r
+               // Send 5 test messages...\r
+//             for (int i = 0; i < 5; i++)\r
+               while (true)\r
+               {                       \r
+                       try { Thread.sleep((int) (Math.random()*20000)); }\r
+                       catch (InterruptedException e) {}\r
+                       \r
+                       int rnd = (int) (Math.random()*100);\r
+                       manager.sendMessage("" + rnd);\r
+               }\r
+       }\r
+       \r
+       public TestApp()\r
+       {\r
+       }\r
+}
\ No newline at end of file
diff --git a/src/org/vamsas/client/simpleclient/AppDataInputStream.java b/src/org/vamsas/client/simpleclient/AppDataInputStream.java
new file mode 100644 (file)
index 0000000..0785ed6
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarInputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author jimp
+ * LATER: this may not be a necessary or useful class to return from IClientAppdata get*InputStream() methods
+ */
+public class AppDataInputStream extends DataInputStream implements DataInput {
+  private Log log = LogFactory.getLog(AppDataInputStream.class);
+  private boolean isOpen = false;
+  /**
+   * Wrapper for writing to/from AppData Entries in a Vamsas Document.
+   */
+  public AppDataInputStream(InputStream inputstream) {
+    super(inputstream);
+    isOpen=true;
+  }
+
+  /* (non-Javadoc)
+   * @see java.io.FilterInputStream#close()
+   */
+  public void close() throws IOException {
+    if (!isOpen) {
+      log.debug("close() called on closed AppDataInputStream.");
+      // throw new IOException("Attempt to close an already closed AppDataInputStream");
+    } else {
+      isOpen=false;
+    }
+  }
+
+  /**
+   * Will return zero if stream has been closed.
+   * @see java.io.FilterInputStream#available()
+   */
+  public int available() throws IOException {
+    if (isOpen)
+      return super.available();
+    else
+      return 0;
+  }
+  
+}
diff --git a/src/org/vamsas/client/simpleclient/AppDataOutputStream.java b/src/org/vamsas/client/simpleclient/AppDataOutputStream.java
new file mode 100644 (file)
index 0000000..db13652
--- /dev/null
@@ -0,0 +1,86 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author jimp
+ *
+ */
+public class AppDataOutputStream extends DataOutputStream {
+  private Log log = LogFactory.getLog(AppDataOutputStream.class);
+  private boolean isOpen=true;
+  /**
+   * @param out
+   */
+  public AppDataOutputStream(OutputStream out) {
+    super(out);
+    isOpen=true;
+  }
+  /* (non-Javadoc)
+   * @see java.io.DataOutputStream#flush()
+   */
+  public void flush() throws IOException {
+    if (isOpen)
+      super.flush();
+    else
+      log.warn("flush() called on closed AppDataOutputStream");
+  }
+  /* (non-Javadoc)
+   * @see java.io.DataOutputStream#write(byte[], int, int)
+   */
+  public synchronized void write(byte[] b, int off, int len) throws IOException {
+    if (isOpen) {
+      super.write(b, off, len);
+    } else {
+      log.debug("write(b,off,len) called on closed AppDataOutputStream");
+      throw new IOException("Attempt to write to closed AppDataOutputStream");
+    }
+  }
+  /* (non-Javadoc)
+   * @see java.io.DataOutputStream#write(int)
+   */
+  public synchronized void write(int b) throws IOException {
+    if (isOpen) {
+      super.write(b);
+    } else {
+      log.debug("write(b) called on closed AppDataOutputStream");
+      throw new IOException("Attempt to write to closed AppDataOutputStream");
+    }
+  }
+  /**
+   * Sets an internal flag preventing further write operations 
+   * to the AppData output stream and flushes any pending writes.
+   * @see java.io.FilterOutputStream#close()
+   */
+  public void close() throws IOException {
+    isOpen=false;
+    super.flush();
+    log.debug("AppDataOutputStream was closed.");
+  }
+  /* (non-Javadoc)
+   * @see java.io.FilterOutputStream#write(byte[])
+   */
+  public void write(byte[] b) throws IOException {
+    if (isOpen) {
+      super.write(b);
+    } else {
+      log.debug("write(b[]) called on closed AppDataOutputStream");
+      throw new IOException("Attempt to write to closed AppDataOutputStream");
+    }
+  }
+  /**
+   * @return true if stream is still Open.
+   */
+  public boolean isOpen() {
+    return isOpen;
+  }
+  
+}
diff --git a/src/org/vamsas/client/simpleclient/ArchiveUrn.java b/src/org/vamsas/client/simpleclient/ArchiveUrn.java
new file mode 100644 (file)
index 0000000..304e1f2
--- /dev/null
@@ -0,0 +1,34 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+/**
+ * Vamsas Document URN for files understood by ArchiveReader and 
+ * written by VamsasArchive.
+ * vdoc://{Absolute path to file}
+ * @author jimp
+ *
+ */
+public class ArchiveUrn extends org.vamsas.client.SessionUrn {
+  /**
+   * a simple vamsas document urn prefix
+   */
+  public static String VAMSASDOCUMENT="vdoc";
+  static {
+    TYPES.put(ArchiveUrn.VAMSASDOCUMENT, ArchiveUrn.class);
+  }
+
+  public ArchiveUrn(File docLocation) throws MalformedURLException {
+    super(VAMSASDOCUMENT, docLocation.getAbsoluteFile().toURL());
+  }
+
+  /**
+   * TODO: LATER: think about this again.
+   * @return File(urn.getPath())
+   */
+  public File asFile() {
+    return new File(urn.getPath());
+  }
+  // TODO: add abstract 'handler' methods for resolving the URN to a particular class
+}
diff --git a/src/org/vamsas/client/simpleclient/ClientDocument.java b/src/org/vamsas/client/simpleclient/ClientDocument.java
new file mode 100644 (file)
index 0000000..3b654f8
--- /dev/null
@@ -0,0 +1,510 @@
+/*
+ *
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.IOException;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.IClientAppdata;
+import org.vamsas.client.IClientDocument;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.Vobject;
+import org.vamsas.client.VorbaId;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.User;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.AppDataReference;
+import org.vamsas.test.objects.Core;
+
+/**
+ * Maintains a collection of vamsas objects, appdatas and states, and provides api for a SimpleClient's client.
+ * @author jimp 
+ */
+public class ClientDocument extends org.vamsas.client.ClientDocument implements IClientDocument {
+  private static Log log = LogFactory.getLog(ClientDocument.class);
+  private VamsasDocument doc;
+  protected SimpleClient sclient;
+  protected VamsasArchive archive = null;
+  /**
+   * indicate if new data has been incorporated
+   */
+  private boolean isModified = false;
+  /**
+   * Public method for internal use by SimpleClient.
+   * @return true if document has been modified.
+   */
+  public boolean isModified() {
+    return isModified;
+  }
+  private Vector updatedObjects=null;
+  /**
+   *
+   *  prepare Application-side dataset from the vamsas Document archive
+   * @param doc - the dataset
+   * @param docHandler - the sessionFile IO handler
+   * @param Factory - the source of current and new vorbaIds
+   * @param sclient - the simpleclient instance
+   */
+  protected ClientDocument(VamsasDocument doc, VamsasArchive docHandler, IdFactory Factory, SimpleClient sclient) {
+    super(Factory.getVorbaIdHash(), Factory);
+    
+    
+    /**
+     * prepare Application-side dataset from the vamsas Document archive
+     */
+    this.sclient = sclient;
+    archive = docHandler;
+    this.doc = doc;
+    updatedObjects=null;  /// TODO: correct this line
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId)
+   */
+  public Vobject getObject(VorbaId id) {
+    if (vamsasObjects==null) {
+      log.debug("getObject called on null objrefs list.");
+      return null;
+    }
+    if (vamsasObjects.containsKey(id))
+      return (Vobject) vamsasObjects.get(id);
+    log.debug("Returning null Vobject reference for id "+id.getId());
+    return null;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[])
+   */
+  public Vobject[] getObjects(VorbaId[] ids) {
+    if (vamsasObjects==null) {
+      log.debug("getObject[]  called on null vamsasObjects list.");
+      return null;
+    }
+    Vobject[] vo = new Vobject[ids.length];
+    for (int i=0,j=ids.length; i<j;i++) 
+      if (vamsasObjects.containsKey(ids[i]))
+        vo[i] = (Vobject) vamsasObjects.get(ids[i]);
+      else
+        log.debug("Returning null Vobject reference for id "+ids[i].getId());
+    return vo;
+  }
+  /**
+   * internal reference to single copy of Document Roots array
+   */
+  private VAMSAS[] _VamsasRoots=null;
+  /*
+   * (non-Javadoc)
+   * LATER: currently there is only one Vector of roots ever passed to client - decide if this is correct (means this is not thread safe and may behave unexpectedly)
+   * @see org.vamsas.client.IClientDocument#getVamsasRoots()
+   */
+  public VAMSAS[] getVamsasRoots() {
+    if (doc==null) {
+      log.debug("Null document for getVamsasRoots(), returning null");
+      return null;
+    }
+    if (archive==null) {
+      // LATER: decide on read-only status of ClientDocument object
+      log.warn("getVamsasRoots() called on possibly read-only document.");
+    }
+    if (_VamsasRoots!=null)
+      return _VamsasRoots;
+    VAMSAS[] roots = doc.getVAMSAS();
+    if (roots == null) {
+      // Make a new one to return to client to get filled. 
+      _VamsasRoots = new VAMSAS[] { new VAMSAS() };
+      // Do provenance now. just in case.
+      doc.getProvenance().addEntry(sclient.getProvenanceEntry("Created new document root [id="+_VamsasRoots[0].getId()+"]"));
+      doc.addVAMSAS(_VamsasRoots[0]);
+    } else {
+      _VamsasRoots = new VAMSAS[roots.length];
+      for (int r=0;r<roots.length; r++)
+        _VamsasRoots[r] = roots[r];
+    }
+    return _VamsasRoots;
+  }
+  
+  private int _contains(VAMSAS root, VAMSAS[] docRoots) {
+    if (root==null)
+      return -1;
+    if (docRoots==null || docRoots.length==0)
+      return -1;
+    String r_id = root.getId();
+    for (int i=0,j=docRoots.length; i<j; i++)
+      if (docRoots[i]==root || (docRoots[i]!=null && docRoots[i].getId().equals(r_id)))
+        return i;
+    return -1;
+  }
+/**
+ * verify that newr version is really an intact version of the 
+ * @param newVersion (may be modified)
+ * @param oldVersion 
+ * @return true if newVersion is a valid root that preserves original references
+ */
+  private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion) {
+    // ideal - this cascades down the two structures, ensuring that all ID'd objects in one are present in the other.
+    if (oldVersion==newVersion) {
+      // may be a virgin root element.
+      if (!newVersion.isRegistered())
+        _registerObject(newVersion);
+      // Should retrieve original version and compare - unless local hashes can be used to determine if resultSet has been truncated.
+      // just do internal validation for moment.
+      if (newVersion.isValid())
+        return true;
+      return false;
+    } else {
+      // redundant ? if (oldVersion.is__stored_in_document())
+      if (!newVersion.isRegistered())
+        _registerObject(newVersion);
+      if (newVersion.isValid())
+        return true;
+    }
+    return false;
+    /**
+     * LATER isValidUpdate : Ideally. we efficiently walk down, comparing hashes, to deal with merging and verifying provenance for objects
+    
+    // extract root objects
+    if (newroots != null) {
+      // check newroots for objects that were present in the old document
+      // check to see if the 'old' objects have been modified
+      // if they have ? we overwrite them with their new version, ensuring that
+      // provenance is updated.
+      // if they haven't ? do nothing ?
+      
+      for (int i = 0, k = newroots.length; i < k; i++) {
+        if (newroots[i].isRegistered()) {
+          // easy - just check if anything has changed and do provenance
+          Vobject oldversion = getObject(newroots[i].getVorbaId());
+          if (oldversion instanceof VAMSAS) {
+            // LATER: appropriate merging behaviour when two clients have improperly modified the same Vobject independently.
+            if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
+              // client has modified this Vobject since last retrieval.
+              if (newroots[i].get__last_hash() != oldversion.get__last_hash()) {
+                // Vobject has been modified by another client since this
+                // client's
+                // last access to document.
+              }
+            }
+          } else {
+            throw new Error(
+                "SimpleClient error when using setVamsasRoots : The vorbaId for Vobject "
+                + i
+                + " does not refer to an Vobject of type VAMSAS in the current document!");
+          }
+        } else {
+          if (!newroots[i].is__stored_in_document()) {
+            // check if Vobject is modified
+            if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
+              // it is - so we add newroots[i] as a new Vobject, with updated
+              // provenance.
+            } else {
+              // do nothing
+              newroots[i] = null;
+            }
+          } else {
+            // just add newroots[i] as a new Vobject in the document
+            // - with appropriate provenance.
+          }
+        }
+      }*/
+  }
+  /**
+   * merge old and new root vectors
+   * @param newr This array may be written to
+   * @param original
+   * @param the client document (usually this) which this root set belongs to.
+   * @return merged vector of vamsas roots
+   */
+  private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original, ClientDocument modflag) {
+    Vector rts = new Vector();
+    boolean modified=false;
+    for (int i=0,j=original.length; i<j; i++) {
+      int k = _contains(original[i], newr);
+      if (k>-1) {
+        if (isValidUpdate(newr[k], original[i])) {
+          modified=true;
+          rts.add(newr[k]);
+          newr[k]=null;
+        } else {
+          // LATER: try harder to merge ducument roots.
+          log.warn("Couldn't merge new VAMSAS root "+newr[k].getId());
+          newr[k] = null; // LATER: this means we ignore mangled roots. NOT GOOD
+        }
+      } else {
+        // add in order.
+        rts.add(original[i]);
+      }
+    }
+    // add remaining (new) roots
+    for (int i=0,j=newr.length; i<j; i++) {
+      if (newr[i]!=null) {
+        rts.add(newr[i]);
+        modified=true;
+      }
+    }
+    newr = new VAMSAS[rts.size()];
+    for (int i=0,j=rts.size(); i<j; i++)
+      newr[i] = (VAMSAS) rts.get(i);
+    if (modflag!=null)
+      modflag.isModified = modified;
+    return newr;
+  }
+  
+  /**
+   * update the document with new roots.
+   * LATER: decide: this affects the next call to getVamsasRoots()
+   * @see org.vamsas.IClientDocument.setVamsasRoots
+   */
+  public void setVamsasRoots(VAMSAS[] newroots) {
+    if (doc==null) {
+      log.debug("setVamsasRoots called on null document.");
+      return;
+    }
+    VAMSAS[] newr;
+    if (newroots==null) {
+      log.debug("setVamsasRoots(null) - do nothing.");
+      return;
+    }
+    // are we dealing with same array ?
+    if (_VamsasRoots!=newroots) {
+      // merge roots into local version.
+      newr = new VAMSAS[newroots.length];
+      for (int i=0;i<newr.length;i++)
+        newr[i] = newroots[i];
+      newr=_combineRoots(newr,_VamsasRoots,this);
+    } else {
+      newr = new VAMSAS[_VamsasRoots.length];
+      for (int i=0;i<newr.length;i++)
+        newr[i]=_VamsasRoots[i];
+    }
+    //  actually compare with document root set for final combination (to ensure nothing is lost)
+    _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this); 
+  }
+  
+  
+  /* (non-Javadoc)
+   * LATER: decide: this affects the next call to getVamsasRoots()
+   * @see org.vamsas.client.IClientDocument#addVamsasRoot(org.vamsas.objects.core.VAMSAS)
+   */
+  public void addVamsasRoot(VAMSAS newroot) {
+    if (doc==null) {
+      log.debug("addVamsasRoots called on null document.");
+      return;
+    }
+    VAMSAS[] newroots = _combineRoots(new VAMSAS[] {newroot}, _VamsasRoots, this);
+    _VamsasRoots = newroots;  
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClientDocument#registerObjects(org.vamsas.client.Vobject[])
+   */
+  public VorbaId[] registerObjects(Vobject[] unregistered) {
+    if (doc==null) {
+      log.warn("registerObjects[] called on null document.");
+      return null;
+    }
+    if (vamsasObjects==null) {
+      log.warn("registerObjects[] called for null vamsasObjects hasharray.");
+      return null;
+    }
+    if (unregistered!=null) {
+      VorbaId ids[] = new VorbaId[unregistered.length];
+      for (int i=0,k=unregistered.length; i<k; i++)
+        if (unregistered[i]!=null) {
+          log.warn("Null Vobject passed to registerObject[] at position "+i);
+          return null;
+        } else {
+          ids[i]=registerObject(unregistered[i]);
+        }
+      log.debug("Registered "+unregistered.length+" objects - total of "+vamsasObjects.size()+" ids.");
+      return ids;
+    }
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.Vobject)
+   */
+  public VorbaId registerObject(Vobject unregistered) {
+    if (doc==null) {
+      log.warn("registerObjects called on null document.");
+      return null;
+    }
+    if (vamsasObjects==null) {
+      log.warn("registerObjects called for null vamsasObjects hasharray.");
+      return null;
+    }
+    if (unregistered!=null) {
+      VorbaId id = _registerObject(unregistered);
+      log.debug("Registered object - total of "+vamsasObjects.size()+" ids.");
+      return id;
+    }
+    log.warn("Null Vobject passed to registerObject.");
+    return null;
+  }
+  /**
+   * IClientAppdata instance - if it exists.
+   */
+  SimpleClientAppdata scappd = null;
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientDocument#getClientAppdata()
+   */
+  public IClientAppdata getClientAppdata() {
+    if (doc==null) {
+      log.warn("getClientAppdata called on null document.");
+      return null;
+    }
+    if (scappd==null) {
+      log.debug("Creating new SimpleClientAppdata instance for "+sclient.getSessionHandle());
+      scappd = new SimpleClientAppdata(this);
+      if (scappd==null) {
+        // LATER: may not need this as a warning message.
+        log.warn("Null appdata object for "+sclient.getSessionHandle());
+      } else {
+        log.debug("Created SimpleClientAppdata successfully.");
+      }
+    } else {
+      log.debug("Returning existing SimpleClientAppdata reference.");
+    }
+    return scappd;
+  }
+  /**
+   * access the vamsas document
+   * @return the session's vamsas document
+   */
+  protected VamsasDocument getVamsasDocument() {
+    return doc;
+  }
+  /**
+   * returns the read-only IO interface for the vamsas document Jar file
+   * @return
+   */
+  protected VamsasArchiveReader getVamsasArchiveReader() {
+    try {
+      return archive.getOriginalArchiveReader();
+    } catch (Exception e) {
+      log.warn("Unable to create OriginalArchiveReader!", e);
+    }
+    return null;
+  }
+  protected boolean updateSessionDocument() throws java.io.IOException {
+    boolean docupdate = true; // 'non-serious' problems below set this false
+    if (doc==null) {
+      log.warn("updateSessionDocument called on null document.");
+      throw new java.io.IOException("Document is closed.");
+    }
+    if (archive==null) {
+      log.warn("updateSessionDocument called document archive handler.");
+      throw new java.io.IOException("Document is closed.");
+    }
+    
+    if (!isModified() && !scappd.isModified()) {
+      log.debug("Document update not necessary. returning false.");
+      return false;
+    }
+    VamsasSession session = sclient._session;
+    log.debug("updating Session Document in "+session.sessionDir);
+    // update the VamsasDocument structure with any new appData's.
+    // try to update the sessionFile
+    log.debug("Attempting to update session "+sclient.session.getSessionUrn());
+    if (scappd.isModified()) {
+      ClientHandle client = sclient.client;
+      UserHandle user = sclient.user;
+      scappd.closeForWriting();      
+      if (scappd.appsGlobal==null) {
+        log.debug("Creating new appData entry for this application...");
+        // first write for this application - add a new section in document
+        ApplicationData appd = scappd.appsGlobal = new ApplicationData();
+        appd.setName(client.getClientName());
+        // appd.setUrn(client.getClientUrn());
+        appd.setVersion(client.getVersion());
+        doc.addApplicationData(appd);
+        // embed or jarEntry ?  - for now only jarEntry's are dealt with.
+        appd.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+        log.debug("... created.");
+      }
+      if (scappd.newAppData!=null && scappd.newAppData.sessionFile.exists()) {
+        log.debug("Beginning update for new Global Appdata...");
+        // new global appdata to write.
+        if (scappd.appsGlobal.getData()!=null) {
+          scappd.appsGlobal.setData(null);
+          scappd.appsGlobal.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+        }
+        // LATER: use a switch to decide if the data should be written as a reference or as an embedded data chunk
+        scappd.updateAnAppdataEntry(archive, scappd.appsGlobal, scappd.newAppData);
+        log.debug("...Successfully updated Global Appdata Entry.");
+      }
+      if (scappd.newUserData!=null && scappd.newUserData.sessionFile.exists()) {
+        log.debug("Beginning to update Users Appdata entry....");
+        if (scappd.usersData==null) {
+          // create new user appdata
+          scappd.usersData = new User();
+          scappd.usersData.setFullname(user.getFullName());
+          scappd.usersData.setOrganization(user.getOrganization());
+          scappd.appsGlobal.addUser(scappd.usersData);
+        }
+        User appd = scappd.usersData;
+        if (appd.getData()!=null || appd.getDataReference()==null) {
+          // LATER make standard appDataReference constructor for client+user 
+          appd.setData(null);          
+          String safe_username = user.getFullName();
+          int t = safe_username.indexOf(" ");
+          if (t!=-1) {
+            safe_username = safe_username.substring(t);
+          }
+          appd.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()+safe_username));
+        }
+        scappd.updateAnAppdataEntry(archive, scappd.usersData, scappd.newUserData);
+        log.debug("...Successfully updated user AppData entry.");
+      }
+    }
+    log.debug("Updating Document...");
+    // now update the document.
+    try {
+      archive.putVamsasDocument(doc);
+      log.debug("Successfully written document entry.");
+    }
+    catch (Exception e) {
+      log.error("Marshalling error for vamsas document.",e);
+      docupdate = false; // pass on the (probable) object validation error 
+    }
+    if (archive.transferRemainingAppDatas())
+      log.debug("Remaining appdatas were transferred.");
+    else
+      log.debug("No remaining appdatas were transferred. (Correct?)");
+    archive.closeArchive();
+    log.debug("...successully finished and closed.");
+    return docupdate; // no errors ?
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Object#finalize()
+   */
+  protected void finalize() throws Throwable {
+    log.debug("Garbage collecting on ClientDocument instance.");
+    if (scappd!=null) {
+      scappd.finalize();
+      scappd = null;
+    }
+    if (doc!=null) {
+      doc = null;
+    }
+    // disengage from client
+    if (sclient!=null)
+      sclient.cdocument = null;
+    sclient=null;
+    
+    super.finalize();
+  }
+  public Vector getUpdatedObjects() {
+    return updatedObjects;
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/ClientsFile.java b/src/org/vamsas/client/simpleclient/ClientsFile.java
new file mode 100644 (file)
index 0000000..96fa871
--- /dev/null
@@ -0,0 +1,295 @@
+package org.vamsas.client.simpleclient;
+
+import org.vamsas.client.*;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.Vector;
+
+/**
+ * Handler for the clientsFile within a vamsas session thread.
+ * @author jim 
+ */
+public class ClientsFile extends ListFile {
+  private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ClientsFile.class);
+  /**
+   * number of my client in list - passed back when a client 
+   * is added to list, and used (if valid) for quickly 
+   * looking up presence of client handle in the list.
+   */
+  private int syncnum = 1;
+
+  public ClientsFile(File filelist) throws IOException {
+    super(filelist);
+  }
+
+  /**
+   * internal method for getting clientList - ensures a lock has been made but
+   * does not release it.
+   * 
+   * @return list of clients
+   */
+  private ClientHandle[] retrieveClientHandles() {
+    if (lockFile()) {
+      try {
+        ClientHandle[] clients=null;
+        if (fileLock.length()>0) {
+          
+          ObjectInputStream is = new ObjectInputStream(fileLock.getBufferedInputStream(true));
+          Object o;
+          o=is.readObject();
+          if (o!=null) {
+            try {
+              clients = (ClientHandle[]) o;
+            }
+            catch (Exception e) {
+              System.err.println("Garbage in the clientHandle list "+this.sessionFile);
+            }
+          }
+        }
+        return clients;
+      } catch (FileNotFoundException e) {
+        // TODO Auto-generated catch block
+        e.printStackTrace(System.err);
+      } catch (Exception e) {
+        e.printStackTrace(System.err);
+      }
+    }
+    return null;
+  }
+  /**
+   * get the clientList from the file. May return null if lock failed!
+   * @return clientList
+   */
+  public ClientHandle[] retrieveClientList() {
+    if (lockFile()) {
+      ClientHandle[] clients = retrieveClientHandles();
+      unlockFile();
+      return clients;
+    }
+    return null;
+  }
+  /**
+   * get list from the locked ClientList.
+   * @param extantlock
+   * @return clientList or null if lock failed (or file was empty)
+   */
+  public ClientHandle[] retrieveClientList(Lock extantlock) {
+    if (lockFile(extantlock)) {
+      ClientHandle[] clients = retrieveClientHandles();
+      unlockFile();
+      return clients;
+    }
+    return null;
+  }
+  /**
+   * adds clientHandle me to the clientList under an existing lock extantLock.
+   * @param me
+   * @param extantLock
+   * @return client index in list or 0 if lock was invalid or addClient operation failed.
+   */
+  public int addClient(ClientHandle me, Lock extantLock) {
+    return addClient(me, true, extantLock);
+  }
+  
+  /**
+   * adds clientHandle me to the clientList under an existing lock.
+   * @param me - clientHandle
+   * @param disambig - if true then add will fail if an identical clientHandle already exists
+   * @param extantLock - existing lock
+   * @return client index in list or 0 if addClient (or the lock) failed.
+   */
+  
+  public int addClient(ClientHandle me, boolean disambig, Lock extantLock) {
+    if (lockFile(extantLock)) {
+      syncnum = addClient(me, disambig);
+      unlockFile();
+      return syncnum;
+    }
+    return 0;
+  }
+  
+  /**
+   * adds the ClientHandle to the list - if it is not unique, then the
+   * ClientHandle object is modified to make it unique in the list. returns the
+   * clientNumber for the client in the session.
+   * 
+   * @param me
+   * @return
+   */
+
+  public int addClient(ClientHandle me) {
+    syncnum = addClient(me, true);
+    unlockFile();
+    return syncnum;
+  }
+
+  /**
+   * removes 'me' from the session ClientList without complaint if 'me' isn't in the clientList already.
+   * @param me client handle to be removed
+   * @param clientlock existing lock passed from watcher.
+   */
+  public void removeClient(ClientHandle me, Lock clientlock) {
+    int mynum=-1;
+    if (lockFile(clientlock)) {
+      ClientHandle[] clients = retrieveClientHandles();
+      if (clients != null) {
+        if ((syncnum<=0 || syncnum>clients.length) || clients[syncnum-1]!=me) {
+          for (int i = 0, j = clients.length; i < j; i++) 
+            if (clients[i].equals(me)) {
+              mynum=i;
+              break;
+            }
+        } else {
+          mynum=syncnum-1;
+        }
+        if (mynum>-1) {
+          ClientHandle[] newlist = new ClientHandle[clients.length - 1];
+          for (int k=0,i = 0, j = clients.length; i < j; i++)
+            if (i!=mynum)
+              newlist[k++] = clients[i];
+          if (!putClientList(newlist))
+            throw new Error("Failed to write new clientList!"); // failed to put the clientList to disk.
+        }
+      }
+      unlockFile();
+    } else {
+      throw new Error("Couldn't get lock for "+((sessionFile==null) ? "Unitialised sessionFile in ClientsFile" : sessionFile.getAbsolutePath()));
+    }
+  }
+  /**
+   * Adds a ClientHandle to the ClientList file - optionally disambiguating 
+   * the ClientHandle (modifes the URN). 
+   * Note: Caller is left to release the lock on the ClientList.
+   * @param me
+   * @param disambiguate -
+   *          flag indicating if the URN for me should be disambiguated to
+   *          differentiate between sessions.
+   * @return index of clientHandle in new list, or -1-position of existing
+   *         clientHandle (if disambiguate is true)
+   */
+  protected int addClient(ClientHandle me, boolean disambiguate) {
+    int newclient = 0;
+    int tries=5;
+    while (tries-->0 && !lockFile())
+      try { Thread.sleep(1); } catch (Exception e){};
+    if (lockFile()) {
+      ClientHandle[] clients = retrieveClientHandles();
+      if (me.getClientUrn()==null) {
+        // TODO: move this into ClientUrn as a standard form method.
+        me.setClientUrn("vamsas://"+me.getClientName()+":"+me.getVersion()+"/");
+      }
+      if (clients == null) {
+        clients = new ClientHandle[1];
+        clients[0] = me;
+        newclient = 1;
+      } else {
+        int k = 0;
+        for (int i = 0, j = clients.length; i < j; i++) {
+          if (clients[i].equals(me)) {
+            if (disambiguate) {
+              while (clients[i].equals(me)) {
+                me.setClientUrn(me.getClientUrn() + k++); // TODO: make a better
+                                                          // disambiguation of
+                                                          // urn.
+              }
+            } else {
+              // will not write the ambiguous clientHandle to disk, just return
+              // its index.
+              return -1 - i;
+            }
+          }
+        }
+        int i, j;
+        ClientHandle[] newlist = new ClientHandle[clients.length + 1];
+        for (i = 0, j = clients.length; i < j; i++)
+          newlist[i] = clients[i];
+        newlist[j] = me;
+        clients = newlist;
+        newclient = j+1;
+      }
+      if (!putClientList(clients))
+        return 0; // failed to put the clientList to disk.
+    }
+    return newclient;
+  }
+  /**
+   * when set true - get FileNotFoundExceptions on WinXP when writing to locked stream after the backup has been made (via the backupFile method)
+   */
+  boolean backup=false;
+  /**
+   * safely writes clients array to the file referred to by sessionFile.
+   * 
+   * @param clients
+   * @return true if successful write. Throws Errors otherwise.
+   */
+  protected boolean putClientList(ClientHandle[] clients) {
+    if (lockFile()) {
+      File templist=null;
+      if (!backup || (templist = backupSessionFile()) != null) {
+        int retries=3;
+        while (retries-->0) {
+          try {
+            ObjectOutputStream os = 
+              new ObjectOutputStream(fileLock.getBufferedOutputStream(true));
+            log.debug("About to write "+clients.length+" clientHandles to output stream.");
+            os.writeObject(clients);
+            os.close();
+          // All done - remove the backup.
+          if (backup)
+            templist.delete();
+          templist = null;
+          retries=-1;
+          } catch (Exception e) {
+            System.err
+            .println("Serious - problems writing to sessionFile.");
+            if (retries>0 && templist != null) {
+              System.err.println("Recovering from Backup in "
+                      + templist.getAbsolutePath());
+              templist.renameTo(fileLock.target);
+            }
+            e.printStackTrace(System.err);
+          }
+        }
+        if (retries>-2) {
+          System.err
+          .println("Serious - problems writing to sessionFile. Giving Up.");
+          return false;
+        }
+      } else {
+        throw new Error(
+            "Couldn't create backup of the clientList before writing to it!");
+      }
+    } else {
+      throw new Error("Could not lock the clientList: "
+          + ((sessionFile == null) ? "Unitialized ClientsFile"
+              : " failed to get lock on " + sessionFile.getAbsolutePath()));
+    }
+    // successful!
+    return true;
+  }
+
+  public void clearList() {
+    if (lockFile()) {
+      try {
+        FileOutputStream fout = fileLock.getFileOutputStream(true);
+        fout.flush();
+        fout.close();
+      } catch (Exception e) {
+        throw new Error("Problems trying to clear clientlist!",e);
+        
+      }
+    }
+    
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/EventGeneratorThread.java b/src/org/vamsas/client/simpleclient/EventGeneratorThread.java
new file mode 100644 (file)
index 0000000..d9aa1db
--- /dev/null
@@ -0,0 +1,277 @@
+package org.vamsas.client.simpleclient;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.Hashtable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.Events;
+
+/**
+ * monitors watcher objects and generates events.
+ */
+public class EventGeneratorThread extends Thread implements Runnable {
+  private static Log log = LogFactory.getLog(EventGeneratorThread.class);
+  private SimpleClient client;
+  private Hashtable handlers; // manager object
+  private VamsasSession session;
+
+  /** 
+   * list with all the clientHandles for the session
+   */
+  protected FileWatcher clientfile=null;
+  /**
+   * the session's vamsasDocument
+   */
+  protected FileWatcher vamsasfile=null;
+  /**
+   * written to by client when its app calls storeDocument.
+   */
+  protected FileWatcher storeFile=null;
+  
+  private boolean watch=false;
+  
+  
+  EventGeneratorThread(VamsasSession s, SimpleClient _client, Hashtable eventhandlers) {
+    if (eventhandlers==null || s==null || _client==null)
+      throw new Error("Null arguments to EventGeneratorThread constructor.");
+    handlers = eventhandlers;
+    session = s;
+    client = _client;
+    setName(s.sessionDir.getName());
+    initWatchers();
+  }
+  
+  private void initWatchers() {
+    if (clientfile==null)
+      clientfile = session.getClientWatcher();
+    if (vamsasfile ==null)
+      vamsasfile = session.getDocWatcher();
+    if (storeFile == null)
+      storeFile = session.getStoreWatcher();
+    clientfile.setState();
+    vamsasfile.setState();
+    storeFile.setState();
+  }
+  boolean ownsf = false;
+  /**
+   * scans all watchers and fires changeEvents if necessary
+   * @return number of events generated.
+   */
+  private int checkforEvents() {
+    Lock watchlock;
+    //TODO : leave slog.info messages for the events that occur.
+    int raised=0;
+    // could make this general - but for now keep simple
+    if ((watchlock=storeFile.getChangedState())!=null) {
+      // TODO: define the storeFile semaphore mechanism : file exists - all clients inform their apps, and then the client that wrote the file should delete the file (it should hold the lock to it).
+      if (storeFile.exists) { 
+        PropertyChangeSupport h = (PropertyChangeSupport) handlers.get(Events.DOCUMENT_FINALIZEAPPDATA);
+        if (h!=null) {
+          log.debug("Triggering DOCUMENT_FINALIZEAPPDATA");
+          raised++;
+          h.firePropertyChange(client.getSessionUrn(), null, client);
+          // expect client to 
+          vamsasfile.setState();
+        }
+      }
+    }
+    if ((watchlock=clientfile.getChangedState())!=null) {
+      // see what happened to the clientfile - compare our internal version with the one in the file, or just send the updated list out...?
+      //
+      /**
+       * Generated when a new vamsas client is attached to a session (Handle is
+       * passed) Note: the newly created client does not receive the event.
+       *
+      public static final String CLIENT_CREATION = "org.vamsas.client.events.clientCreateEvent";
+  */ // as the test
+      /**
+       * Generated when a vamsas client leaves a session (Handle is passed to all
+       * others).
+      public static final String CLIENT_FINALIZATION = "org.vamsas.client.events.clientFinalizationEvent";
+       */ // again - as the test.
+          raised++;
+    }
+    if ((watchlock=vamsasfile.getChangedState())!=null) {
+      
+      /**
+       * Generated when a client has finished updating the document. Passes
+       * applicationHandle of client so the updating client can recognise its own
+       * updates.
+      public static final String DOCUMENT_UPDATE = "org.vamsas.client.events.documentUpdateEvent";
+       */
+      // read apphandle from 'lastUpdate' session file.
+      // pass apphandle name to appHandler ?
+      
+    }
+    /**
+     * Generated when a new vamsas document is created (perhaps from some existing
+     * Vamsas data) so an application may do its own data space initialization.
+     * TODO: decide if this is called when an app is connected to a stored
+     * session...
+     public static final String DOCUMENT_CREATE = "org.vamsas.client.events.documentCreateEvent";
+    */
+    // check if this session's appInit flag is set - if not - generate event for this app.
+    // prolly don't need this at the moment - when an app does getDocument it can to the initing then.
+    
+
+    /**
+     * Generated prior to session Shutdown, after the last participating vamsas
+     * client has finalized.
+     *  TODO: decide on purpose of this ?  is this for benefit of multi-session Apps only ?
+    public static final String SESSION_SHUTDOWN = "org.vamsas.client.events.SessionShutdownEvent";
+     */
+
+    /**
+     * Generated for all clients when any client calls IClient.storeDocument() to
+     * allow them to store any updates before an offline copy of the session is
+     * created. Any client that handles this should call the
+     * IClient.getDocument(), update and then IClient.updateDocument in the same
+     * handler thread.
+     * EventName: <Vamsas-session URN>
+     * NewValue: org.vamsas.client.IClient for session.
+     *
+    public static final String DOCUMENT_FINALIZEAPPDATA = "org.vamsas.client.events.DocumentFinalizeAppData";
+*/
+    // watch for finalization semaphore (last finalised sessionFile).
+    
+    /**
+     * Generated by Vorba stub after the penultimate client makes a call to
+     * closeDocument(). Sequence is as follows : 1. All other vamsas clients have
+     * called closeDocument() 2. Final living client monitors closures, and
+     * realises that it is last. 3. Final client generates event to prompt
+     * associated application to inquire if the user wishes to save the document
+     * for future reference.
+     *  * Any call to closeDocument in a thread other than the registered
+     * EventListener will block until the RequestToClose handler has exited.
+     * 
+     */
+    //    public static final String DOCUMENT_REQUESTTOCLOSE = "org.vamas.client.DocumentRequestToCloseEvent";
+
+    return raised;
+  }
+  
+  private void initEvents() {
+    
+  }
+  /**
+   * Events raised by IClient and propagated to others in session
+   */
+  
+  /**
+   * number of milliseconds between any file state check.
+   */
+  long POLL_UNIT = 20;
+  protected void wait(int u) {
+    if (u<=0)
+      u=1;
+    long l = System.currentTimeMillis()+POLL_UNIT*u;
+      while (System.currentTimeMillis()<l)
+        ;
+  }
+    
+  
+  private boolean block_document_updates=false;
+  int STORE_WAIT=5; // how many units before we decide all clients have finalized their appdatas
+  
+  /**
+   * client App requests offline storage of vamsas data. 
+   * Call blocks whilst other apps do any appData finalizing
+   * and then returns (after locking the vamsasDocument in the session)
+   * Note - the calling app may also receive events through the EventGeneratorThread for document updates.
+   * 
+   * @return Lock for session.vamArchive 
+   * @param STORE_WAIT indicates how lock the call will block for when nothing appears to be happening to the session.
+   */
+  protected Lock want_to_store() {
+    log.debug("Setting flag for document_update requests to be ignored");
+    block_document_updates=true;
+    log.debug("Waiting for other apps to do FinalizeApp handling.");
+    try {
+      session.addStoreDocumentRequest(client.getClientHandle(), client.getUserHandle());
+    } catch (Exception e) {
+      log.warn("Whilst writing StoreDocumentRequest for "+client.getClientHandle().getClientUrn()+" "+client.getUserHandle(),
+          e);
+      log.info("trying to continue.");
+    }
+    // LATER: refine this semaphore process 
+    // to make a robust signalling mechanism:
+    // app1 requests, app1..n do something (or don't - they may be dead), 
+    // app1 realises all apps have done their thing, it then continues with synchronized data.
+    // this probably needs two files - a request file, 
+    //  and a response file which is acknowledged by the app1 requestor for each app.
+    //  eventually, no more responses are received for the request, and the app can then only continue with its store.
+    int units = 0;
+    while (units<STORE_WAIT) {
+      wait(1);
+      if (storeFile.hasChanged() || vamsasfile.hasChanged())
+        units=0;
+      else
+        units++;
+    }
+    
+    block_document_updates=false;
+    log.debug("Cleared flag for ignoring document_update requests");
+    // wait around again (until our own watcher has woken up and synchronized).
+    while (units<STORE_WAIT) {
+      wait(1);
+      if (storeFile.hasChanged() || vamsasfile.hasChanged())
+        units=0;
+      else
+        units++;
+    }
+    
+    
+    log.debug("finished waiting.");
+    return session.vamArchive.getLock();
+  }
+  /**
+   * count handlers for a particular vamsas event 
+   * @param event string enumeration from org.vamsas.client.Events
+   * @return -1 for an invalid event, otherwise the number of handlers
+   */
+  protected int countHandlersFor(String event) {
+    if (handlers.containsKey(event)) {
+      PropertyChangeSupport handler = (PropertyChangeSupport) handlers.get(event);
+      PropertyChangeListener[] listeners;
+      if (handler!=null)
+        return ((listeners=handler.getPropertyChangeListeners())==null) 
+        ? -1 : listeners.length;
+    }
+    return -1;
+  }
+  /**
+   * probably don't need any of these below.
+   */
+  /* (non-Javadoc)
+   * @see java.lang.Thread#destroy()
+   */
+  public void destroy() {
+    super.destroy();
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Thread#interrupt()
+   */
+  public void interrupt() {
+    // TODO Auto-generated method stub
+    super.interrupt();
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Thread#isInterrupted()
+   */
+  public boolean isInterrupted() {
+    // TODO Auto-generated method stub
+    return super.isInterrupted();
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Thread#run()
+   */
+  public void run() {
+    // TODO Auto-generated method stub
+    super.run();
+  }
+  
+
+}
diff --git a/src/org/vamsas/client/simpleclient/FileLock.java b/src/org/vamsas/client/simpleclient/FileLock.java
new file mode 100644 (file)
index 0000000..a1c0406
--- /dev/null
@@ -0,0 +1,205 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+/**
+ * File based Locking mechanism to get around some bizarre limitations of JarEntry seeking.
+ * Abstract locks have a target file, to which access is controlled when a lock is held. Native locks on WindowsXP seem to conflict with Jar seek operations, so a file lock creates an advisory lock.
+ * Method:
+ * A lock file is created, if it doesn't already exist - the naming convention is TargetFile+suffixSeparator+_LockSuffix.
+ * A lock is obtained by locking the lock file with a native lock. The NativeLock is used for this.
+ * @author JimP
+ *
+ */
+public class FileLock extends Lock {
+  private File _lock = null;
+  protected static String _LockSuffix="lck";
+  private NativeLock advisory=null;
+  /**
+   * ensure that the _lock file exists
+   * and create a lock
+   */
+  private boolean ensureLockFile(boolean block) {
+    if (_lock==null)
+      return false;
+    if (advisory!=null && advisory.isLocked())
+      return true;
+    try { 
+      advisory=new NativeLock(_lock, block);
+    } catch (Exception e) {
+      log.fatal("Failed to create advisory lock file "+_lock,e);
+      throw new Error("Failed to create advisory lock file "+_lock);          
+    }
+    return advisory.isLocked();
+  }
+  /**
+   * call to clear up a filelock file after its been made
+   *
+   */
+  private void tidy() {
+    if (_lock!=null) { 
+      if ( advisory!=null) 
+        advisory.release(true);
+      advisory.target.deleteOnExit();
+      advisory=null;
+      _lock=null;
+    }
+  }
+  /**
+   * @param lockfile
+   * @param block true means thread blocks until FileLock is obtained.
+   */
+  public FileLock(File lockfile, boolean block) {
+    super(lockfile);
+    // try and get a lock.
+    try {
+      _lock = new File(lockfile.getParentFile(), lockfile.getName()+"."+_LockSuffix);
+      if (!ensureLockFile(block)) {
+        log.debug("Couldn't get lock on "+_lock);
+        tidy();
+        return;
+      }
+      // create target file ready to be written to if necessary.
+      if (!lockfile.exists())
+        if (!lockfile.createNewFile()) {
+          log.warn("Failed to create locked file "+lockfile);
+          return;
+        }
+      //openRaFile();
+    } catch (FileNotFoundException e) {
+      //
+      log.debug("FileLock failed with target="+lockfile+" and lockfile suffix of "+_LockSuffix);
+      //log.error("Error! Couldn't create a lockfile at "
+      //  + lockfile.getAbsolutePath(), e);
+    } catch (IOException e) {
+      log.error("Error! Problems with IO when creating a lock on "
+          + lockfile.getAbsolutePath(),e);
+    }
+  }
+  
+  private boolean openRaFile() throws IOException {
+    if (target==null)
+      return false;
+    if (advisory==null || !advisory.isLocked())
+      return false;
+    if (rafile==null || rafile.getFD()==null || !rafile.getFD().valid()) {
+      rafile=new RandomAccessFile(target,"rw");
+    } else {
+      if (log.isDebugEnabled())
+        log.debug("Reusing existing RandomAccessFile on "+target);
+    }
+    return (rafile.getChannel()!=null) && rafile.getChannel().isOpen();
+  }
+  
+  public boolean isLocked() {
+    if (advisory != null) {
+      if (advisory.isLocked())
+        return true;
+      advisory=null;
+      if (log.isDebugEnabled())
+        log.debug("Lockfile "+_lock+" unexpectedly deleted ?");
+    }
+    return false;
+  }
+  
+  public void release() {
+    release(true);
+  }
+  
+  public void release(boolean closeChannel) {
+    if (!isLocked())
+      return;
+    if (log.isDebugEnabled())
+      log.debug("Releasing advisory lock on "+target);
+    if (closeChannel) {
+      if (rafile!=null) 
+        try {
+          rafile.close();
+        } catch (Exception e) {
+          log.debug("Unexpected exception whilst closing RandomAccessFile on "+target, e);
+        }
+        rafile=null; 
+    }
+    tidy();
+  }
+  
+  public FileInputStream getFileInputStream(boolean atStart) throws IOException {
+    if (!isLocked()) {
+      log.debug("Don't hold lock on "+target+" to get locked FileInputStream.");
+      return null;
+    }
+    openRaFile();
+    if (atStart)
+      rafile.seek(0);
+    return new FileInputStream(rafile.getFD());
+  }
+  
+  
+  public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
+    if (!isLocked()) {
+      log.debug("Don't hold lock on "+target+" to get locked FileOutputStream.");
+      return null;
+    }
+    openRaFile();
+    if (clear) {
+      rafile.seek(0);
+      rafile.setLength(0);
+    } else
+      rafile.seek(rafile.length());
+    return new LockedFileOutputStream(rafile.getFD());
+  }
+  
+  
+  public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
+    log.debug("Getting BufferedOutputStream (clear="+clear+")");
+    FileOutputStream fos = getFileOutputStream(clear);
+    if (fos!=null)
+      return new BufferedOutputStream(fos);
+    return null;
+  }
+  
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getLength()
+   */
+  public long length() {
+    if (isLocked()) {
+      if (!target.exists()) {
+        try {
+          target.createNewFile();
+        } catch (Exception e) {
+          log.error("Invalid lock:Failed to create target file "+target);
+          tidy();
+          return -1;
+        }
+        return 0;
+      }
+      return target.length();
+    }
+    return -1;
+  }
+  protected void finalize() throws Throwable {
+    release(true); // we explicitly lose the lock here.
+    super.finalize();
+  }
+  public RandomAccessFile getRaFile() throws IOException {
+    if (isLocked() && openRaFile()) {
+      return rafile;
+    }
+    log.debug("Failed to getRaFile on target "+target);
+    return null;
+  }
+  public FileChannel getRaChannel() throws IOException {
+    if (isLocked() && openRaFile()) {
+      return rafile.getChannel();
+    }
+    log.debug("Failed to getRaChannel on target "+target);
+    return null;
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/FileWatcher.java b/src/org/vamsas/client/simpleclient/FileWatcher.java
new file mode 100644 (file)
index 0000000..fe72381
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+
+/**
+ * Watches a particular file for its creation, deletion, or
+ * modification. The watcher is thread safe and different 
+ * instances watching the state of a particular file carry
+ * their own state record for the file.
+ */
+public class FileWatcher {
+
+  private File subject = null;
+
+  private long lastStat[];
+  boolean waslocked=false;
+  boolean exists = false;
+  /**
+   * transient lock on subject - can be passed back to calling class
+   * to preserve new state of file for immediate reading.
+   */
+  private Lock subjectLock = null;
+  /**
+   * clear local locks on subject.
+   *
+   */
+  private void clearLock() {
+    if (subjectLock!=null)
+      subjectLock.release();
+    subjectLock=null;
+  }
+  /**
+   *  
+   * @return true if subject exists and is locked by another process.
+   */
+  private boolean checkLock() {
+    if (subject!=null && subject.exists()) {
+      if (subjectLock!=null) {
+        subjectLock.release();
+      }
+      subjectLock = LockFactory.tryLock(subject);
+      if (subjectLock.isLocked()) {
+        return false;
+      }
+      clearLock();
+      return true;
+    }
+    return false;
+  }
+  
+  private long[] getStat(File subject) {
+    return new long[] { subject.lastModified(), subject.length() };
+  }
+  private boolean compStat(long[] stat, long[] newstat) {
+    if (stat[0]!=newstat[0] || stat[1]!=newstat[1])
+      return false;
+    return true;
+  }
+  /**
+   * Detect changes in file state and release of any
+   * lock in place during change.
+   * @return true if file state has changed. Leaves lock in subjectLock (ready to be passed to caller)
+   */
+  private boolean check() {
+    if (subject != null) {
+      if (!subject.exists()) {
+        if (exists) {
+          if (!waslocked) {
+            // !checkLock()) {
+          
+            exists = false;
+            // waslocked=false;
+            return true;
+          }
+        }
+        // locked - state change registered after lock is released
+        return false;
+      } else {
+        long[] newStat = getStat(subject); // subject.lastModified();
+        if (!checkLock()) {
+          // file is free to access, return state change
+          if (!exists || !compStat(lastStat, newStat)) {
+            waslocked=false;
+            exists=true;
+            lastStat=newStat;
+            return true;
+          }
+          // no change
+          return false;
+        } else {
+          waslocked=true;
+          return false;
+        }
+      }
+    }
+    return false;
+  }
+  /**
+   * updates internal record of file state when caller has intentionally
+   * modified subject. (ignores locked-state of subject)
+   */
+  public void setState() {
+    if (subject!=null) {
+      if (exists = subject.exists()) {
+        lastStat = getStat(subject);
+        waslocked = false;
+      }
+    }
+  }
+  
+  /**
+   * Make a watcher for a particular file. If the file doesn't exist, the
+   * watcher will watch for its creation (and indicate a change of state) 
+   * For locked files, the removal of a lock constitutes a change of 
+   * state if the file was modified.
+   * 
+   * @param subject
+   */
+  
+  public FileWatcher(File subject) {
+    this.subject = subject;
+    setState();
+  }
+  /**
+   * Test for change in file state. Only indicates a change 
+   * after any lock on a file has been released.
+   * @return true if file has been modified.
+   */
+  public boolean hasChanged() {
+    boolean res = check();
+    clearLock();
+    return res;
+  }
+  /**
+   * passes lock back to caller if hasChanged returned true.
+   * @return
+   */
+  public Lock getChangedState() {
+    boolean res = check();
+    if (res)
+      return subjectLock;
+    else {
+      clearLock();
+      return null;
+    }
+  }
+  /**
+   * safely? getting current state of the watched file
+   * @return
+   */
+  public long[] getCurrentState() {
+    return getStat(subject);
+  }
+  /**
+   * safely compare an externally recorded state with the current state
+   * for significant modifications.
+   * @param a
+   * @param b
+   * @return
+   */
+  public boolean diffState(long[] a, long[] b) {
+    return compStat(a,b);
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/IdFactory.java b/src/org/vamsas/client/simpleclient/IdFactory.java
new file mode 100644 (file)
index 0000000..81581be
--- /dev/null
@@ -0,0 +1,159 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.SessionHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.VorbaId;
+import org.vamsas.client.VorbaIdFactory;
+import org.vamsas.client.Vobject;
+import org.vamsas.objects.utils.document.VersionEntries;
+
+import java.util.Hashtable;
+import java.util.zip.CRC32;
+/**
+ * Simplest VorbaId constructor
+ * @author jimp
+ *
+ */
+public class IdFactory extends VorbaIdFactory {
+  static Log log = LogFactory.getLog(IdFactory.class);
+  private SessionHandle session=null;
+  private ClientHandle client;
+  private UserHandle user;
+  private CRC32 unique=new CRC32(); // used to attempt a unique but predictable stream for IDs
+  private String idstring;
+  int sequence=1; // incrementing value for next new ID
+  /**
+   * 
+   */
+  public IdFactory() {
+    super();
+    // TODO Auto-generated constructor stub
+  }
+  
+  /**
+   * @param session
+   * @param client
+   * @param user
+   */
+  protected IdFactory(SessionHandle session, ClientHandle client, UserHandle user) {
+    super();
+    this.session = session;
+    this.client = client;
+    this.user = user;
+    unique.reset();
+    unique.update(new Object[] { session, client, user}.toString().getBytes());
+    // TODO: Ensure format of URNs and use standard composition methods.
+    idstring = client.getClientName()+":"+unique.getValue()+".";
+    extantids=new Hashtable();
+    this.extanthashv=new Hashtable();
+  }
+  /**
+   * values for keys in this hash can be used to reference the org.vamsas.client.Vobject instance for the VorbaId string.
+   * @return the hash of all VorbaIds
+   */
+  protected Hashtable getVorbaIdHash() {
+    return extantids;
+  }
+  /**
+   * values for keys in this hash are Vobjhash objects created for each Vobj with a VorbaId
+   * after this factory has been used to write a vamsas archive.
+   * @return the hash of all VorbaIds and their hash values.
+   */
+  protected Hashtable getVobjhashVals() {
+    return extanthashv;
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#makeVorbaId()
+   */
+  public VorbaId makeVorbaId(Vobject vobject) {
+    if (session==null)
+      throw new Error("makeVorbaId called on improperly initialised IdFactory Vobject!");
+    if (!vobject.isRegisterable())
+      throw new Error("makeVorbaId called on unregisterable object.");
+    if (vobject.isRegistered())
+      throw new Error("makeVorbaId called on already registered object.");
+    String newidstring;
+    do {
+      if (sequence>0) {
+        sequence++;
+      } else {
+        idstring+="1/";
+        sequence=1;
+      }
+      newidstring=idstring+Integer.toString(sequence);
+    } while (extantids.containsKey(newidstring));
+    extantids.put(newidstring, vobject); // hash the Vobject by its new Id
+    VorbaId id = newId(newidstring); // VorbaId.hash()==newidstring.hash() so we can still recover vobject
+    return id;
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#setSession(org.vamsas.client.SessionHandle)
+   */
+  protected void setSession(SessionHandle sessionhandle) {
+    if (sessionhandle!=null)
+      session=sessionhandle;
+    else
+      log.warn("setSession(null) called.");
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#getSessionHandle()
+   */
+  public SessionHandle getSessionHandle() {
+    return session;
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#setClient(org.vamsas.client.ClientHandle)
+   */
+  protected void setClient(ClientHandle appHandle) {
+    if (appHandle!=null)
+      client = appHandle;
+    else
+      log.warn("setClient(null) called.");
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#getClientHandle()
+   */
+  public ClientHandle getClientHandle() {
+    return client;
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#setUser(org.vamsas.client.UserHandle)
+   */
+  protected void setUser(UserHandle userHandle) {
+  if (userHandle!=null)
+    user = userHandle;
+  else
+    log.warn("setUser(null) called.");
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.VorbaIdFactory#getUserHandle()
+   */
+  public UserHandle getUserHandle() {
+    return user;
+  }
+  /**
+   * Convenience method used for default behaviour in testing 
+   * and any anonymous internal vamsasDocument unmarshalling
+   * @param clientname
+   * @return
+   */
+  protected  static IdFactory getDummyFactory(String clientname) {
+    if (clientname==null)
+      clientname="org.vamsas.client.simpleclient.IdFactory";
+    return new IdFactory(new SessionHandle("dummy.session"), 
+        new ClientHandle(clientname,VersionEntries.latestVersion()), 
+        new UserHandle(clientname, "Arnold User's Inc."));
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/ListFile.java b/src/org/vamsas/client/simpleclient/ListFile.java
new file mode 100644 (file)
index 0000000..30956e9
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+
+/**
+ * base class for generic list storage and retrieval operations from a locked IO file
+ *  TODO: LATER: generalize for all list storage and retrieval operations 
+ *  (pull-up from ClientsFile object)
+ */
+public class ListFile extends SessionFile {
+
+  /**
+   * @param file
+   */
+  public ListFile(File file) throws java.io.IOException {
+    super(file);
+    if (!this.sessionFile.exists())
+      this.sessionFile.createNewFile();
+  }
+
+}
diff --git a/src/org/vamsas/client/simpleclient/Lock.java b/src/org/vamsas/client/simpleclient/Lock.java
new file mode 100644 (file)
index 0000000..d3a5889
--- /dev/null
@@ -0,0 +1,96 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.RandomAccessFile;
+import java.nio.channels.ByteChannel;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * transient object representing a file lock
+ * This lock should hold for all processes interacting in a session.
+ * @author jimp
+ */
+
+public abstract class Lock {
+  protected org.apache.commons.logging.Log log = LogFactory.getLog(Lock.class);
+  File target = null; // The file that is being locked
+  protected RandomAccessFile rafile=null;
+  
+  /**
+   * creates a valid Lock (test with <method>isLocked</method>)
+   * if a lock could be obtained for <param>lockfile</param>
+   * @param lockfile
+   */
+  protected Lock(java.io.File lockfile) {
+    target = lockfile;
+  }
+  /**
+   * 
+   * @return true if lock is held on the target
+   */
+  public abstract boolean isLocked();
+  /**
+   * release lock and close all managed channels to file
+   *
+   */
+  public abstract void release();
+  /**
+   * optionally close the open random access channel on the file when releasing lock
+   * @param closeChannel
+   */
+  public abstract void release(boolean closeChannel);
+
+  /**
+   * gets Locked Stream for reading from
+   * @param atStart true to start reading at beginning of file.
+   * @return null if file not locked
+   * @throws IOException
+   */
+  public abstract FileInputStream getFileInputStream(boolean atStart) throws IOException;
+
+  /**
+   * gets Locked stream to write to
+   * FileInput always starts at the *end* of the file (after any truncation)
+   * @param clear true means file will be cleared to zero length
+   * @return null if file is not locked
+   * @throws IOException
+   */
+  public abstract FileOutputStream getFileOutputStream(boolean clear) throws IOException;
+  /**
+   * return buffered output stream to locked file.
+   * @param clear - true means file is truncated to 0 length before writing 
+   * @return
+   */
+  public abstract BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException;
+  
+  protected void finalize() throws Throwable {
+    target=null;
+  }
+  /**
+   * return buffered input stream for locked file.
+   * @param atStart - true means read from begining of file
+   * @return null if file is not locked.
+   */
+  public BufferedInputStream getBufferedInputStream(boolean atStart) throws IOException {
+    FileInputStream fis = getFileInputStream(atStart);
+    if (fis!=null)
+      return new BufferedInputStream(fis);
+    return null;
+  }
+  /**
+   * safe lock target length() function.
+   * @return -1 for non-lockable target, otherwise target's file length 
+   */
+  public abstract long length();
+  public abstract RandomAccessFile getRaFile() throws IOException;
+  public abstract FileChannel getRaChannel() throws IOException;
+}
diff --git a/src/org/vamsas/client/simpleclient/LockFactory.java b/src/org/vamsas/client/simpleclient/LockFactory.java
new file mode 100644 (file)
index 0000000..5fdde6c
--- /dev/null
@@ -0,0 +1,52 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class LockFactory {
+  protected static Log log = LogFactory.getLog(LockFactory.class);
+  public static int locktype=0; // use file lock by default
+  public static String[] locktypes = {"file","native"};
+  {
+    String lockt = System.getProperty("vamsas.locktype");
+    if (lockt!=null) {
+      int i,j;
+      for (i=0, j=locktypes.length; i<j && locktypes[i].equalsIgnoreCase(lockt); i++)
+        ;
+      if (i>=j) {
+        String lt = "'"+locktypes[0]+"'";
+        for (i=1; i<j; i++)
+          lt += ",'"+locktypes[i]+"'";
+        log.warn("System property vamsas.locktype takes one of "+lt);
+        log.warn("Defaulting to Locktype of "+locktypes[locktype]);
+      }
+    } else
+      log.debug("Defaulting to Locktype of "+locktypes[locktype]);
+  }
+  /**
+   * lock target (blocks until lock is obtained)
+   * @param target
+   * @return lock
+   */
+  public static Lock getLock(java.io.File target) {
+    return getLock(target, true);
+  }
+  public static Lock getLock(java.io.File target, boolean block) { 
+    if (locktype==0)
+      return new FileLock(target, block);
+    if (locktype==1)
+      return new NativeLock(target, block);
+    log.fatal("Implementation Error! No valid Locktype value");
+    return null;
+  }
+  /**
+   * try to lock target 
+   * @param target
+   * @return null if lock was not possible
+   */
+  public static Lock tryLock(File target) {
+    return getLock(target, false);
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/LockTimeoutException.java b/src/org/vamsas/client/simpleclient/LockTimeoutException.java
new file mode 100644 (file)
index 0000000..8dc1317
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+/**
+ * @author jimp
+ *
+ */
+public class LockTimeoutException extends Exception {
+  static final long serialVersionUID=1;
+  static final String defaultMessage = "Timeout whilst waiting for lock on VamsasDocument";
+  public LockTimeoutException() {
+    super(defaultMessage);
+  }
+  public LockTimeoutException(String arg0, Throwable arg1) {
+    super(arg0+" (timeout whilst waiting for lock)", arg1);
+    // TODO Auto-generated constructor stub
+  }
+  public LockTimeoutException(String arg0) {
+    super(arg0+" (timeout whilst waiting for lock)");
+    // TODO Auto-generated constructor stub
+  }
+  public LockTimeoutException(Throwable arg0) {
+    super(defaultMessage, arg0);
+    // TODO Auto-generated constructor stub
+  }
+  
+}
diff --git a/src/org/vamsas/client/simpleclient/LockedFileOutputStream.java b/src/org/vamsas/client/simpleclient/LockedFileOutputStream.java
new file mode 100644 (file)
index 0000000..1d59c8a
--- /dev/null
@@ -0,0 +1,159 @@
+/**\r
+ * \r
+ */\r
+package org.vamsas.client.simpleclient;\r
+\r
+import java.io.File;\r
+import java.io.FileDescriptor;\r
+import java.io.FileNotFoundException;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.io.OutputStream;\r
+import java.nio.channels.FileChannel;\r
+\r
+import org.apache.commons.logging.LogFactory;\r
+\r
+/**\r
+ * @author Jim\r
+ *\r
+ */\r
+public class LockedFileOutputStream extends FileOutputStream {\r
+  private static org.apache.commons.logging.Log log = LogFactory.getLog(LockedFileOutputStream.class);\r
+  //FileOutputStream ostream=null;\r
+  boolean closed=true;\r
+  private void init() {\r
+    FileChannel ch = super.getChannel();\r
+    if (ch!=null) {\r
+      try { closed = !ch.isOpen();\r
+      } catch (Exception e) {\r
+        closed=true;\r
+        log.debug("Invalid LockedOutputStream marked closed.",e);\r
+      }\r
+    }\r
+  }\r
+  /**\r
+   * @param file\r
+   * @throws FileNotFoundException\r
+   */\r
+  public LockedFileOutputStream(File file) throws FileNotFoundException {\r
+    super(file); // super(file);\r
+    init();\r
+  }\r
+\r
+  /**\r
+   * @param file\r
+   * @param append\r
+   * @throws FileNotFoundException\r
+   */\r
+  public LockedFileOutputStream(File file, boolean append)\r
+      throws FileNotFoundException {\r
+    super(file, append);\r
+    init();\r
+  }\r
+\r
+  /**\r
+   * @param fdObj\r
+   */\r
+  public LockedFileOutputStream(FileDescriptor fdObj) {\r
+    super(fdObj);\r
+    init();\r
+    if (fdObj.valid())\r
+      closed=false;\r
+  }\r
+\r
+  /**\r
+   * @param name\r
+   * @throws FileNotFoundException\r
+   */\r
+  public LockedFileOutputStream(String name) throws FileNotFoundException {\r
+    super(name);\r
+    init();\r
+  }\r
+\r
+  /**\r
+   * @param name\r
+   * @param append\r
+   * @throws FileNotFoundException\r
+   */\r
+  public LockedFileOutputStream(String name, boolean append)\r
+      throws FileNotFoundException {\r
+    super(name, append);\r
+    init();\r
+  }\r
+  /**\r
+   * closes - actually just flushes the stream instead.\r
+   */\r
+  public void close() throws IOException {\r
+    if (!closed) {\r
+      super.flush();\r
+      super.getChannel().force(true);\r
+      log.debug("Marking Lockedoutputstream closed.");\r
+    } else\r
+      throw new IOException("Close on already closed FileOutputStream.");\r
+    closed=true;\r
+  }\r
+\r
+\r
+  /**\r
+   * @throws IOException\r
+   * @see java.io.OutputStream#flush()\r
+   */\r
+  public void flush() throws IOException {\r
+    if (!closed)\r
+      super.flush();\r
+    else\r
+      throw new IOException("flush on closed FileOutputStream");\r
+  }\r
+\r
+  /**\r
+   * @return\r
+   * @see java.io.FileOutputStream#getChannel()\r
+   */\r
+  public FileChannel getChannel() {\r
+    if (!closed)\r
+      return super.getChannel();\r
+    else\r
+      return null;\r
+  }\r
+\r
+\r
+\r
+  /**\r
+   * @param b\r
+   * @param off\r
+   * @param len\r
+   * @throws IOException\r
+   * @see java.io.FileOutputStream#write(byte[], int, int)\r
+   */\r
+  public void write(byte[] b, int off, int len) throws IOException {\r
+    if (!closed)\r
+      super.write(b, off, len);\r
+    else\r
+      throw new IOException("write on Closed FileOutputStream");\r
+  }\r
+\r
+  /**\r
+   * @param b\r
+   * @throws IOException\r
+   * @see java.io.FileOutputStream#write(byte[])\r
+   */\r
+  public void write(byte[] b) throws IOException {\r
+    if (!closed)\r
+      super.write(b);\r
+    else\r
+      throw new IOException("write on Closed FileOutputStream");\r
+  }\r
+\r
+  /**\r
+   * @param b\r
+   * @throws IOException\r
+   * @see java.io.FileOutputStream#write(int)\r
+   */\r
+  public void write(int b) throws IOException {\r
+    if (!closed)\r
+      super.write(b);\r
+    else\r
+      throw new IOException("write on Closed FileOutputStream");\r
+  }\r
+  \r
+}\r
diff --git a/src/org/vamsas/client/simpleclient/NativeLock.java b/src/org/vamsas/client/simpleclient/NativeLock.java
new file mode 100644 (file)
index 0000000..6a624f1
--- /dev/null
@@ -0,0 +1,173 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.ReadableByteChannel;
+
+/**
+ * @author JimP
+ *
+ */
+public class NativeLock extends Lock {
+
+  protected FileLock lock = null;
+
+  /**
+   * @param lockfile
+   * @param block true means thread will block until a lock is obtained.
+   */
+  public NativeLock(File lockfile, boolean block) {
+    super(lockfile);
+    // try and get a lock.
+    lock = null;
+    
+    try {
+      if (!lockfile.exists())
+        if (!lockfile.createNewFile()) {
+          log.warn("Failed to create locked file "+lockfile);
+          return;
+        }
+      
+      rafile=new RandomAccessFile(lockfile,"rw");
+      if (block)
+        lock = rafile.getChannel().lock();
+      else
+        lock = rafile.getChannel().tryLock();
+      if (lock==null || !lock.isValid()) {
+        // failed to get lock. Close the file channel
+        log.debug("failed to get lock for "+lockfile);
+        rafile.getChannel().close();
+        lock=null;
+      }
+    } catch (FileNotFoundException e) {
+      //
+      log.debug("Lock failed - normal behaviour for windows locking.");
+      //log.error("Error! Couldn't create a lockfile at "
+      //  + lockfile.getAbsolutePath(), e);
+    } catch (IOException e) {
+      log.error("Error! Problems with IO when creating a lock on "
+          + lockfile.getAbsolutePath(),e);
+    }
+  }
+
+  public boolean isLocked() {
+    if (lock != null && lock.isValid()) {
+      return true;
+    }
+    return false;
+  }
+
+  public void release() {
+    release(true);
+  }
+
+  public void release(boolean closeChannel) {
+    try {
+      // channel.close should be called before release() for rigourous locking.
+      if (rafile!=null && rafile.getFD().valid() && rafile.getChannel()!=null && lock.isValid()) {
+        if (closeChannel && rafile.getChannel().isOpen()) {
+            rafile.close();
+            rafile=null; 
+        }
+        if (lock!=null && lock.isValid())
+          lock.release();
+        
+      }
+    } catch (IOException e) {
+      log.warn("Whilst releasing lock",e);
+    }
+    lock=null;
+  }
+
+  /**
+   * gets Locked Stream for reading from
+   * @param atStart true to start reading at beginning of file.
+   * @return null if file not locked
+   * @throws IOException
+   */
+  public FileInputStream getFileInputStream(boolean atStart) throws IOException {
+    if (!isLocked())
+      return null;
+    if (atStart)
+      rafile.seek(0);
+    return new FileInputStream(rafile.getFD());
+  }
+
+  /**
+   * gets Locked stream to write to
+   * FileInput always starts at the *end* of the file (after any truncation)
+   * @param clear true means file will be cleared to zero length
+   * @return null if file is not locked
+   * @throws IOException
+   */
+  public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
+    if (!isLocked())
+      return null;
+    if (clear) {
+      rafile.seek(0);
+      rafile.setLength(0);
+    } else
+      rafile.seek(rafile.length());
+    return new LockedFileOutputStream(rafile.getFD());
+  }
+
+  /**
+   * return buffered output stream to locked file.
+   * @param clear - true means file is truncated to 0 length before writing 
+   * @return
+   */
+  public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
+    OutputStream fos = getFileOutputStream(clear);
+    if (fos!=null)
+      return new BufferedOutputStream(fos);
+    return null;
+  }
+  /**
+   * @see org.vamsas.client.simpleclient.Lock#finalize()
+   */
+  protected void finalize() throws Throwable {
+    release(true); // we explicitly lose the lock here.
+    // log.debug("lock closing through garbage collection ?");
+    super.finalize();
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getLength()
+   */
+  public long length() {
+    if (isLocked()){
+      try {
+        return rafile.length();
+      } catch (Exception e) {
+        log.debug("getLength exception:",e);
+      }
+    }
+    return -1;
+  }
+
+  public RandomAccessFile getRaFile() throws IOException {
+    if (isLocked())
+      return rafile;
+    else
+      log.debug("Failed to getRaFile on "+target);
+    return null;
+  }  
+  
+  public FileChannel getRaChannel() throws IOException {
+    if (isLocked())
+      return rafile.getChannel();
+    else
+      log.debug("Failed to getRaChannel on "+target);
+    return null;
+  }
+
+}
diff --git a/src/org/vamsas/client/simpleclient/SessionFile.java b/src/org/vamsas/client/simpleclient/SessionFile.java
new file mode 100644 (file)
index 0000000..c9f9e67
--- /dev/null
@@ -0,0 +1,215 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.ReadableByteChannel;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Basic methods for classes handling locked IO on files 
+ * monitored by all (simpleclient) clients in a vamsas session.
+ * @author jimp
+ *TODO: support non nio file locking capable systems
+ */
+public class SessionFile {
+  private static Log log = LogFactory.getLog(SessionFile.class);
+  protected File sessionFile;
+  protected Lock fileLock = null;
+
+  protected SessionFile(File file) {
+    super();
+    sessionFile = file;
+  }
+
+  protected boolean lockFile(Lock extantlock) {
+    if (fileLock!=null && !fileLock.isLocked()) {
+      fileLock.release();// tidy up invalid lock
+      fileLock=null;
+    }
+    if (extantlock!=null && extantlock.isLocked())
+      fileLock=extantlock; // THIS IS BROKEN - lockFile then nulls the lock.
+    return lockFile();
+  }
+  private boolean ensureSessionFile() {
+    if (sessionFile != null) {
+      if (!sessionFile.exists()) {
+        // create new file
+        try {
+          if (!sessionFile.createNewFile()) {
+            log.error("Failed to create file prior to locking: "+sessionFile);
+            return false;
+          }
+        } catch (IOException e) {
+          log.error("Exception when trying to create file "+sessionFile, e);
+          return false;
+        }
+      }
+      return true;
+    }
+    log.error("ensureSessionFile called for non-initialised SessionFile!");
+    return false;
+  }
+  /**
+   * Get a lock for the SessionFile
+   * 
+   * @return true if lock was made
+   */
+  protected boolean lockFile() {
+    if (fileLock != null) {
+      if (fileLock.isLocked()) {
+        if (!ensureSessionFile())
+          return false;
+        return true;
+      } else {
+        // lock failed for some reason.
+        fileLock.release();
+        log.info("Unexpected session file lock failure. Trying to get it again.");
+        fileLock=null;
+      }
+    }
+    if (!ensureSessionFile())
+      return false;
+    // TODO: see if we need to loop-wait for locks or they just block until
+    // lock is made...
+    long tries=5000;
+    do {
+      tries--;
+      if (fileLock==null || !fileLock.isLocked()) {
+        //try { Thread.sleep(1); } catch (Exception e) {};
+        fileLock = LockFactory.getLock(sessionFile,true); // TODO: wait around if we can't get the lock.
+          }
+      } while (tries>0 && !fileLock.isLocked());
+    if (!fileLock.isLocked())
+      log.error("Failed to get lock for "+sessionFile);
+    // fileLock = new Lock(sessionFile);
+    return fileLock.isLocked();    
+  }
+
+  /**
+   * Explicitly release the SessionFile's lock.
+   * 
+   * @return true if lock was released.
+   */
+  protected void unlockFile() {
+    if (fileLock != null) {
+      fileLock.release();    
+      fileLock = null;
+    }
+  }
+
+  /**
+   * Makes a backup of the sessionFile.
+   * @return Backed up SessionFile or null if failed to make backup.
+   */
+  protected File backupSessionFile() {
+    return backupSessionFile(null, sessionFile.getName(),".old", sessionFile.getParentFile());
+  }
+
+  protected File backupSessionFile(Lock extantLock, String backupPrefix, String backupSuffix, File backupDir) {
+    File tempfile=null;
+    if (lockFile(extantLock)) {
+      try {
+        tempfile = File.createTempFile(backupPrefix, backupSuffix, backupDir);
+        if (fileLock.length()>0) {
+          FileOutputStream tos = new FileOutputStream(tempfile);
+          ReadableByteChannel channel;
+          tos.getChannel().transferFrom(channel=fileLock.getRaChannel(), 0,
+              fileLock.length());
+          tos.close();
+          if (!channel.isOpen())
+            throw new Error(tos.getChannel().getClass()+".transferFrom closes source channel!");
+          if (!lockFile(extantLock))
+            throw new Error("Lost lock for "+sessionFile.getName()+" after backup.");
+          
+        }
+      } catch (FileNotFoundException e1) {
+        log.warn("Can't create temp file for "+sessionFile.getName(),e1);
+        tempfile=null;
+      } catch (IOException e1) {
+        log.warn("Error when copying content to temp file for "+sessionFile.getName(),e1);
+        tempfile=null;
+      }
+    }
+    return tempfile;
+  }
+  /**
+   * Replaces data in sessionFile with data from file handled by another sessionFile
+   * passes up any exceptions.
+   * @param newData source for new data
+   */
+  protected void updateFrom(Lock extantLock, SessionFile newData) throws IOException {
+    log.debug("Updating "+sessionFile.getAbsolutePath()+" from "+newData.sessionFile.getAbsolutePath());
+    if (newData==null)
+      throw new IOException("Null newData object.");
+    if (newData.sessionFile==null)
+      throw new IOException("Null SessionFile in newData.");
+      
+    if (!lockFile(extantLock))
+      throw new IOException("Failed to get write lock for "+sessionFile);
+    if (!newData.lockFile())
+      throw new IOException("Failed to get lock for updateFrom "+newData.sessionFile);
+    RandomAccessFile nrafile = newData.fileLock.getRaFile();
+    nrafile.seek(0);
+    RandomAccessFile trafile = fileLock.getRaFile();
+    /*long tries=5000;
+    while (trafile==null && --tries>0) {
+      log.debug("Lost lock on "+sessionFile+"! Re-trying for a transfer.");
+      lockFile();
+      trafile = fileLock.getRaFile();
+    }*/
+    trafile.seek(0);
+    trafile.getChannel().transferFrom(nrafile.getChannel(), 0, 
+        nrafile.length());
+  }
+  /**
+   * remove all trace of the sessionFile file
+   *
+   */
+  protected void eraseExistence() {
+    unlockFile();
+    if (sessionFile!=null) {
+      sessionFile.delete();
+      sessionFile = null;
+    }
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getBufferedInputStream(boolean)
+   */
+  public BufferedInputStream getBufferedInputStream(boolean atStart) throws IOException {
+    lockFile();
+    return fileLock.getBufferedInputStream(atStart);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getBufferedOutputStream(boolean)
+   */
+  public BufferedOutputStream getBufferedOutputStream(boolean clear) throws IOException {
+    lockFile();
+    return fileLock.getBufferedOutputStream(clear);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getFileInputStream(boolean)
+   */
+  public FileInputStream getFileInputStream(boolean atStart) throws IOException {
+    lockFile();
+    return fileLock.getFileInputStream(atStart);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.simpleclient.Lock#getFileOutputStream(boolean)
+   */
+  public FileOutputStream getFileOutputStream(boolean clear) throws IOException {
+    lockFile();
+    return fileLock.getFileOutputStream(clear);
+  }
+  
+}
diff --git a/src/org/vamsas/client/simpleclient/SessionFlagFile.java b/src/org/vamsas/client/simpleclient/SessionFlagFile.java
new file mode 100644 (file)
index 0000000..7826fbc
--- /dev/null
@@ -0,0 +1,85 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * methods for setting and checking 
+ * binary flags in a vamsas session directory.
+ * all methods apart from the constructor will 
+ * throw a fatal error if the flagFile is not
+ * a valid java.io.File object.
+ * LATER: extract SessionFlag interface for generalizing the vamsas session code 
+ * @author jimp
+ *
+ */
+public class SessionFlagFile {
+  private static Log log = LogFactory.getLog(SessionFlagFile.class);
+  protected File flagFile=null;
+  private void checkFlagFile() {
+    if (flagFile==null) {
+      log.fatal("Implementation error - uninitialized SessionFlagFile", 
+          new Error("Implementation error - uninitialized SessionFlagFile"));
+    }
+  }
+  /**
+   * will log a warning if exceptions occur during flag creation.
+   * @return true if flag was set successfully
+   */
+  public boolean setFlag() {
+    checkFlagFile();
+    try {
+      if (flagFile.createNewFile()) {
+        log.debug("Set session flag "+flagFile);
+      } else {
+        log.debug("Session flag already set "+flagFile);
+      }
+      return true;
+    }
+    catch (Exception e) {
+      log.warn("Couldn't set session flag "+flagFile, e);
+    }
+    return false;
+  }
+  /**
+   * 
+   * @return true if flag was cleared successfully
+   */
+  public boolean clearFlag() {
+    checkFlagFile();
+    if (flagFile.exists()) {
+      log.debug("clearing session flag "+flagFile);
+      if (!flagFile.delete()) {
+        log.warn("failed to clear session flag "+flagFile);
+        return false;
+      }
+    } else {
+      log.debug("clearFlag called for already cleared flag "+flagFile);
+    }
+    return true;
+  }
+    /**
+     * 
+     * @return state of session flag
+     */
+  public boolean checkFlag() {
+    checkFlagFile();
+    if (flagFile.exists()) {
+      if (log.isDebugEnabled())
+        log.debug("Flag '"+flagFile+"' is set.");
+      return true;
+    }
+    if (log.isDebugEnabled())
+      log.debug("Flag '"+flagFile+"' is not set.");    
+    return false;
+  }
+    /**
+     * @param flagFile
+     */
+    public SessionFlagFile(File flagFile) {
+      super();
+      this.flagFile = flagFile;
+    };
+}
diff --git a/src/org/vamsas/client/simpleclient/SessionUrn.java b/src/org/vamsas/client/simpleclient/SessionUrn.java
new file mode 100644 (file)
index 0000000..13b6f23
--- /dev/null
@@ -0,0 +1,40 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
+/**
+ * SessionUrn for simpleclient sessions:
+ * simpleclient://{Absolute path to session directory}
+ * @author jimp
+ *
+ */
+public class SessionUrn extends org.vamsas.client.SessionUrn {
+  /**
+   * a simple client session urn prefix
+   */
+  public static final String SIMPLECLIENT="simpleclient";
+  public static String VAMSASDOCUMENT="vdoc";
+  static {
+    TYPES.put(SIMPLECLIENT, SessionUrn.class);
+    TYPES.put(SessionUrn.VAMSASDOCUMENT, SessionUrn.class);
+  }
+  
+  public SessionUrn(File sessionLocation) throws MalformedURLException {
+  // TODO: LATER: implement switch to have vamsas document or simpleclient sessions for same constructor
+    super(SIMPLECLIENT, sessionLocation.getAbsoluteFile().toURL());
+    //else
+      // super(VAMSASDOCUMENT, sessionLocation);
+  }
+  public SessionUrn(VamsasSession session) throws MalformedURLException {
+    super(SIMPLECLIENT, session.sessionDir.getAbsoluteFile().toURL());
+  }
+  /**
+   * TODO: LATER: think about this again.
+   * @return File(urn.getPath())
+   */
+  public File asFile() {
+    return new File(urn.getPath());
+  }
+  // TODO: add abstract 'handler' methods for resolving the URN to a particular class
+}
diff --git a/src/org/vamsas/client/simpleclient/SessionsFile.java b/src/org/vamsas/client/simpleclient/SessionsFile.java
new file mode 100644 (file)
index 0000000..eb80f45
--- /dev/null
@@ -0,0 +1,342 @@
+/* EMBL - The European Bioinformatics institute
+* MSD Group
+* VAMSAS Project
+*
+*  Copyright (c) 2005-2006 Thr European Bioinformatics Institute. All rights reserved.
+*
+*   Redistribution and use in source and binary forms, with or without
+*   modification, are permitted provided that the following conditions
+*   are met:
+*  
+*   1. Redistributions of source code must retain the above copyright
+*      notice, this list of conditions and the following disclaimer. 
+*  
+*   2. Redistributions in binary form must reproduce the above copyright
+*      notice, this list of conditions and the following disclaimer in
+*      the documentation and/or other materials provided with the
+*      distribution.
+*  
+*   3. The name MSD must not be used to endorse or promote products 
+*      derived from this software without prior written permission. For 
+*      written permission, please contact msd-help@ebi.ac.uk
+*  
+*   4. Products derived from this software may not be called "MSD"
+*      nor may "MSD" appear in their names without prior written
+*      permission of the MSD developers.
+*  
+*   5. Redistributions of any form whatsoever must retain the following
+*      acknowledgment:
+*      "This product includes software developed by MSD 
+*       (http://www.ebi.ac.uk/)"
+*  
+*   THIS SOFTWARE IS PROVIDED BY THE MSD GROUP ``AS IS'' AND ANY
+*   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+*   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+*   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ENSEMBL GROUP OR
+*   ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+*   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+*   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+*   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+*   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+*   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+*   OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The European Bioinformatics Institute may publish revised and/or new
+* versions of this license with new releases of VAMSAS software.
+*==============================================================================
+*
+*  @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
+* 
+* Dec 13, 2006  - VamsasClientV4
+*
+*/
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.SessionHandle;
+
+/**
+ * @author <a href="mailto:pierre@ebi.ac.uk">Pierre MARGUERITE</a>
+ * 
+ * 
+ */
+public class SessionsFile extends ListFile {
+  
+  private static Log log = LogFactory.getLog(SessionsFile.class);
+  /**
+   * when set true - get FileNotFoundExceptions on WinXP when writing to locked stream after the backup has been made (via the backupFile method)
+   */
+  boolean backup=false;
+  /**
+   * number of my session in list - passed back when a session 
+   * is added to list, and used (if valid) for quickly 
+   * looking up presence of session handle in the list.
+   */
+  private int syncnum = 1;
+  /**
+   * @param file
+   */
+  public SessionsFile(File file) throws java.io.IOException {
+    super(file);
+  }
+  
+  
+  /**
+   * internal method for getting sessionsList - ensures a lock has been made but
+   * does not release it.
+   * 
+   * @return list of clients
+   */
+  private SessionHandle[] retrieveSessionHandles() {
+    if (lockFile()) {
+      try {
+        SessionHandle[] clients=null;
+        if (this.fileLock.length()>0) {
+          
+          ObjectInputStream is = new ObjectInputStream(this.fileLock.getBufferedInputStream(true));
+          Object o;
+          o=is.readObject();
+          if (o!=null) {
+            try {
+              clients = (SessionHandle[]) o;
+            }
+            catch (Exception e) {
+              log.error("Garbage in the clientHandle list "+this.sessionFile,e);
+            }
+          }
+        }
+        return clients;
+      } catch (FileNotFoundException e) {
+       // e.printStackTrace(System.err);
+        log.error(e);
+      } catch (Exception e) {
+        log.error(e);
+        //e.printStackTrace(System.err);
+      }
+    }
+    return null;
+  }
+
+  /**
+   * get the SessionsList from the file. May return null if lock failed!
+   * @return sessionsList
+   */
+  public SessionHandle[] retrieveSessionsList() {
+    if (lockFile()) {
+      SessionHandle[] clients = retrieveSessionHandles();
+      unlockFile();
+      return clients;
+    }
+    return null;
+  }
+
+  /**
+   * get list from the locked ClientList.
+   * @param extantlock
+   * @return clientList or null if lock failed (or file was empty)
+   */
+  public SessionHandle[] retrieveSessionsList(Lock extantlock) {
+    if (lockFile(extantlock)) {
+     SessionHandle[] clients = retrieveSessionHandles();
+      unlockFile();
+      return clients;
+    }
+    return null;
+  }
+  
+  /**
+   * adds clientHandle me to the clientList under an existing lock extantLock.
+   * @param me
+   * @param extantLock
+   * @return client index in list or 0 if lock was invalid or addClient operation failed.
+   */
+  public int addSession(SessionHandle me, Lock extantLock) {
+    return addSession(me, true, extantLock);
+  }
+  
+  /**
+   * adds SessionsHandle me to the sessionsList under an existing lock.
+   * @param me - sessionsHandle
+   * @param disambig - if true then add will fail if an identical clientHandle already exists
+   * @param extantLock - existing lock
+   * @return client index in list or 0 if addClient (or the lock) failed.
+   */
+  
+  public int addSession(SessionHandle session, boolean disambig, Lock extantLock) {
+    if (lockFile(extantLock)) {
+      this.syncnum = addSession(session, disambig);
+      unlockFile();
+      return this.syncnum;
+    }
+    return 0;
+  }
+  
+  /**
+   * removes the current session from the  SessionsList without complaint if the session isn't in the sessionsList already.
+   * @param me client handle to be removed
+   * @param clientlock existing lock passed from watcher.
+   */
+  public void removeSession(SessionHandle session, Lock clientlock) {
+    int mynum =-1;
+    if (lockFile(clientlock)) {
+      SessionHandle[] sessions = retrieveSessionHandles();
+      if (sessions != null) {
+        if ((this.syncnum<=0 || this.syncnum>sessions.length) || sessions[this.syncnum-1]!=session) {
+          for (int i = 0, j = sessions.length; i < j; i++) 
+            if (sessions[i].equals(session)) {
+              mynum=i;
+              break;
+            }
+        } else {
+          mynum=this.syncnum-1;
+        }
+        if (mynum>-1) {
+          SessionHandle[] newlist = new SessionHandle[sessions.length - 1];
+          for (int k=0,i = 0, j = sessions.length; i < j; i++)
+            if (i!=mynum)
+              newlist[k++] = sessions[i];
+          if (!putSessionsList(newlist))
+            throw new Error("Failed to write new sessionsList!"); // failed to put the sessionList to disk.
+        }
+      }
+      unlockFile();
+    } else {
+      throw new Error("Couldn't get lock for "+((sessionFile==null) ? "Unitialised sessionFile in SessionsFile" : this.sessionFile.getAbsolutePath()));
+    }
+  }
+  /**
+   * Adds a SessionHandle to the SessionList file - optionally disambiguating 
+   * the SessionHandle (modifes the URN). 
+   * Note: Caller is left to release the lock on the SessionList.
+   * @param me
+   * @param disambiguate -
+   *          flag indicating if the URN for me should be disambiguated to
+   *          differentiate between sessions.
+   * @return index of sessionHandle in new list, or -1-position of existing
+   *         sessionHandle (if disambiguate is true)
+   */
+  protected int addSession(SessionHandle session, boolean disambiguate) {
+    int newsession = 0;
+    int tries=5;
+    while (tries-->0 && !lockFile())
+      try { Thread.sleep(1); } catch (Exception e){};
+    if (lockFile()) {
+      SessionHandle[] sessions = retrieveSessionHandles();
+
+      if (sessions == null) {
+        sessions = new SessionHandle[1];
+        sessions[0] = session;
+        newsession = 1;
+      } else {
+        int k = 0;
+        for (int i = 0, j = sessions.length; i < j; i++) {
+          if ( sessions[i].equals(session)) {
+            if (disambiguate) {
+              while (sessions[i].equals(session)) {
+               // me.setClientUrn(me.getClientUrn() + k++); // TODO: make a better
+                                                          // disambiguation of
+                                                          // urn.
+              }
+            } else {
+              // will not write the ambiguous clientHandle to disk, just return
+              // its index.
+              return -1 - i;
+            }
+          }
+        }
+        int i, j;
+        SessionHandle[] newlist = new SessionHandle[sessions.length + 1];
+        for (i = 0, j = sessions.length; i < j; i++)
+          newlist[i] = sessions[i];
+        newlist[j] = session;
+        sessions = newlist;
+        newsession = j+1;
+      }
+      if (!putSessionsList(sessions))
+        return 0; // failed to put the clientList to disk.
+    }
+    return newsession;
+  }
+  
+  
+  /**
+   * safely writes sessions array to the file referred to by sessionFile.
+   * 
+   * @param clients
+   * @return true if successful write. Throws Errors otherwise.
+   */
+  protected boolean putSessionsList(SessionHandle[] clients) {
+    if (lockFile()) {
+      File templist=null;
+      if (!this.backup || (templist = backupSessionFile()) != null) {
+        int retries=3;
+        while (retries-->0) {
+          try {
+            ObjectOutputStream os = 
+              new ObjectOutputStream(this.fileLock.getBufferedOutputStream(true));
+            log.debug("About to write "+clients.length+" sessionHandles to output stream.");
+            os.writeObject(clients);
+            os.close();
+          // All done - remove the backup.
+          if (this.backup)
+            templist.delete();
+          templist = null;
+          retries=-1;
+          } catch (Exception e) {
+           // System.err
+            //.println("Serious - problems writing to sessionFile.");
+            log.error("Serious - problems writing to sessionFile.",e);
+            if (retries>0 && templist != null) {
+            //  System.err.println("Recovering from Backup in "
+              //        + templist.getAbsolutePath());
+              log.error("Recovering from Backup in "+ templist.getAbsolutePath());
+              templist.renameTo(this.fileLock.target);
+            }
+            //e.printStackTrace(System.err);
+            log.error(e);
+          }
+        }
+        if (retries>-2) {
+         // System.err
+         // .println("Serious - problems writing to sessionFile. Giving Up.");
+          log.error("Serious - problems writing to sessionFile. Giving Up.");
+          return false;
+        }
+      } else {
+        throw new Error(
+            "Couldn't create backup of the clientList before writing to it!");
+      }
+    } else {
+      throw new Error("Could not lock the clientList: "
+          + ((this.sessionFile == null) ? "Unitialized ClientsFile"
+              : " failed to get lock on " + this.sessionFile.getAbsolutePath()));
+    }
+    // successful!
+    return true;
+  }
+
+  public void clearList() {
+    if (lockFile()) {
+      try {
+        FileOutputStream fout = this.fileLock.getFileOutputStream(true);
+        fout.flush();
+        fout.close();
+      } catch (Exception e) {
+        throw new Error("Problems trying to clear clientlist!",e);
+        
+      }
+    }
+    
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/SimpleClient.java b/src/org/vamsas/client/simpleclient/SimpleClient.java
new file mode 100644 (file)
index 0000000..2041c11
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ * Created on 15-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.client.simpleclient;
+
+import java.beans.EventHandler;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.Events;
+import org.vamsas.client.IClient;
+import org.vamsas.client.IClientDocument;
+import org.vamsas.client.IObjectUpdate;
+import org.vamsas.client.InvalidSessionUrnException;
+import org.vamsas.client.SessionHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.LockFile;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.AppDataReference;
+import org.vamsas.objects.utils.ProvenanceStuff;
+import org.vamsas.objects.utils.document.VersionEntries;
+
+/**
+ * @author jimp
+ */
+public class SimpleClient implements IClient {
+  
+  private static Log log = LogFactory.getLog(SimpleClient.class);
+  
+  protected UserHandle user = null;
+  
+  protected SessionUrn session = null;
+  protected VamsasSession _session;
+  protected ClientHandle client = null;
+  protected EventGeneratorThread evgen = null;
+  protected ClientDocument cdocument = null;
+  /**
+   * object hash table that persists in each client holding vorbaIds and hash values after a document write
+   */
+  protected Hashtable extantobjects=null;
+  /**
+   * construct a transient IdFactory instance - this should last only as long as the 
+   * SimpleClient object holds the lock on the vamsas document being created/manipulated.
+   * @return
+   */
+  private IdFactory makeVorbaIdFactory() {
+    return new IdFactory(getSessionHandle(), client, user);
+  }
+  
+  /**
+   * construct SimpleClient for user, client and VamsasSession directory
+   * use the SimpleClientFactory rather than this constructor directly. 
+   * @param user
+   * @param client
+   * @param sess
+   */
+  protected SimpleClient(UserHandle user, ClientHandle client, VamsasSession sess) throws InvalidSessionUrnException {
+    // TODO: validate user/client/session
+    _session = sess;
+    this.user = user;
+    this.client = client;
+    try {
+      session = new SessionUrn(_session);
+    } catch (MalformedURLException e) {
+      log.error("Couldn't form a valid SessionUrn object!",e);
+      throw new InvalidSessionUrnException(_session.toString());
+    }
+  }
+  /**
+   * construct new session by importing objects from an existing vamsas document
+   * @param user
+   * @param client
+   * @param sess
+   * @param importingArchive
+   * @throws Exception IOExceptions for Session IO problems, and general Exception if importing document is invalid.
+   */
+  protected SimpleClient(UserHandle user, ClientHandle client, VamsasSession sess, File importingArchive) throws Exception {
+    this(user, client, sess);
+    VamsasArchive sessdoc = _session.getVamsasDocument();
+    try {
+      VamsasArchiveReader odoc = new VamsasArchiveReader(importingArchive);
+      SimpleDocument sdoc = new SimpleDocument(makeVorbaIdFactory());
+      VamsasDocument doc = sdoc.getVamsasDocument(odoc);
+      sessdoc.putVamsasDocument(doc, sdoc.vorba);
+      sessdoc.closeArchive();
+    } catch (Exception e) {
+      sessdoc.cancelArchive();
+      // write a dummy archive
+      _session.slog.info("Exception when importing document data from "+importingArchive);
+      throw new Exception("Failed to import data from "+importingArchive, e);
+    }
+  }
+  
+  /*
+   * (non-Javadoc)
+   * LATER: check that build substitution variables are correct
+   * @see org.vamsas.client.IClient#getAbout()
+   */
+  public String getAbout() {
+    return new String("VORBA SimpleClient version $version$ build $build$");
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#getSessionUrn()
+   */
+  public String getSessionUrn() {
+    return session.getSessionUrn();
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#getSessionHandle()
+   */
+  public SessionHandle getSessionHandle() {
+    // TODO: eliminate SessionHandle ? need to refactor interfaces.
+    SessionHandle sh = new SessionHandle(session.getSessionUrn());
+    return sh;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#getClientHandle()
+   */
+  public ClientHandle getClientHandle() {
+    return client;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#getUserHandle()
+   */
+  public UserHandle getUserHandle() {
+    return user;
+  }
+  /**
+   * 
+   * @return user field for a provenance entry
+   */
+  protected String getProvenanceUser() {
+    return new String(user.getFullName());
+  }
+  /**
+   * construct a provenance entry for this client with the specified action string.
+   * @param action
+   * @return properly completed provenance entry
+   */
+  protected Entry getProvenanceEntry(String action) {
+    Entry prov = ProvenanceStuff.newProvenanceEntry(client.getClientUrn(), getProvenanceUser(), action);
+    return prov;
+  }
+  private Hashtable handlers = initHandlers();
+  
+  private Vector listeners = new Vector();
+  
+  /**
+   * make all the PropertyChangeSupport objects for the
+   * events described in org.vamsas.client.Event
+   * @return
+   */
+  private static Hashtable initHandlers() {
+    Hashtable events = new Hashtable();
+    java.util.Iterator evt = Events.EventList.iterator();
+    while (evt.hasNext()) {
+      Object ths = evt.next();
+      events.put(ths, (Object) new PropertyChangeSupport(ths));
+    }
+    return events;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener)
+   */
+  public void addDocumentUpdateHandler(PropertyChangeListener evt) {
+    if (handlers.containsKey(Events.DOCUMENT_UPDATE)) {
+      Object handler;
+      ((PropertyChangeSupport) (handler = handlers.get(Events.DOCUMENT_UPDATE)))
+      .addPropertyChangeListener(evt);
+      listeners.add(handler);
+      listeners.add((Object) evt);
+    }
+  }
+  boolean finalized=false;
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#finalizeClient()
+   */
+  public void finalizeClient() {
+    // TODO: determine if this is last client in session
+    // TODO: raise events like : ((lst_client && document.request.to.close), (client_finalization), (
+    
+    // if (handlers.containsKey(Events.))
+    // if (handlers.containsKey(Events.CLIENT_FINALIZATION))
+    // deregister listeners.
+    // mark this instance as finalized
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#getClientDocument()
+   */
+  public IClientDocument getClientDocument() throws IOException {
+    if (cdocument!=null) {
+      // cdocument is non-nill if the ClientDocument.finalise() method hasn't been called.
+      return cdocument;
+    }
+    VamsasArchive va = null;
+    try {
+      // LATER: bail out if it takes too long to get the lock ?
+      va = _session.getVamsasDocument();
+    }
+    catch (IOException e) {
+      throw new IOException("Failed to get lock on session document");
+    }
+    VamsasDocument doc=null;
+    IdFactory vorba = null;
+    // TODO: reduce size of vorba ids generated from these parameters to IdFactory (mainly sessionHandle rationalization ?)
+    try {
+      va.setVorba(vorba=makeVorbaIdFactory());
+      // if session currently holds data - read it in - or get a dummy
+      _session.slog.debug("Accessing document");
+      doc = 
+        va.getVamsasDocument(getProvenanceUser(),
+            "created new session document.", null);
+      if (doc!=null)
+        _session.slog.debug("Successfully retrieved document.");
+      else
+        log.error("Unexpectedly retrieved null document!");
+    }
+    catch (Exception e) {
+      log.error("Failed to get session document for session directory '"+_session.sessionDir+"'", e);
+      throw new IOException("Failed to get session document for session directory '"+_session.sessionDir+"'");
+    }
+    // Construct the IClientDocument instance
+    
+    ClientDocument cdoc = new ClientDocument(doc, va, vorba, this);
+    return cdoc;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * @throws Errors for invalid newdoc parameter
+   * @see org.vamsas.client.IClient#updateDocument(org.vamsas.client.IClientDocument)
+   */
+  public void updateDocument(IClientDocument newdoc) {
+    if (!(newdoc instanceof ClientDocument)) {
+      throw new Error("Invalid IClientDocument instance for SimpleClient.");
+    }
+    if (cdocument==null)
+      throw new Error("Client Error - updateDocument() called before getClientDocument().");
+    if (newdoc!=cdocument)
+      throw new Error("Client Error - SimpleClient.updateDocument() can only take the IClientDocument instance returned from SimpleClient.getClientDocument()");
+    if (!cdocument.isModified()) {
+      if (log.isDebugEnabled())
+        log.debug("updateDocument for "+session.getSessionUrn()+" with unmodified IClientDocument.");
+    } else {
+      try {
+        if (!cdocument.updateSessionDocument()) {
+          log.warn("Session document did not update properly for session directory "+_session.sessionDir);
+          // cdocument.archive.cancelArchive(); // LATER: could be done - would need to prevent updateSessionDocument closing the archive.
+          _session.slog.warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()");
+        }
+      }
+      catch (IOException e) {
+        log.warn("IO Problems when updating document!",e);
+        _session.slog.error("IO problems when attempting to update document.");
+      }
+    }
+    // garbage collect the ClientDocument instance.
+    try {
+      cdocument.finalize();
+
+    } catch (Throwable e) {
+      log.error("Exception when trying to garbage collect ClientDocument for "+session.getSessionUrn(), e);
+    }
+    cdocument = null; // this is probably done by finalize
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#storeDocument(java.io.File)
+   */
+  public void storeDocument(File location) {
+    
+    // write storeDocument file to inform other clients that they should raise
+    Lock vamlock = evgen.want_to_store();
+    // Events.DOCUMENT_FINALIZEAPPDATA
+    try {
+      _session.writeVamsasDocument(location, vamlock);
+      _session.clearUnsavedFlag();
+    } catch (Exception e) {
+      log.warn("Exception whilst trying to store document in "+location,e);
+    }
+    
+    vamlock.release();
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClient#addVorbaEventHandler(java.lang.String,
+   *      java.beans.PropertyChangeListener)
+   */
+  public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt) {
+    if (handlers.containsKey(EventChain)) {
+      Object handler;
+      ((PropertyChangeSupport) (handler = handlers.get(EventChain)))
+      .addPropertyChangeListener(evt);
+      listeners.add(handler);
+      listeners.add((Object) evt);
+    }
+  }
+  
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClient#pollUpdate()
+   */
+  public void pollUpdate() {
+    
+    if (evgen==null) {
+      log.warn("pollUpdate called on incomplete SimpleClient object.");
+      return;
+    }
+    
+    if (!evgen.isAlive()) {
+      log.warn("pollUpdate called before joinSession() - trying to do this.");
+      try {
+        joinSession();
+      } catch (Exception e) {
+        log.error("Unexpected exception on default call to joinSession",e);
+      }
+    }
+    
+    //TODO ensure event generator robustly handles these interrupts.
+    log.debug("interrrupting event generator.");
+    evgen.interrupt();
+    log.debug("interrrupted event generator.");
+  }
+  
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClient#joinSession()
+   */
+  public void joinSession() throws Exception {
+    // start the EventGenerator thread.
+    if (evgen==null) {
+      log.warn("joinSession called on incomplete SimpleClient object.");
+      return;
+    }
+    if (evgen.isAlive())
+      throw new Error("Join session called twice for the same SimpleClient (IClient instance).");
+    evgen.start();
+    if (evgen.isAlive())
+      log.debug("Started EventGenerator thread.");
+    else {
+      log.warn("Failed to start EventGenerator thread.");
+      throw new Exception("Failed to start event generator thread - client cannot be instantiated.");
+    }
+    if (evgen.countHandlersFor(Events.DOCUMENT_CREATE)>0) {
+      //TODO: is this application connecting to a newly created session document ?
+      //evgen.raise(Events.DOCUMENT_CREATE);
+    }
+  }
+  
+  
+  
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClient#importDocument(java.io.File)
+   */
+  public void importDocument(File location) {
+    // TODO LATER: implement SimpleClient.importDocument()
+    log.error("importDocument is not yet implemented for a SimpleClient Session.");
+  }
+
+  public IObjectUpdate getUpdateHandler(Class rootObject) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public IObjectUpdate[] getUpdateHandlers() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  public void removeUpdateHandler(Class rootObject) {
+    // TODO Auto-generated method stub
+    
+  }
+
+  public void setUpdateHandler(IObjectUpdate handler) {
+    // TODO Auto-generated method stub
+    
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/SimpleClientAppdata.java b/src/org/vamsas/client/simpleclient/SimpleClientAppdata.java
new file mode 100644 (file)
index 0000000..84bc48a
--- /dev/null
@@ -0,0 +1,543 @@
+/**
+ * 
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.IClientAppdata;
+import org.vamsas.objects.core.AppData;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.User;
+import org.vamsas.objects.utils.AppDataReference;
+
+/**
+ * @author jimp
+ * Access interface to data chunks read from a VamsasArchiveReader stream 
+ * (or byte buffer input stream) or written to a VamsasArchive stream.
+ * // TODO: get VamsasArchiveReader from sclient
+ */
+public class SimpleClientAppdata implements IClientAppdata {
+  private static Log log = LogFactory.getLog(SimpleClientAppdata.class);
+  /**
+   * has the session's document been accessed to get the AppData entrys?
+   */
+  protected boolean accessedDocument = false;
+  /**
+   * has the user datablock been modified ? 
+   * temporary file containing new user specific application data chunk
+   */
+  SessionFile newUserData=null;
+  JarOutputStream newUserDataStream = null;
+  /**
+   * has the apps global datablock been modified ?
+   * temporary file containing new global application data chunk
+   */
+  SessionFile newAppData=null;
+  JarOutputStream newAppDataStream=null;
+  /**
+   * set by extractAppData
+   */
+  protected ApplicationData appsGlobal = null;
+  /**
+   * set by extractAppData
+   */
+  protected User usersData = null;
+  
+  ClientDocument clientdoc;
+  /**
+   * state flags
+   * - accessed ClientAppdata
+   * - accessed UserAppdata
+   * => inputStream from embedded xml or jar entry of backup has been created
+   * - set ClientAppdata
+   * - set UserAppdata
+   * => an output stream has been created and written to - or a data chunk has been written.
+   *  - need flag for switching between embedded and jar entry mode ? - always write a jar entry for a stream.
+   *  - need code for rewind and overwriting if the set*Appdata methods are called more than once.
+   *  - need flags for streams to except a call to set*Appdata when an output stream exists and is open.
+   *  - need 
+   * @param clientdoc The ClientDocument instance that this IClientAppData is accessing
+   */
+  protected SimpleClientAppdata(ClientDocument clientdoc) {
+    if (clientdoc==null) {
+      log.fatal("Implementation error - Null ClientDocument for SimpleClientAppdata construction.");
+      throw new Error("Implementation error - Null ClientDocument for SimpleClientAppdata construction.");
+    }
+    this.clientdoc = clientdoc;
+  }
+  /**
+   * gets appropriate app data for the application, if it exists in this dataset
+   * Called by every accessor to ensure data has been retrieved from document.
+   */
+  private void extractAppData(org.vamsas.objects.core.VamsasDocument doc) {
+    if (doc==null) {
+      log.debug("extractAppData called for null document object");
+      return;
+    }
+    if (accessedDocument) {
+      return;
+    }
+    Vector apldataset = AppDataReference.getUserandApplicationsData(
+        doc, clientdoc.sclient.getUserHandle(), clientdoc.sclient.getClientHandle());
+    accessedDocument = true;
+    if (apldataset!=null) {
+      if (apldataset.size()>0) {
+        AppData clientdat = (AppData) apldataset.get(0);
+        if (clientdat instanceof ApplicationData) {
+          appsGlobal = (ApplicationData) clientdat;
+          if (apldataset.size()>1) {
+            clientdat = (AppData) apldataset.get(1);
+            if (clientdat instanceof User) {
+              usersData = (User) clientdat;
+            }
+            if (apldataset.size()>2)
+              log.info("Ignoring additional ("+(apldataset.size()-2)+") AppDatas returned by document appdata query.");
+          } 
+        } else {
+          log.warn("Unexpected entry in AppDataReference query: id="+clientdat.getVorbaId()+" type="+clientdat.getClass().getName());
+        }
+        apldataset.removeAllElements(); // destroy references.
+      }
+    }
+  }
+  /**
+   * LATER: generalize this for different low-level session implementations (it may not always be a Jar)
+   * @param appdata
+   * @param docreader
+   * @return
+   */
+  private JarInputStream getAppDataStream(AppData appdata, VamsasArchiveReader docreader) {
+    String entryRef = appdata.getDataReference();
+    if (entryRef!=null) {
+      log.debug("Resolving appData reference +"+entryRef);
+      InputStream entry = docreader.getAppdataStream(entryRef);
+      if (entry!=null) {
+        if (entry instanceof JarInputStream) {
+          return (JarInputStream) entry;
+        }
+        log.warn("Implementation problem - docreader didn't return a JarInputStream entry.");
+      }
+    } else {
+      log.debug("GetAppDataStream called for an AppData without a data reference.");
+    }
+    return null;
+  }
+  /**
+   * yuk - size of buffer used for slurping appData JarEntry into a byte array.
+   */
+  private final int _TRANSFER_BUFFER=4096*4;
+
+  /**
+   * Resolve AppData object to a byte array.
+   * @param appdata
+   * @param archiveReader
+   * @return null or the application data as a byte array
+   */
+  private byte[] getAppDataAsByteArray(AppData appdata, VamsasArchiveReader docreader) {
+    if (appdata.getData()==null) {
+      if (docreader==null) {
+        log.warn("Silently failing getAppDataAsByteArray with null docreader.",new Exception());
+        return null;
+      }
+      // resolve and load data
+      JarInputStream entry = getAppDataStream(appdata, docreader); 
+      ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+      try {
+        byte buff[] = new byte[_TRANSFER_BUFFER];
+        int olen=0;
+        while (entry.available()>0) {
+          int len = entry.read(buff, olen, _TRANSFER_BUFFER);
+          bytes.write(buff, 0, len);
+          olen+=len;
+        }
+        buff=null;
+      } catch (Exception e) {
+        log.warn("Unexpected exception - probable truncation when accessing VamsasDocument entry "+appdata.getDataReference(), e);
+      }
+      if (bytes.size()>0) {
+        // LATER: deal with probable OutOfMemoryErrors here
+        log.debug("Got "+bytes.size()+" bytes from AppDataReference "+appdata.getDataReference());
+        byte data[] = bytes.toByteArray();
+        bytes = null;
+        return data;
+      }
+      return null;
+    } else {
+      log.debug("Returning inline AppData block for "+appdata.getVorbaId());
+      return appdata.getData();
+    }
+  }
+  /**
+   * internal method for getting a DataInputStream from an AppData object.
+   * @param appdata
+   * @param docreader
+   * @return data in object or null if no data is accessible
+   */
+  private DataInput getAppDataAsDataInputStream(AppData appdata, VamsasArchiveReader docreader) {
+    if (appdata!=null && docreader!=null) {
+      String entryRef = appdata.getDataReference();
+      if (entryRef!=null) {
+        log.debug("Resolving AppData reference for "+entryRef);
+        InputStream jstrm = docreader.getAppdataStream(entryRef);
+        if (jstrm!=null)
+          return new AppDataInputStream(jstrm);
+        else {
+          log.debug("Returning null input stream for unresolved reference ("+entryRef+") id="+appdata.getVorbaId());
+          return null;
+        }
+      } else {
+        // return a byteArray input stream
+        byte[] data=appdata.getData();
+        if (data.length>0) {
+          ByteArrayInputStream stream = new ByteArrayInputStream(data);
+          return new DataInputStream(stream);
+        } else {
+          log.debug("Returning null input stream for empty Appdata data block in id="+appdata.getVorbaId());
+          return null;
+        }
+      }
+    } else {
+      log.debug("Returning null DataInputStream for appdata entry:"+appdata.getVorbaId());
+    }
+    return null;
+  }
+
+  /**
+   * internal method for getting ByteArray from AppData object
+   * @param clientOrUser - true for returning userData, otherwise return Client AppData.
+   * @return null or byte array
+   */
+  private byte[] _getappdataByteArray(boolean clientOrUser) {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    byte[] data=null;
+    String appdName;
+    if (!clientOrUser) {
+      appdName = "Client's Appdata";
+    } else {
+      appdName = "User's Appdata";
+    }    
+    log.debug("getting "+appdName+" as a byte array");
+    extractAppData(clientdoc.getVamsasDocument());
+    AppData object;
+    if (!clientOrUser) {
+      object = appsGlobal;
+    } else {
+      object = usersData;
+    }
+    if (object!=null) {
+      log.debug("Trying to resolve "+appdName+" object to byte array.");
+      data = getAppDataAsByteArray(object, clientdoc.getVamsasArchiveReader());
+    }
+    if (data == null)
+      log.debug("Returning null for "+appdName+"ClientAppdata byte[] array");
+    return data;
+    
+  }
+  
+  /**
+   * common method for Client and User AppData->InputStream accessor
+   * @param clientOrUser - the appData to resolve - false for client, true for user appdata.
+   * @return null or the DataInputStream desired.
+   */
+  private DataInput _getappdataInputStream(boolean clientOrUser) {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    String appdName;
+    if (!clientOrUser) {
+      appdName = "Client's Appdata";
+    } else {
+      appdName = "User's Appdata";
+    }
+    if (log.isDebugEnabled())
+      log.debug("getting "+appdName+" as an input stream.");
+    extractAppData(clientdoc.getVamsasDocument());
+    AppData object;
+    if (!clientOrUser) {
+      object = appsGlobal;
+    } else {
+      object = usersData;
+    }
+    if (object!=null) {
+      log.debug("Trying to resolve ClientAppdata object to an input stream.");
+      return getAppDataAsDataInputStream(object, clientdoc.getVamsasArchiveReader());
+    }
+    log.debug("getClientInputStream returning null.");
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getClientAppdata()
+   */
+  public byte[] getClientAppdata() {
+    return _getappdataByteArray(false);
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getClientInputStream()
+   */
+  public DataInput getClientInputStream() {
+    return _getappdataInputStream(false);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getUserAppdata()
+   */
+  public byte[] getUserAppdata() {
+    return _getappdataByteArray(true);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getUserInputStream()
+   */
+  public DataInput getUserInputStream() {
+    return _getappdataInputStream(true);
+  }
+  /**
+   * methods for writing new AppData entries.
+   */
+  private DataOutput _getAppdataOutputStream(boolean clientOrUser) {
+    String apdname;
+    SessionFile apdfile=null;
+    if (!clientOrUser) {
+      apdname = "clientAppData";
+      apdfile = newAppData;
+    } else {
+      apdname = "userAppData";
+      apdfile = newUserData;
+    }
+    try {
+      if (apdfile==null) {
+        apdfile=clientdoc.sclient._session.getTempSessionFile(apdname,".jar");
+        log.debug("Successfully made temp appData file for "+apdname);
+      } else {
+        // truncate to remove existing data.
+        apdfile.fileLock.getRaFile().setLength(0);
+        log.debug("Successfully truncated existing temp appData for "+apdname);
+      }
+      } catch (Exception e) {
+      log.error("Whilst opening temp file in directory "+clientdoc.sclient._session.sessionDir, e);
+    }
+    // we do not make another file for the new entry if one exists already
+    if (!clientOrUser) {
+      newAppData = apdfile;
+    } else {
+      newUserData = apdfile;
+    }
+    try {
+      apdfile.lockFile();
+      // LATER: Refactor these local AppDatastream IO stuff to their own class.
+      JarOutputStream dstrm = 
+        new JarOutputStream(apdfile.fileLock.getBufferedOutputStream(true));
+      if (!clientOrUser) {
+        newAppDataStream = dstrm;
+      } else {
+        newUserDataStream = dstrm;
+      }
+      dstrm.putNextEntry(new JarEntry("appData_entry.dat"));
+      // LATER: there may be trouble ahead if an AppDataOutputStream is written to by one thread when another truncates the file. This situation should be prevented if possible
+      return new AppDataOutputStream(dstrm);
+    }
+    catch (Exception e) {
+      log.error("Whilst opening jar output stream for file "+apdfile.sessionFile);
+    }
+    // tidy up and return null
+    apdfile.unlockFile();
+    return null;
+   }
+  /**
+   * copy data from the appData jar file to an appropriately 
+   * referenced jar or Data entry for the given ApplicationData
+   * Assumes the JarFile is properly closed. 
+   * @param vdoc session Document handler
+   * @param appd the AppData whose block is being updated
+   * @param apdjar the new data in a Jar written by this class
+   */
+  protected void updateAnAppdataEntry(VamsasArchive vdoc, AppData appd, SessionFile apdjar) throws IOException {
+    if (apdjar==null || apdjar.sessionFile==null || !apdjar.sessionFile.exists()) {
+      throw new IOException("No temporary Appdata to recover and transfer.");
+    }
+    if (vdoc==null) {
+      log.fatal("FATAL! NO DOCUMENT TO WRITE TO!");
+      throw new IOException("FATAL! NO DOCUMENT TO WRITE TO!");
+    }
+    log.debug("Recovering AppData entry from "+apdjar.sessionFile);
+    JarInputStream istrm = new JarInputStream(apdjar.getBufferedInputStream(true));
+    JarEntry je=null;
+    while (istrm.available()>0 && (je=istrm.getNextJarEntry())!=null && !je.getName().equals("appData_entry.dat")) {
+      if (je!=null)
+        log.debug("Ignoring extraneous entry "+je.getName());
+    }
+    if (istrm.available()>0 && je!=null) {
+      log.debug("Found appData_entry.dat in Jar");
+      String ref = appd.getDataReference();
+      if (ref==null) {
+        throw new IOException("Null AppData.DataReference passed.");
+      }
+      if (vdoc.writeAppdataFromStream(ref, istrm)) {
+        log.debug("Entry updated successfully.");
+      } else {
+        throw new IOException("writeAppdataFromStream did not return true - expect future badness."); // LATER - verify why this might occur.
+      }
+    } else {
+      throw new IOException("Couldn't find appData_entry.dat in temporary jar file "+apdjar.sessionFile.getAbsolutePath());
+    }
+    istrm.close();
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getClientOutputStream()
+   */
+  public DataOutput getClientOutputStream() {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    if (log.isDebugEnabled())
+      log.debug("trying to getClientOutputStream for "+clientdoc.sclient.client.getClientUrn());   
+    return _getAppdataOutputStream(false);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#getUserOutputStream()
+   */
+  public DataOutput getUserOutputStream() {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    if (log.isDebugEnabled())
+      log.debug("trying to getUserOutputStream for ("
+          +clientdoc.sclient.getUserHandle().getFullName()+")"+clientdoc.sclient.client.getClientUrn());   
+    return _getAppdataOutputStream(true);
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#hasClientAppdata()
+   */
+  public boolean hasClientAppdata() {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    extractAppData(clientdoc.getVamsasDocument());
+    // LATER - check validity of a DataReference before we return true
+    if ((appsGlobal!=null) && (appsGlobal.getDataReference()!=null || appsGlobal.getData()!=null))
+      return true;
+    return false;
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#hasUserAppdata()
+   */
+  public boolean hasUserAppdata() {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    extractAppData(clientdoc.getVamsasDocument());
+    // LATER - check validity of a DataReference before we return true
+    if ((appsGlobal!=null) && (appsGlobal.getDataReference()!=null || appsGlobal.getData()!=null))
+      return true;
+    return false;
+  }
+  private boolean _writeAppDataStream(JarOutputStream ostrm, byte[] data) {
+    try {
+      if (data!=null && data.length>0) 
+        ostrm.write(data);
+      ostrm.closeEntry();
+      return true;
+    }
+    catch (Exception e) {
+      log.error("Serious! - IO error when writing AppDataStream to file "+newAppData.sessionFile, e);
+    }
+    return false;
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#setClientAppdata(byte[])
+   */
+  public void setClientAppdata(byte[] data) {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    _getAppdataOutputStream(false);
+    if (newAppDataStream==null) {
+      // LATER: define an exception for this ? - operation may fail even if file i/o not involved
+      log.error("Serious! - couldn't open new AppDataStream in session directory "+clientdoc.sclient._session.sessionDir);
+    } else {
+      _writeAppDataStream(newAppDataStream, data);
+      // LATER: deal with error case - do we make session read only, or what ?
+    }
+  }
+
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientAppdata#setUserAppdata(byte[])
+   */
+  public void setUserAppdata(byte[] data) {
+    if (clientdoc==null)
+      throw new Error("Implementation error, Improperly initialized SimpleClientAppdata.");
+    _getAppdataOutputStream(true);
+    if (newUserDataStream==null) {
+      // LATER: define an exception for this ? - operation may fail even if file i/o not involved
+      log.error("Serious! - couldn't open new UserDataStream in session directory "+clientdoc.sclient._session.sessionDir);
+    } else {
+      _writeAppDataStream(newUserDataStream, data);
+      // LATER: deal with error case - do we make session read only, or what ?
+    }
+  }
+  /**
+   * flush and close outstanding output streams. 
+   *  - do this before checking data length.
+   * @throws IOException
+   */
+  protected void closeForWriting() throws IOException {
+    if (newAppDataStream!=null) {
+      newAppDataStream.flush();
+      newAppDataStream.closeEntry();
+      newAppDataStream.close();
+    }
+    if (newUserDataStream!=null) {
+      newUserDataStream.flush();
+      newUserDataStream.closeEntry();
+      newUserDataStream.close();
+    }
+  }
+
+
+  /**
+   * 
+   * @return true if any AppData blocks have to be updated in session Jar
+   */
+  protected boolean isModified() {
+    // LATER differentiate between core xml modification and Jar Entry modification.
+    if (newAppData.sessionFile.exists() || newUserData.sessionFile.exists())
+      return true;
+    return false;
+  }
+  /* (non-Javadoc)
+   * @see java.lang.Object#finalize()
+   */
+  protected void finalize() throws Throwable {
+    if (newAppDataStream!=null) {
+      newAppDataStream = null;
+    }
+    if (newAppDataStream!=null) {
+      newUserDataStream = null;
+    }
+    if (newAppData!=null) {
+      newAppData.eraseExistence();
+      newAppData = null;
+    }
+    if (newUserData!=null) {
+      newUserData.eraseExistence();
+      newUserData = null;
+    }
+    super.finalize();
+  }
+
+}
diff --git a/src/org/vamsas/client/simpleclient/SimpleClientFactory.java b/src/org/vamsas/client/simpleclient/SimpleClientFactory.java
new file mode 100644 (file)
index 0000000..6f5509a
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+* VAMSAS Project
+*
+
+* 
+* Dec 13, 2006 
+*
+*/
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+
+import java.io.IOException;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.IClient;
+import org.vamsas.client.IClientFactory;
+import org.vamsas.client.InvalidSessionUrnException;
+import org.vamsas.client.NoDefaultSessionException;
+import org.vamsas.client.SessionHandle;
+import org.vamsas.client.UserHandle;
+
+/**
+ * 
+ * 
+ */
+public class SimpleClientFactory implements IClientFactory {
+
+  private static Log log = LogFactory.getLog(SimpleClientFactory.class);
+
+  private File sessionArena = null;
+  
+  private String vamsasSubdirectoryName = ".vamsas";
+  
+  private SessionsFile sessionFile = null;
+  private static final String SESSION_LIST="sessions.obj";
+  
+  //private   String[] currentlyAvailableDessions = null; 
+  
+  /**
+   * default constructor - called by CreateClientFactory only.
+   *
+   *Inits the sessionarena to the directory .vamsas of the user home directory. 
+   *
+   */
+  public SimpleClientFactory() throws IOException
+  {
+   // sessionArena
+    
+    //retrieves user home directory
+    String userHomeDirectory = System.getProperty("user.home");
+    if (userHomeDirectory == null || userHomeDirectory.length()<1)
+      {
+        new IOException("Unable to detect user home directory");
+      }
+    String sessionArenaPath =  userHomeDirectory.concat(File.separator.concat(this.vamsasSubdirectoryName));
+    
+    this.initSessionArena(sessionArenaPath);
+    this.initFactoryObjects();
+  }
+  
+  
+  /**
+   * Create a client factory that works with sessions at the given
+   * path.
+   * @param path path to directory called  session arena, where will be created session directories and session files.
+   */
+  public SimpleClientFactory(String path) throws IOException
+  {
+    this.initSessionArena(path);
+  }
+  /**
+   * Inits sessionArena to a given path.
+   * checks if path is valid.
+   * 
+   * @param path path to a directory to use 
+   * @throws IOException if the path is incorrect
+   */
+  private void  initSessionArena (String path) throws IOException
+  {
+    // Check path is valid and read/writeable.
+    File arenaFile = new File (path);
+    if (!arenaFile.exists())
+    {
+      if (! arenaFile.mkdirs())
+      {
+        this.sessionArena = null;
+        throw(new IOException("Unable to create a directory called "+path));
+      }
+    }
+    if (arenaFile.exists() && arenaFile.isDirectory() && arenaFile.canRead() && arenaFile.canWrite()) 
+      {
+        this.sessionArena = arenaFile;
+      } 
+    else
+      {
+      this.sessionArena = null;
+        throw(new IOException("Cannot read and write to a directory called "+path));
+      }
+  }
+  
+  /**
+   * construct SessionFile objects and watchers for each
+   */
+  private void initFactoryObjects() throws IOException {
+    if (this.sessionFile!=null )
+      throw new IOException("initFactoryObjects called for initialised ClientFactory object.");
+    this.sessionFile = new SessionsFile(new File(this.sessionArena,SESSION_LIST));
+
+  }
+  /**
+   * @see org.vamsas.client.IClientFactory#getCurrentSessions()
+   */
+  public String[] getCurrentSessions() 
+  { 
+    String[] sessions = null;
+    if (this.sessionFile!=null )
+      {
+        SessionHandle[] sessionHandles =  this.sessionFile.retrieveSessionsList();
+        if (sessionHandles != null)
+          {
+            sessions = new String[sessionHandles.length];
+            for (int i = sessionHandles.length -1; i > 0; i--)
+              {
+                SessionHandle sessionHandle = sessionHandles[i];
+                sessions [i] = sessionHandle.getSessionUrn();
+              }
+          }
+      }
+    return sessions;
+  }
+  
+  
+  private void discoverSession()
+  {
+   
+  }
+
+  /**
+   * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)
+   * 
+   * Creates a IClient object, using default UserHandle with system variables:"user.name" or "USERNAME")),
+            "host.name" or "HOSTNAME" 
+   */
+  public IClient getIClient(ClientHandle applicationHandle)
+      throws NoDefaultSessionException {
+    
+    return this.getIClient(applicationHandle, (UserHandle) null);
+  }
+
+  /**
+   * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String)
+   */
+  public IClient getIClient(ClientHandle applicationHandle, String sessionUrn) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String)
+   */
+  public IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
+      String sessionUrn) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  /**
+   * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)
+   */
+  public IClient getIClient(ClientHandle applicationHandle, UserHandle userId)
+      throws NoDefaultSessionException {
+    SimpleClient client = null;
+    if (this.sessionArena==null)
+      throw new Error("Improperly initialised SimpleClientFactory object - null sessionArena.");
+    
+    ClientHandle clientHandle =applicationHandle;
+    //create default clientHandle with "SimpleVamsasClientApp","0.1",
+    if (clientHandle == null)
+     clientHandle = new ClientHandle("SimpleVamsasClientApp","0.1");
+    
+    //check if any available session(s)
+    String[] availableSessions = this.getCurrentSessions();
+    if (availableSessions != null) 
+      {//there are available sessions
+        if (availableSessions.length>1)
+          {//more than one session if available... can not choose
+          
+          //represents list of session as String
+            StringBuffer sessionURNs = new StringBuffer("");
+            for (int i = 0; i< availableSessions.length ; i++)
+              {
+                sessionURNs.append(availableSessions[i]+" ");
+              }
+            throw new  NoDefaultSessionException("Several sessions available, please pick one: "+sessionURNs);
+          }
+      
+        //check if only one session available. if yes, open it
+        if (availableSessions.length == 1)
+          {
+          //only one session available, open it.
+            return this.getIClient(clientHandle,  availableSessions[0]);
+          }
+      }
+    //no session available  - create a new one
+    
+    
+    try 
+      {
+        //create sessionDirectory
+        File sessdir = File.createTempFile("sess", ".simpleclient", this.sessionArena);
+        log.debug("Creating new session  directory");
+       if (!(sessdir.delete() && sessdir.mkdir()))
+          throw new IOException("Could not make session directory "+sessdir);
+      //create session
+        VamsasSession vamsasSession = new VamsasSession(sessdir);
+      
+        this.getSessionFile().addSession(new SessionHandle(new SessionUrn(vamsasSession).getSessionUrn()), false);
+        if (userId == null)
+          {
+      //create a default userHandle
+      //with current OS user and hostname
+            userId = new UserHandle(System.getProperty("user.name", System.getProperty("USERNAME","Joe Doe")),
+              System.getProperty("host.name",System.getProperty("HOSTNAME", "Unknown") ));// clientName, clientVersion,  sessionPath);
+          }
+     
+      
+      //create simple client
+         client = new SimpleClient(userId,  clientHandle,  vamsasSession);
+      } 
+    catch (IOException e) 
+      {
+        log.error("error while creating new IClient",e);
+      }
+    catch (InvalidSessionUrnException e) 
+      {
+        log.error("Unable to create new IClient. The session urn is incorrect ",e);
+      }
+   
+      return client;
+  }
+
+
+  /**
+   * @return the sessionFile
+   */
+  private SessionsFile getSessionFile()  throws IOException
+    {
+      if (this.sessionFile == null)
+        {
+          this.sessionFile = new SessionsFile( new File (this.sessionArena, SESSION_LIST));
+        }
+      return this.sessionFile;
+    }
+
+  
+
+}
diff --git a/src/org/vamsas/client/simpleclient/SimpleDocBinding.java b/src/org/vamsas/client/simpleclient/SimpleDocBinding.java
new file mode 100644 (file)
index 0000000..c0c8084
--- /dev/null
@@ -0,0 +1,138 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Vector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.Vobject;
+import org.vamsas.client.VorbaIdFactory;
+import org.vamsas.client.VorbaXmlBinder;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.AppDataReference;
+import org.vamsas.objects.utils.DocumentStuff;
+import org.vamsas.objects.utils.ProvenanceStuff;
+import org.vamsas.objects.utils.document.VersionEntries;
+
+/**
+ * Base class for SimpleClient Vamsas Document Object Manipulation
+ * holds static vamsasDocument from XML routines and
+ * state objects for a particular unmarshalled Document instance.
+ * @author jimp
+ */
+  
+
+public class SimpleDocBinding {
+
+  protected VorbaIdFactory vorba;
+  protected static Log log = LogFactory.getLog(SimpleDocBinding.class);
+
+  /**
+   * @return Returns the vorba.
+   */
+  public VorbaIdFactory getVorba() {
+    return vorba;
+  }
+
+  /**
+   * @param vorba The vorba to set.
+   */
+  public void setVorba(VorbaIdFactory vorba) {
+    this.vorba = vorba;
+  }
+
+  /**
+   * Uses VorbaXmlBinder to retrieve the VamsasDocument from the given stream
+   */
+  public VamsasDocument getVamsasDocument(VamsasArchiveReader oReader) throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    if (oReader!=null) {
+      // check the factory
+      if (vorba==null) {
+        log.error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");
+        return null;
+      }
+  
+      if (oReader.isValid()) {
+        // Read vamsasDocument.xsd instance
+        InputStreamReader vdoc = new InputStreamReader(oReader.getVamsasDocumentStream());
+        Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vdoc, vorba, new VamsasDocument());
+        if (unmarsh==null)
+          log.fatal("Couldn't unmarshall document!");
+        
+        Vobject vobjs = (Vobject) unmarsh[0];
+        if (vobjs!=null) { 
+          VamsasDocument doc=(VamsasDocument) vobjs;
+          if (doc!=null)
+            return doc;
+        }
+        log.debug("Found no VamsasDocument object in properly formatted Vamsas Archive.");
+      } else {        
+        // deprecated data handler (vamsas.xsd instance)
+        InputStream vxmlis = oReader.getVamsasXmlStream();
+        if (vxmlis!=null) { // Might be an old vamsas file.
+          BufferedInputStream ixml = new BufferedInputStream(oReader.getVamsasXmlStream());
+          InputStreamReader vxml = new InputStreamReader(ixml);
+          Object unmarsh[] = VorbaXmlBinder.getVamsasObjects(vxml, vorba, new VAMSAS());
+          
+          if (unmarsh==null)
+            log.fatal("Couldn't unmarshall document!");
+          
+          VAMSAS root[]= new VAMSAS[] { null};
+          root[0] = (VAMSAS) unmarsh[0]; 
+          
+          if (root[0]==null) {
+            log.debug("Found no VAMSAS object in VamsasXML stream.");
+          } else {
+            log.debug("Making new VamsasDocument from VamsasXML stream.");
+            VamsasDocument doc = DocumentStuff.newVamsasDocument(root, 
+                ProvenanceStuff.newProvenance(
+                    vorba.getUserHandle().getFullName(), 
+                    "Vamsas Document constructed from vamsas.xml"), VersionEntries.ALPHA_VERSION);
+            // VAMSAS: decide on 'system' operations provenance form
+            // LATER: implement classes for translating Vorba properties into provenance user fields.
+            // VAMSAS: decide on machine readable info embedding in provenance should be done
+            root[0]=null;
+            root=null;
+            return doc;
+          }
+        }
+      }
+    }
+    // otherwise - there was no valid original document to read.
+    return null;    
+  }
+
+  /**
+   * Extract all jarEntries in an archive referenced by the vamsas document
+   * LATER: a family of methods for finding extraneous jarEntries , and invalid appDataReferences
+   * @param doc
+   * @param oReader
+   * @return array of the subset of JarEntry names that are referenced in doc 
+   */
+  public Vector getReferencedEntries(VamsasDocument doc, VamsasArchiveReader oReader) {
+    if (oReader==null)
+     return null;
+    if (doc==null) {
+     try { doc = getVamsasDocument(oReader); } 
+     catch (Exception e) { log.warn("Failed to get document from "+oReader.jfile.getName()); };
+    }
+    Vector docrefs = AppDataReference.getAppDataReferences(doc);
+    if (docrefs==null)
+      return null;
+    Vector entries = oReader.getExtraEntries();
+    if (entries!=null && docrefs.size()>0) {
+      int i=0, j=entries.size();
+      do {
+        if (!docrefs.contains(entries.get(i))) {
+            entries.remove(i);
+            j--;
+        } else
+          i++;
+      } while (i<j);
+    }
+    return entries;
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/SimpleDocument.java b/src/org/vamsas/client/simpleclient/SimpleDocument.java
new file mode 100644 (file)
index 0000000..df569e7
--- /dev/null
@@ -0,0 +1,28 @@
+package org.vamsas.client.simpleclient;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.VorbaIdFactory;
+
+/**
+ * @see SimpleDocBinding
+ * Additional constructors for 'headless' Vamsas Document access
+ * @author jimp
+ */
+public class SimpleDocument extends SimpleDocBinding {
+  private static Log log = LogFactory.getLog(SimpleDocument.class);
+  
+  private VorbaIdFactory makeDefaultFactory(String name) {
+    return IdFactory.getDummyFactory(name);
+  }
+
+  public SimpleDocument(String name) {
+    vorba = makeDefaultFactory(name);
+  }
+  public SimpleDocument(VorbaIdFactory Vorba) {
+    if (Vorba!=null)
+      vorba = Vorba;
+    else
+      log.error("Invalid SimpleDocument construction - no VorbaIdFactory defined!");
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/VamsasArchive.java b/src/org/vamsas/client/simpleclient/VamsasArchive.java
new file mode 100644 (file)
index 0000000..68c366f
--- /dev/null
@@ -0,0 +1,809 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.IVorbaIdFactory;
+import org.vamsas.client.SessionHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.VorbaIdFactory;
+import org.vamsas.client.VorbaXmlBinder;
+import org.vamsas.client.Vobject;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.AppDataReference;
+import org.vamsas.objects.utils.DocumentStuff;
+import org.vamsas.objects.utils.ProvenanceStuff;
+import org.vamsas.objects.utils.document.VersionEntries;
+
+/**
+ * Class for high-level io and Jar manipulation involved in creating 
+ * or updating a vamsas archive (with backups).
+ * Writes to a temporary file and then swaps new file for backup.
+ * uses the sessionFile locking mechanism for safe I/O
+ * @author jimp
+ *
+ */
+public class VamsasArchive {
+  private static Log log = LogFactory.getLog(VamsasArchive.class);
+  /**
+   * Access original document if it exists, and get VAMSAS root objects.
+   * @return vector of vamsas roots from original document
+   * @throws IOException
+   */
+  public static Vobject[] getOriginalRoots(VamsasArchive ths) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    VamsasArchiveReader oReader = ths.getOriginalArchiveReader();
+    if (oReader!=null) {
+      
+      if (oReader.isValid()) {
+        InputStreamReader vdoc = new InputStreamReader(oReader.getVamsasDocumentStream());
+        VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
+        if (doc!=null) 
+          return doc.getVAMSAS();
+        // TODO ensure embedded appDatas are garbage collected to save memory
+      } else {
+        InputStream vxmlis = oReader.getVamsasXmlStream();
+        if (vxmlis!=null) { // Might be an old vamsas file.
+          BufferedInputStream ixml = new BufferedInputStream(oReader.getVamsasXmlStream());
+          InputStreamReader vxml = new InputStreamReader(ixml);
+          VAMSAS root[] = new VAMSAS[1];
+          root[0] = VAMSAS.unmarshal(vxml);
+          if (root[0]!=null)
+            return root;
+        }
+      }
+    }
+    return null;
+  }
+  /**
+   * Access the original vamsas document for a VamsasArchive class, and return it.
+   * Users of the VamsasArchive class should use the getVamsasDocument method to retrieve
+   * the current document - only use this one if you want the 'backup' version.
+   * TODO: catch OutOfMemoryError - they are likely to occur here.
+   * NOTE: vamsas.xml datastreams are constructed as 'ALPHA_VERSION' vamsas documents.
+   * @param ths
+   * @return null if no document exists.
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    return VamsasArchive.getOriginalVamsasDocument(ths, null);
+  } 
+  /**
+   * Uses VorbaXmlBinder to retrieve the VamsasDocument from the original archive referred to by ths
+   * @param ths
+   * @param vorba
+   * @return
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public static VamsasDocument getOriginalVamsasDocument(VamsasArchive ths, VorbaIdFactory vorba) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    VamsasArchiveReader oReader = ths.getOriginalArchiveReader();
+    if (oReader!=null) {
+      ths.setVorba(vorba);
+      return ths.vorba.getVamsasDocument(oReader);
+    }
+    // otherwise - there was no valid original document to read.
+    return null;    
+  }
+  /**
+   * destination of new archive data (tempfile if virginarchive=true, original archive location otherwise)
+   */
+  java.io.File archive=null;
+  /**
+   * locked IO handler for new archive file
+   */
+  SessionFile rchive=null;
+  /**
+   * original archive file to be updated (or null if virgin) where new data will finally reside
+   */
+  java.io.File original=null;
+  /**
+   * original archive IO handler
+   */
+  SessionFile odoclock = null;
+  Lock destinationLock = null;
+  /**
+   * Original archive reader class
+   */
+  VamsasArchiveReader odoc = null;
+  /**
+   * true if a real vamsas document is being written.
+   */
+  boolean vamsasdocument=true;
+  /**
+   * Output stream for archived data
+   */
+  JarOutputStream newarchive=null;
+  /**
+   * JarEntries written to archive
+   */
+  Hashtable entries = null;
+  
+  /**
+   * true if we aren't just updating an archive
+   */
+  private boolean virginArchive=false;
+  
+  /**
+   * name of backup of existing archive that has been updated/overwritten.
+   * only one backup will be made - and this is it.
+   */
+  File originalBackup = null;
+  
+  boolean donotdeletebackup=false;
+  private final int _TRANSFER_BUFFER=4096*4;
+  protected SimpleDocument vorba = null;
+  /**
+   * LATER: ? CUT'n'Paste error ?
+   * Access and return current vamsas Document, if it exists, or create a new one 
+   * (without affecting VamsasArchive object state - so is NOT THREAD SAFE)
+   * _TODO: possibly modify internal state to lock low-level files 
+   * (like the IClientDocument interface instance constructer would do) 
+   * @see org.vamsas.simpleclient.VamsasArchive.getOriginalVamsasDocument for additional caveats
+   * 
+   * @return
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   * ????? where does this live JBPNote ?
+   */
+  private VamsasDocument _doc=null;
+  
+  /**
+   * Create a new vamsas archive
+   * File locks are made immediately to avoid contention
+   *  
+   * @param archive - file spec for new vamsas archive
+   * @param vamsasdocument true if archive is to be a fully fledged vamsas document archive
+   * @throws IOException if call to accessOriginal failed for updates, or openArchive failed.
+   */
+  public VamsasArchive(File archive, boolean vamsasdocument) throws IOException {
+    this(archive, false, vamsasdocument, null);
+  }
+  public VamsasArchive(File archive, boolean vamsasdocument, boolean overwrite) throws IOException {
+    this(archive, overwrite, vamsasdocument, null);
+  }
+  /**
+   * Constructor for accessing Files under file-lock management (ie a session file)
+   * @param archive
+   * @param vamsasdocument
+   * @param overwrite
+   * @throws IOException
+   */
+  public VamsasArchive(VamsasFile archive, boolean vamsasdocument, boolean overwrite) throws IOException {
+    this(archive.sessionFile, overwrite, vamsasdocument, archive);
+    // log.debug("using non-functional lock-IO stream jar access constructor");
+  }
+  /**
+   * read and write to archive - will not overwrite original contents, and will always write an up to date vamsas document structure.
+   * @param archive
+   * @throws IOException
+   */
+  public VamsasArchive(VamsasFile archive) throws IOException {
+    this(archive, true, false); 
+  }
+  /**
+   * 
+   * @param archive file to write
+   * @param overwrite true if original contents should be deleted
+   * @param vamsasdocument true if a proper VamsasDocument archive is to be written.
+   * @param extantLock SessionFile object holding a lock for the <object>archive</object> 
+   * @throws IOException
+   */
+  public VamsasArchive(File archive, boolean overwrite, boolean vamsasdocument, SessionFile extantLock) throws IOException {
+    super();
+    if (archive==null || (archive!=null && !(archive.getAbsoluteFile().getParentFile().canWrite() && (!archive.exists() || archive.canWrite())))) {
+      log.fatal("Expect Badness! -- Invalid parameters for VamsasArchive constructor:"+((archive!=null) 
+          ? "File cannot be overwritten." : "Null Object not valid constructor parameter"));
+      return;
+    }
+    
+    this.vamsasdocument = vamsasdocument;
+    if (archive.exists() && !overwrite) {
+      this.original = archive;
+      if (extantLock!=null) {
+        this.odoclock = extantLock;
+        if (odoclock.fileLock==null || !odoclock.fileLock.isLocked())
+          odoclock.lockFile();
+      } else { 
+        this.odoclock = new SessionFile(archive);
+      }
+      odoclock.lockFile(); // lock the file *immediatly*
+      this.archive = null;       // archive will be a temp file when the open method is called
+      virginArchive=false;
+      try {
+        this.accessOriginal();
+      } catch (IOException e)  {
+        throw new IOException("Lock failed for existing archive"+archive);
+      }
+    } else {
+      this.original = null;
+      this.archive = archive; // archive is written in place.
+      if (extantLock!=null)
+        rchive=extantLock;
+      else
+        rchive = new SessionFile(archive);
+      rchive.lockFile();
+      if (rchive.fileLock==null || !rchive.fileLock.isLocked())
+        throw new IOException("Lock failed for new archive"+archive);
+      rchive.fileLock.getRaFile().setLength(0); // empty the archive.
+      virginArchive = true;
+    }
+    this.openArchive(); // open archive
+  }
+  /**
+   * open original archive file for exclusive (locked) reading.
+   * @throws IOException
+   */
+  private void accessOriginal() throws IOException {
+    if (original!=null && original.exists()) {
+      if (odoclock==null) 
+        odoclock = new SessionFile(original);
+      odoclock.lockFile();
+      if (odoc == null) 
+        odoc = new VamsasArchiveReader(original);
+        // this constructor is not implemented yet odoc = new VamsasArchiveReader(odoclock.fileLock);
+    }
+  }
+  
+  /**
+   * Add unique entry strings to internal JarEntries list.
+   * @param entry
+   * @return true if entry was unique and was added.
+   */
+  private boolean addEntry(String entry) {
+    if (entries!=null)
+      entries=new Hashtable();
+    if (entries.containsKey(entry))
+      return false;
+    entries.put(entry, new Integer(entries.size()));
+    return true;
+  }
+  /**
+   * adds named entry to newarchive or returns false.
+   * @param entry
+   * @return true if entry was unique and could be added
+   * @throws IOException if entry name was invalid or a new entry could not be made on newarchive
+   */
+  private boolean addValidEntry(String entry) throws IOException {
+    JarEntry je = new JarEntry(entry);
+    if (!addEntry(entry))
+      return false;
+    newarchive.flush();
+    newarchive.putNextEntry(je);
+    return true;
+  }
+  /**
+   * called by app to get name of backup if it was made.
+   * If this is called, the caller app *must* delete the backup themselves.
+   * @return null or a valid file object
+   */
+  public File backupFile() {
+    
+    if (!virginArchive) {
+      makeBackup();
+      donotdeletebackup=false; // external reference has been made.
+      return ((original!=null) ? originalBackup : null);
+    }
+    return null;
+  }
+  
+  /**
+   * Stops any current write to archive, and reverts to the backup if it exists.
+   * All existing locks on the original will be released. All backup files are removed.
+   */
+  public boolean cancelArchive() {
+    if (newarchive!=null) {
+      try { 
+        newarchive.closeEntry();
+        newarchive.putNextEntry(new JarEntry("deleted"));
+        newarchive.closeEntry();
+        newarchive.close();
+        
+      } catch (Exception e) {
+        log.debug("Whilst closing newarchive",e);
+      };
+      if (!virginArchive) {
+        // then there is something to recover.
+        try {
+          recoverBackup();
+        }
+        catch (Exception e) {
+          log.warn("Problems when trying to cancel Archive "+archive.getAbsolutePath(), e);
+          return false;
+        }
+      }
+      
+    } else {
+      log.warn("Client Error: cancelArchive called before archive("+original.getAbsolutePath()+") has been opened!");
+    }
+    closeAndReset(); // tidy up and release locks.
+    return true;
+  }
+  
+  /**
+   * only do this if you want to destroy the current file output stream
+   *
+   */
+  private void closeAndReset() {
+    if (rchive!=null) {
+      rchive.unlockFile();
+      rchive=null;
+    }
+    if (original!=null) {
+      if (odoc!=null) {
+        odoc.close();
+        odoc=null;
+      }
+      if (archive!=null)
+        archive.delete();
+      if (odoclock!=null) {
+        odoclock.unlockFile();
+        odoclock = null;
+      }
+    }
+    removeBackup();
+    newarchive=null;
+    original=null;
+    entries=null;
+  }
+  /**
+   * Tidies up and closes archive, removing any backups that were created.
+   * NOTE: It is up to the caller to delete the original archive backup obtained from backupFile()
+   * TODO: ensure all extant AppDataReference jar entries are transferred to new Jar
+   * TODO: provide convenient mechanism for generating new unique AppDataReferences and adding them to the document
+   */
+  public void closeArchive() throws IOException {
+    if (newarchive!=null) {
+      newarchive.flush();
+      newarchive.closeEntry();
+      if (!isDocumentWritten())
+        log.warn("Premature closure of archive '"+archive.getAbsolutePath()+"': No document has been written.");
+      newarchive.finish();// close(); // use newarchive.finish(); for a stream IO
+      newarchive.flush();
+      //
+      updateOriginal();
+      closeAndReset();
+    } else {
+      log.warn("Attempt to close archive that has not been opened for writing.");
+    }
+  }
+  /**
+   * Opens and returns the applicationData output stream for the appdataReference string.
+   * @param appdataReference
+   * @return Output stream to write to
+   * @throws IOException
+   */
+  public AppDataOutputStream getAppDataStream(String appdataReference) throws IOException {
+    if (newarchive==null)
+      throw new IOException("Attempt to write to closed VamsasArchive object.");
+    if (addValidEntry(appdataReference)) {
+      return new AppDataOutputStream(newarchive);
+    }
+    return null;
+  }
+  
+  /**
+   * 
+   * @return JarEntry name for the vamsas XML stream in this archive
+   */
+  protected String getDocumentJarEntry() {
+    if (vamsasdocument)
+      return VamsasArchiveReader.VAMSASDOC;
+    return VamsasArchiveReader.VAMSASXML;
+  }
+  /**
+   * Safely initializes the VAMSAS XML document Jar Entry. 
+   * @return Writer to pass to the marshalling function.
+   * @throws IOException if a document entry has already been written. 
+   */
+  public PrintWriter getDocumentOutputStream() throws IOException {
+    if (newarchive==null)
+      openArchive();
+    if (!isDocumentWritten()) {
+      try {
+        if (addValidEntry(getDocumentJarEntry())) 
+          return new PrintWriter(new java.io.OutputStreamWriter(newarchive, "UTF-8"));
+      } catch (Exception e) {
+        log.warn("Problems opening XML document JarEntry stream",e);
+      }
+    } else {
+      throw new IOException("Vamsas Document output stream is already written.");
+    }
+    return null;
+  }
+  
+  /**
+   * Access original archive if it exists, pass the reader to the client
+   * Note: this is NOT thread safe and a call to closeArchive() will by necessity 
+   * close and invalidate the VamsasArchiveReader object.
+   * @return null if no original archive exists.
+   */
+  public VamsasArchiveReader getOriginalArchiveReader() throws IOException {
+    if (!virginArchive) {
+      accessOriginal();
+      return odoc;
+    }
+    return null;
+  }
+  /**
+   * returns original document's root vamsas elements.
+   * @return
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public Vobject[] getOriginalRoots() throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException  {
+    return VamsasArchive.getOriginalRoots(this);
+  }
+  /**
+   * @return original document or a new empty document (with default provenance)
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public VamsasDocument getVamsasDocument() throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    return getVamsasDocument("org.vamsas.simpleclient.VamsasArchive", "Created new empty document", null);
+  }
+  /**
+   * Return the original document or a new empty document with initial provenance entry.
+   * @param provenance_user (null sets user to be the class name)
+   * @param provenance_action (null sets action to be 'created new document')
+   * @param version (null means use latest version)
+   * @return (original document or a new vamsas document with supplied provenance and version info)
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public VamsasDocument getVamsasDocument(String provenance_user, String provenance_action, String version) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    if (_doc!=null)
+      return _doc;
+    _doc = getOriginalVamsasDocument(this, getVorba());
+    if (_doc!=null)
+      return _doc;
+    // validate parameters
+    if (provenance_user==null)
+      provenance_user = "org.vamsas.simpleclient.VamsasArchive";
+    if (provenance_action == null)
+      provenance_action="Created new empty document";
+    if (version==null)
+      version = VersionEntries.latestVersion();
+    // Create a new document and return it
+    _doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { new VAMSAS()}, 
+        ProvenanceStuff.newProvenance(provenance_user, provenance_action), version);
+    return _doc;
+  }
+  /**
+   * @return Returns the current VorbaIdFactory for the archive.
+   */
+  public VorbaIdFactory getVorba() {
+    if (vorba==null)
+      vorba = new SimpleDocument("simpleclient.VamsasArchive");
+    return vorba.getVorba();
+  }
+  /**
+   * @return true if Vamsas Document has been written to archive
+   */
+  protected boolean isDocumentWritten() {
+    if (newarchive==null)
+      log.warn("isDocumentWritten() called for unopened archive.");
+    if (entries!=null) {
+      if (entries.containsKey(getDocumentJarEntry()))
+        return true;
+    }
+    return false;
+  }
+  private void makeBackup() {
+    if (!virginArchive) {
+      if (originalBackup==null && original!=null && original.exists()) {
+        try {
+          accessOriginal();
+          originalBackup = odoclock.backupSessionFile(null, original.getName(), ".bak", original.getParentFile());
+        }
+        catch (IOException e) {
+          log.warn("Problem whilst making a backup of original archive.",e);
+        }
+      }
+    }
+  }
+  /**
+   * opens the new archive ready for writing. If the new archive is replacing an existing one, 
+   * then the existing archive will be locked, and the new archive written to a temporary file. 
+   * The new archive will be put in place once close() is called.
+   * @param doclock LATER - pass existing lock on document, if it exists.... no need yet?
+   * @throws IOException
+   */
+  private void openArchive() throws IOException {
+    
+    if (newarchive!=null) {
+      log.warn("openArchive() called multiple times.");
+      throw new IOException("Vamsas Archive '"+archive.getAbsolutePath()+"' is already open.");
+    }
+    if (archive==null && (virginArchive || original==null)) {
+      log.warn("openArchive called on uninitialised VamsasArchive object.");
+      throw new IOException("Badly initialised VamsasArchive object - no archive file specified.");
+    }
+    if (!virginArchive) {
+      // lock the original
+      accessOriginal();
+      // make a temporary file to write to
+      archive = File.createTempFile(original.getName(), ".new",original.getParentFile());
+    } else {
+      if (archive.exists())
+        log.warn("New archive file name already in use! Possible lock failure imminent?");
+    }
+    
+    if (rchive==null)
+      rchive = new SessionFile(archive);
+    if (!rchive.lockFile()) 
+      throw new IOException("Failed to get lock on file "+archive);
+    // LATER: locked IO stream based access.
+    Manifest newmanifest = new Manifest();
+    newarchive = new JarOutputStream(rchive.fileLock.getBufferedOutputStream(true), newmanifest);  
+    //newarchive = new JarOutputStream(new BufferedOutputStream(new java.io.FileOutputStream(archive)));  
+    entries = new Hashtable();
+  }
+  public void putVamsasDocument(VamsasDocument doc) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    putVamsasDocument(doc, getVorba());
+  }
+  /**
+   * 
+   * @param doc
+   * @param vorba
+   * @return (vorbaId string, Vobjhash) pairs for last hash of each object in document
+   * @throws IOException
+   * @throws org.exolab.castor.xml.MarshalException
+   * @throws org.exolab.castor.xml.ValidationException
+   */
+  public void putVamsasDocument(VamsasDocument doc, VorbaIdFactory vorba) throws IOException, 
+  org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
+    if (vamsasdocument)
+      doc.setVersion(VersionEntries.latestVersion()); // LATER: ensure this does the correct thing.
+    VorbaXmlBinder.putVamsasDocument(getDocumentOutputStream(), vorba, doc);
+  }
+  
+  /**
+   * recovers the original file's contents from the (temporary) backup. 
+   * @throws Exception if any SessionFile or file removal operations fail.
+   */
+  private void recoverBackup() throws Exception {
+    if (originalBackup!=null) {
+      // backup has been made.
+      // revert from backup and delete it (changing backup filename)
+      if (rchive==null) {
+        rchive = new SessionFile(original);
+      }
+      SessionFile bckup = new SessionFile(originalBackup);
+      
+      rchive.updateFrom(null, bckup); // recover from backup file.
+      bckup.unlockFile();
+      bckup=null;
+      removeBackup();
+    }
+  }
+  
+  /**
+   * forget about any backup that was made - removing it first if it was only temporary.
+   */
+  private void removeBackup() {
+    if (originalBackup!=null) {
+      log.debug("Removing backup in "+originalBackup.getAbsolutePath());
+      if (!donotdeletebackup)
+        if (!originalBackup.delete())
+          log.info("VamsasArchive couldn't remove temporary backup "+originalBackup.getAbsolutePath());
+      originalBackup=null;
+    }
+  } 
+  /**
+   * @param vorba the VorbaIdFactory to use for accessing vamsas objects.
+   */
+  public void setVorba(VorbaIdFactory Vorba) {
+    if (Vorba!=null) {
+      if (vorba==null)
+        vorba = new SimpleDocument(Vorba);
+      else
+        vorba.setVorba(Vorba);
+    } else
+      getVorba();
+  }
+  /**
+   * Convenience method to copy over the referred entry from the backup to the new version.
+   * Warning messages are raised if no backup exists or the 
+   * entry doesn't exist in the backed-up original.
+   * Duplicate writes return true - but a warning message will also be raised.
+   * @param AppDataReference
+   * @return true if AppDataReference now exists in the new document
+   * @throws IOException
+   */
+  public boolean transferAppDataEntry(String AppDataReference) throws IOException {
+    return transferAppDataEntry(AppDataReference, AppDataReference);
+  }
+  /**
+   * Validates the AppDataReference: not null and not already written to archive.
+   * @param AppDataReference
+   * @return true if valid. false if not
+   * @throws IOException for really broken references!
+   */
+  protected boolean _validNewAppDataReference(String newAppDataReference) throws IOException {
+    // LATER: Specify valid AppDataReference form in all VamsasArchive handlers
+    if (newAppDataReference==null)
+      throw new IOException("null newAppDataReference!");
+    if (entries.containsKey(newAppDataReference)) {
+      log.warn("Attempt to write '"+newAppDataReference+"' twice! - IGNORED");
+      // LATER: fix me? warning message should raise an exception here.
+      return false;
+    }
+    return true;
+  }
+  /**
+   * Transfers an AppDataReference from old to new vamsas archive, with a name change.
+   * @see transferAppDataEntry(String AppDataReference)
+   * @param AppDataReference
+   * @param NewAppDataReference - AppDataReference in new Archive
+   * @return
+   * @throws IOException
+   */
+  public boolean transferAppDataEntry(String AppDataReference, String NewAppDataReference) throws IOException {
+    if (original==null || !original.exists()) {
+      log.warn("No backup archive exists.");
+      return false;
+    }
+    if (AppDataReference==null)
+      throw new IOException("null AppDataReference!");
+
+    if (!_validNewAppDataReference(NewAppDataReference))
+      return false;
+    
+    accessOriginal();
+    
+    java.io.InputStream adstream = odoc.getAppdataStream(AppDataReference);
+    
+    if (adstream==null) {
+      log.warn("AppDataReference '"+AppDataReference+"' doesn't exist in backup archive.");
+      return false;
+    }
+    
+    java.io.OutputStream adout = getAppDataStream(NewAppDataReference);
+    // copy over the bytes
+    int written=-1;
+    long count=0;
+    byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a sensible buffer
+    do {
+      if ((written = adstream.read(buffer))>-1) {
+        adout.write(buffer, 0, written);
+        log.debug("Transferring "+written+".");
+        count+=written;
+      }
+    } while (written>-1);
+    log.debug("Sucessfully transferred AppData for '"
+        +AppDataReference+"' as '"+NewAppDataReference+"' ("+count+" bytes)");
+    return true;
+  }
+  /**
+   * write data from a stream into an appData reference.
+   * @param AppDataReference - New AppDataReference not already written to archive
+   * @param adstream Source of data for appData reference - read until .read(buffer) returns -1
+   * @return true on success.
+   * @throws IOException for file IO or invalid AppDataReference string
+   */
+  public boolean writeAppdataFromStream(String AppDataReference, java.io.InputStream adstream) throws IOException {
+    if (!_validNewAppDataReference(AppDataReference)) {
+      log.warn("Invalid AppDataReference passed to writeAppdataFromStream");
+      throw new IOException("Invalid AppDataReference! (null, or maybe non-unique)!");
+    }
+      
+    if (AppDataReference==null) {
+      log.warn("null appdata passed.");
+      throw new IOException("Null AppDataReference");
+    }
+    
+    java.io.OutputStream adout = getAppDataStream(AppDataReference);
+    // copy over the bytes
+    int written=-1;
+    long count=0;
+    byte[] buffer = new byte[_TRANSFER_BUFFER]; // conservative estimate of a sensible buffer
+    do {
+      if ((written = adstream.read(buffer))>-1) {
+        adout.write(buffer, 0, written);
+        log.debug("Transferring "+written+".");
+        count+=written;
+      }
+    } while (written>-1);
+    return true;
+  }
+  /**
+   * transfers any AppDataReferences existing in the old document 
+   * that haven't already been transferred to the new one
+   * LATER: do the same for transfers requiring a namechange - more document dependent.
+   *  @return true if data was transferred.
+   */
+  public boolean transferRemainingAppDatas() throws IOException {
+    boolean transfered=false;
+    if (original==null || !original.exists()) {
+      log.warn("No backup archive exists.");
+      return false;
+    }
+    accessOriginal();
+    
+    if (getVorba()!=null) {
+      Vector originalRefs=null;
+      try {
+        originalRefs = vorba.getReferencedEntries(getVamsasDocument(), getOriginalArchiveReader());
+      } catch (Exception e) {
+        log.warn("Problems accessing original document entries!",e);
+      }
+      if (originalRefs!=null) {
+        Iterator ref = originalRefs.iterator();
+        while (ref.hasNext()) {
+          String oldentry = (String) ref.next();
+          if (oldentry!=null && !entries.containsKey(oldentry)) {
+            log.debug("Transferring remaining entry '"+oldentry+"'");
+            transfered |= transferAppDataEntry(oldentry);
+          }
+        }
+      }
+    } 
+    return transfered;
+  }
+  /**
+   * called after archive is written to put file in its final place
+   */
+  private void updateOriginal() {
+    if (!virginArchive) {
+      // make sure original document really is backed up and then overwrite it.
+      if (odoc!=null) {
+        // try to shut the odoc reader.
+        odoc.close();
+        odoc = null;
+      }
+      // Make a backup if it isn't done already
+      makeBackup();
+      try {
+        // copy new Archive data that was writen to a temporary file
+        odoclock.updateFrom(null, rchive);
+      }
+      catch (IOException e) {
+        // LATER: decide if leaving nastily named backup files around is necessary.
+        File backupFile=backupFile();
+        if (backupFile!=null)
+          log.error("Problem updating archive from temporary file! - backup left in '"
+            +backupFile().getAbsolutePath()+"'",e);
+        else
+          log.error("Problems updating, and failed to even make a backup file. Ooops!", e);
+      }
+      // Tidy up if necessary.
+      removeBackup();
+    } else {
+      
+      
+    }
+  }
+}
diff --git a/src/org/vamsas/client/simpleclient/VamsasArchiveReader.java b/src/org/vamsas/client/simpleclient/VamsasArchiveReader.java
new file mode 100644 (file)
index 0000000..2df47f5
--- /dev/null
@@ -0,0 +1,313 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.RandomAccessFile;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.objects.utils.document.VersionEntries;
+/**
+ * Basic methods for accessing an existing Vamsas Archive, 
+ * and Jar entry names for creating new vamsas archives.
+ * 
+ * @author jimp
+ *
+ */
+public class VamsasArchiveReader {
+  private static Log log = LogFactory.getLog(VamsasArchiveReader.class);
+  JarFile jfile=null;
+  boolean stream=false; // true if we are seeking on the stream.
+  RandomAccessFile rfile;
+  ZipInputStream jstream=null;
+  Hashtable strmentries = null;
+  private void streamInit() {
+    //throw new Error("VamsasArchiveReader(Stream) Not implemented!");
+     if (!stream) {
+      log.debug("Skipping init for Jar Stream input.");
+      return;
+    }
+    strmentries = new Hashtable();
+    log.debug("Jar Stream input Initialisation");
+    try {
+      rfile.seek(0);
+      // no buffering - we need to be able to move around the random access stream.
+      jstream = new ZipInputStream(new FileInputStream(rfile.getFD())); // no manifest (probably)
+      if (jstream.available()==0)
+        log.warn("Can't read from JarInputStream (Locked stream!)");
+      ZipEntry entry=null;
+      long pos=0;
+      do {
+        if ((entry=jstream.getNextEntry())!=null) {
+          if (strmentries.containsKey(entry.getName())) {
+            log.info("Only recording last of duplicate entries '"+entry.getName()+"'");
+          } 
+          strmentries.put(entry.getName(), new Long(pos++));
+          jstream.closeEntry();
+        }
+      } while (entry!=null);
+    }
+    catch (Exception e) {
+      log.warn("Exceptions during init!",e);
+      jstream=null;
+    }
+  }
+  
+  public VamsasArchiveReader(File vamsasfile) {
+    jfile=null;
+    if (vamsasfile.exists()) {
+      try {
+        jfile=new JarFile(vamsasfile);
+      }
+      catch (Exception e) {
+        log.debug("non-serious? couldn't open new JarFile on "+vamsasfile,e);
+        jfile=null;
+      }
+    }
+    
+  }
+  /**
+   * in an ideal world - this constructor will create a reader object
+   * for the locked file's random access stream.
+   * 
+   * @param vamsaslock
+   */
+  public VamsasArchiveReader(Lock vamsaslock) {
+    // LATER: implement or remove
+    if (vamsaslock==null || !vamsaslock.isLocked())
+      throw new Error("IMPLEMENTATION ERROR: Cannot create a VamsasArchiveReader without a valid lock.");
+    // throw new Error("VamsasArchiveReading from locked IO stream not yet implemented.");
+    try {
+      rfile = vamsaslock.getRaFile();
+    } catch (Exception e) {
+      log.warn("Unexpected IO Exception when accessing locked vamsas archive stream "+vamsaslock.target,e);
+    }
+    stream = true;
+    streamInit();
+    if (jstream==null)
+      throw new Error("Failed to open archive from Locked random access stream.");
+  }
+  
+  /**
+   * the vamsas document version(s) handled by this Reader
+   */
+  final public static String DOCUMENT_VERSION=VersionEntries.BETA_VERSION; 
+  /**
+   * name of the jarEntry containing a well formatted vamsas XML Document
+   */
+  
+  final public static String VAMSASDOC="vamsasDocument.xml";
+  
+  /**
+   * name of the jarEntry containing a root VAMSAS element, and containing a 
+   * random sequence of VAMSAS DataSet elements 
+   */
+  
+  final public static String VAMSASXML="vamsas.xml";
+  /**
+   * seeks jstream to the given entry name and reads it.
+   * @param entryname
+   * @return
+   */
+  private JarEntry seekEntry(String entryname) {
+    if (jstream==null)
+      return null;
+    if (!strmentries.containsKey(entryname)) 
+      return null;
+    Long entrypos = (Long) strmentries.get(entryname);
+    if (entrypos==null) {
+      log.error("Null entry position for "+entryname);
+      return null;
+    }
+    try {
+      jstream=null;
+      rfile.seek(0);
+      jstream = new ZipInputStream(new FileInputStream(rfile.getFD()));
+      ZipEntry entry = null;
+      long epos = entrypos.longValue();
+      do {
+        entry = jstream.getNextEntry();
+      } while (entry!=null && --epos>=0);  
+        // rfile.seek(entrypos.longValue());
+      // make a Jar entry from a zip entry.
+      return new JarEntry(entry);
+    }
+    catch (Exception e) {
+      log.warn("Whilst seeking for "+entryname, e);
+    }
+    return null;
+  }
+  /**
+   * 
+   * @return JarEntry for VamsasArchiveReader.VAMSASDOC
+   */
+  protected JarEntry getVamsasDocumentEntry() {
+    return getJarEntry(VAMSASDOC);
+  }
+  /**
+   * 
+   * @return JarEntry for VamsasArchiveReader.VAMSASXML
+   */
+  protected JarEntry getVamsasXmlEntry() {
+    return getJarEntry(VAMSASXML);
+  }
+  /**
+   * Test for valid vamsas document archive
+   * @return true if getVamsasDocumentStream will return a stream likely to contain valid XML
+   */
+  public boolean isValid() {
+    // TODO: check if VAMSASDOC is well formed (follows www.vamsas.ac.uk/schemas/vamsasDocument.xsd) and all appData references are resolvable - preferably as jar entries
+    if (jfile!=null || jstream!=null)
+      return (getVamsasDocumentEntry()!=null);
+    return false;   
+  }
+  
+  
+  protected JarEntry getAppdataEntry(String AppdataRef) {
+    JarEntry entry;
+    if ((jfile==null && jstream==null) || !isValid() || (entry=getJarEntry(AppdataRef))==null)
+      return null;
+    
+    return entry;
+  }
+  
+  public InputStream getAppdataStream(String AppdataRef) {
+    JarEntry entry=getAppdataEntry(AppdataRef);
+    try {
+      if (entry!=null)
+        return getInputStream(entry);
+    } catch (IOException e) {
+      log.error("Failed when opening AppdataStream for "+AppdataRef, e);
+    }
+    return null;
+  }
+  /**
+   * get the VamsasDocument input stream, if it exists.
+   * @return null or valid input stream
+   */
+  public InputStream getVamsasDocumentStream() {
+    InputStream vdoc;
+    if ((jfile==null && jstream==null) || !isValid())
+      return null;
+    try {
+      vdoc = getInputStream(getVamsasDocumentEntry());
+    } catch (IOException e) {
+      log.error("Whilst geting document stream",e);
+      vdoc=null;
+    }
+    return vdoc;
+  }
+  
+  /**
+   * get the VamsasXML input stream, if it exists.
+   * Note: Deprecated beyond our prealpha testing.
+   * @return null or valid input stream.
+   */
+  
+  public InputStream getVamsasXmlStream() {
+    // log.warn("Deprecated call");
+    JarEntry xmle=getVamsasXmlEntry();
+    InputStream vdoc;
+    if (xmle==null)
+      return null;
+    try {
+      vdoc = getInputStream(xmle);
+    } catch (IOException e) {
+      log.error("Whilst getting VamsasXmlStream",e);
+      vdoc=null;
+    }
+    return vdoc;
+  }
+  
+  /**
+   * silently close the jar file.
+   *
+   */
+  public void close() {
+    if (jfile!=null) {
+      try {
+        jfile.close();
+      } catch (IOException e) {
+        log.error("Whilst closing JarFile "+jfile.getName(), e);
+      }
+    }
+    if (jstream!=null) {
+      try {
+        jstream.closeEntry();
+        jstream=null;
+        // LATER: reference counting for random access file instances is necessary.
+      }
+      catch (Exception e) {
+        log.error("Whilst finishing reading from jar input stream",e);
+      }
+    }
+  }
+  
+  /**
+   * returns all entries not matching the filespec of a vamsas xml entry
+   * @return array of entries.
+   */
+  public Vector getExtraEntries() {
+    if ((jfile==null && jstream==null)|| !isValid())
+      return null;
+    Vector e = new Vector();
+    if (jstream!=null) {
+      Enumeration entries = strmentries.keys();
+      if (entries!=null && entries.hasMoreElements()) {
+        do {
+          JarEntry el = (JarEntry) entries.nextElement();
+          if (!el.getName().equals(VAMSASDOC) && !el.getName().equals(VAMSASXML))
+            e.add(new String(el.getName())); // avoid references
+        } while (entries.hasMoreElements());
+      }
+    } else {
+      Enumeration entries = jfile.entries();
+      if (entries!=null && entries.hasMoreElements()) {
+        do {
+          JarEntry el = (JarEntry) entries.nextElement();
+          if (!el.getName().equals(VAMSASDOC) && !el.getName().equals(VAMSASXML))
+            e.add(new String(el.getName())); // avoid references
+        } while (entries.hasMoreElements());
+      }
+      return e;
+    }
+    return null;
+  }
+  
+  /* (non-Javadoc)
+   * @see java.util.jar.JarFile#getInputStream(java.util.zip.ZipEntry)
+   */
+  private InputStream getInputStream(ZipEntry ze) throws IOException {
+    if (jfile!=null)
+      return jfile.getInputStream(ze);
+    if (jstream!=null) {
+      seekEntry(ze.getName());
+      return new AppDataInputStream(jstream);
+    }
+    return null;
+  }
+    
+    /* (non-Javadoc)
+     * @see java.util.jar.JarFile#getJarEntry(java.lang.String)
+     */
+    private JarEntry getJarEntry(String name) {
+      if (jfile!=null)
+        return jfile.getJarEntry(name);
+      if (jstream!=null)
+        return seekEntry(name);
+      return null;
+    }
+  }
diff --git a/src/org/vamsas/client/simpleclient/VamsasFile.java b/src/org/vamsas/client/simpleclient/VamsasFile.java
new file mode 100644 (file)
index 0000000..3dd2581
--- /dev/null
@@ -0,0 +1,100 @@
+
+package org.vamsas.client.simpleclient;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Timer;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import org.vamsas.objects.core.LockFileDescriptor;
+
+/**
+ * low level vamsas document management routines
+ * analogous to ClientsFile
+ * Grew out of io tests on VamsasArchive class in org.vamsas.test.simpleclient.VamsasArchive
+ * This class is not thread safe.
+ * @author jimp
+ *
+ */
+public class VamsasFile extends SessionFile {
+  /**
+   * 
+   * Connect to an existing Vamsas document in a given sessionDir
+   * or create a new one.
+   * 
+   * @param sessionDir
+   * @throws java.io.IOException
+   */
+  public VamsasFile(File sessionFile) throws java.io.IOException {
+    super(sessionFile);
+  }
+  /**
+   * 
+   * @return the VamsasFile
+   */
+  public File getVamsasFile() {
+    return sessionFile;
+  }
+  /**
+   * Expand a previously stored session into the sessionDir
+   * @param sessionDir
+   * @param storedSession
+   
+   public VamsasFile(File sessionDir, JarFile storedSession) throws IOException {
+    // check if sessionDir is live or not
+    if (!sessionDir.exists()) {
+      sessionDir.mkdir();
+    }
+    
+    {
+      // check its actually a writable directory
+    }
+    
+    File sfile = new File(sessionDir, "vamsas.jar");
+    VamsasFile(sfile);
+    // if live - try to merge storedSession with sessionDir
+    //  - will probably fail through duplicate Vobject references needing to be dereferenced.
+    // TODO: think of a way of specifying vorba_id scope for an application's references to allow merging of one vamsasDocument with another.
+    
+  }
+  */
+  /**
+   * public interface for getting a lock.
+   * The lock object is internally referenced 
+   * so the lock will persist even after the
+   * return value of the method goes out of scope.
+   * @return null if lock couldn't be got or a valid Lock object.
+   */
+  public Lock getLock() {
+    if (lockFile())
+      return fileLock;
+    return null;
+  }
+  /**
+   * 
+   * @param extantLock
+   * @return null, extantLock or new Lock.
+   */
+  public Lock getLock(Lock extantLock) {
+    if (lockFile(extantLock))
+      return fileLock;
+    return null;
+  }
+  /**
+   * explicitly unlocks vamsas file.
+   * if you have called getLock() you *must* 
+   * call this to release the lock.
+   */
+  public void unLock() {
+    this.unlockFile();
+  }
+  
+}
diff --git a/src/org/vamsas/client/simpleclient/VamsasSession.java b/src/org/vamsas/client/simpleclient/VamsasSession.java
new file mode 100644 (file)
index 0000000..a5359ad
--- /dev/null
@@ -0,0 +1,312 @@
+package org.vamsas.client.simpleclient;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.RandomAccessFile;
+import java.io.Writer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.Appender;
+import org.apache.log4j.Logger;
+import org.apache.log4j.FileAppender;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.UserHandle;
+/**
+ * Does all the IO operations for a SimpleClient instance accessing 
+ * a SimpleClient vamsas session.
+ * 
+ * Basically, it defines the various standard names for the files 
+ * in the session directory (that maps to the sessionUrn), 
+ * provides constructors for the file handlers and watchers of 
+ * those file entities, and some higher level methods 
+ * to check and change the state flags for the session.
+ * 
+ * TODO: move the stuff below to the SimpleClientFactory documentation.
+ * much may not be valid now :
+ * Vamsas client is intialised with a path to create live session directories. 
+ * This path may contain a vamsas.properties file 
+ * that sets additional parameters (otherwise client 
+ * just uses the one on the classpath).
+ * 
+ * A vamsas session consists of :
+ *  SessionDir - translates to urn of a live session.
+ *  Contains: Vamsas Document (as a jar), Session client list file, 
+ *  both of which may be locked, and additional 
+ *  temporary versions of these files when write 
+ *  operations are taking place.
+ * 
+ * Zip file entries
+ *  - vamsasdocument.xml : core info
+ *  one or more:
+ *  - <applicationname>.version.sessionnumber.raw (string given in vamsasdocument.xml applicationData entry)
+ *  
+ * Lockfile
+ *  - filename given in the vamsasdocument.xml. Should be checked for validity by any client and rewritten if necessary. 
+ *    The lockfile can point to the jar itself.
+ * Mode of operation.
+ * Initially - documentHandler either:
+ *  - creates a zip for a new session for the client
+ *  - connect to an existing session zip 
+ *   1. reads session urn file
+ *   2. waits for lock
+ *   3. examines session - decide whether to create new application data slice or connect to one stored in session.
+ *   4. writes info into session file
+ *   5. releases lock and generates local client events.
+ *   6. Creates Watcher thread to generate events.
+ * 
+ * During the session
+ *  - Update watcher checks for file change - 
+ * 
+ * Procedures for file based session message exchange
+ *  - session document modification flag
+ *    
+ */
+
+public class VamsasSession {
+  /**
+   * indicator file for informing other processes that 
+   * they should finalise their vamsas datasets for 
+   * storing into a vamsas archive.
+   */
+  public static final String CLOSEANDSAVE_FILE="stored.log";
+  /**
+   * session file storing the last_stored_stat data 
+   */
+  public static final String MODIFIEDDOC_FILE="modified";
+
+  /**
+   * called to clear update flag after a successful offline storage event
+   */
+  protected void clearUnsavedFlag() {
+    SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir, MODIFIEDDOC_FILE));
+    if (!laststored.clearFlag())
+      log.warn("Unsaved flag was not cleared for "+sessionDir);
+  }
+  /**
+   * called to indicate session document has been modified.
+   *
+   */
+  protected void setUnsavedFlag() {
+    SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir, MODIFIEDDOC_FILE));
+    if (!laststored.setFlag())
+      log.warn("Couldn't set the Unsaved flag for "+sessionDir);
+  }
+  /**
+   * 
+   * @return true if session document has been modified since last offline storage event 
+   */
+  protected boolean getUnsavedFlag() {
+    SessionFlagFile laststored = new SessionFlagFile(new File(sessionDir, MODIFIEDDOC_FILE));
+    return laststored.checkFlag();
+  }
+  /**
+   * log file location
+   */
+  public static final String SESSION_LOG="Log.txt";
+  private static Log log = LogFactory.getLog(VamsasSession.class);
+  protected Logger slog = Logger.getLogger("org.vamsas.client.SessionLog");
+  /**
+   * setup the sessionLog using Log4j.
+   * @throws IOException
+   */
+  private void initLog() throws IOException {
+    // LATER: make dedicated appender format for session log.
+    Appender app = slog.getAppender("SESSION_LOG");
+    slog.addAppender(new FileAppender(app.getLayout(), new File(sessionDir, SESSION_LOG).getAbsolutePath()));
+  }
+  
+  /**
+   * the sessionDir is given as the session location for new clients.
+   */
+  protected File sessionDir;
+  /**
+   * holds the list of attached clients
+   */
+  ClientsFile clist;
+  public static final String CLIENT_LIST="Clients.obj";
+  /**
+   * holds the data
+   */
+  VamsasFile vamArchive; 
+  public static final String VAMSAS_OBJ="VamDoc.jar";
+  
+  /**
+   * sets up the vamsas session files and watchers in sessionDir
+   * @param sessionDir
+   */
+  protected VamsasSession(File sessionDir) throws IOException {
+    if (sessionDir==null)
+      throw new Error("Null directory for VamsasSession.");
+    if (sessionDir.exists()) {
+      if (!sessionDir.isDirectory() || !sessionDir.canWrite() || !sessionDir.canRead())
+        throw new IOException("Cannot access '"+sessionDir+"' as a read/writable Directory.");
+      if (checkSessionFiles(sessionDir)) {
+        // session files exist in the directory
+        this.sessionDir = sessionDir;
+        initSessionObjects();
+        slog.debug("Initialising additional VamsasSession instance");
+        log.debug("Attached to VamsasSession in "+sessionDir);
+      } 
+    } else {
+      // start from scratch
+      if (!sessionDir.mkdir())
+        throw new IOException("Failed to make VamsasSession directory in "+sessionDir);
+      this.sessionDir = sessionDir; 
+      createSessionFiles();
+      initSessionObjects();
+      slog.debug("Session directory created.");
+      log.debug("Initialised VamsasSession in "+sessionDir);
+    }
+  }
+  /**
+   * tests presence of existing sessionfiles files in dir
+   * @param dir
+   * @return
+   */
+  private boolean checkSessionFiles(File dir) throws IOException {
+    File c_file = new File(dir,CLIENT_LIST);
+    File v_doc = new File(dir,VAMSAS_OBJ);
+    if (c_file.exists() && v_doc.exists())
+      return true;
+    return false;
+  }
+  /**
+   * create new empty files in dir
+   *
+   */
+  private void createSessionFiles() throws IOException {
+    if (sessionDir==null)
+      throw new IOException("Invalid call to createSessionFiles() with null sessionDir");
+    File c_file = new File(sessionDir,CLIENT_LIST);
+    File v_doc = new File(sessionDir,VAMSAS_OBJ);
+    if (c_file.createNewFile())
+      log.debug("Created new ClientFile "+c_file); // don't care if this works or not
+    if (v_doc.createNewFile())
+      log.debug("Created new Vamsas Session Document File "+v_doc); 
+  }
+  /**
+   * construct SessionFile objects and watchers for each
+   */
+  private void initSessionObjects() throws IOException {
+    if (clist!=null || vamArchive!=null)
+      throw new IOException("initSessionObjects called for initialised VamsasSession object.");
+    clist = new ClientsFile(new File(sessionDir,CLIENT_LIST));
+    vamArchive = new VamsasFile(new File(sessionDir,VAMSAS_OBJ));
+    initLog();
+  }
+  /**
+   * make a new watcher object for the clientFile
+   * @return new ClientFile watcher instance
+   */
+  public FileWatcher getClientWatcher() {
+    return new FileWatcher(clist.sessionFile);
+  }
+  FileWatcher session_doc_watcher=null;
+  /**
+   * make a new watcher object for the vamsas Document
+   * @return new ClientFile watcher instance
+   */
+  public FileWatcher getDocWatcher() {
+    if (session_doc_watcher==null)
+      return session_doc_watcher = new FileWatcher(vamArchive.sessionFile);
+    return new FileWatcher(vamArchive.sessionFile);
+  }
+  FileWatcher store_doc_file=null;
+  /**
+   * make a new watcher object for the messages file
+   * (thread safe - keeps a reference to the first watcher)
+   * @return new watcher instance
+   */
+  public FileWatcher getStoreWatcher() {
+    if (store_doc_file==null)
+      return store_doc_file = new FileWatcher(new File(CLOSEANDSAVE_FILE));
+    return new FileWatcher(new File(CLOSEANDSAVE_FILE));
+
+  }
+  /**
+   * write to the StoreWatcher file to indicate that a storeDocumentRequest has been made.
+   * The local client's storeWatcher FileWatcher object is updated so the initial change is not registered.
+   * @param client
+   * @param user
+   * @return
+   */
+  public void addStoreDocumentRequest(ClientHandle client, UserHandle user) throws IOException {
+    SessionFile sfw = new SessionFile(new File(sessionDir, CLOSEANDSAVE_FILE));
+    while (!sfw.lockFile())
+      log.debug("Trying to get lock for "+CLOSEANDSAVE_FILE);
+    RandomAccessFile sfwfile=sfw.fileLock.getRaFile();
+    sfwfile.setLength(0); // wipe out any old info.
+    // TODO: rationalise what gets written to this file (ie do we want other clients to read the id of the requestor?)
+    sfwfile.writeUTF(client.getClientUrn()+":"+user.getFullName()+"@"+user.getOrganization());
+    sfw.unlockFile();
+    if (store_doc_file!=null)
+      store_doc_file.setState();
+    slog.info("FinalizeAppData request from "+user.getFullName()+" using "+client.getClientUrn()+"");
+  }
+  /**
+   * create a new session with an existing vamsas Document - by copying it into the session.
+   * @param archive
+   */
+  public void setVamsasDocument(File archive) throws IOException {
+    log.debug("Transferring vamsas data from "+archive+" to session:"+vamArchive.sessionFile);
+    SessionFile xtantdoc = new SessionFile(archive);
+    vamArchive.updateFrom(null, xtantdoc);
+    // LATER: decide if session archive provenance should be updated to reflect access.
+    // TODO: soon! do a proper import objects from external file 
+    log.debug("Transfer complete.");
+  }
+  /**
+   * write session as a new vamsas Document (this will overwrite any existing file without warning)
+   * TODO: test
+   * TODO: verify that lock should be released for vamsas document.
+   * @param destarchive
+   */
+  protected void writeVamsasDocument(File destarchive, Lock extlock) throws IOException {
+    log.debug("Transferring vamsas data from "+vamArchive.sessionFile+" to session:"+destarchive);
+    SessionFile newdoc = new SessionFile(destarchive);
+    if (extlock==null && !vamArchive.lockFile())
+      while (!vamArchive.lockFile())
+        log.info("Trying to get lock for "+vamArchive.sessionFile);
+    // TODO: LATER: decide if session archive provenance should be written in vamsasDocument file for this export.
+    newdoc.updateFrom(extlock, vamArchive);
+    // LATER: LATER: fix use of updateFrom for file systems where locks cannot be made (because they don't have a lockManager, ie NFS/Unix, etc).
+    vamArchive.unLock();
+    newdoc.unlockFile();
+    log.debug("Transfer complete.");
+  }
+  
+  /**
+   * Creates a VamsasArchive Vobject for accessing and updating document
+   * Note: this will lock the Vamsas Document for exclusive access to the client.
+   * @return session vamsas document
+   * @throws IOException if locks fail or vamsas document read fails.
+   */
+  protected VamsasArchive getVamsasDocument() throws IOException {
+    // TODO: check we haven't already done this once
+    if (!vamArchive.lockFile()) 
+      throw new IOException("Failed to get lock for vamsas archive.");
+    
+    VamsasArchive va = new VamsasArchive(vamArchive.sessionFile, false, true, vamArchive);
+    
+    return va;
+  }
+  /**
+   * create a uniquely named file in the session Directory
+   * @see java.io.File.createTempFile
+   * @param pref Prefix for name
+   * @param suff Suffix for name
+   * @return SessionFile object configured for the new file (of length zero)
+   * @throws IOException
+   */
+  protected SessionFile getTempSessionFile(String pref, String suff) throws IOException {
+    File tfile = File.createTempFile(pref,suff,sessionDir);
+    SessionFile tempFile = new SessionFile(tfile);
+    return tempFile;
+  }
+}
+
+
diff --git a/src/org/vamsas/objects/core/.castor.cdr b/src/org/vamsas/objects/core/.castor.cdr
new file mode 100644 (file)
index 0000000..8ec2cf3
--- /dev/null
@@ -0,0 +1,3 @@
+-- listing properties --\r
+org.vamsas.objects.core.LockFile=org.vamsas.objects.core.LockFileDescr...\r
+org.vamsas.objects.core.VamsasDocument=org.vamsas.objects.core.VamsasDocumen...\r
diff --git a/src/org/vamsas/objects/core/Alignment.java b/src/org/vamsas/objects/core/Alignment.java
new file mode 100644 (file)
index 0000000..bf70f4e
--- /dev/null
@@ -0,0 +1,979 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Alignment.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Alignment extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field _gapChar
+     */
+    private java.lang.String _gapChar;
+
+    /**
+     * Field _aligned
+     */
+    private boolean _aligned;
+
+    /**
+     * keeps track of state for field: _aligned
+     */
+    private boolean _has_aligned;
+
+    /**
+     * Primary Key for vamsas object referencing
+     *  
+     */
+    private java.lang.String _id;
+
+    /**
+     * Field _modifiable
+     */
+    private java.lang.String _modifiable;
+
+    /**
+     * This is annotation over the coordinate frame
+     *  defined by all the columns in the alignment.
+     *  
+     */
+    private java.util.Vector _alignmentAnnotationList;
+
+    /**
+     * Field _treeList
+     */
+    private java.util.Vector _treeList;
+
+    /**
+     * Field _alignmentSequenceList
+     */
+    private java.util.Vector _alignmentSequenceList;
+
+    /**
+     * typical properties may be additional
+     *  alignment score objects 
+     */
+    private java.util.Vector _propertyList;
+
+    /**
+     * Field _provenance
+     */
+    private org.vamsas.objects.core.Provenance _provenance;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Alignment() 
+     {
+        super();
+        _alignmentAnnotationList = new Vector();
+        _treeList = new Vector();
+        _alignmentSequenceList = new Vector();
+        _propertyList = new Vector();
+    } //-- org.vamsas.objects.core.Alignment()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param vAlignmentAnnotation
+     */
+    public void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationList.addElement(vAlignmentAnnotation);
+    } //-- void addAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method addAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotation
+     */
+    public void addAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentAnnotationList.insertElementAt(vAlignmentAnnotation, index);
+    } //-- void addAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method addAlignmentSequence
+     * 
+     * 
+     * 
+     * @param vAlignmentSequence
+     */
+    public void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentSequenceList.addElement(vAlignmentSequence);
+    } //-- void addAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
+
+    /**
+     * Method addAlignmentSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentSequence
+     */
+    public void addAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentSequenceList.insertElementAt(vAlignmentSequence, index);
+    } //-- void addAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param vTree
+     */
+    public void addTree(org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.addElement(vTree);
+    } //-- void addTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void addTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.insertElementAt(vTree, index);
+    } //-- void addTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method deleteAligned
+     * 
+     */
+    public void deleteAligned()
+    {
+        this._has_aligned= false;
+    } //-- void deleteAligned() 
+
+    /**
+     * Method enumerateAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignmentAnnotation()
+    {
+        return _alignmentAnnotationList.elements();
+    } //-- java.util.Enumeration enumerateAlignmentAnnotation() 
+
+    /**
+     * Method enumerateAlignmentSequence
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignmentSequence()
+    {
+        return _alignmentSequenceList.elements();
+    } //-- java.util.Enumeration enumerateAlignmentSequence() 
+
+    /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
+     * Method enumerateTree
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateTree()
+    {
+        return _treeList.elements();
+    } //-- java.util.Enumeration enumerateTree() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Alignment) {
+        
+            Alignment temp = (Alignment)obj;
+            if (this._gapChar != null) {
+                if (temp._gapChar == null) return false;
+                else if (!(this._gapChar.equals(temp._gapChar))) 
+                    return false;
+            }
+            else if (temp._gapChar != null)
+                return false;
+            if (this._aligned != temp._aligned)
+                return false;
+            if (this._has_aligned != temp._has_aligned)
+                return false;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._modifiable != null) {
+                if (temp._modifiable == null) return false;
+                else if (!(this._modifiable.equals(temp._modifiable))) 
+                    return false;
+            }
+            else if (temp._modifiable != null)
+                return false;
+            if (this._alignmentAnnotationList != null) {
+                if (temp._alignmentAnnotationList == null) return false;
+                else if (!(this._alignmentAnnotationList.equals(temp._alignmentAnnotationList))) 
+                    return false;
+            }
+            else if (temp._alignmentAnnotationList != null)
+                return false;
+            if (this._treeList != null) {
+                if (temp._treeList == null) return false;
+                else if (!(this._treeList.equals(temp._treeList))) 
+                    return false;
+            }
+            else if (temp._treeList != null)
+                return false;
+            if (this._alignmentSequenceList != null) {
+                if (temp._alignmentSequenceList == null) return false;
+                else if (!(this._alignmentSequenceList.equals(temp._alignmentSequenceList))) 
+                    return false;
+            }
+            else if (temp._alignmentSequenceList != null)
+                return false;
+            if (this._propertyList != null) {
+                if (temp._propertyList == null) return false;
+                else if (!(this._propertyList.equals(temp._propertyList))) 
+                    return false;
+            }
+            else if (temp._propertyList != null)
+                return false;
+            if (this._provenance != null) {
+                if (temp._provenance == null) return false;
+                else if (!(this._provenance.equals(temp._provenance))) 
+                    return false;
+            }
+            else if (temp._provenance != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'aligned'.
+     * 
+     * @return boolean
+     * @return the value of field 'aligned'.
+     */
+    public boolean getAligned()
+    {
+        return this._aligned;
+    } //-- boolean getAligned() 
+
+    /**
+     * Method getAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("getAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
+    } //-- org.vamsas.objects.core.AlignmentAnnotation getAlignmentAnnotation(int) 
+
+    /**
+     * Method getAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation()
+    {
+        int size = _alignmentAnnotationList.size();
+        org.vamsas.objects.core.AlignmentAnnotation[] mArray = new org.vamsas.objects.core.AlignmentAnnotation[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.AlignmentAnnotation) _alignmentAnnotationList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.AlignmentAnnotation[] getAlignmentAnnotation() 
+
+    /**
+     * Method getAlignmentAnnotationCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentAnnotationCount()
+    {
+        return _alignmentAnnotationList.size();
+    } //-- int getAlignmentAnnotationCount() 
+
+    /**
+     * Method getAlignmentSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentSequence
+     */
+    public org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentSequenceList.size())) {
+            throw new IndexOutOfBoundsException("getAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
+    } //-- org.vamsas.objects.core.AlignmentSequence getAlignmentSequence(int) 
+
+    /**
+     * Method getAlignmentSequence
+     * 
+     * 
+     * 
+     * @return AlignmentSequence
+     */
+    public org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence()
+    {
+        int size = _alignmentSequenceList.size();
+        org.vamsas.objects.core.AlignmentSequence[] mArray = new org.vamsas.objects.core.AlignmentSequence[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.AlignmentSequence) _alignmentSequenceList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.AlignmentSequence[] getAlignmentSequence() 
+
+    /**
+     * Method getAlignmentSequenceCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentSequenceCount()
+    {
+        return _alignmentSequenceList.size();
+    } //-- int getAlignmentSequenceCount() 
+
+    /**
+     * Returns the value of field 'gapChar'.
+     * 
+     * @return String
+     * @return the value of field 'gapChar'.
+     */
+    public java.lang.String getGapChar()
+    {
+        return this._gapChar;
+    } //-- java.lang.String getGapChar() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'modifiable'.
+     * 
+     * @return String
+     * @return the value of field 'modifiable'.
+     */
+    public java.lang.String getModifiable()
+    {
+        return this._modifiable;
+    } //-- java.lang.String getModifiable() 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property getProperty(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Property[] getProperty() 
+
+    /**
+     * Method getPropertyCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getPropertyCount()
+    {
+        return _propertyList.size();
+    } //-- int getPropertyCount() 
+
+    /**
+     * Returns the value of field 'provenance'.
+     * 
+     * @return Provenance
+     * @return the value of field 'provenance'.
+     */
+    public org.vamsas.objects.core.Provenance getProvenance()
+    {
+        return this._provenance;
+    } //-- org.vamsas.objects.core.Provenance getProvenance() 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree getTree(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+    } //-- org.vamsas.objects.core.Tree getTree(int) 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree[] getTree()
+    {
+        int size = _treeList.size();
+        org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Tree[] getTree() 
+
+    /**
+     * Method getTreeCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getTreeCount()
+    {
+        return _treeList.size();
+    } //-- int getTreeCount() 
+
+    /**
+     * Method hasAligned
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasAligned()
+    {
+        return this._has_aligned;
+    } //-- boolean hasAligned() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int index)
+    {
+        java.lang.Object obj = _alignmentAnnotationList.elementAt(index);
+        _alignmentAnnotationList.removeElementAt(index);
+        return (org.vamsas.objects.core.AlignmentAnnotation) obj;
+    } //-- org.vamsas.objects.core.AlignmentAnnotation removeAlignmentAnnotation(int) 
+
+    /**
+     * Method removeAlignmentSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentSequence
+     */
+    public org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int index)
+    {
+        java.lang.Object obj = _alignmentSequenceList.elementAt(index);
+        _alignmentSequenceList.removeElementAt(index);
+        return (org.vamsas.objects.core.AlignmentSequence) obj;
+    } //-- org.vamsas.objects.core.AlignmentSequence removeAlignmentSequence(int) 
+
+    /**
+     * Method removeAllAlignmentAnnotation
+     * 
+     */
+    public void removeAllAlignmentAnnotation()
+    {
+        _alignmentAnnotationList.removeAllElements();
+    } //-- void removeAllAlignmentAnnotation() 
+
+    /**
+     * Method removeAllAlignmentSequence
+     * 
+     */
+    public void removeAllAlignmentSequence()
+    {
+        _alignmentSequenceList.removeAllElements();
+    } //-- void removeAllAlignmentSequence() 
+
+    /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
+     * Method removeAllTree
+     * 
+     */
+    public void removeAllTree()
+    {
+        _treeList.removeAllElements();
+    } //-- void removeAllTree() 
+
+    /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
+     * Method removeTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree removeTree(int index)
+    {
+        java.lang.Object obj = _treeList.elementAt(index);
+        _treeList.removeElementAt(index);
+        return (org.vamsas.objects.core.Tree) obj;
+    } //-- org.vamsas.objects.core.Tree removeTree(int) 
+
+    /**
+     * Sets the value of field 'aligned'.
+     * 
+     * @param aligned the value of field 'aligned'.
+     */
+    public void setAligned(boolean aligned)
+    {
+        this._aligned = aligned;
+        this._has_aligned = true;
+    } //-- void setAligned(boolean) 
+
+    /**
+     * Method setAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentAnnotation
+     */
+    public void setAlignmentAnnotation(int index, org.vamsas.objects.core.AlignmentAnnotation vAlignmentAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("setAlignmentAnnotation: Index value '"+index+"' not in range [0.."+_alignmentAnnotationList.size()+ "]");
+        }
+        _alignmentAnnotationList.setElementAt(vAlignmentAnnotation, index);
+    } //-- void setAlignmentAnnotation(int, org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method setAlignmentAnnotation
+     * 
+     * 
+     * 
+     * @param alignmentAnnotationArray
+     */
+    public void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation[] alignmentAnnotationArray)
+    {
+        //-- copy array
+        _alignmentAnnotationList.removeAllElements();
+        for (int i = 0; i < alignmentAnnotationArray.length; i++) {
+            _alignmentAnnotationList.addElement(alignmentAnnotationArray[i]);
+        }
+    } //-- void setAlignmentAnnotation(org.vamsas.objects.core.AlignmentAnnotation) 
+
+    /**
+     * Method setAlignmentSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentSequence
+     */
+    public void setAlignmentSequence(int index, org.vamsas.objects.core.AlignmentSequence vAlignmentSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentSequenceList.size())) {
+            throw new IndexOutOfBoundsException("setAlignmentSequence: Index value '"+index+"' not in range [0.."+_alignmentSequenceList.size()+ "]");
+        }
+        _alignmentSequenceList.setElementAt(vAlignmentSequence, index);
+    } //-- void setAlignmentSequence(int, org.vamsas.objects.core.AlignmentSequence) 
+
+    /**
+     * Method setAlignmentSequence
+     * 
+     * 
+     * 
+     * @param alignmentSequenceArray
+     */
+    public void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence[] alignmentSequenceArray)
+    {
+        //-- copy array
+        _alignmentSequenceList.removeAllElements();
+        for (int i = 0; i < alignmentSequenceArray.length; i++) {
+            _alignmentSequenceList.addElement(alignmentSequenceArray[i]);
+        }
+    } //-- void setAlignmentSequence(org.vamsas.objects.core.AlignmentSequence) 
+
+    /**
+     * Sets the value of field 'gapChar'.
+     * 
+     * @param gapChar the value of field 'gapChar'.
+     */
+    public void setGapChar(java.lang.String gapChar)
+    {
+        this._gapChar = gapChar;
+    } //-- void setGapChar(java.lang.String) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'modifiable'.
+     * 
+     * @param modifiable the value of field 'modifiable'.
+     */
+    public void setModifiable(java.lang.String modifiable)
+    {
+        this._modifiable = modifiable;
+    } //-- void setModifiable(java.lang.String) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        _propertyList.setElementAt(vProperty, index);
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Sets the value of field 'provenance'.
+     * 
+     * @param provenance the value of field 'provenance'.
+     */
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)
+    {
+        this._provenance = provenance;
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void setTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        _treeList.setElementAt(vTree, index);
+    } //-- void setTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param treeArray
+     */
+    public void setTree(org.vamsas.objects.core.Tree[] treeArray)
+    {
+        //-- copy array
+        _treeList.removeAllElements();
+        for (int i = 0; i < treeArray.length; i++) {
+            _treeList.addElement(treeArray[i]);
+        }
+    } //-- void setTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Alignment
+     */
+    public static org.vamsas.objects.core.Alignment unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Alignment) Unmarshaller.unmarshal(org.vamsas.objects.core.Alignment.class, reader);
+    } //-- org.vamsas.objects.core.Alignment unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/AlignmentAnnotation.java b/src/org/vamsas/objects/core/AlignmentAnnotation.java
new file mode 100644 (file)
index 0000000..3fb9dfc
--- /dev/null
@@ -0,0 +1,249 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * This is annotation over the coordinate frame\r
+ *  defined by all the columns in the alignment.\r
+ *  \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AlignmentAnnotation extends org.vamsas.objects.core.RangeAnnotation \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * TODO: decide if this flag is\r
+     *  redundant - when true it would suggest that\r
+     *  the annotationElement values together form a\r
+     *  graph \r
+     */\r
+    private boolean _graph;\r
+\r
+    /**\r
+     * keeps track of state for field: _graph\r
+     */\r
+    private boolean _has_graph;\r
+\r
+    /**\r
+     * Field _provenance\r
+     */\r
+    private org.vamsas.objects.core.Provenance _provenance;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AlignmentAnnotation() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.AlignmentAnnotation()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteGraph\r
+     * \r
+     */\r
+    public void deleteGraph()\r
+    {\r
+        this._has_graph= false;\r
+    } //-- void deleteGraph() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof AlignmentAnnotation) {\r
+        \r
+            AlignmentAnnotation temp = (AlignmentAnnotation)obj;\r
+            if (this._graph != temp._graph)\r
+                return false;\r
+            if (this._has_graph != temp._has_graph)\r
+                return false;\r
+            if (this._provenance != null) {\r
+                if (temp._provenance == null) return false;\r
+                else if (!(this._provenance.equals(temp._provenance))) \r
+                    return false;\r
+            }\r
+            else if (temp._provenance != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'graph'. The field 'graph' has\r
+     * the following description: TODO: decide if this flag is\r
+     *  redundant - when true it would suggest that\r
+     *  the annotationElement values together form a\r
+     *  graph \r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'graph'.\r
+     */\r
+    public boolean getGraph()\r
+    {\r
+        return this._graph;\r
+    } //-- boolean getGraph() \r
+\r
+    /**\r
+     * Returns the value of field 'provenance'.\r
+     * \r
+     * @return Provenance\r
+     * @return the value of field 'provenance'.\r
+     */\r
+    public org.vamsas.objects.core.Provenance getProvenance()\r
+    {\r
+        return this._provenance;\r
+    } //-- org.vamsas.objects.core.Provenance getProvenance() \r
+\r
+    /**\r
+     * Method hasGraph\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraph()\r
+    {\r
+        return this._has_graph;\r
+    } //-- boolean hasGraph() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'graph'. The field 'graph' has the\r
+     * following description: TODO: decide if this flag is\r
+     *  redundant - when true it would suggest that\r
+     *  the annotationElement values together form a\r
+     *  graph \r
+     * \r
+     * @param graph the value of field 'graph'.\r
+     */\r
+    public void setGraph(boolean graph)\r
+    {\r
+        this._graph = graph;\r
+        this._has_graph = true;\r
+    } //-- void setGraph(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'provenance'.\r
+     * \r
+     * @param provenance the value of field 'provenance'.\r
+     */\r
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)\r
+    {\r
+        this._provenance = provenance;\r
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return RangeType\r
+     */\r
+    public static org.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.AlignmentAnnotation) Unmarshaller.unmarshal(org.vamsas.objects.core.AlignmentAnnotation.class, reader);\r
+    } //-- org.vamsas.objects.core.RangeType unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AlignmentAnnotationDescriptor.java b/src/org/vamsas/objects/core/AlignmentAnnotationDescriptor.java
new file mode 100644 (file)
index 0000000..fb81a9a
--- /dev/null
@@ -0,0 +1,255 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AlignmentAnnotationDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AlignmentAnnotationDescriptor extends org.vamsas.objects.core.RangeAnnotationDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AlignmentAnnotationDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.RangeAnnotationDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "AlignmentAnnotation";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _graph\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+                if(!target.hasGraph())\r
+                    return null;\r
+                return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setGraph( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graph\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _provenance\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+                return target.getProvenance();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AlignmentAnnotation target = (AlignmentAnnotation) object;\r
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.Provenance();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _provenance\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- org.vamsas.objects.core.AlignmentAnnotationDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.AlignmentAnnotation.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AlignmentDescriptor.java b/src/org/vamsas/objects/core/AlignmentDescriptor.java
new file mode 100644 (file)
index 0000000..4804a61
--- /dev/null
@@ -0,0 +1,503 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class AlignmentDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class AlignmentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public AlignmentDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "Alignment";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _gapChar
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_gapChar", "gapChar", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getGapChar();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.setGapChar( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _gapChar
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _aligned
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_aligned", "aligned", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                if(!target.hasAligned())
+                    return null;
+                return (target.getAligned() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteAligned();
+                        return;
+                    }
+                    target.setAligned( ((java.lang.Boolean)value).booleanValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _aligned
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            BooleanValidator typeValidator = new BooleanValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _modifiable
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getModifiable();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.setModifiable( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _modifiable
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _alignmentAnnotationList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.AlignmentAnnotation.class, "_alignmentAnnotationList", "AlignmentAnnotation", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getAlignmentAnnotation();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.addAlignmentAnnotation( (org.vamsas.objects.core.AlignmentAnnotation) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.AlignmentAnnotation();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _alignmentAnnotationList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _treeList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getTree();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.addTree( (org.vamsas.objects.core.Tree) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Tree();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _treeList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _alignmentSequenceList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.AlignmentSequence.class, "_alignmentSequenceList", "alignmentSequence", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getAlignmentSequence();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.addAlignmentSequence( (org.vamsas.objects.core.AlignmentSequence) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.AlignmentSequence();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _alignmentSequenceList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _propertyList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getProperty();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.addProperty( (org.vamsas.objects.core.Property) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Property();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _propertyList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _provenance
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Alignment target = (Alignment) object;
+                return target.getProvenance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Alignment target = (Alignment) object;
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Provenance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _provenance
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.AlignmentDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Alignment.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/AlignmentSequence.java b/src/org/vamsas/objects/core/AlignmentSequence.java
new file mode 100644 (file)
index 0000000..3a0a72e
--- /dev/null
@@ -0,0 +1,385 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class AlignmentSequence.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class AlignmentSequence extends org.vamsas.objects.core.SequenceType 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object
+     *  referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * Dataset Sequence from which
+     *  this alignment sequence is taken from
+     *  
+     */
+    private java.lang.Object _refid;
+
+    /**
+     * Field _alignmentSequenceAnnotationList
+     */
+    private java.util.Vector _alignmentSequenceAnnotationList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public AlignmentSequence() 
+     {
+        super();
+        _alignmentSequenceAnnotationList = new Vector();
+    } //-- org.vamsas.objects.core.AlignmentSequence()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param vAlignmentSequenceAnnotation
+     */
+    public void addAlignmentSequenceAnnotation(org.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentSequenceAnnotationList.addElement(vAlignmentSequenceAnnotation);
+    } //-- void addAlignmentSequenceAnnotation(org.vamsas.objects.core.AlignmentSequenceAnnotation) 
+
+    /**
+     * Method addAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentSequenceAnnotation
+     */
+    public void addAlignmentSequenceAnnotation(int index, org.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentSequenceAnnotationList.insertElementAt(vAlignmentSequenceAnnotation, index);
+    } //-- void addAlignmentSequenceAnnotation(int, org.vamsas.objects.core.AlignmentSequenceAnnotation) 
+
+    /**
+     * Method enumerateAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignmentSequenceAnnotation()
+    {
+        return _alignmentSequenceAnnotationList.elements();
+    } //-- java.util.Enumeration enumerateAlignmentSequenceAnnotation() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof AlignmentSequence) {
+        
+            AlignmentSequence temp = (AlignmentSequence)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._refid != null) {
+                if (temp._refid == null) return false;
+                else if (!(this._refid.equals(temp._refid))) 
+                    return false;
+            }
+            else if (temp._refid != null)
+                return false;
+            if (this._alignmentSequenceAnnotationList != null) {
+                if (temp._alignmentSequenceAnnotationList == null) return false;
+                else if (!(this._alignmentSequenceAnnotationList.equals(temp._alignmentSequenceAnnotationList))) 
+                    return false;
+            }
+            else if (temp._alignmentSequenceAnnotationList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentSequenceAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("getAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index);
+    } //-- org.vamsas.objects.core.AlignmentSequenceAnnotation getAlignmentSequenceAnnotation(int) 
+
+    /**
+     * Method getAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @return AlignmentSequenceAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation()
+    {
+        int size = _alignmentSequenceAnnotationList.size();
+        org.vamsas.objects.core.AlignmentSequenceAnnotation[] mArray = new org.vamsas.objects.core.AlignmentSequenceAnnotation[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.AlignmentSequenceAnnotation) _alignmentSequenceAnnotationList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.AlignmentSequenceAnnotation[] getAlignmentSequenceAnnotation() 
+
+    /**
+     * Method getAlignmentSequenceAnnotationCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentSequenceAnnotationCount()
+    {
+        return _alignmentSequenceAnnotationList.size();
+    } //-- int getAlignmentSequenceAnnotationCount() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     *  referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'refid'. The field 'refid' has
+     * the following description: Dataset Sequence from which
+     *  this alignment sequence is taken from
+     *  
+     * 
+     * @return Object
+     * @return the value of field 'refid'.
+     */
+    public java.lang.Object getRefid()
+    {
+        return this._refid;
+    } //-- java.lang.Object getRefid() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @return AlignmentSequenceAnnotation
+     */
+    public org.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int index)
+    {
+        java.lang.Object obj = _alignmentSequenceAnnotationList.elementAt(index);
+        _alignmentSequenceAnnotationList.removeElementAt(index);
+        return (org.vamsas.objects.core.AlignmentSequenceAnnotation) obj;
+    } //-- org.vamsas.objects.core.AlignmentSequenceAnnotation removeAlignmentSequenceAnnotation(int) 
+
+    /**
+     * Method removeAllAlignmentSequenceAnnotation
+     * 
+     */
+    public void removeAllAlignmentSequenceAnnotation()
+    {
+        _alignmentSequenceAnnotationList.removeAllElements();
+    } //-- void removeAllAlignmentSequenceAnnotation() 
+
+    /**
+     * Method setAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignmentSequenceAnnotation
+     */
+    public void setAlignmentSequenceAnnotation(int index, org.vamsas.objects.core.AlignmentSequenceAnnotation vAlignmentSequenceAnnotation)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentSequenceAnnotationList.size())) {
+            throw new IndexOutOfBoundsException("setAlignmentSequenceAnnotation: Index value '"+index+"' not in range [0.."+_alignmentSequenceAnnotationList.size()+ "]");
+        }
+        _alignmentSequenceAnnotationList.setElementAt(vAlignmentSequenceAnnotation, index);
+    } //-- void setAlignmentSequenceAnnotation(int, org.vamsas.objects.core.AlignmentSequenceAnnotation) 
+
+    /**
+     * Method setAlignmentSequenceAnnotation
+     * 
+     * 
+     * 
+     * @param alignmentSequenceAnnotationArray
+     */
+    public void setAlignmentSequenceAnnotation(org.vamsas.objects.core.AlignmentSequenceAnnotation[] alignmentSequenceAnnotationArray)
+    {
+        //-- copy array
+        _alignmentSequenceAnnotationList.removeAllElements();
+        for (int i = 0; i < alignmentSequenceAnnotationArray.length; i++) {
+            _alignmentSequenceAnnotationList.addElement(alignmentSequenceAnnotationArray[i]);
+        }
+    } //-- void setAlignmentSequenceAnnotation(org.vamsas.objects.core.AlignmentSequenceAnnotation) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     *  referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'refid'. The field 'refid' has the
+     * following description: Dataset Sequence from which
+     *  this alignment sequence is taken from
+     *  
+     * 
+     * @param refid the value of field 'refid'.
+     */
+    public void setRefid(java.lang.Object refid)
+    {
+        this._refid = refid;
+    } //-- void setRefid(java.lang.Object) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return SequenceType
+     */
+    public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.AlignmentSequence) Unmarshaller.unmarshal(org.vamsas.objects.core.AlignmentSequence.class, reader);
+    } //-- org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/AlignmentSequenceAnnotation.java b/src/org/vamsas/objects/core/AlignmentSequenceAnnotation.java
new file mode 100644 (file)
index 0000000..0f229af
--- /dev/null
@@ -0,0 +1,256 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class AlignmentSequenceAnnotation.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AlignmentSequenceAnnotation extends org.vamsas.objects.core.RangeAnnotation \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * TODO:\r
+     *  decide if this flag is\r
+     *  redundant - when true it\r
+     *  would suggest that the\r
+     *  annotationElement values\r
+     *  together form a graph\r
+     *  \r
+     */\r
+    private boolean _graph;\r
+\r
+    /**\r
+     * keeps track of state for field: _graph\r
+     */\r
+    private boolean _has_graph;\r
+\r
+    /**\r
+     * Field _provenance\r
+     */\r
+    private org.vamsas.objects.core.Provenance _provenance;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AlignmentSequenceAnnotation() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.AlignmentSequenceAnnotation()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteGraph\r
+     * \r
+     */\r
+    public void deleteGraph()\r
+    {\r
+        this._has_graph= false;\r
+    } //-- void deleteGraph() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof AlignmentSequenceAnnotation) {\r
+        \r
+            AlignmentSequenceAnnotation temp = (AlignmentSequenceAnnotation)obj;\r
+            if (this._graph != temp._graph)\r
+                return false;\r
+            if (this._has_graph != temp._has_graph)\r
+                return false;\r
+            if (this._provenance != null) {\r
+                if (temp._provenance == null) return false;\r
+                else if (!(this._provenance.equals(temp._provenance))) \r
+                    return false;\r
+            }\r
+            else if (temp._provenance != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'graph'. The field 'graph' has\r
+     * the following description: TODO:\r
+     *  decide if this flag is\r
+     *  redundant - when true it\r
+     *  would suggest that the\r
+     *  annotationElement values\r
+     *  together form a graph\r
+     *  \r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'graph'.\r
+     */\r
+    public boolean getGraph()\r
+    {\r
+        return this._graph;\r
+    } //-- boolean getGraph() \r
+\r
+    /**\r
+     * Returns the value of field 'provenance'.\r
+     * \r
+     * @return Provenance\r
+     * @return the value of field 'provenance'.\r
+     */\r
+    public org.vamsas.objects.core.Provenance getProvenance()\r
+    {\r
+        return this._provenance;\r
+    } //-- org.vamsas.objects.core.Provenance getProvenance() \r
+\r
+    /**\r
+     * Method hasGraph\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraph()\r
+    {\r
+        return this._has_graph;\r
+    } //-- boolean hasGraph() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'graph'. The field 'graph' has the\r
+     * following description: TODO:\r
+     *  decide if this flag is\r
+     *  redundant - when true it\r
+     *  would suggest that the\r
+     *  annotationElement values\r
+     *  together form a graph\r
+     *  \r
+     * \r
+     * @param graph the value of field 'graph'.\r
+     */\r
+    public void setGraph(boolean graph)\r
+    {\r
+        this._graph = graph;\r
+        this._has_graph = true;\r
+    } //-- void setGraph(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'provenance'.\r
+     * \r
+     * @param provenance the value of field 'provenance'.\r
+     */\r
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)\r
+    {\r
+        this._provenance = provenance;\r
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return RangeType\r
+     */\r
+    public static org.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.AlignmentSequenceAnnotation) Unmarshaller.unmarshal(org.vamsas.objects.core.AlignmentSequenceAnnotation.class, reader);\r
+    } //-- org.vamsas.objects.core.RangeType unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AlignmentSequenceAnnotationDescriptor.java b/src/org/vamsas/objects/core/AlignmentSequenceAnnotationDescriptor.java
new file mode 100644 (file)
index 0000000..a4aa126
--- /dev/null
@@ -0,0 +1,255 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AlignmentSequenceAnnotationDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AlignmentSequenceAnnotationDescriptor extends org.vamsas.objects.core.RangeAnnotationDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AlignmentSequenceAnnotationDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.RangeAnnotationDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "AlignmentSequenceAnnotation";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _graph\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+                if(!target.hasGraph())\r
+                    return null;\r
+                return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setGraph( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graph\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _provenance\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+                return target.getProvenance();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AlignmentSequenceAnnotation target = (AlignmentSequenceAnnotation) object;\r
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.Provenance();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _provenance\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- org.vamsas.objects.core.AlignmentSequenceAnnotationDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.AlignmentSequenceAnnotation.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AlignmentSequenceDescriptor.java b/src/org/vamsas/objects/core/AlignmentSequenceDescriptor.java
new file mode 100644 (file)
index 0000000..afbe5cd
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class AlignmentSequenceDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class AlignmentSequenceDescriptor extends org.vamsas.objects.core.SequenceTypeDescriptor {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public AlignmentSequenceDescriptor() 
+     {
+        super();
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.SequenceTypeDescriptor());
+        nsURI = "http://www.vamsas.org";
+        xmlName = "alignmentSequence";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AlignmentSequence target = (AlignmentSequence) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AlignmentSequence target = (AlignmentSequence) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _refid
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_refid", "refid", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setReference(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AlignmentSequence target = (AlignmentSequence) object;
+                return target.getRefid();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AlignmentSequence target = (AlignmentSequence) object;
+                    target.setRefid( (java.lang.Object) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.Object();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _refid
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _alignmentSequenceAnnotationList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.AlignmentSequenceAnnotation.class, "_alignmentSequenceAnnotationList", "AlignmentSequenceAnnotation", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AlignmentSequence target = (AlignmentSequence) object;
+                return target.getAlignmentSequenceAnnotation();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AlignmentSequence target = (AlignmentSequence) object;
+                    target.addAlignmentSequenceAnnotation( (org.vamsas.objects.core.AlignmentSequenceAnnotation) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.AlignmentSequenceAnnotation();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _alignmentSequenceAnnotationList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.AlignmentSequenceDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return super.getExtends();
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        if (identity == null)
+            return super.getIdentity();
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.AlignmentSequence.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/AnnotationElement.java b/src/org/vamsas/objects/core/AnnotationElement.java
new file mode 100644 (file)
index 0000000..b2ed9c5
--- /dev/null
@@ -0,0 +1,673 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class AnnotationElement.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class AnnotationElement extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * position with respect to the coordinate frame defined by a
+     *  rangeType specification 
+     */
+    private int _position;
+
+    /**
+     * keeps track of state for field: _position
+     */
+    private boolean _has_position;
+
+    /**
+     * true means the annotation element appears between the
+     *  specified position and the next 
+     */
+    private boolean _after = false;
+
+    /**
+     * keeps track of state for field: _after
+     */
+    private boolean _has_after;
+
+    /**
+     * Primary Key for vamsas object referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * Free text at this position 
+     */
+    private java.lang.String _description;
+
+    /**
+     * Discrete symbol - possibly graphically represented
+     *  
+     */
+    private java.util.Vector _glyphList;
+
+    /**
+     * Ordered set of float values - an application may treat
+     *  the values together as a vector with common support for a
+     * set of
+     *  annotation elements - but this is, again, not validated so
+     * applications
+     *  should deal gracefully with varying numbers of dimensions
+     *  
+     */
+    private java.util.Vector _valueList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public AnnotationElement() 
+     {
+        super();
+        _glyphList = new Vector();
+        _valueList = new Vector();
+    } //-- org.vamsas.objects.core.AnnotationElement()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addGlyph
+     * 
+     * 
+     * 
+     * @param vGlyph
+     */
+    public void addGlyph(org.vamsas.objects.core.Glyph vGlyph)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _glyphList.addElement(vGlyph);
+    } //-- void addGlyph(org.vamsas.objects.core.Glyph) 
+
+    /**
+     * Method addGlyph
+     * 
+     * 
+     * 
+     * @param index
+     * @param vGlyph
+     */
+    public void addGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _glyphList.insertElementAt(vGlyph, index);
+    } //-- void addGlyph(int, org.vamsas.objects.core.Glyph) 
+
+    /**
+     * Method addValue
+     * 
+     * 
+     * 
+     * @param vValue
+     */
+    public void addValue(float vValue)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _valueList.addElement(new java.lang.Float(vValue));
+    } //-- void addValue(float) 
+
+    /**
+     * Method addValue
+     * 
+     * 
+     * 
+     * @param index
+     * @param vValue
+     */
+    public void addValue(int index, float vValue)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _valueList.insertElementAt(new java.lang.Float(vValue), index);
+    } //-- void addValue(int, float) 
+
+    /**
+     * Method deleteAfter
+     * 
+     */
+    public void deleteAfter()
+    {
+        this._has_after= false;
+    } //-- void deleteAfter() 
+
+    /**
+     * Method deletePosition
+     * 
+     */
+    public void deletePosition()
+    {
+        this._has_position= false;
+    } //-- void deletePosition() 
+
+    /**
+     * Method enumerateGlyph
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateGlyph()
+    {
+        return _glyphList.elements();
+    } //-- java.util.Enumeration enumerateGlyph() 
+
+    /**
+     * Method enumerateValue
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateValue()
+    {
+        return _valueList.elements();
+    } //-- java.util.Enumeration enumerateValue() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof AnnotationElement) {
+        
+            AnnotationElement temp = (AnnotationElement)obj;
+            if (this._position != temp._position)
+                return false;
+            if (this._has_position != temp._has_position)
+                return false;
+            if (this._after != temp._after)
+                return false;
+            if (this._has_after != temp._has_after)
+                return false;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._description != null) {
+                if (temp._description == null) return false;
+                else if (!(this._description.equals(temp._description))) 
+                    return false;
+            }
+            else if (temp._description != null)
+                return false;
+            if (this._glyphList != null) {
+                if (temp._glyphList == null) return false;
+                else if (!(this._glyphList.equals(temp._glyphList))) 
+                    return false;
+            }
+            else if (temp._glyphList != null)
+                return false;
+            if (this._valueList != null) {
+                if (temp._valueList == null) return false;
+                else if (!(this._valueList.equals(temp._valueList))) 
+                    return false;
+            }
+            else if (temp._valueList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'after'. The field 'after' has
+     * the following description: true means the annotation element
+     * appears between the
+     *  specified position and the next 
+     * 
+     * @return boolean
+     * @return the value of field 'after'.
+     */
+    public boolean getAfter()
+    {
+        return this._after;
+    } //-- boolean getAfter() 
+
+    /**
+     * Returns the value of field 'description'. The field
+     * 'description' has the following description: Free text at
+     * this position 
+     * 
+     * @return String
+     * @return the value of field 'description'.
+     */
+    public java.lang.String getDescription()
+    {
+        return this._description;
+    } //-- java.lang.String getDescription() 
+
+    /**
+     * Method getGlyph
+     * 
+     * 
+     * 
+     * @param index
+     * @return Glyph
+     */
+    public org.vamsas.objects.core.Glyph getGlyph(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _glyphList.size())) {
+            throw new IndexOutOfBoundsException("getGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
+    } //-- org.vamsas.objects.core.Glyph getGlyph(int) 
+
+    /**
+     * Method getGlyph
+     * 
+     * 
+     * 
+     * @return Glyph
+     */
+    public org.vamsas.objects.core.Glyph[] getGlyph()
+    {
+        int size = _glyphList.size();
+        org.vamsas.objects.core.Glyph[] mArray = new org.vamsas.objects.core.Glyph[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Glyph[] getGlyph() 
+
+    /**
+     * Method getGlyphCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getGlyphCount()
+    {
+        return _glyphList.size();
+    } //-- int getGlyphCount() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'position'. The field 'position'
+     * has the following description: position with respect to the
+     * coordinate frame defined by a
+     *  rangeType specification 
+     * 
+     * @return int
+     * @return the value of field 'position'.
+     */
+    public int getPosition()
+    {
+        return this._position;
+    } //-- int getPosition() 
+
+    /**
+     * Method getValue
+     * 
+     * 
+     * 
+     * @param index
+     * @return float
+     */
+    public float getValue(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _valueList.size())) {
+            throw new IndexOutOfBoundsException("getValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
+        }
+        
+        return ((java.lang.Float)_valueList.elementAt(index)).floatValue();
+    } //-- float getValue(int) 
+
+    /**
+     * Method getValue
+     * 
+     * 
+     * 
+     * @return float
+     */
+    public float[] getValue()
+    {
+        int size = _valueList.size();
+        float[] mArray = new float[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = ((java.lang.Float)_valueList.elementAt(index)).floatValue();
+        }
+        return mArray;
+    } //-- float[] getValue() 
+
+    /**
+     * Method getValueCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getValueCount()
+    {
+        return _valueList.size();
+    } //-- int getValueCount() 
+
+    /**
+     * Method hasAfter
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasAfter()
+    {
+        return this._has_after;
+    } //-- boolean hasAfter() 
+
+    /**
+     * Method hasPosition
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasPosition()
+    {
+        return this._has_position;
+    } //-- boolean hasPosition() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllGlyph
+     * 
+     */
+    public void removeAllGlyph()
+    {
+        _glyphList.removeAllElements();
+    } //-- void removeAllGlyph() 
+
+    /**
+     * Method removeAllValue
+     * 
+     */
+    public void removeAllValue()
+    {
+        _valueList.removeAllElements();
+    } //-- void removeAllValue() 
+
+    /**
+     * Method removeGlyph
+     * 
+     * 
+     * 
+     * @param index
+     * @return Glyph
+     */
+    public org.vamsas.objects.core.Glyph removeGlyph(int index)
+    {
+        java.lang.Object obj = _glyphList.elementAt(index);
+        _glyphList.removeElementAt(index);
+        return (org.vamsas.objects.core.Glyph) obj;
+    } //-- org.vamsas.objects.core.Glyph removeGlyph(int) 
+
+    /**
+     * Method removeValue
+     * 
+     * 
+     * 
+     * @param index
+     * @return float
+     */
+    public float removeValue(int index)
+    {
+        java.lang.Object obj = _valueList.elementAt(index);
+        _valueList.removeElementAt(index);
+        return ((java.lang.Float)obj).floatValue();
+    } //-- float removeValue(int) 
+
+    /**
+     * Sets the value of field 'after'. The field 'after' has the
+     * following description: true means the annotation element
+     * appears between the
+     *  specified position and the next 
+     * 
+     * @param after the value of field 'after'.
+     */
+    public void setAfter(boolean after)
+    {
+        this._after = after;
+        this._has_after = true;
+    } //-- void setAfter(boolean) 
+
+    /**
+     * Sets the value of field 'description'. The field
+     * 'description' has the following description: Free text at
+     * this position 
+     * 
+     * @param description the value of field 'description'.
+     */
+    public void setDescription(java.lang.String description)
+    {
+        this._description = description;
+    } //-- void setDescription(java.lang.String) 
+
+    /**
+     * Method setGlyph
+     * 
+     * 
+     * 
+     * @param index
+     * @param vGlyph
+     */
+    public void setGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _glyphList.size())) {
+            throw new IndexOutOfBoundsException("setGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
+        }
+        _glyphList.setElementAt(vGlyph, index);
+    } //-- void setGlyph(int, org.vamsas.objects.core.Glyph) 
+
+    /**
+     * Method setGlyph
+     * 
+     * 
+     * 
+     * @param glyphArray
+     */
+    public void setGlyph(org.vamsas.objects.core.Glyph[] glyphArray)
+    {
+        //-- copy array
+        _glyphList.removeAllElements();
+        for (int i = 0; i < glyphArray.length; i++) {
+            _glyphList.addElement(glyphArray[i]);
+        }
+    } //-- void setGlyph(org.vamsas.objects.core.Glyph) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'position'. The field 'position' has
+     * the following description: position with respect to the
+     * coordinate frame defined by a
+     *  rangeType specification 
+     * 
+     * @param position the value of field 'position'.
+     */
+    public void setPosition(int position)
+    {
+        this._position = position;
+        this._has_position = true;
+    } //-- void setPosition(int) 
+
+    /**
+     * Method setValue
+     * 
+     * 
+     * 
+     * @param index
+     * @param vValue
+     */
+    public void setValue(int index, float vValue)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _valueList.size())) {
+            throw new IndexOutOfBoundsException("setValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
+        }
+        _valueList.setElementAt(new java.lang.Float(vValue), index);
+    } //-- void setValue(int, float) 
+
+    /**
+     * Method setValue
+     * 
+     * 
+     * 
+     * @param valueArray
+     */
+    public void setValue(float[] valueArray)
+    {
+        //-- copy array
+        _valueList.removeAllElements();
+        for (int i = 0; i < valueArray.length; i++) {
+            _valueList.addElement(new java.lang.Float(valueArray[i]));
+        }
+    } //-- void setValue(float) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return AnnotationElement
+     */
+    public static org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.AnnotationElement) Unmarshaller.unmarshal(org.vamsas.objects.core.AnnotationElement.class, reader);
+    } //-- org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/AnnotationElementDescriptor.java b/src/org/vamsas/objects/core/AnnotationElementDescriptor.java
new file mode 100644 (file)
index 0000000..cc7bb65
--- /dev/null
@@ -0,0 +1,405 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class AnnotationElementDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public AnnotationElementDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "annotationElement";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _position
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_position", "position", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                if(!target.hasPosition())
+                    return null;
+                return new java.lang.Integer(target.getPosition());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    // ignore null values for non optional primitives
+                    if (value == null) return;
+                    
+                    target.setPosition( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _position
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            IntegerValidator typeValidator = new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _after
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_after", "after", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                if(!target.hasAfter())
+                    return null;
+                return (target.getAfter() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteAfter();
+                        return;
+                    }
+                    target.setAfter( ((java.lang.Boolean)value).booleanValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _after
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            BooleanValidator typeValidator = new BooleanValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _description
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                return target.getDescription();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    target.setDescription( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _description
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _glyphList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Glyph.class, "_glyphList", "glyph", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                return target.getGlyph();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    target.addGlyph( (org.vamsas.objects.core.Glyph) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Glyph();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _glyphList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _valueList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_valueList", "value", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                AnnotationElement target = (AnnotationElement) object;
+                return target.getValue();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    AnnotationElement target = (AnnotationElement) object;
+                    // ignore null values for non optional primitives
+                    if (value == null) return;
+                    
+                    target.addValue( ((java.lang.Float)value).floatValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _valueList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+            FloatValidator typeValidator = new FloatValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.AnnotationElementDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.AnnotationElement.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/AppData.java b/src/org/vamsas/objects/core/AppData.java
new file mode 100644 (file)
index 0000000..168bc6b
--- /dev/null
@@ -0,0 +1,239 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class AppData.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AppData extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Internal choice value storage\r
+     */\r
+    private java.lang.Object _choiceValue;\r
+\r
+    /**\r
+     * Field _data\r
+     */\r
+    private byte[] _data;\r
+\r
+    /**\r
+     * Field _dataReference\r
+     */\r
+    private java.lang.String _dataReference;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AppData() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.AppData()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof AppData) {\r
+        \r
+            AppData temp = (AppData)obj;\r
+            if (this._choiceValue != null) {\r
+                if (temp._choiceValue == null) return false;\r
+                else if (!(this._choiceValue.equals(temp._choiceValue))) \r
+                    return false;\r
+            }\r
+            else if (temp._choiceValue != null)\r
+                return false;\r
+            if (this._data != null) {\r
+                if (temp._data == null) return false;\r
+                else if (!(this._data.equals(temp._data))) \r
+                    return false;\r
+            }\r
+            else if (temp._data != null)\r
+                return false;\r
+            if (this._dataReference != null) {\r
+                if (temp._dataReference == null) return false;\r
+                else if (!(this._dataReference.equals(temp._dataReference))) \r
+                    return false;\r
+            }\r
+            else if (temp._dataReference != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'choiceValue'. The field\r
+     * 'choiceValue' has the following description: Internal choice\r
+     * value storage\r
+     * \r
+     * @return Object\r
+     * @return the value of field 'choiceValue'.\r
+     */\r
+    public java.lang.Object getChoiceValue()\r
+    {\r
+        return this._choiceValue;\r
+    } //-- java.lang.Object getChoiceValue() \r
+\r
+    /**\r
+     * Returns the value of field 'data'.\r
+     * \r
+     * @return byte\r
+     * @return the value of field 'data'.\r
+     */\r
+    public byte[] getData()\r
+    {\r
+        return this._data;\r
+    } //-- byte[] getData() \r
+\r
+    /**\r
+     * Returns the value of field 'dataReference'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'dataReference'.\r
+     */\r
+    public java.lang.String getDataReference()\r
+    {\r
+        return this._dataReference;\r
+    } //-- java.lang.String getDataReference() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'data'.\r
+     * \r
+     * @param data the value of field 'data'.\r
+     */\r
+    public void setData(byte[] data)\r
+    {\r
+        this._data = data;\r
+        this._choiceValue = data;\r
+    } //-- void setData(byte) \r
+\r
+    /**\r
+     * Sets the value of field 'dataReference'.\r
+     * \r
+     * @param dataReference the value of field 'dataReference'.\r
+     */\r
+    public void setDataReference(java.lang.String dataReference)\r
+    {\r
+        this._dataReference = dataReference;\r
+        this._choiceValue = dataReference;\r
+    } //-- void setDataReference(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return AppData\r
+     */\r
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.AppData) Unmarshaller.unmarshal(org.vamsas.objects.core.AppData.class, reader);\r
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AppDataDescriptor.java b/src/org/vamsas/objects/core/AppDataDescriptor.java
new file mode 100644 (file)
index 0000000..d0eeab9
--- /dev/null
@@ -0,0 +1,250 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AppDataDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AppDataDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AppDataDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "appData";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsChoice();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _data\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(byte[].class, "_data", "data", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AppData target = (AppData) object;\r
+                return target.getData();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AppData target = (AppData) object;\r
+                    target.setData( (byte[]) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _data\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _dataReference\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dataReference", "dataReference", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AppData target = (AppData) object;\r
+                return target.getDataReference();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AppData target = (AppData) object;\r
+                    target.setDataReference( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _dataReference\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- org.vamsas.objects.core.AppDataDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.AppData.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/ApplicationData.java b/src/org/vamsas/objects/core/ApplicationData.java
new file mode 100644 (file)
index 0000000..76f44be
--- /dev/null
@@ -0,0 +1,572 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class ApplicationData.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class ApplicationData extends org.vamsas.objects.core.AppData 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Version string describing the application specific
+     *  data storage version used
+     */
+    private java.lang.String _version;
+
+    /**
+     * Canonical name of application 
+     */
+    private java.lang.String _name;
+
+    /**
+     * Field _userList
+     */
+    private java.util.Vector _userList;
+
+    /**
+     * Field _common
+     */
+    private org.vamsas.objects.core.Common _common;
+
+    /**
+     * Field _instanceList
+     */
+    private java.util.Vector _instanceList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public ApplicationData() 
+     {
+        super();
+        _userList = new Vector();
+        _instanceList = new Vector();
+    } //-- org.vamsas.objects.core.ApplicationData()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addInstance
+     * 
+     * 
+     * 
+     * @param vInstance
+     */
+    public void addInstance(org.vamsas.objects.core.Instance vInstance)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _instanceList.addElement(vInstance);
+    } //-- void addInstance(org.vamsas.objects.core.Instance) 
+
+    /**
+     * Method addInstance
+     * 
+     * 
+     * 
+     * @param index
+     * @param vInstance
+     */
+    public void addInstance(int index, org.vamsas.objects.core.Instance vInstance)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _instanceList.insertElementAt(vInstance, index);
+    } //-- void addInstance(int, org.vamsas.objects.core.Instance) 
+
+    /**
+     * Method addUser
+     * 
+     * 
+     * 
+     * @param vUser
+     */
+    public void addUser(org.vamsas.objects.core.User vUser)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _userList.addElement(vUser);
+    } //-- void addUser(org.vamsas.objects.core.User) 
+
+    /**
+     * Method addUser
+     * 
+     * 
+     * 
+     * @param index
+     * @param vUser
+     */
+    public void addUser(int index, org.vamsas.objects.core.User vUser)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _userList.insertElementAt(vUser, index);
+    } //-- void addUser(int, org.vamsas.objects.core.User) 
+
+    /**
+     * Method enumerateInstance
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateInstance()
+    {
+        return _instanceList.elements();
+    } //-- java.util.Enumeration enumerateInstance() 
+
+    /**
+     * Method enumerateUser
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateUser()
+    {
+        return _userList.elements();
+    } //-- java.util.Enumeration enumerateUser() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof ApplicationData) {
+        
+            ApplicationData temp = (ApplicationData)obj;
+            if (this._version != null) {
+                if (temp._version == null) return false;
+                else if (!(this._version.equals(temp._version))) 
+                    return false;
+            }
+            else if (temp._version != null)
+                return false;
+            if (this._name != null) {
+                if (temp._name == null) return false;
+                else if (!(this._name.equals(temp._name))) 
+                    return false;
+            }
+            else if (temp._name != null)
+                return false;
+            if (this._userList != null) {
+                if (temp._userList == null) return false;
+                else if (!(this._userList.equals(temp._userList))) 
+                    return false;
+            }
+            else if (temp._userList != null)
+                return false;
+            if (this._common != null) {
+                if (temp._common == null) return false;
+                else if (!(this._common.equals(temp._common))) 
+                    return false;
+            }
+            else if (temp._common != null)
+                return false;
+            if (this._instanceList != null) {
+                if (temp._instanceList == null) return false;
+                else if (!(this._instanceList.equals(temp._instanceList))) 
+                    return false;
+            }
+            else if (temp._instanceList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'common'.
+     * 
+     * @return Common
+     * @return the value of field 'common'.
+     */
+    public org.vamsas.objects.core.Common getCommon()
+    {
+        return this._common;
+    } //-- org.vamsas.objects.core.Common getCommon() 
+
+    /**
+     * Method getInstance
+     * 
+     * 
+     * 
+     * @param index
+     * @return Instance
+     */
+    public org.vamsas.objects.core.Instance getInstance(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _instanceList.size())) {
+            throw new IndexOutOfBoundsException("getInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Instance) _instanceList.elementAt(index);
+    } //-- org.vamsas.objects.core.Instance getInstance(int) 
+
+    /**
+     * Method getInstance
+     * 
+     * 
+     * 
+     * @return Instance
+     */
+    public org.vamsas.objects.core.Instance[] getInstance()
+    {
+        int size = _instanceList.size();
+        org.vamsas.objects.core.Instance[] mArray = new org.vamsas.objects.core.Instance[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Instance) _instanceList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Instance[] getInstance() 
+
+    /**
+     * Method getInstanceCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getInstanceCount()
+    {
+        return _instanceList.size();
+    } //-- int getInstanceCount() 
+
+    /**
+     * Returns the value of field 'name'. The field 'name' has the
+     * following description: Canonical name of application 
+     * 
+     * @return String
+     * @return the value of field 'name'.
+     */
+    public java.lang.String getName()
+    {
+        return this._name;
+    } //-- java.lang.String getName() 
+
+    /**
+     * Method getUser
+     * 
+     * 
+     * 
+     * @param index
+     * @return User
+     */
+    public org.vamsas.objects.core.User getUser(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _userList.size())) {
+            throw new IndexOutOfBoundsException("getUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.User) _userList.elementAt(index);
+    } //-- org.vamsas.objects.core.User getUser(int) 
+
+    /**
+     * Method getUser
+     * 
+     * 
+     * 
+     * @return User
+     */
+    public org.vamsas.objects.core.User[] getUser()
+    {
+        int size = _userList.size();
+        org.vamsas.objects.core.User[] mArray = new org.vamsas.objects.core.User[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.User) _userList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.User[] getUser() 
+
+    /**
+     * Method getUserCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getUserCount()
+    {
+        return _userList.size();
+    } //-- int getUserCount() 
+
+    /**
+     * Returns the value of field 'version'. The field 'version'
+     * has the following description: Version string describing the
+     * application specific
+     *  data storage version used
+     * 
+     * @return String
+     * @return the value of field 'version'.
+     */
+    public java.lang.String getVersion()
+    {
+        return this._version;
+    } //-- java.lang.String getVersion() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllInstance
+     * 
+     */
+    public void removeAllInstance()
+    {
+        _instanceList.removeAllElements();
+    } //-- void removeAllInstance() 
+
+    /**
+     * Method removeAllUser
+     * 
+     */
+    public void removeAllUser()
+    {
+        _userList.removeAllElements();
+    } //-- void removeAllUser() 
+
+    /**
+     * Method removeInstance
+     * 
+     * 
+     * 
+     * @param index
+     * @return Instance
+     */
+    public org.vamsas.objects.core.Instance removeInstance(int index)
+    {
+        java.lang.Object obj = _instanceList.elementAt(index);
+        _instanceList.removeElementAt(index);
+        return (org.vamsas.objects.core.Instance) obj;
+    } //-- org.vamsas.objects.core.Instance removeInstance(int) 
+
+    /**
+     * Method removeUser
+     * 
+     * 
+     * 
+     * @param index
+     * @return User
+     */
+    public org.vamsas.objects.core.User removeUser(int index)
+    {
+        java.lang.Object obj = _userList.elementAt(index);
+        _userList.removeElementAt(index);
+        return (org.vamsas.objects.core.User) obj;
+    } //-- org.vamsas.objects.core.User removeUser(int) 
+
+    /**
+     * Sets the value of field 'common'.
+     * 
+     * @param common the value of field 'common'.
+     */
+    public void setCommon(org.vamsas.objects.core.Common common)
+    {
+        this._common = common;
+    } //-- void setCommon(org.vamsas.objects.core.Common) 
+
+    /**
+     * Method setInstance
+     * 
+     * 
+     * 
+     * @param index
+     * @param vInstance
+     */
+    public void setInstance(int index, org.vamsas.objects.core.Instance vInstance)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _instanceList.size())) {
+            throw new IndexOutOfBoundsException("setInstance: Index value '"+index+"' not in range [0.."+_instanceList.size()+ "]");
+        }
+        _instanceList.setElementAt(vInstance, index);
+    } //-- void setInstance(int, org.vamsas.objects.core.Instance) 
+
+    /**
+     * Method setInstance
+     * 
+     * 
+     * 
+     * @param instanceArray
+     */
+    public void setInstance(org.vamsas.objects.core.Instance[] instanceArray)
+    {
+        //-- copy array
+        _instanceList.removeAllElements();
+        for (int i = 0; i < instanceArray.length; i++) {
+            _instanceList.addElement(instanceArray[i]);
+        }
+    } //-- void setInstance(org.vamsas.objects.core.Instance) 
+
+    /**
+     * Sets the value of field 'name'. The field 'name' has the
+     * following description: Canonical name of application 
+     * 
+     * @param name the value of field 'name'.
+     */
+    public void setName(java.lang.String name)
+    {
+        this._name = name;
+    } //-- void setName(java.lang.String) 
+
+    /**
+     * Method setUser
+     * 
+     * 
+     * 
+     * @param index
+     * @param vUser
+     */
+    public void setUser(int index, org.vamsas.objects.core.User vUser)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _userList.size())) {
+            throw new IndexOutOfBoundsException("setUser: Index value '"+index+"' not in range [0.."+_userList.size()+ "]");
+        }
+        _userList.setElementAt(vUser, index);
+    } //-- void setUser(int, org.vamsas.objects.core.User) 
+
+    /**
+     * Method setUser
+     * 
+     * 
+     * 
+     * @param userArray
+     */
+    public void setUser(org.vamsas.objects.core.User[] userArray)
+    {
+        //-- copy array
+        _userList.removeAllElements();
+        for (int i = 0; i < userArray.length; i++) {
+            _userList.addElement(userArray[i]);
+        }
+    } //-- void setUser(org.vamsas.objects.core.User) 
+
+    /**
+     * Sets the value of field 'version'. The field 'version' has
+     * the following description: Version string describing the
+     * application specific
+     *  data storage version used
+     * 
+     * @param version the value of field 'version'.
+     */
+    public void setVersion(java.lang.String version)
+    {
+        this._version = version;
+    } //-- void setVersion(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return AppData
+     */
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.ApplicationData) Unmarshaller.unmarshal(org.vamsas.objects.core.ApplicationData.class, reader);
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/ApplicationDataDescriptor.java b/src/org/vamsas/objects/core/ApplicationDataDescriptor.java
new file mode 100644 (file)
index 0000000..894e945
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class ApplicationDataDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class ApplicationDataDescriptor extends org.vamsas.objects.core.AppDataDescriptor {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public ApplicationDataDescriptor() 
+     {
+        super();
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.AppDataDescriptor());
+        nsURI = "http://www.vamsas.org";
+        xmlName = "ApplicationData";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _version
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                ApplicationData target = (ApplicationData) object;
+                return target.getVersion();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    ApplicationData target = (ApplicationData) object;
+                    target.setVersion( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _version
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _name
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                ApplicationData target = (ApplicationData) object;
+                return target.getName();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    ApplicationData target = (ApplicationData) object;
+                    target.setName( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _name
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _userList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.User.class, "_userList", "User", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                ApplicationData target = (ApplicationData) object;
+                return target.getUser();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    ApplicationData target = (ApplicationData) object;
+                    target.addUser( (org.vamsas.objects.core.User) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.User();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _userList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _common
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Common.class, "_common", "Common", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                ApplicationData target = (ApplicationData) object;
+                return target.getCommon();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    ApplicationData target = (ApplicationData) object;
+                    target.setCommon( (org.vamsas.objects.core.Common) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Common();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _common
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _instanceList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Instance.class, "_instanceList", "Instance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                ApplicationData target = (ApplicationData) object;
+                return target.getInstance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    ApplicationData target = (ApplicationData) object;
+                    target.addInstance( (org.vamsas.objects.core.Instance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Instance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _instanceList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.ApplicationDataDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return super.getExtends();
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        if (identity == null)
+            return super.getIdentity();
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.ApplicationData.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Attachment.java b/src/org/vamsas/objects/core/Attachment.java
new file mode 100644 (file)
index 0000000..9bf14c2
--- /dev/null
@@ -0,0 +1,330 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Attachment.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Attachment extends org.vamsas.objects.core.AppData \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * true implies data will be decompresses with Zip\r
+     *  before presenting to application \r
+     */\r
+    private boolean _compressed = false;\r
+\r
+    /**\r
+     * keeps track of state for field: _compressed\r
+     */\r
+    private boolean _has_compressed;\r
+\r
+    /**\r
+     * Type of arbitrary data - TODO: decide format - use\r
+     *  (extended) MIME types ? \r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Object the arbitrary data is associated with\r
+     *  \r
+     */\r
+    private java.lang.Object _objectref;\r
+\r
+    /**\r
+     * Primary Key for vamsas object referencing\r
+     *  \r
+     */\r
+    private java.lang.String _id;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Attachment() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Attachment()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteCompressed\r
+     * \r
+     */\r
+    public void deleteCompressed()\r
+    {\r
+        this._has_compressed= false;\r
+    } //-- void deleteCompressed() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Attachment) {\r
+        \r
+            Attachment temp = (Attachment)obj;\r
+            if (this._compressed != temp._compressed)\r
+                return false;\r
+            if (this._has_compressed != temp._has_compressed)\r
+                return false;\r
+            if (this._type != null) {\r
+                if (temp._type == null) return false;\r
+                else if (!(this._type.equals(temp._type))) \r
+                    return false;\r
+            }\r
+            else if (temp._type != null)\r
+                return false;\r
+            if (this._objectref != null) {\r
+                if (temp._objectref == null) return false;\r
+                else if (!(this._objectref.equals(temp._objectref))) \r
+                    return false;\r
+            }\r
+            else if (temp._objectref != null)\r
+                return false;\r
+            if (this._id != null) {\r
+                if (temp._id == null) return false;\r
+                else if (!(this._id.equals(temp._id))) \r
+                    return false;\r
+            }\r
+            else if (temp._id != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'compressed'. The field\r
+     * 'compressed' has the following description: true implies\r
+     * data will be decompresses with Zip\r
+     *  before presenting to application \r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'compressed'.\r
+     */\r
+    public boolean getCompressed()\r
+    {\r
+        return this._compressed;\r
+    } //-- boolean getCompressed() \r
+\r
+    /**\r
+     * Returns the value of field 'id'. The field 'id' has the\r
+     * following description: Primary Key for vamsas object\r
+     * referencing\r
+     *  \r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Returns the value of field 'objectref'. The field\r
+     * 'objectref' has the following description: Object the\r
+     * arbitrary data is associated with\r
+     *  \r
+     * \r
+     * @return Object\r
+     * @return the value of field 'objectref'.\r
+     */\r
+    public java.lang.Object getObjectref()\r
+    {\r
+        return this._objectref;\r
+    } //-- java.lang.Object getObjectref() \r
+\r
+    /**\r
+     * Returns the value of field 'type'. The field 'type' has the\r
+     * following description: Type of arbitrary data - TODO: decide\r
+     * format - use\r
+     *  (extended) MIME types ? \r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method hasCompressed\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasCompressed()\r
+    {\r
+        return this._has_compressed;\r
+    } //-- boolean hasCompressed() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'compressed'. The field 'compressed'\r
+     * has the following description: true implies data will be\r
+     * decompresses with Zip\r
+     *  before presenting to application \r
+     * \r
+     * @param compressed the value of field 'compressed'.\r
+     */\r
+    public void setCompressed(boolean compressed)\r
+    {\r
+        this._compressed = compressed;\r
+        this._has_compressed = true;\r
+    } //-- void setCompressed(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'id'. The field 'id' has the\r
+     * following description: Primary Key for vamsas object\r
+     * referencing\r
+     *  \r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'objectref'. The field 'objectref'\r
+     * has the following description: Object the arbitrary data is\r
+     * associated with\r
+     *  \r
+     * \r
+     * @param objectref the value of field 'objectref'.\r
+     */\r
+    public void setObjectref(java.lang.Object objectref)\r
+    {\r
+        this._objectref = objectref;\r
+    } //-- void setObjectref(java.lang.Object) \r
+\r
+    /**\r
+     * Sets the value of field 'type'. The field 'type' has the\r
+     * following description: Type of arbitrary data - TODO: decide\r
+     * format - use\r
+     *  (extended) MIME types ? \r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return AppData\r
+     */\r
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Attachment) Unmarshaller.unmarshal(org.vamsas.objects.core.Attachment.class, reader);\r
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/AttachmentDescriptor.java b/src/org/vamsas/objects/core/AttachmentDescriptor.java
new file mode 100644 (file)
index 0000000..e2669da
--- /dev/null
@@ -0,0 +1,325 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AttachmentDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AttachmentDescriptor extends org.vamsas.objects.core.AppDataDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AttachmentDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.AppDataDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "Attachment";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _compressed\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_compressed", "compressed", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Attachment target = (Attachment) object;\r
+                if(!target.hasCompressed())\r
+                    return null;\r
+                return (target.getCompressed() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Attachment target = (Attachment) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteCompressed();\r
+                        return;\r
+                    }\r
+                    target.setCompressed( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _compressed\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Attachment target = (Attachment) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Attachment target = (Attachment) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _objectref\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_objectref", "objectref", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setReference(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Attachment target = (Attachment) object;\r
+                return target.getObjectref();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Attachment target = (Attachment) object;\r
+                    target.setObjectref( (java.lang.Object) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.Object();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _objectref\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        this.identity = desc;\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Attachment target = (Attachment) object;\r
+                return target.getId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Attachment target = (Attachment) object;\r
+                    target.setId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.String();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.AttachmentDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Attachment.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Common.java b/src/org/vamsas/objects/core/Common.java
new file mode 100644 (file)
index 0000000..3fdab82
--- /dev/null
@@ -0,0 +1,141 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Common.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Common extends org.vamsas.objects.core.AppData \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Common() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Common()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Common) {\r
+        \r
+            Common temp = (Common)obj;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return AppData\r
+     */\r
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Common) Unmarshaller.unmarshal(org.vamsas.objects.core.Common.class, reader);\r
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/CommonDescriptor.java b/src/org/vamsas/objects/core/CommonDescriptor.java
new file mode 100644 (file)
index 0000000..c7bc7e0
--- /dev/null
@@ -0,0 +1,167 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class CommonDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class CommonDescriptor extends org.vamsas.objects.core.AppDataDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public CommonDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.AppDataDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "Common";\r
+    } //-- org.vamsas.objects.core.CommonDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Common.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/DataSet.java b/src/org/vamsas/objects/core/DataSet.java
new file mode 100644 (file)
index 0000000..e6d064e
--- /dev/null
@@ -0,0 +1,850 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class DataSet.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DataSet extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * Field _sequenceList
+     */
+    private java.util.Vector _sequenceList;
+
+    /**
+     * Field _dataSetAnnotationsList
+     */
+    private java.util.Vector _dataSetAnnotationsList;
+
+    /**
+     * Field _alignmentList
+     */
+    private java.util.Vector _alignmentList;
+
+    /**
+     * Field _treeList
+     */
+    private java.util.Vector _treeList;
+
+    /**
+     * Field _provenance
+     */
+    private org.vamsas.objects.core.Provenance _provenance;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DataSet() 
+     {
+        super();
+        _sequenceList = new Vector();
+        _dataSetAnnotationsList = new Vector();
+        _alignmentList = new Vector();
+        _treeList = new Vector();
+    } //-- org.vamsas.objects.core.DataSet()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addAlignment
+     * 
+     * 
+     * 
+     * @param vAlignment
+     */
+    public void addAlignment(org.vamsas.objects.core.Alignment vAlignment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentList.addElement(vAlignment);
+    } //-- void addAlignment(org.vamsas.objects.core.Alignment) 
+
+    /**
+     * Method addAlignment
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignment
+     */
+    public void addAlignment(int index, org.vamsas.objects.core.Alignment vAlignment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _alignmentList.insertElementAt(vAlignment, index);
+    } //-- void addAlignment(int, org.vamsas.objects.core.Alignment) 
+
+    /**
+     * Method addDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param vDataSetAnnotations
+     */
+    public void addDataSetAnnotations(org.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dataSetAnnotationsList.addElement(vDataSetAnnotations);
+    } //-- void addDataSetAnnotations(org.vamsas.objects.core.DataSetAnnotations) 
+
+    /**
+     * Method addDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDataSetAnnotations
+     */
+    public void addDataSetAnnotations(int index, org.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dataSetAnnotationsList.insertElementAt(vDataSetAnnotations, index);
+    } //-- void addDataSetAnnotations(int, org.vamsas.objects.core.DataSetAnnotations) 
+
+    /**
+     * Method addSequence
+     * 
+     * 
+     * 
+     * @param vSequence
+     */
+    public void addSequence(org.vamsas.objects.core.Sequence vSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _sequenceList.addElement(vSequence);
+    } //-- void addSequence(org.vamsas.objects.core.Sequence) 
+
+    /**
+     * Method addSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @param vSequence
+     */
+    public void addSequence(int index, org.vamsas.objects.core.Sequence vSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _sequenceList.insertElementAt(vSequence, index);
+    } //-- void addSequence(int, org.vamsas.objects.core.Sequence) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param vTree
+     */
+    public void addTree(org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.addElement(vTree);
+    } //-- void addTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void addTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.insertElementAt(vTree, index);
+    } //-- void addTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method enumerateAlignment
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAlignment()
+    {
+        return _alignmentList.elements();
+    } //-- java.util.Enumeration enumerateAlignment() 
+
+    /**
+     * Method enumerateDataSetAnnotations
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateDataSetAnnotations()
+    {
+        return _dataSetAnnotationsList.elements();
+    } //-- java.util.Enumeration enumerateDataSetAnnotations() 
+
+    /**
+     * Method enumerateSequence
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateSequence()
+    {
+        return _sequenceList.elements();
+    } //-- java.util.Enumeration enumerateSequence() 
+
+    /**
+     * Method enumerateTree
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateTree()
+    {
+        return _treeList.elements();
+    } //-- java.util.Enumeration enumerateTree() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof DataSet) {
+        
+            DataSet temp = (DataSet)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._sequenceList != null) {
+                if (temp._sequenceList == null) return false;
+                else if (!(this._sequenceList.equals(temp._sequenceList))) 
+                    return false;
+            }
+            else if (temp._sequenceList != null)
+                return false;
+            if (this._dataSetAnnotationsList != null) {
+                if (temp._dataSetAnnotationsList == null) return false;
+                else if (!(this._dataSetAnnotationsList.equals(temp._dataSetAnnotationsList))) 
+                    return false;
+            }
+            else if (temp._dataSetAnnotationsList != null)
+                return false;
+            if (this._alignmentList != null) {
+                if (temp._alignmentList == null) return false;
+                else if (!(this._alignmentList.equals(temp._alignmentList))) 
+                    return false;
+            }
+            else if (temp._alignmentList != null)
+                return false;
+            if (this._treeList != null) {
+                if (temp._treeList == null) return false;
+                else if (!(this._treeList.equals(temp._treeList))) 
+                    return false;
+            }
+            else if (temp._treeList != null)
+                return false;
+            if (this._provenance != null) {
+                if (temp._provenance == null) return false;
+                else if (!(this._provenance.equals(temp._provenance))) 
+                    return false;
+            }
+            else if (temp._provenance != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getAlignment
+     * 
+     * 
+     * 
+     * @param index
+     * @return Alignment
+     */
+    public org.vamsas.objects.core.Alignment getAlignment(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentList.size())) {
+            throw new IndexOutOfBoundsException("getAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
+    } //-- org.vamsas.objects.core.Alignment getAlignment(int) 
+
+    /**
+     * Method getAlignment
+     * 
+     * 
+     * 
+     * @return Alignment
+     */
+    public org.vamsas.objects.core.Alignment[] getAlignment()
+    {
+        int size = _alignmentList.size();
+        org.vamsas.objects.core.Alignment[] mArray = new org.vamsas.objects.core.Alignment[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Alignment) _alignmentList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Alignment[] getAlignment() 
+
+    /**
+     * Method getAlignmentCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAlignmentCount()
+    {
+        return _alignmentList.size();
+    } //-- int getAlignmentCount() 
+
+    /**
+     * Method getDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @return DataSetAnnotations
+     */
+    public org.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dataSetAnnotationsList.size())) {
+            throw new IndexOutOfBoundsException("getDataSetAnnotations: Index value '"+index+"' not in range [0.."+_dataSetAnnotationsList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList.elementAt(index);
+    } //-- org.vamsas.objects.core.DataSetAnnotations getDataSetAnnotations(int) 
+
+    /**
+     * Method getDataSetAnnotations
+     * 
+     * 
+     * 
+     * @return DataSetAnnotations
+     */
+    public org.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations()
+    {
+        int size = _dataSetAnnotationsList.size();
+        org.vamsas.objects.core.DataSetAnnotations[] mArray = new org.vamsas.objects.core.DataSetAnnotations[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.DataSetAnnotations) _dataSetAnnotationsList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.DataSetAnnotations[] getDataSetAnnotations() 
+
+    /**
+     * Method getDataSetAnnotationsCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getDataSetAnnotationsCount()
+    {
+        return _dataSetAnnotationsList.size();
+    } //-- int getDataSetAnnotationsCount() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'provenance'.
+     * 
+     * @return Provenance
+     * @return the value of field 'provenance'.
+     */
+    public org.vamsas.objects.core.Provenance getProvenance()
+    {
+        return this._provenance;
+    } //-- org.vamsas.objects.core.Provenance getProvenance() 
+
+    /**
+     * Method getSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @return Sequence
+     */
+    public org.vamsas.objects.core.Sequence getSequence(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _sequenceList.size())) {
+            throw new IndexOutOfBoundsException("getSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
+    } //-- org.vamsas.objects.core.Sequence getSequence(int) 
+
+    /**
+     * Method getSequence
+     * 
+     * 
+     * 
+     * @return Sequence
+     */
+    public org.vamsas.objects.core.Sequence[] getSequence()
+    {
+        int size = _sequenceList.size();
+        org.vamsas.objects.core.Sequence[] mArray = new org.vamsas.objects.core.Sequence[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Sequence) _sequenceList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Sequence[] getSequence() 
+
+    /**
+     * Method getSequenceCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getSequenceCount()
+    {
+        return _sequenceList.size();
+    } //-- int getSequenceCount() 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree getTree(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+    } //-- org.vamsas.objects.core.Tree getTree(int) 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree[] getTree()
+    {
+        int size = _treeList.size();
+        org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Tree[] getTree() 
+
+    /**
+     * Method getTreeCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getTreeCount()
+    {
+        return _treeList.size();
+    } //-- int getTreeCount() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAlignment
+     * 
+     * 
+     * 
+     * @param index
+     * @return Alignment
+     */
+    public org.vamsas.objects.core.Alignment removeAlignment(int index)
+    {
+        java.lang.Object obj = _alignmentList.elementAt(index);
+        _alignmentList.removeElementAt(index);
+        return (org.vamsas.objects.core.Alignment) obj;
+    } //-- org.vamsas.objects.core.Alignment removeAlignment(int) 
+
+    /**
+     * Method removeAllAlignment
+     * 
+     */
+    public void removeAllAlignment()
+    {
+        _alignmentList.removeAllElements();
+    } //-- void removeAllAlignment() 
+
+    /**
+     * Method removeAllDataSetAnnotations
+     * 
+     */
+    public void removeAllDataSetAnnotations()
+    {
+        _dataSetAnnotationsList.removeAllElements();
+    } //-- void removeAllDataSetAnnotations() 
+
+    /**
+     * Method removeAllSequence
+     * 
+     */
+    public void removeAllSequence()
+    {
+        _sequenceList.removeAllElements();
+    } //-- void removeAllSequence() 
+
+    /**
+     * Method removeAllTree
+     * 
+     */
+    public void removeAllTree()
+    {
+        _treeList.removeAllElements();
+    } //-- void removeAllTree() 
+
+    /**
+     * Method removeDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @return DataSetAnnotations
+     */
+    public org.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotations(int index)
+    {
+        java.lang.Object obj = _dataSetAnnotationsList.elementAt(index);
+        _dataSetAnnotationsList.removeElementAt(index);
+        return (org.vamsas.objects.core.DataSetAnnotations) obj;
+    } //-- org.vamsas.objects.core.DataSetAnnotations removeDataSetAnnotations(int) 
+
+    /**
+     * Method removeSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @return Sequence
+     */
+    public org.vamsas.objects.core.Sequence removeSequence(int index)
+    {
+        java.lang.Object obj = _sequenceList.elementAt(index);
+        _sequenceList.removeElementAt(index);
+        return (org.vamsas.objects.core.Sequence) obj;
+    } //-- org.vamsas.objects.core.Sequence removeSequence(int) 
+
+    /**
+     * Method removeTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree removeTree(int index)
+    {
+        java.lang.Object obj = _treeList.elementAt(index);
+        _treeList.removeElementAt(index);
+        return (org.vamsas.objects.core.Tree) obj;
+    } //-- org.vamsas.objects.core.Tree removeTree(int) 
+
+    /**
+     * Method setAlignment
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAlignment
+     */
+    public void setAlignment(int index, org.vamsas.objects.core.Alignment vAlignment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _alignmentList.size())) {
+            throw new IndexOutOfBoundsException("setAlignment: Index value '"+index+"' not in range [0.."+_alignmentList.size()+ "]");
+        }
+        _alignmentList.setElementAt(vAlignment, index);
+    } //-- void setAlignment(int, org.vamsas.objects.core.Alignment) 
+
+    /**
+     * Method setAlignment
+     * 
+     * 
+     * 
+     * @param alignmentArray
+     */
+    public void setAlignment(org.vamsas.objects.core.Alignment[] alignmentArray)
+    {
+        //-- copy array
+        _alignmentList.removeAllElements();
+        for (int i = 0; i < alignmentArray.length; i++) {
+            _alignmentList.addElement(alignmentArray[i]);
+        }
+    } //-- void setAlignment(org.vamsas.objects.core.Alignment) 
+
+    /**
+     * Method setDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDataSetAnnotations
+     */
+    public void setDataSetAnnotations(int index, org.vamsas.objects.core.DataSetAnnotations vDataSetAnnotations)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dataSetAnnotationsList.size())) {
+            throw new IndexOutOfBoundsException("setDataSetAnnotations: Index value '"+index+"' not in range [0.."+_dataSetAnnotationsList.size()+ "]");
+        }
+        _dataSetAnnotationsList.setElementAt(vDataSetAnnotations, index);
+    } //-- void setDataSetAnnotations(int, org.vamsas.objects.core.DataSetAnnotations) 
+
+    /**
+     * Method setDataSetAnnotations
+     * 
+     * 
+     * 
+     * @param dataSetAnnotationsArray
+     */
+    public void setDataSetAnnotations(org.vamsas.objects.core.DataSetAnnotations[] dataSetAnnotationsArray)
+    {
+        //-- copy array
+        _dataSetAnnotationsList.removeAllElements();
+        for (int i = 0; i < dataSetAnnotationsArray.length; i++) {
+            _dataSetAnnotationsList.addElement(dataSetAnnotationsArray[i]);
+        }
+    } //-- void setDataSetAnnotations(org.vamsas.objects.core.DataSetAnnotations) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'provenance'.
+     * 
+     * @param provenance the value of field 'provenance'.
+     */
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)
+    {
+        this._provenance = provenance;
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
+
+    /**
+     * Method setSequence
+     * 
+     * 
+     * 
+     * @param index
+     * @param vSequence
+     */
+    public void setSequence(int index, org.vamsas.objects.core.Sequence vSequence)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _sequenceList.size())) {
+            throw new IndexOutOfBoundsException("setSequence: Index value '"+index+"' not in range [0.."+_sequenceList.size()+ "]");
+        }
+        _sequenceList.setElementAt(vSequence, index);
+    } //-- void setSequence(int, org.vamsas.objects.core.Sequence) 
+
+    /**
+     * Method setSequence
+     * 
+     * 
+     * 
+     * @param sequenceArray
+     */
+    public void setSequence(org.vamsas.objects.core.Sequence[] sequenceArray)
+    {
+        //-- copy array
+        _sequenceList.removeAllElements();
+        for (int i = 0; i < sequenceArray.length; i++) {
+            _sequenceList.addElement(sequenceArray[i]);
+        }
+    } //-- void setSequence(org.vamsas.objects.core.Sequence) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void setTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        _treeList.setElementAt(vTree, index);
+    } //-- void setTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param treeArray
+     */
+    public void setTree(org.vamsas.objects.core.Tree[] treeArray)
+    {
+        //-- copy array
+        _treeList.removeAllElements();
+        for (int i = 0; i < treeArray.length; i++) {
+            _treeList.addElement(treeArray[i]);
+        }
+    } //-- void setTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return DataSet
+     */
+    public static org.vamsas.objects.core.DataSet unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.DataSet) Unmarshaller.unmarshal(org.vamsas.objects.core.DataSet.class, reader);
+    } //-- org.vamsas.objects.core.DataSet unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/DataSetAnnotations.java b/src/org/vamsas/objects/core/DataSetAnnotations.java
new file mode 100644 (file)
index 0000000..1d5552a
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class DataSetAnnotations.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DataSetAnnotations extends org.vamsas.objects.core.RangeAnnotation 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * annotation is associated with a
+     *  particular dataset sequence 
+     */
+    private java.lang.Object _seqRef;
+
+    /**
+     * Field _provenance
+     */
+    private org.vamsas.objects.core.Provenance _provenance;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DataSetAnnotations() 
+     {
+        super();
+    } //-- org.vamsas.objects.core.DataSetAnnotations()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof DataSetAnnotations) {
+        
+            DataSetAnnotations temp = (DataSetAnnotations)obj;
+            if (this._seqRef != null) {
+                if (temp._seqRef == null) return false;
+                else if (!(this._seqRef.equals(temp._seqRef))) 
+                    return false;
+            }
+            else if (temp._seqRef != null)
+                return false;
+            if (this._provenance != null) {
+                if (temp._provenance == null) return false;
+                else if (!(this._provenance.equals(temp._provenance))) 
+                    return false;
+            }
+            else if (temp._provenance != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'provenance'.
+     * 
+     * @return Provenance
+     * @return the value of field 'provenance'.
+     */
+    public org.vamsas.objects.core.Provenance getProvenance()
+    {
+        return this._provenance;
+    } //-- org.vamsas.objects.core.Provenance getProvenance() 
+
+    /**
+     * Returns the value of field 'seqRef'. The field 'seqRef' has
+     * the following description: annotation is associated with a
+     *  particular dataset sequence 
+     * 
+     * @return Object
+     * @return the value of field 'seqRef'.
+     */
+    public java.lang.Object getSeqRef()
+    {
+        return this._seqRef;
+    } //-- java.lang.Object getSeqRef() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Sets the value of field 'provenance'.
+     * 
+     * @param provenance the value of field 'provenance'.
+     */
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)
+    {
+        this._provenance = provenance;
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
+
+    /**
+     * Sets the value of field 'seqRef'. The field 'seqRef' has the
+     * following description: annotation is associated with a
+     *  particular dataset sequence 
+     * 
+     * @param seqRef the value of field 'seqRef'.
+     */
+    public void setSeqRef(java.lang.Object seqRef)
+    {
+        this._seqRef = seqRef;
+    } //-- void setSeqRef(java.lang.Object) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return RangeType
+     */
+    public static org.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.DataSetAnnotations) Unmarshaller.unmarshal(org.vamsas.objects.core.DataSetAnnotations.class, reader);
+    } //-- org.vamsas.objects.core.RangeType unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java b/src/org/vamsas/objects/core/DataSetAnnotationsDescriptor.java
new file mode 100644 (file)
index 0000000..a8b2741
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class DataSetAnnotationsDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DataSetAnnotationsDescriptor extends org.vamsas.objects.core.RangeAnnotationDescriptor {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DataSetAnnotationsDescriptor() 
+     {
+        super();
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.RangeAnnotationDescriptor());
+        nsURI = "http://www.vamsas.org";
+        xmlName = "DataSetAnnotations";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _seqRef
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_seqRef", "seqRef", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setReference(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSetAnnotations target = (DataSetAnnotations) object;
+                return target.getSeqRef();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSetAnnotations target = (DataSetAnnotations) object;
+                    target.setSeqRef( (java.lang.Object) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.Object();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _seqRef
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _provenance
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSetAnnotations target = (DataSetAnnotations) object;
+                return target.getProvenance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSetAnnotations target = (DataSetAnnotations) object;
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Provenance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _provenance
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.DataSetAnnotationsDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return super.getExtends();
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        if (identity == null)
+            return super.getIdentity();
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.DataSetAnnotations.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/DataSetDescriptor.java b/src/org/vamsas/objects/core/DataSetDescriptor.java
new file mode 100644 (file)
index 0000000..7e342bc
--- /dev/null
@@ -0,0 +1,385 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class DataSetDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DataSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DataSetDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "DataSet";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _sequenceList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Sequence.class, "_sequenceList", "Sequence", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getSequence();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.addSequence( (org.vamsas.objects.core.Sequence) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Sequence();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _sequenceList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _dataSetAnnotationsList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.DataSetAnnotations.class, "_dataSetAnnotationsList", "DataSetAnnotations", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getDataSetAnnotations();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.addDataSetAnnotations( (org.vamsas.objects.core.DataSetAnnotations) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.DataSetAnnotations();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _dataSetAnnotationsList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _alignmentList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Alignment.class, "_alignmentList", "Alignment", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getAlignment();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.addAlignment( (org.vamsas.objects.core.Alignment) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Alignment();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _alignmentList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _treeList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getTree();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.addTree( (org.vamsas.objects.core.Tree) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Tree();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _treeList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _provenance
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DataSet target = (DataSet) object;
+                return target.getProvenance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DataSet target = (DataSet) object;
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Provenance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _provenance
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.DataSetDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.DataSet.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/DbRef.java b/src/org/vamsas/objects/core/DbRef.java
new file mode 100644 (file)
index 0000000..3be5671
--- /dev/null
@@ -0,0 +1,806 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Store a list of database references
+ *  for this sequence record - with optional mapping
+ *  from database sequence to the given sequence record 
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DbRef extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * TODO Database Naming
+     *  Convention: either start using LSID (so
+     *  change type to URI) or leave this as an
+     *  uncontrolled/unspecified string ID
+     *  
+     */
+    private java.lang.String _source;
+
+    /**
+     * Version must be specified -
+     *  
+     */
+    private java.lang.String _version;
+
+    /**
+     * TODO: make some specification
+     *  of the database field from which this
+     *  accessionId is taken from - should that be a
+     *  special property of the dbRef object ?
+     *  
+     */
+    private java.lang.String _accessionId;
+
+    /**
+     * Primary Key for vamsas object
+     *  referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * From: Offset to first
+     *  position in dataset sequence record that
+     *  this database entry maps to To: Offset
+     *  to last position in dataset sequence
+     *  record that this database entry maps to
+     *  Start: Offset to first last position in
+     *  database entry that first (or offset)
+     *  position in sequence maps to End: Offset
+     *  to last position in database entry that
+     *  last (offset) position in sequence maps
+     *  to 
+     */
+    private java.util.Vector _mapList;
+
+    /**
+     * Field _linkList
+     */
+    private java.util.Vector _linkList;
+
+    /**
+     * Field _propertyList
+     */
+    private java.util.Vector _propertyList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DbRef() 
+     {
+        super();
+        _mapList = new Vector();
+        _linkList = new Vector();
+        _propertyList = new Vector();
+    } //-- org.vamsas.objects.core.DbRef()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addLink
+     * 
+     * 
+     * 
+     * @param vLink
+     */
+    public void addLink(org.vamsas.objects.core.Link vLink)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _linkList.addElement(vLink);
+    } //-- void addLink(org.vamsas.objects.core.Link) 
+
+    /**
+     * Method addLink
+     * 
+     * 
+     * 
+     * @param index
+     * @param vLink
+     */
+    public void addLink(int index, org.vamsas.objects.core.Link vLink)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _linkList.insertElementAt(vLink, index);
+    } //-- void addLink(int, org.vamsas.objects.core.Link) 
+
+    /**
+     * Method addMap
+     * 
+     * 
+     * 
+     * @param vMap
+     */
+    public void addMap(org.vamsas.objects.core.Map vMap)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _mapList.addElement(vMap);
+    } //-- void addMap(org.vamsas.objects.core.Map) 
+
+    /**
+     * Method addMap
+     * 
+     * 
+     * 
+     * @param index
+     * @param vMap
+     */
+    public void addMap(int index, org.vamsas.objects.core.Map vMap)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _mapList.insertElementAt(vMap, index);
+    } //-- void addMap(int, org.vamsas.objects.core.Map) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method enumerateLink
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateLink()
+    {
+        return _linkList.elements();
+    } //-- java.util.Enumeration enumerateLink() 
+
+    /**
+     * Method enumerateMap
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateMap()
+    {
+        return _mapList.elements();
+    } //-- java.util.Enumeration enumerateMap() 
+
+    /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof DbRef) {
+        
+            DbRef temp = (DbRef)obj;
+            if (this._source != null) {
+                if (temp._source == null) return false;
+                else if (!(this._source.equals(temp._source))) 
+                    return false;
+            }
+            else if (temp._source != null)
+                return false;
+            if (this._version != null) {
+                if (temp._version == null) return false;
+                else if (!(this._version.equals(temp._version))) 
+                    return false;
+            }
+            else if (temp._version != null)
+                return false;
+            if (this._accessionId != null) {
+                if (temp._accessionId == null) return false;
+                else if (!(this._accessionId.equals(temp._accessionId))) 
+                    return false;
+            }
+            else if (temp._accessionId != null)
+                return false;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._mapList != null) {
+                if (temp._mapList == null) return false;
+                else if (!(this._mapList.equals(temp._mapList))) 
+                    return false;
+            }
+            else if (temp._mapList != null)
+                return false;
+            if (this._linkList != null) {
+                if (temp._linkList == null) return false;
+                else if (!(this._linkList.equals(temp._linkList))) 
+                    return false;
+            }
+            else if (temp._linkList != null)
+                return false;
+            if (this._propertyList != null) {
+                if (temp._propertyList == null) return false;
+                else if (!(this._propertyList.equals(temp._propertyList))) 
+                    return false;
+            }
+            else if (temp._propertyList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'accessionId'. The field
+     * 'accessionId' has the following description: TODO: make some
+     * specification
+     *  of the database field from which this
+     *  accessionId is taken from - should that be a
+     *  special property of the dbRef object ?
+     *  
+     * 
+     * @return String
+     * @return the value of field 'accessionId'.
+     */
+    public java.lang.String getAccessionId()
+    {
+        return this._accessionId;
+    } //-- java.lang.String getAccessionId() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     *  referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Method getLink
+     * 
+     * 
+     * 
+     * @param index
+     * @return Link
+     */
+    public org.vamsas.objects.core.Link getLink(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _linkList.size())) {
+            throw new IndexOutOfBoundsException("getLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Link) _linkList.elementAt(index);
+    } //-- org.vamsas.objects.core.Link getLink(int) 
+
+    /**
+     * Method getLink
+     * 
+     * 
+     * 
+     * @return Link
+     */
+    public org.vamsas.objects.core.Link[] getLink()
+    {
+        int size = _linkList.size();
+        org.vamsas.objects.core.Link[] mArray = new org.vamsas.objects.core.Link[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Link) _linkList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Link[] getLink() 
+
+    /**
+     * Method getLinkCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getLinkCount()
+    {
+        return _linkList.size();
+    } //-- int getLinkCount() 
+
+    /**
+     * Method getMap
+     * 
+     * 
+     * 
+     * @param index
+     * @return Map
+     */
+    public org.vamsas.objects.core.Map getMap(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _mapList.size())) {
+            throw new IndexOutOfBoundsException("getMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Map) _mapList.elementAt(index);
+    } //-- org.vamsas.objects.core.Map getMap(int) 
+
+    /**
+     * Method getMap
+     * 
+     * 
+     * 
+     * @return Map
+     */
+    public org.vamsas.objects.core.Map[] getMap()
+    {
+        int size = _mapList.size();
+        org.vamsas.objects.core.Map[] mArray = new org.vamsas.objects.core.Map[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Map) _mapList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Map[] getMap() 
+
+    /**
+     * Method getMapCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getMapCount()
+    {
+        return _mapList.size();
+    } //-- int getMapCount() 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property getProperty(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Property[] getProperty() 
+
+    /**
+     * Method getPropertyCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getPropertyCount()
+    {
+        return _propertyList.size();
+    } //-- int getPropertyCount() 
+
+    /**
+     * Returns the value of field 'source'. The field 'source' has
+     * the following description: TODO Database Naming
+     *  Convention: either start using LSID (so
+     *  change type to URI) or leave this as an
+     *  uncontrolled/unspecified string ID
+     *  
+     * 
+     * @return String
+     * @return the value of field 'source'.
+     */
+    public java.lang.String getSource()
+    {
+        return this._source;
+    } //-- java.lang.String getSource() 
+
+    /**
+     * Returns the value of field 'version'. The field 'version'
+     * has the following description: Version must be specified -
+     *  
+     * 
+     * @return String
+     * @return the value of field 'version'.
+     */
+    public java.lang.String getVersion()
+    {
+        return this._version;
+    } //-- java.lang.String getVersion() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllLink
+     * 
+     */
+    public void removeAllLink()
+    {
+        _linkList.removeAllElements();
+    } //-- void removeAllLink() 
+
+    /**
+     * Method removeAllMap
+     * 
+     */
+    public void removeAllMap()
+    {
+        _mapList.removeAllElements();
+    } //-- void removeAllMap() 
+
+    /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
+     * Method removeLink
+     * 
+     * 
+     * 
+     * @param index
+     * @return Link
+     */
+    public org.vamsas.objects.core.Link removeLink(int index)
+    {
+        java.lang.Object obj = _linkList.elementAt(index);
+        _linkList.removeElementAt(index);
+        return (org.vamsas.objects.core.Link) obj;
+    } //-- org.vamsas.objects.core.Link removeLink(int) 
+
+    /**
+     * Method removeMap
+     * 
+     * 
+     * 
+     * @param index
+     * @return Map
+     */
+    public org.vamsas.objects.core.Map removeMap(int index)
+    {
+        java.lang.Object obj = _mapList.elementAt(index);
+        _mapList.removeElementAt(index);
+        return (org.vamsas.objects.core.Map) obj;
+    } //-- org.vamsas.objects.core.Map removeMap(int) 
+
+    /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
+     * Sets the value of field 'accessionId'. The field
+     * 'accessionId' has the following description: TODO: make some
+     * specification
+     *  of the database field from which this
+     *  accessionId is taken from - should that be a
+     *  special property of the dbRef object ?
+     *  
+     * 
+     * @param accessionId the value of field 'accessionId'.
+     */
+    public void setAccessionId(java.lang.String accessionId)
+    {
+        this._accessionId = accessionId;
+    } //-- void setAccessionId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     *  referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Method setLink
+     * 
+     * 
+     * 
+     * @param index
+     * @param vLink
+     */
+    public void setLink(int index, org.vamsas.objects.core.Link vLink)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _linkList.size())) {
+            throw new IndexOutOfBoundsException("setLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");
+        }
+        _linkList.setElementAt(vLink, index);
+    } //-- void setLink(int, org.vamsas.objects.core.Link) 
+
+    /**
+     * Method setLink
+     * 
+     * 
+     * 
+     * @param linkArray
+     */
+    public void setLink(org.vamsas.objects.core.Link[] linkArray)
+    {
+        //-- copy array
+        _linkList.removeAllElements();
+        for (int i = 0; i < linkArray.length; i++) {
+            _linkList.addElement(linkArray[i]);
+        }
+    } //-- void setLink(org.vamsas.objects.core.Link) 
+
+    /**
+     * Method setMap
+     * 
+     * 
+     * 
+     * @param index
+     * @param vMap
+     */
+    public void setMap(int index, org.vamsas.objects.core.Map vMap)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _mapList.size())) {
+            throw new IndexOutOfBoundsException("setMap: Index value '"+index+"' not in range [0.."+_mapList.size()+ "]");
+        }
+        _mapList.setElementAt(vMap, index);
+    } //-- void setMap(int, org.vamsas.objects.core.Map) 
+
+    /**
+     * Method setMap
+     * 
+     * 
+     * 
+     * @param mapArray
+     */
+    public void setMap(org.vamsas.objects.core.Map[] mapArray)
+    {
+        //-- copy array
+        _mapList.removeAllElements();
+        for (int i = 0; i < mapArray.length; i++) {
+            _mapList.addElement(mapArray[i]);
+        }
+    } //-- void setMap(org.vamsas.objects.core.Map) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        _propertyList.setElementAt(vProperty, index);
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Sets the value of field 'source'. The field 'source' has the
+     * following description: TODO Database Naming
+     *  Convention: either start using LSID (so
+     *  change type to URI) or leave this as an
+     *  uncontrolled/unspecified string ID
+     *  
+     * 
+     * @param source the value of field 'source'.
+     */
+    public void setSource(java.lang.String source)
+    {
+        this._source = source;
+    } //-- void setSource(java.lang.String) 
+
+    /**
+     * Sets the value of field 'version'. The field 'version' has
+     * the following description: Version must be specified -
+     *  
+     * 
+     * @param version the value of field 'version'.
+     */
+    public void setVersion(java.lang.String version)
+    {
+        this._version = version;
+    } //-- void setVersion(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return DbRef
+     */
+    public static org.vamsas.objects.core.DbRef unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.DbRef) Unmarshaller.unmarshal(org.vamsas.objects.core.DbRef.class, reader);
+    } //-- org.vamsas.objects.core.DbRef unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/DbRefDescriptor.java b/src/org/vamsas/objects/core/DbRefDescriptor.java
new file mode 100644 (file)
index 0000000..fdb9238
--- /dev/null
@@ -0,0 +1,430 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class DbRefDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class DbRefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public DbRefDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "dbRef";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _source
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_source", "source", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getSource();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.setSource( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _source
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _version
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getVersion();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.setVersion( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _version
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _accessionId
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_accessionId", "accessionId", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getAccessionId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.setAccessionId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _accessionId
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _mapList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Map.class, "_mapList", "map", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getMap();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.addMap( (org.vamsas.objects.core.Map) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Map();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _mapList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _linkList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Link.class, "_linkList", "link", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getLink();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.addLink( (org.vamsas.objects.core.Link) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Link();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _linkList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _propertyList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                DbRef target = (DbRef) object;
+                return target.getProperty();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    DbRef target = (DbRef) object;
+                    target.addProperty( (org.vamsas.objects.core.Property) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Property();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _propertyList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.DbRefDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.DbRef.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Entry.java b/src/org/vamsas/objects/core/Entry.java
new file mode 100644 (file)
index 0000000..dcf3c5e
--- /dev/null
@@ -0,0 +1,803 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Entry.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Entry extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object referencing
+     *  
+     */
+    private java.lang.String _id;
+
+    /**
+     * Who 
+     */
+    private java.lang.String _user;
+
+    /**
+     * With which application 
+     */
+    private java.lang.String _app;
+
+    /**
+     * Did what 
+     */
+    private java.lang.String _action;
+
+    /**
+     * When 
+     */
+    private org.exolab.castor.types.Date _date;
+
+    /**
+     * additional information 
+     */
+    private java.util.Vector _propertyList;
+
+    /**
+     * parameter for the action 
+     */
+    private java.util.Vector _paramList;
+
+    /**
+     * bioinformatic objects input to action
+     *  
+     */
+    private java.util.Vector _inputList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Entry() 
+     {
+        super();
+        _propertyList = new Vector();
+        _paramList = new Vector();
+        _inputList = new Vector();
+    } //-- org.vamsas.objects.core.Entry()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addInput
+     * 
+     * 
+     * 
+     * @param vInput
+     */
+    public void addInput(org.vamsas.objects.core.Input vInput)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _inputList.addElement(vInput);
+    } //-- void addInput(org.vamsas.objects.core.Input) 
+
+    /**
+     * Method addInput
+     * 
+     * 
+     * 
+     * @param index
+     * @param vInput
+     */
+    public void addInput(int index, org.vamsas.objects.core.Input vInput)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _inputList.insertElementAt(vInput, index);
+    } //-- void addInput(int, org.vamsas.objects.core.Input) 
+
+    /**
+     * Method addParam
+     * 
+     * 
+     * 
+     * @param vParam
+     */
+    public void addParam(org.vamsas.objects.core.Param vParam)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _paramList.addElement(vParam);
+    } //-- void addParam(org.vamsas.objects.core.Param) 
+
+    /**
+     * Method addParam
+     * 
+     * 
+     * 
+     * @param index
+     * @param vParam
+     */
+    public void addParam(int index, org.vamsas.objects.core.Param vParam)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _paramList.insertElementAt(vParam, index);
+    } //-- void addParam(int, org.vamsas.objects.core.Param) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method enumerateInput
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateInput()
+    {
+        return _inputList.elements();
+    } //-- java.util.Enumeration enumerateInput() 
+
+    /**
+     * Method enumerateParam
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateParam()
+    {
+        return _paramList.elements();
+    } //-- java.util.Enumeration enumerateParam() 
+
+    /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Entry) {
+        
+            Entry temp = (Entry)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._user != null) {
+                if (temp._user == null) return false;
+                else if (!(this._user.equals(temp._user))) 
+                    return false;
+            }
+            else if (temp._user != null)
+                return false;
+            if (this._app != null) {
+                if (temp._app == null) return false;
+                else if (!(this._app.equals(temp._app))) 
+                    return false;
+            }
+            else if (temp._app != null)
+                return false;
+            if (this._action != null) {
+                if (temp._action == null) return false;
+                else if (!(this._action.equals(temp._action))) 
+                    return false;
+            }
+            else if (temp._action != null)
+                return false;
+            if (this._date != null) {
+                if (temp._date == null) return false;
+                else if (!(this._date.equals(temp._date))) 
+                    return false;
+            }
+            else if (temp._date != null)
+                return false;
+            if (this._propertyList != null) {
+                if (temp._propertyList == null) return false;
+                else if (!(this._propertyList.equals(temp._propertyList))) 
+                    return false;
+            }
+            else if (temp._propertyList != null)
+                return false;
+            if (this._paramList != null) {
+                if (temp._paramList == null) return false;
+                else if (!(this._paramList.equals(temp._paramList))) 
+                    return false;
+            }
+            else if (temp._paramList != null)
+                return false;
+            if (this._inputList != null) {
+                if (temp._inputList == null) return false;
+                else if (!(this._inputList.equals(temp._inputList))) 
+                    return false;
+            }
+            else if (temp._inputList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'action'. The field 'action' has
+     * the following description: Did what 
+     * 
+     * @return String
+     * @return the value of field 'action'.
+     */
+    public java.lang.String getAction()
+    {
+        return this._action;
+    } //-- java.lang.String getAction() 
+
+    /**
+     * Returns the value of field 'app'. The field 'app' has the
+     * following description: With which application 
+     * 
+     * @return String
+     * @return the value of field 'app'.
+     */
+    public java.lang.String getApp()
+    {
+        return this._app;
+    } //-- java.lang.String getApp() 
+
+    /**
+     * Returns the value of field 'date'. The field 'date' has the
+     * following description: When 
+     * 
+     * @return Date
+     * @return the value of field 'date'.
+     */
+    public org.exolab.castor.types.Date getDate()
+    {
+        return this._date;
+    } //-- org.exolab.castor.types.Date getDate() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Method getInput
+     * 
+     * 
+     * 
+     * @param index
+     * @return Input
+     */
+    public org.vamsas.objects.core.Input getInput(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _inputList.size())) {
+            throw new IndexOutOfBoundsException("getInput: Index value '"+index+"' not in range [0.."+_inputList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Input) _inputList.elementAt(index);
+    } //-- org.vamsas.objects.core.Input getInput(int) 
+
+    /**
+     * Method getInput
+     * 
+     * 
+     * 
+     * @return Input
+     */
+    public org.vamsas.objects.core.Input[] getInput()
+    {
+        int size = _inputList.size();
+        org.vamsas.objects.core.Input[] mArray = new org.vamsas.objects.core.Input[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Input) _inputList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Input[] getInput() 
+
+    /**
+     * Method getInputCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getInputCount()
+    {
+        return _inputList.size();
+    } //-- int getInputCount() 
+
+    /**
+     * Method getParam
+     * 
+     * 
+     * 
+     * @param index
+     * @return Param
+     */
+    public org.vamsas.objects.core.Param getParam(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _paramList.size())) {
+            throw new IndexOutOfBoundsException("getParam: Index value '"+index+"' not in range [0.."+_paramList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Param) _paramList.elementAt(index);
+    } //-- org.vamsas.objects.core.Param getParam(int) 
+
+    /**
+     * Method getParam
+     * 
+     * 
+     * 
+     * @return Param
+     */
+    public org.vamsas.objects.core.Param[] getParam()
+    {
+        int size = _paramList.size();
+        org.vamsas.objects.core.Param[] mArray = new org.vamsas.objects.core.Param[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Param) _paramList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Param[] getParam() 
+
+    /**
+     * Method getParamCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getParamCount()
+    {
+        return _paramList.size();
+    } //-- int getParamCount() 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property getProperty(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Property[] getProperty() 
+
+    /**
+     * Method getPropertyCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getPropertyCount()
+    {
+        return _propertyList.size();
+    } //-- int getPropertyCount() 
+
+    /**
+     * Returns the value of field 'user'. The field 'user' has the
+     * following description: Who 
+     * 
+     * @return String
+     * @return the value of field 'user'.
+     */
+    public java.lang.String getUser()
+    {
+        return this._user;
+    } //-- java.lang.String getUser() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllInput
+     * 
+     */
+    public void removeAllInput()
+    {
+        _inputList.removeAllElements();
+    } //-- void removeAllInput() 
+
+    /**
+     * Method removeAllParam
+     * 
+     */
+    public void removeAllParam()
+    {
+        _paramList.removeAllElements();
+    } //-- void removeAllParam() 
+
+    /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
+     * Method removeInput
+     * 
+     * 
+     * 
+     * @param index
+     * @return Input
+     */
+    public org.vamsas.objects.core.Input removeInput(int index)
+    {
+        java.lang.Object obj = _inputList.elementAt(index);
+        _inputList.removeElementAt(index);
+        return (org.vamsas.objects.core.Input) obj;
+    } //-- org.vamsas.objects.core.Input removeInput(int) 
+
+    /**
+     * Method removeParam
+     * 
+     * 
+     * 
+     * @param index
+     * @return Param
+     */
+    public org.vamsas.objects.core.Param removeParam(int index)
+    {
+        java.lang.Object obj = _paramList.elementAt(index);
+        _paramList.removeElementAt(index);
+        return (org.vamsas.objects.core.Param) obj;
+    } //-- org.vamsas.objects.core.Param removeParam(int) 
+
+    /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
+     * Sets the value of field 'action'. The field 'action' has the
+     * following description: Did what 
+     * 
+     * @param action the value of field 'action'.
+     */
+    public void setAction(java.lang.String action)
+    {
+        this._action = action;
+    } //-- void setAction(java.lang.String) 
+
+    /**
+     * Sets the value of field 'app'. The field 'app' has the
+     * following description: With which application 
+     * 
+     * @param app the value of field 'app'.
+     */
+    public void setApp(java.lang.String app)
+    {
+        this._app = app;
+    } //-- void setApp(java.lang.String) 
+
+    /**
+     * Sets the value of field 'date'. The field 'date' has the
+     * following description: When 
+     * 
+     * @param date the value of field 'date'.
+     */
+    public void setDate(org.exolab.castor.types.Date date)
+    {
+        this._date = date;
+    } //-- void setDate(org.exolab.castor.types.Date) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Method setInput
+     * 
+     * 
+     * 
+     * @param index
+     * @param vInput
+     */
+    public void setInput(int index, org.vamsas.objects.core.Input vInput)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _inputList.size())) {
+            throw new IndexOutOfBoundsException("setInput: Index value '"+index+"' not in range [0.."+_inputList.size()+ "]");
+        }
+        _inputList.setElementAt(vInput, index);
+    } //-- void setInput(int, org.vamsas.objects.core.Input) 
+
+    /**
+     * Method setInput
+     * 
+     * 
+     * 
+     * @param inputArray
+     */
+    public void setInput(org.vamsas.objects.core.Input[] inputArray)
+    {
+        //-- copy array
+        _inputList.removeAllElements();
+        for (int i = 0; i < inputArray.length; i++) {
+            _inputList.addElement(inputArray[i]);
+        }
+    } //-- void setInput(org.vamsas.objects.core.Input) 
+
+    /**
+     * Method setParam
+     * 
+     * 
+     * 
+     * @param index
+     * @param vParam
+     */
+    public void setParam(int index, org.vamsas.objects.core.Param vParam)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _paramList.size())) {
+            throw new IndexOutOfBoundsException("setParam: Index value '"+index+"' not in range [0.."+_paramList.size()+ "]");
+        }
+        _paramList.setElementAt(vParam, index);
+    } //-- void setParam(int, org.vamsas.objects.core.Param) 
+
+    /**
+     * Method setParam
+     * 
+     * 
+     * 
+     * @param paramArray
+     */
+    public void setParam(org.vamsas.objects.core.Param[] paramArray)
+    {
+        //-- copy array
+        _paramList.removeAllElements();
+        for (int i = 0; i < paramArray.length; i++) {
+            _paramList.addElement(paramArray[i]);
+        }
+    } //-- void setParam(org.vamsas.objects.core.Param) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        _propertyList.setElementAt(vProperty, index);
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Sets the value of field 'user'. The field 'user' has the
+     * following description: Who 
+     * 
+     * @param user the value of field 'user'.
+     */
+    public void setUser(java.lang.String user)
+    {
+        this._user = user;
+    } //-- void setUser(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Entry
+     */
+    public static org.vamsas.objects.core.Entry unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Entry) Unmarshaller.unmarshal(org.vamsas.objects.core.Entry.class, reader);
+    } //-- org.vamsas.objects.core.Entry unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/EntryDescriptor.java b/src/org/vamsas/objects/core/EntryDescriptor.java
new file mode 100644 (file)
index 0000000..0426fa4
--- /dev/null
@@ -0,0 +1,471 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class EntryDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class EntryDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public EntryDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "entry";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _user
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_user", "User", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getUser();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.setUser( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _user
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _app
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_app", "App", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getApp();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.setApp( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _app
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _action
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_action", "Action", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getAction();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.setAction( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _action
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _date
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.types.Date.class, "_date", "Date", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getDate();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.setDate( (org.exolab.castor.types.Date) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.exolab.castor.types.Date();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _date
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            DateTimeValidator typeValidator = new DateTimeValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _propertyList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getProperty();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.addProperty( (org.vamsas.objects.core.Property) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Property();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _propertyList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _paramList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Param.class, "_paramList", "param", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getParam();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.addParam( (org.vamsas.objects.core.Param) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Param();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _paramList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _inputList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Input.class, "_inputList", "input", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Entry target = (Entry) object;
+                return target.getInput();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Entry target = (Entry) object;
+                    target.addInput( (org.vamsas.objects.core.Input) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Input();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _inputList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.EntryDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Entry.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Glyph.java b/src/org/vamsas/objects/core/Glyph.java
new file mode 100644 (file)
index 0000000..f5d9362
--- /dev/null
@@ -0,0 +1,233 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Discrete symbol - possibly graphically represented\r
+ *  \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Glyph extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * internal content storage\r
+     */\r
+    private java.lang.String _content = "";\r
+\r
+    /**\r
+     * specifies the symbol dictionary for this\r
+     *  glyph - eg utf8 (the default), aasecstr_3 or\r
+     *  kd_hydrophobicity - the content is not validated so\r
+     *  applications must ensure they gracefully deal with\r
+     *  invalid entries here \r
+     */\r
+    private java.lang.String _dict = "utf8";\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Glyph() \r
+     {\r
+        super();\r
+        setContent("");\r
+        setDict("utf8");\r
+    } //-- org.vamsas.objects.core.Glyph()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Glyph) {\r
+        \r
+            Glyph temp = (Glyph)obj;\r
+            if (this._content != null) {\r
+                if (temp._content == null) return false;\r
+                else if (!(this._content.equals(temp._content))) \r
+                    return false;\r
+            }\r
+            else if (temp._content != null)\r
+                return false;\r
+            if (this._dict != null) {\r
+                if (temp._dict == null) return false;\r
+                else if (!(this._dict.equals(temp._dict))) \r
+                    return false;\r
+            }\r
+            else if (temp._dict != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'content'. The field 'content'\r
+     * has the following description: internal content storage\r
+     * \r
+     * @return String\r
+     * @return the value of field 'content'.\r
+     */\r
+    public java.lang.String getContent()\r
+    {\r
+        return this._content;\r
+    } //-- java.lang.String getContent() \r
+\r
+    /**\r
+     * Returns the value of field 'dict'. The field 'dict' has the\r
+     * following description: specifies the symbol dictionary for\r
+     * this\r
+     *  glyph - eg utf8 (the default), aasecstr_3 or\r
+     *  kd_hydrophobicity - the content is not validated so\r
+     *  applications must ensure they gracefully deal with\r
+     *  invalid entries here \r
+     * \r
+     * @return String\r
+     * @return the value of field 'dict'.\r
+     */\r
+    public java.lang.String getDict()\r
+    {\r
+        return this._dict;\r
+    } //-- java.lang.String getDict() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'content'. The field 'content' has\r
+     * the following description: internal content storage\r
+     * \r
+     * @param content the value of field 'content'.\r
+     */\r
+    public void setContent(java.lang.String content)\r
+    {\r
+        this._content = content;\r
+    } //-- void setContent(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'dict'. The field 'dict' has the\r
+     * following description: specifies the symbol dictionary for\r
+     * this\r
+     *  glyph - eg utf8 (the default), aasecstr_3 or\r
+     *  kd_hydrophobicity - the content is not validated so\r
+     *  applications must ensure they gracefully deal with\r
+     *  invalid entries here \r
+     * \r
+     * @param dict the value of field 'dict'.\r
+     */\r
+    public void setDict(java.lang.String dict)\r
+    {\r
+        this._dict = dict;\r
+    } //-- void setDict(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Glyph\r
+     */\r
+    public static org.vamsas.objects.core.Glyph unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Glyph) Unmarshaller.unmarshal(org.vamsas.objects.core.Glyph.class, reader);\r
+    } //-- org.vamsas.objects.core.Glyph unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/GlyphDescriptor.java b/src/org/vamsas/objects/core/GlyphDescriptor.java
new file mode 100644 (file)
index 0000000..e1d6966
--- /dev/null
@@ -0,0 +1,244 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class GlyphDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class GlyphDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public GlyphDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "glyph";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- _content\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Glyph target = (Glyph) object;\r
+                return target.getContent();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Glyph target = (Glyph) object;\r
+                    target.setContent( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _content\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _dict\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dict", "dict", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Glyph target = (Glyph) object;\r
+                return target.getDict();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Glyph target = (Glyph) object;\r
+                    target.setDict( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _dict\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.GlyphDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Glyph.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Input.java b/src/org/vamsas/objects/core/Input.java
new file mode 100644 (file)
index 0000000..4743d67
--- /dev/null
@@ -0,0 +1,219 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Input.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Input extends org.vamsas.objects.core.RangeType \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * Reference Frame for rangeType specfication\r
+     *  \r
+     */\r
+    private java.lang.Object _objRef;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Input() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Input()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Input) {\r
+        \r
+            Input temp = (Input)obj;\r
+            if (this._name != null) {\r
+                if (temp._name == null) return false;\r
+                else if (!(this._name.equals(temp._name))) \r
+                    return false;\r
+            }\r
+            else if (temp._name != null)\r
+                return false;\r
+            if (this._objRef != null) {\r
+                if (temp._objRef == null) return false;\r
+                else if (!(this._objRef.equals(temp._objRef))) \r
+                    return false;\r
+            }\r
+            else if (temp._objRef != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'objRef'. The field 'objRef' has\r
+     * the following description: Reference Frame for rangeType\r
+     * specfication\r
+     *  \r
+     * \r
+     * @return Object\r
+     * @return the value of field 'objRef'.\r
+     */\r
+    public java.lang.Object getObjRef()\r
+    {\r
+        return this._objRef;\r
+    } //-- java.lang.Object getObjRef() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'objRef'. The field 'objRef' has the\r
+     * following description: Reference Frame for rangeType\r
+     * specfication\r
+     *  \r
+     * \r
+     * @param objRef the value of field 'objRef'.\r
+     */\r
+    public void setObjRef(java.lang.Object objRef)\r
+    {\r
+        this._objRef = objRef;\r
+    } //-- void setObjRef(java.lang.Object) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return RangeType\r
+     */\r
+    public static org.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Input) Unmarshaller.unmarshal(org.vamsas.objects.core.Input.class, reader);\r
+    } //-- org.vamsas.objects.core.RangeType unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/InputDescriptor.java b/src/org/vamsas/objects/core/InputDescriptor.java
new file mode 100644 (file)
index 0000000..56cc4b5
--- /dev/null
@@ -0,0 +1,247 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class InputDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class InputDescriptor extends org.vamsas.objects.core.RangeTypeDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public InputDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.RangeTypeDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "input";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Input target = (Input) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Input target = (Input) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _objRef\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_objRef", "objRef", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setReference(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Input target = (Input) object;\r
+                return target.getObjRef();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Input target = (Input) object;\r
+                    target.setObjRef( (java.lang.Object) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.Object();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _objRef\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.InputDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Input.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Instance.java b/src/org/vamsas/objects/core/Instance.java
new file mode 100644 (file)
index 0000000..037d035
--- /dev/null
@@ -0,0 +1,179 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Instance.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Instance extends org.vamsas.objects.core.AppData \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _urn\r
+     */\r
+    private java.lang.String _urn;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Instance() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Instance()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Instance) {\r
+        \r
+            Instance temp = (Instance)obj;\r
+            if (this._urn != null) {\r
+                if (temp._urn == null) return false;\r
+                else if (!(this._urn.equals(temp._urn))) \r
+                    return false;\r
+            }\r
+            else if (temp._urn != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'urn'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'urn'.\r
+     */\r
+    public java.lang.String getUrn()\r
+    {\r
+        return this._urn;\r
+    } //-- java.lang.String getUrn() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'urn'.\r
+     * \r
+     * @param urn the value of field 'urn'.\r
+     */\r
+    public void setUrn(java.lang.String urn)\r
+    {\r
+        this._urn = urn;\r
+    } //-- void setUrn(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return AppData\r
+     */\r
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Instance) Unmarshaller.unmarshal(org.vamsas.objects.core.Instance.class, reader);\r
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/InstanceDescriptor.java b/src/org/vamsas/objects/core/InstanceDescriptor.java
new file mode 100644 (file)
index 0000000..0fdec55
--- /dev/null
@@ -0,0 +1,213 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class InstanceDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class InstanceDescriptor extends org.vamsas.objects.core.AppDataDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public InstanceDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.AppDataDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "Instance";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _urn\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_urn", "urn", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Instance target = (Instance) object;\r
+                return target.getUrn();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Instance target = (Instance) object;\r
+                    target.setUrn( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _urn\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.InstanceDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Instance.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Link.java b/src/org/vamsas/objects/core/Link.java
new file mode 100644 (file)
index 0000000..1330cff
--- /dev/null
@@ -0,0 +1,217 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Link.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Link extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * internal content storage\r
+     */\r
+    private java.lang.String _content = "";\r
+\r
+    /**\r
+     * The URI\r
+     */\r
+    private java.lang.String _href;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Link() \r
+     {\r
+        super();\r
+        setContent("");\r
+    } //-- org.vamsas.objects.core.Link()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Link) {\r
+        \r
+            Link temp = (Link)obj;\r
+            if (this._content != null) {\r
+                if (temp._content == null) return false;\r
+                else if (!(this._content.equals(temp._content))) \r
+                    return false;\r
+            }\r
+            else if (temp._content != null)\r
+                return false;\r
+            if (this._href != null) {\r
+                if (temp._href == null) return false;\r
+                else if (!(this._href.equals(temp._href))) \r
+                    return false;\r
+            }\r
+            else if (temp._href != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'content'. The field 'content'\r
+     * has the following description: internal content storage\r
+     * \r
+     * @return String\r
+     * @return the value of field 'content'.\r
+     */\r
+    public java.lang.String getContent()\r
+    {\r
+        return this._content;\r
+    } //-- java.lang.String getContent() \r
+\r
+    /**\r
+     * Returns the value of field 'href'. The field 'href' has the\r
+     * following description: The URI\r
+     * \r
+     * @return String\r
+     * @return the value of field 'href'.\r
+     */\r
+    public java.lang.String getHref()\r
+    {\r
+        return this._href;\r
+    } //-- java.lang.String getHref() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'content'. The field 'content' has\r
+     * the following description: internal content storage\r
+     * \r
+     * @param content the value of field 'content'.\r
+     */\r
+    public void setContent(java.lang.String content)\r
+    {\r
+        this._content = content;\r
+    } //-- void setContent(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'href'. The field 'href' has the\r
+     * following description: The URI\r
+     * \r
+     * @param href the value of field 'href'.\r
+     */\r
+    public void setHref(java.lang.String href)\r
+    {\r
+        this._href = href;\r
+    } //-- void setHref(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Link\r
+     */\r
+    public static org.vamsas.objects.core.Link unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Link) Unmarshaller.unmarshal(org.vamsas.objects.core.Link.class, reader);\r
+    } //-- org.vamsas.objects.core.Link unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/LinkDescriptor.java b/src/org/vamsas/objects/core/LinkDescriptor.java
new file mode 100644 (file)
index 0000000..659278d
--- /dev/null
@@ -0,0 +1,240 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class LinkDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class LinkDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public LinkDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "link";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- _content\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Link target = (Link) object;\r
+                return target.getContent();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Link target = (Link) object;\r
+                    target.setContent( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _content\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _href\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_href", "href", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Link target = (Link) object;\r
+                return target.getHref();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Link target = (Link) object;\r
+                    target.setHref( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.String();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _href\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.LinkDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Link.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/LockFile.java b/src/org/vamsas/objects/core/LockFile.java
new file mode 100644 (file)
index 0000000..a26bbe2
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class LockFile.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class LockFile extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * internal content storage
+     */
+    private java.lang.String _content = "";
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public LockFile() 
+     {
+        super();
+        setContent("");
+    } //-- org.vamsas.objects.core.LockFile()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof LockFile) {
+        
+            LockFile temp = (LockFile)obj;
+            if (this._content != null) {
+                if (temp._content == null) return false;
+                else if (!(this._content.equals(temp._content))) 
+                    return false;
+            }
+            else if (temp._content != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'content'. The field 'content'
+     * has the following description: internal content storage
+     * 
+     * @return String
+     * @return the value of field 'content'.
+     */
+    public java.lang.String getContent()
+    {
+        return this._content;
+    } //-- java.lang.String getContent() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Sets the value of field 'content'. The field 'content' has
+     * the following description: internal content storage
+     * 
+     * @param content the value of field 'content'.
+     */
+    public void setContent(java.lang.String content)
+    {
+        this._content = content;
+    } //-- void setContent(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return LockFile
+     */
+    public static org.vamsas.objects.core.LockFile unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.LockFile) Unmarshaller.unmarshal(org.vamsas.objects.core.LockFile.class, reader);
+    } //-- org.vamsas.objects.core.LockFile unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/LockFileDescriptor.java b/src/org/vamsas/objects/core/LockFileDescriptor.java
new file mode 100644 (file)
index 0000000..b837f28
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class LockFileDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class LockFileDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public LockFileDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.ac.uk/vamsasDocument";
+        xmlName = "LockFile";
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- _content
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                LockFile target = (LockFile) object;
+                return target.getContent();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    LockFile target = (LockFile) object;
+                    target.setContent( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _content
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize attribute descriptors
+        
+        //-- initialize element descriptors
+        
+    } //-- org.vamsas.objects.core.LockFileDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.LockFile.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Map.java b/src/org/vamsas/objects/core/Map.java
new file mode 100644 (file)
index 0000000..38bab4b
--- /dev/null
@@ -0,0 +1,151 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * From: Offset to first\r
+ *  position in dataset sequence record that\r
+ *  this database entry maps to To: Offset\r
+ *  to last position in dataset sequence\r
+ *  record that this database entry maps to\r
+ *  Start: Offset to first last position in\r
+ *  database entry that first (or offset)\r
+ *  position in sequence maps to End: Offset\r
+ *  to last position in database entry that\r
+ *  last (offset) position in sequence maps\r
+ *  to \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Map extends org.vamsas.objects.core.MapList \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Map() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Map()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Map) {\r
+        \r
+            Map temp = (Map)obj;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return MapList\r
+     */\r
+    public static org.vamsas.objects.core.MapList unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Map) Unmarshaller.unmarshal(org.vamsas.objects.core.Map.class, reader);\r
+    } //-- org.vamsas.objects.core.MapList unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/MapDescriptor.java b/src/org/vamsas/objects/core/MapDescriptor.java
new file mode 100644 (file)
index 0000000..a4c5123
--- /dev/null
@@ -0,0 +1,167 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class MapDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class MapDescriptor extends org.vamsas.objects.core.MapListDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public MapDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.MapListDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "map";\r
+    } //-- org.vamsas.objects.core.MapDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Map.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/MapList.java b/src/org/vamsas/objects/core/MapList.java
new file mode 100644 (file)
index 0000000..608ee58
--- /dev/null
@@ -0,0 +1,404 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class MapList.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class MapList extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Offset to first position in dataset sequence record that\r
+     * start\r
+     *  position on 'onto' maps to \r
+     */\r
+    private int _from = 0;\r
+\r
+    /**\r
+     * keeps track of state for field: _from\r
+     */\r
+    private boolean _has_from;\r
+\r
+    /**\r
+     * Offset to last position in dataset sequence record that end\r
+     *  position on 'onto' maps to \r
+     */\r
+    private int _to = 0;\r
+\r
+    /**\r
+     * keeps track of state for field: _to\r
+     */\r
+    private boolean _has_to;\r
+\r
+    /**\r
+     * Offset to first position in database entry that first (or\r
+     * offset)\r
+     *  position in sequence maps to \r
+     */\r
+    private int _start;\r
+\r
+    /**\r
+     * keeps track of state for field: _start\r
+     */\r
+    private boolean _has_start;\r
+\r
+    /**\r
+     * Offset to last position in database entry that last (offset)\r
+     *  position in sequence maps to \r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public MapList() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.MapList()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteFrom\r
+     * \r
+     */\r
+    public void deleteFrom()\r
+    {\r
+        this._has_from= false;\r
+    } //-- void deleteFrom() \r
+\r
+    /**\r
+     * Method deleteStart\r
+     * \r
+     */\r
+    public void deleteStart()\r
+    {\r
+        this._has_start= false;\r
+    } //-- void deleteStart() \r
+\r
+    /**\r
+     * Method deleteTo\r
+     * \r
+     */\r
+    public void deleteTo()\r
+    {\r
+        this._has_to= false;\r
+    } //-- void deleteTo() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof MapList) {\r
+        \r
+            MapList temp = (MapList)obj;\r
+            if (this._from != temp._from)\r
+                return false;\r
+            if (this._has_from != temp._has_from)\r
+                return false;\r
+            if (this._to != temp._to)\r
+                return false;\r
+            if (this._has_to != temp._has_to)\r
+                return false;\r
+            if (this._start != temp._start)\r
+                return false;\r
+            if (this._has_start != temp._has_start)\r
+                return false;\r
+            if (this._end != temp._end)\r
+                return false;\r
+            if (this._has_end != temp._has_end)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'end'. The field 'end' has the\r
+     * following description: Offset to last position in database\r
+     * entry that last (offset)\r
+     *  position in sequence maps to \r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'from'. The field 'from' has the\r
+     * following description: Offset to first position in dataset\r
+     * sequence record that start\r
+     *  position on 'onto' maps to \r
+     * \r
+     * @return int\r
+     * @return the value of field 'from'.\r
+     */\r
+    public int getFrom()\r
+    {\r
+        return this._from;\r
+    } //-- int getFrom() \r
+\r
+    /**\r
+     * Returns the value of field 'start'. The field 'start' has\r
+     * the following description: Offset to first position in\r
+     * database entry that first (or offset)\r
+     *  position in sequence maps to \r
+     * \r
+     * @return int\r
+     * @return the value of field 'start'.\r
+     */\r
+    public int getStart()\r
+    {\r
+        return this._start;\r
+    } //-- int getStart() \r
+\r
+    /**\r
+     * Returns the value of field 'to'. The field 'to' has the\r
+     * following description: Offset to last position in dataset\r
+     * sequence record that end\r
+     *  position on 'onto' maps to \r
+     * \r
+     * @return int\r
+     * @return the value of field 'to'.\r
+     */\r
+    public int getTo()\r
+    {\r
+        return this._to;\r
+    } //-- int getTo() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasFrom\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFrom()\r
+    {\r
+        return this._has_from;\r
+    } //-- boolean hasFrom() \r
+\r
+    /**\r
+     * Method hasStart\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStart()\r
+    {\r
+        return this._has_start;\r
+    } //-- boolean hasStart() \r
+\r
+    /**\r
+     * Method hasTo\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasTo()\r
+    {\r
+        return this._has_to;\r
+    } //-- boolean hasTo() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'end'. The field 'end' has the\r
+     * following description: Offset to last position in database\r
+     * entry that last (offset)\r
+     *  position in sequence maps to \r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'from'. The field 'from' has the\r
+     * following description: Offset to first position in dataset\r
+     * sequence record that start\r
+     *  position on 'onto' maps to \r
+     * \r
+     * @param from the value of field 'from'.\r
+     */\r
+    public void setFrom(int from)\r
+    {\r
+        this._from = from;\r
+        this._has_from = true;\r
+    } //-- void setFrom(int) \r
+\r
+    /**\r
+     * Sets the value of field 'start'. The field 'start' has the\r
+     * following description: Offset to first position in database\r
+     * entry that first (or offset)\r
+     *  position in sequence maps to \r
+     * \r
+     * @param start the value of field 'start'.\r
+     */\r
+    public void setStart(int start)\r
+    {\r
+        this._start = start;\r
+        this._has_start = true;\r
+    } //-- void setStart(int) \r
+\r
+    /**\r
+     * Sets the value of field 'to'. The field 'to' has the\r
+     * following description: Offset to last position in dataset\r
+     * sequence record that end\r
+     *  position on 'onto' maps to \r
+     * \r
+     * @param to the value of field 'to'.\r
+     */\r
+    public void setTo(int to)\r
+    {\r
+        this._to = to;\r
+        this._has_to = true;\r
+    } //-- void setTo(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return MapList\r
+     */\r
+    public static org.vamsas.objects.core.MapList unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.MapList) Unmarshaller.unmarshal(org.vamsas.objects.core.MapList.class, reader);\r
+    } //-- org.vamsas.objects.core.MapList unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/MapListDescriptor.java b/src/org/vamsas/objects/core/MapListDescriptor.java
new file mode 100644 (file)
index 0000000..4d46e41
--- /dev/null
@@ -0,0 +1,339 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class MapListDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class MapListDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public MapListDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "mapList";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _from\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_from", "from", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                MapList target = (MapList) object;\r
+                if(!target.hasFrom())\r
+                    return null;\r
+                return new java.lang.Integer(target.getFrom());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    MapList target = (MapList) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFrom();\r
+                        return;\r
+                    }\r
+                    target.setFrom( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _from\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator = new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _to\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_to", "to", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                MapList target = (MapList) object;\r
+                if(!target.hasTo())\r
+                    return null;\r
+                return new java.lang.Integer(target.getTo());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    MapList target = (MapList) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteTo();\r
+                        return;\r
+                    }\r
+                    target.setTo( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _to\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator = new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _start\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                MapList target = (MapList) object;\r
+                if(!target.hasStart())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStart());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    MapList target = (MapList) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setStart( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _start\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator = new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                MapList target = (MapList) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    MapList target = (MapList) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator = new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.MapListDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.MapList.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Mapping.java b/src/org/vamsas/objects/core/Mapping.java
new file mode 100644 (file)
index 0000000..e68ad1d
--- /dev/null
@@ -0,0 +1,186 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Mapping.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Mapping extends org.vamsas.objects.core.MapList \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * object to which the mapping is being mapped\r
+     *  \r
+     */\r
+    private java.lang.Object _onto;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Mapping() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Mapping()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Mapping) {\r
+        \r
+            Mapping temp = (Mapping)obj;\r
+            if (this._onto != null) {\r
+                if (temp._onto == null) return false;\r
+                else if (!(this._onto.equals(temp._onto))) \r
+                    return false;\r
+            }\r
+            else if (temp._onto != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'onto'. The field 'onto' has the\r
+     * following description: object to which the mapping is being\r
+     * mapped\r
+     *  \r
+     * \r
+     * @return Object\r
+     * @return the value of field 'onto'.\r
+     */\r
+    public java.lang.Object getOnto()\r
+    {\r
+        return this._onto;\r
+    } //-- java.lang.Object getOnto() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'onto'. The field 'onto' has the\r
+     * following description: object to which the mapping is being\r
+     * mapped\r
+     *  \r
+     * \r
+     * @param onto the value of field 'onto'.\r
+     */\r
+    public void setOnto(java.lang.Object onto)\r
+    {\r
+        this._onto = onto;\r
+    } //-- void setOnto(java.lang.Object) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return MapList\r
+     */\r
+    public static org.vamsas.objects.core.MapList unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Mapping) Unmarshaller.unmarshal(org.vamsas.objects.core.Mapping.class, reader);\r
+    } //-- org.vamsas.objects.core.MapList unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/MappingDescriptor.java b/src/org/vamsas/objects/core/MappingDescriptor.java
new file mode 100644 (file)
index 0000000..95a6cbb
--- /dev/null
@@ -0,0 +1,210 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class MappingDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class MappingDescriptor extends org.vamsas.objects.core.MapListDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public MappingDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.MapListDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "mapping";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _onto\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Object.class, "_onto", "onto", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setReference(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Mapping target = (Mapping) object;\r
+                return target.getOnto();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Mapping target = (Mapping) object;\r
+                    target.setOnto( (java.lang.Object) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.Object();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _onto\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.MappingDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Mapping.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Newick.java b/src/org/vamsas/objects/core/Newick.java
new file mode 100644 (file)
index 0000000..2c60f61
--- /dev/null
@@ -0,0 +1,288 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Newick.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Newick extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * internal content storage
+     */
+    private java.lang.String _content = "";
+
+    /**
+     * Field _title
+     */
+    private java.lang.String _title;
+
+    /**
+     * Primary Key for vamsas object referencing
+     *  
+     */
+    private java.lang.String _id;
+
+    /**
+     * Field _modifiable
+     */
+    private java.lang.String _modifiable;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Newick() 
+     {
+        super();
+        setContent("");
+    } //-- org.vamsas.objects.core.Newick()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Newick) {
+        
+            Newick temp = (Newick)obj;
+            if (this._content != null) {
+                if (temp._content == null) return false;
+                else if (!(this._content.equals(temp._content))) 
+                    return false;
+            }
+            else if (temp._content != null)
+                return false;
+            if (this._title != null) {
+                if (temp._title == null) return false;
+                else if (!(this._title.equals(temp._title))) 
+                    return false;
+            }
+            else if (temp._title != null)
+                return false;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._modifiable != null) {
+                if (temp._modifiable == null) return false;
+                else if (!(this._modifiable.equals(temp._modifiable))) 
+                    return false;
+            }
+            else if (temp._modifiable != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'content'. The field 'content'
+     * has the following description: internal content storage
+     * 
+     * @return String
+     * @return the value of field 'content'.
+     */
+    public java.lang.String getContent()
+    {
+        return this._content;
+    } //-- java.lang.String getContent() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'modifiable'.
+     * 
+     * @return String
+     * @return the value of field 'modifiable'.
+     */
+    public java.lang.String getModifiable()
+    {
+        return this._modifiable;
+    } //-- java.lang.String getModifiable() 
+
+    /**
+     * Returns the value of field 'title'.
+     * 
+     * @return String
+     * @return the value of field 'title'.
+     */
+    public java.lang.String getTitle()
+    {
+        return this._title;
+    } //-- java.lang.String getTitle() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Sets the value of field 'content'. The field 'content' has
+     * the following description: internal content storage
+     * 
+     * @param content the value of field 'content'.
+     */
+    public void setContent(java.lang.String content)
+    {
+        this._content = content;
+    } //-- void setContent(java.lang.String) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'modifiable'.
+     * 
+     * @param modifiable the value of field 'modifiable'.
+     */
+    public void setModifiable(java.lang.String modifiable)
+    {
+        this._modifiable = modifiable;
+    } //-- void setModifiable(java.lang.String) 
+
+    /**
+     * Sets the value of field 'title'.
+     * 
+     * @param title the value of field 'title'.
+     */
+    public void setTitle(java.lang.String title)
+    {
+        this._title = title;
+    } //-- void setTitle(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Newick
+     */
+    public static org.vamsas.objects.core.Newick unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Newick) Unmarshaller.unmarshal(org.vamsas.objects.core.Newick.class, reader);
+    } //-- org.vamsas.objects.core.Newick unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/NewickDescriptor.java b/src/org/vamsas/objects/core/NewickDescriptor.java
new file mode 100644 (file)
index 0000000..d56a141
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class NewickDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class NewickDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public NewickDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "newick";
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- _content
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Newick target = (Newick) object;
+                return target.getContent();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Newick target = (Newick) object;
+                    target.setContent( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _content
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize attribute descriptors
+        
+        //-- _title
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Newick target = (Newick) object;
+                return target.getTitle();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Newick target = (Newick) object;
+                    target.setTitle( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _title
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Newick target = (Newick) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Newick target = (Newick) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _modifiable
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Newick target = (Newick) object;
+                return target.getModifiable();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Newick target = (Newick) object;
+                    target.setModifiable( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _modifiable
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+    } //-- org.vamsas.objects.core.NewickDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Newick.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Param.java b/src/org/vamsas/objects/core/Param.java
new file mode 100644 (file)
index 0000000..b7c2ab5
--- /dev/null
@@ -0,0 +1,261 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Param.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Param extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * internal content storage\r
+     */\r
+    private java.lang.String _content = "";\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * The type specifies how the property will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     */\r
+    private java.lang.String _type;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Param() \r
+     {\r
+        super();\r
+        setContent("");\r
+    } //-- org.vamsas.objects.core.Param()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Param) {\r
+        \r
+            Param temp = (Param)obj;\r
+            if (this._content != null) {\r
+                if (temp._content == null) return false;\r
+                else if (!(this._content.equals(temp._content))) \r
+                    return false;\r
+            }\r
+            else if (temp._content != null)\r
+                return false;\r
+            if (this._name != null) {\r
+                if (temp._name == null) return false;\r
+                else if (!(this._name.equals(temp._name))) \r
+                    return false;\r
+            }\r
+            else if (temp._name != null)\r
+                return false;\r
+            if (this._type != null) {\r
+                if (temp._type == null) return false;\r
+                else if (!(this._type.equals(temp._type))) \r
+                    return false;\r
+            }\r
+            else if (temp._type != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'content'. The field 'content'\r
+     * has the following description: internal content storage\r
+     * \r
+     * @return String\r
+     * @return the value of field 'content'.\r
+     */\r
+    public java.lang.String getContent()\r
+    {\r
+        return this._content;\r
+    } //-- java.lang.String getContent() \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'type'. The field 'type' has the\r
+     * following description: The type specifies how the property\r
+     * will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'content'. The field 'content' has\r
+     * the following description: internal content storage\r
+     * \r
+     * @param content the value of field 'content'.\r
+     */\r
+    public void setContent(java.lang.String content)\r
+    {\r
+        this._content = content;\r
+    } //-- void setContent(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'type'. The field 'type' has the\r
+     * following description: The type specifies how the property\r
+     * will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Param\r
+     */\r
+    public static org.vamsas.objects.core.Param unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Param) Unmarshaller.unmarshal(org.vamsas.objects.core.Param.class, reader);\r
+    } //-- org.vamsas.objects.core.Param unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/ParamDescriptor.java b/src/org/vamsas/objects/core/ParamDescriptor.java
new file mode 100644 (file)
index 0000000..d049192
--- /dev/null
@@ -0,0 +1,285 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class ParamDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ParamDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ParamDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "param";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- _content\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Param target = (Param) object;\r
+                return target.getContent();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Param target = (Param) object;\r
+                    target.setContent( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _content\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Param target = (Param) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Param target = (Param) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Param target = (Param) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Param target = (Param) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.ParamDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Param.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Pos.java b/src/org/vamsas/objects/core/Pos.java
new file mode 100644 (file)
index 0000000..5053f98
--- /dev/null
@@ -0,0 +1,204 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * a position within the associated object's coordinate system\r
+ *  \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Pos extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _i\r
+     */\r
+    private int _i;\r
+\r
+    /**\r
+     * keeps track of state for field: _i\r
+     */\r
+    private boolean _has_i;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Pos() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Pos()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteI\r
+     * \r
+     */\r
+    public void deleteI()\r
+    {\r
+        this._has_i= false;\r
+    } //-- void deleteI() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Pos) {\r
+        \r
+            Pos temp = (Pos)obj;\r
+            if (this._i != temp._i)\r
+                return false;\r
+            if (this._has_i != temp._has_i)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'i'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'i'.\r
+     */\r
+    public int getI()\r
+    {\r
+        return this._i;\r
+    } //-- int getI() \r
+\r
+    /**\r
+     * Method hasI\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasI()\r
+    {\r
+        return this._has_i;\r
+    } //-- boolean hasI() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'i'.\r
+     * \r
+     * @param i the value of field 'i'.\r
+     */\r
+    public void setI(int i)\r
+    {\r
+        this._i = i;\r
+        this._has_i = true;\r
+    } //-- void setI(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Pos\r
+     */\r
+    public static org.vamsas.objects.core.Pos unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Pos) Unmarshaller.unmarshal(org.vamsas.objects.core.Pos.class, reader);\r
+    } //-- org.vamsas.objects.core.Pos unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/PosDescriptor.java b/src/org/vamsas/objects/core/PosDescriptor.java
new file mode 100644 (file)
index 0000000..fdfffc7
--- /dev/null
@@ -0,0 +1,213 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PosDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PosDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PosDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "pos";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _i\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_i", "i", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Pos target = (Pos) object;\r
+                if(!target.hasI())\r
+                    return null;\r
+                return new java.lang.Integer(target.getI());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Pos target = (Pos) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setI( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _i\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.PosDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Pos.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Property.java b/src/org/vamsas/objects/core/Property.java
new file mode 100644 (file)
index 0000000..fb4aacc
--- /dev/null
@@ -0,0 +1,261 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Property.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Property extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * internal content storage\r
+     */\r
+    private java.lang.String _content = "";\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * The type specifies how the property will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     */\r
+    private java.lang.String _type;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Property() \r
+     {\r
+        super();\r
+        setContent("");\r
+    } //-- org.vamsas.objects.core.Property()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Property) {\r
+        \r
+            Property temp = (Property)obj;\r
+            if (this._content != null) {\r
+                if (temp._content == null) return false;\r
+                else if (!(this._content.equals(temp._content))) \r
+                    return false;\r
+            }\r
+            else if (temp._content != null)\r
+                return false;\r
+            if (this._name != null) {\r
+                if (temp._name == null) return false;\r
+                else if (!(this._name.equals(temp._name))) \r
+                    return false;\r
+            }\r
+            else if (temp._name != null)\r
+                return false;\r
+            if (this._type != null) {\r
+                if (temp._type == null) return false;\r
+                else if (!(this._type.equals(temp._type))) \r
+                    return false;\r
+            }\r
+            else if (temp._type != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'content'. The field 'content'\r
+     * has the following description: internal content storage\r
+     * \r
+     * @return String\r
+     * @return the value of field 'content'.\r
+     */\r
+    public java.lang.String getContent()\r
+    {\r
+        return this._content;\r
+    } //-- java.lang.String getContent() \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'type'. The field 'type' has the\r
+     * following description: The type specifies how the property\r
+     * will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'content'. The field 'content' has\r
+     * the following description: internal content storage\r
+     * \r
+     * @param content the value of field 'content'.\r
+     */\r
+    public void setContent(java.lang.String content)\r
+    {\r
+        this._content = content;\r
+    } //-- void setContent(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'type'. The field 'type' has the\r
+     * following description: The type specifies how the property\r
+     * will be parsed.\r
+     *  Empty property strings are allowed, and can be used to\r
+     * prototype the\r
+     *  input to a document. TODO: specify allowed types \r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Property\r
+     */\r
+    public static org.vamsas.objects.core.Property unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Property) Unmarshaller.unmarshal(org.vamsas.objects.core.Property.class, reader);\r
+    } //-- org.vamsas.objects.core.Property unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/PropertyDescriptor.java b/src/org/vamsas/objects/core/PropertyDescriptor.java
new file mode 100644 (file)
index 0000000..bb80022
--- /dev/null
@@ -0,0 +1,285 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PropertyDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PropertyDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "property";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- _content\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Property target = (Property) object;\r
+                return target.getContent();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Property target = (Property) object;\r
+                    target.setContent( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _content\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Property target = (Property) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Property target = (Property) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Property target = (Property) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Property target = (Property) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.PropertyDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Property.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Provenance.java b/src/org/vamsas/objects/core/Provenance.java
new file mode 100644 (file)
index 0000000..e1f6b85
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Provenance.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Provenance extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field _entryList
+     */
+    private java.util.Vector _entryList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Provenance() 
+     {
+        super();
+        _entryList = new Vector();
+    } //-- org.vamsas.objects.core.Provenance()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addEntry
+     * 
+     * 
+     * 
+     * @param vEntry
+     */
+    public void addEntry(org.vamsas.objects.core.Entry vEntry)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _entryList.addElement(vEntry);
+    } //-- void addEntry(org.vamsas.objects.core.Entry) 
+
+    /**
+     * Method addEntry
+     * 
+     * 
+     * 
+     * @param index
+     * @param vEntry
+     */
+    public void addEntry(int index, org.vamsas.objects.core.Entry vEntry)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _entryList.insertElementAt(vEntry, index);
+    } //-- void addEntry(int, org.vamsas.objects.core.Entry) 
+
+    /**
+     * Method enumerateEntry
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateEntry()
+    {
+        return _entryList.elements();
+    } //-- java.util.Enumeration enumerateEntry() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Provenance) {
+        
+            Provenance temp = (Provenance)obj;
+            if (this._entryList != null) {
+                if (temp._entryList == null) return false;
+                else if (!(this._entryList.equals(temp._entryList))) 
+                    return false;
+            }
+            else if (temp._entryList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getEntry
+     * 
+     * 
+     * 
+     * @param index
+     * @return Entry
+     */
+    public org.vamsas.objects.core.Entry getEntry(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _entryList.size())) {
+            throw new IndexOutOfBoundsException("getEntry: Index value '"+index+"' not in range [0.."+_entryList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Entry) _entryList.elementAt(index);
+    } //-- org.vamsas.objects.core.Entry getEntry(int) 
+
+    /**
+     * Method getEntry
+     * 
+     * 
+     * 
+     * @return Entry
+     */
+    public org.vamsas.objects.core.Entry[] getEntry()
+    {
+        int size = _entryList.size();
+        org.vamsas.objects.core.Entry[] mArray = new org.vamsas.objects.core.Entry[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Entry) _entryList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Entry[] getEntry() 
+
+    /**
+     * Method getEntryCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getEntryCount()
+    {
+        return _entryList.size();
+    } //-- int getEntryCount() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllEntry
+     * 
+     */
+    public void removeAllEntry()
+    {
+        _entryList.removeAllElements();
+    } //-- void removeAllEntry() 
+
+    /**
+     * Method removeEntry
+     * 
+     * 
+     * 
+     * @param index
+     * @return Entry
+     */
+    public org.vamsas.objects.core.Entry removeEntry(int index)
+    {
+        java.lang.Object obj = _entryList.elementAt(index);
+        _entryList.removeElementAt(index);
+        return (org.vamsas.objects.core.Entry) obj;
+    } //-- org.vamsas.objects.core.Entry removeEntry(int) 
+
+    /**
+     * Method setEntry
+     * 
+     * 
+     * 
+     * @param index
+     * @param vEntry
+     */
+    public void setEntry(int index, org.vamsas.objects.core.Entry vEntry)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _entryList.size())) {
+            throw new IndexOutOfBoundsException("setEntry: Index value '"+index+"' not in range [0.."+_entryList.size()+ "]");
+        }
+        _entryList.setElementAt(vEntry, index);
+    } //-- void setEntry(int, org.vamsas.objects.core.Entry) 
+
+    /**
+     * Method setEntry
+     * 
+     * 
+     * 
+     * @param entryArray
+     */
+    public void setEntry(org.vamsas.objects.core.Entry[] entryArray)
+    {
+        //-- copy array
+        _entryList.removeAllElements();
+        for (int i = 0; i < entryArray.length; i++) {
+            _entryList.addElement(entryArray[i]);
+        }
+    } //-- void setEntry(org.vamsas.objects.core.Entry) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Provenance
+     */
+    public static org.vamsas.objects.core.Provenance unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Provenance) Unmarshaller.unmarshal(org.vamsas.objects.core.Provenance.class, reader);
+    } //-- org.vamsas.objects.core.Provenance unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/ProvenanceDescriptor.java b/src/org/vamsas/objects/core/ProvenanceDescriptor.java
new file mode 100644 (file)
index 0000000..a76c8ab
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class ProvenanceDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class ProvenanceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public ProvenanceDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "Provenance";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- initialize element descriptors
+        
+        //-- _entryList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Entry.class, "_entryList", "entry", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Provenance target = (Provenance) object;
+                return target.getEntry();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Provenance target = (Provenance) object;
+                    target.addEntry( (org.vamsas.objects.core.Entry) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Entry();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _entryList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.ProvenanceDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Provenance.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/RangeAnnotation.java b/src/org/vamsas/objects/core/RangeAnnotation.java
new file mode 100644 (file)
index 0000000..0dda140
--- /dev/null
@@ -0,0 +1,1093 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Annotation for a rangeSpec - values can be attached for the\r
+ * whole\r
+ *  specification, and to each position within the spec. following\r
+ * the orientation\r
+ *  specified by the ordered set of rangeSpec (pos, seg) elements. \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class RangeAnnotation extends org.vamsas.objects.core.RangeType \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Primary Key for vamsas object referencing\r
+     *  \r
+     */\r
+    private java.lang.String _id;\r
+\r
+    /**\r
+     * Field _modifiable\r
+     */\r
+    private java.lang.String _modifiable;\r
+\r
+    /**\r
+     * Annotation with the same non-empty group name are grouped\r
+     *  together \r
+     */\r
+    private java.lang.String _group = "";\r
+\r
+    /**\r
+     * A Das Feature has both a type and a Type ID. We go the\r
+     *  route of requiring the type string to be taken from a\r
+     * controlled\r
+     *  vocabulary if an application expects others to make sense\r
+     * of it. The\r
+     *  type may qualified - so uniprot:CHAIN is a valid type name,\r
+     * and\r
+     *  considered distinct from someotherDB:CHAIN \r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Short, meaningful name for the annotation - if this\r
+     *  is absent, then the type string should be used in its\r
+     * place.\r
+     *  \r
+     */\r
+    private java.lang.String _label;\r
+\r
+    /**\r
+     * Human readable description of the annotation\r
+     *  \r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * TODO: specify this - we have considered taking the GO\r
+     *  evidence codes as a model for assessing a measure of\r
+     * quality to an\r
+     *  annotation. \r
+     */\r
+    private java.lang.String _status;\r
+\r
+    /**\r
+     * Annotation Element position maps to ordered positions\r
+     *  defined by the sequence of rangeType pos positions or\r
+     * concatenated\r
+     *  seg start/end segments. \r
+     */\r
+    private java.util.Vector _annotationElementList;\r
+\r
+    /**\r
+     * Ordered set of optionally named float values for the\r
+     *  whole annotation \r
+     */\r
+    private java.util.Vector _scoreList;\r
+\r
+    /**\r
+     * Field _linkList\r
+     */\r
+    private java.util.Vector _linkList;\r
+\r
+    /**\r
+     * Note:These are mutable so an application should check\r
+     *  them each time. \r
+     */\r
+    private java.util.Vector _propertyList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public RangeAnnotation() \r
+     {\r
+        super();\r
+        setGroup("");\r
+        _annotationElementList = new Vector();\r
+        _scoreList = new Vector();\r
+        _linkList = new Vector();\r
+        _propertyList = new Vector();\r
+    } //-- org.vamsas.objects.core.RangeAnnotation()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param vAnnotationElement\r
+     */\r
+    public void addAnnotationElement(org.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationElementList.addElement(vAnnotationElement);\r
+    } //-- void addAnnotationElement(org.vamsas.objects.core.AnnotationElement) \r
+\r
+    /**\r
+     * Method addAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotationElement\r
+     */\r
+    public void addAnnotationElement(int index, org.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationElementList.insertElementAt(vAnnotationElement, index);\r
+    } //-- void addAnnotationElement(int, org.vamsas.objects.core.AnnotationElement) \r
+\r
+    /**\r
+     * Method addLink\r
+     * \r
+     * \r
+     * \r
+     * @param vLink\r
+     */\r
+    public void addLink(org.vamsas.objects.core.Link vLink)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _linkList.addElement(vLink);\r
+    } //-- void addLink(org.vamsas.objects.core.Link) \r
+\r
+    /**\r
+     * Method addLink\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vLink\r
+     */\r
+    public void addLink(int index, org.vamsas.objects.core.Link vLink)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _linkList.insertElementAt(vLink, index);\r
+    } //-- void addLink(int, org.vamsas.objects.core.Link) \r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param vProperty\r
+     */\r
+    public void addProperty(org.vamsas.objects.core.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.addElement(vProperty);\r
+    } //-- void addProperty(org.vamsas.objects.core.Property) \r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.insertElementAt(vProperty, index);\r
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) \r
+\r
+    /**\r
+     * Method addScore\r
+     * \r
+     * \r
+     * \r
+     * @param vScore\r
+     */\r
+    public void addScore(org.vamsas.objects.core.Score vScore)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _scoreList.addElement(vScore);\r
+    } //-- void addScore(org.vamsas.objects.core.Score) \r
+\r
+    /**\r
+     * Method addScore\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vScore\r
+     */\r
+    public void addScore(int index, org.vamsas.objects.core.Score vScore)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _scoreList.insertElementAt(vScore, index);\r
+    } //-- void addScore(int, org.vamsas.objects.core.Score) \r
+\r
+    /**\r
+     * Method enumerateAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateAnnotationElement()\r
+    {\r
+        return _annotationElementList.elements();\r
+    } //-- java.util.Enumeration enumerateAnnotationElement() \r
+\r
+    /**\r
+     * Method enumerateLink\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateLink()\r
+    {\r
+        return _linkList.elements();\r
+    } //-- java.util.Enumeration enumerateLink() \r
+\r
+    /**\r
+     * Method enumerateProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateProperty()\r
+    {\r
+        return _propertyList.elements();\r
+    } //-- java.util.Enumeration enumerateProperty() \r
+\r
+    /**\r
+     * Method enumerateScore\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateScore()\r
+    {\r
+        return _scoreList.elements();\r
+    } //-- java.util.Enumeration enumerateScore() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof RangeAnnotation) {\r
+        \r
+            RangeAnnotation temp = (RangeAnnotation)obj;\r
+            if (this._id != null) {\r
+                if (temp._id == null) return false;\r
+                else if (!(this._id.equals(temp._id))) \r
+                    return false;\r
+            }\r
+            else if (temp._id != null)\r
+                return false;\r
+            if (this._modifiable != null) {\r
+                if (temp._modifiable == null) return false;\r
+                else if (!(this._modifiable.equals(temp._modifiable))) \r
+                    return false;\r
+            }\r
+            else if (temp._modifiable != null)\r
+                return false;\r
+            if (this._group != null) {\r
+                if (temp._group == null) return false;\r
+                else if (!(this._group.equals(temp._group))) \r
+                    return false;\r
+            }\r
+            else if (temp._group != null)\r
+                return false;\r
+            if (this._type != null) {\r
+                if (temp._type == null) return false;\r
+                else if (!(this._type.equals(temp._type))) \r
+                    return false;\r
+            }\r
+            else if (temp._type != null)\r
+                return false;\r
+            if (this._label != null) {\r
+                if (temp._label == null) return false;\r
+                else if (!(this._label.equals(temp._label))) \r
+                    return false;\r
+            }\r
+            else if (temp._label != null)\r
+                return false;\r
+            if (this._description != null) {\r
+                if (temp._description == null) return false;\r
+                else if (!(this._description.equals(temp._description))) \r
+                    return false;\r
+            }\r
+            else if (temp._description != null)\r
+                return false;\r
+            if (this._status != null) {\r
+                if (temp._status == null) return false;\r
+                else if (!(this._status.equals(temp._status))) \r
+                    return false;\r
+            }\r
+            else if (temp._status != null)\r
+                return false;\r
+            if (this._annotationElementList != null) {\r
+                if (temp._annotationElementList == null) return false;\r
+                else if (!(this._annotationElementList.equals(temp._annotationElementList))) \r
+                    return false;\r
+            }\r
+            else if (temp._annotationElementList != null)\r
+                return false;\r
+            if (this._scoreList != null) {\r
+                if (temp._scoreList == null) return false;\r
+                else if (!(this._scoreList.equals(temp._scoreList))) \r
+                    return false;\r
+            }\r
+            else if (temp._scoreList != null)\r
+                return false;\r
+            if (this._linkList != null) {\r
+                if (temp._linkList == null) return false;\r
+                else if (!(this._linkList.equals(temp._linkList))) \r
+                    return false;\r
+            }\r
+            else if (temp._linkList != null)\r
+                return false;\r
+            if (this._propertyList != null) {\r
+                if (temp._propertyList == null) return false;\r
+                else if (!(this._propertyList.equals(temp._propertyList))) \r
+                    return false;\r
+            }\r
+            else if (temp._propertyList != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Method getAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return AnnotationElement\r
+     */\r
+    public org.vamsas.objects.core.AnnotationElement getAnnotationElement(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationElementList.size())) {\r
+            throw new IndexOutOfBoundsException("getAnnotationElement: Index value '"+index+"' not in range [0.."+_annotationElementList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.AnnotationElement) _annotationElementList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.AnnotationElement getAnnotationElement(int) \r
+\r
+    /**\r
+     * Method getAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @return AnnotationElement\r
+     */\r
+    public org.vamsas.objects.core.AnnotationElement[] getAnnotationElement()\r
+    {\r
+        int size = _annotationElementList.size();\r
+        org.vamsas.objects.core.AnnotationElement[] mArray = new org.vamsas.objects.core.AnnotationElement[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.AnnotationElement) _annotationElementList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.AnnotationElement[] getAnnotationElement() \r
+\r
+    /**\r
+     * Method getAnnotationElementCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getAnnotationElementCount()\r
+    {\r
+        return _annotationElementList.size();\r
+    } //-- int getAnnotationElementCount() \r
+\r
+    /**\r
+     * Returns the value of field 'description'. The field\r
+     * 'description' has the following description: Human readable\r
+     * description of the annotation\r
+     *  \r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'group'. The field 'group' has\r
+     * the following description: Annotation with the same\r
+     * non-empty group name are grouped\r
+     *  together \r
+     * \r
+     * @return String\r
+     * @return the value of field 'group'.\r
+     */\r
+    public java.lang.String getGroup()\r
+    {\r
+        return this._group;\r
+    } //-- java.lang.String getGroup() \r
+\r
+    /**\r
+     * Returns the value of field 'id'. The field 'id' has the\r
+     * following description: Primary Key for vamsas object\r
+     * referencing\r
+     *  \r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Returns the value of field 'label'. The field 'label' has\r
+     * the following description: Short, meaningful name for the\r
+     * annotation - if this\r
+     *  is absent, then the type string should be used in its\r
+     * place.\r
+     *  \r
+     * \r
+     * @return String\r
+     * @return the value of field 'label'.\r
+     */\r
+    public java.lang.String getLabel()\r
+    {\r
+        return this._label;\r
+    } //-- java.lang.String getLabel() \r
+\r
+    /**\r
+     * Method getLink\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Link\r
+     */\r
+    public org.vamsas.objects.core.Link getLink(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _linkList.size())) {\r
+            throw new IndexOutOfBoundsException("getLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.Link) _linkList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.Link getLink(int) \r
+\r
+    /**\r
+     * Method getLink\r
+     * \r
+     * \r
+     * \r
+     * @return Link\r
+     */\r
+    public org.vamsas.objects.core.Link[] getLink()\r
+    {\r
+        int size = _linkList.size();\r
+        org.vamsas.objects.core.Link[] mArray = new org.vamsas.objects.core.Link[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.Link) _linkList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.Link[] getLink() \r
+\r
+    /**\r
+     * Method getLinkCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getLinkCount()\r
+    {\r
+        return _linkList.size();\r
+    } //-- int getLinkCount() \r
+\r
+    /**\r
+     * Returns the value of field 'modifiable'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'modifiable'.\r
+     */\r
+    public java.lang.String getModifiable()\r
+    {\r
+        return this._modifiable;\r
+    } //-- java.lang.String getModifiable() \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public org.vamsas.objects.core.Property getProperty(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.Property getProperty(int) \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Property\r
+     */\r
+    public org.vamsas.objects.core.Property[] getProperty()\r
+    {\r
+        int size = _propertyList.size();\r
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.Property[] getProperty() \r
+\r
+    /**\r
+     * Method getPropertyCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPropertyCount()\r
+    {\r
+        return _propertyList.size();\r
+    } //-- int getPropertyCount() \r
+\r
+    /**\r
+     * Method getScore\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Score\r
+     */\r
+    public org.vamsas.objects.core.Score getScore(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _scoreList.size())) {\r
+            throw new IndexOutOfBoundsException("getScore: Index value '"+index+"' not in range [0.."+_scoreList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.Score) _scoreList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.Score getScore(int) \r
+\r
+    /**\r
+     * Method getScore\r
+     * \r
+     * \r
+     * \r
+     * @return Score\r
+     */\r
+    public org.vamsas.objects.core.Score[] getScore()\r
+    {\r
+        int size = _scoreList.size();\r
+        org.vamsas.objects.core.Score[] mArray = new org.vamsas.objects.core.Score[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.Score) _scoreList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.Score[] getScore() \r
+\r
+    /**\r
+     * Method getScoreCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getScoreCount()\r
+    {\r
+        return _scoreList.size();\r
+    } //-- int getScoreCount() \r
+\r
+    /**\r
+     * Returns the value of field 'status'. The field 'status' has\r
+     * the following description: TODO: specify this - we have\r
+     * considered taking the GO\r
+     *  evidence codes as a model for assessing a measure of\r
+     * quality to an\r
+     *  annotation. \r
+     * \r
+     * @return String\r
+     * @return the value of field 'status'.\r
+     */\r
+    public java.lang.String getStatus()\r
+    {\r
+        return this._status;\r
+    } //-- java.lang.String getStatus() \r
+\r
+    /**\r
+     * Returns the value of field 'type'. The field 'type' has the\r
+     * following description: A Das Feature has both a type and a\r
+     * Type ID. We go the\r
+     *  route of requiring the type string to be taken from a\r
+     * controlled\r
+     *  vocabulary if an application expects others to make sense\r
+     * of it. The\r
+     *  type may qualified - so uniprot:CHAIN is a valid type name,\r
+     * and\r
+     *  considered distinct from someotherDB:CHAIN \r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllAnnotationElement\r
+     * \r
+     */\r
+    public void removeAllAnnotationElement()\r
+    {\r
+        _annotationElementList.removeAllElements();\r
+    } //-- void removeAllAnnotationElement() \r
+\r
+    /**\r
+     * Method removeAllLink\r
+     * \r
+     */\r
+    public void removeAllLink()\r
+    {\r
+        _linkList.removeAllElements();\r
+    } //-- void removeAllLink() \r
+\r
+    /**\r
+     * Method removeAllProperty\r
+     * \r
+     */\r
+    public void removeAllProperty()\r
+    {\r
+        _propertyList.removeAllElements();\r
+    } //-- void removeAllProperty() \r
+\r
+    /**\r
+     * Method removeAllScore\r
+     * \r
+     */\r
+    public void removeAllScore()\r
+    {\r
+        _scoreList.removeAllElements();\r
+    } //-- void removeAllScore() \r
+\r
+    /**\r
+     * Method removeAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return AnnotationElement\r
+     */\r
+    public org.vamsas.objects.core.AnnotationElement removeAnnotationElement(int index)\r
+    {\r
+        java.lang.Object obj = _annotationElementList.elementAt(index);\r
+        _annotationElementList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.AnnotationElement) obj;\r
+    } //-- org.vamsas.objects.core.AnnotationElement removeAnnotationElement(int) \r
+\r
+    /**\r
+     * Method removeLink\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Link\r
+     */\r
+    public org.vamsas.objects.core.Link removeLink(int index)\r
+    {\r
+        java.lang.Object obj = _linkList.elementAt(index);\r
+        _linkList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.Link) obj;\r
+    } //-- org.vamsas.objects.core.Link removeLink(int) \r
+\r
+    /**\r
+     * Method removeProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public org.vamsas.objects.core.Property removeProperty(int index)\r
+    {\r
+        java.lang.Object obj = _propertyList.elementAt(index);\r
+        _propertyList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.Property) obj;\r
+    } //-- org.vamsas.objects.core.Property removeProperty(int) \r
+\r
+    /**\r
+     * Method removeScore\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Score\r
+     */\r
+    public org.vamsas.objects.core.Score removeScore(int index)\r
+    {\r
+        java.lang.Object obj = _scoreList.elementAt(index);\r
+        _scoreList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.Score) obj;\r
+    } //-- org.vamsas.objects.core.Score removeScore(int) \r
+\r
+    /**\r
+     * Method setAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotationElement\r
+     */\r
+    public void setAnnotationElement(int index, org.vamsas.objects.core.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationElementList.size())) {\r
+            throw new IndexOutOfBoundsException("setAnnotationElement: Index value '"+index+"' not in range [0.."+_annotationElementList.size()+ "]");\r
+        }\r
+        _annotationElementList.setElementAt(vAnnotationElement, index);\r
+    } //-- void setAnnotationElement(int, org.vamsas.objects.core.AnnotationElement) \r
+\r
+    /**\r
+     * Method setAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param annotationElementArray\r
+     */\r
+    public void setAnnotationElement(org.vamsas.objects.core.AnnotationElement[] annotationElementArray)\r
+    {\r
+        //-- copy array\r
+        _annotationElementList.removeAllElements();\r
+        for (int i = 0; i < annotationElementArray.length; i++) {\r
+            _annotationElementList.addElement(annotationElementArray[i]);\r
+        }\r
+    } //-- void setAnnotationElement(org.vamsas.objects.core.AnnotationElement) \r
+\r
+    /**\r
+     * Sets the value of field 'description'. The field\r
+     * 'description' has the following description: Human readable\r
+     * description of the annotation\r
+     *  \r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'group'. The field 'group' has the\r
+     * following description: Annotation with the same non-empty\r
+     * group name are grouped\r
+     *  together \r
+     * \r
+     * @param group the value of field 'group'.\r
+     */\r
+    public void setGroup(java.lang.String group)\r
+    {\r
+        this._group = group;\r
+    } //-- void setGroup(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'id'. The field 'id' has the\r
+     * following description: Primary Key for vamsas object\r
+     * referencing\r
+     *  \r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'label'. The field 'label' has the\r
+     * following description: Short, meaningful name for the\r
+     * annotation - if this\r
+     *  is absent, then the type string should be used in its\r
+     * place.\r
+     *  \r
+     * \r
+     * @param label the value of field 'label'.\r
+     */\r
+    public void setLabel(java.lang.String label)\r
+    {\r
+        this._label = label;\r
+    } //-- void setLabel(java.lang.String) \r
+\r
+    /**\r
+     * Method setLink\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vLink\r
+     */\r
+    public void setLink(int index, org.vamsas.objects.core.Link vLink)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _linkList.size())) {\r
+            throw new IndexOutOfBoundsException("setLink: Index value '"+index+"' not in range [0.."+_linkList.size()+ "]");\r
+        }\r
+        _linkList.setElementAt(vLink, index);\r
+    } //-- void setLink(int, org.vamsas.objects.core.Link) \r
+\r
+    /**\r
+     * Method setLink\r
+     * \r
+     * \r
+     * \r
+     * @param linkArray\r
+     */\r
+    public void setLink(org.vamsas.objects.core.Link[] linkArray)\r
+    {\r
+        //-- copy array\r
+        _linkList.removeAllElements();\r
+        for (int i = 0; i < linkArray.length; i++) {\r
+            _linkList.addElement(linkArray[i]);\r
+        }\r
+    } //-- void setLink(org.vamsas.objects.core.Link) \r
+\r
+    /**\r
+     * Sets the value of field 'modifiable'.\r
+     * \r
+     * @param modifiable the value of field 'modifiable'.\r
+     */\r
+    public void setModifiable(java.lang.String modifiable)\r
+    {\r
+        this._modifiable = modifiable;\r
+    } //-- void setModifiable(java.lang.String) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");\r
+        }\r
+        _propertyList.setElementAt(vProperty, index);\r
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param propertyArray\r
+     */\r
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)\r
+    {\r
+        //-- copy array\r
+        _propertyList.removeAllElements();\r
+        for (int i = 0; i < propertyArray.length; i++) {\r
+            _propertyList.addElement(propertyArray[i]);\r
+        }\r
+    } //-- void setProperty(org.vamsas.objects.core.Property) \r
+\r
+    /**\r
+     * Method setScore\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vScore\r
+     */\r
+    public void setScore(int index, org.vamsas.objects.core.Score vScore)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _scoreList.size())) {\r
+            throw new IndexOutOfBoundsException("setScore: Index value '"+index+"' not in range [0.."+_scoreList.size()+ "]");\r
+        }\r
+        _scoreList.setElementAt(vScore, index);\r
+    } //-- void setScore(int, org.vamsas.objects.core.Score) \r
+\r
+    /**\r
+     * Method setScore\r
+     * \r
+     * \r
+     * \r
+     * @param scoreArray\r
+     */\r
+    public void setScore(org.vamsas.objects.core.Score[] scoreArray)\r
+    {\r
+        //-- copy array\r
+        _scoreList.removeAllElements();\r
+        for (int i = 0; i < scoreArray.length; i++) {\r
+            _scoreList.addElement(scoreArray[i]);\r
+        }\r
+    } //-- void setScore(org.vamsas.objects.core.Score) \r
+\r
+    /**\r
+     * Sets the value of field 'status'. The field 'status' has the\r
+     * following description: TODO: specify this - we have\r
+     * considered taking the GO\r
+     *  evidence codes as a model for assessing a measure of\r
+     * quality to an\r
+     *  annotation. \r
+     * \r
+     * @param status the value of field 'status'.\r
+     */\r
+    public void setStatus(java.lang.String status)\r
+    {\r
+        this._status = status;\r
+    } //-- void setStatus(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'type'. The field 'type' has the\r
+     * following description: A Das Feature has both a type and a\r
+     * Type ID. We go the\r
+     *  route of requiring the type string to be taken from a\r
+     * controlled\r
+     *  vocabulary if an application expects others to make sense\r
+     * of it. The\r
+     *  type may qualified - so uniprot:CHAIN is a valid type name,\r
+     * and\r
+     *  considered distinct from someotherDB:CHAIN \r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return RangeType\r
+     */\r
+    public static org.vamsas.objects.core.RangeType unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.RangeAnnotation) Unmarshaller.unmarshal(org.vamsas.objects.core.RangeAnnotation.class, reader);\r
+    } //-- org.vamsas.objects.core.RangeType unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java b/src/org/vamsas/objects/core/RangeAnnotationDescriptor.java
new file mode 100644 (file)
index 0000000..39bb29a
--- /dev/null
@@ -0,0 +1,578 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class RangeAnnotationDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class RangeAnnotationDescriptor extends org.vamsas.objects.core.RangeTypeDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public RangeAnnotationDescriptor() \r
+     {\r
+        super();\r
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.RangeTypeDescriptor());\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "rangeAnnotation";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        this.identity = desc;\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.lang.String();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _modifiable\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getModifiable();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setModifiable( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _modifiable\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _group\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_group", "group", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getGroup();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setGroup( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _group\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _label\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getLabel();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setLabel( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _label\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _description\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getDescription();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setDescription( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _description\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _status\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_status", "status", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getStatus();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.setStatus( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _status\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _annotationElementList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.AnnotationElement.class, "_annotationElementList", "annotationElement", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getAnnotationElement();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.addAnnotationElement( (org.vamsas.objects.core.AnnotationElement) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.AnnotationElement();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotationElementList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _scoreList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Score.class, "_scoreList", "score", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getScore();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.addScore( (org.vamsas.objects.core.Score) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.Score();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _scoreList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _linkList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Link.class, "_linkList", "link", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getLink();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.addLink( (org.vamsas.objects.core.Link) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.Link();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _linkList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _propertyList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeAnnotation target = (RangeAnnotation) object;\r
+                return target.getProperty();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeAnnotation target = (RangeAnnotation) object;\r
+                    target.addProperty( (org.vamsas.objects.core.Property) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new org.vamsas.objects.core.Property();\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _propertyList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- org.vamsas.objects.core.RangeAnnotationDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.RangeAnnotation.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/RangeType.java b/src/org/vamsas/objects/core/RangeType.java
new file mode 100644 (file)
index 0000000..c0d6571
--- /dev/null
@@ -0,0 +1,452 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+\r
+/**\r
+ * Specify an ordered set of positions and/or regions on the\r
+ * principle\r
+ *  dimension of some associated vamsas object Keeping to jaxb-1.0\r
+ * specification for the moment - this choice should\r
+ *  become a substitution group when we use jaxb-2.0 capable\r
+ * bindings\r
+ *  \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public abstract class RangeType extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Internal choice value storage\r
+     */\r
+    private java.lang.Object _choiceValue;\r
+\r
+    /**\r
+     * a position within the associated object's coordinate system\r
+     *  \r
+     */\r
+    private java.util.Vector _posList;\r
+\r
+    /**\r
+     * a region from start to end, with flag for inclusivity of\r
+     *  terminii \r
+     */\r
+    private java.util.Vector _segList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public RangeType() \r
+     {\r
+        super();\r
+        _posList = new Vector();\r
+        _segList = new Vector();\r
+    } //-- org.vamsas.objects.core.RangeType()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addPos\r
+     * \r
+     * \r
+     * \r
+     * @param vPos\r
+     */\r
+    public void addPos(org.vamsas.objects.core.Pos vPos)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _posList.addElement(vPos);\r
+    } //-- void addPos(org.vamsas.objects.core.Pos) \r
+\r
+    /**\r
+     * Method addPos\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPos\r
+     */\r
+    public void addPos(int index, org.vamsas.objects.core.Pos vPos)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _posList.insertElementAt(vPos, index);\r
+    } //-- void addPos(int, org.vamsas.objects.core.Pos) \r
+\r
+    /**\r
+     * Method addSeg\r
+     * \r
+     * \r
+     * \r
+     * @param vSeg\r
+     */\r
+    public void addSeg(org.vamsas.objects.core.Seg vSeg)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _segList.addElement(vSeg);\r
+    } //-- void addSeg(org.vamsas.objects.core.Seg) \r
+\r
+    /**\r
+     * Method addSeg\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSeg\r
+     */\r
+    public void addSeg(int index, org.vamsas.objects.core.Seg vSeg)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _segList.insertElementAt(vSeg, index);\r
+    } //-- void addSeg(int, org.vamsas.objects.core.Seg) \r
+\r
+    /**\r
+     * Method enumeratePos\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumeratePos()\r
+    {\r
+        return _posList.elements();\r
+    } //-- java.util.Enumeration enumeratePos() \r
+\r
+    /**\r
+     * Method enumerateSeg\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSeg()\r
+    {\r
+        return _segList.elements();\r
+    } //-- java.util.Enumeration enumerateSeg() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof RangeType) {\r
+        \r
+            RangeType temp = (RangeType)obj;\r
+            if (this._choiceValue != null) {\r
+                if (temp._choiceValue == null) return false;\r
+                else if (!(this._choiceValue.equals(temp._choiceValue))) \r
+                    return false;\r
+            }\r
+            else if (temp._choiceValue != null)\r
+                return false;\r
+            if (this._posList != null) {\r
+                if (temp._posList == null) return false;\r
+                else if (!(this._posList.equals(temp._posList))) \r
+                    return false;\r
+            }\r
+            else if (temp._posList != null)\r
+                return false;\r
+            if (this._segList != null) {\r
+                if (temp._segList == null) return false;\r
+                else if (!(this._segList.equals(temp._segList))) \r
+                    return false;\r
+            }\r
+            else if (temp._segList != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'choiceValue'. The field\r
+     * 'choiceValue' has the following description: Internal choice\r
+     * value storage\r
+     * \r
+     * @return Object\r
+     * @return the value of field 'choiceValue'.\r
+     */\r
+    public java.lang.Object getChoiceValue()\r
+    {\r
+        return this._choiceValue;\r
+    } //-- java.lang.Object getChoiceValue() \r
+\r
+    /**\r
+     * Method getPos\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pos\r
+     */\r
+    public org.vamsas.objects.core.Pos getPos(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _posList.size())) {\r
+            throw new IndexOutOfBoundsException("getPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.Pos) _posList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.Pos getPos(int) \r
+\r
+    /**\r
+     * Method getPos\r
+     * \r
+     * \r
+     * \r
+     * @return Pos\r
+     */\r
+    public org.vamsas.objects.core.Pos[] getPos()\r
+    {\r
+        int size = _posList.size();\r
+        org.vamsas.objects.core.Pos[] mArray = new org.vamsas.objects.core.Pos[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.Pos) _posList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.Pos[] getPos() \r
+\r
+    /**\r
+     * Method getPosCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPosCount()\r
+    {\r
+        return _posList.size();\r
+    } //-- int getPosCount() \r
+\r
+    /**\r
+     * Method getSeg\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Seg\r
+     */\r
+    public org.vamsas.objects.core.Seg getSeg(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _segList.size())) {\r
+            throw new IndexOutOfBoundsException("getSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");\r
+        }\r
+        \r
+        return (org.vamsas.objects.core.Seg) _segList.elementAt(index);\r
+    } //-- org.vamsas.objects.core.Seg getSeg(int) \r
+\r
+    /**\r
+     * Method getSeg\r
+     * \r
+     * \r
+     * \r
+     * @return Seg\r
+     */\r
+    public org.vamsas.objects.core.Seg[] getSeg()\r
+    {\r
+        int size = _segList.size();\r
+        org.vamsas.objects.core.Seg[] mArray = new org.vamsas.objects.core.Seg[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (org.vamsas.objects.core.Seg) _segList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- org.vamsas.objects.core.Seg[] getSeg() \r
+\r
+    /**\r
+     * Method getSegCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSegCount()\r
+    {\r
+        return _segList.size();\r
+    } //-- int getSegCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method removeAllPos\r
+     * \r
+     */\r
+    public void removeAllPos()\r
+    {\r
+        _posList.removeAllElements();\r
+    } //-- void removeAllPos() \r
+\r
+    /**\r
+     * Method removeAllSeg\r
+     * \r
+     */\r
+    public void removeAllSeg()\r
+    {\r
+        _segList.removeAllElements();\r
+    } //-- void removeAllSeg() \r
+\r
+    /**\r
+     * Method removePos\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pos\r
+     */\r
+    public org.vamsas.objects.core.Pos removePos(int index)\r
+    {\r
+        java.lang.Object obj = _posList.elementAt(index);\r
+        _posList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.Pos) obj;\r
+    } //-- org.vamsas.objects.core.Pos removePos(int) \r
+\r
+    /**\r
+     * Method removeSeg\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Seg\r
+     */\r
+    public org.vamsas.objects.core.Seg removeSeg(int index)\r
+    {\r
+        java.lang.Object obj = _segList.elementAt(index);\r
+        _segList.removeElementAt(index);\r
+        return (org.vamsas.objects.core.Seg) obj;\r
+    } //-- org.vamsas.objects.core.Seg removeSeg(int) \r
+\r
+    /**\r
+     * Method setPos\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPos\r
+     */\r
+    public void setPos(int index, org.vamsas.objects.core.Pos vPos)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _posList.size())) {\r
+            throw new IndexOutOfBoundsException("setPos: Index value '"+index+"' not in range [0.."+_posList.size()+ "]");\r
+        }\r
+        _posList.setElementAt(vPos, index);\r
+    } //-- void setPos(int, org.vamsas.objects.core.Pos) \r
+\r
+    /**\r
+     * Method setPos\r
+     * \r
+     * \r
+     * \r
+     * @param posArray\r
+     */\r
+    public void setPos(org.vamsas.objects.core.Pos[] posArray)\r
+    {\r
+        //-- copy array\r
+        _posList.removeAllElements();\r
+        for (int i = 0; i < posArray.length; i++) {\r
+            _posList.addElement(posArray[i]);\r
+        }\r
+    } //-- void setPos(org.vamsas.objects.core.Pos) \r
+\r
+    /**\r
+     * Method setSeg\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSeg\r
+     */\r
+    public void setSeg(int index, org.vamsas.objects.core.Seg vSeg)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _segList.size())) {\r
+            throw new IndexOutOfBoundsException("setSeg: Index value '"+index+"' not in range [0.."+_segList.size()+ "]");\r
+        }\r
+        _segList.setElementAt(vSeg, index);\r
+    } //-- void setSeg(int, org.vamsas.objects.core.Seg) \r
+\r
+    /**\r
+     * Method setSeg\r
+     * \r
+     * \r
+     * \r
+     * @param segArray\r
+     */\r
+    public void setSeg(org.vamsas.objects.core.Seg[] segArray)\r
+    {\r
+        //-- copy array\r
+        _segList.removeAllElements();\r
+        for (int i = 0; i < segArray.length; i++) {\r
+            _segList.addElement(segArray[i]);\r
+        }\r
+    } //-- void setSeg(org.vamsas.objects.core.Seg) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/RangeTypeDescriptor.java b/src/org/vamsas/objects/core/RangeTypeDescriptor.java
new file mode 100644 (file)
index 0000000..20f0de9
--- /dev/null
@@ -0,0 +1,246 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class RangeTypeDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class RangeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public RangeTypeDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "rangeType";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsChoice();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _posList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Pos.class, "_posList", "pos", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeType target = (RangeType) object;\r
+                return target.getPos();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeType target = (RangeType) object;\r
+                    target.addPos( (org.vamsas.objects.core.Pos) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _posList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _segList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Seg.class, "_segList", "seg", org.exolab.castor.xml.NodeType.Element);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                RangeType target = (RangeType) object;\r
+                return target.getSeg();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    RangeType target = (RangeType) object;\r
+                    target.addSeg( (org.vamsas.objects.core.Seg) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("http://www.vamsas.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _segList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- org.vamsas.objects.core.RangeTypeDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.RangeType.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Score.java b/src/org/vamsas/objects/core/Score.java
new file mode 100644 (file)
index 0000000..cb294f3
--- /dev/null
@@ -0,0 +1,240 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Ordered set of optionally named float values for the\r
+ *  whole annotation \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Score extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * internal content storage\r
+     */\r
+    private float _content;\r
+\r
+    /**\r
+     * keeps track of state for field: _content\r
+     */\r
+    private boolean _has_content;\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name = "score";\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Score() \r
+     {\r
+        super();\r
+        setName("score");\r
+    } //-- org.vamsas.objects.core.Score()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteContent\r
+     * \r
+     */\r
+    public void deleteContent()\r
+    {\r
+        this._has_content= false;\r
+    } //-- void deleteContent() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Score) {\r
+        \r
+            Score temp = (Score)obj;\r
+            if (this._content != temp._content)\r
+                return false;\r
+            if (this._has_content != temp._has_content)\r
+                return false;\r
+            if (this._name != null) {\r
+                if (temp._name == null) return false;\r
+                else if (!(this._name.equals(temp._name))) \r
+                    return false;\r
+            }\r
+            else if (temp._name != null)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'content'. The field 'content'\r
+     * has the following description: internal content storage\r
+     * \r
+     * @return float\r
+     * @return the value of field 'content'.\r
+     */\r
+    public float getContent()\r
+    {\r
+        return this._content;\r
+    } //-- float getContent() \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Method hasContent\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasContent()\r
+    {\r
+        return this._has_content;\r
+    } //-- boolean hasContent() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'content'. The field 'content' has\r
+     * the following description: internal content storage\r
+     * \r
+     * @param content the value of field 'content'.\r
+     */\r
+    public void setContent(float content)\r
+    {\r
+        this._content = content;\r
+        this._has_content = true;\r
+    } //-- void setContent(float) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Score\r
+     */\r
+    public static org.vamsas.objects.core.Score unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Score) Unmarshaller.unmarshal(org.vamsas.objects.core.Score.class, reader);\r
+    } //-- org.vamsas.objects.core.Score unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/ScoreDescriptor.java b/src/org/vamsas/objects/core/ScoreDescriptor.java
new file mode 100644 (file)
index 0000000..c9c1eda
--- /dev/null
@@ -0,0 +1,249 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class ScoreDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ScoreDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ScoreDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "score";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- _content\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Score target = (Score) object;\r
+                if(!target.hasContent())\r
+                    return null;\r
+                return new java.lang.Float(target.getContent());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Score target = (Score) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteContent();\r
+                        return;\r
+                    }\r
+                    target.setContent( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _content\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Score target = (Score) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Score target = (Score) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.ScoreDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Score.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Seg.java b/src/org/vamsas/objects/core/Seg.java
new file mode 100644 (file)
index 0000000..5e36703
--- /dev/null
@@ -0,0 +1,331 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * a region from start to end, with flag for inclusivity of\r
+ *  terminii \r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Seg extends org.vamsas.client.Vobject \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _start\r
+     */\r
+    private int _start;\r
+\r
+    /**\r
+     * keeps track of state for field: _start\r
+     */\r
+    private boolean _has_start;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+    /**\r
+     * when false, a consecutive range like 'start=1, end=2'\r
+     *  means the region lying after position 1 and before position\r
+     * 2\r
+     *  \r
+     */\r
+    private boolean _inclusive;\r
+\r
+    /**\r
+     * keeps track of state for field: _inclusive\r
+     */\r
+    private boolean _has_inclusive;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Seg() \r
+     {\r
+        super();\r
+    } //-- org.vamsas.objects.core.Seg()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteInclusive\r
+     * \r
+     */\r
+    public void deleteInclusive()\r
+    {\r
+        this._has_inclusive= false;\r
+    } //-- void deleteInclusive() \r
+\r
+    /**\r
+     * Method deleteStart\r
+     * \r
+     */\r
+    public void deleteStart()\r
+    {\r
+        this._has_start= false;\r
+    } //-- void deleteStart() \r
+\r
+    /**\r
+     * Note: hashCode() has not been overriden\r
+     * \r
+     * @param obj\r
+     * @return boolean\r
+     */\r
+    public boolean equals(java.lang.Object obj)\r
+    {\r
+        if ( this == obj )\r
+            return true;\r
+        \r
+        if (super.equals(obj)==false)\r
+            return false;\r
+        \r
+        if (obj instanceof Seg) {\r
+        \r
+            Seg temp = (Seg)obj;\r
+            if (this._start != temp._start)\r
+                return false;\r
+            if (this._has_start != temp._has_start)\r
+                return false;\r
+            if (this._end != temp._end)\r
+                return false;\r
+            if (this._has_end != temp._has_end)\r
+                return false;\r
+            if (this._inclusive != temp._inclusive)\r
+                return false;\r
+            if (this._has_inclusive != temp._has_inclusive)\r
+                return false;\r
+            return true;\r
+        }\r
+        return false;\r
+    } //-- boolean equals(java.lang.Object) \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'inclusive'. The field\r
+     * 'inclusive' has the following description: when false, a\r
+     * consecutive range like 'start=1, end=2'\r
+     *  means the region lying after position 1 and before position\r
+     * 2\r
+     *  \r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'inclusive'.\r
+     */\r
+    public boolean getInclusive()\r
+    {\r
+        return this._inclusive;\r
+    } //-- boolean getInclusive() \r
+\r
+    /**\r
+     * Returns the value of field 'start'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'start'.\r
+     */\r
+    public int getStart()\r
+    {\r
+        return this._start;\r
+    } //-- int getStart() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasInclusive\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasInclusive()\r
+    {\r
+        return this._has_inclusive;\r
+    } //-- boolean hasInclusive() \r
+\r
+    /**\r
+     * Method hasStart\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStart()\r
+    {\r
+        return this._has_start;\r
+    } //-- boolean hasStart() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'inclusive'. The field 'inclusive'\r
+     * has the following description: when false, a consecutive\r
+     * range like 'start=1, end=2'\r
+     *  means the region lying after position 1 and before position\r
+     * 2\r
+     *  \r
+     * \r
+     * @param inclusive the value of field 'inclusive'.\r
+     */\r
+    public void setInclusive(boolean inclusive)\r
+    {\r
+        this._inclusive = inclusive;\r
+        this._has_inclusive = true;\r
+    } //-- void setInclusive(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'start'.\r
+     * \r
+     * @param start the value of field 'start'.\r
+     */\r
+    public void setStart(int start)\r
+    {\r
+        this._start = start;\r
+        this._has_start = true;\r
+    } //-- void setStart(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Seg\r
+     */\r
+    public static org.vamsas.objects.core.Seg unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (org.vamsas.objects.core.Seg) Unmarshaller.unmarshal(org.vamsas.objects.core.Seg.class, reader);\r
+    } //-- org.vamsas.objects.core.Seg unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/SegDescriptor.java b/src/org/vamsas/objects/core/SegDescriptor.java
new file mode 100644 (file)
index 0000000..41a423c
--- /dev/null
@@ -0,0 +1,297 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package org.vamsas.objects.core;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class SegDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SegDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SegDescriptor() \r
+     {\r
+        super();\r
+        nsURI = "http://www.vamsas.org";\r
+        xmlName = "seg";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.mapping.FieldHandler             handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _start\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Seg target = (Seg) object;\r
+                if(!target.hasStart())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStart());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Seg target = (Seg) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setStart( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _start\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Seg target = (Seg) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Seg target = (Seg) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _inclusive\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_inclusive", "inclusive", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Seg target = (Seg) object;\r
+                if(!target.hasInclusive())\r
+                    return null;\r
+                return (target.getInclusive() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Seg target = (Seg) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setInclusive( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        };\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _inclusive\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- org.vamsas.objects.core.SegDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return org.vamsas.objects.core.Seg.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/org/vamsas/objects/core/Sequence.java b/src/org/vamsas/objects/core/Sequence.java
new file mode 100644 (file)
index 0000000..66dc569
--- /dev/null
@@ -0,0 +1,387 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Sequence.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Sequence extends org.vamsas.objects.core.SequenceType 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object referencing
+     *  
+     */
+    private java.lang.String _id;
+
+    /**
+     * symbol class for sequence
+     *  
+     */
+    private java.lang.String _dictionary;
+
+    /**
+     * Store a list of database references
+     *  for this sequence record - with optional mapping
+     *  from database sequence to the given sequence record 
+     */
+    private java.util.Vector _dbRefList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Sequence() 
+     {
+        super();
+        _dbRefList = new Vector();
+    } //-- org.vamsas.objects.core.Sequence()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addDbRef
+     * 
+     * 
+     * 
+     * @param vDbRef
+     */
+    public void addDbRef(org.vamsas.objects.core.DbRef vDbRef)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dbRefList.addElement(vDbRef);
+    } //-- void addDbRef(org.vamsas.objects.core.DbRef) 
+
+    /**
+     * Method addDbRef
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDbRef
+     */
+    public void addDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dbRefList.insertElementAt(vDbRef, index);
+    } //-- void addDbRef(int, org.vamsas.objects.core.DbRef) 
+
+    /**
+     * Method enumerateDbRef
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateDbRef()
+    {
+        return _dbRefList.elements();
+    } //-- java.util.Enumeration enumerateDbRef() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Sequence) {
+        
+            Sequence temp = (Sequence)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._dictionary != null) {
+                if (temp._dictionary == null) return false;
+                else if (!(this._dictionary.equals(temp._dictionary))) 
+                    return false;
+            }
+            else if (temp._dictionary != null)
+                return false;
+            if (this._dbRefList != null) {
+                if (temp._dbRefList == null) return false;
+                else if (!(this._dbRefList.equals(temp._dbRefList))) 
+                    return false;
+            }
+            else if (temp._dbRefList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getDbRef
+     * 
+     * 
+     * 
+     * @param index
+     * @return DbRef
+     */
+    public org.vamsas.objects.core.DbRef getDbRef(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dbRefList.size())) {
+            throw new IndexOutOfBoundsException("getDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
+    } //-- org.vamsas.objects.core.DbRef getDbRef(int) 
+
+    /**
+     * Method getDbRef
+     * 
+     * 
+     * 
+     * @return DbRef
+     */
+    public org.vamsas.objects.core.DbRef[] getDbRef()
+    {
+        int size = _dbRefList.size();
+        org.vamsas.objects.core.DbRef[] mArray = new org.vamsas.objects.core.DbRef[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.DbRef) _dbRefList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.DbRef[] getDbRef() 
+
+    /**
+     * Method getDbRefCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getDbRefCount()
+    {
+        return _dbRefList.size();
+    } //-- int getDbRefCount() 
+
+    /**
+     * Returns the value of field 'dictionary'. The field
+     * 'dictionary' has the following description: symbol class for
+     * sequence
+     *  
+     * 
+     * @return String
+     * @return the value of field 'dictionary'.
+     */
+    public java.lang.String getDictionary()
+    {
+        return this._dictionary;
+    } //-- java.lang.String getDictionary() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllDbRef
+     * 
+     */
+    public void removeAllDbRef()
+    {
+        _dbRefList.removeAllElements();
+    } //-- void removeAllDbRef() 
+
+    /**
+     * Method removeDbRef
+     * 
+     * 
+     * 
+     * @param index
+     * @return DbRef
+     */
+    public org.vamsas.objects.core.DbRef removeDbRef(int index)
+    {
+        java.lang.Object obj = _dbRefList.elementAt(index);
+        _dbRefList.removeElementAt(index);
+        return (org.vamsas.objects.core.DbRef) obj;
+    } //-- org.vamsas.objects.core.DbRef removeDbRef(int) 
+
+    /**
+     * Method setDbRef
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDbRef
+     */
+    public void setDbRef(int index, org.vamsas.objects.core.DbRef vDbRef)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dbRefList.size())) {
+            throw new IndexOutOfBoundsException("setDbRef: Index value '"+index+"' not in range [0.."+_dbRefList.size()+ "]");
+        }
+        _dbRefList.setElementAt(vDbRef, index);
+    } //-- void setDbRef(int, org.vamsas.objects.core.DbRef) 
+
+    /**
+     * Method setDbRef
+     * 
+     * 
+     * 
+     * @param dbRefArray
+     */
+    public void setDbRef(org.vamsas.objects.core.DbRef[] dbRefArray)
+    {
+        //-- copy array
+        _dbRefList.removeAllElements();
+        for (int i = 0; i < dbRefArray.length; i++) {
+            _dbRefList.addElement(dbRefArray[i]);
+        }
+    } //-- void setDbRef(org.vamsas.objects.core.DbRef) 
+
+    /**
+     * Sets the value of field 'dictionary'. The field 'dictionary'
+     * has the following description: symbol class for sequence
+     *  
+     * 
+     * @param dictionary the value of field 'dictionary'.
+     */
+    public void setDictionary(java.lang.String dictionary)
+    {
+        this._dictionary = dictionary;
+    } //-- void setDictionary(java.lang.String) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing
+     *  
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return SequenceType
+     */
+    public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Sequence) Unmarshaller.unmarshal(org.vamsas.objects.core.Sequence.class, reader);
+    } //-- org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/SequenceDescriptor.java b/src/org/vamsas/objects/core/SequenceDescriptor.java
new file mode 100644 (file)
index 0000000..440d8e0
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class SequenceDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class SequenceDescriptor extends org.vamsas.objects.core.SequenceTypeDescriptor {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public SequenceDescriptor() 
+     {
+        super();
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.SequenceTypeDescriptor());
+        nsURI = "http://www.vamsas.org";
+        xmlName = "Sequence";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Sequence target = (Sequence) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Sequence target = (Sequence) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _dictionary
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_dictionary", "dictionary", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Sequence target = (Sequence) object;
+                return target.getDictionary();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Sequence target = (Sequence) object;
+                    target.setDictionary( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _dictionary
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _dbRefList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.DbRef.class, "_dbRefList", "dbRef", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Sequence target = (Sequence) object;
+                return target.getDbRef();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Sequence target = (Sequence) object;
+                    target.addDbRef( (org.vamsas.objects.core.DbRef) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.DbRef();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _dbRefList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.SequenceDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return super.getExtends();
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        if (identity == null)
+            return super.getIdentity();
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Sequence.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/SequenceType.java b/src/org/vamsas/objects/core/SequenceType.java
new file mode 100644 (file)
index 0000000..96fba5b
--- /dev/null
@@ -0,0 +1,677 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class SequenceType.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class SequenceType extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field _start
+     */
+    private int _start;
+
+    /**
+     * keeps track of state for field: _start
+     */
+    private boolean _has_start;
+
+    /**
+     * Field _end
+     */
+    private int _end;
+
+    /**
+     * keeps track of state for field: _end
+     */
+    private boolean _has_end;
+
+    /**
+     * Field _sequence
+     */
+    private java.lang.String _sequence;
+
+    /**
+     * Field _name
+     */
+    private java.lang.String _name;
+
+    /**
+     * Field _description
+     */
+    private java.lang.String _description;
+
+    /**
+     * additional typed properties 
+     */
+    private java.util.Vector _propertyList;
+
+    /**
+     * Field _mappingList
+     */
+    private java.util.Vector _mappingList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public SequenceType() 
+     {
+        super();
+        _propertyList = new Vector();
+        _mappingList = new Vector();
+    } //-- org.vamsas.objects.core.SequenceType()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addMapping
+     * 
+     * 
+     * 
+     * @param vMapping
+     */
+    public void addMapping(org.vamsas.objects.core.Mapping vMapping)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _mappingList.addElement(vMapping);
+    } //-- void addMapping(org.vamsas.objects.core.Mapping) 
+
+    /**
+     * Method addMapping
+     * 
+     * 
+     * 
+     * @param index
+     * @param vMapping
+     */
+    public void addMapping(int index, org.vamsas.objects.core.Mapping vMapping)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _mappingList.insertElementAt(vMapping, index);
+    } //-- void addMapping(int, org.vamsas.objects.core.Mapping) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method deleteEnd
+     * 
+     */
+    public void deleteEnd()
+    {
+        this._has_end= false;
+    } //-- void deleteEnd() 
+
+    /**
+     * Method deleteStart
+     * 
+     */
+    public void deleteStart()
+    {
+        this._has_start= false;
+    } //-- void deleteStart() 
+
+    /**
+     * Method enumerateMapping
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateMapping()
+    {
+        return _mappingList.elements();
+    } //-- java.util.Enumeration enumerateMapping() 
+
+    /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof SequenceType) {
+        
+            SequenceType temp = (SequenceType)obj;
+            if (this._start != temp._start)
+                return false;
+            if (this._has_start != temp._has_start)
+                return false;
+            if (this._end != temp._end)
+                return false;
+            if (this._has_end != temp._has_end)
+                return false;
+            if (this._sequence != null) {
+                if (temp._sequence == null) return false;
+                else if (!(this._sequence.equals(temp._sequence))) 
+                    return false;
+            }
+            else if (temp._sequence != null)
+                return false;
+            if (this._name != null) {
+                if (temp._name == null) return false;
+                else if (!(this._name.equals(temp._name))) 
+                    return false;
+            }
+            else if (temp._name != null)
+                return false;
+            if (this._description != null) {
+                if (temp._description == null) return false;
+                else if (!(this._description.equals(temp._description))) 
+                    return false;
+            }
+            else if (temp._description != null)
+                return false;
+            if (this._propertyList != null) {
+                if (temp._propertyList == null) return false;
+                else if (!(this._propertyList.equals(temp._propertyList))) 
+                    return false;
+            }
+            else if (temp._propertyList != null)
+                return false;
+            if (this._mappingList != null) {
+                if (temp._mappingList == null) return false;
+                else if (!(this._mappingList.equals(temp._mappingList))) 
+                    return false;
+            }
+            else if (temp._mappingList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'description'.
+     * 
+     * @return String
+     * @return the value of field 'description'.
+     */
+    public java.lang.String getDescription()
+    {
+        return this._description;
+    } //-- java.lang.String getDescription() 
+
+    /**
+     * Returns the value of field 'end'.
+     * 
+     * @return int
+     * @return the value of field 'end'.
+     */
+    public int getEnd()
+    {
+        return this._end;
+    } //-- int getEnd() 
+
+    /**
+     * Method getMapping
+     * 
+     * 
+     * 
+     * @param index
+     * @return Mapping
+     */
+    public org.vamsas.objects.core.Mapping getMapping(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _mappingList.size())) {
+            throw new IndexOutOfBoundsException("getMapping: Index value '"+index+"' not in range [0.."+_mappingList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Mapping) _mappingList.elementAt(index);
+    } //-- org.vamsas.objects.core.Mapping getMapping(int) 
+
+    /**
+     * Method getMapping
+     * 
+     * 
+     * 
+     * @return Mapping
+     */
+    public org.vamsas.objects.core.Mapping[] getMapping()
+    {
+        int size = _mappingList.size();
+        org.vamsas.objects.core.Mapping[] mArray = new org.vamsas.objects.core.Mapping[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Mapping) _mappingList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Mapping[] getMapping() 
+
+    /**
+     * Method getMappingCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getMappingCount()
+    {
+        return _mappingList.size();
+    } //-- int getMappingCount() 
+
+    /**
+     * Returns the value of field 'name'.
+     * 
+     * @return String
+     * @return the value of field 'name'.
+     */
+    public java.lang.String getName()
+    {
+        return this._name;
+    } //-- java.lang.String getName() 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property getProperty(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Property[] getProperty() 
+
+    /**
+     * Method getPropertyCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getPropertyCount()
+    {
+        return _propertyList.size();
+    } //-- int getPropertyCount() 
+
+    /**
+     * Returns the value of field 'sequence'.
+     * 
+     * @return String
+     * @return the value of field 'sequence'.
+     */
+    public java.lang.String getSequence()
+    {
+        return this._sequence;
+    } //-- java.lang.String getSequence() 
+
+    /**
+     * Returns the value of field 'start'.
+     * 
+     * @return int
+     * @return the value of field 'start'.
+     */
+    public int getStart()
+    {
+        return this._start;
+    } //-- int getStart() 
+
+    /**
+     * Method hasEnd
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasEnd()
+    {
+        return this._has_end;
+    } //-- boolean hasEnd() 
+
+    /**
+     * Method hasStart
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasStart()
+    {
+        return this._has_start;
+    } //-- boolean hasStart() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllMapping
+     * 
+     */
+    public void removeAllMapping()
+    {
+        _mappingList.removeAllElements();
+    } //-- void removeAllMapping() 
+
+    /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
+     * Method removeMapping
+     * 
+     * 
+     * 
+     * @param index
+     * @return Mapping
+     */
+    public org.vamsas.objects.core.Mapping removeMapping(int index)
+    {
+        java.lang.Object obj = _mappingList.elementAt(index);
+        _mappingList.removeElementAt(index);
+        return (org.vamsas.objects.core.Mapping) obj;
+    } //-- org.vamsas.objects.core.Mapping removeMapping(int) 
+
+    /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
+     * Sets the value of field 'description'.
+     * 
+     * @param description the value of field 'description'.
+     */
+    public void setDescription(java.lang.String description)
+    {
+        this._description = description;
+    } //-- void setDescription(java.lang.String) 
+
+    /**
+     * Sets the value of field 'end'.
+     * 
+     * @param end the value of field 'end'.
+     */
+    public void setEnd(int end)
+    {
+        this._end = end;
+        this._has_end = true;
+    } //-- void setEnd(int) 
+
+    /**
+     * Method setMapping
+     * 
+     * 
+     * 
+     * @param index
+     * @param vMapping
+     */
+    public void setMapping(int index, org.vamsas.objects.core.Mapping vMapping)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _mappingList.size())) {
+            throw new IndexOutOfBoundsException("setMapping: Index value '"+index+"' not in range [0.."+_mappingList.size()+ "]");
+        }
+        _mappingList.setElementAt(vMapping, index);
+    } //-- void setMapping(int, org.vamsas.objects.core.Mapping) 
+
+    /**
+     * Method setMapping
+     * 
+     * 
+     * 
+     * @param mappingArray
+     */
+    public void setMapping(org.vamsas.objects.core.Mapping[] mappingArray)
+    {
+        //-- copy array
+        _mappingList.removeAllElements();
+        for (int i = 0; i < mappingArray.length; i++) {
+            _mappingList.addElement(mappingArray[i]);
+        }
+    } //-- void setMapping(org.vamsas.objects.core.Mapping) 
+
+    /**
+     * Sets the value of field 'name'.
+     * 
+     * @param name the value of field 'name'.
+     */
+    public void setName(java.lang.String name)
+    {
+        this._name = name;
+    } //-- void setName(java.lang.String) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        _propertyList.setElementAt(vProperty, index);
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Sets the value of field 'sequence'.
+     * 
+     * @param sequence the value of field 'sequence'.
+     */
+    public void setSequence(java.lang.String sequence)
+    {
+        this._sequence = sequence;
+    } //-- void setSequence(java.lang.String) 
+
+    /**
+     * Sets the value of field 'start'.
+     * 
+     * @param start the value of field 'start'.
+     */
+    public void setStart(int start)
+    {
+        this._start = start;
+        this._has_start = true;
+    } //-- void setStart(int) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return SequenceType
+     */
+    public static org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.SequenceType) Unmarshaller.unmarshal(org.vamsas.objects.core.SequenceType.class, reader);
+    } //-- org.vamsas.objects.core.SequenceType unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/SequenceTypeDescriptor.java b/src/org/vamsas/objects/core/SequenceTypeDescriptor.java
new file mode 100644 (file)
index 0000000..0cb00aa
--- /dev/null
@@ -0,0 +1,446 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class SequenceTypeDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public SequenceTypeDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "SequenceType";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _start
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                if(!target.hasStart())
+                    return null;
+                return new java.lang.Integer(target.getStart());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    // ignore null values for non optional primitives
+                    if (value == null) return;
+                    
+                    target.setStart( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _start
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            IntegerValidator typeValidator = new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _end
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                if(!target.hasEnd())
+                    return null;
+                return new java.lang.Integer(target.getEnd());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    // ignore null values for non optional primitives
+                    if (value == null) return;
+                    
+                    target.setEnd( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _end
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            IntegerValidator typeValidator = new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _sequence
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequence", "sequence", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                return target.getSequence();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    target.setSequence( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _sequence
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _name
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                return target.getName();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    target.setName( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _name
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _description
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                return target.getDescription();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    target.setDescription( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _description
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _propertyList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                return target.getProperty();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    target.addProperty( (org.vamsas.objects.core.Property) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Property();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _propertyList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _mappingList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Mapping.class, "_mappingList", "mapping", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                SequenceType target = (SequenceType) object;
+                return target.getMapping();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    SequenceType target = (SequenceType) object;
+                    target.addMapping( (org.vamsas.objects.core.Mapping) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Mapping();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _mappingList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.SequenceTypeDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.SequenceType.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/Tree.java b/src/org/vamsas/objects/core/Tree.java
new file mode 100644 (file)
index 0000000..5b9ea99
--- /dev/null
@@ -0,0 +1,600 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class Tree.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class Tree extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * Field _modifiable
+     */
+    private java.lang.String _modifiable;
+
+    /**
+     * Field _title
+     */
+    private java.lang.String _title;
+
+    /**
+     * Field _newickList
+     */
+    private java.util.Vector _newickList;
+
+    /**
+     * Field _propertyList
+     */
+    private java.util.Vector _propertyList;
+
+    /**
+     * Field _provenance
+     */
+    private org.vamsas.objects.core.Provenance _provenance;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public Tree() 
+     {
+        super();
+        _newickList = new Vector();
+        _propertyList = new Vector();
+    } //-- org.vamsas.objects.core.Tree()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addNewick
+     * 
+     * 
+     * 
+     * @param vNewick
+     */
+    public void addNewick(org.vamsas.objects.core.Newick vNewick)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _newickList.addElement(vNewick);
+    } //-- void addNewick(org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method addNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @param vNewick
+     */
+    public void addNewick(int index, org.vamsas.objects.core.Newick vNewick)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _newickList.insertElementAt(vNewick, index);
+    } //-- void addNewick(int, org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param vProperty
+     */
+    public void addProperty(org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.addElement(vProperty);
+    } //-- void addProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Method addProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void addProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _propertyList.insertElementAt(vProperty, index);
+    } //-- void addProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method enumerateNewick
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateNewick()
+    {
+        return _newickList.elements();
+    } //-- java.util.Enumeration enumerateNewick() 
+
+    /**
+     * Method enumerateProperty
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateProperty()
+    {
+        return _propertyList.elements();
+    } //-- java.util.Enumeration enumerateProperty() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof Tree) {
+        
+            Tree temp = (Tree)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._modifiable != null) {
+                if (temp._modifiable == null) return false;
+                else if (!(this._modifiable.equals(temp._modifiable))) 
+                    return false;
+            }
+            else if (temp._modifiable != null)
+                return false;
+            if (this._title != null) {
+                if (temp._title == null) return false;
+                else if (!(this._title.equals(temp._title))) 
+                    return false;
+            }
+            else if (temp._title != null)
+                return false;
+            if (this._newickList != null) {
+                if (temp._newickList == null) return false;
+                else if (!(this._newickList.equals(temp._newickList))) 
+                    return false;
+            }
+            else if (temp._newickList != null)
+                return false;
+            if (this._propertyList != null) {
+                if (temp._propertyList == null) return false;
+                else if (!(this._propertyList.equals(temp._propertyList))) 
+                    return false;
+            }
+            else if (temp._propertyList != null)
+                return false;
+            if (this._provenance != null) {
+                if (temp._provenance == null) return false;
+                else if (!(this._provenance.equals(temp._provenance))) 
+                    return false;
+            }
+            else if (temp._provenance != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'modifiable'.
+     * 
+     * @return String
+     * @return the value of field 'modifiable'.
+     */
+    public java.lang.String getModifiable()
+    {
+        return this._modifiable;
+    } //-- java.lang.String getModifiable() 
+
+    /**
+     * Method getNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @return Newick
+     */
+    public org.vamsas.objects.core.Newick getNewick(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _newickList.size())) {
+            throw new IndexOutOfBoundsException("getNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
+    } //-- org.vamsas.objects.core.Newick getNewick(int) 
+
+    /**
+     * Method getNewick
+     * 
+     * 
+     * 
+     * @return Newick
+     */
+    public org.vamsas.objects.core.Newick[] getNewick()
+    {
+        int size = _newickList.size();
+        org.vamsas.objects.core.Newick[] mArray = new org.vamsas.objects.core.Newick[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Newick) _newickList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Newick[] getNewick() 
+
+    /**
+     * Method getNewickCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getNewickCount()
+    {
+        return _newickList.size();
+    } //-- int getNewickCount() 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property getProperty(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("getProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+    } //-- org.vamsas.objects.core.Property getProperty(int) 
+
+    /**
+     * Method getProperty
+     * 
+     * 
+     * 
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property[] getProperty()
+    {
+        int size = _propertyList.size();
+        org.vamsas.objects.core.Property[] mArray = new org.vamsas.objects.core.Property[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Property) _propertyList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Property[] getProperty() 
+
+    /**
+     * Method getPropertyCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getPropertyCount()
+    {
+        return _propertyList.size();
+    } //-- int getPropertyCount() 
+
+    /**
+     * Returns the value of field 'provenance'.
+     * 
+     * @return Provenance
+     * @return the value of field 'provenance'.
+     */
+    public org.vamsas.objects.core.Provenance getProvenance()
+    {
+        return this._provenance;
+    } //-- org.vamsas.objects.core.Provenance getProvenance() 
+
+    /**
+     * Returns the value of field 'title'.
+     * 
+     * @return String
+     * @return the value of field 'title'.
+     */
+    public java.lang.String getTitle()
+    {
+        return this._title;
+    } //-- java.lang.String getTitle() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllNewick
+     * 
+     */
+    public void removeAllNewick()
+    {
+        _newickList.removeAllElements();
+    } //-- void removeAllNewick() 
+
+    /**
+     * Method removeAllProperty
+     * 
+     */
+    public void removeAllProperty()
+    {
+        _propertyList.removeAllElements();
+    } //-- void removeAllProperty() 
+
+    /**
+     * Method removeNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @return Newick
+     */
+    public org.vamsas.objects.core.Newick removeNewick(int index)
+    {
+        java.lang.Object obj = _newickList.elementAt(index);
+        _newickList.removeElementAt(index);
+        return (org.vamsas.objects.core.Newick) obj;
+    } //-- org.vamsas.objects.core.Newick removeNewick(int) 
+
+    /**
+     * Method removeProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @return Property
+     */
+    public org.vamsas.objects.core.Property removeProperty(int index)
+    {
+        java.lang.Object obj = _propertyList.elementAt(index);
+        _propertyList.removeElementAt(index);
+        return (org.vamsas.objects.core.Property) obj;
+    } //-- org.vamsas.objects.core.Property removeProperty(int) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'modifiable'.
+     * 
+     * @param modifiable the value of field 'modifiable'.
+     */
+    public void setModifiable(java.lang.String modifiable)
+    {
+        this._modifiable = modifiable;
+    } //-- void setModifiable(java.lang.String) 
+
+    /**
+     * Method setNewick
+     * 
+     * 
+     * 
+     * @param index
+     * @param vNewick
+     */
+    public void setNewick(int index, org.vamsas.objects.core.Newick vNewick)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _newickList.size())) {
+            throw new IndexOutOfBoundsException("setNewick: Index value '"+index+"' not in range [0.."+_newickList.size()+ "]");
+        }
+        _newickList.setElementAt(vNewick, index);
+    } //-- void setNewick(int, org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method setNewick
+     * 
+     * 
+     * 
+     * @param newickArray
+     */
+    public void setNewick(org.vamsas.objects.core.Newick[] newickArray)
+    {
+        //-- copy array
+        _newickList.removeAllElements();
+        for (int i = 0; i < newickArray.length; i++) {
+            _newickList.addElement(newickArray[i]);
+        }
+    } //-- void setNewick(org.vamsas.objects.core.Newick) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param index
+     * @param vProperty
+     */
+    public void setProperty(int index, org.vamsas.objects.core.Property vProperty)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _propertyList.size())) {
+            throw new IndexOutOfBoundsException("setProperty: Index value '"+index+"' not in range [0.."+_propertyList.size()+ "]");
+        }
+        _propertyList.setElementAt(vProperty, index);
+    } //-- void setProperty(int, org.vamsas.objects.core.Property) 
+
+    /**
+     * Method setProperty
+     * 
+     * 
+     * 
+     * @param propertyArray
+     */
+    public void setProperty(org.vamsas.objects.core.Property[] propertyArray)
+    {
+        //-- copy array
+        _propertyList.removeAllElements();
+        for (int i = 0; i < propertyArray.length; i++) {
+            _propertyList.addElement(propertyArray[i]);
+        }
+    } //-- void setProperty(org.vamsas.objects.core.Property) 
+
+    /**
+     * Sets the value of field 'provenance'.
+     * 
+     * @param provenance the value of field 'provenance'.
+     */
+    public void setProvenance(org.vamsas.objects.core.Provenance provenance)
+    {
+        this._provenance = provenance;
+    } //-- void setProvenance(org.vamsas.objects.core.Provenance) 
+
+    /**
+     * Sets the value of field 'title'.
+     * 
+     * @param title the value of field 'title'.
+     */
+    public void setTitle(java.lang.String title)
+    {
+        this._title = title;
+    } //-- void setTitle(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Tree
+     */
+    public static org.vamsas.objects.core.Tree unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.Tree) Unmarshaller.unmarshal(org.vamsas.objects.core.Tree.class, reader);
+    } //-- org.vamsas.objects.core.Tree unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/TreeDescriptor.java b/src/org/vamsas/objects/core/TreeDescriptor.java
new file mode 100644 (file)
index 0000000..1ca69de
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class TreeDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public TreeDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "Tree";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _modifiable
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getModifiable();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.setModifiable( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _modifiable
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _title
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getTitle();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.setTitle( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _title
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _newickList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Newick.class, "_newickList", "newick", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getNewick();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.addNewick( (org.vamsas.objects.core.Newick) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Newick();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _newickList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _propertyList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getProperty();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.addProperty( (org.vamsas.objects.core.Property) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Property();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _propertyList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _provenance
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                Tree target = (Tree) object;
+                return target.getProvenance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    Tree target = (Tree) object;
+                    target.setProvenance( (org.vamsas.objects.core.Provenance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Provenance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _provenance
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.TreeDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.Tree.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/User.java b/src/org/vamsas/objects/core/User.java
new file mode 100644 (file)
index 0000000..6efdd05
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class User.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class User extends org.vamsas.objects.core.AppData 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field _fullname
+     */
+    private java.lang.String _fullname;
+
+    /**
+     * Field _organization
+     */
+    private java.lang.String _organization;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public User() 
+     {
+        super();
+    } //-- org.vamsas.objects.core.User()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof User) {
+        
+            User temp = (User)obj;
+            if (this._fullname != null) {
+                if (temp._fullname == null) return false;
+                else if (!(this._fullname.equals(temp._fullname))) 
+                    return false;
+            }
+            else if (temp._fullname != null)
+                return false;
+            if (this._organization != null) {
+                if (temp._organization == null) return false;
+                else if (!(this._organization.equals(temp._organization))) 
+                    return false;
+            }
+            else if (temp._organization != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Returns the value of field 'fullname'.
+     * 
+     * @return String
+     * @return the value of field 'fullname'.
+     */
+    public java.lang.String getFullname()
+    {
+        return this._fullname;
+    } //-- java.lang.String getFullname() 
+
+    /**
+     * Returns the value of field 'organization'.
+     * 
+     * @return String
+     * @return the value of field 'organization'.
+     */
+    public java.lang.String getOrganization()
+    {
+        return this._organization;
+    } //-- java.lang.String getOrganization() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Sets the value of field 'fullname'.
+     * 
+     * @param fullname the value of field 'fullname'.
+     */
+    public void setFullname(java.lang.String fullname)
+    {
+        this._fullname = fullname;
+    } //-- void setFullname(java.lang.String) 
+
+    /**
+     * Sets the value of field 'organization'.
+     * 
+     * @param organization the value of field 'organization'.
+     */
+    public void setOrganization(java.lang.String organization)
+    {
+        this._organization = organization;
+    } //-- void setOrganization(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return AppData
+     */
+    public static org.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.User) Unmarshaller.unmarshal(org.vamsas.objects.core.User.class, reader);
+    } //-- org.vamsas.objects.core.AppData unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/UserDescriptor.java b/src/org/vamsas/objects/core/UserDescriptor.java
new file mode 100644 (file)
index 0000000..a90dbb1
--- /dev/null
@@ -0,0 +1,252 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class UserDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class UserDescriptor extends org.vamsas.objects.core.AppDataDescriptor {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public UserDescriptor() 
+     {
+        super();
+        setExtendsWithoutFlatten(new org.vamsas.objects.core.AppDataDescriptor());
+        nsURI = "http://www.vamsas.org";
+        xmlName = "User";
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _fullname
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fullname", "fullname", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                User target = (User) object;
+                return target.getFullname();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    User target = (User) object;
+                    target.setFullname( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _fullname
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _organization
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_organization", "organization", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                User target = (User) object;
+                return target.getOrganization();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    User target = (User) object;
+                    target.setOrganization( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _organization
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+    } //-- org.vamsas.objects.core.UserDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return super.getExtends();
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        if (identity == null)
+            return super.getIdentity();
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.User.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/VAMSAS.java b/src/org/vamsas/objects/core/VAMSAS.java
new file mode 100644 (file)
index 0000000..c359593
--- /dev/null
@@ -0,0 +1,535 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * contains unassociated trees and a number of analysis sets
+ *  
+ * 
+ * @version $Revision$ $Date$
+ */
+public class VAMSAS extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Primary Key for vamsas object referencing 
+     */
+    private java.lang.String _id;
+
+    /**
+     * Field _modifiable
+     */
+    private java.lang.String _modifiable;
+
+    /**
+     * Field _treeList
+     */
+    private java.util.Vector _treeList;
+
+    /**
+     * Field _dataSetList
+     */
+    private java.util.Vector _dataSetList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public VAMSAS() 
+     {
+        super();
+        _treeList = new Vector();
+        _dataSetList = new Vector();
+    } //-- org.vamsas.objects.core.VAMSAS()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addDataSet
+     * 
+     * 
+     * 
+     * @param vDataSet
+     */
+    public void addDataSet(org.vamsas.objects.core.DataSet vDataSet)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dataSetList.addElement(vDataSet);
+    } //-- void addDataSet(org.vamsas.objects.core.DataSet) 
+
+    /**
+     * Method addDataSet
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDataSet
+     */
+    public void addDataSet(int index, org.vamsas.objects.core.DataSet vDataSet)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _dataSetList.insertElementAt(vDataSet, index);
+    } //-- void addDataSet(int, org.vamsas.objects.core.DataSet) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param vTree
+     */
+    public void addTree(org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.addElement(vTree);
+    } //-- void addTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method addTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void addTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _treeList.insertElementAt(vTree, index);
+    } //-- void addTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method enumerateDataSet
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateDataSet()
+    {
+        return _dataSetList.elements();
+    } //-- java.util.Enumeration enumerateDataSet() 
+
+    /**
+     * Method enumerateTree
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateTree()
+    {
+        return _treeList.elements();
+    } //-- java.util.Enumeration enumerateTree() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof VAMSAS) {
+        
+            VAMSAS temp = (VAMSAS)obj;
+            if (this._id != null) {
+                if (temp._id == null) return false;
+                else if (!(this._id.equals(temp._id))) 
+                    return false;
+            }
+            else if (temp._id != null)
+                return false;
+            if (this._modifiable != null) {
+                if (temp._modifiable == null) return false;
+                else if (!(this._modifiable.equals(temp._modifiable))) 
+                    return false;
+            }
+            else if (temp._modifiable != null)
+                return false;
+            if (this._treeList != null) {
+                if (temp._treeList == null) return false;
+                else if (!(this._treeList.equals(temp._treeList))) 
+                    return false;
+            }
+            else if (temp._treeList != null)
+                return false;
+            if (this._dataSetList != null) {
+                if (temp._dataSetList == null) return false;
+                else if (!(this._dataSetList.equals(temp._dataSetList))) 
+                    return false;
+            }
+            else if (temp._dataSetList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getDataSet
+     * 
+     * 
+     * 
+     * @param index
+     * @return DataSet
+     */
+    public org.vamsas.objects.core.DataSet getDataSet(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dataSetList.size())) {
+            throw new IndexOutOfBoundsException("getDataSet: Index value '"+index+"' not in range [0.."+_dataSetList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.DataSet) _dataSetList.elementAt(index);
+    } //-- org.vamsas.objects.core.DataSet getDataSet(int) 
+
+    /**
+     * Method getDataSet
+     * 
+     * 
+     * 
+     * @return DataSet
+     */
+    public org.vamsas.objects.core.DataSet[] getDataSet()
+    {
+        int size = _dataSetList.size();
+        org.vamsas.objects.core.DataSet[] mArray = new org.vamsas.objects.core.DataSet[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.DataSet) _dataSetList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.DataSet[] getDataSet() 
+
+    /**
+     * Method getDataSetCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getDataSetCount()
+    {
+        return _dataSetList.size();
+    } //-- int getDataSetCount() 
+
+    /**
+     * Returns the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @return String
+     * @return the value of field 'id'.
+     */
+    public java.lang.String getId()
+    {
+        return this._id;
+    } //-- java.lang.String getId() 
+
+    /**
+     * Returns the value of field 'modifiable'.
+     * 
+     * @return String
+     * @return the value of field 'modifiable'.
+     */
+    public java.lang.String getModifiable()
+    {
+        return this._modifiable;
+    } //-- java.lang.String getModifiable() 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree getTree(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("getTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        
+        return (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+    } //-- org.vamsas.objects.core.Tree getTree(int) 
+
+    /**
+     * Method getTree
+     * 
+     * 
+     * 
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree[] getTree()
+    {
+        int size = _treeList.size();
+        org.vamsas.objects.core.Tree[] mArray = new org.vamsas.objects.core.Tree[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (org.vamsas.objects.core.Tree) _treeList.elementAt(index);
+        }
+        return mArray;
+    } //-- org.vamsas.objects.core.Tree[] getTree() 
+
+    /**
+     * Method getTreeCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getTreeCount()
+    {
+        return _treeList.size();
+    } //-- int getTreeCount() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllDataSet
+     * 
+     */
+    public void removeAllDataSet()
+    {
+        _dataSetList.removeAllElements();
+    } //-- void removeAllDataSet() 
+
+    /**
+     * Method removeAllTree
+     * 
+     */
+    public void removeAllTree()
+    {
+        _treeList.removeAllElements();
+    } //-- void removeAllTree() 
+
+    /**
+     * Method removeDataSet
+     * 
+     * 
+     * 
+     * @param index
+     * @return DataSet
+     */
+    public org.vamsas.objects.core.DataSet removeDataSet(int index)
+    {
+        java.lang.Object obj = _dataSetList.elementAt(index);
+        _dataSetList.removeElementAt(index);
+        return (org.vamsas.objects.core.DataSet) obj;
+    } //-- org.vamsas.objects.core.DataSet removeDataSet(int) 
+
+    /**
+     * Method removeTree
+     * 
+     * 
+     * 
+     * @param index
+     * @return Tree
+     */
+    public org.vamsas.objects.core.Tree removeTree(int index)
+    {
+        java.lang.Object obj = _treeList.elementAt(index);
+        _treeList.removeElementAt(index);
+        return (org.vamsas.objects.core.Tree) obj;
+    } //-- org.vamsas.objects.core.Tree removeTree(int) 
+
+    /**
+     * Method setDataSet
+     * 
+     * 
+     * 
+     * @param index
+     * @param vDataSet
+     */
+    public void setDataSet(int index, org.vamsas.objects.core.DataSet vDataSet)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _dataSetList.size())) {
+            throw new IndexOutOfBoundsException("setDataSet: Index value '"+index+"' not in range [0.."+_dataSetList.size()+ "]");
+        }
+        _dataSetList.setElementAt(vDataSet, index);
+    } //-- void setDataSet(int, org.vamsas.objects.core.DataSet) 
+
+    /**
+     * Method setDataSet
+     * 
+     * 
+     * 
+     * @param dataSetArray
+     */
+    public void setDataSet(org.vamsas.objects.core.DataSet[] dataSetArray)
+    {
+        //-- copy array
+        _dataSetList.removeAllElements();
+        for (int i = 0; i < dataSetArray.length; i++) {
+            _dataSetList.addElement(dataSetArray[i]);
+        }
+    } //-- void setDataSet(org.vamsas.objects.core.DataSet) 
+
+    /**
+     * Sets the value of field 'id'. The field 'id' has the
+     * following description: Primary Key for vamsas object
+     * referencing 
+     * 
+     * @param id the value of field 'id'.
+     */
+    public void setId(java.lang.String id)
+    {
+        this._id = id;
+    } //-- void setId(java.lang.String) 
+
+    /**
+     * Sets the value of field 'modifiable'.
+     * 
+     * @param modifiable the value of field 'modifiable'.
+     */
+    public void setModifiable(java.lang.String modifiable)
+    {
+        this._modifiable = modifiable;
+    } //-- void setModifiable(java.lang.String) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param index
+     * @param vTree
+     */
+    public void setTree(int index, org.vamsas.objects.core.Tree vTree)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _treeList.size())) {
+            throw new IndexOutOfBoundsException("setTree: Index value '"+index+"' not in range [0.."+_treeList.size()+ "]");
+        }
+        _treeList.setElementAt(vTree, index);
+    } //-- void setTree(int, org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method setTree
+     * 
+     * 
+     * 
+     * @param treeArray
+     */
+    public void setTree(org.vamsas.objects.core.Tree[] treeArray)
+    {
+        //-- copy array
+        _treeList.removeAllElements();
+        for (int i = 0; i < treeArray.length; i++) {
+            _treeList.addElement(treeArray[i]);
+        }
+    } //-- void setTree(org.vamsas.objects.core.Tree) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return VAMSAS
+     */
+    public static org.vamsas.objects.core.VAMSAS unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.VAMSAS) Unmarshaller.unmarshal(org.vamsas.objects.core.VAMSAS.class, reader);
+    } //-- org.vamsas.objects.core.VAMSAS unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/VAMSASDescriptor.java b/src/org/vamsas/objects/core/VAMSASDescriptor.java
new file mode 100644 (file)
index 0000000..9eb4e29
--- /dev/null
@@ -0,0 +1,315 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class VAMSASDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public VAMSASDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.org";
+        xmlName = "VAMSAS";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- _id
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
+        this.identity = desc;
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VAMSAS target = (VAMSAS) object;
+                return target.getId();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VAMSAS target = (VAMSAS) object;
+                    target.setId( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new java.lang.String();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _id
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _modifiable
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_modifiable", "modifiable", org.exolab.castor.xml.NodeType.Attribute);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VAMSAS target = (VAMSAS) object;
+                return target.getModifiable();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VAMSAS target = (VAMSAS) object;
+                    target.setModifiable( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _modifiable
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+        //-- _treeList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Tree.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VAMSAS target = (VAMSAS) object;
+                return target.getTree();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VAMSAS target = (VAMSAS) object;
+                    target.addTree( (org.vamsas.objects.core.Tree) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.Tree();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _treeList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _dataSetList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.DataSet.class, "_dataSetList", "DataSet", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VAMSAS target = (VAMSAS) object;
+                return target.getDataSet();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VAMSAS target = (VAMSAS) object;
+                    target.addDataSet( (org.vamsas.objects.core.DataSet) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.DataSet();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _dataSetList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.VAMSASDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.VAMSAS.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/core/VamsasDocument.java b/src/org/vamsas/objects/core/VamsasDocument.java
new file mode 100644 (file)
index 0000000..f8df822
--- /dev/null
@@ -0,0 +1,725 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.util.Enumeration;
+import java.util.Vector;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class VamsasDocument.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class VamsasDocument extends org.vamsas.client.Vobject 
+implements java.io.Serializable
+{
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Vamsas Document Version Number
+     */
+    private java.lang.String _version;
+
+    /**
+     * Field _lockFile
+     */
+    private org.vamsas.objects.core.LockFile _lockFile;
+
+    /**
+     * Field _provenance
+     */
+    private Provenance _provenance;
+
+    /**
+     * contains unassociated trees and a number of analysis sets
+     *  
+     */
+    private java.util.Vector _VAMSASList;
+
+    /**
+     * Field _applicationDataList
+     */
+    private java.util.Vector _applicationDataList;
+
+    /**
+     * Field _attachmentList
+     */
+    private java.util.Vector _attachmentList;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public VamsasDocument() 
+     {
+        super();
+        _VAMSASList = new Vector();
+        _applicationDataList = new Vector();
+        _attachmentList = new Vector();
+    } //-- org.vamsas.objects.core.VamsasDocument()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method addApplicationData
+     * 
+     * 
+     * 
+     * @param vApplicationData
+     */
+    public void addApplicationData(ApplicationData vApplicationData)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _applicationDataList.addElement(vApplicationData);
+    } //-- void addApplicationData(ApplicationData) 
+
+    /**
+     * Method addApplicationData
+     * 
+     * 
+     * 
+     * @param index
+     * @param vApplicationData
+     */
+    public void addApplicationData(int index, ApplicationData vApplicationData)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _applicationDataList.insertElementAt(vApplicationData, index);
+    } //-- void addApplicationData(int, ApplicationData) 
+
+    /**
+     * Method addAttachment
+     * 
+     * 
+     * 
+     * @param vAttachment
+     */
+    public void addAttachment(Attachment vAttachment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _attachmentList.addElement(vAttachment);
+    } //-- void addAttachment(Attachment) 
+
+    /**
+     * Method addAttachment
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAttachment
+     */
+    public void addAttachment(int index, Attachment vAttachment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _attachmentList.insertElementAt(vAttachment, index);
+    } //-- void addAttachment(int, Attachment) 
+
+    /**
+     * Method addVAMSAS
+     * 
+     * 
+     * 
+     * @param vVAMSAS
+     */
+    public void addVAMSAS(VAMSAS vVAMSAS)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _VAMSASList.addElement(vVAMSAS);
+    } //-- void addVAMSAS(VAMSAS) 
+
+    /**
+     * Method addVAMSAS
+     * 
+     * 
+     * 
+     * @param index
+     * @param vVAMSAS
+     */
+    public void addVAMSAS(int index, VAMSAS vVAMSAS)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        _VAMSASList.insertElementAt(vVAMSAS, index);
+    } //-- void addVAMSAS(int, VAMSAS) 
+
+    /**
+     * Method enumerateApplicationData
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateApplicationData()
+    {
+        return _applicationDataList.elements();
+    } //-- java.util.Enumeration enumerateApplicationData() 
+
+    /**
+     * Method enumerateAttachment
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateAttachment()
+    {
+        return _attachmentList.elements();
+    } //-- java.util.Enumeration enumerateAttachment() 
+
+    /**
+     * Method enumerateVAMSAS
+     * 
+     * 
+     * 
+     * @return Enumeration
+     */
+    public java.util.Enumeration enumerateVAMSAS()
+    {
+        return _VAMSASList.elements();
+    } //-- java.util.Enumeration enumerateVAMSAS() 
+
+    /**
+     * Note: hashCode() has not been overriden
+     * 
+     * @param obj
+     * @return boolean
+     */
+    public boolean equals(java.lang.Object obj)
+    {
+        if ( this == obj )
+            return true;
+        
+        if (super.equals(obj)==false)
+            return false;
+        
+        if (obj instanceof VamsasDocument) {
+        
+            VamsasDocument temp = (VamsasDocument)obj;
+            if (this._version != null) {
+                if (temp._version == null) return false;
+                else if (!(this._version.equals(temp._version))) 
+                    return false;
+            }
+            else if (temp._version != null)
+                return false;
+            if (this._lockFile != null) {
+                if (temp._lockFile == null) return false;
+                else if (!(this._lockFile.equals(temp._lockFile))) 
+                    return false;
+            }
+            else if (temp._lockFile != null)
+                return false;
+            if (this._provenance != null) {
+                if (temp._provenance == null) return false;
+                else if (!(this._provenance.equals(temp._provenance))) 
+                    return false;
+            }
+            else if (temp._provenance != null)
+                return false;
+            if (this._VAMSASList != null) {
+                if (temp._VAMSASList == null) return false;
+                else if (!(this._VAMSASList.equals(temp._VAMSASList))) 
+                    return false;
+            }
+            else if (temp._VAMSASList != null)
+                return false;
+            if (this._applicationDataList != null) {
+                if (temp._applicationDataList == null) return false;
+                else if (!(this._applicationDataList.equals(temp._applicationDataList))) 
+                    return false;
+            }
+            else if (temp._applicationDataList != null)
+                return false;
+            if (this._attachmentList != null) {
+                if (temp._attachmentList == null) return false;
+                else if (!(this._attachmentList.equals(temp._attachmentList))) 
+                    return false;
+            }
+            else if (temp._attachmentList != null)
+                return false;
+            return true;
+        }
+        return false;
+    } //-- boolean equals(java.lang.Object) 
+
+    /**
+     * Method getApplicationData
+     * 
+     * 
+     * 
+     * @param index
+     * @return ApplicationData
+     */
+    public ApplicationData getApplicationData(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _applicationDataList.size())) {
+            throw new IndexOutOfBoundsException("getApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
+        }
+        
+        return (ApplicationData) _applicationDataList.elementAt(index);
+    } //-- ApplicationData getApplicationData(int) 
+
+    /**
+     * Method getApplicationData
+     * 
+     * 
+     * 
+     * @return ApplicationData
+     */
+    public ApplicationData[] getApplicationData()
+    {
+        int size = _applicationDataList.size();
+        ApplicationData[] mArray = new ApplicationData[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (ApplicationData) _applicationDataList.elementAt(index);
+        }
+        return mArray;
+    } //-- ApplicationData[] getApplicationData() 
+
+    /**
+     * Method getApplicationDataCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getApplicationDataCount()
+    {
+        return _applicationDataList.size();
+    } //-- int getApplicationDataCount() 
+
+    /**
+     * Method getAttachment
+     * 
+     * 
+     * 
+     * @param index
+     * @return Attachment
+     */
+    public Attachment getAttachment(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _attachmentList.size())) {
+            throw new IndexOutOfBoundsException("getAttachment: Index value '"+index+"' not in range [0.."+_attachmentList.size()+ "]");
+        }
+        
+        return (Attachment) _attachmentList.elementAt(index);
+    } //-- Attachment getAttachment(int) 
+
+    /**
+     * Method getAttachment
+     * 
+     * 
+     * 
+     * @return Attachment
+     */
+    public Attachment[] getAttachment()
+    {
+        int size = _attachmentList.size();
+        Attachment[] mArray = new Attachment[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (Attachment) _attachmentList.elementAt(index);
+        }
+        return mArray;
+    } //-- Attachment[] getAttachment() 
+
+    /**
+     * Method getAttachmentCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getAttachmentCount()
+    {
+        return _attachmentList.size();
+    } //-- int getAttachmentCount() 
+
+    /**
+     * Returns the value of field 'lockFile'.
+     * 
+     * @return LockFile
+     * @return the value of field 'lockFile'.
+     */
+    public org.vamsas.objects.core.LockFile getLockFile()
+    {
+        return this._lockFile;
+    } //-- org.vamsas.objects.core.LockFile getLockFile() 
+
+    /**
+     * Returns the value of field 'provenance'.
+     * 
+     * @return Provenance
+     * @return the value of field 'provenance'.
+     */
+    public Provenance getProvenance()
+    {
+        return this._provenance;
+    } //-- Provenance getProvenance() 
+
+    /**
+     * Method getVAMSAS
+     * 
+     * 
+     * 
+     * @param index
+     * @return VAMSAS
+     */
+    public VAMSAS getVAMSAS(int index)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _VAMSASList.size())) {
+            throw new IndexOutOfBoundsException("getVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
+        }
+        
+        return (VAMSAS) _VAMSASList.elementAt(index);
+    } //-- VAMSAS getVAMSAS(int) 
+
+    /**
+     * Method getVAMSAS
+     * 
+     * 
+     * 
+     * @return VAMSAS
+     */
+    public VAMSAS[] getVAMSAS()
+    {
+        int size = _VAMSASList.size();
+        VAMSAS[] mArray = new VAMSAS[size];
+        for (int index = 0; index < size; index++) {
+            mArray[index] = (VAMSAS) _VAMSASList.elementAt(index);
+        }
+        return mArray;
+    } //-- VAMSAS[] getVAMSAS() 
+
+    /**
+     * Method getVAMSASCount
+     * 
+     * 
+     * 
+     * @return int
+     */
+    public int getVAMSASCount()
+    {
+        return _VAMSASList.size();
+    } //-- int getVAMSASCount() 
+
+    /**
+     * Returns the value of field 'version'. The field 'version'
+     * has the following description: Vamsas Document Version
+     * Number
+     * 
+     * @return String
+     * @return the value of field 'version'.
+     */
+    public java.lang.String getVersion()
+    {
+        return this._version;
+    } //-- java.lang.String getVersion() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Method removeAllApplicationData
+     * 
+     */
+    public void removeAllApplicationData()
+    {
+        _applicationDataList.removeAllElements();
+    } //-- void removeAllApplicationData() 
+
+    /**
+     * Method removeAllAttachment
+     * 
+     */
+    public void removeAllAttachment()
+    {
+        _attachmentList.removeAllElements();
+    } //-- void removeAllAttachment() 
+
+    /**
+     * Method removeAllVAMSAS
+     * 
+     */
+    public void removeAllVAMSAS()
+    {
+        _VAMSASList.removeAllElements();
+    } //-- void removeAllVAMSAS() 
+
+    /**
+     * Method removeApplicationData
+     * 
+     * 
+     * 
+     * @param index
+     * @return ApplicationData
+     */
+    public ApplicationData removeApplicationData(int index)
+    {
+        java.lang.Object obj = _applicationDataList.elementAt(index);
+        _applicationDataList.removeElementAt(index);
+        return (ApplicationData) obj;
+    } //-- ApplicationData removeApplicationData(int) 
+
+    /**
+     * Method removeAttachment
+     * 
+     * 
+     * 
+     * @param index
+     * @return Attachment
+     */
+    public Attachment removeAttachment(int index)
+    {
+        java.lang.Object obj = _attachmentList.elementAt(index);
+        _attachmentList.removeElementAt(index);
+        return (Attachment) obj;
+    } //-- Attachment removeAttachment(int) 
+
+    /**
+     * Method removeVAMSAS
+     * 
+     * 
+     * 
+     * @param index
+     * @return VAMSAS
+     */
+    public VAMSAS removeVAMSAS(int index)
+    {
+        java.lang.Object obj = _VAMSASList.elementAt(index);
+        _VAMSASList.removeElementAt(index);
+        return (VAMSAS) obj;
+    } //-- VAMSAS removeVAMSAS(int) 
+
+    /**
+     * Method setApplicationData
+     * 
+     * 
+     * 
+     * @param index
+     * @param vApplicationData
+     */
+    public void setApplicationData(int index, ApplicationData vApplicationData)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _applicationDataList.size())) {
+            throw new IndexOutOfBoundsException("setApplicationData: Index value '"+index+"' not in range [0.."+_applicationDataList.size()+ "]");
+        }
+        _applicationDataList.setElementAt(vApplicationData, index);
+    } //-- void setApplicationData(int, ApplicationData) 
+
+    /**
+     * Method setApplicationData
+     * 
+     * 
+     * 
+     * @param applicationDataArray
+     */
+    public void setApplicationData(ApplicationData[] applicationDataArray)
+    {
+        //-- copy array
+        _applicationDataList.removeAllElements();
+        for (int i = 0; i < applicationDataArray.length; i++) {
+            _applicationDataList.addElement(applicationDataArray[i]);
+        }
+    } //-- void setApplicationData(ApplicationData) 
+
+    /**
+     * Method setAttachment
+     * 
+     * 
+     * 
+     * @param index
+     * @param vAttachment
+     */
+    public void setAttachment(int index, Attachment vAttachment)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _attachmentList.size())) {
+            throw new IndexOutOfBoundsException("setAttachment: Index value '"+index+"' not in range [0.."+_attachmentList.size()+ "]");
+        }
+        _attachmentList.setElementAt(vAttachment, index);
+    } //-- void setAttachment(int, Attachment) 
+
+    /**
+     * Method setAttachment
+     * 
+     * 
+     * 
+     * @param attachmentArray
+     */
+    public void setAttachment(Attachment[] attachmentArray)
+    {
+        //-- copy array
+        _attachmentList.removeAllElements();
+        for (int i = 0; i < attachmentArray.length; i++) {
+            _attachmentList.addElement(attachmentArray[i]);
+        }
+    } //-- void setAttachment(Attachment) 
+
+    /**
+     * Sets the value of field 'lockFile'.
+     * 
+     * @param lockFile the value of field 'lockFile'.
+     */
+    public void setLockFile(org.vamsas.objects.core.LockFile lockFile)
+    {
+        this._lockFile = lockFile;
+    } //-- void setLockFile(org.vamsas.objects.core.LockFile) 
+
+    /**
+     * Sets the value of field 'provenance'.
+     * 
+     * @param provenance the value of field 'provenance'.
+     */
+    public void setProvenance(Provenance provenance)
+    {
+        this._provenance = provenance;
+    } //-- void setProvenance(Provenance) 
+
+    /**
+     * Method setVAMSAS
+     * 
+     * 
+     * 
+     * @param index
+     * @param vVAMSAS
+     */
+    public void setVAMSAS(int index, VAMSAS vVAMSAS)
+        throws java.lang.IndexOutOfBoundsException
+    {
+        //-- check bounds for index
+        if ((index < 0) || (index > _VAMSASList.size())) {
+            throw new IndexOutOfBoundsException("setVAMSAS: Index value '"+index+"' not in range [0.."+_VAMSASList.size()+ "]");
+        }
+        _VAMSASList.setElementAt(vVAMSAS, index);
+    } //-- void setVAMSAS(int, VAMSAS) 
+
+    /**
+     * Method setVAMSAS
+     * 
+     * 
+     * 
+     * @param VAMSASArray
+     */
+    public void setVAMSAS(VAMSAS[] VAMSASArray)
+    {
+        //-- copy array
+        _VAMSASList.removeAllElements();
+        for (int i = 0; i < VAMSASArray.length; i++) {
+            _VAMSASList.addElement(VAMSASArray[i]);
+        }
+    } //-- void setVAMSAS(VAMSAS) 
+
+    /**
+     * Sets the value of field 'version'. The field 'version' has
+     * the following description: Vamsas Document Version Number
+     * 
+     * @param version the value of field 'version'.
+     */
+    public void setVersion(java.lang.String version)
+    {
+        this._version = version;
+    } //-- void setVersion(java.lang.String) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return VamsasDocument
+     */
+    public static org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (org.vamsas.objects.core.VamsasDocument) Unmarshaller.unmarshal(org.vamsas.objects.core.VamsasDocument.class, reader);
+    } //-- org.vamsas.objects.core.VamsasDocument unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
diff --git a/src/org/vamsas/objects/core/VamsasDocumentDescriptor.java b/src/org/vamsas/objects/core/VamsasDocumentDescriptor.java
new file mode 100644 (file)
index 0000000..425e16a
--- /dev/null
@@ -0,0 +1,388 @@
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package org.vamsas.objects.core;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class VamsasDocumentDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class VamsasDocumentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public VamsasDocumentDescriptor() 
+     {
+        super();
+        nsURI = "http://www.vamsas.ac.uk/vamsasDocument";
+        xmlName = "VamsasDocument";
+        
+        //-- set grouping compositor
+        setCompositorAsSequence();
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.mapping.FieldHandler             handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- initialize attribute descriptors
+        
+        //-- initialize element descriptors
+        
+        //-- _version
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "Version", org.exolab.castor.xml.NodeType.Element);
+        desc.setImmutable(true);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getVersion();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.setVersion( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.ac.uk/vamsasDocument");
+        desc.setRequired(true);
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _version
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _lockFile
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.LockFile.class, "_lockFile", "LockFile", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getLockFile();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.setLockFile( (org.vamsas.objects.core.LockFile) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new org.vamsas.objects.core.LockFile();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.ac.uk/vamsasDocument");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _lockFile
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _provenance
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(Provenance.class, "_provenance", "Provenance", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getProvenance();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.setProvenance( (Provenance) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new Provenance();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(false);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _provenance
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _VAMSASList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(VAMSAS.class, "_VAMSASList", "VAMSAS", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getVAMSAS();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.addVAMSAS( (VAMSAS) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new VAMSAS();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setRequired(true);
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _VAMSASList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(1);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _applicationDataList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(ApplicationData.class, "_applicationDataList", "ApplicationData", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getApplicationData();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.addApplicationData( (ApplicationData) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new ApplicationData();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _applicationDataList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+        //-- _attachmentList
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(Attachment.class, "_attachmentList", "Attachment", org.exolab.castor.xml.NodeType.Element);
+        handler = new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                VamsasDocument target = (VamsasDocument) object;
+                return target.getAttachment();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    VamsasDocument target = (VamsasDocument) object;
+                    target.addAttachment( (Attachment) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return new Attachment();
+            }
+        };
+        desc.setHandler(handler);
+        desc.setNameSpaceURI("http://www.vamsas.org");
+        desc.setMultivalued(true);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _attachmentList
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        fieldValidator.setMinOccurs(0);
+        { //-- local scope
+        }
+        desc.setValidator(fieldValidator);
+    } //-- org.vamsas.objects.core.VamsasDocumentDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return org.vamsas.objects.core.VamsasDocument.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}
diff --git a/src/org/vamsas/objects/utils/AppDataReference.java b/src/org/vamsas/objects/utils/AppDataReference.java
new file mode 100644 (file)
index 0000000..414c8da
--- /dev/null
@@ -0,0 +1,160 @@
+/**
+ * 
+ */
+package org.vamsas.objects.utils;
+import java.util.Vector;
+
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.objects.core.*;
+/**
+ * Form, accessors and validation for ApplicationData references in
+ * vamsas document.
+ * TODO: LATER:extend XML Schema to properly validate against the same forms required by this class
+ * TODO: VAMSAS: URNS for appDatas are supposed to be unique, aren't they ?
+ */
+public class AppDataReference {
+  /**
+   * search interface for collecting particular types of AppDatas in a vamsas document
+   * @author jimp
+   *
+   */
+  interface IAppDSearch {
+    /**
+     * process the appData Vobject d
+     * @param d
+     * @return true if appData should be collected
+     */
+    public boolean process(AppData d);
+  }
+  /**
+   * collect all appData reference strings in a vamsas document
+   * @param doc
+   * @return vector of String objects
+   */
+  static public Vector getAppDataReferences(VamsasDocument doc) {
+    if ((doc!=null) && (doc.getApplicationDataCount()>0)) {
+      Vector apdrefs = new Vector();
+      ApplicationData[] appdatas = doc.getApplicationData();
+      for (int q=0; q<appdatas.length; q++) {
+        String refstring=appdatas[q].getDataReference();
+        if (refstring!=null) 
+          apdrefs.add(refstring);
+        User users[] = appdatas[q].getUser();
+        
+        if (users!=null)
+          for (int u=0; u<users.length; u++) {
+            refstring=users[u].getDataReference();
+            if (refstring!=null)
+              apdrefs.add(new String(refstring)); // avoid referencing.
+          }
+      }
+      if (apdrefs.size()>0)
+        return apdrefs;
+    }
+    return null;
+  }
+  /**
+   * General search through the set of AppData objects for a particular profile of Client and User handle.
+   * @param doc
+   * @param test interface implemented by the filter selecting particular AppDatas.
+   * @param cascade if true only User objects for ApplicationData objects that test.process returned true will be tested.
+   * @return set of org.vamsas.objects.core.AppData objects for which test.process returned true
+   */
+  static public Vector searchAppDatas(VamsasDocument doc, IAppDSearch test, boolean cascade) {
+    if ((doc!=null) && (doc.getApplicationDataCount()>0)) {
+      Vector apdrefs = new Vector();
+      ApplicationData[] appdatas = doc.getApplicationData();
+      for (int q=0; q<appdatas.length; q++) {
+        boolean t;
+        if (t=test.process(appdatas[q])) 
+          apdrefs.add(appdatas[q]);
+        if (t || cascade) { 
+          User users[] = appdatas[q].getUser();
+          if (users!=null)
+            for (int u=0; u<users.length; u++) 
+              if (test.process(users[u]))
+                apdrefs.add(users[u]);
+        }
+      }
+      if (apdrefs.size()>0)
+        return apdrefs;
+    }
+    return null;
+  }
+  static public boolean equals(User p, UserHandle u) {
+    if (p.getFullname().equals(u.getFullName())
+        && p.getOrganization().equals(u.getOrganization()))
+      return true;
+    return false;
+  }
+  /**
+   * returns true if Name matches in c and p, and Urn's match (or c.getUrn()==null) and Version's match (or c.getVersion()==null)
+   * @param p
+   * @param c
+   * @return match of p on template c.
+   */
+  static public boolean equals(ApplicationData p, ClientHandle c) {
+    if (
+        //((c.getClientUrn()==null) || p.getUrn().equals(c.getClientUrn()))
+        //&&
+        (p.getName().equals(c.getClientName()))
+        &&
+        ((c.getVersion()==null) || (p.getVersion().equals(c.getVersion())))
+        )
+      return true;
+    return false;
+  }
+  /**
+   * Searches document appData structure for particular combinations of client and user data
+   * @param doc the data 
+   * @param user template user data to match against
+   * @see AppDataReference.equals(org.vamsas.objects.core.User, org.vamsas.client.UserHandle)
+   * @param app
+   * @see AppDataReference.equals(org.vamsas.objects.core.ApplicationData, org.vamsas.client.ClientHandle)
+   * @return set of matching client app datas for this client and user combination
+   */
+  static public Vector getUserandApplicationsData(VamsasDocument doc, UserHandle user, ClientHandle app) {
+    if (doc==null) {
+      return null;
+    }
+    final UserHandle u = user;
+    final ClientHandle c = app;
+    
+    IAppDSearch match = new IAppDSearch() {
+      public boolean process(AppData p) {
+        if (p instanceof User) {
+          if (AppDataReference.equals((User) p, u))
+            return true;
+        } else 
+        if (p instanceof ApplicationData) {
+          if (AppDataReference.equals((ApplicationData) p, c))
+            return true;
+        }
+        return false;
+      }
+    };
+    
+    return searchAppDatas(doc, match, true); // only return AppDatas belonging to appdata app.
+  }
+  /**
+   * safely creates a new appData reference
+   * @param dest destination document Vobject
+   * @param entry base application reference to make unique 
+   */
+  public static String uniqueAppDataReference(VamsasDocument dest,String base) {
+    String urn = new String(base);    
+    
+    for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
+      ApplicationData o = dest.getApplicationData()[i];
+      // ensure new urn is really unique
+      int v = 1;
+      // TODO: while (o.getUrn().equals(urn)) {
+        urn = base+"/"+v++;      
+      //} 
+    }
+    return urn;
+  }
+}
diff --git a/src/org/vamsas/objects/utils/DocumentStuff.java b/src/org/vamsas/objects/utils/DocumentStuff.java
new file mode 100644 (file)
index 0000000..825a3ae
--- /dev/null
@@ -0,0 +1,34 @@
+package org.vamsas.objects.utils;
+
+import org.vamsas.objects.core.*;
+import org.vamsas.objects.utils.document.VersionEntries;
+
+/**
+ * various vamsas-client independent helpers 
+ * for creating and manipulating the vamsasDocument Vobject
+ * @author jimp
+ *
+ */
+public class DocumentStuff {
+  public static VamsasDocument newVamsasDocument(VAMSAS root[], String version) {
+    return newVamsasDocument(root, ProvenanceStuff.newProvenance(
+      "AUTO:org.vamsas.DocumentStuff.newVamsasDocument", 
+      "Vamsas Document created"),
+      version);
+  }
+  public static VamsasDocument newVamsasDocument(VAMSAS root[]) {
+    return newVamsasDocument(root, ProvenanceStuff.newProvenance(
+      "AUTO:org.vamsas.DocumentStuff.newVamsasDocument", 
+      "Vamsas Document created"),
+      VersionEntries.latestVersion());
+  }
+  public static VamsasDocument newVamsasDocument(VAMSAS root[], Provenance p, String version) {
+    VamsasDocument doc = new VamsasDocument();
+    for (int r=0; r<root.length; r++) {
+      doc.addVAMSAS(root[r]);
+    }
+    doc.setProvenance(p);
+    doc.setVersion(version);
+    return doc;
+  }
+}
diff --git a/src/org/vamsas/objects/utils/Format.java b/src/org/vamsas/objects/utils/Format.java
new file mode 100644 (file)
index 0000000..43db402
--- /dev/null
@@ -0,0 +1,612 @@
+/*\r
+ * Cay S. Horstmann & Gary Cornell, Core Java\r
+ * Published By Sun Microsystems Press/Prentice-Hall\r
+ * Copyright (C) 1997 Sun Microsystems Inc.\r
+ * All Rights Reserved.\r
+ *\r
+ * Permission to use, copy, modify, and distribute this \r
+ * software and its documentation for NON-COMMERCIAL purposes\r
+ * and without fee is hereby granted provided that this \r
+ * copyright notice appears in all copies. \r
+ * \r
+ * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR \r
+ * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER \r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE \r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A \r
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS\r
+ * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED \r
+ * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING \r
+ * THIS SOFTWARE OR ITS DERIVATIVES.\r
+ */\r
+\r
+/**\r
+ * A class for formatting numbers that follows printf conventions.\r
+ * Also implements C-like atoi and atof functions\r
+ * @version 1.03 25 Oct 1997\r
+ * @author Cay Horstmann\r
+ */\r
+\r
+package org.vamsas.objects.utils;\r
+\r
+import java.io.*;\r
+\r
+public class Format { /**\r
+     * Formats the number following printf conventions.\r
+     * Main limitation: Can only handle one format parameter at a time\r
+     * Use multiple Format objects to format more than one number\r
+     * @param s the format string following printf conventions\r
+     * The string has a prefix, a format code and a suffix. The prefix and suffix\r
+     * become part of the formatted output. The format code directs the\r
+     * formatting of the (single) parameter to be formatted. The code has the\r
+     * following structure\r
+     * <ul>\r
+     * <li> a % (required)\r
+     * <li> a modifier (optional)\r
+     * <dl>\r
+     * <dt> + <dd> forces display of + for positive numbers\r
+     * <dt> 0 <dd> show leading zeroes\r
+     * <dt> - <dd> align left in the field\r
+     * <dt> space <dd> prepend a space in front of positive numbers\r
+     * <dt> # <dd> use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers. Don't suppress trailing zeroes in general floating point format.\r
+     * </dl>\r
+     * <li> an integer denoting field width (optional)\r
+     * <li> a period followed by an integer denoting precision (optional)\r
+     * <li> a format descriptor (required)\r
+     * <dl>\r
+     * <dt>f <dd> floating point number in fixed format\r
+     * <dt>e, E <dd> floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e.\r
+     * <dt>g, G <dd> floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e.\r
+     * <dt>d, i <dd> integer in decimal\r
+     * <dt>x <dd> integer in hexadecimal\r
+     * <dt>o <dd> integer in octal\r
+     * <dt>s <dd> string\r
+     * <dt>c <dd> character\r
+     * </dl>\r
+     * </ul>\r
+     * @exception IllegalArgumentException if bad format\r
+     */\r
+\r
+  public Format(String s) {\r
+    width = 0;\r
+    precision = -1;\r
+    pre = "";\r
+    post = "";\r
+    leading_zeroes = false;\r
+    show_plus = false;\r
+    alternate = false;\r
+    show_space = false;\r
+    left_align = false;\r
+    fmt = ' ';\r
+\r
+    int state = 0;\r
+    int length = s.length();\r
+    int parse_state = 0;\r
+    // 0 = prefix, 1 = flags, 2 = width, 3 = precision,\r
+    // 4 = format, 5 = end\r
+    int i = 0;\r
+\r
+    while (parse_state == 0) {\r
+      if (i >= length)\r
+        parse_state = 5;\r
+      else if (s.charAt(i) == '%') {\r
+        if (i < length - 1) {\r
+          if (s.charAt(i + 1) == '%') {\r
+            pre = pre + '%';\r
+            i++;\r
+          } else\r
+            parse_state = 1;\r
+        } else\r
+          throw new java.lang.IllegalArgumentException();\r
+      } else\r
+        pre = pre + s.charAt(i);\r
+      i++;\r
+    }\r
+    while (parse_state == 1) {\r
+      if (i >= length)\r
+        parse_state = 5;\r
+      else if (s.charAt(i) == ' ')\r
+        show_space = true;\r
+      else if (s.charAt(i) == '-')\r
+        left_align = true;\r
+      else if (s.charAt(i) == '+')\r
+        show_plus = true;\r
+      else if (s.charAt(i) == '0')\r
+        leading_zeroes = true;\r
+      else if (s.charAt(i) == '#')\r
+        alternate = true;\r
+      else {\r
+        parse_state = 2;\r
+        i--;\r
+      }\r
+      i++;\r
+    }\r
+    while (parse_state == 2) {\r
+      if (i >= length)\r
+        parse_state = 5;\r
+      else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') {\r
+        width = width * 10 + s.charAt(i) - '0';\r
+        i++;\r
+      } else if (s.charAt(i) == '.') {\r
+        parse_state = 3;\r
+        precision = 0;\r
+        i++;\r
+      } else\r
+        parse_state = 4;\r
+    }\r
+    while (parse_state == 3) {\r
+      if (i >= length)\r
+        parse_state = 5;\r
+      else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') {\r
+        precision = precision * 10 + s.charAt(i) - '0';\r
+        i++;\r
+      } else\r
+        parse_state = 4;\r
+    }\r
+    if (parse_state == 4) {\r
+      if (i >= length)\r
+        parse_state = 5;\r
+      else\r
+        fmt = s.charAt(i);\r
+      i++;\r
+    }\r
+    if (i < length)\r
+      post = s.substring(i, length);\r
+  }\r
+\r
+  /**\r
+  * prints a formatted number following printf conventions\r
+  * @param s a PrintStream\r
+  * @param fmt the format string\r
+  * @param x the double to print\r
+  */\r
+\r
+  public static void print(java.io.PrintStream s, String fmt, double x) {\r
+    s.print(new Format(fmt).form(x));\r
+  }\r
+\r
+  /**\r
+  * prints a formatted number following printf conventions\r
+  * @param s a PrintStream\r
+  * @param fmt the format string\r
+  * @param x the long to print\r
+  */\r
+  public static void print(java.io.PrintStream s, String fmt, long x) {\r
+    s.print(new Format(fmt).form(x));\r
+  }\r
+\r
+  /**\r
+  * prints a formatted number following printf conventions\r
+  * @param s a PrintStream\r
+  * @param fmt the format string\r
+  * @param x the character to \r
+  */\r
+\r
+  public static void print(java.io.PrintStream s, String fmt, char x) {\r
+    s.print(new Format(fmt).form(x));\r
+  }\r
+\r
+  /**\r
+  * prints a formatted number following printf conventions\r
+  * @param s a PrintStream, fmt the format string\r
+  * @param x a string that represents the digits to print\r
+  */\r
+\r
+  public static void print(java.io.PrintStream s, String fmt, String x) {\r
+    s.print(new Format(fmt).form(x));\r
+  }\r
+\r
+  /**\r
+  * Converts a string of digits (decimal, octal or hex) to an integer\r
+  * @param s a string\r
+  * @return the numeric value of the prefix of s representing a base 10 integer\r
+  */\r
+\r
+  public static int atoi(String s) {\r
+    return (int)atol(s);\r
+  }\r
+\r
+  /**\r
+  * Converts a string of digits (decimal, octal or hex) to a long integer\r
+  * @param s a string\r
+  * @return the numeric value of the prefix of s representing a base 10 integer\r
+  */\r
+\r
+  public static long atol(String s) {\r
+    int i = 0;\r
+\r
+    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
+      i++;\r
+    if (i < s.length() && s.charAt(i) == '0') {\r
+      if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X'))\r
+        return parseLong(s.substring(i + 2), 16);\r
+      else\r
+        return parseLong(s, 8);\r
+    } else\r
+      return parseLong(s, 10);\r
+  }\r
+\r
+  private static long parseLong(String s, int base) {\r
+    int i = 0;\r
+    int sign = 1;\r
+    long r = 0;\r
+\r
+    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
+      i++;\r
+    if (i < s.length() && s.charAt(i) == '-') {\r
+      sign = -1;\r
+      i++;\r
+    } else if (i < s.length() && s.charAt(i) == '+') {\r
+      i++;\r
+    }\r
+    while (i < s.length()) {\r
+      char ch = s.charAt(i);\r
+      if ('0' <= ch && ch < '0' + base)\r
+        r = r * base + ch - '0';\r
+      else if ('A' <= ch && ch < 'A' + base - 10)\r
+        r = r * base + ch - 'A' + 10 ;\r
+      else if ('a' <= ch && ch < 'a' + base - 10)\r
+        r = r * base + ch - 'a' + 10 ;\r
+      else\r
+        return r * sign;\r
+      i++;\r
+    }\r
+    return r * sign;\r
+  }\r
+\r
+  /**\r
+  * Converts a string of digits to an double\r
+  * @param s a string\r
+  */\r
+\r
+  public static double atof(String s) {\r
+    int i = 0;\r
+    int sign = 1;\r
+    double r = 0; // integer part\r
+    double f = 0; // fractional part\r
+    double p = 1; // exponent of fractional part\r
+    int state = 0; // 0 = int part, 1 = frac part\r
+\r
+    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
+      i++;\r
+    if (i < s.length() && s.charAt(i) == '-') {\r
+      sign = -1;\r
+      i++;\r
+    } else if (i < s.length() && s.charAt(i) == '+') {\r
+      i++;\r
+    }\r
+    while (i < s.length()) {\r
+      char ch = s.charAt(i);\r
+      if ('0' <= ch && ch <= '9') {\r
+        if (state == 0)\r
+          r = r * 10 + ch - '0';\r
+        else if (state == 1) {\r
+          p = p / 10;\r
+          r = r + p * (ch - '0');\r
+        }\r
+      } else if (ch == '.') {\r
+        if (state == 0)\r
+          state = 1;\r
+        else\r
+          return sign * r;\r
+      } else if (ch == 'e' || ch == 'E') {\r
+        long e = (int)parseLong(s.substring(i + 1), 10);\r
+        return sign * r * Math.pow(10, e);\r
+      } else\r
+        return sign * r;\r
+      i++;\r
+    }\r
+    return sign * r;\r
+  }\r
+\r
+  /**\r
+  * Formats a double into a string (like sprintf in C)\r
+  * @param x the number to format\r
+  * @return the formatted string \r
+  * @exception IllegalArgumentException if bad argument\r
+  */\r
+\r
+  public String form(double x) {\r
+    String r;\r
+    if (precision < 0)\r
+      precision = 6;\r
+    int s = 1;\r
+    if (x < 0) {\r
+      x = -x;\r
+      s = -1;\r
+    }\r
+    if (fmt == 'f')\r
+      r = fixed_format(x);\r
+    else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G')\r
+      r = exp_format(x);\r
+    else\r
+      throw new java.lang.IllegalArgumentException();\r
+\r
+    return pad(sign(s, r));\r
+  }\r
+\r
+  /**\r
+  * Formats a long integer into a string (like sprintf in C)\r
+  * @param x the number to format\r
+  * @return the formatted string \r
+  */\r
+\r
+  public String form(long x) {\r
+    String r;\r
+    int s = 0;\r
+    if (fmt == 'd' || fmt == 'i') {\r
+      if (x < 0) {\r
+        r = ("" + x).substring(1);\r
+        s = -1;\r
+      } else {\r
+        r = "" + x;\r
+        s = 1;\r
+      }\r
+    } else if (fmt == 'o')\r
+      r = convert(x, 3, 7, "01234567");\r
+    else if (fmt == 'x')\r
+      r = convert(x, 4, 15, "0123456789abcdef");\r
+    else if (fmt == 'X')\r
+      r = convert(x, 4, 15, "0123456789ABCDEF");\r
+    else\r
+      throw new java.lang.IllegalArgumentException();\r
+\r
+    return pad(sign(s, r));\r
+  }\r
+\r
+  /**\r
+  * Formats a character into a string (like sprintf in C)\r
+  * @param x the value to format\r
+  * @return the formatted string \r
+  */\r
+\r
+  public String form(char c) {\r
+    if (fmt != 'c')\r
+      throw new java.lang.IllegalArgumentException();\r
+\r
+    String r = "" + c;\r
+    return pad(r);\r
+  }\r
+\r
+  /**\r
+  * Formats a string into a larger string (like sprintf in C)\r
+  * @param x the value to format\r
+  * @return the formatted string \r
+  */\r
+\r
+  public String form(String s) {\r
+    if (fmt != 's')\r
+      throw new java.lang.IllegalArgumentException();\r
+    if (precision >= 0)\r
+      s = s.substring(0, precision);\r
+    return pad(s);\r
+  }\r
+\r
+\r
+  /**\r
+  * a test stub for the format class\r
+  */\r
+\r
+  public static void main(String[] a) {\r
+    double x = 1.23456789012;\r
+    double y = 123;\r
+    double z = 1.2345e30;\r
+    double w = 1.02;\r
+    double u = 1.234e-5;\r
+    int d = 0xCAFE;\r
+    Format.print(System.out, "x = |%f|\n", x);\r
+    Format.print(System.out, "u = |%20f|\n", u);\r
+    Format.print(System.out, "x = |% .5f|\n", x);\r
+    Format.print(System.out, "w = |%20.5f|\n", w);\r
+    Format.print(System.out, "x = |%020.5f|\n", x);\r
+    Format.print(System.out, "x = |%+20.5f|\n", x);\r
+    Format.print(System.out, "x = |%+020.5f|\n", x);\r
+    Format.print(System.out, "x = |% 020.5f|\n", x);\r
+    Format.print(System.out, "y = |%#+20.5f|\n", y);\r
+    Format.print(System.out, "y = |%-+20.5f|\n", y);\r
+    Format.print(System.out, "z = |%20.5f|\n", z);\r
+\r
+    Format.print(System.out, "x = |%e|\n", x);\r
+    Format.print(System.out, "u = |%20e|\n", u);\r
+    Format.print(System.out, "x = |% .5e|\n", x);\r
+    Format.print(System.out, "w = |%20.5e|\n", w);\r
+    Format.print(System.out, "x = |%020.5e|\n", x);\r
+    Format.print(System.out, "x = |%+20.5e|\n", x);\r
+    Format.print(System.out, "x = |%+020.5e|\n", x);\r
+    Format.print(System.out, "x = |% 020.5e|\n", x);\r
+    Format.print(System.out, "y = |%#+20.5e|\n", y);\r
+    Format.print(System.out, "y = |%-+20.5e|\n", y);\r
+\r
+    Format.print(System.out, "x = |%g|\n", x);\r
+    Format.print(System.out, "z = |%g|\n", z);\r
+    Format.print(System.out, "w = |%g|\n", w);\r
+    Format.print(System.out, "u = |%g|\n", u);\r
+    Format.print(System.out, "y = |%.2g|\n", y);\r
+    Format.print(System.out, "y = |%#.2g|\n", y);\r
+\r
+    Format.print(System.out, "d = |%d|\n", d);\r
+    Format.print(System.out, "d = |%20d|\n", d);\r
+    Format.print(System.out, "d = |%020d|\n", d);\r
+    Format.print(System.out, "d = |%+20d|\n", d);\r
+    Format.print(System.out, "d = |% 020d|\n", d);\r
+    Format.print(System.out, "d = |%-20d|\n", d);\r
+    Format.print(System.out, "d = |%20.8d|\n", d);\r
+    Format.print(System.out, "d = |%x|\n", d);\r
+    Format.print(System.out, "d = |%20X|\n", d);\r
+    Format.print(System.out, "d = |%#20x|\n", d);\r
+    Format.print(System.out, "d = |%020X|\n", d);\r
+    Format.print(System.out, "d = |%20.8x|\n", d);\r
+    Format.print(System.out, "d = |%o|\n", d);\r
+    Format.print(System.out, "d = |%020o|\n", d);\r
+    Format.print(System.out, "d = |%#20o|\n", d);\r
+    Format.print(System.out, "d = |%#020o|\n", d);\r
+    Format.print(System.out, "d = |%20.12o|\n", d);\r
+\r
+    Format.print(System.out, "s = |%-20s|\n", "Hello");\r
+    Format.print(System.out, "s = |%-20c|\n", '!');\r
+\r
+    // regression test to confirm fix of reported bugs\r
+\r
+    Format.print(System.out, "|%i|\n", Long.MIN_VALUE);\r
+\r
+    Format.print(System.out, "|%6.2e|\n", 0.0);\r
+    Format.print(System.out, "|%6.2g|\n", 0.0);\r
+\r
+    Format.print(System.out, "|%6.2f|\n", 9.99);\r
+    Format.print(System.out, "|%6.2f|\n", 9.999);\r
+\r
+    Format.print(System.out, "|%6.0f|\n", 9.999);\r
+  }\r
+\r
+  private static String repeat(char c, int n) {\r
+    if (n <= 0)\r
+      return "";\r
+    StringBuffer s = new StringBuffer(n);\r
+    for (int i = 0; i < n; i++)\r
+      s.append(c);\r
+    return s.toString();\r
+  }\r
+\r
+  private static String convert(long x, int n, int m, String d) {\r
+    if (x == 0)\r
+      return "0";\r
+    String r = "";\r
+    while (x != 0) {\r
+      r = d.charAt((int)(x & m)) + r;\r
+      x = x >>> n;\r
+    }\r
+    return r;\r
+  }\r
+\r
+  private String pad(String r) {\r
+    String p = repeat(' ', width - r.length());\r
+    if (left_align)\r
+      return pre + r + p + post;\r
+    else\r
+      return pre + p + r + post;\r
+  }\r
+\r
+  private String sign(int s, String r) {\r
+    String p = "";\r
+    if (s < 0)\r
+      p = "-";\r
+    else if (s > 0) {\r
+      if (show_plus)\r
+        p = "+";\r
+      else if (show_space)\r
+        p = " ";\r
+    } else {\r
+      if (fmt == 'o' && alternate && r.length() > 0 && r.charAt(0) != '0')\r
+        p = "0";\r
+      else if (fmt == 'x' && alternate)\r
+        p = "0x";\r
+      else if (fmt == 'X' && alternate)\r
+        p = "0X";\r
+    }\r
+    int w = 0;\r
+    if (leading_zeroes)\r
+      w = width;\r
+    else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o')\r
+             && precision > 0)\r
+      w = precision;\r
+\r
+    return p + repeat('0', w - p.length() - r.length()) + r;\r
+  }\r
+\r
+  private String fixed_format(double d) {\r
+    boolean removeTrailing\r
+    = (fmt == 'G' || fmt == 'g') && !alternate;\r
+    // remove trailing zeroes and decimal point\r
+\r
+    if (d > 0x7FFFFFFFFFFFFFFFL)\r
+      return exp_format(d);\r
+    if (precision == 0)\r
+      return (long)(d + 0.5) + (removeTrailing ? "" : ".");\r
+\r
+    long whole = (long)d;\r
+    double fr = d - whole; // fractional part\r
+    if (fr >= 1 || fr < 0)\r
+      return exp_format(d);\r
+\r
+    double factor = 1;\r
+    String leading_zeroes = "";\r
+    for (int i = 1; i <= precision && factor <= 0x7FFFFFFFFFFFFFFFL; i++) {\r
+      factor *= 10;\r
+      leading_zeroes = leading_zeroes + "0";\r
+    }\r
+    long l = (long) (factor * fr + 0.5);\r
+    if (l >= factor) {\r
+      l = 0;\r
+      whole++;\r
+    } // CSH 10-25-97\r
+\r
+    String z = leading_zeroes + l;\r
+    z = "." + z.substring(z.length() - precision, z.length());\r
+\r
+    if (removeTrailing) {\r
+      int t = z.length() - 1;\r
+      while (t >= 0 && z.charAt(t) == '0')\r
+        t--;\r
+      if (t >= 0 && z.charAt(t) == '.')\r
+        t--;\r
+      z = z.substring(0, t + 1);\r
+    }\r
+\r
+    return whole + z;\r
+  }\r
+\r
+  private String exp_format(double d) {\r
+    String f = "";\r
+    int e = 0;\r
+    double dd = d;\r
+    double factor = 1;\r
+    if (d != 0) {\r
+      while (dd > 10) {\r
+        e++;\r
+        factor /= 10;\r
+        dd = dd / 10;\r
+      }\r
+      while (dd < 1) {\r
+        e--;\r
+        factor *= 10;\r
+        dd = dd * 10;\r
+      }\r
+    }\r
+    if ((fmt == 'g' || fmt == 'G') && e >= -4 && e < precision)\r
+      return fixed_format(d);\r
+\r
+    d = d * factor;\r
+    f = f + fixed_format(d);\r
+\r
+    if (fmt == 'e' || fmt == 'g')\r
+      f = f + "e";\r
+    else\r
+      f = f + "E";\r
+\r
+    String p = "000";\r
+    if (e >= 0) {\r
+      f = f + "+";\r
+      p = p + e;\r
+    } else {\r
+      f = f + "-";\r
+      p = p + (-e);\r
+    }\r
+\r
+    return f + p.substring(p.length() - 3, p.length());\r
+  }\r
+\r
+  private int width;\r
+  private int precision;\r
+  private String pre;\r
+  private String post;\r
+  private boolean leading_zeroes;\r
+  private boolean show_plus;\r
+  private boolean alternate;\r
+  private boolean show_space;\r
+  private boolean left_align;\r
+  private char fmt; // one of cdeEfgGiosxXos\r
+}\r
+\r
+\r
+\r
+\r
+\r
diff --git a/src/org/vamsas/objects/utils/GlyphDictionary.java b/src/org/vamsas/objects/utils/GlyphDictionary.java
new file mode 100644 (file)
index 0000000..1ed7b20
--- /dev/null
@@ -0,0 +1,23 @@
+package org.vamsas.objects.utils;\r
+\r
+/**\r
+ * dict attribute values for glyph symbol sets found in org.vamsas.objects.core.AnnotationElement\r
+ * TODO: add validators and multilength symbols.\r
+ * @author JimP\r
+ *\r
+ */\r
+public class GlyphDictionary {\r
+  /**\r
+   * standard H, E, or C three state secondary structure assignment.\r
+   */\r
+  static final public String PROTEIN_SS_3STATE="aasecstr_3"; // HE, blank or C\r
+  /**\r
+   * default glyph type attribute indicates a UTF8 character\r
+   */\r
+  static final public String DEFAULT="utf8";\r
+  /**\r
+   * kyte and doolittle hydrophobicity\r
+   * TODO: specify this glyph set.\r
+   */\r
+  static final public String PROTEIN_HD_HYDRO="kd_hydrophobicity";\r
+}\r
diff --git a/src/org/vamsas/objects/utils/ProvenanceStuff.java b/src/org/vamsas/objects/utils/ProvenanceStuff.java
new file mode 100644 (file)
index 0000000..2e813f7
--- /dev/null
@@ -0,0 +1,45 @@
+package org.vamsas.objects.utils;
+
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.Provenance;
+
+public class ProvenanceStuff {
+
+  /**
+   * stuff for making and doing things with provenance objects.
+   */
+  static Log log = LogFactory.getLog(ProvenanceStuff.class);
+
+  /**
+   * @param app TODO
+   * @param action
+   *          text for action entry
+   * @return new Provenance entry for ArchiveWriter created docs.
+   * TODO: Verify and move to SimpleClient class for provenance handling
+   */
+  public static Entry newProvenanceEntry(String app, String user, String action) { 
+    log.debug("Adding ProvenanceEntry("+user+","+action+")");
+    Entry e = new Entry();
+    e.setApp(app);
+    e.setAction(action);
+    e.setUser(user);
+    e.setDate(new org.exolab.castor.types.Date(new Date()));
+    return e;
+  }
+  public static Provenance newProvenance(Entry entry) {
+    Provenance list = new Provenance();
+    list.addEntry(entry);
+    return list;
+  }
+  public static Provenance newProvenance(String user, String action) {
+    return newProvenance(ProvenanceStuff.newProvenanceEntry("vamsasApp:ExampleVamsasClient/alpha", user, action));
+  }
+  public static Provenance newProvenance(String app, String user, String action) {
+    return newProvenance(ProvenanceStuff.newProvenanceEntry(app, user, action));
+  }
+
+}
diff --git a/src/org/vamsas/objects/utils/Seq.java b/src/org/vamsas/objects/utils/Seq.java
new file mode 100644 (file)
index 0000000..b1955a1
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Created on 17-May-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.objects.utils;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.regex.Pattern;
+
+import org.vamsas.objects.core.AlignmentSequence;
+import org.vamsas.objects.core.Sequence;
+import org.vamsas.objects.core.SequenceType;
+
+/**
+ * @author jimp
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class Seq {
+
+       public static void write_PirSeq(OutputStream os, SequenceType seq, int wid) throws IOException {
+               BufferedWriter pir_out = new BufferedWriter(new OutputStreamWriter(os));
+               pir_out.write(">P1;"+seq.getName()+"\n");
+               int width = (wid<1) ? 80 : wid;
+               for (int j=0,k=seq.getSequence().length(); j<k; j+=width)
+                       if (j+width<k)
+                               pir_out.write(seq.getSequence().substring(j,j+width)+"\n");
+                       else
+                               pir_out.write(seq.getSequence().substring(j)+"\n");
+               pir_out.flush();
+         }
+  
+       public static void write_FastaSeq(OutputStream os, SequenceType seq) throws IOException {
+               BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
+               fasta_out.write(">"+seq.getName()+"\n");
+               fasta_out.write(seq.getSequence()+"\n");
+               fasta_out.flush();
+         }
+
+       public static void write_FastaSeq(OutputStream os, SequenceType seq, int wid) throws IOException {
+               BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
+               fasta_out.write(">"+seq.getName()+"\n");
+               int width = (wid<1) ? 80 : wid;
+               for (int j=0,k=seq.getSequence().length(); j<k; j+=width)
+                       if (j+width<k)
+                               fasta_out.write(seq.getSequence().substring(j,j+width)+"\n");
+                       else
+                               fasta_out.write(seq.getSequence().substring(j)+"\n");
+               fasta_out.flush();
+         }
+       /**
+   *validate a SequenceType Vobject as an info:iubmb.org/aminoacid SequenceType
+   *This version resolves references to Sequence objects from AlignmentSequence
+   *TODO: Define info: urn for dictionary string (could also be regex of valid characters!)
+   * @param s
+        * @param dict TODO
+   * @return true if a valid amino acid sequence Vobject
+        */
+       private static boolean valid_aadictionary_string(String s, String dict) {
+    if (s==null)
+      return false;
+    // validate against dictionary
+    // TODO generalise to resolve dictionary against info: urn for dictionary type
+      Pattern aa_repl = Pattern.compile("[ARNDCQEGHILKMFPSTWYVUX]+", Pattern.CASE_INSENSITIVE);
+      String remnants = aa_repl.matcher(s).replaceAll("");
+      return !remnants.matches("//S+");
+  }
+
+  public static Sequence newSequence(String Name, String Sequence, String Dictionary, int start, int end) {
+    //TODO: make hierarchy reflecting the SeqType Vobject.
+    Sequence seq= new Sequence();
+     seq.setDictionary(Dictionary);
+     seq.setName(Name);
+     seq.setSequence(Sequence);
+     seq.setStart(start);
+     if (start<=end) {
+       if ((end-start)!=Sequence.length())
+         seq.setEnd(start+Sequence.length());
+     } else {
+       // reverse topology mapping. TODO: VAMSAS: decide if allowed to do start>end on Sequence Vobject
+       if ((start-end)!=Sequence.length())
+         seq.setEnd(end+Sequence.length());
+     }
+     return seq;
+  }
+  public static AlignmentSequence newAlignmentSequence(String name, String alSequence, Sequence refseq, int start, int end) {
+    if (refseq!=null) {
+      AlignmentSequence asq = new AlignmentSequence();
+      asq.setName(name);
+      asq.setSequence(alSequence);
+      asq.setRefid(refseq);
+      if (start<refseq.getStart())
+        start = refseq.getStart();
+      asq.setStart(start);
+      if (end>refseq.getEnd())
+        end = refseq.getEnd();
+      asq.setEnd(end);
+      return asq;
+    }
+    return null;
+  }
+  public static boolean is_valid_aa_seq(SequenceType s) {
+    Sequence q;
+    boolean validref=false;
+    if (s instanceof Sequence) {
+      q=(Sequence) s;
+      if (q.getDictionary()!=null 
+    
+        && q.getDictionary().length()>0
+        || !q.getDictionary().equals(SymbolDictionary.STANDARD_AA))
+        return false;
+      return valid_aadictionary_string(q.getSequence(), SymbolDictionary.STANDARD_AA);
+    }
+    
+    // follow references
+    if (s instanceof AlignmentSequence) {
+      Object w = (((AlignmentSequence) s).getRefid());
+      if (w!=null && w!=s && w instanceof SequenceType)
+        return is_valid_aa_seq((SequenceType) w) 
+        && valid_aadictionary_string(((AlignmentSequence) s).getSequence(), SymbolDictionary.STANDARD_AA);
+    }
+    
+    return false;
+  }
+}
diff --git a/src/org/vamsas/objects/utils/SeqAln.java b/src/org/vamsas/objects/utils/SeqAln.java
new file mode 100644 (file)
index 0000000..5e351f9
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Created on 17-May-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.objects.utils;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.regex.Pattern;
+
+import org.vamsas.objects.core.*;
+
+/**
+ * @author jimp
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class SeqAln extends org.vamsas.objects.core.Alignment {
+
+  public static Sequence[] ReadClustalFile(InputStream os) throws Exception {
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);
+    String gapchars = "";
+    char gapchar = '-';
+
+    int i = 0;
+    boolean flag = false;
+
+    Vector headers = new Vector();
+    Hashtable seqhash = new Hashtable();
+    Sequence[] seqs = null;
+    int noSeqs = 0;
+    String line;
+
+    try {
+      BufferedReader ins = new BufferedReader(new InputStreamReader(os));
+      while ((line = ins.readLine()) != null) {
+        if (line.indexOf(" ") != 0) {
+          java.util.StringTokenizer str = new StringTokenizer(line, " ");
+          String id = "";
+
+          if (str.hasMoreTokens()) {
+            id = str.nextToken();
+            if (id.equals("CLUSTAL")) {
+              flag = true;
+            } else {
+              if (flag) {
+                StringBuffer tempseq;
+                if (seqhash.containsKey(id)) {
+                  tempseq = (StringBuffer) seqhash.get(id);
+                } else {
+                  tempseq = new StringBuffer();
+                  seqhash.put(id, tempseq);
+                }
+
+                if (!(headers.contains(id))) {
+                  headers.addElement(id);
+                }
+
+                tempseq.append(str.nextToken());
+              }
+            }
+          }
+        }
+      }
+
+    } catch (IOException e) {
+      throw (new Exception("Exception parsing clustal file ", e));
+    }
+
+    if (flag) {
+      noSeqs = headers.size();
+
+      // Add sequences to the hash
+      seqs = new Sequence[headers.size()];
+      for (i = 0; i < headers.size(); i++) {
+        if (seqhash.get(headers.elementAt(i)) != null) {
+          // TODO: develop automatic dictionary typing for sequences
+          Sequence newSeq = Seq.newSequence(headers.elementAt(i).toString(),
+              seqhash.get(headers.elementAt(i).toString()).toString(),
+              SymbolDictionary.STANDARD_AA,0,0);
+
+          seqs[i] = newSeq;
+
+        } else {
+          throw (new Exception("Bizarreness! Can't find sequence for "
+              + headers.elementAt(i)));
+        }
+      }
+    }
+    return seqs;
+  }
+
+  public static void WriteClustalWAlignment(java.io.OutputStream os,
+      Alignment seqAl) throws IOException {
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    AlignmentSequence[] s = seqAl.getAlignmentSequence();
+
+    java.io.BufferedWriter out = new BufferedWriter(
+        new java.io.OutputStreamWriter(os));
+
+    out.write("CLUSTAL\n\n");
+
+    int max = 0;
+    int maxid = 0;
+
+    int i = 0;
+
+    while (i < s.length && s[i] != null) {
+      String tmp = s[i].getId();
+
+      if (s[i].getSequence().length() > max) {
+        max = s[i].getSequence().length();
+      }
+      if (tmp.length() > maxid) {
+        maxid = tmp.length();
+      }
+      i++;
+    }
+
+    if (maxid < 15) {
+      maxid = 15;
+    }
+    maxid++;
+    int len = 60;
+    int nochunks = max / len + 1;
+
+    for (i = 0; i < nochunks; i++) {
+      int j = 0;
+      while (j < s.length && s[j] != null) {
+        out.write(new Format("%-" + maxid + "s").form(s[j].getId() + " "));
+        int start = i * len;
+        int end = start + len;
+
+        if (end < s[j].getSequence().length() && start < s[j].getSequence().length()) {
+          out.write(s[j].getSequence().substring(start, end) + "\n");
+        } else {
+          if (start < s[j].getSequence().length()) {
+            out.write(s[j].getSequence().substring(start) + "\n");
+          }
+        }
+        j++;
+      }
+      out.write("\n");
+
+    }
+  }
+  /**
+   * manufacture an alignment/dataset from an array of sequences
+   * @param origin
+   * @param seqs
+   * @return
+   * @throws Exception
+   */
+  public static Alignment make_Alignment(Entry origin,
+      Sequence[] seqs) throws Exception {
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    Alignment al = new Alignment();
+    al.setProvenance(ProvenanceStuff.newProvenance(origin));
+    
+    Pattern nonGap = Pattern.compile("[A-Z*0-9]", Pattern.CASE_INSENSITIVE);
+    boolean gapsset = false;
+    char gapchar = '-';
+    int seqLength = 0;
+
+    for (int i = 0, nseq = seqs.length; i < nseq; i++) {
+      String seq = seqs[i].getSequence();
+      String gaps = nonGap.matcher(seq).replaceAll("");
+      if (seqLength == 0) {
+        seqLength = seq.length();
+      } else if (seqLength != seq.length())
+        throw (new Exception(i + "th Sequence (>" + seqs[i].getId()
+            + ") is not aligned.\n"));// TODO: move this to assertions part of
+                                      // Alignment
+
+      // common check for any sequence...
+      if (gaps != null && gaps.length() > 0) {
+        if (!gapsset)
+          gapchar = gaps.charAt(0);
+        for (int c = 0, gc = gaps.length(); c < gc; c++) {
+          if (gapchar != gaps.charAt(c)) {
+            throw (new IOException("Inconsistent gap characters in sequence "
+                + i + ": '" + seq + "'"));
+          }
+        }
+      }
+      AlignmentSequence sq = new AlignmentSequence();
+      // TODO: use as basis of default AlignSequence(Sequence) constructor.
+      sq.setSequence(seq);
+      sq.setName(seqs[i].getId());
+      sq.setRefid(seqs[i].getVorbaId());
+      sq.setStart(seqs[i].getStart());
+      sq.setEnd(seqs[i].getEnd());
+      al.addAlignmentSequence(sq);
+    }
+    al.setGapChar(String.valueOf(gapchar));
+    return al;
+  }
+
+  public static Alignment read_FastaAlignment(InputStream os, Entry entry)
+      throws Exception {
+    Sequence[] seqs;
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    try {
+      seqs = SeqSet.read_SeqFasta(os);
+      if (seqs == null)
+        throw (new Exception("Empty alignment stream!\n"));
+    } catch (Exception e) {
+      throw new Exception("Invalid fasta alignment\n", e);
+    }
+    
+    return make_Alignment(entry, seqs);
+  }
+
+  public static Alignment read_ClustalAlignment(InputStream os, Entry entry)
+      throws Exception {
+    Sequence[] seqs;
+    try {
+      seqs = SeqAln.ReadClustalFile(os);
+      if (seqs == null)
+        throw (new Exception("Empty alignment stream!\n"));
+    } catch (Exception e) {
+      throw new Exception("Invalid fasta alignment\n", e);
+    }
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    return make_Alignment(entry, seqs);
+  }
+}
diff --git a/src/org/vamsas/objects/utils/SeqSet.java b/src/org/vamsas/objects/utils/SeqSet.java
new file mode 100644 (file)
index 0000000..294ce43
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Created on 17-May-2005
+ * Slurped into VamsasClient object set on 12th Jan 2006
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.objects.utils;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.regex.Pattern;
+
+import org.vamsas.objects.core.*;
+
+/**
+ * @author jimp
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SeqSet {
+  
+  public static void write_Fasta(OutputStream os, SequenceType[] seqs) throws IOException {
+    write_Fasta(os, seqs, 80);
+  }
+  
+  public static void write_Fasta(OutputStream os, SequenceType[] seqs, boolean width80) throws IOException {
+    write_Fasta(os, seqs, (width80) ? 80 : 0);
+  }
+  
+  public static void write_Fasta(OutputStream os, SequenceType[] seqs, int width) throws IOException {
+    int i, nseq = seqs.length;
+    BufferedWriter fasta_out = new BufferedWriter(new OutputStreamWriter(os));
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    for (i=0; i<nseq; i++) {
+      fasta_out.write(">"+seqs[i].getName()+"\n");
+      if (width<=0) {
+        fasta_out.write(seqs[i].getSequence()+"\n");
+      } else {
+        // TODO: adapt to SymbolDictionary labelwidths
+        String tempseq = seqs[i].getSequence();
+        int j=0, k=tempseq.length();
+        while (j<k) {
+          int d = k-j;
+          if (d>=width) {
+            fasta_out.write(tempseq, j, width);
+          } else {
+            fasta_out.write(tempseq, j, d);
+          }
+          fasta_out.write("\n");
+          j+=width;
+        }                          
+      }
+    }
+    fasta_out.flush();
+  }
+  /**
+   * TODO: introduce a dictionary parameter for qualified sequence symbols
+   * Reads a sequence set from a stream - will only read prescribed amino acid
+   * symbols. 
+   * @param os
+   * @return
+   * @throws IOException
+   */  
+  public static Sequence[] read_SeqFasta(InputStream os) throws IOException {
+    Vector seqs = new Vector();
+    int nseq = 0;
+    BufferedReader infasta = new BufferedReader(new InputStreamReader(os));
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    // TODO: decide on return type - SequenceType is a partly complete vamsas Vobject - either for a dataset or alignment sequence
+    // so could go in either!
+    String line;
+    Sequence seq = null;
+    Pattern aaMatch = Pattern.compile("[ARNDCQEGHILKMFPSTUWYV]", Pattern.CASE_INSENSITIVE);
+    String sname = "", seqstr=null;
+    do {
+      line = infasta.readLine();
+      if (line==null || line.startsWith(">")) {
+        if (seqstr!=null) 
+          seqs.add((Object) Seq.newSequence(sname.substring(1), seqstr, SymbolDictionary.STANDARD_AA, 0,0));
+        sname = line; // remove >
+        seqstr="";
+      } else { 
+        String subseq = Pattern.compile("//s+").matcher(line).replaceAll("");
+        seqstr += subseq;                      
+      }
+    } while (line!=null);
+    nseq = seqs.size();
+    if (nseq>0) {
+      // TODO:POSS: should really return a sequence if there's only one in the file.
+      Sequence[] seqset = new Sequence[nseq];
+      for (int i=0; i<nseq; i++) {
+        seqset[i] = (Sequence) seqs.elementAt(i);
+      }
+      return seqset;
+    }
+    
+    return null;
+  }
+  
+  public static Hashtable uniquify(SequenceType[] sequences) {
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    // TODO: do we need this with vamsas sequences ?
+    // Generate a safely named sequence set and a hash to recover the sequence names
+    Hashtable map = new Hashtable();
+    for (int i = 0; i < sequences.length; i++) {
+      String safename = new String("Sequence" + i);
+      map.put(safename, sequences[i].getName());
+      sequences[i].setName(safename);
+    }
+    return map;
+  }
+  
+  public static boolean deuniquify(Hashtable map, SequenceType[] sequences) {
+    System.err.println("NOT FULLY IMPLEMENTED!"); // TODO: Finish adapting this method
+    // TODO: do we need this with vamsas sequences ?
+    // recover unsafe sequence names for a sequence set
+    boolean allfound = true;
+    for (int i = 0; i < sequences.length; i++) {
+      if (map.containsKey(sequences[i].getName())) {
+        String unsafename = (String) map.get(sequences[i].getName());
+        sequences[i].setName(unsafename);
+      } else {
+        allfound = false;
+      }
+    }
+    return allfound;
+  }
+  
+}
diff --git a/src/org/vamsas/objects/utils/SymbolDictionary.java b/src/org/vamsas/objects/utils/SymbolDictionary.java
new file mode 100644 (file)
index 0000000..07cdab3
--- /dev/null
@@ -0,0 +1,19 @@
+package org.vamsas.objects.utils;
+
+public class SymbolDictionary {
+  /**
+   * defines standard names and properties for vamsas sequence dictionaries
+   */
+  static final public String STANDARD_AA="info:iubmb.org/aminoacids"; // strict 1 letter code
+  static final public String STANDARD_NA="info:iubmb.org/nucleosides";// strict 1 letter code (do not allow arbitrary rare nucleosides)
+  /**
+   * TODO: Vamsas Dictionary properties interface
+   * an interface for dictionary provides :
+   * validation for a string
+   * symbolwidth (or symbol next/previous)
+   * mappings to certain other dictionaries (one2three, etc)
+   * gap-character test
+   * 
+   */
+  
+}
diff --git a/src/org/vamsas/objects/utils/document/VersionEntries.java b/src/org/vamsas/objects/utils/document/VersionEntries.java
new file mode 100644 (file)
index 0000000..3edf9bb
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * 
+ */
+package org.vamsas.objects.utils.document;
+
+import java.util.Hashtable;
+
+/**
+ *  enumerates versions for the VamsasDocument.Version string
+ *  provides version comparison methods
+ *  TODO: LATER: associate schema versions with these strings
+ */
+public class VersionEntries {
+  public static final String ALPHA_VERSION="alpha";
+  public static final String BETA_VERSION="beta";
+  protected static Hashtable versions;
+  static {
+    versions = new Hashtable();
+    // integers represent version hierarchy - 0 precedes 1
+    versions.put(ALPHA_VERSION, new Integer(0)); 
+    versions.put(BETA_VERSION, new Integer(1));
+  }
+  // TODO: LATER: decide on best pattern for enumeration classes (ie - need an ordered list of versions, and validator, plus explicit enum-strings)
+  public static boolean isVersion(String vstring) {
+    return versions.containsKey(vstring);
+  }
+  /**
+   * returns 0 if levels are equivalent, 
+   * 1 if higher is valid and higher, 
+   * 2 if lower is valid and higher
+   * -1 if both levels are invalid
+   * @param higher
+   * @param lower
+   * @return
+   */
+  public static int compare(String higher, String lower) {
+    int v_1 = versions.containsKey(higher) ? ((Integer) versions.get(higher)).intValue() : -1;
+    int v_2 = versions.containsKey(lower) ? ((Integer) versions.get(lower)).intValue() : -1;
+    int comp = v_1<v_2 ? 2 : v_1 == v_2 ? 0 : 1;
+    return (comp==0) ? (v_1!=-1 ? 0 : -1) : comp;
+  }
+  /**
+   * @return the latest version that this vamsas library supports
+   */
+  public static String latestVersion() {
+    return BETA_VERSION;
+  }
+
+}
diff --git a/src/org/vamsas/test/ExampleApplication.java b/src/org/vamsas/test/ExampleApplication.java
new file mode 100644 (file)
index 0000000..071d20d
--- /dev/null
@@ -0,0 +1,160 @@
+/**
+ * Created on 14-Sep-2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.vamsas.test;
+
+import org.vamsas.client.*;
+
+import java.awt.Event;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.util.Vector;
+/**
+ * Toy vamsas command line client application demonstrating the API.
+ * 
+ * @author jimp
+ */
+
+public class ExampleApplication {
+  private static ClientHandle app;
+  private static UserHandle user; // TODO: make this something defined by the api
+  private static IClientFactory clientfactory;
+  private static IClient vorbaclient;
+  private static byte[] mydata;
+  private static Vector vamsasObjects;
+  private static boolean isUpdated = false;
+  private static boolean isShuttingdown = false;
+  private static boolean isFinalizing = false;
+  private static void processVamsasDocument(IClientDocument doc) {
+    // merge vamsasObjects with vamsas objects in document
+    // get this apps 'mydata' if it hasn't got it already.
+    // .. access this application's 'public' mydata' if there is any.
+  }
+  private static void addHandlers(IClient avorbaclient) {
+    // make a non-volatile reference to the client instance.
+    final IClient vorbaclient = avorbaclient;
+    // register update handler
+    vorbaclient.addDocumentUpdateHandler(new PropertyChangeListener() {
+      public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("Vamsas document update for "+evt.getPropertyName()
+            +": "+evt.getOldValue()+" to "+evt.getNewValue());
+        // merge new data into ours.
+        isUpdated=true; // tell main thread to reflect change...
+      }
+    });
+    // register close handler
+    vorbaclient.addVorbaEventHandler(Events.DOCUMENT_REQUESTTOCLOSE, 
+        new PropertyChangeListener() {
+       public void propertyChange(PropertyChangeEvent evt) {
+         System.out.println("Received request to close vamsas document.");
+         // ask user for a filename to save it to. 
+         // Then pass it to the vorba object...
+         vorbaclient.storeDocument(new java.io.File("UserLocation"));
+       }
+    });
+    
+    // register some more handlers to monitor the session :
+    
+    vorbaclient.addVorbaEventHandler(Events.CLIENT_CREATION, 
+        new PropertyChangeListener() {
+      public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("New Vamsas client for "+evt.getPropertyName()
+            +": "+evt.getOldValue()+" to "+evt.getNewValue());
+        // tell app add new client to its list of clients.
+      }
+    });
+    vorbaclient.addVorbaEventHandler(Events.CLIENT_FINALIZATION, 
+        new PropertyChangeListener() {
+      public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("Vamsas client finalizing for "+evt.getPropertyName()
+            +": "+evt.getOldValue()+" to "+evt.getNewValue());
+        // tell app to update its list of clients to communicate with.
+      }
+    });
+    vorbaclient.addVorbaEventHandler(Events.SESSION_SHUTDOWN, 
+        new PropertyChangeListener() {
+      public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("Session "+evt.getPropertyName()+" is shutting down.");
+        // tell app to finalize its session data before shutdown.
+      }
+    });
+    vorbaclient.addVorbaEventHandler(Events.DOCUMENT_FINALIZEAPPDATA, 
+        new PropertyChangeListener() {
+      public void propertyChange(PropertyChangeEvent evt) {
+        System.out.println("Application received a DOCUMENT_FINALIZEAPPDATA event.");
+        // tell app to finalize its session data prior to the storage of the current session as an archive.
+      }
+    });
+    
+  }
+  public static String 
+       Usage="ExampleApplication <vamsasFileDirectory> <vamsasSessionURN> <action> [+<arguments>]\n"
+         +"<action> is one of :\n\tsave,update,close,watch";
+  
+  private static boolean parseArgs(String args[]) {
+    return true; // incorrect arguments.
+  }
+  public static void main(String[] args) {
+    if ((args.length<=2) || !parseArgs(args)) {
+      System.err.print(Usage);
+    }
+
+    // get IClientFactory
+    try {
+      clientfactory = new org.vamsas.client.simpleclient.SimpleClientFactory(args[0]);
+    } catch (IOException e) {
+      System.err.println(e+"\n"+Usage);
+      System.exit(1);
+    }
+    
+    // get an Iclient with session data
+    app = new ClientHandle("org.vamsas.test.ExampleApplication","0.1");
+    user = new UserHandle("arnolduser","deathsdoor");
+    try {
+      vorbaclient = clientfactory.getIClient(app, user);
+    } catch (NoDefaultSessionException e) {
+      System.err.println("There appear to be several sessions to choose from :");
+      String[] sessions = clientfactory.getCurrentSessions();
+      for (int s=0;s<sessions.length; s++)
+        System.err.println(sessions[s]);
+      System.exit(2);
+    }
+    addHandlers(vorbaclient);
+    try {
+      vorbaclient.joinSession();
+    }
+    catch (Exception se) {
+      se.printStackTrace();
+      System.err.println(se+" when joining session.\n"+Usage);
+      System.exit(1);
+    }
+    // register an update listener and a close listener.
+    // get document data
+    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) {
+      // do something with data
+      // , update document, or something.
+      // ..
+      
+    }
+    // call finalizeClient
+    vorbaclient.finalizeClient();
+    // { meanwhile, eventHandlers are called to do any saves if need be }
+    // and all registered listeners will be deregistered to avoid deadlock.
+    
+    // finish
+  }
+}
diff --git a/src/org/vamsas/test/objects/Core.java b/src/org/vamsas/test/objects/Core.java
new file mode 100644 (file)
index 0000000..ffc8a23
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * 
+ */
+package org.vamsas.test.objects;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.objects.core.*;
+import org.vamsas.objects.utils.*;
+import org.vamsas.objects.utils.document.*;
+import org.vamsas.test.simpleclient.ArchiveReports;
+
+/**
+ * @author jim
+ * test XSD-Java binding classes in org.vamsas.objects.core
+ */
+public class Core {
+  static Log log = LogFactory.getLog(Core.class);
+
+  /**
+   * 
+   * complete any automatically completable entries in the dataset
+   * @param ds
+   */
+  public static String user = "org.vamsas.test.objects.Core";
+  
+  public static void complete(DataSet ds) {
+    Sequence[] q = ds.getSequence();
+    for (int i=0,j=q.length; i<j; i++) {
+      q[i].setStart(i+1);
+      q[i].setEnd(q[i].getSequence().length()+i+1);
+    }
+  }  
+
+  public static VAMSAS getDemoVamsas() {
+     VAMSAS v=new VAMSAS();
+     DataSet ds = new DataSet();
+     ds.addSequence(Seq.newSequence("Dummy1","ASDFLEQ",SymbolDictionary.STANDARD_AA, 5, 11));
+     ds.addSequence(Seq.newSequence("Dummy2","ASFLEQ",SymbolDictionary.STANDARD_AA, 5, 10));
+     ds.addSequence(Seq.newSequence("Dummy3","ADFEQ",SymbolDictionary.STANDARD_AA, 3, 7));
+     ds.setProvenance(ProvenanceStuff.newProvenance(user, "constructed some dummy sequences"));
+     complete(ds);
+     v.addDataSet(ds);
+     Alignment al = new Alignment();
+     al.setProvenance(ProvenanceStuff.newProvenance(user, "Created dummy alignment"));
+     //   rely on newAlignmentSequence to set start/end correctly
+     al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned1", "ASDFLEQ", ds.getSequence(0), -1, -1)); 
+     al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned2", "AS-FLEQ", ds.getSequence(1), -1, -1)); 
+     al.addAlignmentSequence(Seq.newAlignmentSequence("Aligned3", "A-DF-EQ", ds.getSequence(2), -1, -1)); 
+     al.setGapChar("-");
+     ds.addAlignment(al);
+     // TODO: create annotations
+     // TODO: create tree
+     return v;
+   }
+  /**
+   * @param args
+   */
+  public static void main(String[] args) {
+    
+    /**
+     * test constants and controlled vocab utils
+     */
+    System.out.println("VersionEntries.compare(invalid, ALPHA) returned "+VersionEntries.compare("invalid", VersionEntries.ALPHA_VERSION));
+    System.out.println("VersionEntries.compare(ALPHA, invalid) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION, "invalid"));      
+    System.out.println("VersionEntries.compare(BETA, ALPHA) returned "+VersionEntries.compare(VersionEntries.BETA_VERSION,VersionEntries.ALPHA_VERSION));
+    System.out.println("VersionEntries.compare(ALPHA, BETA) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION,VersionEntries.BETA_VERSION));
+    System.out.println("VersionEntries.compare(ALPHA, ALPHA) returned "+VersionEntries.compare(VersionEntries.ALPHA_VERSION,VersionEntries.ALPHA_VERSION));
+    System.out.println("VersionEntries.compare(invalid, invalid) returned "+VersionEntries.compare("invalid", "invalid"));
+    System.out.println("VersionEntries.latestVersion()="+VersionEntries.latestVersion()+
+        ", dict_aa="+SymbolDictionary.STANDARD_AA+", dict_na="+SymbolDictionary.STANDARD_NA);
+    /**
+     * Test utils and autogenerated Vobject interfaces
+     */
+    
+    VamsasDocument doc = DocumentStuff.newVamsasDocument(new VAMSAS[] { getDemoVamsas() }, 
+        ProvenanceStuff.newProvenance("org.vamsas.objects.test.Core", "Created demo vamsasDocument"),
+        VersionEntries.latestVersion());
+    ArchiveReports.reportDocument(doc, null, true, System.out);
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveClient.java b/src/org/vamsas/test/simpleclient/ArchiveClient.java
new file mode 100644 (file)
index 0000000..c681fe0
--- /dev/null
@@ -0,0 +1,292 @@
+/**
+ * 
+ */
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.ValidationException;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.IVorbaIdFactory;
+import org.vamsas.client.SessionHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.Vobject;
+import org.vamsas.client.VorbaId;
+import org.vamsas.client.simpleclient.AppDataOutputStream;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.IdFactory;
+import org.vamsas.client.simpleclient.SessionFile;
+import org.vamsas.client.simpleclient.SimpleDocBinding;
+import org.vamsas.client.simpleclient.SimpleDocument;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.AppData;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.User;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.AppDataReference;
+import org.vamsas.objects.utils.DocumentStuff;
+import org.vamsas.objects.utils.ProvenanceStuff;
+import org.vamsas.objects.utils.SeqSet;
+import org.vamsas.objects.utils.document.VersionEntries;
+import org.vamsas.test.objects.Core;
+
+/**
+ * @author jimp
+ *  test the VamsasFile routines for watching, reading and updating a vamsas document jar file.
+ *  simple document access base class.
+ */
+public class ArchiveClient extends IdFactory {
+  
+  private Log log = LogFactory.getLog(ArchiveClient.class);
+  // protected UserHandle user=null;
+  // protected ClientHandle me = new ClientHandle("ArchiveClient","0.01");
+  VamsasFile vsess;
+  
+  /**
+   * @param user
+   * @param vsess
+   */
+  public ArchiveClient(UserHandle user, VamsasFile vsess) {
+    super(new SessionHandle("vamsasfile://"+vsess.getVamsasFile()), new ClientHandle("ArchiveClient","0.01"), user);
+    this.vsess = vsess;
+    valid();
+  }
+  private void _openVsess(File vsess) {
+    try {
+      this.vsess = new VamsasFile(vsess);
+    }
+    catch (Exception e) {
+      log.error("Couldn't open session for file "+vsess,e);
+      this.vsess = null;
+    }
+  }
+  public ArchiveClient(String username, String organization, File vsess) {
+    super(new SessionHandle("vamsasfile://"+vsess), new ClientHandle("ArchiveClient","0.01"), new UserHandle(username, organization));
+    _openVsess(vsess);
+    valid();
+  }
+  public ArchiveClient(String username, String organization, String clientName, String clientVersion, File vsess) {
+    super(new SessionHandle("vamsasfile://"+vsess), new ClientHandle(clientName, clientVersion), new UserHandle(username, organization));
+    _openVsess(vsess);
+    valid();
+  }
+  public void valid() {
+    if (vsess==null)
+      throw new Error("ArchiveClient instance is invalid!.");
+  }
+  /**
+   * set this to false if watch loop should end immediately
+   */
+  protected boolean watchForChange=true;
+  public static int WATCH_SLEEP=300;
+  /**
+   * watch the document file for updates.
+   * @param time - length of time to watch for.
+   * @return read only IO interface for session document.
+   */
+  public ClientDoc watch(long time) {
+    valid();
+    vsess.unLock(); // doh.
+    FileWatcher watcher = new FileWatcher(vsess.getVamsasFile());
+    // watcher.setState();
+    watchForChange=true;
+    long endtime=System.currentTimeMillis()+time;
+    try {
+      org.vamsas.client.simpleclient.Lock doclock;
+      do {
+        doclock=watcher.getChangedState();
+        if (doclock==null)
+          Thread.sleep(WATCH_SLEEP);
+      } while (watchForChange && doclock==null && (time==0 || endtime>System.currentTimeMillis())); // tuning.
+      if (doclock==null)
+        return null;
+      else {
+        return getUpdateable(vsess.getLock(doclock));
+        /*VamsasArchiveReader varc = new VamsasArchiveReader(vsess.getVamsasFile());
+        return _getReadonly(varc);*/
+      }
+    } catch (Exception e) {
+      log.error("Whilst watching file "+vsess.getVamsasFile(), e);
+    }
+    return null;
+  }
+
+  // from ClientDocument.getClientAppdata
+  private AppData[] getAppData(VamsasDocument doc) {
+    if (doc==null) {
+      log.debug("extractAppData called for null document object");
+      return null;
+    }
+    AppData appsGlobal=null, usersData=null;
+    Vector apldataset = AppDataReference.getUserandApplicationsData(
+        doc, this.getUserHandle(), this.getClientHandle());
+    if (apldataset!=null) {
+      if (apldataset.size()>0) {
+        AppData clientdat = (AppData) apldataset.get(0);
+        if (clientdat instanceof ApplicationData) {
+          appsGlobal = (ApplicationData) clientdat;
+          if (apldataset.size()>1) {
+            clientdat = (AppData) apldataset.get(1);
+            if (clientdat instanceof User) {
+              usersData = (User) clientdat;
+            }
+            if (apldataset.size()>2)
+              log.info("Ignoring additional ("+(apldataset.size()-2)+") AppDatas returned by document appdata query.");
+          } 
+        } else {
+          log.warn("Unexpected entry in AppDataReference query: id="+clientdat.getVorbaId()+" type="+clientdat.getClass().getName());
+        }
+        apldataset.removeAllElements(); // destroy references.
+      }
+    }
+    return new AppData[] { appsGlobal, usersData};
+  }
+  
+  protected ClientDoc _getReadonly(VamsasArchiveReader vreader) throws IOException, ValidationException, MarshalException {
+    valid();
+    if (vreader!=null) {
+      SimpleDocBinding docb = new SimpleDocBinding();
+      docb.setVorba(this);
+      VamsasDocument d;
+      d = docb.getVamsasDocument(vreader);
+      
+      if (d!=null) {
+        ClientDoc creader = new ClientDoc(d, null, vreader, getClientHandle().getClientUrn(), getProvenanceUser(), getVorbaIdHash());
+        return creader;
+      }
+    }
+    return null;
+  }  
+  /**
+   * from SimpleClient
+   * @return user field for a provenance entry
+   */
+  protected String getProvenanceUser() {
+    return new String(getUserHandle().getFullName()+" ["+getClientHandle().getClientUrn()+"]");
+  }
+  
+  public ClientDoc getUpdateable() {
+    return getUpdateable(null);
+  }
+  public ClientDoc getUpdateable(org.vamsas.client.simpleclient.Lock lock) {
+    getVorbaIdHash().clear();
+    valid();
+    try {
+      // patiently wait for a lock on the document.
+      long tries=5000;
+      while (lock==null && ((lock=vsess.getLock())==null || !lock.isLocked()) && --tries>0) {
+//        Thread.sleep(1);
+        log.debug("Trying to get a document lock for the "+tries+"'th time.");
+      }
+      VamsasArchive varc = new VamsasArchive(vsess, true, false); // read archive, write as vamsasDocument, don't erase original contents.
+      varc.setVorba(this);
+      VamsasDocument d = varc.getVamsasDocument(getProvenanceUser(), "Created new document.", VersionEntries.latestVersion()); // VAMSAS: provenance user and client combined
+      
+      if (d==null) {
+        log.warn("Backing out from opening a VamsasArchive writable IO session");
+        varc.cancelArchive();
+        return null;
+      }      
+      ClientDoc cdoc = new ClientDoc(d, varc, varc.getOriginalArchiveReader(), getClientHandle().getClientUrn(), getProvenanceUser(), getVorbaIdHash());
+      return cdoc;
+      // do appHandle?
+    } catch (Exception e) {
+      log.error("Failed to get Updateable version of "+vsess.getVamsasFile(), e);
+    }
+    return null;
+  }
+  /**
+   * trust client to not do anything stupid to the document roots which will now be written to the archive.
+   * @param cdoc
+   * @return true if write was a success.
+   */
+  public boolean doUpdate(ClientDoc cdoc) {
+    valid();
+    if (cdoc==null) {
+      log.warn("Invalid ClientDoc passed to org.vamsas.test.simpleclient.doUpdate()");
+      return false;
+    }
+    if (cdoc.iohandler==null) {
+      log.warn("Read only ClientDoc object passed to org.vamsas.test.simpleclient.doUpdate()");
+      return false;
+    }
+    if (cdoc.iohandler.getVorba()!=this) {
+      log.error("Mismatch between ClientDoc instances and ArchiveClient instances!");
+      return false;
+    }
+    try {
+      // do any appDatas first.
+      if (cdoc.iohandler.transferRemainingAppDatas())
+        log.debug("Remaining appdatas were transfered.");
+      cdoc.updateDocumentRoots();
+      cdoc.iohandler.putVamsasDocument(cdoc.doc);
+      cdoc.iohandler.closeArchive();
+      this.extantids.clear();// we forget our ids after we close the document.
+      cdoc.iohandler=null;
+      cdoc = null;
+      vsess.unLock();
+    } catch (Exception e) {
+      log.warn("While updating archive in "+vsess.getVamsasFile(),e);
+      return false;
+    }
+    return true;
+  }
+  /**
+   * @param args
+   */
+  public static void usage() {
+    throw new Error("Usage: Username Organization VamsasFile [command,args]*");
+  }
+  public static void main(String[] args) {
+    // really simple.
+    if (args.length<3)
+      usage();
+    
+    ArchiveClient client = new ArchiveClient(args[0],args[1], new File(args[2]));
+    ClientDoc cdoc=null;
+    // sanity test.
+    try {
+      cdoc = client.getUpdateable();
+      // ArchiveReports.reportDocument(cdoc.doc, cdoc.getReader(), true, System.out);
+      System.out.println("Report Roots :");
+      ArchiveReports.rootReport(cdoc.getVamsasRoots(), true, System.out);
+      cdoc.addVamsasRoot(Core.getDemoVamsas());
+      System.out.println("Doing update.");
+      client.doUpdate(cdoc);
+      cdoc.closeDoc();
+      cdoc = null;
+      int u=5;
+      while (--u>0) {
+        System.out.println("Watch for more... ("+u+" left)");
+        ClientDoc ucdoc = client.watch(0000);
+        if (ucdoc!=null) {
+          System.out.println("****\nUpdate detected at "+new Date());
+          ArchiveReports.reportDocument(ucdoc.doc, ucdoc.getReader(), true, System.out);
+          ucdoc.closeDoc();
+          ucdoc=null;
+        } else {
+          System.out.println("!!!! Null document update detected at "+new Date());
+        }
+      }
+    }
+    catch (Exception e) {
+      client.log.error("Broken!", e);
+    }
+    System.out.println("Finished at "+new Date());
+  }
+  public org.vamsas.client.Vobject getObject(VorbaId id) {
+    Hashtable idhash = this.getVorbaIdHash();
+    if (idhash!=null && idhash.containsKey(id))
+      return (Vobject) idhash.get(id);
+    return null;
+    }
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveReader.java b/src/org/vamsas/test/simpleclient/ArchiveReader.java
new file mode 100644 (file)
index 0000000..d7959b4
--- /dev/null
@@ -0,0 +1,50 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+
+public class ArchiveReader {
+  /**
+   * tests VamsasArchiveReader archive reader on a vamsas jar file
+   * @param args
+   */
+  public static void main(String args[]) {
+    
+    try {
+      File av = new File(args[0]);
+      VamsasArchiveReader var = new VamsasArchiveReader(av);
+      VAMSAS roots[]=null;
+      if (var.isValid()) {
+        InputStreamReader vdoc = new InputStreamReader(var.getVamsasDocumentStream());
+        VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
+        if (ArchiveReports.reportDocument(doc, var, true, System.out)) {
+          roots = doc.getVAMSAS();
+        }
+      } else {
+        InputStream vxmlis = var.getVamsasXmlStream();
+        
+        if (vxmlis!=null) { // Might be an old vamsas file.
+          BufferedInputStream ixml = new BufferedInputStream(var.getVamsasXmlStream());
+          InputStreamReader vxml = new InputStreamReader(ixml);
+          VAMSAS root;
+          // unmarshal seems to always close the stream (should check this)
+          if ((root = VAMSAS.unmarshal(vxml))!=null) {
+            System.out.println("Read a root.");
+            roots = new VAMSAS[1];
+            roots[0] = root;
+          }
+        }
+      }
+      if (!ArchiveReports.rootReport(roots, true, System.out))
+        System.err.print(args[0]+" is not a valid vamsas archive.");
+    } catch (Exception e) {
+      e.printStackTrace(System.err);
+    }
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveReports.java b/src/org/vamsas/test/simpleclient/ArchiveReports.java
new file mode 100644 (file)
index 0000000..4a3a284
--- /dev/null
@@ -0,0 +1,186 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+import org.vamsas.client.ClientDocument;
+import org.vamsas.client.Vobject;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.objects.core.Alignment;
+import org.vamsas.objects.core.AppData;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.DataSet;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.Instance;
+import org.vamsas.objects.core.Provenance;
+import org.vamsas.objects.core.Tree;
+import org.vamsas.objects.core.User;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+/**
+ * this class contains static methods for writing info to stdout about a vamsas document
+ * Methods have a 'cascade' switch to indicate if sub-objects should have info printed on them.
+ * Methods return true or false - indicating if the Vobject was valid or not
+ * TODO: LATER: propagate true/false return so that an invalid vamsas Vobject invalidates the whole document
+ * @author jimp
+ *
+ */
+public class ArchiveReports {
+    /**
+     * print an informative summary on a VamsasDocument
+     * @param outstr TODO
+     * @param document - the document itself
+     * @param archive - document source archive for resolving any appData refs
+     * @return
+     */
+  public static boolean reportProvenance(Provenance p, PrintStream outstr) {
+    if (p==null) {
+      outstr.println("No Provenance");
+      return false;
+    }
+    Entry[] pe = p.getEntry();
+    for (int i=0; i<pe.length; i++)
+      outstr.println(pe[i].getDate()+"\t'"+pe[i].getUser()+"'\t"+pe[i].getApp()+"\t'"+pe[i].getAction()+"'");
+    return true;
+  }
+  public static boolean appDataEntryReport(AppData appD, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
+    if (appD!=null) {
+      boolean nulldata=false;
+      if (appD.getDataReference()!=null) {
+        String appData=appD.getDataReference();
+        if (appData==null) { outstr.println("Empty DataReference - not valid ?"); } 
+        else 
+          if (appData.length()>1) {
+          outstr.print("a reference ("+appData+")");
+          InputStream jstrm;
+          if ((jstrm=archive.getAppdataStream(appData))!=null)
+            outstr.println(" which resolves to a JarEntry.");
+          else {
+            outstr.println(" which does not resolve to a JarEntry.");
+            outstr.println("Unresolved appdata reference '"+appData+"'");
+          }
+        } else {
+          nulldata=true;
+        }
+      } else {
+        if (appD.getData()==null)
+          nulldata &= true;
+          else
+          outstr.println("an embedded chunk of "+appD.getData().length+" bytes.");
+      }
+      if (nulldata)
+        outstr.println("Null AppData reference/data chunk.");
+    }
+    return true;
+  }
+  
+  public static boolean appDataReport(ApplicationData appD, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
+    if (appD!=null) {
+      // Report on root appData
+      appDataEntryReport(appD, archive, cascade, outstr);
+      if (appD.getInstanceCount()>0) {
+        Instance inst[] = appD.getInstance();
+        for (int i=0,j=inst.hashCode(); i<j; i++) {
+          outstr.println("Data for App Instance URN: '"+inst[i].getUrn());
+          appDataEntryReport(inst[i],archive,cascade,outstr);
+        }
+      }
+      if (appD.getUserCount()>0) {
+        User users[] = appD.getUser();
+        for (int i=0,j=users.length; i<j; i++) {
+          outstr.println("Data for User '"+users[i].getFullname()+"' of '"+users[i].getOrganization()+"'");
+          appDataEntryReport(users[i], archive, cascade, outstr);
+        }
+      }
+    }
+
+    return true;
+  }
+  public static boolean reportDocument(VamsasDocument document, VamsasArchiveReader archive, boolean cascade, PrintStream outstr) {
+    if (document!=null) {
+      outstr.println("Vamsas Document version '"+document.getVersion()+"'");
+      reportProvenance(document.getProvenance(), outstr);
+      outstr.print("Document contains "+document.getVAMSASCount()+" VAMSAS Elements and "+document.getApplicationDataCount()+" Application data elements.\n");
+      if (document.getVAMSASCount()>0 && cascade)
+        rootReport(document.getVAMSAS(), true, outstr);
+      if (document.getApplicationDataCount()>0) {
+        outstr.print("There are "+document.getApplicationDataCount()+" ApplicationData references.\n");
+        ApplicationData appd[] = document.getApplicationData();
+        for (int i=0,j=appd.length; i<j; i++) {
+          outstr.print("Application "+i+": '"+appd[i].getName()+"'\nVersion '"+appd[i].getVersion()+"'\n");
+          outstr.print("AppData is :");
+          appDataReport(appd[i], archive, cascade, outstr);
+        }
+          
+      }
+      return true;
+    } else {
+      outstr.println("Document Object is null");
+    }
+    return false;
+  }
+
+  /**
+   * summarises all the datasets in a vamsas document.
+   * @param roots
+   * @param cascade TODO
+   * @param outstr TODO
+   * @return
+   */
+  public static boolean rootReport(VAMSAS[] roots, boolean cascade, PrintStream outstr) {
+    if (roots!=null) {
+      for (int i=0; i<roots.length; i++) {
+        VAMSAS r = roots[i];
+        int ds, tr;
+        outstr.print("Vamsas Root "+i+" (id="
+            +((r.getId()!=null) ? r.getId():"<none>")
+            +") contains "+(ds=r.getDataSetCount())+" DataSets, "
+            + (tr=r.getTreeCount())+" Global trees\n");
+        if (cascade) {
+          for (int j=0; j<ds; j++) {
+            outstr.println("Dataset "+j);
+            cascade = datasetReport(r.getDataSet(j), true, outstr) && cascade ;
+          }
+          for (int j=0; j<tr; j++) {
+            outstr.println("Global tree "+j);
+            cascade = treeReport(r.getTree(j), true, outstr) && cascade;
+          }
+        }
+      }
+      return true;
+    }
+    return false;
+  }
+  public static boolean datasetReport(DataSet ds, boolean cascade, PrintStream outstr) {
+    if (cascade)
+      reportProvenance(ds.getProvenance(), outstr);
+    outstr.println("Dataset contains : "+ds.getSequenceCount()
+        +" sequences, "+ds.getAlignmentCount()+" alignments and "+ds.getTreeCount()+" trees.");
+    if (cascade)
+      alignmentReport(ds.getAlignment(), true, outstr);
+    return true;
+  }
+  public static boolean alignmentReport(Alignment[] al, boolean cascade, PrintStream outstr) {
+    boolean val=true;
+    if (al!=null && al.length>0) {
+      for (int i=0; i<al.length; i++) {
+        outstr.println("Alignment "+i+(al[i].isRegistered() ? " ("+al[i].getVorbaId()+")" : " (unregistered)"));
+        if (cascade)
+          reportProvenance(al[i].getProvenance(), outstr);
+        outstr.println("Involves "+al[i].getAlignmentSequenceCount()+" sequences, has "
+            +al[i].getAlignmentAnnotationCount()+" annotations and "+al[i].getTreeCount()+" trees.");
+        if (cascade) {
+          for (int t=0; t<al[i].getTreeCount(); t++)
+            treeReport(al[i].getTree(t), true, outstr);
+        }
+      }
+    }
+    return val;
+  }
+  public static boolean treeReport(Tree t, boolean cascade, PrintStream outstr) {
+    outstr.println("Tree: '"+t.getTitle()+"'");
+    return !cascade || reportProvenance(t.getProvenance(), outstr);
+  }
+
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveStreamReader.java b/src/org/vamsas/test/simpleclient/ArchiveStreamReader.java
new file mode 100644 (file)
index 0000000..1415731
--- /dev/null
@@ -0,0 +1,52 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.vamsas.client.simpleclient.SessionFile;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+
+public class ArchiveStreamReader {
+  /**
+   * tests VamsasArchiveReader archive reader on a vamsas jar file opened as a stream
+   * @param args
+   */
+  public static void main(String args[]) {
+    
+    try {
+      VamsasFile av = new VamsasFile(new File(args[0]));
+      VamsasArchiveReader var = new VamsasArchiveReader(av.getLock());
+      VAMSAS roots[]=null;
+      if (var.isValid()) {
+        InputStreamReader vdoc = new InputStreamReader(var.getVamsasDocumentStream());
+        VamsasDocument doc = VamsasDocument.unmarshal(vdoc);
+        if (ArchiveReports.reportDocument(doc, var, true, System.out)) {
+          roots = doc.getVAMSAS();
+        }
+      } else {
+        InputStream vxmlis = var.getVamsasXmlStream();
+        
+        if (vxmlis!=null) { // Might be an old vamsas file.
+          BufferedInputStream ixml = new BufferedInputStream(var.getVamsasXmlStream());
+          InputStreamReader vxml = new InputStreamReader(ixml);
+          VAMSAS root;
+          // unmarshal seems to always close the stream (should check this)
+          if ((root = VAMSAS.unmarshal(vxml))!=null) {
+            System.out.println("Read a root.");
+            roots = new VAMSAS[1];
+            roots[0] = root;
+          }
+        }
+      }
+      if (!ArchiveReports.rootReport(roots, true, System.out))
+        System.err.print(args[0]+" is not a valid vamsas archive.");
+    } catch (Exception e) {
+      e.printStackTrace(System.err);
+    }
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveWatcher.java b/src/org/vamsas/test/simpleclient/ArchiveWatcher.java
new file mode 100644 (file)
index 0000000..c1c7422
--- /dev/null
@@ -0,0 +1,105 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.Lock;
+import org.vamsas.client.simpleclient.SimpleDocument;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.VamsasDocument;
+/**
+ * demo of archive watching process - should mimic the clientsfileTest watcher/monitor process.
+ * @author jimp
+ *
+ */
+public class ArchiveWatcher {
+  private static Log log = LogFactory.getLog(ArchiveWatcher.class);
+  private static CommandProcessor cproc=new CommandProcessor();
+  static {
+    cproc.addCommand("new", 0, "no args");
+    cproc.addCommand("delete", 0, "no args");    
+    cproc.addCommand("watch", 0, "no args");
+    cproc.addCommand("file", 1, "Need vamsas archive as argument.");    
+  }
+  
+  public static void main(String[] args) {
+    try {
+      
+      if (args!=null && args.length>0) {
+        File archive = new File(args[0]);
+        log.info("Watching file "+args[0]);
+        int argc=1;
+        while (argc < args.length) {
+          // vars needed for operations
+          ClientHandle ch;
+          int com = cproc.getCommand(args, argc);
+          argc++;
+          switch (com) {
+          case 0:
+            // new
+            log.info("Doing locked deletion and new-file creation.");
+            {
+              if (!archive.exists())
+                archive.createNewFile();
+              VamsasFile sf = new VamsasFile(archive);
+              Lock l = sf.getLock();
+              archive.delete();
+              archive.createNewFile();
+              sf.unLock();
+            }
+            break;
+          case 1:
+            // delete
+            log.info("Deleting "+archive+" without locking it first.");
+            archive.delete();
+            break;
+          case 2:
+            // watch
+            log.info("Endlessly Watching file "+archive);
+            /*        if (!archive.exists())
+                      archive.createNewFile();
+             */       // watch the new file... - taken straight from ClientsFileTest
+            FileWatcher w = new FileWatcher(archive);
+            while (true) {              
+              // get watcher's lock to ensure state change is fixed for retrieval
+              Lock chlock = w.getChangedState();
+              if (chlock != null) {
+                log.info("Got lock on "+archive+(archive.exists() ? " exists l="+archive.length() : "(non existant)"));
+                if (archive.length()>0) {
+                  VamsasArchiveReader vreader = new VamsasArchiveReader(archive);
+                  SimpleDocument sdoc = new SimpleDocument("testing vamsas watcher");
+                  try {
+                    VamsasDocument d = sdoc.getVamsasDocument(vreader);
+                    if (d!=null) {
+                      ArchiveReports.reportDocument(d, vreader, false, System.out);
+                    }
+                    System.out.println("Update at "+System.currentTimeMillis()+"\n\n********************************************************\n");
+                  } catch (Exception e) {
+                    log.error("Unmarshalling failed.",e);
+                  }
+                  vreader.close();
+                  w.setState();
+                }
+              }
+            }
+            // break;
+          case 3: // set file
+            archive = new File(args[argc++]);
+            break;
+          case 4:
+            break;
+            default:
+              log.warn("Unknown command  + "+args[argc++]);
+          }
+        }
+      }
+    } catch (Exception e) {
+      log.error(e);
+    }
+    
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/ArchiveWriter.java b/src/org/vamsas/test/simpleclient/ArchiveWriter.java
new file mode 100644 (file)
index 0000000..d6f8ee9
--- /dev/null
@@ -0,0 +1,180 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.objects.core.Alignment;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.Instance;
+import org.vamsas.objects.core.Provenance;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.ProvenanceStuff;
+
+public class ArchiveWriter {
+  
+  /**
+   * Test program for writing archive files.
+   * form is ArchiveWriter new/modified argive command list
+   */
+  
+  static Log log = LogFactory.getLog(ArchiveWriter.class);
+    
+  private static void mergeVecs(Object[] destvec, Object[] svec1, Object[] svec2) {
+    int i;
+    for (i=0; i<svec1.length; i++)
+      destvec[i] = svec1[i];
+    for (int j=0; j<svec2.length; i++, j++)
+      destvec[i] = svec2[j];
+  }
+  // Merge appDataReferences require transfer of jar entries, perhaps with a renaming of the entry.
+  // Merge appDatas require eventually unique URNS
+  // TODO: merging global appdata from different documents where same app has written them causes conflict
+  
+  public static Hashtable hashOfAppDatas(Hashtable ht, Instance[] appdatas) {
+    if (ht==null)
+      ht = new Hashtable();
+    for (int i=0, j=appdatas.length; i<j; i++) {
+      if (!ht.containsKey(appdatas[i].getUrn())) {
+        Hashtable aphash = new Hashtable();
+        ht.put(appdatas[i].getUrn(), aphash);
+        aphash.put(appdatas[i], appdatas[i].getDataReference());
+      } else {
+        // ensure urns and references are unique
+        
+        
+      }
+          
+    }
+    return ht;
+  }
+  /**
+   * safely copies an appData from one archive to another.
+   * @param darc destination archive
+   * @param dest destination document Vobject
+   * @param sarc source archive reader
+   * @param entry application data to be copied from source archive
+   */
+  public static void addAppDataEntry(VamsasArchive darc, VamsasDocument dest,  VamsasArchiveReader sarc, ApplicationData entry) {
+    // TODO: fix instances
+    // check uniqueness of instance's[] entry.urn amongst dest.ApplicationData[].getInstances[].urn 
+    //  check uniqueness of entry.user[].urn amongst dest.ApplicationData[].user[].urn
+    // check uniqueness of entry.user
+    // entry.getAppDataChoice().getData() or getDataReference is unique
+    ApplicationData newo = new ApplicationData();
+    for (int i=0, j=dest.getApplicationDataCount(); i<j; i++) {
+      ApplicationData o = dest.getApplicationData()[i];
+      // ensure new urn is really unique
+      //String urn = entry.getUrn();
+      int v = 1;
+      //while (o.getUrn().equals(urn)) {
+      //  urn = entry.getUrn()+v++;      
+     // }
+      // uniqueness of urn
+      // check each user ApplicationData
+      // uniqueness (again)
+      // copy over valid objects
+      // 
+    }
+  }
+  /**
+   * Copy new datasets and appdatas from one vamsas document to another.
+   * @param darc
+   * @param dest
+   * @param sarc
+   * @param source
+   * @return true if merge was successful.
+   */
+  public static boolean mergeDocs(VamsasArchive darc, VamsasDocument dest,  VamsasArchiveReader sarc, VamsasDocument source) {
+    log.debug("mergeDocs entered.");
+    // search for appDatas in cdoc
+    VAMSAS[] newr = new VAMSAS[dest.getVAMSASCount()+source.getVAMSASCount()];
+    mergeVecs(newr, dest.getVAMSAS(), source.getVAMSAS());
+    dest.setVAMSAS(newr);
+    /** TODO: LATER: should verify that all ids really are unique in newly merged document. If not then what ?
+     *  investigate possibility of having an id translation between appDatas and the core document - 
+     *  the mapping is stored when an external application performs a merge, but when the owning 
+     *  Application accesses the Vobject, the vorba_id is updated to the new one when it writes its 
+     *  references in to its appdata again
+     */
+    if (source.getApplicationDataCount()>0) {
+      ApplicationData[] newdat = new ApplicationData[source.getApplicationDataCount()+dest.getApplicationDataCount()];
+      ApplicationData[] sappd = source.getApplicationData();
+      // check refs and update/modify if necessary
+      for (int i=0; i<sappd.length; i++) {
+        addAppDataEntry(darc, dest, sarc, sappd[i]);
+      }
+      
+    }
+    
+    return true; // success    
+  }
+  
+  private static CommandProcessor cproc;
+  static {
+    cproc.addCommand("new", 0, "no args");
+    cproc.addCommand("add", 1, "Need another vamsas document archive filename as argument.");    
+    cproc.addCommand("repair", 0, "no args");
+    cproc.addCommand("list", 0, "no args");    
+    cproc.addCommand("monitor", 0, "no args");    
+  }
+  
+  public static void main(String argv[]) {
+    /**
+     * TODO: switches for setting user identities for writing to vamsas document
+     */ 
+    if (argv.length<1) {
+      log.fatal("Usage : <archive to create> [(commands)]");
+      return;
+    }
+    File newarch = new File(argv[0]);
+    int argpos = 0;
+    try {
+      // test fully fledged doc construction
+      VamsasArchive varc = new VamsasArchive(newarch, true);
+      VamsasDocument docroot;
+      docroot = new VamsasDocument();
+      docroot.setProvenance(ProvenanceStuff.newProvenance("ArchiveWriter", "user", "Created new Vamsas Document"));
+      while (++argpos<argv.length) {
+        File archive = new File(argv[argpos]);
+        InputStream istream;
+        if (archive.exists()) {
+          VamsasArchiveReader vdoc = new VamsasArchiveReader(archive);
+          if (vdoc.isValid()) {
+            istream = vdoc.getVamsasDocumentStream(); 
+            if (istream!=null) {
+              VamsasDocument cdocroot = VamsasDocument.unmarshal(new InputStreamReader(istream));
+              if (cdocroot!=null) 
+                mergeDocs(varc, docroot, vdoc, cdocroot);
+            } else 
+              log.warn("Unexpectedly null document stream from existing document "+archive);
+          } else {
+              // updating an oldformat stream ?
+              if ((istream = vdoc.getVamsasXmlStream())!=null) {
+                // make a new vamsas document from the vamsas.xml entry
+                VAMSAS root = VAMSAS.unmarshal(new InputStreamReader(istream)); // TODO: verify only one VAMSAS element per vamsas.xml entry.
+                docroot.getProvenance().addEntry(ProvenanceStuff.newProvenanceEntry("ArchiveWriter", "user", "added vamsas.xml from "+argv[argpos-1]));
+                docroot.addVAMSAS(root);
+              }
+          }
+        } else {
+          // Begin a new vamsas document
+          PrintWriter docwriter = varc.getDocumentOutputStream();
+        }
+      }
+    } catch (Exception e) {
+      log.error("Whilst manipulating "+argv[0], e);
+    }
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/ClientDoc.java b/src/org/vamsas/test/simpleclient/ClientDoc.java
new file mode 100644 (file)
index 0000000..da05e00
--- /dev/null
@@ -0,0 +1,355 @@
+package org.vamsas.test.simpleclient;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.IClientAppdata;
+import org.vamsas.client.Vobject;
+import org.vamsas.client.VorbaId;
+import org.vamsas.client.simpleclient.ClientDocument;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.objects.utils.ProvenanceStuff;
+
+// simple holder to pass to client.
+public class ClientDoc extends org.vamsas.client.ClientDocument {
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientDocument#getClientAppdata()
+   */
+  public IClientAppdata getClientAppdata() {
+    throw new Error("Appdata access is not implemented in the test.simpleclient.ClientDoc instance."); // TODO Auto-generated method stub
+  }
+  protected boolean isModified=false;
+  private Log log = LogFactory.getLog(ClientDoc.class);
+  protected VamsasDocument doc;
+  public org.vamsas.objects.core.VAMSAS[] _VamsasRoots;
+  protected VamsasArchive iohandler=null;
+  protected VamsasArchiveReader reader=null;
+  private String user=null;
+  private String app=null;
+  
+  /**
+   * @param doc
+   * @param iohandler
+   * @param reader
+   * @param app
+   * @param user
+   */
+  public ClientDoc(VamsasDocument doc, VamsasArchive iohandler, VamsasArchiveReader reader, String app, String user, Hashtable objrefs) {
+    super(objrefs, (iohandler!=null) ? iohandler.getVorba() : null);
+    this.doc = doc;
+    this.iohandler = iohandler;
+    this.reader = reader;
+    this.app = app;
+    this.user = user;
+    this.objrefs = objrefs;
+    _VamsasRoots = doc.getVAMSAS();
+  }
+  // AppDataOutputStream appd;
+  //AppDataOutputStream userd;
+  /* (non-Javadoc)
+   * @see java.lang.Object#finalize()
+   */
+  protected Entry getProvenanceEntry(String action) {
+    // VAMSAS: modify schema to allow referencing of user field (plus other issues, ClientUrn field, machine readable action, input parameters, additional data generated notes
+    Entry prov = ProvenanceStuff.newProvenanceEntry(app, user, action);
+    return prov;
+  }
+  public VAMSAS[] getVamsasRoots() {
+    if (doc==null) {
+      log.debug("Null document for getVamsasRoots(), returning null");
+      return null;
+    }
+    if (iohandler==null) {
+      // LATER: decide on read-only status of ClientDocument object
+      log.warn("getVamsasRoots() called on possibly read-only document.");
+    }
+    if (_VamsasRoots!=null)
+      return _VamsasRoots;
+    VAMSAS[] roots = doc.getVAMSAS();
+    if (roots == null) {
+      // Make a new one to return to client to get filled. 
+      _VamsasRoots = new VAMSAS[] { new VAMSAS() };
+      // Do provenance now. just in case.
+      doc.getProvenance().addEntry(getProvenanceEntry("Created new document root [id="+_VamsasRoots[0].getId()+"]"));
+      doc.addVAMSAS(_VamsasRoots[0]);
+    } else {
+      _VamsasRoots = new VAMSAS[roots.length];
+      for (int r=0;r<roots.length; r++)
+        _VamsasRoots[r] = roots[r];
+    }
+    return _VamsasRoots;
+  }
+  
+  private int _contains(VAMSAS root, VAMSAS[] docRoots) {
+    if (root==null)
+      return -1;
+    if (docRoots==null || docRoots.length==0)
+      return -1;
+    VorbaId r_id = root.getVorbaId();
+    for (int i=0,j=docRoots.length; i<j; i++) {
+      VorbaId n_id=null;
+      if (docRoots[i]==root || (docRoots[i]!=null && (n_id=docRoots[i].getVorbaId())!=null && n_id.equals(r_id)))
+        return i;
+    }
+    return -1;
+  }
+/**
+ * verify that newr version is really an intact version of the 
+ * @param newVersion (may be modified)
+ * @param oldVersion 
+ * @return true if newVersion is a valid root that preserves original references
+ */
+  private boolean isValidUpdate(VAMSAS newVersion, final VAMSAS oldVersion) {
+    // ideal - this cascades down the two structures, ensuring that all ID'd objects in one are present in the other.
+    if (oldVersion==newVersion) {
+      // may be a virgin root element.
+      if (!newVersion.isRegistered())
+        iohandler.getVorba().makeVorbaId(newVersion);
+      // Should retrieve original version and compare - unless local hashes can be used to determine if resultSet has been truncated.
+      // just do internal validation for moment.
+      if (newVersion.isValid())
+        return true;
+      return false;
+    } else {
+      // redundant ? if (oldVersion.is__stored_in_document())
+      if (!newVersion.isRegistered())
+        iohandler.getVorba().makeVorbaId(newVersion);
+      if (newVersion.isValid())
+        return true;
+    }
+    return false;
+  }
+    /**
+  /**
+   * merge old and new root vectors
+   * @param newr This array may be written to
+   * @param original
+   * @param the client document (usually this) which this root set belongs to.
+   * @return merged vector of vamsas roots
+   */
+  private VAMSAS[] _combineRoots(VAMSAS[] newr, final VAMSAS[] original, ClientDoc modflag) {
+    Vector rts = new Vector();
+    boolean modified=false;
+    for (int i=0,j=original.length; i<j; i++) {
+      int k = _contains(original[i], newr);
+      if (k>-1) {
+        if (isValidUpdate(newr[k], original[i])) {
+          modified=true;
+          rts.add(newr[k]);
+          newr[k]=null;
+        } else {
+          // LATER: try harder to merge ducument roots.
+          log.warn("Couldn't merge new VAMSAS root "+newr[k].getId());
+          newr[k] = null; // LATER: this means we ignore mangled roots. NOT GOOD
+        }
+      } else {
+        // add in order.
+        rts.add(original[i]);
+      }
+    }
+    // add remaining (new) roots
+    for (int i=0,j=newr.length; i<j; i++) {
+      if (newr[i]!=null) {
+        rts.add(newr[i]);
+        modified=true;
+      }
+    }
+    newr = new VAMSAS[rts.size()];
+    for (int i=0,j=rts.size(); i<j; i++)
+      newr[i] = (VAMSAS) rts.get(i);
+    if (modflag!=null)
+      modflag.isModified = modified;
+    return newr;
+  }
+  
+  /**
+   * update the document with new roots.
+   * LATER: decide: this affects the next call to getVamsasRoots()
+   * @see org.vamsas.IClientDocument.setVamsasRoots
+   */
+  public void setVamsasRoots(VAMSAS[] newroots) {
+    if (doc==null) {
+      log.debug("setVamsasRoots called on null document.");
+      return;
+    }
+    VAMSAS[] newr;
+    if (newroots==null) {
+      log.debug("setVamsasRoots(null) - do nothing.");
+      return;
+    }
+    // are we dealing with same array ?
+    if (_VamsasRoots!=newroots) {
+      // merge roots into local version.
+      newr = new VAMSAS[newroots.length];
+      for (int i=0;i<newr.length;i++)
+        newr[i] = newroots[i];
+      newr=_combineRoots(newr,_VamsasRoots,this);
+    } else {
+      newr = new VAMSAS[_VamsasRoots.length];
+      for (int i=0;i<newr.length;i++)
+        newr[i]=_VamsasRoots[i];
+    }
+    //  actually compare with document root set for final combination (to ensure nothing is lost)
+    _VamsasRoots = _combineRoots(newr, doc.getVAMSAS(), this); 
+  }
+  
+  
+  /* (non-Javadoc)
+   * LATER: decide: this affects the next call to getVamsasRoots()
+   * @see org.vamsas.client.IClientDocument#addVamsasRoot(org.vamsas.objects.core.VAMSAS)
+   */
+  public void addVamsasRoot(VAMSAS newroot) {
+    if (doc==null) {
+      log.debug("addVamsasRoots called on null document.");
+      return;
+    }
+    VAMSAS[] newroots = _combineRoots(new VAMSAS[] {newroot}, _VamsasRoots, this);
+    _VamsasRoots = newroots;  
+  }
+
+  public VamsasArchiveReader getReader() {
+    return reader;
+  }
+  private void _finalize() {
+    log.debug("finalizing clientDoc");
+    if (doc!=null) {
+      doc = null;
+    }
+    if (_VamsasRoots!=null) {
+      for (int i=0; i<_VamsasRoots.length; i++)
+        _VamsasRoots[i]=null;
+      _VamsasRoots=null;
+       
+    }
+      
+    if (reader!=null) {
+      log.debug("Closing and removing reader reference");
+      reader.close();
+      reader=null;
+    }
+    if (iohandler!=null) {
+      log.debug("Removing ioHandler reference.");
+      iohandler.cancelArchive();
+      iohandler=null;
+    }
+  }
+  protected void finalize() throws Throwable {
+    _finalize();
+    super.finalize();
+  }
+  private java.util.Hashtable objrefs=null;
+  
+  public VorbaId[] registerObjects(Vobject[] unregistered) {
+    if (doc==null) {
+      log.warn("registerObjects[] called on null document.");
+      return null;
+    }
+    if (objrefs==null) {
+      log.warn("registerObjects[] called for null objrefs hasharray.");
+      return null;
+    }
+    if (unregistered!=null) {
+      VorbaId ids[] = new VorbaId[unregistered.length];
+      for (int i=0,k=unregistered.length; i<k; i++)
+        if (unregistered[i]!=null) {
+          log.warn("Null Vobject passed to registerObject[] at position "+i);
+          return null;
+        } else {
+          ids[i]=registerObject(unregistered[i]);
+        }
+      log.debug("Registered "+unregistered.length+" objects - total of "+objrefs.size()+" ids.");
+      return ids;
+    }
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.Vobject)
+   */
+  public VorbaId registerObject(Vobject unregistered) {
+    if (doc==null) {
+      log.warn("registerObjects called on null document.");
+      return null;
+    }
+    if (objrefs==null) {
+      log.warn("registerObjects called for null objrefs hasharray.");
+      return null;
+    }
+    if (iohandler==null) {
+      log.warn("registerObjects called for read only document.");
+      return null;
+    }
+    
+    if (unregistered!=null) {
+      VorbaId id = this._registerObject(unregistered);
+      log.debug("Registered object - total of "+objrefs.size()+" ids.");
+      return id;
+    }
+    log.warn("Null Vobject passed to registerObject.");
+    return null;
+  }
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId)
+   */
+  public Vobject getObject(VorbaId id) {
+    if (objrefs==null) {
+      log.debug("getObject called on null objrefs list.");
+      return null;
+    }
+    if (objrefs.containsKey(id.getId()))
+      return (Vobject) objrefs.get(id.getId());
+    log.debug("Returning null Vobject reference for id "+id.getId());
+    return null;
+  }
+  
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[])
+   */
+  public Vobject[] getObjects(VorbaId[] ids) {
+    if (objrefs==null) {
+      log.debug("getObject[]  called on null objrefs list.");
+      return null;
+    }
+    Vobject[] vo = new Vobject[ids.length];
+    for (int i=0,j=ids.length; i<j;i++) 
+      if (objrefs.containsKey(ids[i]))
+        vo[i] = (Vobject) objrefs.get(ids[i]);
+      else
+        log.debug("Returning null Vobject reference for id "+ids[i].getId());
+    return vo;
+  }
+  protected void updateDocumentRoots() {
+    if (doc==null) {
+      log.error("updateDocumentRoots called on null document. Probably an implementation error.");
+      return;
+    }
+    if (isModified) {
+      if (_VamsasRoots!=null) {
+        doc.setVAMSAS(_VamsasRoots);
+        _VamsasRoots=null;
+      }
+    }
+  }
+  /**
+   * tell vamsas client to close the document and reset the object. Once closed, nothing can be done with the object.
+   *
+   */
+  public void closeDoc() {
+    if (doc!=null) {
+      log.debug("Closing open document.");
+      _finalize();
+    } else {
+      log.warn("Ignoring closeDoc on invalid document.");
+    }
+  }
+  
+}
\ No newline at end of file
diff --git a/src/org/vamsas/test/simpleclient/ClientsFileTest.java b/src/org/vamsas/test/simpleclient/ClientsFileTest.java
new file mode 100644 (file)
index 0000000..46fbfd7
--- /dev/null
@@ -0,0 +1,310 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.simpleclient.ClientsFile;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.Lock;
+
+public class ClientsFileTest {
+  private static CommandProcessor cproc;
+
+  private static Vector commands;
+  static {
+    cproc = new CommandProcessor();
+    ClientsFileTest.commands = new Vector();
+    ClientsFileTest.commands.add(new String("add"));
+    cproc.addCommand("add", 2, "for the Client's 'Name' and 'Version'");
+    ClientsFileTest.commands.add(new String("remove"));
+    cproc.addCommand("remove", 3, "for the Client's 'Name', Version and URN");
+    ClientsFileTest.commands.add(new String("list"));
+    cproc.addCommand("list", 0, "no args needed");
+    ClientsFileTest.commands.add(new String("clear"));
+    cproc.addCommand("clear", 0, "no args needed");
+    ClientsFileTest.commands.add(new String("watch"));
+    cproc.addCommand("watch", 0, "no args needed");
+    ClientsFileTest.commands.add(new String("monitor"));
+    cproc.addCommand("monitor", 2, "for the Client's 'Name' and 'Version'");
+  }
+
+  private static void complainArgs(int argl, int argpos, String cmd,
+      int argneed, String msg) {
+    if (argl - argpos < argneed)
+      throw new Error(cmd + " needs " + argneed + " arguments : " + msg);
+  }
+
+  public static void main(String[] args) {
+    java.io.File cf = new java.io.File(args[0]);
+    System.out.println("Connecting to clientFile " + args[0]);
+    ClientsFile cfhand;
+    try {
+      cfhand = new ClientsFile(cf);
+    } catch (Exception e) {
+      e.printStackTrace(System.err);
+      return;
+    }
+    int argc = 1;
+    while (argc < args.length) {
+      // vars needed for operations
+      ClientHandle ch;
+      int com = cproc.getCommand(args, argc);
+      argc++;
+      switch (com) {
+      case 0:
+        // Add
+        int pos = cfhand.addClient(ch = new ClientHandle(args[argc],
+            args[argc + 1]));
+        argc += 2;
+        if (pos != 0)
+          System.out.println("Client added at " + pos + " as urn:"
+              + ch.getClientUrn());
+        else
+          System.out.println("Client was not added.");
+        break;
+      case 1:
+        // remove
+        ch = new ClientHandle(args[argc], args[argc + 1]);
+        ch.setClientUrn(args[argc + 2]);
+        argc += 3;
+        cfhand.removeClient(ch, null);
+        System.out.println("Client removed (apparently)");
+        break;
+      case 2:
+        // list
+        ClientHandle[] chlist = cfhand.retrieveClientList();
+        if (chlist != null) {
+          for (int chi = 0, che = chlist.length; chi < che; chi++) {
+            System.out.println("Client " + chi + " ("
+                + chlist[chi].getClientName() + " " + chlist[chi].getVersion()
+                + " " + chlist[chi].getClientUrn() + ")");
+          }
+        } else {
+          System.out.println("Client list is empty.");
+        }
+        break;
+      case 3:
+        // clear
+        //cfhand.get = null;
+        //cf.delete();
+        try {
+          
+          cfhand.clearList();
+          
+        } catch (Exception e) {
+          System.err.println("Failed on new empty clientfile creation!");
+          e.printStackTrace(System.err);
+        }
+        break;
+      case 4:
+        // watch
+        FileWatcher w = new FileWatcher(cf);
+        while (cf.exists()) {
+          // get watcher's lock to ensure state change is fixed for retrieval
+          Lock chlock = w.getChangedState();
+          if (chlock != null) {
+            ClientHandle[] cl = cfhand.retrieveClientList(chlock);
+            System.out.println("-- Watching " + cf.getName());
+            //while (w.hasChanged())
+            //  ;
+            if (cl != null) {
+              for (int chi = 0, che = cl.length; chi < che; chi++) {
+                System.out.println("Client " + chi + " ("
+                    + cl[chi].getClientName() + " " + cl[chi].getVersion()
+                    + " " + cl[chi].getClientUrn() + ")");
+              }
+            } else {
+              System.out.println("Client list is empty.");
+            }
+          }
+
+        }
+        break;
+      case 5:
+        // monitor
+        int clpos = cfhand.addClient(ch = new ClientHandle(args[argc],
+            args[argc + 1]));
+        argc += 2;
+        if (clpos != 0)
+          System.out.println("Monitor Client added at " + clpos + " as urn:"
+              + ch.getClientUrn());
+        else {
+          System.err.println("Monitor Client was not added.");
+          break;
+        }
+        FileWatcher mon = new FileWatcher(cf);
+        while (cf.exists()) {
+          // get watcher's lock to ensure state change is fixed for retrieval
+          Lock chlock = mon.getChangedState();
+          if (chlock != null) {
+            ClientHandle[] cl = cfhand.retrieveClientList(chlock);
+            System.out.println("-- Monitor " + cf.getName());
+            //while (w.hasChanged())
+            //  ;
+            int newpos = -1;
+            if (cl != null) {
+              for (int chi = 0, che = cl.length; chi < che; chi++) {
+                if (ch.equals(cl[chi]))
+                  newpos = chi + 1;
+              }
+            }
+            if (newpos == -1) {
+              // add self again to cleared list.
+              newpos = cfhand.addClient(ch);
+              mon.setState();
+              if (newpos == 0) {
+                System.err
+                    .println("Monitor client could not be re-added to list.");
+                break;
+              }
+            }
+            if (newpos != clpos) {
+              System.out.println("Monitor client moved from " + clpos + " to "
+                  + newpos);
+              clpos = newpos;
+            }
+          }
+        }
+        break;
+      default:
+        if (com == -1) {
+          System.err
+              .println("Unknown command : " + args[argc++] + "*Ignored!*");
+        } else
+          System.err.println("Command " + args[argc++]
+              + " *Ignored!* - its not implemented.");
+      }
+      
+      for (int j = 0; j < 900000; j++) {
+        Integer i = Integer.getInteger("1");
+        Integer q = i;
+      }
+    }
+
+  }
+
+  /*      Iterator coms = commands.iterator();
+   int com=-1;
+   while ((coms!=null) && coms.hasNext()) {
+   com++;
+   if (args[argc].toLowerCase().equals((String) coms.next())) {
+   System.out.println("Doing "+args[argc]);
+   ClientHandle ch;
+   argc++;
+   switch (com) {
+   case 0:
+   // Add
+   ClientsFileTest.complainArgs(args.length, argc, "add", 2, "for the Client's 'Name' and 'Version'");
+   int pos = cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1]));
+   argc+=2;
+   if (pos!=0)
+   System.out.println("Client added at "+pos+" as urn:"+ch.getClientUrn());
+   else
+   System.out.println("Client was not added.");
+   break;
+   case 1:
+   // remove
+   ClientsFileTest.complainArgs(args.length, argc, "remove", 3, "for the Client's 'Name', Version and URN");
+   ch=new ClientHandle(args[argc], args[argc+1]);
+   ch.setClientUrn(args[argc+2]);
+   argc+=3;
+   cfhand.removeClient(ch, null);
+   System.out.println("Client removed (apparently)");
+   break;
+   case 2:
+   // list
+   ClientHandle[] chlist = cfhand.retrieveClientList();
+   if (chlist!=null) {
+   for (int chi=0,che=chlist.length; chi<che; chi++) {
+   System.out.println("Client "+chi+" ("+chlist[chi].getClientName()+" "+chlist[chi].getVersion()+" "+chlist[chi].getClientUrn()+")");
+   }
+   } else {
+   System.out.println("Client list is empty.");
+   }
+   break;
+   case 3:
+   // clear
+   cfhand = null;
+   cf.delete();
+   try {
+   cf.createNewFile();
+   cfhand = new ClientsFile(cf);
+   }
+   catch (Exception e) {
+   System.err.println("Failed on new empty clientfile creation!");
+   e.printStackTrace(System.err);
+   }
+   break;
+   case 4:
+   // watch
+   FileWatcher w=new FileWatcher(cf);
+   while (cf.exists()) {
+   // get watcher's lock to ensure state change is fixed for retrieval
+   Lock chlock=w.getChangedState();
+   if (chlock!=null) {
+   ClientHandle[] cl = cfhand.retrieveClientList(chlock);
+   System.out.println("-- Watching "+cf.getName());
+   //while (w.hasChanged())
+   //  ;
+   if (cl!=null) {
+   for (int chi=0,che=cl.length; chi<che; chi++) {
+   System.out.println("Client "+chi+" ("+cl[chi].getClientName()+" "+cl[chi].getVersion()+" "+cl[chi].getClientUrn()+")");
+   }
+   } else {
+   System.out.println("Client list is empty.");
+   }
+   }
+   
+   }
+   break;
+   case 5:
+   // monitor
+   ClientsFileTest.complainArgs(args.length, argc, "monitor", 2, "for the Client's 'Name' and 'Version'");
+   int clpos = cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1]));
+   argc+=2;
+   if (clpos!=0)
+   System.out.println("Monitor Client added at "+clpos+" as urn:"+ch.getClientUrn());
+   else {
+   System.err.println("Monitor Client was not added.");
+   break;
+   }
+   FileWatcher mon=new FileWatcher(cf);
+   while (cf.exists()) {
+   // get watcher's lock to ensure state change is fixed for retrieval
+   Lock chlock=mon.getChangedState();
+   if (chlock!=null) {
+   ClientHandle[] cl = cfhand.retrieveClientList(chlock);
+   System.out.println("-- Monitor "+cf.getName());
+   //while (w.hasChanged())
+   //  ;
+   int newpos=-1;
+   if (cl!=null) {
+   for (int chi=0,che=cl.length; chi<che; chi++) {
+   if (ch.equals(cl[chi]))
+   newpos=chi+1;
+   }
+   }
+   if (newpos==-1) {
+   // add self again to cleared list.
+   newpos=cfhand.addClient(ch);
+   mon.setState();
+   if (newpos==0) {
+   System.err.println("Monitor client could not be re-added to list.");
+   break;
+   }
+   }
+   if (newpos!=clpos) {
+   System.out.println("Monitor client moved from "+clpos+" to "+newpos);
+   clpos=newpos;
+   }
+   }
+   }
+   
+   }
+   coms = null;
+   }
+   } */
+
+}
diff --git a/src/org/vamsas/test/simpleclient/CommandProcessor.java b/src/org/vamsas/test/simpleclient/CommandProcessor.java
new file mode 100644 (file)
index 0000000..0cf0701
--- /dev/null
@@ -0,0 +1,65 @@
+package org.vamsas.test.simpleclient;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+public class CommandProcessor {
+  /**
+   * this is not getOPT!!!! - processes a *series* of space separated commands - some of which take arguments.
+   */
+  private Vector commands;
+  /* static {
+    ClientsFileTest.commands=new Vector();
+    ClientsFileTest.commands.add(new String("add"));
+    ClientsFileTest.commands.add(new String("remove"));
+    ClientsFileTest.commands.add(new String("list"));    
+    ClientsFileTest.commands.add(new String("clear"));
+    ClientsFileTest.commands.add(new String("watch"));    
+    ClientsFileTest.commands.add(new String("monitor"));    
+  } */
+
+  public int addCommand(String cmd, int argneed, String complainString) {
+    int cnum=0;
+    if (commands==null)
+      commands = new Vector();
+    else 
+      cnum = commands.size();
+    Vector cv = new Vector();
+    cv.add(new String(cmd));
+    cv.add(new Integer(argneed));
+    cv.add(new String(complainString));
+    commands.add(cv);
+    return cnum;
+  }
+  /**
+   * Integer argl, Integer argpos, String cmd, Integer argneed, String msg in vector
+   */
+  public void complainArgs(int argl, int argpos, Vector ca) {
+    int argneed = ((Integer) ca.get(1)).intValue();
+    if (argl-argpos<argneed)
+      throw new Error(((String) ca.get(0))+" at position "+argpos+" needs "+argneed+" arguments : "+(String) ca.get(2));
+  }
+  /**
+   * find and verify a command
+   * @param args argstring
+   * @param argpos position to check for command
+   * @return matching command or -1
+   */
+  public int getCommand(String[]args, int argpos) {
+    Iterator coms = commands.iterator();
+    int com=-1, argc;
+    argc=argpos;
+    while ((coms!=null) && coms.hasNext()) {
+      com++;
+      Vector comnext = (Vector) coms.next();
+      if (args[argc].toLowerCase().equals((String) comnext.get(0))) {
+        if (comnext.size()>2)
+          complainArgs(args.length, argc+1, comnext);
+        return com;
+      }
+    }
+    return -1;
+        
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/VamsasArchive.java b/src/org/vamsas/test/simpleclient/VamsasArchive.java
new file mode 100644 (file)
index 0000000..09ddf34
--- /dev/null
@@ -0,0 +1,205 @@
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+import java.io.ObjectOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.simpleclient.Lock;
+import org.vamsas.client.simpleclient.SessionFile;
+import org.vamsas.client.simpleclient.SimpleDocument;
+import org.vamsas.client.simpleclient.VamsasArchiveReader;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.ApplicationData;
+import org.vamsas.objects.core.User;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.test.objects.Core;
+
+public class VamsasArchive {
+  /**
+   * test the org.vamsas.simpleclient.vamsasArchive class
+   */
+  static Log log = LogFactory.getLog(VamsasArchive.class);
+  public static ApplicationData makeDemoAppdata(org.vamsas.client.simpleclient.VamsasArchive va, String apname, String userName, String userOrg) {
+    if (va==null)
+      return null;
+    VamsasArchiveReader vread=null;
+    try {
+      vread = va.getOriginalArchiveReader();
+    }
+    catch (Exception e) {
+      log.error("Failed to get original archive reader!",e);
+      return null;
+    }
+    ApplicationData appdata = new ApplicationData();
+    appdata.setName("org.vamsas.test.simpleclient.VamsasArchive");
+    appdata.setData(new String("this is some test data.").getBytes());
+    User apuser = new User();
+    apuser.setFullname(userName);
+    apuser.setOrganization(userOrg);
+    String appdata_ref = "vamsas:"+apname+"/"+apuser.getOrganization()+"/"+apuser.getFullname();
+    SimpleDocument sdoc = new SimpleDocument("test.simpleclient.VamsasArchive");
+    if (vread!=null) {
+      VamsasDocument orignalnew;
+      try {
+        orignalnew = sdoc.getVamsasDocument(vread);
+        log.info("*** Dump follows ***");
+        
+        ArchiveReports.reportDocument(orignalnew, vread, false, System.out);
+        log.info("*** Dump precedes ***");
+      } catch (Exception e) {
+        log.info("makeDemoAppdata: Problems accessing original document");
+      }
+      
+      log.info("Reading (and avoiding references to) original data");
+      if (vread.getAppdataStream(appdata_ref)!=null) {
+        // transfer over
+        try {
+          va.transferAppDataEntry(appdata_ref);
+        } catch (Exception e) {
+          log.warn("Exception when transferring appdata reference : "+appdata_ref, e);
+        }
+        int i=0;
+        while (vread.getAppdataStream(appdata_ref+"/"+Integer.toString(++i))!=null) {
+          try {
+            // copy over another duplicate.
+            va.transferAppDataEntry(appdata_ref+"/"+Integer.toString(i));
+          } catch (Exception e) {
+            log.warn("Exception when transferring appdata reference : "+appdata_ref, e);
+          }
+        }
+        // this one must be unique!
+        appdata_ref+="/"+Integer.toString(i);
+      }
+    }
+    
+    log.info("Adding new data stuff.");
+    log.info("Writing an apdata reference using AppDataStream interface.");
+    apuser.setDataReference(appdata_ref);
+    appdata.addUser(apuser);
+    appdata.setVersion("noggin");
+    //TODO: write instance appdata  appdata.setUrn("program:/the.nog/");
+    try {
+      ObjectOutputStream ost = new ObjectOutputStream(va.getAppDataStream(appdata_ref));
+      ost.writeObject(appdata);
+      ost.close();
+    } catch (Exception e) {
+      log.warn("Couldn't write appdata reference "+appdata_ref);
+    }
+    return appdata;
+  }
+  public static void main(String args[]) {
+    
+    try {
+      File av;
+      if (args.length>0)
+        av = new File(args[0]);
+      else
+        av = new File("test/vamsas.zip");
+      log.info("Opening archive "+av);
+      org.vamsas.client.simpleclient.VamsasArchive varchive = new org.vamsas.client.simpleclient.VamsasArchive(av, true);
+      
+      VAMSAS[] roots = (VAMSAS[]) varchive.getOriginalRoots();
+      
+      if (roots!=null) {
+        log.info("Report on Original roots in archive:");
+        ArchiveReports.rootReport(roots, true, System.out);
+      }
+      log.info("Getting current vamsas document.");
+      VamsasDocument doc = varchive.getVamsasDocument();
+      ArchiveReports.reportDocument(doc, varchive.getOriginalArchiveReader(), true, System.out); // not modified document so references will still be valid
+      // do some stuff
+      log.info("Retrieving backup");
+      File backup = varchive.backupFile();
+      if (backup==null)
+        log.info(av+" is a New Archive.");
+      else 
+        log.info(av+" has been backed up as "+backup);
+      File newf=new File(av.getAbsolutePath()+"_new.zip");
+      VamsasFile sfile = new VamsasFile(newf);
+      /* if (newf.exists()) {
+        int q=1;
+        do {
+          newf=new File(av.getAbsolutePath()+"_"+q+++"_new.zip");
+        }
+        while (newf.exists()); 
+      } */
+      if (newf.exists()) {
+        log.info("Removing existing "+newf);
+        newf.delete();
+      }
+        
+      log.info("Now writing new Archive into "+newf.getAbsolutePath());
+      org.vamsas.client.simpleclient.VamsasArchive va=null;
+      { // hold lock over deletion and write of new archive.
+        //Lock wlock = sfile.getLock();
+        //newf.delete(); // clear out old file.
+        sfile.getLock();
+        va = new org.vamsas.client.simpleclient.VamsasArchive(newf, true, true, sfile);
+        // open another and...
+        ApplicationData appdata = makeDemoAppdata(va, 
+            "org.vamsas.test.simpleclient.VamsasArchive", "arnold Bugger esq", "disOrganised");
+        log.info("Preparing to write new document.");
+        doc.addApplicationData(appdata);
+        doc.addVAMSAS(Core.getDemoVamsas());
+        va.putVamsasDocument(doc); // gets stream and puts it.
+        va.closeArchive();
+        sfile.unLock();
+      }
+      log.info("Dump of new vamsas document :");
+      log.info("Testing update: ");
+      {
+        Lock lock=sfile.getLock();
+        if (lock==null)
+          while ((lock=sfile.getLock())==null) {
+            log.info("Waiting for lock.");
+            Thread.sleep(100);
+          }
+        VamsasArchiveReader vreader = new VamsasArchiveReader(sfile.getVamsasFile());// lock); // cannot do new JarFile on a locked file. // newf);
+        SimpleDocument sdoc = new SimpleDocument("testing new vamsas write");
+        ArchiveReports.reportDocument(sdoc.getVamsasDocument(vreader), vreader, true, System.out);
+        sfile.unLock();
+      }
+      // backup.delete(); // tidy up
+      
+      log.info("Now Cancelling write to original archive "+av);
+      if (varchive.cancelArchive())
+        log.info("Successfully cancelled.");
+      else
+        log.info("Didn't cancel.");
+      long t=System.currentTimeMillis()+200; while (t>System.currentTimeMillis());
+      log.info("Now testing archive update.");
+      va = new org.vamsas.client.simpleclient.VamsasArchive(newf, false, true, sfile);
+      doc = va.getVamsasDocument();
+      doc.addVAMSAS(Core.getDemoVamsas());
+      doc.addApplicationData(makeDemoAppdata(va, 
+          "org.vamsas.test.simpleclient.VamsasArchive", "another old Bugger esq", "rescinded"));
+      if (va.transferRemainingAppDatas())
+        log.info("Remain appdatas were transferred.");
+      else
+        log.warn("No appdatas were transferred. This is wrong.");
+      va.putVamsasDocument(doc);
+      va.closeArchive();
+      sfile.unLock();
+      log.info("Testing update: ");
+      {
+        Lock lock=sfile.getLock();
+        if (lock==null)
+          while ((lock=sfile.getLock())==null)
+            log.info("Waiting for lock.");
+        // VamsasArchiveReader vreader = new VamsasArchiveReader(lock);
+        VamsasArchiveReader vreader = new VamsasArchiveReader(newf);
+        
+        SimpleDocument sdoc = new SimpleDocument("testing vamsas update");
+        VamsasDocument finaldoc = sdoc.getVamsasDocument(vreader);
+        if (finaldoc!=null)
+          ArchiveReports.reportDocument(finaldoc, vreader, true, System.out);
+        else 
+          log.error("Null Document Read from "+newf);
+      }
+    } catch (Exception e) {
+      e.printStackTrace(System.err);
+    }
+  }
+}
diff --git a/src/org/vamsas/test/simpleclient/simpleapp/VamsasClient.java b/src/org/vamsas/test/simpleclient/simpleapp/VamsasClient.java
new file mode 100644 (file)
index 0000000..2b70a0a
--- /dev/null
@@ -0,0 +1,186 @@
+/**
+ * 
+ */
+package org.vamsas.test.simpleclient.simpleapp;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Vector;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasFile;
+import org.vamsas.objects.core.Entry;
+import org.vamsas.objects.core.VamsasDocument;
+import org.vamsas.test.simpleclient.ArchiveClient;
+import org.vamsas.test.simpleclient.ClientDoc;
+
+/**
+ * @author jimp
+ *
+ */
+public class VamsasClient extends ArchiveClient {
+       org.apache.commons.logging.Log log=org.apache.commons.logging.LogFactory.getLog(VamsasClient.class);
+  /**
+   * create a new vamsas client session from the archive at sessionPath.
+   * @param sessionPath
+   */
+  public VamsasClient(File sessionPath) {
+               super(System.getProperty("user.name"),System.getProperty("host.name"), "SimpleVamsasClientApp","0.1",
+                               sessionPath);
+       }
+  /**
+   * Called by gui to read anything from the vamsas session into the apps datamodel
+   * after it has started up.
+   *
+   */
+       public void initial_update() {
+               log.info("Jalview loading the Vamsas Session.");
+               // load in the vamsas archive for the first time
+               ClientDoc cdoc = this.getUpdateable();
+               updateJalview(cdoc);
+               // TODO: flush any new VorbaIds to the document : updateVamsasClient may actually generate new Vamsas Document data in the form of vamsas element ids - these should be written back to the document. 
+    //doUpdate(cdoc); // JBPNote: this should flush new VorbaIds but I've not tested it yet.
+    cdoc.closeDoc();
+               // then tell app to update its display based on the datamodel changes.
+       }
+  VamsasClientWatcher watcher=null;
+       /**
+   * Called by app when internal datamodel should exported (syncrhonised outwards) to vamsas document 
+   *
+        */
+  public void push_update() {
+
+    watchForChange=false; // this makes any watch(long) loops return. 
+    // we should also wait arount for this.WATCH_SLEEP to really make sure the watcher thread has stopped. 
+    try {
+      Thread.sleep(WATCH_SLEEP); 
+    } catch (Exception e) {
+      
+    };
+    
+    ClientDoc cdoc = getUpdateable();
+    updateVamsasDocument(cdoc);
+    doUpdate(cdoc);
+    cdoc.closeDoc();
+    cdoc=null;
+    watchForChange=true;
+    startWatcher();
+       }
+       public void end_session() {
+    watchForChange=false; // this makes any watch(long) loops return. 
+    // we should also wait arount for this.WATCH_SLEEP to really make sure the watcher thread has stopped. 
+    try {
+      Thread.sleep(WATCH_SLEEP); 
+    } catch (Exception e) {
+      
+    };
+    
+               // stop any update/watcher thread.
+               log.info("VamsasClientApplication disconnecting from the Vamsas Session.");
+       }
+       public void updateJalview(ClientDoc cdoc) {
+               ensureVamsasBindings();
+    VamsasDatastore vds = new VamsasDatastore(cdoc, vobj2jv, jv2vobj, baseProvEntry());
+    vds.updateToJalview();
+       }
+       private void ensureVamsasBindings() {
+    if (jv2vobj==null) {
+      jv2vobj = new IdentityHashMap();
+      vobj2jv = new Hashtable();
+    }
+       }
+       /**
+        * App's object binding to VorbaIds
+        */
+       IdentityHashMap jv2vobj = null;
+       Hashtable vobj2jv = null;
+       /**
+   * called with a vamsas document which will be updated with new data from the app
+   * @param doc
+        */
+  public void updateVamsasDocument(ClientDoc doc) {
+         ensureVamsasBindings();
+    VamsasDatastore vds = new VamsasDatastore(doc, vobj2jv, jv2vobj, baseProvEntry());
+    // wander through frames 
+    vds.storeVAMSAS(new Object()); // Object is the apps datamodel ;)
+       }
+  /**
+   * 
+   * @return a base provenance entry used by the VamsasDatastore object to get attributes from. this isn't particularly elegant either.
+   */
+       private Entry baseProvEntry() {
+    org.vamsas.objects.core.Entry pentry = new org.vamsas.objects.core.Entry();
+    pentry.setUser(this.getProvenanceUser());
+    pentry.setApp(this.getClientHandle().getClientName());
+    pentry.setDate(new org.exolab.castor.types.Date(new java.util.Date()));
+    pentry.setAction("created");
+    return pentry;
+       }
+  protected class VamsasClientWatcher extends Thread implements Runnable {
+               /* (non-Javadoc)
+                * @see java.lang.Thread#run()
+                */
+               VamsasClient client=null;
+               VamsasClientWatcher(VamsasClient client) {
+                       this.client = client;
+               }
+    boolean running=false;
+               public void run() {
+                 running=true;
+                       while (client.watchForChange) {
+                         ClientDoc docio = client.watch(0);
+                         if (docio!=null) {
+          // VamsasClient GUI bits should be disabled whilst an update is in progress so the user doesn't screw anything up.
+          client.disableGui(true);
+          log.debug("Updating VamsasClient app from changed vamsas document.");
+                           client.updateJalview(docio);
+          log.debug("Finished updating from document change.");
+          docio.closeDoc();
+          docio=null;
+          client.disableGui(false);
+                         }
+      }
+      running=false;
+      
+               }
+               
+       }
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               // TODO Auto-generated method stub
+
+       }
+  /**
+   * disable (if b is true) or enable (if b is true) the VamsasClient's vamsas session gui bits whilst a document change is being updated to the app.
+   * @param b 
+   */
+  public void disableGui(boolean b) {
+      // in jalview, we turn off the VAMSAS Session menu : Desktop.instance.setVamsasUpdate(b);    
+  }
+  /**
+   * spawn a new thread to start the VamsasClientWatcher.
+   *
+   */
+  public void startWatcher() {
+    if (watcher==null)
+      watcher=new VamsasClientWatcher(this);
+    Thread thr = new Thread() {
+      public void run() {
+        watcher.start();
+      }
+    };
+    thr.start();
+  }
+
+}
diff --git a/src/org/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java b/src/org/vamsas/test/simpleclient/simpleapp/VamsasDatastore.java
new file mode 100644 (file)
index 0000000..9114e88
--- /dev/null
@@ -0,0 +1,333 @@
+/*\r
+ * VamsasClientSimpleApp - A framework for interoparable Sequence analysis\r
+ * Copyright (C) 2006 VAMSAS\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+\r
+package org.vamsas.test.simpleclient.simpleapp;\r
+\r
+import org.vamsas.client.Vobject;\r
+import org.vamsas.client.VorbaId;\r
+import org.vamsas.objects.core.*;\r
+import org.vamsas.objects.utils.DocumentStuff;\r
+import org.vamsas.test.simpleclient.ClientDoc;\r
+\r
+\r
+import java.io.*;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Hashtable;\r
+import java.util.IdentityHashMap;\r
+import java.util.Vector;\r
+import java.util.jar.*;\r
+import org.exolab.castor.xml.*;\r
+import org.exolab.castor.mapping.Mapping;\r
+\r
+/*\r
+ * \r
+ * static {\r
+ * org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty(\r
+ * "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); }\r
+ * \r
+ */\r
+\r
+public class VamsasDatastore {\r
+  org.apache.commons.logging.Log log=org.apache.commons.logging.LogFactory.getLog(VamsasDatastore.class);\r
+  Entry provEntry = null;\r
+\r
+\r
+  org.exolab.castor.types.Date date = new org.exolab.castor.types.Date(\r
+      new java.util.Date());\r
+\r
+  ClientDoc cdoc;\r
+\r
+  Hashtable vobj2jv;\r
+\r
+  IdentityHashMap jv2vobj;\r
+\r
+  public VamsasDatastore(ClientDoc cdoc, Hashtable vobj2jv,\r
+      IdentityHashMap jv2vobj, Entry provEntry) {\r
+      this.cdoc = cdoc;\r
+    this.vobj2jv = vobj2jv;\r
+    this.jv2vobj = jv2vobj;\r
+    this.provEntry = provEntry;\r
+  }\r
+\r
+  /*\r
+   * public void storeJalview(String file, AlignFrame af) { try { // 1. Load the\r
+   * mapping information from the file Mapping map = new\r
+   * Mapping(getClass().getClassLoader()); java.net.URL url =\r
+   * getClass().getResource("/jalview_mapping.xml"); map.loadMapping(url); // 2.\r
+   * Unmarshal the data // Unmarshaller unmar = new Unmarshaller();\r
+   * //unmar.setIgnoreExtraElements(true); //unmar.setMapping(map); // uni =\r
+   * (UniprotFile) unmar.unmarshal(new FileReader(file)); // 3. marshal the data\r
+   * with the total price back and print the XML in the console Marshaller\r
+   * marshaller = new Marshaller( new FileWriter(file) );\r
+   * \r
+   * marshaller.setMapping(map); marshaller.marshal(af); } catch (Exception e) {\r
+   * e.printStackTrace(); } }\r
+   * \r
+   * \r
+   */\r
+  /**\r
+   * @return the Vobject bound to Jalview datamodel object\r
+   */\r
+  protected Vobject getjv2vObj(Object jvobj) {\r
+    if (jv2vobj.containsKey(jvobj))\r
+      return cdoc.getObject((VorbaId) jv2vobj.get(jvobj));\r
+    return null;\r
+  }\r
+\r
+  /**\r
+   * \r
+   * @param vobj\r
+   * @return Jalview datamodel object bound to the vamsas document object\r
+   */\r
+  protected Object getvObj2jv(org.vamsas.client.Vobject vobj) {\r
+    VorbaId id = vobj.getVorbaId();\r
+    if (id == null)\r
+    {\r
+      id = cdoc.registerObject(vobj);\r
+      log\r
+      .debug("Registering new object and returning null for getvObj2jv");\r
+      return null;\r
+    }\r
+    if (vobj2jv.containsKey(vobj.getVorbaId()))\r
+      return vobj2jv.get(vobj.getVorbaId());\r
+    return null;\r
+  }\r
+\r
+  protected void bindjvvobj(Object jvobj, org.vamsas.client.Vobject vobj) {\r
+    VorbaId id = vobj.getVorbaId();\r
+    if (id == null)\r
+    {\r
+      id = cdoc.registerObject(vobj);\r
+      if (id==null || vobj.getVorbaId()==null)\r
+        log.error("Failed to get id for "+(vobj.isRegisterable() ? "registerable" : "unregisterable") +" object "+vobj);\r
+    }\r
+    if (vobj2jv.containsKey(vobj.getVorbaId()) || jv2vobj.containsKey(jvobj))\r
+    {\r
+      log.error("Duplicate object binding! "+vobj+" id " +vobj.getVorbaId().getId()+" to "+jvobj);\r
+    }\r
+    else\r
+    {\r
+      vobj2jv.put(vobj.getVorbaId(), jvobj);// JBPNote - better implementing a\r
+      // hybrid invertible hash.\r
+      jv2vobj.put(jvobj, vobj.getVorbaId());\r
+    }\r
+  }\r
+\r
+  /**\r
+   * put the alignment viewed by AlignViewport into cdoc.\r
+   * \r
+   * @param av\r
+   */\r
+  public void storeVAMSAS(Object fromAppsDatamodel) {\r
+    boolean nw = false;\r
+    VAMSAS root = null; // will be resolved based on Dataset Parent.\r
+    DataSet dataset = (DataSet) getjv2vObj(fromAppsDatamodel);\r
+    if (dataset == null)\r
+    {\r
+      root = cdoc.getVamsasRoots()[0]; // default vamsas root for modifying.\r
+      dataset = new DataSet();\r
+      root.addDataSet(dataset);\r
+      bindjvvobj(fromAppsDatamodel, dataset);\r
+      dataset.setProvenance(dummyProvenance());\r
+      dataset.getProvenance().addEntry(provEntry);\r
+      nw = true;\r
+    } else {\r
+      root = (VAMSAS) dataset.getV_parent();\r
+    }\r
+    // etc...\r
+  }\r
+\r
+  private Property newProperty(String name, String type, String content) {\r
+    Property vProperty=new Property();\r
+    vProperty.setName(name);\r
+    if (type!=null)\r
+      vProperty.setType(type);\r
+    vProperty.setContent(content);\r
+    return vProperty;\r
+  }\r
+\r
+  /**\r
+   * get start<end range of segment, adjusting for inclusivity flag and\r
+   * polarity.\r
+   *  \r
+   * @param visSeg\r
+   * @param ensureDirection when true - always ensure start is less than end.\r
+   * @return int[] { start, end, direction} where direction==1 for range running from end to start.\r
+   */\r
+  private int[] getSegRange(Seg visSeg, boolean ensureDirection) {\r
+    boolean incl = visSeg.getInclusive();\r
+    // adjust for inclusive flag.\r
+    int pol = (visSeg.getStart() <= visSeg.getEnd()) ? 1 : -1; // polarity of\r
+    // region.\r
+    int start = visSeg.getStart() + (incl ? 0 : pol);\r
+    int end = visSeg.getEnd() + (incl ? 0 : -pol);\r
+    if (ensureDirection && pol==-1)\r
+    {\r
+      // jalview doesn't deal with inverted ranges, yet.\r
+      int t = end;\r
+      end = start;\r
+      start = t;\r
+    }\r
+    return new int[] { start, end, pol<0 ? 1 : 0 };\r
+  }\r
+\r
+  public void updateToJalview() {\r
+    VAMSAS _roots[] = cdoc.getVamsasRoots();\r
+\r
+    for (int _root = 0; _root<_roots.length; _root++) {\r
+      VAMSAS root = _roots[_root];\r
+      boolean newds=false;\r
+      for (int _ds=0,_nds=root.getDataSetCount(); _ds<_nds; _ds++) {\r
+        // ///////////////////////////////////\r
+        // ///LOAD DATASET\r
+        DataSet dataset = root.getDataSet(_ds);\r
+        int i, iSize = dataset.getSequenceCount();\r
+        Vector dsseqs;\r
+        Object appsdataset = (Object) getvObj2jv(dataset);\r
+        int jremain=0;\r
+        if (appsdataset==null) {\r
+          log.debug("Initialising new dataset fields");\r
+          newds=true;\r
+          dsseqs=new Vector();\r
+        } else {\r
+          log.debug("Update dataset from vamsas dataset.");\r
+        }\r
+        // etc for annotations, alignments, trees, etc. \r
+      }\r
+    }\r
+  }\r
+  /**\r
+   * get real bounds of a RangeType's specification. start and end are an\r
+   * inclusive range within which all segments and positions lie.\r
+   * TODO: refactor to vamsas utils\r
+   * @param dseta\r
+   * @return int[] { start, end}\r
+   */\r
+  private int[] getBounds(RangeType dseta) {\r
+    if (dseta != null)\r
+    {\r
+      int[] se = null;\r
+      if (dseta.getSegCount()>0 && dseta.getPosCount()>0)\r
+        throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+      if (dseta.getSegCount() > 0)\r
+      {\r
+        se = getSegRange(dseta.getSeg(0),true);\r
+        for (int s = 1, sSize = dseta.getSegCount(); s < sSize; s++)\r
+        {\r
+          int nse[] = getSegRange(dseta.getSeg(s), true);\r
+          if (se[0] > nse[0])\r
+            se[0] = nse[0];\r
+          if (se[1] < nse[1])\r
+            se[1] = nse[1];\r
+        }\r
+      }\r
+      if (dseta.getPosCount() > 0)\r
+      {\r
+        // could do a polarity for pos range too. and pass back indication of discontinuities.\r
+        int pos = dseta.getPos(0).getI();\r
+        se = new int[] { pos, pos };\r
+        for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
+        {\r
+          pos = dseta.getPos(p).getI();\r
+          if (se[0] > pos)\r
+            se[0] = pos;\r
+          if (se[1] < pos)\r
+            se[1] = pos;\r
+        }\r
+      }\r
+      return se;\r
+    }\r
+    return null;\r
+  }\r
+  /**\r
+   * map from a rangeType's internal frame to the referenced object's coordinate frame.\r
+   * @param dseta\r
+   * @return int [] { ref(pos)...} for all pos in rangeType's frame.\r
+   */\r
+  private int[] getMapping(RangeType dseta) {\r
+    Vector posList=new Vector();\r
+    if (dseta != null)\r
+    {\r
+      int[] se = null;\r
+      if (dseta.getSegCount()>0 && dseta.getPosCount()>0)\r
+        throw new Error("Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!");\r
+      if (dseta.getSegCount() > 0)\r
+      {\r
+        for (int s = 0, sSize = dseta.getSegCount(); s < sSize; s++)\r
+        {\r
+          se = getSegRange(dseta.getSeg(s), false);\r
+          int se_end=se[1-se[2]]+(se[2]==0 ? 1 : -1);\r
+          for (int p=se[se[2]]; p!=se_end; p+=se[2]==0 ? 1 : -1 ) {\r
+            posList.add(Integer.valueOf(p));\r
+          }\r
+        }\r
+      } \r
+      else if (dseta.getPosCount() > 0)\r
+      {\r
+        int pos = dseta.getPos(0).getI();\r
+\r
+        for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++)\r
+        {\r
+          pos = dseta.getPos(p).getI();\r
+          posList.add(Integer.valueOf(pos));\r
+        }\r
+      }\r
+    }\r
+    if (posList!=null && posList.size()>0) {\r
+      int[] range=new int[posList.size()];\r
+      for (int i=0; i<range.length; i++)\r
+        range[i] = ((Integer)posList.elementAt(i)).intValue();\r
+      posList.clear();\r
+      return range;\r
+    }\r
+    return null;\r
+  }\r
+  /**\r
+   * \r
+   * @return default initial provenance list for a VamsasDatastore created vamsas\r
+   *         object.\r
+   */\r
+  Provenance dummyProvenance() {\r
+    return dummyProvenance(null);\r
+  }\r
+\r
+  Entry dummyPEntry(String action) {\r
+    Entry entry = new Entry();\r
+    entry.setApp(this.provEntry.getApp());\r
+    if (action != null)\r
+      entry.setAction(action);\r
+    else\r
+      entry.setAction("created.");\r
+    entry.setDate(new org.exolab.castor.types.Date(new java.util.Date()));\r
+    entry.setUser(this.provEntry.getUser());\r
+    return entry;\r
+  }\r
+\r
+  Provenance dummyProvenance(String action) {\r
+    Provenance prov = new Provenance();\r
+    prov.addEntry(dummyPEntry(action));\r
+    return prov;\r
+  }\r
+\r
+  void addProvenance(Provenance p, String action) {\r
+    p.addEntry(dummyPEntry(action));\r
+  }\r
+\r
+}\r