diff options
Diffstat (limited to 'share/perl/lib/OpenSim/GridServer')
-rw-r--r-- | share/perl/lib/OpenSim/GridServer/Config.pm | 50 | ||||
-rw-r--r-- | share/perl/lib/OpenSim/GridServer/GridManager.pm | 57 |
2 files changed, 107 insertions, 0 deletions
diff --git a/share/perl/lib/OpenSim/GridServer/Config.pm b/share/perl/lib/OpenSim/GridServer/Config.pm new file mode 100644 index 0000000..dc72e5a --- /dev/null +++ b/share/perl/lib/OpenSim/GridServer/Config.pm | |||
@@ -0,0 +1,50 @@ | |||
1 | package OpenSim::GridServer::Config; | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | our %SYS_SQL = ( | ||
6 | select_region_by_uuid => | ||
7 | "SELECT * FROM regions WHERE uuid=?", | ||
8 | select_region_by_handle => | ||
9 | "SELECT * FROM regions WHERE regionHandle=?", | ||
10 | select_region_list => | ||
11 | "SELECT * FROM regions WHERE locX>=? AND locX<? AND locY>=? AND locY<?", | ||
12 | select_region_list2 => | ||
13 | "SELECT * FROM regions WHERE locX>=? AND locX<? AND locY>=? AND locY<?", | ||
14 | insert_region => | ||
15 | "INSERT INTO regions VALUES (?????????)", | ||
16 | delete_all_regions => | ||
17 | "delete from regions", | ||
18 | ); | ||
19 | |||
20 | |||
21 | our @REGIONS_COLUMNS = ( | ||
22 | "uuid", | ||
23 | "regionHandle", | ||
24 | "regionName", | ||
25 | "regionRecvKey", | ||
26 | "regionSendKey", | ||
27 | "regionSecret", | ||
28 | "regionDataURI", | ||
29 | "serverIP", | ||
30 | "serverPort", | ||
31 | "serverURI", | ||
32 | "locX", | ||
33 | "locY", | ||
34 | "locZ", | ||
35 | "eastOverrideHandle", | ||
36 | "westOverrideHandle", | ||
37 | "southOverrideHandle", | ||
38 | "northOverrideHandle", | ||
39 | "regionAssetURI", | ||
40 | "regionAssetRecvKey", | ||
41 | "regionAssetSendKey", | ||
42 | "regionUserURI", | ||
43 | "regionUserRecvKey", | ||
44 | "regionUserSendKey", | ||
45 | "regionMapTexture", | ||
46 | "serverHttpPort", | ||
47 | "serverRemotingPort", | ||
48 | ); | ||
49 | |||
50 | 1; | ||
diff --git a/share/perl/lib/OpenSim/GridServer/GridManager.pm b/share/perl/lib/OpenSim/GridServer/GridManager.pm new file mode 100644 index 0000000..2170d74 --- /dev/null +++ b/share/perl/lib/OpenSim/GridServer/GridManager.pm | |||
@@ -0,0 +1,57 @@ | |||
1 | package OpenSim::GridServer::GridManager; | ||
2 | |||
3 | use strict; | ||
4 | use Carp; | ||
5 | use OpenSim::Utility; | ||
6 | use OpenSim::GridServer::Config; | ||
7 | |||
8 | sub getRegionByUUID { | ||
9 | my $uuid = shift; | ||
10 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_uuid}, $uuid); | ||
11 | my $count = @$result; | ||
12 | if ($count > 0) { | ||
13 | return $result->[0]; | ||
14 | } | ||
15 | Carp::croak("can not find region"); | ||
16 | } | ||
17 | |||
18 | sub getRegionByHandle { | ||
19 | my $handle = shift; | ||
20 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_by_handle}, $handle); | ||
21 | my $count = @$result; | ||
22 | if ($count > 0) { | ||
23 | return $result->[0]; | ||
24 | } | ||
25 | Carp::croak("can not find region # $handle"); | ||
26 | } | ||
27 | |||
28 | sub getRegionList { | ||
29 | my ($xmin, $ymin, $xmax, $ymax) = @_; | ||
30 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list}, $xmin, $xmax, $ymin, $ymax); | ||
31 | my $count = @$result; | ||
32 | if ($count > 0) { | ||
33 | return $result; | ||
34 | } | ||
35 | Carp::croak("can not find region"); | ||
36 | } | ||
37 | |||
38 | sub getRegionList2 { | ||
39 | my ($xmin, $ymin, $xmax, $ymax) = @_; | ||
40 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{select_region_list2}, $xmin, $xmax, $ymin, $ymax); | ||
41 | my $count = @$result; | ||
42 | if ($count > 0) { | ||
43 | return $result; | ||
44 | } | ||
45 | Carp::croak("can not find region"); | ||
46 | } | ||
47 | |||
48 | sub deleteRegions { | ||
49 | my $result = &OpenSim::Utility::getSimpleResult($OpenSim::GridServer::Config::SYS_SQL{delete_all_regions}); | ||
50 | my $count = @$result; | ||
51 | if ($count > 0) { | ||
52 | return $result; | ||
53 | } | ||
54 | Carp::croak("failed to delete regions"); | ||
55 | } | ||
56 | |||
57 | 1; | ||