diff options
author | Melanie Thielker | 2009-04-10 21:26:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-04-10 21:26:36 +0000 |
commit | ae6f265729ad3a31dd10f320e712ad208cde0edf (patch) | |
tree | cdb680128b241ce83084f8fda036ba603e301068 | |
parent | Introduce IXmlRpcRouter, an interface that allows registering XMLRPC (diff) | |
download | opensim-SC-ae6f265729ad3a31dd10f320e712ad208cde0edf.zip opensim-SC-ae6f265729ad3a31dd10f320e712ad208cde0edf.tar.gz opensim-SC-ae6f265729ad3a31dd10f320e712ad208cde0edf.tar.bz2 opensim-SC-ae6f265729ad3a31dd10f320e712ad208cde0edf.tar.xz |
Add an optional region module which will supply a script event,
xmlrpc_uri(string) in response to a OpenRemoteDataChannel call. The string
is the fully qualified URI to post XMLRPC requests for that script to.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs | 90 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 11 |
2 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs new file mode 100644 index 0000000..cdde893 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs | |||
@@ -0,0 +1,90 @@ | |||
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.Reflection; | ||
30 | |||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenMetaverse; | ||
34 | |||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | |||
39 | |||
40 | namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule | ||
41 | { | ||
42 | public class XmlRpcRouter : IRegionModule, IXmlRpcRouter | ||
43 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
45 | |||
46 | public void Initialise(Scene scene, IConfigSource config) | ||
47 | { | ||
48 | IConfig startupConfig = config.Configs["Startup"]; | ||
49 | if (startupConfig == null) | ||
50 | return; | ||
51 | |||
52 | if (startupConfig.GetString("XmlRpcRouterModule", | ||
53 | "XmlRpcRouterModule") == "XmlRpcRouterModule") | ||
54 | { | ||
55 | scene.RegisterModuleInterface<IXmlRpcRouter>(this); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public void PostInitialise() | ||
60 | { | ||
61 | } | ||
62 | |||
63 | public void Close() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | public string Name | ||
68 | { | ||
69 | get { return "XmlRpcRouterModule"; } | ||
70 | } | ||
71 | |||
72 | public bool IsSharedModule | ||
73 | { | ||
74 | get { return false; } | ||
75 | } | ||
76 | |||
77 | public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) | ||
78 | { | ||
79 | scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); | ||
80 | } | ||
81 | |||
82 | public void ScriptRemoved(UUID itemID) | ||
83 | { | ||
84 | } | ||
85 | |||
86 | public void ObjectRemoved(UUID objectID) | ||
87 | { | ||
88 | } | ||
89 | } | ||
90 | } | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index a49035d..2826462 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -203,6 +203,17 @@ | |||
203 | ;MapImageModule = "MapImageModule" | 203 | ;MapImageModule = "MapImageModule" |
204 | 204 | ||
205 | ; ## | 205 | ; ## |
206 | ; ## Scripting XMLRPC mapper | ||
207 | ; ## | ||
208 | |||
209 | ; If enabled, this will post an event, "xmlrpc_uri(string)" to the | ||
210 | ; script concurrently with the first remote_data event. | ||
211 | ; This will contain the fully qualified URI an external site needs | ||
212 | ; to use to send XMLRPC requests to that script | ||
213 | |||
214 | ;XmlRpcRouterModule = "XmlRpcRouterModule" | ||
215 | |||
216 | ; ## | ||
206 | ; ## Customized Cache Implementation | 217 | ; ## Customized Cache Implementation |
207 | ; ## | 218 | ; ## |
208 | ; | 219 | ; |