Compare commits

...

15 Commits

Author SHA1 Message Date
BlueWall
f266e19243 automatic creation of ini form repository 2012-04-04 20:01:23 -04:00
BlueWall
e4a69297f6 Merge branch 'master' of /home/opensim/var/repo/opensim 2012-04-04 20:00:47 -04:00
BlueWall
4fa5fa5e08 Remove some old work + add to config/init 2012-04-04 15:07:19 -04:00
BlueWall
d2cd39d0d8 Adding configuration management to plugins 2012-04-04 14:15:52 -04:00
BlueWall
a4cb9639cc Merge branch 'master' of /home/opensim/var/repo/opensim 2012-04-04 09:26:29 -04:00
BlueWall
639c6bdd62 Add a delay to let regions load before calling PostInit
Something is letting PostInit fire before the regions are loaded. This small delay "fixes" it. Will continue to look for a way to make sure they are loaded first.
2012-04-03 14:50:26 -04:00
BlueWall
b3ecf935cd Update mono-addins 2012-04-02 22:50:13 -04:00
BlueWall
4c5b3adb96 Do some work on the plugin registry locations and configuration manager 2012-04-02 17:06:31 -04:00
BlueWall
335d167ead Added some logging 2012-04-02 00:48:36 -04:00
BlueWall
36daea4480 Added some utilities and copyright/license 2012-04-01 23:15:38 -04:00
BlueWall
5c92aa262a Pass server up to IntegrationService to allow pluggins to register their handlers 2012-04-01 15:58:26 -04:00
BlueWall
445caca18b Merge branch 'master' of /home/opensim/var/repo/opensim 2012-04-01 11:10:21 -04:00
BlueWall
4b90dcfb73 Missed these files 2012-04-01 11:05:05 -04:00
BlueWall
ade1acc9d4 Making IntegrationService pluggable
First steps to making a pluggable IntegrationService.
2012-04-01 09:38:59 -04:00
BlueWall
e8eb9b7e84 Add Integration Service
Adding an integration service to provide base services at endpoints for external application integration. So far, landtool.php is converted to use the IntegrationService. Others will follow to provide coverage for the base helperuri applications needed in OpenSim.
2012-03-31 17:57:58 -04:00
26 changed files with 887 additions and 4 deletions

View File

@@ -135,7 +135,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
}
}
}
//[TODO]: Temporary fix for an issue after the mono-addis upgrade
// PostInilise can fire before the region is loaded, so need to
// track down the cause of that
Thread.Sleep(300);
m_openSim.ModuleLoader.PostInitialise();
m_openSim.ModuleLoader.ClearCache();
}

View File

@@ -49,6 +49,7 @@ namespace OpenSim.Data
bool Store(PresenceData data);
PresenceData Get(UUID sessionID);
PresenceData Verify(UUID s_sessionID);
void LogoutRegionAgents(UUID regionID);
bool ReportAgent(UUID sessionID, UUID regionID);
PresenceData[] Get(string field, string data);

View File

@@ -61,6 +61,17 @@ namespace OpenSim.Data.MSSQL
return ret[0];
}
public PresenceData Verify(UUID s_sessionID)
{
PresenceData[] ret = Get("SecureSessionID",
s_sessionID.ToString());
if (ret.Length == 0)
return null;
return ret[0];
}
public void LogoutRegionAgents(UUID regionID)
{
using (SqlConnection conn = new SqlConnection(m_ConnectionString))

View File

@@ -61,6 +61,17 @@ namespace OpenSim.Data.MySQL
return ret[0];
}
public PresenceData Verify(UUID s_sessionID)
{
PresenceData[] ret = Get("SecureSessionID",
s_sessionID.ToString());
if (ret.Length == 0)
return null;
return ret[0];
}
public void LogoutRegionAgents(UUID regionID)
{
MySqlCommand cmd = new MySqlCommand();

View File

@@ -79,6 +79,19 @@ namespace OpenSim.Data.Null
return null;
}
public PresenceData Verify(UUID s_sessionID)
{
if (Instance != this)
return Instance.Verify(s_sessionID);
if (m_presenceData.ContainsKey(s_sessionID))
{
return m_presenceData[s_sessionID];
}
return null;
}
public void LogoutRegionAgents(UUID regionID)
{
if (Instance != this)

View File

@@ -193,6 +193,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return m_PresenceService.GetAgents(userIDs);
}
public PresenceInfo VerifyAgent(UUID s_sessionID)
{
return m_PresenceService.VerifyAgent(s_sessionID);
}
#endregion
}

