diff options
author | Adam Frisby | 2007-11-06 21:41:11 +0000 |
---|---|---|
committer | Adam Frisby | 2007-11-06 21:41:11 +0000 |
commit | c0010e4940dd0ca067d469d8194be69b2bc1dece (patch) | |
tree | 3dd9a39e2b9db0d6e97e15c8b3bb7d595f2da612 /share/ruby/gridserv.rb | |
parent | set svn:eol-style (diff) | |
download | opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.zip opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.gz opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.bz2 opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.xz |
* Moved /branches/ruby to /trunk/share/ruby
Diffstat (limited to '')
-rw-r--r-- | share/ruby/gridserv.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/share/ruby/gridserv.rb b/share/ruby/gridserv.rb new file mode 100644 index 0000000..03cb4d1 --- /dev/null +++ b/share/ruby/gridserv.rb | |||
@@ -0,0 +1,69 @@ | |||
1 | require "webrick" | ||
2 | require "xmlrpc/server" | ||
3 | require 'xmlrpc/client' | ||
4 | require 'pp' | ||
5 | require 'config.rb' | ||
6 | |||
7 | # | ||
8 | # Dummy grid server | ||
9 | # | ||
10 | # | ||
11 | |||
12 | class SimServlet < WEBrick::HTTPServlet::AbstractServlet | ||
13 | # does actually nothing | ||
14 | def do_POST(req, res) | ||
15 | STDERR.print "----\n" | ||
16 | end | ||
17 | end | ||
18 | |||
19 | $SimUUID = "" | ||
20 | |||
21 | s = XMLRPC::WEBrickServlet.new | ||
22 | s.add_handler("map_block") do |param| | ||
23 | # does just enough to login.. if you try using "map" you will cause the exception | ||
24 | # and hang the client | ||
25 | responseData = Hash.new | ||
26 | responseData["sim-profiles"] = [ ] | ||
27 | responseData | ||
28 | end | ||
29 | |||
30 | s.add_handler("simulator_login") do |param| | ||
31 | sc = SimConfig.new | ||
32 | responseData = Hash.new | ||
33 | STDERR.print "simulator login: " + param.inspect + "\n" | ||
34 | $SimUUID = param["UUID"] | ||
35 | |||
36 | responseData["UUID"] = param["UUID"] | ||
37 | responseData["region_locx"] = sc.cfgSimX | ||
38 | responseData["region_locy"] = sc.cfgSimY | ||
39 | responseData["regionname"] = "DalienLand" | ||
40 | responseData["estate_id"] = "1" | ||
41 | responseData["neighbours"] = [ ] | ||
42 | responseData["sim_ip"] = sc.cfgSimIP | ||
43 | responseData["sim_port"] = sc.cfgSimPort | ||
44 | responseData["asset_url"] = sc.cfgAssetServerUrl | ||
45 | responseData["asset_sendkey"] = "" | ||
46 | responseData["asset_recvkey"] = "" | ||
47 | responseData["user_url"] = sc.cfgUserServerUrl | ||
48 | responseData["user_sendkey"] = "" | ||
49 | responseData["user_recvkey"] = "" | ||
50 | responseData["authkey"] = "" | ||
51 | |||
52 | responseData | ||
53 | |||
54 | end | ||
55 | |||
56 | s.set_default_handler do |name, *args| | ||
57 | STDERR.print "Unknown method #{name}, #{args.inspect}\n\n" | ||
58 | raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + | ||
59 | " or wrong number of parameters!") | ||
60 | end | ||
61 | |||
62 | httpserver = WEBrick::HTTPServer.new(:Port => 8001) | ||
63 | httpserver.mount("/", s) | ||
64 | httpserver.mount("/sims", SimServlet) | ||
65 | |||
66 | trap(:INT) { httpserver.shutdown } # use 1 instead of "HUP" on Windows | ||
67 | httpserver.start | ||
68 | |||
69 | |||