comparison WebServiceToolWorkflow/WADLRESTclient2.py~ @ 0:d5cd409b8a18 default tip

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author ganjoo
date Tue, 07 Jun 2011 18:00:50 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d5cd409b8a18
1 import warnings
2 import platform
3
4 with warnings.catch_warnings():
5 warnings.simplefilter("ignore")
6 from jpype._jpackage import JPackage
7 from jpype import *
8 import os.path
9 import sys
10
11
12
13 javahome = os.environ.get('JAVA_HOME')
14 galaxyhome=os.environ.get('GALAXY_HOME')
15 classpath= galaxyhome + '/tools/restclientWADL/ParserForWADL/bin'
16 jarpath = galaxyhome + '/tools/restclientWADL/WADLParser/dist/lib/'
17 machine = platform.machine()
18
19 if machine == 'x86_64' :
20 print 'a'
21 startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
22 elif machine == 'i686' :
23 print 'b'
24 startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
25 elif machine == 'sun4u' :
26 startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
27 else :
28 print 'c'
29 System.exit("Could not identify machine, please specify path to libjvm.so")
30
31
32
33 pkg=JPackage('lsdis')
34 urlToPass=java.net.URL(sys.argv[2])
35 wadlUrl = sys.argv[2]
36
37 outputfileParamNames=open(sys.argv[5],'w')
38 outputfileParamNames.seek(0,0)
39 # outputfileParamTypes=open(sys.argv[6],'w')
40 # outputfileParamTypes.seek(0,0)
41
42 webserviceId = sys.argv[3]
43 resUrl = sys.argv[4]
44
45 urls = []
46 methods = []
47
48 WADLParserDriver=pkg.WADLParserDriver
49 wPD=WADLParserDriver()
50 wPD.parse(urlToPass)
51 urls = wPD.getUrl()
52 methods = wPD.getCompleteMethodList()
53
54 i=0
55 for method in methods:
56 x = str(method.getId())
57 y = str(urls.get(0))
58 if x == webserviceId :
59 if y == resUrl :
60 for param in method.getRequest().getParams():
61 if param.isRequired():
62 val = 'true'
63 else :
64 val = 'false'
65 outputfileParamNames.write(str(param.getName())+"\t" + str(param.getType())+"\t" + str(param.getDefault1()) + "\t" + val +"\t"+resUrl+"\n")
66 # outputfileParamTypes.write(str(param.getType())+"\n")
67 break
68 i=i+1