*/
package org.vamsas.client;
+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.util.EventListener;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.exolab.castor.xml.IDResolver;
+import org.exolab.castor.xml.MarshalException;
+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;
/**
* @author jimp
- *
- * TODO To change the template for this generated type comment go to
- * Window - Preferences - Java - Code Style - Code Templates
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
*/
public class Client implements IClient {
- /* (non-Javadoc)
+ UserHandle user = null;
+
+ SessionHandle session = null;
+
+ ClientHandle client = null;
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getAbout()
*/
public String getAbout() {
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getSessionUrn()
*/
public String getSessionUrn() {
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getSessionHandle()
*/
public SessionHandle getSessionHandle() {
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getClientHandle()
*/
public ClientHandle getClientHandle() {
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getUserHandle()
*/
public UserHandle getUserHandle() {
return null;
}
- /* (non-Javadoc)
+ 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, listener;
+ ((PropertyChangeSupport) (handler
+ = handlers.get(Events.DOCUMENT_UPDATE))).addPropertyChangeListener(evt);
+ listeners.add(handler);
+ listeners.add((Object) evt);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#finalizeClient()
*/
public void finalizeClient() {
// TODO Auto-generated method stub
}
-
- /* (non-Javadoc)
- * @see org.vamsas.client.IClient#addDocumentUpdateHandler(java.util.EventListener)
+
+ /**
+ * writes the VamsasDocument to the given stream.
+ * @param outstream
+ * @param doc
+ * @throws IOException
+ * @throws MarshalException
+ * @throws ValidationException
*/
- public void addDocumentUpdateHandler(EventListener evt) {
- // TODO Auto-generated method stub
+ private static void setVamsasDocument(Writer outstream, VamsasDocument doc) throws IOException, MarshalException, ValidationException {
+ Marshaller marshaller = new Marshaller(outstream);
+ marshaller.marshal(doc);
+ }
+
+ /**
+ * Unmarshals a vamsasDocument object from a stream, registers
+ * any VorbaIds, and completes the org.vamsas.client.object housekeeping fields.
+ *
+ * @param instream - the XML input stream
+ * @param factory - the Client's properly configured VorbaId factory to make new references.
+ * @return null or {(Object) VamsasDocument object, (Object) Hashtable of object references)
+ */
+ private static Object[] getVamsasDocument(Reader instream,
+ IVorbaIdFactory factory) {
+ Unmarshaller unmarshaller = new Unmarshaller(instream);
+ unmarshaller.setIDResolver(new IDResolver() {
+ public Object resolve(String id) {
+ System.err.println("Warning - id " + id
+ + " is not found in the VamsasDocument!");
+ return null;
+ }
+ });
+ Hashtable refbase = new Hashtable();
+ final Hashtable objrefs = refbase;
+ final IVorbaIdFactory vorbafactory = factory;
+ unmarshaller.setUnmarshalListener(new UnmarshalListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.exolab.castor.xml.UnmarshalListener#attributesProcessed(java.lang.Object)
+ */
+ public void attributesProcessed(Object object) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (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) {
+ // TODO Auto-generated method stub
+
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.exolab.castor.xml.UnmarshalListener#initialized(java.lang.Object)
+ */
+ public void initialized(Object object) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * Check if the object has an 'id' field - if it does, copy the value into
+ * the VorbaId field of object, and add the object to the VorbaId hash.
+ *
+ * @see org.exolab.castor.xml.UnmarshalListener#unmarshalled(java.lang.Object)
+ */
+ public void unmarshalled(Object newobj) {
+ if (newobj instanceof object) {
+ object nobj = (object) newobj;
+ nobj.set__stored_in_document(true);
+ Field fd = null;
+ try {
+ // look for the id field (should be an NCName string)
+ fd = nobj.getClass().getField("id");
+ String idstring;
+ if (fd.getType().getClass().equals("astring".getClass())) {
+ if (fd.get(nobj) != null) {
+ idstring = (String) fd.get(nobj);
+ if (idstring.length() > 0)
+ if (!objrefs.containsKey(idstring)) {
+ objrefs.put(idstring, nobj);
+ nobj.setVorbaId(VorbaId.newId(idstring));
+ nobj.__vorba = vorbafactory;
+ }
+ }
+ }
+ nobj.doHash();
+ } catch (Exception e) {
+ return;
+ }
+ ;
+ }
+ }
+
+ });
+ // Call the unmarshaller.
+ try {
+ while (instream.ready()) {
+ Object obj = unmarshaller.unmarshal(instream);
+ if (obj instanceof VamsasDocument) {
+ return new Object[] { obj, objrefs};
+ }
+ }
+ } 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;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#getClientDocument()
*/
+
public IClientDocument getClientDocument() {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#updateDocument(org.vamsas.client.IClientDocument)
*/
public void updateDocument(IClientDocument newdoc) {
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClient#storeDocument(java.io.File)
*/
public void storeDocument(File location) {
}
- /* (non-Javadoc)
- * @see org.vamsas.client.IClient#addVorbaEventHandler(java.lang.String, java.beans.PropertyChangeListener)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.vamsas.client.IClient#addVorbaEventHandler(java.lang.String,
+ * java.beans.PropertyChangeListener)
*/
public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt) {
// TODO Auto-generated method stub
import java.util.Hashtable;
+import org.vamsas.objects.core.VAMSAS;
+import org.vamsas.objects.core.VamsasDocument;
+
/**
- * @author jimp
- * Contains a collection of vamsas objects and reference
- * to a specified ClientHandle's information.
+ * @author jimp Contains a collection of vamsas objects and reference to a
+ * specified ClientHandle's information.
*/
public class ClientDocument implements IClientDocument {
- IClient vorba;
- /* (non-Javadoc)
+ protected IClient vorba;
+
+ protected VamsasDocument doc;
+
+ protected byte[] appData;
+
+ /**
+ * collection of org.vamsas.client.object references
+ */
+ protected Hashtable vamsasObjects;
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#getApplicationData()
*/
+
public byte[] getApplicationData() {
// Look up client byte stash using client and user handle
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId)
*/
public object getObject(VorbaId id) {
// retrieve object and return
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[])
*/
public object[] getObjects(VorbaId[] ids) {
// getObject in bulk
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#getVamsasRoots()
*/
public object[] getVamsasRoots() {
// extract root objects
- return null;
+ VAMSAS[] roots = doc.getVAMSAS();
+ if (roots == null)
+ return new VAMSAS[] { new VAMSAS() };
+ return roots;
}
- /* (non-Javadoc)
+
+ /**
+ * update the document with new roots.
+ */
+ public void setVamsasRoots(VAMSAS[] newroots) {
+ // extract root objects
+ VAMSAS[] roots = doc.getVAMSAS();
+ 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
+ object oldversion = getObject(newroots[i].getVorbaId());
+ if (oldversion instanceof VAMSAS) {
+ // TODO: appropriate merging behaviour when two clients have
+ // modified the same registered object independently
+ if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
+ // client has modified this object since last retrieval.
+ if (newroots[i].get__last_hash() != oldversion.get__last_hash()) {
+ // object has been modified by another client since this
+ // client's
+ // last access to document.
+ }
+ }
+ } else {
+ throw new Error(
+ "Client error when using setVamsasRoots : The vorbaId for object "
+ + i
+ + " does not refer to an object of type VAMSAS in the current document!");
+ }
+ } else {
+ if (!newroots[i].is__stored_in_document()) {
+ // check if object is modified
+ if (newroots[i].get__last_hash() != newroots[i].hashCode()) {
+ // it is - so we add newroots[i] as a new object, with updated
+ // provenance.
+ } else {
+ // do nothing
+ newroots[i] = null;
+ }
+ } else {
+ // just add newroots[i] as a new object in the document
+ // - with appropriate provenance.
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.object)
*/
- public VorbaId registerObject(object unregistered) {
- // TODO Auto-generated method stub
- return null;
+public VorbaId registerObject(object unregistered) {
+ VorbaId rtn;
+ if (!unregistered.isRegistered())
+ unregistered.VorbaId.(rtn=unregistered.__vorba.makeVorbaId());
+ else
+ return unregistered.getVorbaId();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#registerObjects(org.vamsas.client.object[])
*/
public VorbaId[] registerObjects(object[] unregistered) {
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.vamsas.client.IClientDocument#setApplicationData(byte[])
*/
public void setApplicationData(byte[] newData) {
// TODO Auto-generated method stub
}
- /**
- * collection of org.vamsas.client.objects
- */
- Hashtable VamsasObjects;
- byte[] appData;
}
*
*/
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);
+ return vec;
+ }
}
package org.vamsas.client;
import java.beans.PropertyChangeListener;
-import java.util.EventListener;
/**
* Defines the methods availabable to a vamsas
/**
* register handler for updates for the current session
*/
- public void addDocumentUpdateHandler(EventListener evt);
+ public void addDocumentUpdateHandler(PropertyChangeListener evt);
/**
* get vamsas document with
* user and app specific data
*/
public class VorbaId {
protected String id;
+ protected VorbaId() {
+ super();
+ }
private VorbaId(String Id) {
+ super();
id = Id;
}
protected static VorbaId newId(IVorbaIdFactory vorbaObject) {
return vorbaObject.makeVorbaId();
}
}
+ protected static VorbaId newId(String id) {
+ return new VorbaId(id);
+ }
/**
* @return Returns the id.
*/
*/
protected boolean __stored_in_document=false;
protected long __last_hash=0;
+
protected VorbaId vorbaId=null;
protected IVorbaIdFactory __vorba=null;
/**
+ * calculate a hash
+ * for the object with all housekeeping
+ * fields at standard values.
+ */
+ synchronized protected void doHash() {
+ __last_hash = 0;
+ VorbaId thisid = vorbaId;
+ IVorbaIdFactory factory = __vorba;
+ boolean stored = __stored_in_document;
+ vorbaId = null;
+ __vorba = null;
+ __last_hash = this.hashCode();
+ vorbaId = thisid;
+ __vorba = factory;
+ __stored_in_document = stored;
+ }
+
+ /**
*
* @return true if object is registered
*/
* or not associated with a properly instantiated
* VorbaIdFactory.
*/
- public String getVorbaId() {
+ public VorbaId getVorbaId() {
if (vorbaId==null) {
// Try to use the associated factory.
if (__vorba!=null)
else
return null;
}
- return vorbaId.getId();
+ return vorbaId;
}
/**
* used by the IClient implementation
-- listing properties --
-org.vamsas.objects.core.Tree=org.vamsas.objects.core.TreeDescriptor
-org.vamsas.objects.core.Provenance=org.vamsas.objects.core.ProvenanceDes...
-org.vamsas.objects.core.SequenceType=org.vamsas.objects.core.SequenceTypeD...
-org.vamsas.objects.core.Newick=org.vamsas.objects.core.NewickDescriptor
-org.vamsas.objects.core.AnnotationElement=org.vamsas.objects.core.AnnotationEle...
-org.vamsas.objects.core.AlignmentSequence=org.vamsas.objects.core.AlignmentSequ...
-org.vamsas.objects.core.Alignment=org.vamsas.objects.core.AlignmentDesc...
-org.vamsas.objects.core.User=org.vamsas.objects.core.UserDescriptor
-org.vamsas.objects.core.DbRef=org.vamsas.objects.core.DbRefDescriptor
-org.vamsas.objects.core.SequenceSetAnnotations=org.vamsas.objects.core.SequenceSetAn...
-org.vamsas.objects.core.Application=org.vamsas.objects.core.ApplicationDe...
-org.vamsas.objects.core.VAMSAS=org.vamsas.objects.core.VAMSASDescriptor
-org.vamsas.objects.core.Sequence=org.vamsas.objects.core.SequenceDescr...
org.vamsas.objects.core.LockFile=org.vamsas.objects.core.LockFileDescr...
-org.vamsas.objects.core.Entry=org.vamsas.objects.core.EntryDescriptor
-org.vamsas.objects.core.SequenceSet=org.vamsas.objects.core.SequenceSetDe...
-org.vamsas.objects.core.ApplicationData=org.vamsas.objects.core.ApplicationDa...
-org.vamsas.objects.core.AlignmentAnnotations=org.vamsas.objects.core.AlignmentAnno...
+org.vamsas.objects.core.VamsasDocument=org.vamsas.objects.core.VamsasDocumen...
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
- desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _displayCharacter
fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator typeValidator = new StringValidator();
typeValidator.setWhiteSpace("preserve");
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
- desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _description
fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator typeValidator = new StringValidator();
typeValidator.setWhiteSpace("preserve");
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
- desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _secondaryStructure
fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator typeValidator = new StringValidator();
typeValidator.setLength(1);
{
try {
AnnotationElement target = (AnnotationElement) object;
- // ignore null values for non optional primitives
- if (value == null) return;
-
+ // if null, use delete method for optional primitives
+ if (value == null) {
+ target.deleteValue();
+ return;
+ }
target.setValue( ((java.lang.Float)value).floatValue());
}
catch (java.lang.Exception ex) {
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
- desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _value
fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
{ //-- local scope
FloatValidator typeValidator = new FloatValidator();
fieldValidator.setValidator(typeValidator);
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;
private java.lang.String _data;
/**
- * Field _user
+ * Field _userList
*/
- private org.vamsas.objects.core.User _user;
+ private java.util.Vector _userList;
//----------------/
public Application()
{
super();
+ _userList = new Vector();
} //-- org.vamsas.objects.core.Application()
//-----------/
/**
+ * 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 enumerateUser
+ *
+ *
+ *
+ * @return Enumeration
+ */
+ public java.util.Enumeration enumerateUser()
+ {
+ return _userList.elements();
+ } //-- java.util.Enumeration enumerateUser()
+
+ /**
* Note: hashCode() has not been overriden
*
* @param obj
}
else if (temp._data != null)
return false;
- if (this._user != null) {
- if (temp._user == null) return false;
- else if (!(this._user.equals(temp._user)))
+ if (this._userList != null) {
+ if (temp._userList == null) return false;
+ else if (!(this._userList.equals(temp._userList)))
return false;
}
- else if (temp._user != null)
+ else if (temp._userList != null)
return false;
return true;
}
} //-- java.lang.String getUrn()
/**
- * Returns the value of field 'user'.
+ * Method getUser
*
+ *
+ *
+ * @param index
* @return User
- * @return the value of field 'user'.
*/
- public org.vamsas.objects.core.User getUser()
+ public org.vamsas.objects.core.User getUser(int index)
+ throws java.lang.IndexOutOfBoundsException
{
- return this._user;
- } //-- org.vamsas.objects.core.User getUser()
+ //-- 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'.
} //-- void marshal(org.xml.sax.ContentHandler)
/**
+ * Method removeAllUser
+ *
+ */
+ public void removeAllUser()
+ {
+ _userList.removeAllElements();
+ } //-- void removeAllUser()
+
+ /**
+ * 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 'data'.
*
* @param data the value of field 'data'.
} //-- void setUrn(java.lang.String)
/**
- * Sets the value of field 'user'.
+ * 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 user the value of field 'user'.
+ *
+ * @param userArray
*/
- public void setUser(org.vamsas.objects.core.User user)
+ public void setUser(org.vamsas.objects.core.User[] userArray)
{
- this._user = user;
+ //-- copy array
+ _userList.removeAllElements();
+ for (int i = 0; i < userArray.length; i++) {
+ _userList.addElement(userArray[i]);
+ }
} //-- void setUser(org.vamsas.objects.core.User)
/**
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;
//--------------------------/
/**
- * Field _application
+ * Field _applicationList
*/
- private org.vamsas.objects.core.Application _application;
+ private java.util.Vector _applicationList;
//----------------/
public ApplicationData()
{
super();
+ _applicationList = new Vector();
} //-- org.vamsas.objects.core.ApplicationData()
//-----------/
/**
+ * Method addApplication
+ *
+ *
+ *
+ * @param vApplication
+ */
+ public void addApplication(org.vamsas.objects.core.Application vApplication)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ _applicationList.addElement(vApplication);
+ } //-- void addApplication(org.vamsas.objects.core.Application)
+
+ /**
+ * Method addApplication
+ *
+ *
+ *
+ * @param index
+ * @param vApplication
+ */
+ public void addApplication(int index, org.vamsas.objects.core.Application vApplication)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ _applicationList.insertElementAt(vApplication, index);
+ } //-- void addApplication(int, org.vamsas.objects.core.Application)
+
+ /**
+ * Method enumerateApplication
+ *
+ *
+ *
+ * @return Enumeration
+ */
+ public java.util.Enumeration enumerateApplication()
+ {
+ return _applicationList.elements();
+ } //-- java.util.Enumeration enumerateApplication()
+
+ /**
* Note: hashCode() has not been overriden
*
* @param obj
if (obj instanceof ApplicationData) {
ApplicationData temp = (ApplicationData)obj;
- if (this._application != null) {
- if (temp._application == null) return false;
- else if (!(this._application.equals(temp._application)))
+ if (this._applicationList != null) {
+ if (temp._applicationList == null) return false;
+ else if (!(this._applicationList.equals(temp._applicationList)))
return false;
}
- else if (temp._application != null)
+ else if (temp._applicationList != null)
return false;
return true;
}
} //-- boolean equals(java.lang.Object)
/**
- * Returns the value of field 'application'.
+ * Method getApplication
*
+ *
+ *
+ * @param index
* @return Application
- * @return the value of field 'application'.
*/
- public org.vamsas.objects.core.Application getApplication()
+ public org.vamsas.objects.core.Application getApplication(int index)
+ throws java.lang.IndexOutOfBoundsException
{
- return this._application;
- } //-- org.vamsas.objects.core.Application getApplication()
+ //-- check bounds for index
+ if ((index < 0) || (index > _applicationList.size())) {
+ throw new IndexOutOfBoundsException("getApplication: Index value '"+index+"' not in range [0.."+_applicationList.size()+ "]");
+ }
+
+ return (org.vamsas.objects.core.Application) _applicationList.elementAt(index);
+ } //-- org.vamsas.objects.core.Application getApplication(int)
+
+ /**
+ * Method getApplication
+ *
+ *
+ *
+ * @return Application
+ */
+ public org.vamsas.objects.core.Application[] getApplication()
+ {
+ int size = _applicationList.size();
+ org.vamsas.objects.core.Application[] mArray = new org.vamsas.objects.core.Application[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (org.vamsas.objects.core.Application) _applicationList.elementAt(index);
+ }
+ return mArray;
+ } //-- org.vamsas.objects.core.Application[] getApplication()
+
+ /**
+ * Method getApplicationCount
+ *
+ *
+ *
+ * @return int
+ */
+ public int getApplicationCount()
+ {
+ return _applicationList.size();
+ } //-- int getApplicationCount()
/**
* Method isValid
} //-- void marshal(org.xml.sax.ContentHandler)
/**
- * Sets the value of field 'application'.
+ * Method removeAllApplication
+ *
+ */
+ public void removeAllApplication()
+ {
+ _applicationList.removeAllElements();
+ } //-- void removeAllApplication()
+
+ /**
+ * Method removeApplication
+ *
+ *
+ *
+ * @param index
+ * @return Application
+ */
+ public org.vamsas.objects.core.Application removeApplication(int index)
+ {
+ java.lang.Object obj = _applicationList.elementAt(index);
+ _applicationList.removeElementAt(index);
+ return (org.vamsas.objects.core.Application) obj;
+ } //-- org.vamsas.objects.core.Application removeApplication(int)
+
+ /**
+ * Method setApplication
+ *
+ *
+ *
+ * @param index
+ * @param vApplication
+ */
+ public void setApplication(int index, org.vamsas.objects.core.Application vApplication)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ //-- check bounds for index
+ if ((index < 0) || (index > _applicationList.size())) {
+ throw new IndexOutOfBoundsException("setApplication: Index value '"+index+"' not in range [0.."+_applicationList.size()+ "]");
+ }
+ _applicationList.setElementAt(vApplication, index);
+ } //-- void setApplication(int, org.vamsas.objects.core.Application)
+
+ /**
+ * Method setApplication
+ *
*
- * @param application the value of field 'application'.
+ *
+ * @param applicationArray
*/
- public void setApplication(org.vamsas.objects.core.Application application)
+ public void setApplication(org.vamsas.objects.core.Application[] applicationArray)
{
- this._application = application;
+ //-- copy array
+ _applicationList.removeAllElements();
+ for (int i = 0; i < applicationArray.length; i++) {
+ _applicationList.addElement(applicationArray[i]);
+ }
} //-- void setApplication(org.vamsas.objects.core.Application)
/**
//-- initialize element descriptors
- //-- _application
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Application.class, "_application", "Application", org.exolab.castor.xml.NodeType.Element);
+ //-- _applicationList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Application.class, "_applicationList", "Application", org.exolab.castor.xml.NodeType.Element);
handler = new org.exolab.castor.xml.XMLFieldHandler() {
public java.lang.Object getValue( java.lang.Object object )
throws IllegalStateException
{
try {
ApplicationData target = (ApplicationData) object;
- target.setApplication( (org.vamsas.objects.core.Application) value);
+ target.addApplication( (org.vamsas.objects.core.Application) value);
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
- desc.setRequired(true);
- desc.setMultivalued(false);
+ desc.setMultivalued(true);
addFieldDescriptor(desc);
- //-- validation code for: _application
+ //-- validation code for: _applicationList
fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
+ fieldValidator.setMinOccurs(0);
{ //-- local scope
}
desc.setValidator(fieldValidator);
}
};
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");
}
};
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");
}
};
desc.setHandler(handler);
+ desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _urn
fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator typeValidator = new StringValidator();
typeValidator.setWhiteSpace("preserve");
}
};
desc.setHandler(handler);
+ desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _data
fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
{ //-- local scope
StringValidator typeValidator = new StringValidator();
typeValidator.setWhiteSpace("preserve");
desc.setValidator(fieldValidator);
//-- initialize element descriptors
- //-- _user
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.User.class, "_user", "User", org.exolab.castor.xml.NodeType.Element);
+ //-- _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
{
try {
Application target = (Application) object;
- target.setUser( (org.vamsas.objects.core.User) value);
+ target.addUser( (org.vamsas.objects.core.User) value);
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
desc.setRequired(true);
- desc.setMultivalued(false);
+ desc.setMultivalued(true);
addFieldDescriptor(desc);
- //-- validation code for: _user
+ //-- validation code for: _userList
fieldValidator = new org.exolab.castor.xml.FieldValidator();
fieldValidator.setMinOccurs(1);
{ //-- local scope
public LockFileDescriptor()
{
super();
- nsURI = "http://www.vamsas.org";
+ nsURI = "http://www.vamsas.ac.uk/vamsasDocument";
xmlName = "LockFile";
org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
org.exolab.castor.mapping.FieldHandler handler = null;
private java.util.Vector _treeList;
/**
- * Field _provenance
+ * Field _provenanceList
*/
- private org.vamsas.objects.core.Provenance _provenance;
+ private java.util.Vector _provenanceList;
//----------------/
_sequenceSetAnnotationsList = new Vector();
_alignmentList = new Vector();
_treeList = new Vector();
+ _provenanceList = new Vector();
} //-- org.vamsas.objects.core.SequenceSet()
} //-- void addAlignment(int, org.vamsas.objects.core.Alignment)
/**
+ * Method addProvenance
+ *
+ *
+ *
+ * @param vProvenance
+ */
+ public void addProvenance(org.vamsas.objects.core.Provenance vProvenance)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ _provenanceList.addElement(vProvenance);
+ } //-- void addProvenance(org.vamsas.objects.core.Provenance)
+
+ /**
+ * Method addProvenance
+ *
+ *
+ *
+ * @param index
+ * @param vProvenance
+ */
+ public void addProvenance(int index, org.vamsas.objects.core.Provenance vProvenance)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ _provenanceList.insertElementAt(vProvenance, index);
+ } //-- void addProvenance(int, org.vamsas.objects.core.Provenance)
+
+ /**
* Method addSequence
*
*
} //-- java.util.Enumeration enumerateAlignment()
/**
+ * Method enumerateProvenance
+ *
+ *
+ *
+ * @return Enumeration
+ */
+ public java.util.Enumeration enumerateProvenance()
+ {
+ return _provenanceList.elements();
+ } //-- java.util.Enumeration enumerateProvenance()
+
+ /**
* Method enumerateSequence
*
*
}
else if (temp._treeList != null)
return false;
- if (this._provenance != null) {
- if (temp._provenance == null) return false;
- else if (!(this._provenance.equals(temp._provenance)))
+ if (this._provenanceList != null) {
+ if (temp._provenanceList == null) return false;
+ else if (!(this._provenanceList.equals(temp._provenanceList)))
return false;
}
- else if (temp._provenance != null)
+ else if (temp._provenanceList != null)
return false;
return true;
}
} //-- java.lang.String getId()
/**
- * Returns the value of field 'provenance'.
+ * Method getProvenance
+ *
+ *
+ *
+ * @param index
+ * @return Provenance
+ */
+ public org.vamsas.objects.core.Provenance getProvenance(int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ //-- check bounds for index
+ if ((index < 0) || (index > _provenanceList.size())) {
+ throw new IndexOutOfBoundsException("getProvenance: Index value '"+index+"' not in range [0.."+_provenanceList.size()+ "]");
+ }
+
+ return (org.vamsas.objects.core.Provenance) _provenanceList.elementAt(index);
+ } //-- org.vamsas.objects.core.Provenance getProvenance(int)
+
+ /**
+ * Method getProvenance
+ *
+ *
*
* @return Provenance
- * @return the value of field 'provenance'.
*/
- public org.vamsas.objects.core.Provenance getProvenance()
+ public org.vamsas.objects.core.Provenance[] getProvenance()
{
- return this._provenance;
- } //-- org.vamsas.objects.core.Provenance getProvenance()
+ int size = _provenanceList.size();
+ org.vamsas.objects.core.Provenance[] mArray = new org.vamsas.objects.core.Provenance[size];
+ for (int index = 0; index < size; index++) {
+ mArray[index] = (org.vamsas.objects.core.Provenance) _provenanceList.elementAt(index);
+ }
+ return mArray;
+ } //-- org.vamsas.objects.core.Provenance[] getProvenance()
+
+ /**
+ * Method getProvenanceCount
+ *
+ *
+ *
+ * @return int
+ */
+ public int getProvenanceCount()
+ {
+ return _provenanceList.size();
+ } //-- int getProvenanceCount()
/**
* Method getSequence
} //-- void removeAllAlignment()
/**
+ * Method removeAllProvenance
+ *
+ */
+ public void removeAllProvenance()
+ {
+ _provenanceList.removeAllElements();
+ } //-- void removeAllProvenance()
+
+ /**
* Method removeAllSequence
*
*/
} //-- void removeAllTree()
/**
+ * Method removeProvenance
+ *
+ *
+ *
+ * @param index
+ * @return Provenance
+ */
+ public org.vamsas.objects.core.Provenance removeProvenance(int index)
+ {
+ java.lang.Object obj = _provenanceList.elementAt(index);
+ _provenanceList.removeElementAt(index);
+ return (org.vamsas.objects.core.Provenance) obj;
+ } //-- org.vamsas.objects.core.Provenance removeProvenance(int)
+
+ /**
* Method removeSequence
*
*
} //-- void setId(java.lang.String)
/**
- * Sets the value of field 'provenance'.
+ * Method setProvenance
+ *
+ *
+ *
+ * @param index
+ * @param vProvenance
+ */
+ public void setProvenance(int index, org.vamsas.objects.core.Provenance vProvenance)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ //-- check bounds for index
+ if ((index < 0) || (index > _provenanceList.size())) {
+ throw new IndexOutOfBoundsException("setProvenance: Index value '"+index+"' not in range [0.."+_provenanceList.size()+ "]");
+ }
+ _provenanceList.setElementAt(vProvenance, index);
+ } //-- void setProvenance(int, org.vamsas.objects.core.Provenance)
+
+ /**
+ * Method setProvenance
+ *
+ *
*
- * @param provenance the value of field 'provenance'.
+ * @param provenanceArray
*/
- public void setProvenance(org.vamsas.objects.core.Provenance provenance)
+ public void setProvenance(org.vamsas.objects.core.Provenance[] provenanceArray)
{
- this._provenance = provenance;
+ //-- copy array
+ _provenanceList.removeAllElements();
+ for (int i = 0; i < provenanceArray.length; i++) {
+ _provenanceList.addElement(provenanceArray[i]);
+ }
} //-- void setProvenance(org.vamsas.objects.core.Provenance)
/**
{ //-- 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);
+ //-- _provenanceList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.vamsas.objects.core.Provenance.class, "_provenanceList", "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
{
try {
SequenceSet target = (SequenceSet) object;
- target.setProvenance( (org.vamsas.objects.core.Provenance) value);
+ target.addProvenance( (org.vamsas.objects.core.Provenance) value);
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
desc.setHandler(handler);
desc.setNameSpaceURI("http://www.vamsas.org");
desc.setRequired(true);
- desc.setMultivalued(false);
+ desc.setMultivalued(true);
addFieldDescriptor(desc);
- //-- validation code for: _provenance
+ //-- validation code for: _provenanceList
fieldValidator = new org.exolab.castor.xml.FieldValidator();
fieldValidator.setMinOccurs(1);
{ //-- local scope
--- /dev/null
+/*
+ * 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.object
+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;
+
+ /**
+ * Field _VAMSASList
+ */
+ private java.util.Vector _VAMSASList;
+
+ /**
+ * Field _applicationData
+ */
+ private ApplicationData _applicationData;
+
+
+ //----------------/
+ //- Constructors -/
+ //----------------/
+
+ public VamsasDocument()
+ {
+ super();
+ _VAMSASList = new Vector();
+ } //-- org.vamsas.objects.core.VamsasDocument()
+
+
+ //-----------/
+ //- Methods -/
+ //-----------/
+
+ /**
+ * 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 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._applicationData != null) {
+ if (temp._applicationData == null) return false;
+ else if (!(this._applicationData.equals(temp._applicationData)))
+ return false;
+ }
+ else if (temp._applicationData != null)
+ return false;
+ return true;
+ }
+ return false;
+ } //-- boolean equals(java.lang.Object)
+
+ /**
+ * Returns the value of field 'applicationData'.
+ *
+ * @return ApplicationData
+ * @return the value of field 'applicationData'.
+ */
+ public ApplicationData getApplicationData()
+ {
+ return this._applicationData;
+ } //-- ApplicationData getApplicationData()
+
+ /**
+ * 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 removeAllVAMSAS
+ *
+ */
+ public void removeAllVAMSAS()
+ {
+ _VAMSASList.removeAllElements();
+ } //-- void removeAllVAMSAS()
+
+ /**
+ * 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)
+
+ /**
+ * Sets the value of field 'applicationData'.
+ *
+ * @param applicationData the value of field 'applicationData'.
+ */
+ public void setApplicationData(ApplicationData applicationData)
+ {
+ this._applicationData = applicationData;
+ } //-- void setApplicationData(ApplicationData)
+
+ /**
+ * 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()
+
+}
--- /dev/null
+/*
+ * 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);
+ //-- _applicationData
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(ApplicationData.class, "_applicationData", "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.setApplicationData( (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(false);
+ addFieldDescriptor(desc);
+
+ //-- validation code for: _applicationData
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { //-- 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()
+
+}