diff options
author | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
---|---|---|
committer | Johan Berntsson | 2008-03-04 05:31:54 +0000 |
commit | 279e0061c515ee0a03036bef68eea9738273d785 (patch) | |
tree | 4502228eb7b87a760e0b0e67aded9d1d870d0bed /ThirdParty/3Di/RegionMonitor/ServerPlugin/RegionMonitorPlugin.cs | |
parent | Added copyright heaaders. Minor cleanup. (diff) | |
download | opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.zip opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.gz opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.bz2 opensim-SC-279e0061c515ee0a03036bef68eea9738273d785.tar.xz |
Merged 3Di code that provides scene and avatar serialization, and plugin support for region move/split/merge. See ThirdParty/3Di/README.txt. Unless the new modules are used there should be no noticeable changes when running OpenSim.
Diffstat (limited to '')
-rw-r--r-- | ThirdParty/3Di/RegionMonitor/ServerPlugin/RegionMonitorPlugin.cs | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/ThirdParty/3Di/RegionMonitor/ServerPlugin/RegionMonitorPlugin.cs b/ThirdParty/3Di/RegionMonitor/ServerPlugin/RegionMonitorPlugin.cs new file mode 100644 index 0000000..5d2df3a --- /dev/null +++ b/ThirdParty/3Di/RegionMonitor/ServerPlugin/RegionMonitorPlugin.cs | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Runtime.Remoting; | ||
30 | using System.Threading; | ||
31 | using Mono.Addins; | ||
32 | using OpenSim; | ||
33 | using OpenSim.Framework.Console; | ||
34 | using MonitorLib; | ||
35 | |||
36 | [assembly:Addin] | ||
37 | [assembly:AddinDependency ("OpenSim", "0.5")] | ||
38 | |||
39 | namespace OpenSim.ApplicationPlugins.RegionMonitor | ||
40 | { | ||
41 | [Extension("/OpenSim/Startup")] | ||
42 | public class RegionMonitorPlugin : MonitorLibBase, IApplicationPlugin | ||
43 | { | ||
44 | protected Thread m_mointorThread; | ||
45 | protected static OpenSimMain m_openSimMain; | ||
46 | |||
47 | public void Initialise(OpenSimMain opensim) | ||
48 | { | ||
49 | m_openSimMain = opensim; | ||
50 | Start(); | ||
51 | MainLog.Instance.Verbose("Monitor", "Region monitor is runing ..."); | ||
52 | } | ||
53 | |||
54 | public void Close() | ||
55 | { | ||
56 | } | ||
57 | |||
58 | public void Start() | ||
59 | { | ||
60 | // start monitor thread (remoting module) | ||
61 | m_mointorThread = new Thread(new ThreadStart(StartMonitor)); | ||
62 | m_mointorThread.IsBackground = true; | ||
63 | m_mointorThread.Start(); | ||
64 | } | ||
65 | |||
66 | private void StartMonitor() | ||
67 | { | ||
68 | try | ||
69 | { | ||
70 | Object lockObj = new Object(); | ||
71 | |||
72 | RemotingConfiguration.Configure("monitorS.config", false); | ||
73 | |||
74 | lock (lockObj) | ||
75 | { | ||
76 | System.Threading.Monitor.Wait(lockObj); | ||
77 | } | ||
78 | } | ||
79 | catch (Exception e) | ||
80 | { | ||
81 | MainLog.Instance.Warn("MONITOR", "Error - " + e.Message); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | public override bool FetchInfo(out string outstr) | ||
86 | { | ||
87 | MainLog.Instance.Verbose("MONITOR", "Fetch Information from Region server"); | ||
88 | bool status = true; | ||
89 | string startTime = ""; | ||
90 | string upTime = ""; | ||
91 | int userNumber = 0; | ||
92 | int regionNumber = 0; | ||
93 | m_openSimMain.GetRunTime(out startTime, out upTime); | ||
94 | m_openSimMain.GetAvatarNumber(out userNumber); | ||
95 | m_openSimMain.GetRegionNumber(out regionNumber); | ||
96 | outstr = startTime | ||
97 | + "," + upTime | ||
98 | + "," + regionNumber | ||
99 | + "," + userNumber; | ||
100 | return status; | ||
101 | } | ||
102 | |||
103 | |||
104 | public override bool MoveRegion() | ||
105 | { | ||
106 | MainLog.Instance.Verbose("MONITOR", "Move Region"); | ||
107 | bool status = true; | ||
108 | |||
109 | return status; | ||
110 | } | ||
111 | |||
112 | public override bool SplitRegion() | ||
113 | { | ||
114 | MainLog.Instance.Verbose("MONITOR", "Split Region"); | ||
115 | bool status = true; | ||
116 | |||
117 | return status; | ||
118 | } | ||
119 | |||
120 | public override bool MergeScenes() | ||
121 | { | ||
122 | MainLog.Instance.Verbose("MONITOR", "Merge Scenes"); | ||
123 | bool status = true; | ||
124 | |||
125 | return status; | ||
126 | } | ||
127 | |||
128 | } | ||
129 | } | ||