Agent gets there through the Gatekeeper, but still a few quirks to fix.

This commit is contained in:
Diva Canto
2010-01-17 18:04:55 -08:00
parent 5e034f5933
commit b2e6ec9e12
16 changed files with 561 additions and 95 deletions

View File

@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ISimulationService m_SimulationService;
public AgentHandler() { }
public AgentHandler(ISimulationService sim)
{
m_SimulationService = sim;
@@ -117,7 +119,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
{
OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null)
@@ -171,7 +173,8 @@ namespace OpenSim.Server.Handlers.Simulation
// This is the meaning of POST agent
//m_regionClient.AdjustUserInformation(aCircuit);
bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
//bool result = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
bool result = CreateAgent(destination, aCircuit, teleportFlags, out reason);
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);
@@ -181,7 +184,13 @@ namespace OpenSim.Server.Handlers.Simulation
responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
}
protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata)
// subclasses can override this
protected virtual bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
{
return m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
}
protected void DoAgentPut(Hashtable request, Hashtable responsedata)
{
OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null)
@@ -237,7 +246,7 @@ namespace OpenSim.Server.Handlers.Simulation
//agent.Dump();
// This is one of the meanings of PUT agent
result = m_SimulationService.UpdateAgent(destination, agent);
result = UpdateAgent(destination, agent);
}
else if ("AgentPosition".Equals(messageType))
@@ -263,6 +272,12 @@ namespace OpenSim.Server.Handlers.Simulation
//responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); ??? instead
}
// subclasses cab override this
protected virtual bool UpdateAgent(GridRegion destination, AgentData agent)
{
return m_SimulationService.UpdateAgent(destination, agent);
}
protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
{
GridRegion destination = new GridRegion();
@@ -305,7 +320,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
}
protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID)
{
m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID);
@@ -313,7 +328,7 @@ namespace OpenSim.Server.Handlers.Simulation
destination.RegionID = regionID;
if (action.Equals("release"))
m_SimulationService.ReleaseAgent(regionID, id, "");
ReleaseAgent(regionID, id);
else
m_SimulationService.CloseAgent(destination, id);
@@ -322,6 +337,11 @@ namespace OpenSim.Server.Handlers.Simulation
m_log.Debug("[AGENT HANDLER]: Agent Released/Deleted.");
}
protected virtual void ReleaseAgent(UUID regionID, UUID id)
{
m_SimulationService.ReleaseAgent(regionID, id, "");
}
}
}

View File

@@ -52,6 +52,8 @@ namespace OpenSim.Server.Handlers.Simulation
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ISimulationService m_SimulationService;
public ObjectHandler() { }
public ObjectHandler(ISimulationService sim)
{
m_SimulationService = sim;
@@ -110,7 +112,7 @@ namespace OpenSim.Server.Handlers.Simulation
}
protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID)
protected void DoObjectPost(Hashtable request, Hashtable responsedata, UUID regionID)
{
OSDMap args = Utils.GetOSDMap((string)request["body"]);
if (args == null)
@@ -181,7 +183,7 @@ namespace OpenSim.Server.Handlers.Simulation
try
{
// This is the meaning of POST object
result = m_SimulationService.CreateObject(destination, sog, false);
result = CreateObject(destination, sog);
}
catch (Exception e)
{
@@ -192,6 +194,12 @@ namespace OpenSim.Server.Handlers.Simulation
responsedata["str_response_string"] = result.ToString();
}
// subclasses can override this
protected virtual bool CreateObject(GridRegion destination, ISceneObject sog)
{
return m_SimulationService.CreateObject(destination, sog, false);
}
protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID)
{
OSDMap args = Utils.GetOSDMap((string)request["body"]);