aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut
diff options
context:
space:
mode:
authorMelanie2010-03-06 11:58:19 +0000
committerMelanie2010-03-06 11:58:19 +0000
commit9fa9cfd2154fb1225b5b96ad26d7284d446f9961 (patch)
tree2a0f1ba9ea7bfb211819fbb9946315cb89a9d828 /OpenSim/Region/CoreModules/ServiceConnectorsOut
parent- implementing server 1.38 functions (diff)
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.zip
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.gz
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.bz2
opensim-SC_OLD-9fa9cfd2154fb1225b5b96ad26d7284d446f9961.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs139
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs13
3 files changed, 157 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs
new file mode 100644
index 0000000..d5fae23
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs
@@ -0,0 +1,139 @@
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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
32using Nini.Config;
33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37
38using OpenMetaverse;
39
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
41{
42 public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService
43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45
46 private IGridUserService m_service;
47
48 private bool m_Enabled = false;
49
50 public Type ReplaceableInterface
51 {
52 get { return null; }
53 }
54
55 public string Name
56 {
57 get { return "LocalGridUserServicesConnector"; }
58 }
59
60 public void Initialise(IConfigSource source)
61 {
62 IConfig moduleConfig = source.Configs["Modules"];
63 if (moduleConfig != null)
64 {
65 string name = moduleConfig.GetString("GridUserServices", "");
66 if (name == Name)
67 {
68 IConfig userConfig = source.Configs["GridUserService"];
69 if (userConfig == null)
70 {
71 m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: GridUserService missing from ini files");
72 return;
73 }
74
75 string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty);
76
77 if (serviceDll == String.Empty)
78 {
79 m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: No LocalServiceModule named in section GridUserService");
80 return;
81 }
82
83 Object[] args = new Object[] { source };
84 m_service = ServerUtils.LoadPlugin<IGridUserService>(serviceDll, args);
85
86 if (m_service == null)
87 {
88 m_log.Error("[LOCAL GRID USER SERVICE CONNECTOR]: Can't load GridUser service");
89 return;
90 }
91 m_Enabled = true;
92 m_log.Info("[LOCAL GRID USER SERVICE CONNECTOR]: Local GridUser connector enabled");
93 }
94 }
95 }
96
97 public void PostInitialise()
98 {
99 if (!m_Enabled)
100 return;
101 }
102
103 public void Close()
104 {
105 if (!m_Enabled)
106 return;
107 }
108
109 public void AddRegion(Scene scene)
110 {
111 if (!m_Enabled)
112 return;
113
114 scene.RegisterModuleInterface<IGridUserService>(m_service);
115 }
116
117 public void RemoveRegion(Scene scene)
118 {
119 if (!m_Enabled)
120 return;
121 }
122
123 public void RegionLoaded(Scene scene)
124 {
125 if (!m_Enabled)
126 return;
127 }
128
129 public GridUserInfo GetGridUserInfo(string userID)
130 {
131 return m_service.GetGridUserInfo(userID);
132 }
133
134 public bool StoreGridUserInfo(GridUserInfo info)
135 {
136 return m_service.StoreGridUserInfo(info);
137 }
138 }
139} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs
index d78daf9..c402a3f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs
@@ -47,7 +47,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
47 private bool m_Enabled = false; 47 private bool m_Enabled = false;
48 48
49 private PresenceDetector m_PresenceDetector; 49 private PresenceDetector m_PresenceDetector;
50 private IPresenceService m_PresenceService; 50
51 /// <summary>
52 /// Underlying presence service. Do not use directly.
53 /// </summary>
54 public IPresenceService m_PresenceService;
51 55
52 public LocalPresenceServicesConnector() 56 public LocalPresenceServicesConnector()
53 { 57 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
index ca42461..292ff8e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
@@ -59,6 +59,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
59 config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 59 config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
60 60
61 m_LocalConnector = new LocalPresenceServicesConnector(config); 61 m_LocalConnector = new LocalPresenceServicesConnector(config);
62
63 // Let's stick in a test presence
64 m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero);
62 } 65 }
63 66
64 /// <summary> 67 /// <summary>
@@ -68,6 +71,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
68 public void TestPresenceV0_1() 71 public void TestPresenceV0_1()
69 { 72 {
70 SetUp(); 73 SetUp();
74
75 // Let's stick in a test presence
76 /*
77 PresenceData p = new PresenceData();
78 p.SessionID = UUID.Zero;
79 p.UserID = UUID.Zero.ToString();
80 p.Data = new Dictionary<string, string>();
81 p.Data["Online"] = true.ToString();
82 m_presenceData.Add(UUID.Zero, p);
83 */
71 84
72 string user1 = UUID.Zero.ToString(); 85 string user1 = UUID.Zero.ToString();
73 UUID session1 = UUID.Zero; 86 UUID session1 = UUID.Zero;