View File

@@ -153,6 +153,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
return m_RemoteConnector.GetAgents(userIDs);
}
public PresenceInfo VerifyAgent(UUID sessionID)
{
return m_RemoteConnector.VerifyAgent(sessionID);
}
#endregion
}

View File

@@ -35,6 +35,7 @@ using System.Collections.Generic;
using log4net;
using OpenSim.Framework;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Base
{
@@ -330,5 +331,36 @@ namespace OpenSim.Server.Base
return ret;
}
public static bool ParseStringToOSDMap(string input, out OSDMap map)
{
try
{
map = null;
OSD tmpbuff = null;
try
{
tmpbuff = OSDParser.DeserializeJson(input);
}
catch
{
m_log.DebugFormat("[ServerUtils]: Parse Caught Error Deserializei {0} ", input);
return false;
}
if (tmpbuff.Type == OSDType.Map)
{
map = (OSDMap)tmpbuff;
return true;
}
else
return false;
}
catch (NullReferenceException e)
{
m_log.ErrorFormat("[ServerUtils]: exception on ParseStringToJson {0}", e.Message);
map = null;
return false;
}
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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 OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
using OpenSim.Framework;
namespace OpenSim.Server.Handlers.Integration
{
public class IntegrationServiceConnector : ServiceConnector
{
private IIntegrationService m_IntegrationService;
private string m_ConfigName = "IntegrationService";
public IntegrationServiceConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
string service = serverConfig.GetString("LocalServiceModule",
String.Empty);
if (service == String.Empty)
throw new Exception("No LocalServiceModule in config file");
Object[] args = new Object[] { config, server };
m_IntegrationService = ServerUtils.LoadPlugin<IIntegrationService>(service, args);
server.AddStreamHandler(new IntegrationServerHandler(m_IntegrationService));
}
}
}

View File

