diff options
author | Diva Canto | 2009-12-29 15:58:40 -0800 |
---|---|---|
committer | Diva Canto | 2009-12-29 15:58:40 -0800 |
commit | b4483df2701483aabd43fc7d03ebd74770d70170 (patch) | |
tree | d36e88b1409e438be222e0a994b6ca563fe26850 /OpenSim/Region | |
parent | Tighten up the IUserService interface again. No need for auth tokens at this ... (diff) | |
download | opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.zip opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.gz opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.bz2 opensim-SC_OLD-b4483df2701483aabd43fc7d03ebd74770d70170.tar.xz |
* All modules and connectors for user account service are in place. Untested.
* Cleaned up a few things on presence connectors
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 4 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs | 176 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs (renamed from OpenSim/Services/Connectors/User/UserServiceConnector.cs) | 94 |
5 files changed, 226 insertions, 48 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 79796b1..a7acc43 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -48,9 +48,11 @@ | |||
48 | <RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" /> | 48 | <RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" /> |
49 | <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> | 49 | <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> |
50 | <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> | 50 | <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> |
51 | <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" /> | ||
51 | <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> | 52 | <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> |
52 | <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> | 53 | <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> |
53 | <RegionModule id="HGGridConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.HGGridConnector" /> | 54 | <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.User.LocalUserAccountServicesConnector" /> |
55 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.User.RemoteUserAccountServicesConnector" /> | ||
54 | <!-- Service connectors IN modules --> | 56 | <!-- Service connectors IN modules --> |
55 | <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> | 57 | <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> |
56 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> | 58 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs index cca5bb4..cca5bb4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/LocalUserAccountServiceConnector.cs | |||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs index cef9129..cef9129 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/User/RemoteUserAccountServiceConnector.cs | |||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs new file mode 100644 index 0000000..e40d524 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/LocalUserAccountServiceConnector.cs | |||
@@ -0,0 +1,176 @@ | |||
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.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Region.Framework.Interfaces; | ||
34 | using OpenSim.Region.Framework.Scenes; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | |||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User | ||
41 | { | ||
42 | public class LocalUserAccountServicesConnector : ISharedRegionModule, IUserAccountService | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private IUserAccountService m_UserService; | ||
49 | |||
50 | private bool m_Enabled = false; | ||
51 | |||
52 | #region ISharedRegionModule | ||
53 | |||
54 | public Type ReplaceableInterface | ||
55 | { | ||
56 | get { return null; } | ||
57 | } | ||
58 | |||
59 | public string Name | ||
60 | { | ||
61 | get { return "LocalUserAccountServicesConnector"; } | ||
62 | } | ||
63 | |||
64 | public void Initialise(IConfigSource source) | ||
65 | { | ||
66 | IConfig moduleConfig = source.Configs["Modules"]; | ||
67 | if (moduleConfig != null) | ||
68 | { | ||
69 | string name = moduleConfig.GetString("UserAccountServices", ""); | ||
70 | if (name == Name) | ||
71 | { | ||
72 | IConfig userConfig = source.Configs["UserAccountService"]; | ||
73 | if (userConfig == null) | ||
74 | { | ||
75 | m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpenSim.ini"); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | string serviceDll = userConfig.GetString("LocalServiceModule", | ||
80 | String.Empty); | ||
81 | |||
82 | if (serviceDll == String.Empty) | ||
83 | { | ||
84 | m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService"); | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | Object[] args = new Object[] { source }; | ||
89 | m_UserService = | ||
90 | ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, | ||
91 | args); | ||
92 | |||
93 | if (m_UserService == null) | ||
94 | { | ||
95 | m_log.Error("[USER CONNECTOR]: Can't load user account service"); | ||
96 | return; | ||
97 | } | ||
98 | m_Enabled = true; | ||
99 | m_log.Info("[USER CONNECTOR]: Local user connector enabled"); | ||
100 | } | ||
101 | } | ||
102 | } | ||
103 | |||
104 | public void PostInitialise() | ||
105 | { | ||
106 | if (!m_Enabled) | ||
107 | return; | ||
108 | } | ||
109 | |||
110 | public void Close() | ||
111 | { | ||
112 | if (!m_Enabled) | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | public void AddRegion(Scene scene) | ||
117 | { | ||
118 | if (!m_Enabled) | ||
119 | return; | ||
120 | |||
121 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); | ||
122 | } | ||
123 | |||
124 | public void RemoveRegion(Scene scene) | ||
125 | { | ||
126 | if (!m_Enabled) | ||
127 | return; | ||
128 | } | ||
129 | |||
130 | public void RegionLoaded(Scene scene) | ||
131 | { | ||
132 | if (!m_Enabled) | ||
133 | return; | ||
134 | } | ||
135 | |||
136 | #endregion | ||
137 | |||
138 | #region IUserAccountService | ||
139 | |||
140 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | ||
141 | { | ||
142 | return m_UserService.GetUserAccount(scopeID, userID); | ||
143 | } | ||
144 | |||
145 | public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) | ||
146 | { | ||
147 | return m_UserService.GetUserAccount(scopeID, FirstName, LastName); | ||
148 | } | ||
149 | |||
150 | public UserAccount GetUserAccount(UUID scopeID, string Email) | ||
151 | { | ||
152 | return m_UserService.GetUserAccount(scopeID, Email); | ||
153 | } | ||
154 | |||
155 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | ||
156 | { | ||
157 | return m_UserService.GetUserAccounts(scopeID, query); | ||
158 | } | ||
159 | |||
160 | // Update all updatable fields | ||
161 | // | ||
162 | public bool SetUserAccount(UserAccount data) | ||
163 | { | ||
164 | return m_UserService.SetUserAccount(data); | ||
165 | } | ||
166 | |||
167 | // Creates a user data record | ||
168 | public bool CreateUserAccount(UserAccount data) | ||
169 | { | ||
170 | return m_UserService.CreateUserAccount(data); | ||
171 | } | ||
172 | |||
173 | #endregion | ||
174 | |||
175 | } | ||
176 | } | ||
diff --git a/OpenSim/Services/Connectors/User/UserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs index 0de8c1d..0b72080 100644 --- a/OpenSim/Services/Connectors/User/UserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccount/RemoteUserAccountServiceConnector.cs | |||
@@ -25,90 +25,90 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | ||
29 | using System; | 28 | using System; |
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | 29 | using Nini.Config; |
34 | using OpenSim.Framework; | 30 | using log4net; |
35 | using OpenSim.Framework.Communications; | 31 | using System.Reflection; |
36 | using OpenSim.Framework.Servers.HttpServer; | 32 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
38 | using OpenMetaverse; | 35 | using OpenSim.Services.Connectors; |
39 | 36 | ||
40 | namespace OpenSim.Services.Connectors | 37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.User |
41 | { | 38 | { |
42 | public class UserServicesConnector : IUserAccountService | 39 | public class RemoteUserAccountServicesConnector : UserAccountServicesConnector, |
40 | ISharedRegionModule, IUserAccountService | ||
43 | { | 41 | { |
44 | private static readonly ILog m_log = | 42 | private static readonly ILog m_log = |
45 | LogManager.GetLogger( | 43 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 44 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 45 | ||
48 | // private string m_ServerURI = String.Empty; | 46 | private bool m_Enabled = false; |
49 | |||
50 | public UserServicesConnector() | ||
51 | { | ||
52 | } | ||
53 | 47 | ||
54 | public UserServicesConnector(string serverURI) | 48 | public Type ReplaceableInterface |
55 | { | 49 | { |
56 | // m_ServerURI = serverURI.TrimEnd('/'); | 50 | get { return null; } |
57 | } | 51 | } |
58 | 52 | ||
59 | public UserServicesConnector(IConfigSource source) | 53 | public string Name |
60 | { | 54 | { |
61 | Initialise(source); | 55 | get { return "RemoteUserAccountServicesConnector"; } |
62 | } | 56 | } |
63 | 57 | ||
64 | public virtual void Initialise(IConfigSource source) | 58 | public override void Initialise(IConfigSource source) |
65 | { | 59 | { |
66 | IConfig assetConfig = source.Configs["UserService"]; | 60 | IConfig moduleConfig = source.Configs["Modules"]; |
67 | if (assetConfig == null) | 61 | if (moduleConfig != null) |
68 | { | 62 | { |
69 | m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini"); | 63 | string name = moduleConfig.GetString("UserServices", ""); |
70 | throw new Exception("User connector init error"); | 64 | if (name == Name) |
71 | } | 65 | { |
66 | IConfig userConfig = source.Configs["UserService"]; | ||
67 | if (userConfig == null) | ||
68 | { | ||
69 | m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini"); | ||
70 | return; | ||
71 | } | ||
72 | 72 | ||
73 | string serviceURI = assetConfig.GetString("UserServerURI", | 73 | m_Enabled = true; |
74 | String.Empty); | ||
75 | 74 | ||
76 | if (serviceURI == String.Empty) | 75 | base.Initialise(source); |
77 | { | 76 | |
78 | m_log.Error("[USER CONNECTOR]: No Server URI named in section UserService"); | 77 | m_log.Info("[USER CONNECTOR]: Remote users enabled"); |
79 | throw new Exception("User connector init error"); | 78 | } |
80 | } | 79 | } |
81 | //m_ServerURI = serviceURI; | ||
82 | } | 80 | } |
83 | 81 | ||
84 | public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) | 82 | public void PostInitialise() |
85 | { | 83 | { |
86 | return null; | 84 | if (!m_Enabled) |
85 | return; | ||
87 | } | 86 | } |
88 | 87 | ||
89 | public UserAccount GetUserAccount(UUID scopeID, string email) | 88 | public void Close() |
90 | { | 89 | { |
91 | return null; | 90 | if (!m_Enabled) |
92 | } | 91 | return; |
93 | |||
94 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) | ||
95 | { | ||
96 | return null; | ||
97 | } | 92 | } |
98 | 93 | ||
99 | public bool SetUserAccount(UserAccount data) | 94 | public void AddRegion(Scene scene) |
100 | { | 95 | { |
101 | return false; | 96 | if (!m_Enabled) |
97 | return; | ||
98 | |||
99 | scene.RegisterModuleInterface<IUserAccountService>(this); | ||
102 | } | 100 | } |
103 | 101 | ||
104 | public bool CreateUserAccount(UserAccount data) | 102 | public void RemoveRegion(Scene scene) |
105 | { | 103 | { |
106 | return false; | 104 | if (!m_Enabled) |
105 | return; | ||
107 | } | 106 | } |
108 | 107 | ||
109 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 108 | public void RegionLoaded(Scene scene) |
110 | { | 109 | { |
111 | return null; | 110 | if (!m_Enabled) |
111 | return; | ||
112 | } | 112 | } |
113 | } | 113 | } |
114 | } | 114 | } |