1 |
stehr |
24 |
import org.apache.xmlrpc.*; |
2 |
|
|
import java.net.*; |
3 |
|
|
import java.util.*; |
4 |
|
|
import java.io.*; |
5 |
|
|
|
6 |
|
|
/** |
7 |
|
|
* Package: tools |
8 |
|
|
* Class: testPymolServer |
9 |
|
|
* Author: Henning Stehr, stehr@molgen.mpg.de |
10 |
|
|
* Date: 2/Feb/2006 |
11 |
|
|
* |
12 |
|
|
* Simple test class for XML-RPC calls to a remote PyMol server. Run PyMol |
13 |
|
|
* with the -R option to run the server. |
14 |
|
|
* |
15 |
|
|
* Changelog: |
16 |
|
|
* 06/02/02 first created by HS |
17 |
|
|
*/ |
18 |
|
|
public class testPymolServer { |
19 |
|
|
|
20 |
|
|
/** |
21 |
|
|
* Send the first command line parameter to the pymol server. |
22 |
|
|
*/ |
23 |
|
|
public static void main(String[] args) { |
24 |
|
|
|
25 |
|
|
String command = "load /project/StruPPi/PDBs/mainPDB/1RX4.pdb, hello"; |
26 |
|
|
if(args.length > 0) { |
27 |
|
|
command = args[0]; |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
try { |
31 |
|
|
String myURL = "http://gelb:9123"; |
32 |
|
|
XmlRpcClient client = new XmlRpcClient(myURL); |
33 |
|
|
Vector<String> myvector = new Vector<String>(); |
34 |
|
|
myvector.add(command); |
35 |
|
|
try { |
36 |
|
|
client.execute("do",myvector); |
37 |
|
|
} |
38 |
|
|
catch (IOException e) { |
39 |
|
|
e.printStackTrace(); |
40 |
|
|
} |
41 |
|
|
catch( XmlRpcException e) { |
42 |
|
|
e.printStackTrace(); |
43 |
|
|
} |
44 |
|
|
} |
45 |
|
|
catch(MalformedURLException e){ |
46 |
|
|
e.printStackTrace(); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
|
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
} |