From 28702f585f632da43bcee2ca0d4c7a59fe036543 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 2 Jan 2010 15:07:38 -0800
Subject: * Avatar service connectors all in place, but untested. * Fixed a
typo in RemoteUserAccountServiceConnector module.
---
.../Resources/CoreModulePlugin.addin.xml | 2 +
.../Avatar/LocalAvatarServiceConnector.cs | 168 +++++++++++++++++++++
.../Avatar/RemoteAvatarServiceConnector.cs | 114 ++++++++++++++
.../RemoteUserAccountServiceConnector.cs | 6 +-
4 files changed, 287 insertions(+), 3 deletions(-)
create mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
create mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 5f5dc02..8b831a5 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -32,6 +32,8 @@
+
+
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
new file mode 100644
index 0000000..0c8ee61
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using log4net;
+using Nini.Config;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Server.Base;
+using OpenSim.Services.Interfaces;
+
+using OpenMetaverse;
+
+namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
+{
+ public class LocalAvatarServicesConnector : ISharedRegionModule, IAvatarService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ private IAvatarService m_AvatarService;
+
+ private bool m_Enabled = false;
+
+ #region ISharedRegionModule
+
+ public Type ReplaceableInterface
+ {
+ get { return null; }
+ }
+
+ public string Name
+ {
+ get { return "LocalAvatarServicesConnector"; }
+ }
+
+ public void Initialise(IConfigSource source)
+ {
+ IConfig moduleConfig = source.Configs["Modules"];
+ if (moduleConfig != null)
+ {
+ string name = moduleConfig.GetString("AvatarServices", "");
+ if (name == Name)
+ {
+ IConfig userConfig = source.Configs["AvatarService"];
+ if (userConfig == null)
+ {
+ m_log.Error("[USER CONNECTOR]: AvatarService missing from OpenSim.ini");
+ return;
+ }
+
+ string serviceDll = userConfig.GetString("LocalServiceModule",
+ String.Empty);
+
+ if (serviceDll == String.Empty)
+ {
+ m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section AvatarService");
+ return;
+ }
+
+ Object[] args = new Object[] { source };
+ m_AvatarService =
+ ServerUtils.LoadPlugin(serviceDll,
+ args);
+
+ if (m_AvatarService == null)
+ {
+ m_log.Error("[USER CONNECTOR]: Can't load user account service");
+ return;
+ }
+ m_Enabled = true;
+ m_log.Info("[USER CONNECTOR]: Local avatar connector enabled");
+ }
+ }
+ }
+
+ public void PostInitialise()
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void Close()
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void AddRegion(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+
+ scene.RegisterModuleInterface(m_AvatarService);
+ }
+
+ public void RemoveRegion(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void RegionLoaded(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ #endregion
+
+ #region IAvatarService
+
+ public AvatarData GetAvatar(UUID userID)
+ {
+ return m_AvatarService.GetAvatar(userID);
+ }
+
+ public bool SetAvatar(UUID userID, AvatarData avatar)
+ {
+ return m_AvatarService.SetAvatar(userID, avatar);
+ }
+
+ public bool ResetAvatar(UUID userID)
+ {
+ return m_AvatarService.ResetAvatar(userID);
+ }
+
+ public bool SetItems(UUID userID, string[] names, string[] values)
+ {
+ return m_AvatarService.SetItems(userID, names, values);
+ }
+
+ public bool RemoveItems(UUID userID, string[] names)
+ {
+ return m_AvatarService.RemoveItems(userID, names);
+ }
+
+ #endregion
+
+ }
+}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs
new file mode 100644
index 0000000..48759b5
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using Nini.Config;
+using log4net;
+using System.Reflection;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Services.Interfaces;
+using OpenSim.Services.Connectors;
+
+namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
+{
+ public class RemoteAvatarServicesConnector : AvatarServicesConnector,
+ ISharedRegionModule, IAvatarService
+ {
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+
+ private bool m_Enabled = false;
+
+ public Type ReplaceableInterface
+ {
+ get { return null; }
+ }
+
+ public string Name
+ {
+ get { return "RemoteAvatarServicesConnector"; }
+ }
+
+ public override void Initialise(IConfigSource source)
+ {
+ IConfig moduleConfig = source.Configs["Modules"];
+ if (moduleConfig != null)
+ {
+ string name = moduleConfig.GetString("AvatarServices", "");
+ if (name == Name)
+ {
+ IConfig userConfig = source.Configs["AvatarService"];
+ if (userConfig == null)
+ {
+ m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpanSim.ini");
+ return;
+ }
+
+ m_Enabled = true;
+
+ base.Initialise(source);
+
+ m_log.Info("[AVATAR CONNECTOR]: Remote avatars enabled");
+ }
+ }
+ }
+
+ public void PostInitialise()
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void Close()
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void AddRegion(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+
+ scene.RegisterModuleInterface(this);
+ }
+
+ public void RemoveRegion(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+ }
+
+ public void RegionLoaded(Scene scene)
+ {
+ if (!m_Enabled)
+ return;
+ }
+ }
+}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
index d322aba..7d61b20 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs
@@ -60,13 +60,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
- string name = moduleConfig.GetString("UserServices", "");
+ string name = moduleConfig.GetString("UserAccountServices", "");
if (name == Name)
{
- IConfig userConfig = source.Configs["UserService"];
+ IConfig userConfig = source.Configs["UserAccountService"];
if (userConfig == null)
{
- m_log.Error("[USER CONNECTOR]: UserService missing from OpanSim.ini");
+ m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpanSim.ini");
return;
}
--
cgit v1.1