diff options
Renamed Region/CoreModules/ServiceConnectors to Region/CoreModules/ServiceConnectorsOut. No functional changes.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/User')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs | 126 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs | 87 |
2 files changed, 213 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs new file mode 100644 index 0000000..f364999 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs | |||
@@ -0,0 +1,126 @@ | |||
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 OpenSimulator 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 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | |||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | ||
38 | { | ||
39 | public class LocalUserServicesConnector : ISharedRegionModule | ||
40 | { | ||
41 | private static readonly ILog m_log = | ||
42 | LogManager.GetLogger( | ||
43 | MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private IUserService m_UserService; | ||
46 | |||
47 | private bool m_Enabled = false; | ||
48 | |||
49 | public string Name | ||
50 | { | ||
51 | get { return "LocalUserServicesConnector"; } | ||
52 | } | ||
53 | |||
54 | public void Initialise(IConfigSource source) | ||
55 | { | ||
56 | IConfig moduleConfig = source.Configs["Modules"]; | ||
57 | if (moduleConfig != null) | ||
58 | { | ||
59 | string name = moduleConfig.GetString("UserServices", ""); | ||
60 | if (name == Name) | ||
61 | { | ||
62 | IConfig userConfig = source.Configs["UserService"]; | ||
63 | if (userConfig == null) | ||
64 | { | ||
65 | m_log.Error("[USER CONNECTOR]: UserService missing from OpenSim.ini"); | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | string serviceDll = userConfig.GetString("LocalServiceModule", | ||
70 | String.Empty); | ||
71 | |||
72 | if (serviceDll == String.Empty) | ||
73 | { | ||
74 | m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService"); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | Object[] args = new Object[] { source }; | ||
79 | m_UserService = | ||
80 | ServerUtils.LoadPlugin<IUserService>(serviceDll, | ||
81 | args); | ||
82 | |||
83 | if (m_UserService == null) | ||
84 | { | ||
85 | m_log.Error("[USER CONNECTOR]: Can't load user service"); | ||
86 | return; | ||
87 | } | ||
88 | m_Enabled = true; | ||
89 | m_log.Info("[USER CONNECTOR]: Local user connector enabled"); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public void PostInitialise() | ||
95 | { | ||
96 | if (!m_Enabled) | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | public void Close() | ||
101 | { | ||
102 | if (!m_Enabled) | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | public void AddRegion(Scene scene) | ||
107 | { | ||
108 | if (!m_Enabled) | ||
109 | return; | ||
110 | |||
111 | scene.RegisterModuleInterface<IUserService>(m_UserService); | ||
112 | } | ||
113 | |||
114 | public void RemoveRegion(Scene scene) | ||
115 | { | ||
116 | if (!m_Enabled) | ||
117 | return; | ||
118 | } | ||
119 | |||
120 | public void RegionLoaded(Scene scene) | ||
121 | { | ||
122 | if (!m_Enabled) | ||
123 | return; | ||
124 | } | ||
125 | } | ||
126 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs new file mode 100644 index 0000000..00a2478 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs | |||
@@ -0,0 +1,87 @@ | |||
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 OpenSimulator 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 Nini.Config; | ||
29 | using OpenSim.Region.Framework.Interfaces; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | ||
34 | { | ||
35 | public class RemoteUserServicesConnector : ISharedRegionModule | ||
36 | { | ||
37 | private bool m_Enabled = false; | ||
38 | |||
39 | public string Name | ||
40 | { | ||
41 | get { return "RemoteUserServicesConnector"; } | ||
42 | } | ||
43 | |||
44 | public void Initialise(IConfigSource source) | ||
45 | { | ||
46 | IConfig moduleConfig = source.Configs["Modules"]; | ||
47 | if (moduleConfig != null) | ||
48 | { | ||
49 | string name = moduleConfig.GetString("UserServices", ""); | ||
50 | if (name == Name) | ||
51 | { | ||
52 | m_Enabled = true; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public void PostInitialise() | ||
58 | { | ||
59 | if (!m_Enabled) | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | public void Close() | ||
64 | { | ||
65 | if (!m_Enabled) | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | public void AddRegion(Scene scene) | ||
70 | { | ||
71 | if (!m_Enabled) | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | public void RemoveRegion(Scene scene) | ||
76 | { | ||
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | public void RegionLoaded(Scene scene) | ||
82 | { | ||
83 | if (!m_Enabled) | ||
84 | return; | ||
85 | } | ||
86 | } | ||
87 | } | ||