mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Added new REST protocol (partially complete)
Made sim profiles load from DB Updated build files for grid server Added sim login
This commit is contained in:
@@ -56,8 +56,13 @@ namespace OpenGridServices.GridServer
|
||||
MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Spawned main thread OK");
|
||||
Listener = new HttpListener();
|
||||
|
||||
Listener.Prefixes.Add("http://+:8001/gridserver/");
|
||||
Listener.Prefixes.Add("http://+:8001/sims/");
|
||||
Listener.Prefixes.Add("http://+:8001/gods/");
|
||||
Listener.Prefixes.Add("http://+:8001/highestuuid/");
|
||||
Listener.Prefixes.Add("http://+:8001/uuidblocks/");
|
||||
Listener.Start();
|
||||
|
||||
MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Successfully bound to port 8001");
|
||||
|
||||
HttpListenerContext context;
|
||||
while(true) {
|
||||
@@ -66,72 +71,105 @@ namespace OpenGridServices.GridServer
|
||||
}
|
||||
}
|
||||
|
||||
static string ParseXMLRPC(string requestBody) {
|
||||
static string ParseXMLRPC(string requestBody, string referrer) {
|
||||
try{
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
|
||||
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
switch(request.MethodName) {
|
||||
case "get_sim_info":
|
||||
ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]);
|
||||
SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle);
|
||||
string RecvKey="";
|
||||
string caller=(string)requestData["caller"];
|
||||
switch(caller) {
|
||||
case "userserver":
|
||||
RecvKey=OpenGrid_Main.thegrid.UserRecvKey;
|
||||
break;
|
||||
case "assetserver":
|
||||
RecvKey=OpenGrid_Main.thegrid.AssetRecvKey;
|
||||
break;
|
||||
}
|
||||
if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) {
|
||||
XmlRpcResponse SimInfoResp = new XmlRpcResponse();
|
||||
Hashtable SimInfoData = new Hashtable();
|
||||
SimInfoData["UUID"]=TheSim.UUID.ToString();
|
||||
SimInfoData["regionhandle"]=TheSim.regionhandle.ToString();
|
||||
SimInfoData["regionname"]=TheSim.regionname;
|
||||
SimInfoData["sim_ip"]=TheSim.sim_ip;
|
||||
SimInfoData["sim_port"]=TheSim.sim_port.ToString();
|
||||
SimInfoData["caps_url"]=TheSim.caps_url;
|
||||
SimInfoData["RegionLocX"]=TheSim.RegionLocX.ToString();
|
||||
SimInfoData["RegionLocY"]=TheSim.RegionLocY.ToString();
|
||||
SimInfoData["sendkey"]=TheSim.sendkey;
|
||||
SimInfoData["recvkey"]=TheSim.recvkey;
|
||||
SimInfoResp.Value=SimInfoData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp),"utf-16","utf-8"));
|
||||
} else {
|
||||
XmlRpcResponse SimErrorResp = new XmlRpcResponse();
|
||||
Hashtable SimErrorData = new Hashtable();
|
||||
SimErrorData["error"]="sim not found";
|
||||
SimErrorResp.Value=SimErrorData;
|
||||
return(XmlRpcResponseSerializer.Singleton.Serialize(SimErrorResp));
|
||||
}
|
||||
break;
|
||||
}
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
switch(request.MethodName) {
|
||||
case "simulator_login":
|
||||
if(!(referrer=="simulator")) {
|
||||
XmlRpcResponse ErrorResp = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["error"]="Only simulators can login with this method";
|
||||
ErrorResp.Value=ErrorRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8"));
|
||||
}
|
||||
|
||||
if(!((string)requestData["authkey"]==OpenGrid_Main.thegrid.SimRecvKey)) {
|
||||
XmlRpcResponse ErrorResp = new XmlRpcResponse();
|
||||
Hashtable ErrorRespData = new Hashtable();
|
||||
ErrorRespData["error"]="invalid key";
|
||||
ErrorResp.Value=ErrorRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8"));
|
||||
}
|
||||
|
||||
SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(new LLUUID((string)requestData["UUID"]));
|
||||
XmlRpcResponse SimLoginResp = new XmlRpcResponse();
|
||||
Hashtable SimLoginRespData = new Hashtable();
|
||||
|
||||
ArrayList SimNeighboursData = new ArrayList();
|
||||
|
||||
SimProfileBase neighbour;
|
||||
Hashtable NeighbourBlock;
|
||||
for(int x=-1; x<2; x++) for(int y=-1; y<2; y++) {
|
||||
if(OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256))!=null) {
|
||||
neighbour=OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256));
|
||||
NeighbourBlock = new Hashtable();
|
||||
NeighbourBlock["sim_ip"] = neighbour.sim_ip;
|
||||
NeighbourBlock["sim_port"] = neighbour.sim_port.ToString();
|
||||
NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString();
|
||||
NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString();
|
||||
NeighbourBlock["UUID"] = neighbour.UUID.ToString();
|
||||
SimNeighboursData.Add(NeighbourBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SimLoginRespData["region_locx"]=TheSim.RegionLocX.ToString();
|
||||
SimLoginRespData["region_locy"]=TheSim.RegionLocY.ToString();
|
||||
SimLoginRespData["regionname"]=TheSim.regionname;
|
||||
SimLoginRespData["estate_id"]="1";
|
||||
SimLoginRespData["neighbours"]=SimNeighboursData;
|
||||
SimLoginRespData["asset_url"]=OpenGrid_Main.thegrid.DefaultAssetServer;
|
||||
SimLoginRespData["asset_sendkey"]=OpenGrid_Main.thegrid.AssetSendKey;
|
||||
SimLoginRespData["asset_recvkey"]=OpenGrid_Main.thegrid.AssetRecvKey;
|
||||
SimLoginRespData["user_url"]=OpenGrid_Main.thegrid.DefaultUserServer;
|
||||
SimLoginRespData["user_sendkey"]=OpenGrid_Main.thegrid.UserSendKey;
|
||||
SimLoginRespData["user_recvkey"]=OpenGrid_Main.thegrid.UserRecvKey;
|
||||
SimLoginRespData["authkey"]=OpenGrid_Main.thegrid.SimSendKey;
|
||||
SimLoginResp.Value=SimLoginRespData;
|
||||
return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimLoginResp),"utf-16","utf-8"));
|
||||
break;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static string ParseREST(string requestBody, string requestURL) {
|
||||
static string ParseREST(string requestBody, string requestURL, string HTTPmethod) {
|
||||
char[] splitter = {'/'};
|
||||
string[] rest_params = requestURL.Split(splitter);
|
||||
string req_type = rest_params[1]; // First part of the URL is the type of request -
|
||||
switch(req_type) {
|
||||
case "regions":
|
||||
ulong regionhandle = (ulong)Convert.ToInt64(rest_params[2]); // get usersessions/sessionid
|
||||
switch(rest_params[3]) {
|
||||
case "neighbours":
|
||||
return OpenGrid_Main.thegrid._regionmanager.GetXMLNeighbours(regionhandle);
|
||||
break;
|
||||
string req_type = rest_params[0]; // First part of the URL is the type of request -
|
||||
string respstring;
|
||||
switch(req_type) {
|
||||
case "sims":
|
||||
LLUUID UUID = new LLUUID((string)rest_params[1]);
|
||||
SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(UUID);
|
||||
if(!(TheSim==null)) {
|
||||
switch(HTTPmethod) {
|
||||
case "GET":
|
||||
respstring="<authkey>" + OpenGrid_Main.thegrid.SimSendKey + "</authkey>";
|
||||
respstring+="<sim>";
|
||||
respstring+="<uuid>" + TheSim.UUID.ToString() + "</uuid>";
|
||||
respstring+="<regionname>" + TheSim.regionname + "</regionname>";
|
||||
respstring+="<sim_ip>" + TheSim.sim_ip + "</sim_ip>";
|
||||
respstring+="<sim_port>" + TheSim.sim_port.ToString() + "</sim_port>";
|
||||
respstring+="<region_locx>" + TheSim.RegionLocX.ToString() + "</region_locx>";
|
||||
respstring+="<region_locy>" + TheSim.RegionLocY.ToString() + "</region_locy>";
|
||||
respstring+="<estate_id>1</estate_id>";
|
||||
respstring+="</sim>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "OK";
|
||||
break;
|
||||
}
|
||||
case "highestuuid":
|
||||
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -152,18 +190,20 @@ namespace OpenGridServices.GridServer
|
||||
body.Close();
|
||||
reader.Close();
|
||||
|
||||
// TODO: AUTHENTICATION!!!!!!!!! MUST ADD!!!!!!!!!! SCRIPT KIDDIES LOVE LACK OF IT!!!!!!!!!!
|
||||
|
||||
string responseString="";
|
||||
switch(request.ContentType) {
|
||||
case "text/xml":
|
||||
// must be XML-RPC, so pass to the XML-RPC parser
|
||||
|
||||
responseString=ParseXMLRPC(requestBody);
|
||||
responseString=ParseXMLRPC(requestBody,request.Headers["Referer"]);
|
||||
response.AddHeader("Content-type","text/xml");
|
||||
break;
|
||||
|
||||
case null:
|
||||
// must be REST or invalid crap, so pass to the REST parser
|
||||
responseString=ParseREST(request.Url.OriginalString,requestBody);
|
||||
responseString=ParseREST(request.Url.OriginalString,requestBody,request.HttpMethod);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace OpenGridServices.GridServer
|
||||
/// </summary>
|
||||
public class OpenGrid_Main : conscmd_callback
|
||||
{
|
||||
|
||||
public static OpenGrid_Main thegrid;
|
||||
public string GridOwner;
|
||||
public string DefaultStartupMsg;
|
||||
@@ -49,6 +48,9 @@ namespace OpenGridServices.GridServer
|
||||
public string DefaultUserServer;
|
||||
public string UserSendKey;
|
||||
public string UserRecvKey;
|
||||
public string SimSendKey;
|
||||
public string SimRecvKey;
|
||||
public LLUUID highestUUID;
|
||||
|
||||
public GridHTTPServer _httpd;
|
||||
public SimProfileManager _regionmanager;
|
||||
@@ -97,11 +99,16 @@ namespace OpenGridServices.GridServer
|
||||
this.UserSendKey = m_console.CmdPrompt("Key to send to user server: ");
|
||||
this.UserRecvKey = m_console.CmdPrompt("Key to expect from user server: ");
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
||||
this.SimSendKey = m_console.CmdPrompt("Key to send to sims: ");
|
||||
this.SimRecvKey = m_console.CmdPrompt("Key to expect from sims: ");
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database");
|
||||
this._regionmanager = new SimProfileManager();
|
||||
_regionmanager.LoadProfiles();
|
||||
|
||||
m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
|
||||
_httpd = new GridHTTPServer();
|
||||
|
||||
this._regionmanager = new SimProfileManager();
|
||||
_regionmanager.CreateNewProfile("OpenSim Test", "http://there-is-no-caps.com", "4.78.190.75", 9000, 997, 996, this.UserSendKey, this.UserRecvKey);
|
||||
}
|
||||
|
||||
public void RunCmd(string cmd, string[] cmdparams)
|
||||
|
||||
@@ -1,113 +1,117 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{21BFC8E2-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenGridServices.GridServer</AssemblyName>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<RootNamespace>OpenGridServices.GridServer</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" >
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" >
|
||||
<HintPath>System.Data.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj">
|
||||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GridHttp.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SimProfiles.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{53A65EE9-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenGridServices.GridServer</AssemblyName>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<RootNamespace>OpenGridServices.GridServer</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>../bin/</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
<OutputPath>../bin/</OutputPath>
|
||||
<RegisterForComInterop>False</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" >
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" >
|
||||
<HintPath>System.Data.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<HintPath>..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Db4objects.Db4o.dll" >
|
||||
<HintPath>..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../OpenSim.Framework/OpenSim.Framework.csproj">
|
||||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{7404933D-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="../OpenSim.Framework.Console/OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{16759386-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GridHttp.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SimProfiles.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties/AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,47 +1,48 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="OpenGridServices.GridServer" default="build">
|
||||
<target name="build">
|
||||
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||
<fileset basedir="${project::get-base-directory()}">
|
||||
</fileset>
|
||||
</copy>
|
||||
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
|
||||
<resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
|
||||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="GridHttp.cs" />
|
||||
<include name="Main.cs" />
|
||||
<include name="SimProfiles.cs" />
|
||||
<include name="Properties/AssemblyInfo.cs" />
|
||||
</sources>
|
||||
<references basedir="${project::get-base-directory()}">
|
||||
<lib>
|
||||
<include name="${project::get-base-directory()}" />
|
||||
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||
</lib>
|
||||
<include name="System.dll" />
|
||||
<include name="System.Data.dll" />
|
||||
<include name="System.Xml.dll" />
|
||||
<include name="../bin/OpenSim.Framework.dll" />
|
||||
<include name="../bin/OpenSim.Framework.Console.dll" />
|
||||
<include name="../bin/libsecondlife.dll" />
|
||||
</references>
|
||||
</csc>
|
||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
|
||||
<mkdir dir="${project::get-base-directory()}/../bin/"/>
|
||||
<copy todir="${project::get-base-directory()}/../bin/">
|
||||
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||
<include name="*.dll"/>
|
||||
<include name="*.exe"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${bin.dir}" failonerror="false" />
|
||||
<delete dir="${obj.dir}" failonerror="false" />
|
||||
</target>
|
||||
<target name="doc" description="Creates documentation.">
|
||||
</target>
|
||||
</project>
|
||||
<?xml version="1.0" ?>
|
||||
<project name="OpenGridServices.GridServer" default="build">
|
||||
<target name="build">
|
||||
<echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
|
||||
<mkdir dir="${project::get-base-directory()}/${build.dir}" />
|
||||
<copy todir="${project::get-base-directory()}/${build.dir}">
|
||||
<fileset basedir="${project::get-base-directory()}">
|
||||
</fileset>
|
||||
</copy>
|
||||
<csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
|
||||
<resources prefix="OpenGridServices.GridServer" dynamicprefix="true" >
|
||||
</resources>
|
||||
<sources failonempty="true">
|
||||
<include name="GridHttp.cs" />
|
||||
<include name="Main.cs" />
|
||||
<include name="SimProfiles.cs" />
|
||||
<include name="Properties/AssemblyInfo.cs" />
|
||||
</sources>
|
||||
<references basedir="${project::get-base-directory()}">
|
||||
<lib>
|
||||
<include name="${project::get-base-directory()}" />
|
||||
<include name="${project::get-base-directory()}/${build.dir}" />
|
||||
</lib>
|
||||
<include name="System.dll" />
|
||||
<include name="System.Data.dll" />
|
||||
<include name="System.Xml.dll" />
|
||||
<include name="../bin/OpenSim.Framework.dll" />
|
||||
<include name="../bin/OpenSim.Framework.Console.dll" />
|
||||
<include name="../bin/libsecondlife.dll" />
|
||||
<include name="../bin/Db4objects.Db4o.dll" />
|
||||
</references>
|
||||
</csc>
|
||||
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
|
||||
<mkdir dir="${project::get-base-directory()}/../bin/"/>
|
||||
<copy todir="${project::get-base-directory()}/../bin/">
|
||||
<fileset basedir="${project::get-base-directory()}/${build.dir}/" >
|
||||
<include name="*.dll"/>
|
||||
<include name="*.exe"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${bin.dir}" failonerror="false" />
|
||||
<delete dir="${obj.dir}" failonerror="false" />
|
||||
</target>
|
||||
<target name="doc" description="Creates documentation.">
|
||||
</target>
|
||||
</project>
|
||||
|
||||
@@ -33,7 +33,9 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Utilities;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Sims;
|
||||
using Db4objects.Db4o;
|
||||
|
||||
namespace OpenGridServices.GridServer
|
||||
{
|
||||
@@ -46,8 +48,15 @@ namespace OpenGridServices.GridServer
|
||||
public SimProfileManager() {
|
||||
}
|
||||
|
||||
public void InitSimProfiles() {
|
||||
// TODO: need to load from database
|
||||
public void LoadProfiles() { // should abstract this out
|
||||
IObjectContainer db;
|
||||
db = Db4oFactory.OpenFile("simprofiles.yap");
|
||||
IObjectSet result = db.Get(typeof(SimProfileBase));
|
||||
foreach (SimProfileBase simprof in result) {
|
||||
SimProfiles.Add(simprof.UUID, simprof);
|
||||
}
|
||||
MainConsole.Instance.WriteLine("SimProfiles.Cs:LoadProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
|
||||
db.Close();
|
||||
}
|
||||
|
||||
public SimProfileBase GetProfileByHandle(ulong reqhandle) {
|
||||
|
||||
Reference in New Issue
Block a user