Remove some old work + add to config/init

integration
BlueWall 2012-04-04 15:07:19 -04:00
parent d2cd39d0d8
commit 4fa5fa5e08
4 changed files with 11 additions and 49 deletions

View File

@ -78,58 +78,25 @@ namespace OpenSim.Server.Handlers.Integration
switch (command) switch (command)
{ {
// agent // agent
case "verify_agent_ssession": case "foo":
return HandleVerifyAgentSession(request); break;
case "verify_agent_region": case "bar":
return FailureResult("Not Implemented"); break;
default: default:
m_log.DebugFormat("[IntegrationHandler]: unknown method {0} request {1}", command.Length, command); m_log.DebugFormat("[INTEGRATION HANDLER]: unknown method {0} request {1}", command.Length, command);
return FailureResult("IntegrationHandler: Unrecognized method requested!"); return FailureResult("IntegrationHandler: Unrecognized method requested!");
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[IntegrationHandler]: Exception {0}", e); m_log.DebugFormat("[INTEGRATION HANDLER]: Exception {0}", e);
} }
return FailureResult(); return FailureResult();
} }
#region Handlers
/// <summary>
/// Verifies the agent to external applications.
/// </summary>
/// <returns>
/// UUID of the agent.
/// </returns>
/// <param name='request'>
/// request - Send SecureSessionID and optionally Encoding=xml for xml Output
/// </param>
byte[] HandleVerifyAgentSession(OSDMap request)
{
UUID s_session = UUID.Zero;
if (!request.ContainsKey("SecureSessionID"))
return FailureResult();
if (!UUID.TryParse(request["SecureSessionID"].AsString(), out s_session))
return FailureResult();
PresenceInfo pinfo = m_IntegrationService.VerifyAgent(s_session);
OSDMap result = new OSDMap();
if (pinfo == null)
result["agent_id"] = OSD.FromUUID(UUID.Zero);
else
result["agent_id"] = OSD.FromString(pinfo.UserID.ToString());
return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(result));
}
#endregion Handlers
#region utility #region utility
private byte[] FailureResult() private byte[] FailureResult()
{ {

View File

@ -49,12 +49,5 @@ namespace OpenSim.Services.IntegrationService
m_log.InfoFormat("[INTEGRATION SERVICE]: Loaded"); m_log.InfoFormat("[INTEGRATION SERVICE]: Loaded");
} }
#region IIntegrationService implementation
public PresenceInfo VerifyAgent(UUID SecureSessionID)
{
return m_PresenceService.VerifyAgent(SecureSessionID);
}
#endregion
} }
} }

View File

@ -46,7 +46,7 @@ namespace OpenSim.Services.IntegrationService
[TypeExtensionPoint (Path="/OpenSim/IntegrationService", Name="IntegrationService")] [TypeExtensionPoint (Path="/OpenSim/IntegrationService", Name="IntegrationService")]
public interface IntegrationPlugin public interface IntegrationPlugin
{ {
void Init(IConfigSource config); void Init(IConfigSource config, IConfig data);
string Name{ get; } string Name{ get; }
string ConfigName { get; } string ConfigName { get; }
} }
@ -93,6 +93,9 @@ namespace OpenSim.Services.IntegrationService
return; return;
} }
// Send the default data service
IConfig DataService = config.Configs["DatabaseService"];
// Add a command to the console // Add a command to the console
if (MainConsole.Instance != null) if (MainConsole.Instance != null)
{ {
@ -116,7 +119,7 @@ namespace OpenSim.Services.IntegrationService
// We maintain a configuration per-plugin to enhance modularity // We maintain a configuration per-plugin to enhance modularity
// If ConfigSource is null, we will get the default from the repo // If ConfigSource is null, we will get the default from the repo
// and write it to our directory // and write it to our directory
cmd.Init (ConfigSource); cmd.Init (ConfigSource, DataService);
server.AddStreamHandler((IRequestHandler)cmd); server.AddStreamHandler((IRequestHandler)cmd);
m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name); m_log.InfoFormat("[INTEGRATION SERVICE]: Loading IntegrationService plugin {0}", cmd.Name);
} }

View File

@ -36,7 +36,6 @@ namespace OpenSim.Services.Interfaces
{ {
public interface IIntegrationService public interface IIntegrationService
{ {
PresenceInfo VerifyAgent(UUID SecretSessionID);
} }
} }