01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
04: //
05: // All Rights Reserved
06: //
07: // This program is free software; you can redistribute it and/or modify
08: // it under the terms of the GNU General Public License and GNU Library
09: // General Public License as published by the Free Software Foundation;
10: // either version 2, or (at your option) any later version.
11: //
12: // This program 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
15: // GNU General Public License and GNU Library General Public License
16: // for more details.
17: //
18: // You should have received a copy of the GNU General Public License
19: // and GNU Library General Public License along with this program; if
20: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
21: // MA 02139, USA.
22: //
23: ///////////////////////////////////////////////////////////////////////////////
24:
25: package org.rdesktop.server;
26:
27: import org.myoodb.*;
28: import org.myoodb.collectable.*;
29: import org.rdesktop.objects.*;
30:
31: public class RemoteDesktopServer {
32: public static int PORT = 54321;
33: public static String DIR = "db";
34: public static String HOST = "localhost";
35: public static String USERNAME = "guest";
36: public static String PASSWORD = "guest";
37: public static String WEBCONFIG = "webconfig.xml";
38:
39: public static void main(String[] args) throws Exception {
40: StreamProtocolServer.register();
41:
42: Runnable initRoot = new Runnable() {
43: public void run() {
44: try {
45: while (org.myoodb.core.MyOodbManager
46: .getTheManagerInitializedFlag() == false) {
47: Thread.sleep(100);
48: }
49:
50: MyOodbDatabase db = MyOodbDatabase
51: .open("tcp://localhost:" + PORT, "guest",
52: "guest");
53:
54: LinkedList streams = (LinkedList) db
55: .getRoot(Constants.ROOT_NAME);
56: if (streams == null) {
57: streams = (LinkedList) db
58: .createRoot(
59: Constants.ROOT_NAME,
60: org.myoodb.collectable.LinkedListDbImpl.class);
61: }
62:
63: java.util.ArrayList list = streams.toArrayList();
64: streams.clear();
65:
66: for (int i = 0; i < list.size(); i++) {
67: db.deleteObject((RdpDesktopExchange) list
68: .get(i));
69: }
70: } catch (Exception e) {
71: e.printStackTrace();
72: System.exit(0);
73: }
74: }
75: };
76:
77: Thread thread = new Thread(initRoot);
78: thread.setDaemon(true);
79: thread.start();
80:
81: final String[] params = { "-create", "-dbdir=" + DIR,
82: "-tcpPort=" + PORT,
83: "-admin=" + USERNAME + ":" + PASSWORD,
84: "-webconfig=" + WEBCONFIG };
85:
86: org.myoodb.core.MyOodbMain.setCheckForStaleMemoryFlag(false);
87: org.myoodb.core.MyOodbMain.main(params);
88: }
89: }
|