[Seek-dev] updated ecogrid query client
Bing Zhu
bzhu at sdsc.edu
Wed Mar 23 17:07:19 PST 2005
Jing,
The Ecogrid query client was modified so that it can talk to both
factory Ecogrid service or a non-factory Ecogrid service (our previous
approach) for backward compatibility.
The default mode is for a factory Ecogrid query service.
$ java EcogridQueryClient query query_doc_file $GSH
To talk to a non-factory Ecogrid service, a Java property is used for
Ecogrid client switching to non-factory mode. i.e.
$ java -DFACTORY=no EcogridQueryClient query query_doc_file $GSH
Bing
-----Original Message-----
From: seek-cvs-admin at ecoinformatics.org
[mailto:seek-cvs-admin at ecoinformatics.org]On Behalf Of Bing Zhu
Sent: Wednesday, March 23, 2005 4:29 PM
To: seek-cvs at ecoinformatics.org
Subject: [seek-cvs]
seek/projects/ecogrid/src/org/ecoinformatics/ecogrid/client
EcogridQueryClient.java
zhu 05/03/23 16:29:13
Modified: projects/ecogrid/src/org/ecoinformatics/ecogrid/client
EcogridQueryClient.java
Log:
The client is modified for both a fcatory ecogrid query service and a
non-factory ecogrid query service.
Revision Changes Path
1.27 +49 -12
seek/projects/ecogrid/src/org/ecoinformatics/ecogrid/client/EcogridQueryClie
nt.java
Index: EcogridQueryClient.java
===================================================================
RCS file:
/cvs/seek/projects/ecogrid/src/org/ecoinformatics/ecogrid/client/EcogridQuer
yClient.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- EcogridQueryClient.java 3 Dec 2004 02:38:46 -0000 1.26
+++ EcogridQueryClient.java 24 Mar 2005 00:29:13 -0000 1.27
@@ -8,8 +8,8 @@
* Release: @release@
*
* '$Author: zhu $'
- * '$Date: 2004/12/03 02:38:46 $'
- * '$Revision: 1.26 $'
+ * '$Date: 2005/03/24 00:29:13 $'
+ * '$Revision: 1.27 $'
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ * Modified on March 17, 2005.
+ * -- users can have a choice to run a client for a factorized service
or
+ * a non-factorized service. The defaul is for a factorized
service.
+ * To run a client for a non-facctory service, use -DFACTORY=no
+ * e.g.
+ * $ java -DFACTORY=no EcogridQueryClient ...
*/
//package org.ecoinformatics.ecogrid.client;
@@ -80,17 +86,20 @@
{
private URL serviceURL = null;;
private EcoGridQueryInterfaceLevelOnePortType ecogrid = null;
+ private boolean fcatory_service = true; // default is a factory
service.
public static void main(String[] args)
{
if(args.length < 1)
{
- System.out.println("Usage: java
org.ecoinformatics.ecogrid.client.EcogridQueryClient query local_filename
GSH");
- System.out.println("Usage: java
org.ecoinformatics.ecogrid.client.EcogridQueryClient get ecogri_filename
local_filename GSH");
+ System.out.println("Usage: java [-DFACTORY=no] EcogridQueryClient
query local_filename GSH");
+ System.out.println("Usage: java [-DFACTORY=no] EcogridQueryClient
get ecogri_filename local_filename GSH");
System.exit(0);
}
String myOperation = args[0];
+ EcogridQueryClient client = new EcogridQueryClient();
+ client.checkEnvs(); // check if there is env to define a
factory or non-factory service
try
{
@@ -107,7 +116,7 @@
}
GSH = new URL(args[2]);
- EcogridQueryClient client = new EcogridQueryClient(GSH);
+ client.setGSH(GSH);
client.createEcoGridQueryLevelOnePortType();
localFileName = args[1];
@@ -128,7 +137,7 @@
}
GSH = new URL(args[3]);
- EcogridQueryClient client = new EcogridQueryClient(GSH);
+ client.setGSH(GSH);
client.createEcoGridQueryLevelOnePortType();
localFileName = args[2];
@@ -150,6 +159,7 @@
catch (Exception e)
{
System.out.println("Exception in main : "+ e.getMessage());
+ e.printStackTrace();
}
}//main
@@ -158,11 +168,23 @@
* client constructor
* @param serviceURL the url of service
*/
- public EcogridQueryClient(URL serviceURL)
+ void setGSH(URL gsh)
{
- this.serviceURL = serviceURL;
+ this.serviceURL = gsh;
}//EcogridQueryClient
+ void checkEnvs()
+ {
+ String str = System.getProperty("FACTORY");
+ if(str == null)
+ return;
+
+ if(str.compareToIgnoreCase("no") == 0)
+ {
+ fcatory_service = false;
+ }
+ }
+
/**
* Method to create in service instance
*/
@@ -172,7 +194,7 @@
Factory factory = factoryService.getFactoryPort(serviceURL);
GridServiceFactory gridFactory = new GridServiceFactory(factory);
LocatorType locator = gridFactory.createService();
- System.out.println("Created an instance of metacat ecogrid");
+ // System.out.println("Created an instance of metacat ecogrid");
return locator;
}//createServiceInstance
@@ -210,6 +232,7 @@
String tcpMonURL)
throws Exception
{
+/*
String handle = getHandlerString(locator);
System.out.println("Handler for this instance is " + handle);
String hash = getHashFromHandle(handle);
@@ -222,6 +245,7 @@
org.apache.axis.client.Stub stub =
(org.apache.axis.client.Stub)ecogrid;
stub.setTimeout(1000000);
+*/
}//createEcoGridQueryPortLeveType
/**
@@ -229,11 +253,24 @@
*/
public void createEcoGridQueryLevelOnePortType() throws Exception
{
+ if(fcatory_service)
+ {
+ LocatorType locator = createServiceInstance();
- EcoGridQueryLevelOneServiceGridLocator loc =
+ EcoGridQueryLevelOneServiceGridLocator queryLocator =
+ new
EcoGridQueryLevelOneServiceGridLocator();
+ ecogrid
=queryLocator.getEcoGridQueryLevelOneServicePort(locator);
+ }
+ else // a non-fcatory service. no need to create an instance.
+ {
+ EcoGridQueryLevelOneServiceGridLocator loc =
new
EcoGridQueryLevelOneServiceGridLocator();
- ecogrid =loc.getEcoGridQueryLevelOneServicePort(serviceURL);
+ ecogrid =loc.getEcoGridQueryLevelOneServicePort(serviceURL);
+ }
+
org.apache.axis.client.Stub stub =
(org.apache.axis.client.Stub)ecogrid;
+ stub.setTimeout(10000000);
+
}//createEcoGridQuery
_______________________________________________
seek-cvs mailing list
seek-cvs at ecoinformatics.org
http://www.ecoinformatics.org/mailman/listinfo/seek-cvs
More information about the Seek-dev
mailing list