|
1 |
| package net.sf.crispy.impl.jaxrpc; |
|
2 |
| |
|
3 |
| import java.net.ServerSocket; |
|
4 |
| |
|
5 |
| import net.sf.crispy.impl.MiniServer; |
|
6 |
| import net.sf.crispy.util.Util; |
|
7 |
| |
|
8 |
| import org.apache.axis.client.AdminClient; |
|
9 |
| import org.apache.axis.components.threadpool.ThreadPool; |
|
10 |
| import org.apache.axis.transport.http.SimpleAxisServer; |
|
11 |
| import org.apache.commons.logging.Log; |
|
12 |
| import org.apache.commons.logging.LogFactory; |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| public class MiniAxisServer implements MiniServer { |
|
21 |
| |
|
22 |
| protected static final Log log = LogFactory.getLog (MiniAxisServer.class); |
|
23 |
| private SimpleAxisServer axisServer = new SimpleAxisServer(ThreadPool.DEFAULT_MAX_THREADS); |
|
24 |
| private int port = 9080; |
|
25 |
| |
|
26 |
2
| public MiniAxisServer() { }
|
|
27 |
| |
|
28 |
| |
|
29 |
1
| public void addService (String pvServiceInterface, String pvServiceObject) {
|
|
30 |
| if (log.isDebugEnabled()) { log.debug("The method addService in the MiniAxisServer class do nothing!"); } |
|
31 |
| } |
|
32 |
| |
|
33 |
2
| public synchronized void start () {
|
|
34 |
2
| try {
|
|
35 |
2
| boolean isPortFree = Util.isPortFree(port);
|
|
36 |
2
| if (isPortFree == true) {
|
|
37 |
2
| axisServer.setServerSocket(new ServerSocket(port));
|
|
38 |
2
| axisServer.start();
|
|
39 |
| if (log.isDebugEnabled()) { log.debug("MiniAxisServer is started ..."); } |
|
40 |
| } |
|
41 |
| |
|
42 |
2
| AdminClient lvAdminClient = new AdminClient();
|
|
43 |
2
| String args[] = new String[3];
|
|
44 |
2
| args[0] = "./classes/test/crispy/example/service/deployCalculator.wsdd";
|
|
45 |
2
| args[1] = "-l";
|
|
46 |
2
| args[2] = "http://localhost:" + port + "/axis/services/AdminService";
|
|
47 |
2
| String lvDeployStr1 = lvAdminClient.process(args);
|
|
48 |
| if (log.isDebugEnabled()) { log.debug("Deploy1: " + lvDeployStr1); } |
|
49 |
2
| args[0] = "./classes/test/crispy/example/service/deployEcho.wsdd";
|
|
50 |
2
| args[1] = "-l";
|
|
51 |
2
| args[2] = "http://localhost:" + port + "/axis/services/AdminService";
|
|
52 |
2
| String lvDeployStr2 = lvAdminClient.process(args);
|
|
53 |
| if (log.isDebugEnabled()) { log.debug(" Deploy2: " + lvDeployStr2); } |
|
54 |
| } catch (Exception e) { |
|
55 |
0
| e.printStackTrace();
|
|
56 |
| } |
|
57 |
| |
|
58 |
| } |
|
59 |
| |
|
60 |
| public void stop() { |
|
61 |
| axisServer.stop(); |
|
62 |
| if (log.isDebugEnabled()) { log.debug("Stop MiniAxisServer."); } |
|
63 |
| } |
|
64 |
| |
|
65 |
| } |