[MOBY-guts] biomoby commit
senger@ebi.ac.uk
senger at pub.open-bio.org
Thu Feb 27 16:28:29 UTC 2003
senger
Thu Feb 27 11:28:29 EST 2003
Update of /home/repository/moby/moby-live/Java/Clients
In directory pub.open-bio.org:/tmp/cvs-serv3865/Clients
Modified Files:
Makefile TestingCentral.java
Added Files:
CDATATest.java Test.java
Removed Files:
ClientUtils.class ClientUtils.java MobyCentralDeser.class
MobyCentralDeser.java MobyCentralDeserFactory.class
MobyCentralDeserFactory.java MobyCentralSer.class
MobyCentralSer.java MobyCentralSerFactory.class
MobyCentralSerFactory.java TestingCentral.class
Log Message:
moby-live/Java/Clients CDATATest.java,NONE,1.1 Test.java,NONE,1.1 Makefile,1.1,1.2 TestingCentral.java,1.1,1.2 ClientUtils.class,1.1,NONE ClientUtils.java,1.1,NONE MobyCentralDeser.class,1.1,NONE MobyCentralDeser.java,1.1,NONE MobyCentralDeserFactory.class,1.1,NONE MobyCentralDeserFactory.java,1.1,NONE MobyCentralSer.class,1.1,NONE MobyCentralSer.java,1.1,NONE MobyCentralSerFactory.class,1.1,NONE MobyCentralSerFactory.java,1.1,NONE TestingCentral.class,1.1,NONE
===================================================================
RCS file: /home/repository/moby/moby-live/Java/Clients/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/Clients/Makefile 2002/12/02 19:38:14 1.1
+++ /home/repository/moby/moby-live/Java/Clients/Makefile 2003/02/27 16:28:29 1.2
@@ -4,11 +4,9 @@
#
# -----------------------------------------------------------------------------
-# ADD NAMES OF SOURCE FILES HERE
-SOURCE += MobyCentralDeser MobyCentralDeserFactory
-SOURCE += MobyCentralSer MobyCentralSerFactory
-SOURCE += ClientUtils
SOURCE += TestingCentral
+SOURCE += Test
+##SOURCE += CDATATest
# -----------------------------------------------------------------------------
===================================================================
RCS file: /home/repository/moby/moby-live/Java/Clients/TestingCentral.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/Clients/TestingCentral.java 2002/12/02 19:38:15 1.1
+++ /home/repository/moby/moby-live/Java/Clients/TestingCentral.java 2003/02/27 16:28:29 1.2
@@ -63,13 +63,6 @@
engine.setOption (AxisEngine.PROP_DOMULTIREFS, new Boolean (false));
call = (Call) service.createCall();
call.setTargetEndpointAddress (target);
-
- QName centralQName = new QName ("http://namespaces.soaplite.com/perl", "MOBY__Central");
- call.registerTypeMapping (MobyCentral.class,
- centralQName,
- MobyCentralSerFactory.class,
- MobyCentralDeserFactory.class);
-
return call.invoke (uri, method, parameters);
} catch (AxisFault e) {
@@ -85,31 +78,153 @@
}
/*************************************************************************
- * Call the 'new' method of the Moby Central returning a Moby
- * Central object (used in other calls).
+ * Extract 'id' from an XML... (as paintlessly as possible :-) ).
+ * Return an empty string if no 'id' found.
*************************************************************************/
- protected MobyCentral getMobyCentral() {
- Call call = null;
- try {
- call = (Call) new Service().createCall();
- call.setTargetEndpointAddress (target);
+ protected String extractId (String xml) {
+ String id = "";
+ int pos = xml.indexOf ("<id>");
+ if (pos > -1) {
+ int pos2 = xml.indexOf ("</id>");
+ if (pos2 > pos)
+ id = xml.substring (pos + 4, pos2);
+ }
+ return id;
+ }
- QName centralQName = new QName ("http://namespaces.soaplite.com/perl", "MOBY__Central");
- call.registerTypeMapping (MobyCentral.class,
- centralQName,
- MobyCentralSerFactory.class,
- MobyCentralDeserFactory.class);
+ /*************************************************************************
+ * Register service type; return resulting xml
+ *************************************************************************/
+ protected String registerServiceType (String serviceTypeName) {
+ //
+ System.out.println ("METHOD: registerServiceType '" + serviceTypeName + "\'");
+ String result =
+ (String)doCall ("registerServiceType",
+ new Object[] {
+ "<registerServiceType>" +
+ "<serviceType>" + serviceTypeName + "</serviceType>" +
+ "<Description>" +
+ "<![CDATA[ This is ONLY A TESTING service type. ]]>" +
+ "</Description>" +
+ "<ISA>" +
+ "<serviceType>Service</serviceType>" +
+ "</ISA>" +
+ "</registerServiceType>"
+ });
+ System.out.println ("----------------------------\n" + result);
+ return result;
+ }
- return (MobyCentral)call.invoke (uri, "new", new Object[] { new Hashtable() });
+ /*************************************************************************
+ * Deregister service type; return resulting xml
+ *************************************************************************/
+ protected String deregisterServiceType (String serviceTypeId) {
+ System.out.println ("METHOD: deregisterServiceType \"" + serviceTypeId + "\"");
+ String result =
+ (String)doCall ("deregisterServiceType",
+ new Object[] {
+ "<deregisterServiceType>" +
+ "<serviceTypeAcc>" + serviceTypeId + "</serviceTypeAcc>" +
+ "</deregisterServiceType>"
+ });
+ System.out.println ("---------------------------\n" + result);
+ return result;
+ }
- } catch (AxisFault e) {
- ClientUtils.formatFault (e, System.err);
- System.exit (1);
- } catch (Exception e) {
- System.err.println (e.toString());
- System.exit (1);
- }
- return null;
+ /*************************************************************************
+ * Register namespace; return resulting xml
+ *************************************************************************/
+ protected String registerNamespace (String namespaceName) {
+ System.out.println ("METHOD: registerNamespace \"" + namespaceName + "\"");
+ String result =
+ (String)doCall ("registerNamespace",
+ new Object[] {
+ "<registerNamespace>" +
+ "<namespaceType>" + namespaceName + "</namespaceType>" +
+ "<authURI>org.embl.ebi.senger</authURI>" +
+ "<Description>" +
+ "<![CDATA[ This is ONLY A TESTING namespace. ]]>" +
+ "</Description>" +
+ "<Clobber>0</Clobber>" +
+ "</registerNamespace>"
+ });
+ System.out.println ("----------------------------\n" + result);
+ return result;
+ }
+
+ /*************************************************************************
+ * Deregister namespace; return resulting xml
+ *************************************************************************/
+ protected String deregisterNamespace (String namespaceId) {
+ System.out.println ("METHOD: deregisterNamespace \"" + namespaceId + "\"");
+ String result =
+ (String)doCall ("deregisterNamespace",
+ new Object[] {
+ "<deregisterNamespace>" +
+ "<namespaceAcc>" + namespaceId + "</namespaceAcc>" +
+ "</deregisterNamespace>"
+ });
+ System.out.println ("---------------------------\n" + result);
+ return result;
+ }
+
+ /*************************************************************************
+ * Register object; return resulting xml
+ *************************************************************************/
+ protected String registerObject (String objectType, String xsd) {
+ System.out.println ("METHOD: registerObject \"" + objectType + "\"");
+ String result =
+ (String)doCall ("registerObject",
+ new Object[] {
+ "<registerObject>" +
+ "<objectType>" + objectType + "</objectType>" +
+ "<Description><![CDATA[" +
+ "This is a biologically completely useless object." +
+ "Its only purpose is to test MOBY central method calls." +
+ "]]>" +
+ "</Description>" +
+ "<ISA>" +
+ "<objectType>Object</objectType>" +
+ "</ISA>" +
+ "<authURI>org.embl.ebi.senger</authURI>" +
+ "<Clobber>2</Clobber>" +
+ "<xsd>" + xsd + "</xsd>" +
+ "</registerObject>"
+ });
+ System.out.println ("----------------------------\n" + result);
+ return result;
+ }
+
+ /*************************************************************************
+ * Deregister object; return resulting xml
+ *************************************************************************/
+ protected String deregisterObject (String objectId) {
+ System.out.println ("METHOD: deregisterObject \"" + objectId + "\"");
+ String result =
+ (String)doCall ("deregisterObject",
+ new Object[] {
+ "<deregisterObject>" +
+ "<objectAcc>" + objectId + "</objectAcc>" +
+ "</deregisterObject>"
+ });
+ System.out.println ("---------------------------\n" + result);
+ return result;
+ }
+
+ /*************************************************************************
+ * Retrieve object; return resulting xml
+ *************************************************************************/
+ protected String retrieveObject (String objectType) {
+ System.out.println ("METHOD: retrieveObject '" + objectType + "'");
+ String result =
+ (String)doCall ("retrieveObject",
+ new Object[] {
+ "<retrieveObject>" +
+ "<objectType>" + objectType + "</objectType>" +
+ "</retrieveObject>"
+ });
+ System.out.println ("---------------------------\n" + result);
+ return result;
}
/*************************************************************************
@@ -125,6 +240,17 @@
// String endpoint = "http://198.166.4.151/cgi-bin/MOBY-Central.pl";
String uri = "http://mobycentral.cbr.nrc.ca/MOBY/Central";
+ boolean testLists = true;
+ boolean testListServiceNames = true;
+ boolean testListServiceTypes = true;
+ boolean testListProviders = true;
+ boolean testListNamespaces = true;
+ boolean testListObjects = true;
+ boolean testObject = true;
+ boolean testServiceType = true;
+ boolean testNamespace = true;
+ boolean testService = true;
+
// command-line parameters
int i = 0;
while (i < args.length) {
@@ -143,98 +269,236 @@
i += 2;
continue;
}
+ if (args[i].equals ("-na")) {
+ testObject = false;
+ testLists = false;
+ testServiceType = false;
+ testNamespace = false;
+ testService = false;
+ testListServiceNames = testListServiceTypes = testListProviders =
+ testListNamespaces = testListObjects = false;
+ }
+ if (args[i].equals ("-o")) testObject = true;
+ if (args[i].equals ("-no")) testObject = false;
+ if (args[i].equals ("-t")) testServiceType = true;
+ if (args[i].equals ("-nt")) testServiceType = false;
+ if (args[i].equals ("-m")) testNamespace = true;
+ if (args[i].equals ("-ms")) testNamespace = false;
+ if (args[i].equals ("-s")) testService = true;
+ if (args[i].equals ("-ns")) testService = false;
+
+ if (args[i].equals ("-l")) testLists = true;
+ if (args[i].equals ("-nl")) testLists = false;
+ if (args[i].equals ("-ls")) testListServiceNames = true;
+ if (args[i].equals ("-lt")) testListServiceTypes = true;
+ if (args[i].equals ("-lp")) testListProviders = true;
+ if (args[i].equals ("-ln")) testListNamespaces = true;
+ if (args[i].equals ("-lo")) testListObjects = true;
+
i++;
}
// create service proxy...
TestingCentral client = new TestingCentral (endpoint, uri);
- // ...retrieve a Moby Central object
- MobyCentral moby = client.getMobyCentral();
-
- // ...and call (all) other methods
+ // ...and call other methods:
String result;
- //
- System.out.println ("METHOD: retrieveServiceNames");
- result = (String)client.doCall ("retrieveServiceNames",
- new Object[] { moby });
- System.out.println ("----------------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveServiceProviders");
- result = (String)client.doCall ("retrieveServiceProviders",
- new Object[] { moby });
- System.out.println ("--------------------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveServiceTypes");
- result = (String)client.doCall ("retrieveServiceTypes",
- new Object[] { moby });
- System.out.println ("----------------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveNamespaces");
- result = (String)client.doCall ("retrieveNamespaces",
- new Object[] { moby });
- System.out.println ("--------------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveObjectNames");
- result = (String)client.doCall ("retrieveObjectNames",
- new Object[] { moby });
- System.out.println ("---------------------------\n" + result);
-
- //
- System.out.println ("METHOD: locateServiceByType");
- result = (String)client.doCall ("locateServiceByType",
- new Object[] { moby,
- "Blast",
- new Integer (100),
- new Integer (0)
- });
- System.out.println ("---------------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveService");
- result = (String)client.doCall ("retrieveService",
- new Object[] { moby, "bioinfo.pbi.nrc.ca", "MarksTestSequenceRetrieve" });
- System.out.println ("-----------------------\n" + result);
-
- //
- System.out.println ("METHOD: retrieveObject");
- result = (String)client.doCall ("retrieveObject",
- new Object[] { moby, "GO_Term" });
- System.out.println ("--------------------------\n" + result);
-
- //
- System.out.println ("METHOD: locateServiceByInput");
- result = (String)client.doCall ("locateServiceByInput",
- new Object[] { moby,
- new String[] { "Object", "MAGE-ML" }, // input types
- new String[] {}, // namespaces
- "Retrieve", // service type
- "bioinfo.pbi.nrc.ca", // authority
- new Integer (2), // max return
- new Integer (1), // full objects
- new Integer (0) // full services
- });
- System.out.println ("--------------------------------\n" + result);
-
- //
- System.out.println ("METHOD: locateServiceByOutput");
- result = (String)client.doCall ("locateServiceByOutput",
- new Object[] { moby,
- "Sequence", // output type
- new String[] {}, // namespaces
- "Retrieve", // service type
- "bioinfo.pbi.nrc.ca", // authority
- new Integer (2), // max return
- new Integer (1), // full objects
- new Integer (0) // full services
- });
- System.out.println ("---------------------------------\n" + result);
+ if (testObject) {
+ String objectType = "TestingObjectType";
+ result = client.registerObject (objectType, "<blank/>");
+ String objectId = client.extractId (result);
+ client.retrieveObject (objectType);
+ client.deregisterObject (objectId);
+ client.retrieveObject (objectType); // not-existing
+ }
+ if (testLists || testListServiceNames) {
+ System.out.println ("METHOD: retrieveServiceNames");
+ result = (String)client.doCall ("retrieveServiceNames",
+ new Object[] {});
+ System.out.println ("----------------------------\n" + result);
+ }
+ if (testLists || testListProviders) {
+ System.out.println ("METHOD: retrieveServiceProviders");
+ result = (String)client.doCall ("retrieveServiceProviders",
+ new Object[] {});
+ System.out.println ("--------------------------------\n" + result);
+ }
+
+ if (testLists || testListServiceTypes) {
+ System.out.println ("METHOD: retrieveServiceTypes");
+ result = (String)client.doCall ("retrieveServiceTypes",
+ new Object[] {});
+ System.out.println ("----------------------------\n" + result);
+ }
+
+ if (testLists || testListNamespaces) {
+ System.out.println ("METHOD: retrieveNamespaces");
+ result = (String)client.doCall ("retrieveNamespaces",
+ new Object[] {});
+ System.out.println ("--------------------------\n" + result);
+ }
+
+ if (testLists || testListObjects) {
+ System.out.println ("METHOD: retrieveObjectNames");
+ result = (String)client.doCall ("retrieveObjectNames",
+ new Object[] {});
+ System.out.println ("---------------------------\n" + result);
+ }
+
+ if (testServiceType) {
+ String uniqueName = "TestingServiceType_" + new Date().getTime();
+ result = client.registerServiceType (uniqueName);
+ String serviceTypeId = client.extractId (result);
+ result = client.deregisterServiceType (serviceTypeId);
+ }
+
+ if (testNamespace) {
+ String uniqueName = "TestingNamespace_" + new Date().getTime();
+ result = client.registerNamespace (uniqueName);
+ String namespaceId = client.extractId (result);
+ result = client.deregisterNamespace (namespaceId);
+ }
+
+ if (testService) {
+ String serviceName = "TestingService_" + new Date().getTime();
+ String serviceType = "TestingServiceType_" + new Date().getTime();
+ String objectType1 = "TestingObjectType1_" + new Date().getTime();
+ String namespace1 = "TestingNamespace1_" + new Date().getTime();
+ String objectType2 = "TestingObjectType2_" + new Date().getTime();
+ String namespace2 = "TestingNamespace2_" + new Date().getTime();
+ String objectType3 = "TestingObjectType3_" + new Date().getTime();
+ String objectType4 = "TestingObjectType4_" + new Date().getTime();
+ String authURI = "org.embl.ebi.senger";
+
+ result = client.registerServiceType (serviceType);
+ String serviceTypeId = client.extractId (result);
+ result = client.registerNamespace (namespace1);
+ String namespaceId1 = client.extractId (result);
+ result = client.registerNamespace (namespace2);
+ String namespaceId2 = client.extractId (result);
+ result = client.registerObject (objectType1, "<blank/>");
+ String objectId1 = client.extractId (result);
+ result = client.registerObject (objectType2, "<blank/>");
+ String objectId2 = client.extractId (result);
+ result = client.registerObject (objectType3, "<blank/>");
+ String objectId3 = client.extractId (result);
+ result = client.registerObject (objectType4, "<blank/>");
+ String objectId4 = client.extractId (result);
+
+ // 1. register a service
+ System.out.println ("METHOD: registerService '" + serviceName + "'");
+ result = (String)client.doCall ("registerService",
+ new Object[] {
+ "<registerService>" +
+ "<Category>moby</Category>" +
+ "<serviceName>" + serviceName + "</serviceName>" +
+ "<serviceType>" + serviceType + "</serviceType>" +
+ "<authURI>" + authURI + "</authURI>" +
+ "<inputObjects>" +
+ "<Input>" +
+ "<objectType>" + objectType1 + "</objectType>" +
+ "<namespaceType>" + namespace1 + "</namespaceType>" +
+ "</Input>" +
+ "<Input>" +
+ "<objectType>" + objectType2 + "</objectType>" +
+ "<namespaceType>" + namespace2 + "</namespaceType>" +
+ "</Input>" +
+ "</inputObjects>" +
+ "<outputObjects>" +
+ "<objectType>" + objectType3 + "</objectType>" +
+ "<objectType>" + objectType4 + "</objectType>" +
+ "</outputObjects>" +
+ "<URL>http://not.existing.server/not.existing.service</URL>" +
+ "<Description><![CDATA[" +
+ "This is ONLY A TESTING service." +
+ "]]>" +
+ "</Description>" +
+ "</registerService>"
+ });
+ System.out.println ("----------------------------\n" + result);
+
+ // 2. locate service byte service type
+ System.out.println ("METHOD: locateServiceByType '" + serviceType + "'");
+ result = (String)client.doCall ("locateServiceByType",
+ new Object[] {
+ "<locateServiceByType>" +
+ "<serviceType>" + serviceType + "</serviceType>" +
+ "<fullServices>1</fullServices>" +
+ "</locateServiceByType>"
+ });
+ System.out.println ("---------------------------\n" + result);
+
+ // 3. locate service by input type
+ System.out.println ("METHOD: locateServiceByInput");
+ result = (String)client.doCall ("locateServiceByInput",
+ new Object[] {
+ "<locateServiceByInput>" +
+ "<inputObjects>" +
+ "<Input>" +
+ "<objectType>" + objectType1 + "</objectType>" +
+ "<namespaceType>" + namespace1 + "</namespaceType>" +
+ "</Input>" +
+ "<Input>" +
+ "<objectType>" + objectType2 + "</objectType>" +
+ "<namespaceType>" + namespace2 + "</namespaceType>" +
+ "</Input>" +
+ "</inputObjects>" +
+ "<serviceType>" + serviceType + "</serviceType>" +
+ "<authURI>" + authURI + "</authURI>" +
+ "<fullObjects>1</fullObjects>" +
+ "<fullServices>1</fullServices>" +
+ "</locateServiceByInput>"
+ });
+ System.out.println ("--------------------------------\n" + result);
+
+ // 4. locate service by output type
+ System.out.println ("METHOD: locateServiceByOutput");
+ result = (String)client.doCall ("locateServiceByOutput",
+ new Object[] {
+ "<locateServiceByOutput>" +
+ "<objectType>" + objectType4 + "</objectType>" +
+ "<serviceType>" + serviceType + "</serviceType>" +
+ "<authURI>" + authURI + "</authURI>" +
+ "<fullObjects>1</fullObjects>" +
+ "<fullServices>1</fullServices>" +
+ "</locateServiceByOutput>"
+ });
+ System.out.println ("---------------------------------\n" + result);
+
+ // 5. retrieve service (by service name)
+ System.out.println ("METHOD: retrieveService");
+ result = (String)client.doCall ("retrieveService",
+ new Object[] {
+ "<retrieveService>" +
+ "<authURI>" + authURI + "</authURI>" +
+ "<serviceName>" + serviceName + "</serviceName>" +
+ "</retrieveService>"
+ });
+ System.out.println ("-----------------------\n" + result);
+
+ // 6. deregister service
+// System.out.println ("METHOD: deregisterService \"" + serviceTypeId + "\"");
+// result = (String)client.doCall ("deregisterService",
+// new Object[] {
+// "<deregisterService>" +
+// "<serviceID>" + serviceId + "</serviceID>" +
+// "</deregisterService>"
+
+// });
+// System.out.println ("---------------------------\n" + result);
+
+ //
+ result = client.deregisterServiceType (serviceTypeId);
+ result = client.deregisterNamespace (namespaceId1);
+ result = client.deregisterNamespace (namespaceId2);
+ result = client.deregisterNamespace (objectId1);
+ result = client.deregisterNamespace (objectId2);
+ result = client.deregisterNamespace (objectId3);
+ result = client.deregisterNamespace (objectId4);
+
+ }
} catch (Exception e) {
System.err.println ("===ERROR===");
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/ClientUtils.class,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/ClientUtils.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralDeser.class,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralDeser.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralDeserFactory.class,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralDeserFactory.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralSer.class,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralSer.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralSerFactory.class,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/MobyCentralSerFactory.java,v: No such file or directory
rcsdiff: /home/repository/moby/moby-live/Java/Clients/RCS/TestingCentral.class,v: No such file or directory
More information about the MOBY-guts
mailing list