[MOBY-guts] biomoby commit
Paul Gordon
gordonp at pub.open-bio.org
Thu May 12 05:13:37 UTC 2005
gordonp
Thu May 12 01:13:37 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory pub.open-bio.org:/tmp/cvs-serv26242
Modified Files:
MobyRequest.java
Log Message:
Updates to deal with new data instance package
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.10,1.11
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2005/04/18 17:29:43 1.10
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2005/05/12 05:13:37 1.11
@@ -23,10 +23,10 @@
import org.apache.xpath.objects.XObject;
import org.biomoby.shared.Central;
import org.biomoby.shared.MobyData;
-import org.biomoby.shared.MobyDataInstance;
-import org.biomoby.shared.MobyDataSecondaryInstance;
-import org.biomoby.shared.MobyDataSetInstance;
-import org.biomoby.shared.MobyDataSimpleInstance;
+import org.biomoby.shared.data.MobyDataInstance;
+import org.biomoby.shared.data.MobyDataSecondaryInstance;
+import org.biomoby.shared.data.MobyDataObjectSet;
+import org.biomoby.shared.data.MobyDataObject;
import org.biomoby.shared.MobyException;
import org.biomoby.shared.MobyPrefixResolver;
import org.biomoby.shared.MobyService;
@@ -111,18 +111,24 @@
MobyPrefixResolver.XSI1999_PREFIX+
":type, ':'), \"base64\") or starts-with(substring-after(@"+
MobyPrefixResolver.XSI2001_PREFIX+
- ":type, ':'), \"base64\")]", null, mobyPrefixResolver, XPath.SELECT);
+ ":type, ':'), \"base64\")]", null,
+ mobyPrefixResolver, XPath.SELECT);
stringEncodedXPath = new XPath("//*[substring-after(@"+
MobyPrefixResolver.XSI1999_PREFIX+
":type, ':')=\"string\" or substring-after(@"+
MobyPrefixResolver.XSI2001_PREFIX+
- ":type, ':')=\"string\"]", null, mobyPrefixResolver, XPath.SELECT);
- queryResponseXPath = new XPath("//moby:mobyData | //mobyData", null, mobyPrefixResolver, XPath.SELECT);
- simpleChildXPath = new XPath("moby:Simple | Simple", null, mobyPrefixResolver, XPath.SELECT);
- collectionChildXPath = new XPath("moby:Collection | Collection", null, mobyPrefixResolver, XPath.SELECT);
+ ":type, ':')=\"string\"]", null,
+ mobyPrefixResolver, XPath.SELECT);
+ queryResponseXPath = new XPath("//moby:mobyData | //mobyData", null,
+ mobyPrefixResolver, XPath.SELECT);
+ simpleChildXPath = new XPath("moby:Simple | Simple", null,
+ mobyPrefixResolver, XPath.SELECT);
+ collectionChildXPath = new XPath("moby:Collection | Collection", null,
+ mobyPrefixResolver, XPath.SELECT);
}
catch(TransformerException te){
- debugPS.println("Syntax error encountered while compiling XPath statements for internal use (code bug?): " + te);
+ debugPS.println("Syntax error encountered while compiling XPath " +
+ "statements for internal use (code bug?): " + te);
}
}
@@ -194,7 +200,7 @@
}
/**
- * Convenience method to run services that take one argument.
+ * Convenience method to run services that take one unnamed argument.
*/
public void setInput(MobyDataInstance datum) throws IllegalArgumentException{
inputData = new MobyDataInstance[1];
@@ -586,17 +592,23 @@
data[i].setXmlMode(MobyDataInstance.SERVICE_XML_MODE);
}
- if(data[i] instanceof MobyDataSimpleInstance){
- mobyRequest += ((MobyDataSimpleInstance) data[i]).toXML();
+ if(data[i] instanceof MobyDataObject){
+ // This line should be replaced with a named field
+ mobyRequest += "<Simple articleName=''>"+
+ ((MobyDataObject) data[i]).toXML()+
+ "</Simple>";
}
- else if(data[i] instanceof MobyDataSetInstance){
- mobyRequest += ((MobyDataSetInstance) data[i]).toXML();
+ else if(data[i] instanceof MobyDataObjectSet){
+ mobyRequest += ((MobyDataObjectSet) data[i]).toXML();
}
else{
+ // Could just call toXML, but don't know if it has a Simple wrapper
+ // already or not, or even if it's a set.
throw new MobyException("Element #" + i +
" of the input data was not a " +
- "MobyDataSimpleInstance or a " +
- "MobyDataSetInstance (found " + data[i] + ")");
+ "MobyDataObject or a " +
+ "MobyDataObjectSet (found " +
+ data[i].getClass().getName() + ")");
}
// Restore the old XML mode setting if not service mode
@@ -667,7 +679,7 @@
if(debug & j == 0)
debugPS.println("There are " + collections.getLength() +
" collections in response #" +i);
- MobyDataSetInstance collection = new MobyDataSetInstance("");
+ MobyDataObjectSet collection = new MobyDataObjectSet("");
// For each collection, find the simple children
NodeList subsimples = null;
@@ -679,13 +691,13 @@
}
// And add their values to the collection
- MobyDataSimpleInstance[] subout = new MobyDataSimpleInstance[subsimples.getLength()];
+ MobyDataObject[] subout = new MobyDataObject[subsimples.getLength()];
for(int k = 0; k < subsimples.getLength(); k++){
if(debug && k == 0)
debugPS.println("There are " + subsimples.getLength() +
" simples in response #" + i +
", collection #" + j);
- subout[k] = new MobyDataSimpleInstance(mobyCentral, (Element) subsimples.item(k));
+ subout[k] = (MobyDataObject) MobyDataObject.createInstanceFromDOM((Element) subsimples.item(k));
}
collection.setElements(subout);
releaseXPath(collections.item(j));
@@ -708,7 +720,7 @@
for(int j = 0; simples != null && j < simples.getLength(); j++){
if(debug && j == 0)
debugPS.println("There are " + simples.getLength() + " simples in response #" +i);
- out.add(new MobyDataSimpleInstance(mobyCentral, (Element) simples.item(j)));
+ out.add(MobyDataObject.createInstanceFromDOM((Element) simples.item(j)));
}
// What we're building is a Vector, where each element represents
More information about the MOBY-guts
mailing list