01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package pipeserver;
16:
17: //import java.net.*;
18: import java.io.*;
19: import java.util.StringTokenizer;
20: import org.quickserver.net.*;
21: import org.quickserver.net.server.*;
22:
23: import java.util.logging.*;
24: import org.quickserver.util.logging.*;
25:
26: /**
27: * A simple redirect server.
28: */
29:
30: public class PipeServer {
31: public static void main(String args[]) {
32: QuickServer myServer = new QuickServer();
33: //setup logger to log to file
34: Logger logger = null;
35: FileHandler txtLog = null;
36: File log = new File("./log/");
37: if (!log.canRead())
38: log.mkdir();
39: try {
40: logger = Logger.getLogger("org.quickserver");
41: logger.setLevel(Level.FINEST);
42: txtLog = new FileHandler("log/PipeServer_QuickServer.txt");
43: txtLog.setFormatter(new SimpleTextFormatter());
44: logger.addHandler(txtLog);
45:
46: logger = Logger.getLogger("pipeserver");
47: logger.setLevel(Level.FINEST);
48: txtLog = new FileHandler("log/PipeServer.txt");
49: txtLog.setFormatter(new SimpleTextFormatter());
50: logger.addHandler(txtLog);
51:
52: myServer.setAppLogger(logger); //imp
53: } catch (IOException e) {
54: System.err.println("Could not create txtLog FileHandler : "
55: + e);
56: }
57: //end of logger code
58: String confFile = "conf" + File.separator + "PipeServer.xml";
59: Object config[] = new Object[] { confFile };
60: if (myServer.initService(config) == true) {
61: try {
62: myServer.startServer();
63: myServer.startQSAdminServer();
64: } catch (AppException e) {
65: System.err.println("Error in server : " + e);
66: e.printStackTrace();
67: }
68: }
69: }
70: }
|