aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ThirdParty/3Di/RegionMonitor
diff options
context:
space:
mode:
authorJohan Berntsson2008-07-16 03:04:45 +0000
committerJohan Berntsson2008-07-16 03:04:45 +0000
commit337a46474a1c782603c918171a7afcdb1221973c (patch)
tree56a9a92a53e2050c0f8d168d125f94c1994cde4f /ThirdParty/3Di/RegionMonitor
parentFix issue 1582. The maximum allowable length for a string passed to SimChat i... (diff)
downloadopensim-SC_OLD-337a46474a1c782603c918171a7afcdb1221973c.zip
opensim-SC_OLD-337a46474a1c782603c918171a7afcdb1221973c.tar.gz
opensim-SC_OLD-337a46474a1c782603c918171a7afcdb1221973c.tar.bz2
opensim-SC_OLD-337a46474a1c782603c918171a7afcdb1221973c.tar.xz
Updated files for the loadbalancer web interface
Diffstat (limited to 'ThirdParty/3Di/RegionMonitor')
-rw-r--r--ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm100
-rw-r--r--ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/readme.txt21
2 files changed, 121 insertions, 0 deletions
diff --git a/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm
new file mode 100644
index 0000000..5d9b388
--- /dev/null
+++ b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/XML/RPC.pm
@@ -0,0 +1,100 @@
1package XML::RPC;
2
3use strict;
4use Carp;
5use RPC::XML;
6use RPC::XML::Parser;
7use RPC::XML::Client;
8
9sub new {
10 my ($this, $url) = @_;
11 my %fields = (
12 parser => new RPC::XML::Parser(),
13 url => $url,
14 );
15 return bless \%fields, $this;
16}
17
18sub receive {
19 my ($this, $xmldata, $handler) = @_;
20 my $response = undef;
21 eval {
22 my $request = $this->{parser}->parse($xmldata);
23 my @args = map {$_->value} @{$request->args};
24 $response = $handler->($request->{name}, @args);
25 };
26 if ($@) {
27 my %error = (
28 "error" => "ERROR",
29 "message" => $@,
30 );
31 $response = \%error;
32 }
33 if ( ref($response) eq "RPC::XML::response" ) {
34 return $response->as_string;
35 }
36 else {
37 return RPC::XML::response->new($response)->as_string;
38 }
39}
40
41sub call {
42 my ($this, $method_name, $param) = @_;
43 if (!$this->{url}) {
44 Carp::croak("XMLRPC: url not set for calling $method_name");
45 }
46 my $client = RPC::XML::Client->new($this->{url});
47 my $request_param = undef;
48 my $req = undef;
49 if (ref $param eq "ARRAY") {
50 $request_param = &_make_array_param($param);
51 $req = RPC::XML::request->new(
52 $method_name,
53 @$request_param,
54 );
55 } elsif (ref $param eq "HASH"){
56 $request_param = &_make_hash_param($param);
57 $req = RPC::XML::request->new(
58 $method_name,
59 $request_param,
60 );
61 } else {
62 Carp::croak("unexpected param type");
63 }
64 my $rpc_res = undef;
65 eval {
66 $rpc_res = $client->send_request($req);
67 };
68 if ($@) {
69 Carp::croak("request " . $this->{url} . "/" . $method_name . " failed. $@" );
70 }
71 if (ref($rpc_res) eq "RPC::XML::struct") {
72 my %res = map { $_ => $rpc_res->{$_}->value } keys %$rpc_res; # remember good perl !!
73 return \%res;
74 } elsif (ref($rpc_res) eq "RPC::XML::string") {
75 return $rpc_res->value;
76 } else {
77 return undef;
78 }
79}
80
81sub _make_array_param {
82 my $param = shift;
83 my @array_param = ();
84 foreach (@$param) {
85 push @array_param, RPC::XML::string->new($_); # @@@ only string type
86 }
87 return \@array_param;
88}
89
90sub _make_hash_param {
91 my $param = shift;
92 my %hash_param = ();
93 foreach (keys %$param) {
94 $hash_param{$_} = RPC::XML::string->new($param->{$_}); # @@@ only string type
95 }
96 return RPC::XML::struct->new(\%hash_param);
97}
98
991;
100
diff --git a/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/readme.txt b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/readme.txt
new file mode 100644
index 0000000..396ba56
--- /dev/null
+++ b/ThirdParty/3Di/RegionMonitor/MonitorGUI/htdocs/readme.txt
@@ -0,0 +1,21 @@
1How to get this working on Linux/Apache:
2
3Create a new directory /var/www/monitor and copy all files htdocs/* files there.
4
5Include these lines in /etc/apache2/httpdocs
6---
7<Directory /var/www/monitor>
8 Options +ExecCGI
9</Directory>
10AddHandler cgi-script .cgi
11---
12
13Restart Apache: sudo /etc/init.d/apache2 restart
14
15Check that the perl XML-RPC modules is available ("sudo apt-get install librcp-xml-perl" on Ubuntu)
16
17Edit /var/www/monitor/monitor.cgi to update the IP addresses for the Grid server (TODO: improve this)
18
19Start OpenSim in grid mode, use a browser to open http://localhost/monitor/monitor.cgi
20
21