Initial stubs and code for quark/actor registration and lookup

dsg
Robert Adams 2011-02-02 17:34:53 -08:00
parent a7d4c974dd
commit 4a4ecb1cde
6 changed files with 216 additions and 0 deletions

View File

@ -256,5 +256,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
} }
} }
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public virtual bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi)
{
return m_GridService.RegisterActor(gai, lgqi);
}
public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi)
{
return m_GridService.RegisterActor(gai, gqi);
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi)
{
return m_GridService.LookupQuark(gqi);
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType)
{
return m_GridService.LookupQuark(gqi, actorType);
}
#endregion SYNC SERVER
} }
} }

View File

@ -288,5 +288,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return flags; return flags;
} }
#endregion #endregion
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public virtual bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi)
{
return m_RemoteGridService.RegisterActor(gai, lgqi);
}
public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi)
{
return m_RemoteGridService.RegisterActor(gai, gqi);
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi)
{
return LookupQuark(gqi);
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType)
{
return LookupQuark(gqi, actorType);
}
#endregion SYNC SERVER
} }
} }

View File

@ -653,5 +653,25 @@ namespace OpenSim.Services.Connectors
#endregion #endregion
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public virtual bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi)
{
return false;
}
public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi)
{
return false;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi)
{
return null;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType)
{
return null;
}
#endregion SYNC SERVER
} }
} }

View File

@ -432,5 +432,123 @@ namespace OpenSim.Services.Connectors.SimianGrid
return region; return region;
} }
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public virtual bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi)
{
OSDArray quarks = new OSDArray();
foreach (GridQuarkInfo gqi in lgqi)
{
OSDMap quarkMap = new OSDMap
{
{ "locX", OSD.FromInteger(gqi.locX) },
{ "locY", OSD.FromInteger(gqi.locY) }
};
quarks.Add(quarkMap);
}
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "RegisterActor" },
{ "actorID", gai.actorID },
{ "type", gai.type },
{ "address", gai.address },
{ "port", gai.port.ToString() },
{ "quarks", OSDParser.SerializeJsonString(quarks) }
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
return true;
}
return false;
}
public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi)
{
OSDMap quarkMap = new OSDMap
{
{ "locX", OSD.FromInteger(gqi.locX) },
{ "locY", OSD.FromInteger(gqi.locY) }
};
OSDArray quarks = new OSDArray();
quarks.Add(quarkMap);
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "RegisterActor" },
{ "actorID", gai.actorID },
{ "actorType", gai.type },
{ "address", gai.address },
{ "port", gai.port.ToString() },
{ "quarks", OSDParser.SerializeJsonString(quarks) }
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
return true;
}
return false;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "LookupQuark" },
{ "locX", gqi.locX.ToString() },
{ "locY", gqi.locY.ToString() }
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
List<GridActorInfo> lgai = new List<GridActorInfo>();
OSDArray gridActors = (OSDArray)response["actors"];
for (int ii = 0; ii < gridActors.Count; ii++)
{
OSDMap thisGridActor = (OSDMap)gridActors[ii];
GridActorInfo gai = new GridActorInfo();
gai.actorID = thisGridActor["actorID"].AsString();
gai.type = thisGridActor["actorType"].AsString();
gai.address = thisGridActor["address"].AsString();
gai.port = thisGridActor["port"].AsInteger();
lgai.Add(gai);
}
return lgai;
}
return null;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType)
{
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "LookupQuark" },
{ "locX", gqi.locX.ToString() },
{ "locY", gqi.locY.ToString() },
{ "actorType", actorType }
};
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
if (response["Success"].AsBoolean())
{
List<GridActorInfo> lgai = new List<GridActorInfo>();
OSDArray gridActors = (OSDArray)response["actors"];
for (int ii = 0; ii < gridActors.Count; ii++)
{
OSDMap thisGridActor = (OSDMap)gridActors[ii];
GridActorInfo gai = new GridActorInfo();
gai.actorID = thisGridActor["actorID"].AsString();
gai.type = thisGridActor["actorType"].AsString();
gai.address = thisGridActor["address"].AsString();
gai.port = thisGridActor["port"].AsInteger();
lgai.Add(gai);
}
return lgai;
}
return null;
}
#endregion SYNC SERVER
} }
} }

View File

@ -548,5 +548,25 @@ namespace OpenSim.Services.GridService
m_Database.Store(r); m_Database.Store(r);
} }
} }
#region SYNC SERVER
// Stubs for actor and quark management. Only implementation is in SimianGridService
public virtual bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi)
{
return false;
}
public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi)
{
return false;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi)
{
return null;
}
public virtual List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType)
{
return null;
}
#endregion SYNC SERVER
} }
} }

View File

@ -95,6 +95,24 @@ namespace OpenSim.Services.Interfaces
List<GridRegion> GetHyperlinks(UUID scopeID); List<GridRegion> GetHyperlinks(UUID scopeID);
int GetRegionFlags(UUID scopeID, UUID regionID); int GetRegionFlags(UUID scopeID, UUID regionID);
bool RegisterActor(GridActorInfo gai, List<GridQuarkInfo> lgqi);
bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi);
List<GridActorInfo> LookupQuark(GridQuarkInfo gqi);
List<GridActorInfo> LookupQuark(GridQuarkInfo gqi, string actorType);
}
public class GridQuarkInfo
{
public int locX;
public int locY;
}
public class GridActorInfo
{
public string address;
public int port;
public string type;
public string actorID;
} }
public class GridRegion : Object public class GridRegion : Object