@@ -0,0 +1,121 @@
/*
* 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 OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using log4net;
using System;
using System.Reflection;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
namespace OpenSim.Server.Handlers.Integration
{
public class IntegrationServerHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IIntegrationService m_IntegrationService;
public IntegrationServerHandler(IIntegrationService service) :
base("POST", "/integration")
{
m_IntegrationService = service;
}
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
body = body.Trim();
try
{
OSDMap request = null;
if (ServerUtils.ParseStringToOSDMap(body, out request) == false)
return FailureResult();
// Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("command"))
return FailureResult("Error, no command defined!");
string command = request["command"].AsString();
// command...
switch (command)
{
// agent
case "foo":
break;
case "bar":
break;
default:
m_log.DebugFormat("[INTEGRATION HANDLER]: unknown method {0} request {1}", command.Length, command);
return FailureResult("IntegrationHandler: Unrecognized method requested!");
}
}
catch (Exception e)
{
m_log.DebugFormat("[INTEGRATION HANDLER]: Exception {0}", e);
}
return FailureResult();
}
#region utility
private byte[] FailureResult()
{
return FailureResult(String.Empty);
}
private byte[] FailureResult(string msg)
{
OSDMap doc = new OSDMap(2);
doc["Result"] = OSD.FromString("Failure");
doc["Message"] = OSD.FromString(msg);
return DocToBytes(doc);
}
private byte[] DocToBytes(OSDMap doc)
{
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(doc));
}
#endregion utility
}
}

View File

@@ -41,6 +41,7 @@ using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Handlers.Presence
{
@@ -244,7 +245,6 @@ namespace OpenSim.Server.Handlers.Presence
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
private byte[] SuccessResult()
{

View File

@@ -371,6 +371,49 @@ namespace OpenSim.Services.Connectors
return rinfos.ToArray();
}
public PresenceInfo VerifyAgent(UUID s_sessionID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
//sendData["SCOPEID"] = scopeID.ToString();
sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
sendData["METHOD"] = "verifyagent";
sendData["SecureSessionID"] = s_sessionID.ToString();
string reply = string.Empty;
string reqString = ServerUtils.BuildQueryString(sendData);
string uri = m_ServerURI + "/presence";
// m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString);
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri,
reqString);
if (reply == null || (reply != null && reply == string.Empty))
{
m_log.DebugFormat("[PRESENCE CONNECTOR]: VerifyAgent received null or empty reply");
return null;
}
}
catch (Exception e)
{
m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message);
}
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
PresenceInfo pinfo = null;
if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null))
{
if (replyData["result"] is Dictionary<string, object>)
{
pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]);
}
}
return pinfo;
}
#endregion

View File

@@ -260,6 +260,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
return null;
}
public PresenceInfo VerifyAgent(UUID s_sessionID)
{
// Not implemented
return null;
}
public bool LoggedOut(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt)
{
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Logging out user " + userID);

View File

@@ -0,0 +1,53 @@
/*
* 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.Reflection;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using Nini.Config;
using log4net;
namespace OpenSim.Services.IntegrationService
{
public class IntegrationService : IntegrationServiceBase, IIntegrationService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public IntegrationService(IConfigSource config, IHttpServer server)
: base(config, server)
{
m_log.InfoFormat("[INTEGRATION SERVICE]: Loaded");
}
}
}

View File

@@ -0,0 +1,215 @@
/*
* 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.IO;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Base;
using OpenSim.Framework.Servers.HttpServer;
using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using Mono.Addins;
using log4net;
using Ux = OpenSim.Services.IntegrationService.IUtils;
[assembly:AddinRoot ("IntegrationService", "1.0")]
namespace OpenSim.Services.IntegrationService
{
[TypeExtensionPoint (Path="/OpenSim/IntegrationService", Name="IntegrationService")]
public interface IntegrationPlugin
{
void Init(IConfigSource PluginConfig);
string Name{ get; }
string ConfigName { get; }
string DefaultConfig { get; }
}
public class IntegrationServiceBase : ServiceBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_ConfigName = "IntegrationService";
protected IPresenceService m_PresenceService;
protected IGridService m_GridService;
protected IHttpServer m_Server;
protected string m_IntegrationConfig;
IConfig m_IntegrationServerConfig;
string m_IntegrationConfigLoc;
public IntegrationServiceBase(IConfigSource config, IHttpServer server)
: base(config)
{
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
// defaults to the ./bin directory
string RegistryLocation = serverConfig.GetString("PluginRegistryLocation",
".");
// Deal with files only for now - will add url/environment later
m_IntegrationConfigLoc = serverConfig.GetString("IntegrationConfig", String.Empty);
if(String.IsNullOrEmpty(m_IntegrationConfigLoc))
m_log.Error("[INTEGRATION SERVICE]: No IntegrationConfig defined in the Robust.ini");
AddinManager.AddinLoaded += on_addinloaded_;
AddinManager.AddinLoadError += on_addinloaderror_;
m_Server = server;
m_IntegrationServerConfig = config.Configs["IntegrationService"];
if (m_IntegrationServerConfig == null)
{
throw new Exception("[INTEGRATION SERVICE]: Missing configuration");
return;
}
// Add a command to the console
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("Integration", true,
"show repos",
"show repos",
"Show list of registered plugin repositories",
String.Empty,
HandleShowRepos);
}
suppress_console_output_(true);
AddinManager.Initialize (RegistryLocation);
AddinManager.Registry.Update ();
suppress_console_output_(false);
foreach (IntegrationPlugin cmd in AddinManager.GetExtensionObjects("/OpenSim/IntegrationService"))
{
string ConfigPath = String.Format("{0}/(1)", m_IntegrationConfigLoc,cmd.ConfigName);
IConfigSource PlugConfig = Ux.GetConfigSource(m_IntegrationConfigLoc, cmd.ConfigName);
// Fetch the starter ini
if (PlugConfig == null)
{
m_log.InfoFormat("[INTEGRATION SERVICE]: Fetching starter config for {0} from {1}", cmd.Name, cmd.DefaultConfig);
// Send the default data service
IConfig DataService = config.Configs["DatabaseService"];
m_log.InfoFormat("[INTEGRATION SERVICE]: Writing initial config to {0}", cmd.ConfigName);
// FileStream fs = File.Create(Path.Combine(m_IntegrationConfigLoc,cmd.ConfigName));
// System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
// Byte[] buf = enc.GetBytes("; Automatically Generated Configuration - Edit for your installation\n" );
// fs.Write(buf, 0, buf.Length);
// fs.Close();
IniConfigSource source = new IniConfigSource();
IConfig Init = source.AddConfig("DatabaseService");
Init.Set("StorageProvider",(string)DataService.GetString("StorageProvider"));
Init.Set("ConnectionString", (string)DataService.GetString("ConnectionString"));
PlugConfig = Ux.LoadInitialConfig(cmd.DefaultConfig);
source.Merge(PlugConfig);
source.Save(Path.Combine(m_IntegrationConfigLoc, cmd.ConfigName));
PlugConfig = source;
}
// We maintain a configuration per-plugin to enhance modularity
// If ConfigSource is null, we will get the default from the repo
// and write it to our directory
cmd.Init (PlugConfig);
server.AddStreamHandler((IRequestHandler)cmd);
m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name);
}
}
private IConfigSource GetConfig(string configName)
{
return new IniConfigSource();
}
private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
{
if (args.Exception == null)
m_log.Error ("[INTEGRATION SERVICE]: Plugin Error: "
+ args.Message);
else
m_log.Error ("[INTEGRATION SERVICE]: Plugin Error: "
+ args.Exception.Message + "\n"
+ args.Exception.StackTrace);
}
private void on_addinloaded_(object sender, AddinEventArgs args)
{
m_log.Info ("[INTEGRATION SERVICE]: Plugin Loaded: " + args.AddinId);
}
private static TextWriter prev_console_;
public void suppress_console_output_(bool save)
{
if (save)
{
prev_console_ = System.Console.Out;
System.Console.SetOut(new StreamWriter(Stream.Null));
}
else
{
if (prev_console_ != null)
System.Console.SetOut(prev_console_);
}
}
#region console handlers
private void HandleShowRepos(string module, string[] cmd)
{
if ( cmd.Length < 2 )
{
MainConsole.Instance.Output("Syntax: show repos");
return;
}
// List<UserData> list = m_Database.ListNames();
//
// foreach (UserData name in list)
// {
// MainConsole.Instance.Output(String.Format("{0} {1}",name.FirstName, name.LastName));
// }
}
#endregion
}
}

View File

@@ -0,0 +1,153 @@
/*
* 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.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using log4net;
using Nini.Config;
using OpenMetaverse.StructuredData;
namespace OpenSim.Services.IntegrationService
{
public static class IUtils
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region web utils
public static bool ParseStringToOSDMap(string input, out OSDMap json)
{
try
{
json = null;
OSD tmpbuff = null;
try
{
tmpbuff = OSDParser.DeserializeJson(input.ToString());
}
catch
{
return false;
}
if (tmpbuff.Type == OSDType.Map)
{
json = (OSDMap)tmpbuff;
return true;
} else
return false;
}
catch (NullReferenceException e)
{
m_log.ErrorFormat("[IUtil]: exception on ParseStringToJson {0}", e.Message);
json = null;
return false;
}
}
public static byte[] FailureResult()
{
return FailureResult(String.Empty);
}
public static byte[] FailureResult(string msg)
{
OSDMap doc = new OSDMap(2);
doc["Result"] = OSD.FromString("Failure");
doc["Message"] = OSD.FromString(msg);
return DocToBytes(doc);
}
public static byte[] ResponseMessage(string message)
{
OSDMap doc = new OSDMap(2);
doc["Result"] = OSD.FromString("Success");
doc["Message"] = OSD.FromString(message);
return DocToBytes(doc);
}
public static byte[] DocToBytes(OSDMap doc)
{
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(doc));
}
#endregion web utils
#region config utils
public static IConfigSource GetConfigSource(string IniPath, string IniName)
{
string configFilePath = Path.GetFullPath(
Path.Combine(IniPath, IniName));
if (File.Exists(configFilePath))
{
IConfigSource config = new IniConfigSource(configFilePath);
return config;
}
else
{
return null;
}
}
public static IConfigSource LoadInitialConfig(string url)
{
IConfigSource source = new XmlConfigSource();
m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url);
// The ini file path is a http URI
// Try to read it
try
{
XmlReader r = XmlReader.Create(url);
IConfigSource cs = new XmlConfigSource(r);
source.Merge(cs);
}
catch (Exception e)
{
m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url);
Environment.Exit(1);
}
return source;
}
#endregion config utils
public static T LoadPlugin<T>(string dllName, Object[] args) where T:class
{
return OpenSim.Server.Base.ServerUtils.LoadPlugin<T>(dllName, args);
}
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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 Mono.Addins;
using Mono.Addins.Setup;
namespace OpenSim.Services.IntegrationService
{
// This will maintain the plugin repositories and plugins
}

View File

@@ -0,0 +1,41 @@
/*
* 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;
using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
namespace OpenSim.Services.Interfaces
{
public interface IIntegrationService
{
}
}

View File

@@ -68,6 +68,7 @@ namespace OpenSim.Services.Interfaces
bool ReportAgent(UUID sessionID, UUID regionID);
PresenceInfo GetAgent(UUID sessionID);
PresenceInfo VerifyAgent(UUID s_sessionID);
PresenceInfo[] GetAgents(string[] userIDs);
}
}

View File

@@ -158,5 +158,19 @@ namespace OpenSim.Services.PresenceService
return info.ToArray();
}
public PresenceInfo VerifyAgent(UUID s_sessionID)
{
PresenceInfo ret = new PresenceInfo();
PresenceData data = m_Database.Verify(s_sessionID);
if (data == null)
return null;
ret.UserID = data.UserID;
ret.RegionID = data.RegionID;
return ret;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -21,7 +21,7 @@
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; *
[Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector,8002/OpenSim.Server.Handlers:IntegrationServiceConnector"
; * This is common for all services, it's the network setup for the entire
; * server instance, if none is specified above
@@ -426,3 +426,9 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
;; This applies to the core groups module (Flotsam) only.
; ForwardOfflineGroupMessages = true
[IntegrationService]
LocalServiceModule = "OpenSim.Services.IntegrationService.dll:IntegrationService"
GridService = "OpenSim.Services.GridService.dll:GridService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"

View File

@@ -13,7 +13,7 @@
; * [[<ConfigName>@]<port>/]<dll name>[:<class name>]
; *
[Startup]
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector"
ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector,8002/OpenSim.Server.Handlers:IntegrationServiceConnector"
; * This is common for all services, it's the network setup for the entire
; * server instance, if none is specified above
@@ -294,3 +294,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
; password help: optional: page providing password assistance for users of your grid
;password = http://127.0.0.1/password
[IntegrationService]
LocalServiceModule = "OpenSim.Services.IntegrationService.dll:IntegrationService"
GridService = "OpenSim.Services.GridService.dll:GridService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"

View File

@@ -787,6 +787,7 @@
<Reference name="System.Xml"/>
<Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
@@ -1150,6 +1151,44 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Services.IntegrationService" path="OpenSim/Services/IntegrationService" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService" path="OpenSim/Services/InventoryService" type="Library">
<Configuration name="Debug">
<Options>