[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Dec 6 16:07:10 UTC 2006


gordonp
Wed Dec  6 11:07:10 EST 2006
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv24370/src/main/org/biomoby/shared/data

Modified Files:
	MobyContentInstance.java 
Log Message:
Major commit to allow automated construction of MobyServlet.war, and revised cvode for Java annotation-based service meta-data specification
moby-live/Java/src/main/org/biomoby/shared/data MobyContentInstance.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java	2006/10/26 01:32:06	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyContentInstance.java	2006/12/06 16:07:10	1.7
@@ -32,7 +32,7 @@
     private int xmlMode = MobyDataInstance.SERVICE_XML_MODE;
     private HashMap<String, MobyDataJob> members;
     private int autoID = 1;  // to name members without existing names
-    private Vector exceptions;
+    private Vector<ServiceException> exceptions;
 
     /**
      * Creates a blank MOBY envelope, to be filled in programatically with data instances.
@@ -40,7 +40,7 @@
      */
     public MobyContentInstance(){
 	members = new HashMap<String, MobyDataJob>();
-	exceptions = new Vector();
+	exceptions = new Vector<ServiceException>();
     }
 
     /**
@@ -342,12 +342,42 @@
     }
 
     /**
-     * @return the list of exceptions assocaited with this content
+     * @return the list of exceptions associated with this content
      */
     public ServiceException[] getExceptions(){
 	return (ServiceException[]) exceptions.toArray(new ServiceException[exceptions.size()]);
     }
 
+    /**
+     * Indicates whether the moby content has any exception (according to the style of MOBY-S RFC 1863)
+     * 
+     * @return true if there are exceptions (any severity) in the content
+     */
+    public boolean hasExceptions(){
+	return exceptions != null && exceptions.size() > 0;
+    }
+
+    /**
+     * Indicates whether the moby content has any exception of the given severity or worse 
+     * (according to the style of MOBY-S RFC 1863).
+     *
+     * @param severity the minimum severity of exception (info < warning < error) to report
+     *
+     * @return true if there are exceptions (of the specified severity or greater) in the content
+     */
+    public boolean hasExceptions(int severity){
+	if(exceptions == null || exceptions.size() == 0){
+	    return false;
+	}
+
+	for(ServiceException se: exceptions){
+	    if(se.getSeverity() <= severity){
+		return true;
+	    }
+	}
+	return false;
+    }
+
     public void setXmlMode(int mode) throws IllegalArgumentException{
         if(mode != MobyDataInstance.CENTRAL_XML_MODE && mode != MobyDataInstance.SERVICE_XML_MODE){
 	    throw new IllegalArgumentException("Value passed to setXmlMode was neither " +




More information about the MOBY-guts mailing list