KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > benchmark > xmlrpc > latency > Server


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Harbonnier, Denimal.
23 Contributor(s): Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.benchmark.xmlrpc.latency;
28
29 // Package dependencies.
30
import org.apache.xmlrpc.WebServer;
31
32 /**
33  * This is the WS Server. It implements the Ping interface.
34  *
35  * @author Harbonnier, Denimal.
36  *
37  * @version 1.0
38  */

39 public class Server
40 {
41     // ==================================================================
42
//
43
// Internal states.
44
//
45
// ==================================================================
46

47     /** port */
48     private String JavaDoc port;
49
50     // ==================================================================
51
//
52
// Constructors.
53
//
54
// ==================================================================
55

56     /**
57      * The default constructor.
58      */

59     public Server()
60     {
61         try
62         {
63             java.util.Properties JavaDoc properties = new java.util.Properties JavaDoc();
64             java.io.InputStream JavaDoc propStream = getClass().getClassLoader().getResourceAsStream("benchmark.properties");
65             properties.load(propStream);
66         
67             port = "2000";
68         }catch(Exception JavaDoc e){
69             e.printStackTrace();
70         }
71     }
72
73     // ==================================================================
74
//
75
// Internal methods.
76
//
77
// ==================================================================
78

79     private String JavaDoc
80     getPort()
81     {
82         return port;
83     }
84
85     // ==================================================================
86
//
87
// Public methods.
88
//
89
// ==================================================================
90

91     /**
92      * The bootstrap method.
93      */

94    public static void
95    main(String JavaDoc[] args)
96    {
97        Server s = new Server();
98
99        try
100        {
101            WebServer server = new WebServer(Integer.parseInt(s.getPort()));
102            System.out.println ("Ping Server started ...");
103            server.addHandler ("pingServer", new PingHandler ());
104        } catch (java.io.IOException JavaDoc e) {
105            e.printStackTrace();
106        }
107     }
108 }
109
Popular Tags