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