diff options
author | gareth | 2007-04-02 00:48:25 +0000 |
---|---|---|
committer | gareth | 2007-04-02 00:48:25 +0000 |
commit | e985e05a5ad7df4c5f01763dfe6b82cc1b37ab83 (patch) | |
tree | 7b07b8fae3ade588d11cdeeabf1f2479e80a8dff /OpenGridServices.GridServer | |
parent | More refactoring (diff) | |
download | opensim-SC-e985e05a5ad7df4c5f01763dfe6b82cc1b37ab83.zip opensim-SC-e985e05a5ad7df4c5f01763dfe6b82cc1b37ab83.tar.gz opensim-SC-e985e05a5ad7df4c5f01763dfe6b82cc1b37ab83.tar.bz2 opensim-SC-e985e05a5ad7df4c5f01763dfe6b82cc1b37ab83.tar.xz |
Added new REST protocol (partially complete)
Made sim profiles load from DB
Updated build files for grid server
Added sim login
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices.GridServer/GridHttp.cs | 152 | ||||
-rw-r--r-- | OpenGridServices.GridServer/Main.cs | 15 | ||||
-rw-r--r-- | OpenGridServices.GridServer/OpenGridServices.GridServer.csproj | 230 | ||||
-rw-r--r-- | OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build | 95 | ||||
-rw-r--r-- | OpenGridServices.GridServer/SimProfiles.cs | 13 |
5 files changed, 283 insertions, 222 deletions
diff --git a/OpenGridServices.GridServer/GridHttp.cs b/OpenGridServices.GridServer/GridHttp.cs index c9cda61..33e1e71 100644 --- a/OpenGridServices.GridServer/GridHttp.cs +++ b/OpenGridServices.GridServer/GridHttp.cs | |||
@@ -56,8 +56,13 @@ namespace OpenGridServices.GridServer | |||
56 | MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Spawned main thread OK"); | 56 | MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Spawned main thread OK"); |
57 | Listener = new HttpListener(); | 57 | Listener = new HttpListener(); |
58 | 58 | ||
59 | Listener.Prefixes.Add("http://+:8001/gridserver/"); | 59 | Listener.Prefixes.Add("http://+:8001/sims/"); |
60 | Listener.Prefixes.Add("http://+:8001/gods/"); | ||
61 | Listener.Prefixes.Add("http://+:8001/highestuuid/"); | ||
62 | Listener.Prefixes.Add("http://+:8001/uuidblocks/"); | ||
60 | Listener.Start(); | 63 | Listener.Start(); |
64 | |||
65 | MainConsole.Instance.WriteLine("GridHttp.cs:StartHTTP() - Successfully bound to port 8001"); | ||
61 | 66 | ||
62 | HttpListenerContext context; | 67 | HttpListenerContext context; |
63 | while(true) { | 68 | while(true) { |
@@ -66,72 +71,105 @@ namespace OpenGridServices.GridServer | |||
66 | } | 71 | } |
67 | } | 72 | } |
68 | 73 | ||
69 | static string ParseXMLRPC(string requestBody) { | 74 | static string ParseXMLRPC(string requestBody, string referrer) { |
70 | try{ | 75 | try{ |
71 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); | 76 | XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); |
72 | 77 | ||
73 | Hashtable requestData = (Hashtable)request.Params[0]; | 78 | Hashtable requestData = (Hashtable)request.Params[0]; |
74 | switch(request.MethodName) { | 79 | switch(request.MethodName) { |
75 | case "get_sim_info": | 80 | case "simulator_login": |
76 | ulong req_handle=(ulong)Convert.ToInt64(requestData["region_handle"]); | 81 | if(!(referrer=="simulator")) { |
77 | SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(req_handle); | 82 | XmlRpcResponse ErrorResp = new XmlRpcResponse(); |
78 | string RecvKey=""; | 83 | Hashtable ErrorRespData = new Hashtable(); |
79 | string caller=(string)requestData["caller"]; | 84 | ErrorRespData["error"]="Only simulators can login with this method"; |
80 | switch(caller) { | 85 | ErrorResp.Value=ErrorRespData; |
81 | case "userserver": | 86 | return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8")); |
82 | RecvKey=OpenGrid_Main.thegrid.UserRecvKey; | 87 | } |
83 | break; | 88 | |
84 | case "assetserver": | 89 | if(!((string)requestData["authkey"]==OpenGrid_Main.thegrid.SimRecvKey)) { |
85 | RecvKey=OpenGrid_Main.thegrid.AssetRecvKey; | 90 | XmlRpcResponse ErrorResp = new XmlRpcResponse(); |
86 | break; | 91 | Hashtable ErrorRespData = new Hashtable(); |
87 | } | 92 | ErrorRespData["error"]="invalid key"; |
88 | if((TheSim!=null) && (string)requestData["authkey"]==RecvKey) { | 93 | ErrorResp.Value=ErrorRespData; |
89 | XmlRpcResponse SimInfoResp = new XmlRpcResponse(); | 94 | return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(ErrorResp),"utf-16","utf-8")); |
90 | Hashtable SimInfoData = new Hashtable(); | 95 | } |
91 | SimInfoData["UUID"]=TheSim.UUID.ToString(); | 96 | |
92 | SimInfoData["regionhandle"]=TheSim.regionhandle.ToString(); | 97 | SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(new LLUUID((string)requestData["UUID"])); |
93 | SimInfoData["regionname"]=TheSim.regionname; | 98 | XmlRpcResponse SimLoginResp = new XmlRpcResponse(); |
94 | SimInfoData["sim_ip"]=TheSim.sim_ip; | 99 | Hashtable SimLoginRespData = new Hashtable(); |
95 | SimInfoData["sim_port"]=TheSim.sim_port.ToString(); | 100 | |
96 | SimInfoData["caps_url"]=TheSim.caps_url; | 101 | ArrayList SimNeighboursData = new ArrayList(); |
97 | SimInfoData["RegionLocX"]=TheSim.RegionLocX.ToString(); | 102 | |
98 | SimInfoData["RegionLocY"]=TheSim.RegionLocY.ToString(); | 103 | SimProfileBase neighbour; |
99 | SimInfoData["sendkey"]=TheSim.sendkey; | 104 | Hashtable NeighbourBlock; |
100 | SimInfoData["recvkey"]=TheSim.recvkey; | 105 | for(int x=-1; x<2; x++) for(int y=-1; y<2; y++) { |
101 | SimInfoResp.Value=SimInfoData; | 106 | if(OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256))!=null) { |
102 | return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimInfoResp),"utf-16","utf-8")); | 107 | neighbour=OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX+x)*256), (uint)(TheSim.RegionLocY+y)*256)); |
103 | } else { | 108 | NeighbourBlock = new Hashtable(); |
104 | XmlRpcResponse SimErrorResp = new XmlRpcResponse(); | 109 | NeighbourBlock["sim_ip"] = neighbour.sim_ip; |
105 | Hashtable SimErrorData = new Hashtable(); | 110 | NeighbourBlock["sim_port"] = neighbour.sim_port.ToString(); |
106 | SimErrorData["error"]="sim not found"; | 111 | NeighbourBlock["region_locx"] = neighbour.RegionLocX.ToString(); |
107 | SimErrorResp.Value=SimErrorData; | 112 | NeighbourBlock["region_locy"] = neighbour.RegionLocY.ToString(); |
108 | return(XmlRpcResponseSerializer.Singleton.Serialize(SimErrorResp)); | 113 | NeighbourBlock["UUID"] = neighbour.UUID.ToString(); |
109 | } | 114 | SimNeighboursData.Add(NeighbourBlock); |
110 | break; | 115 | } |
111 | } | 116 | } |
117 | |||
118 | |||
119 | SimLoginRespData["region_locx"]=TheSim.RegionLocX.ToString(); | ||
120 | SimLoginRespData["region_locy"]=TheSim.RegionLocY.ToString(); | ||
121 | SimLoginRespData["regionname"]=TheSim.regionname; | ||
122 | SimLoginRespData["estate_id"]="1"; | ||
123 | SimLoginRespData["neighbours"]=SimNeighboursData; | ||
124 | SimLoginRespData["asset_url"]=OpenGrid_Main.thegrid.DefaultAssetServer; | ||
125 | SimLoginRespData["asset_sendkey"]=OpenGrid_Main.thegrid.AssetSendKey; | ||
126 | SimLoginRespData["asset_recvkey"]=OpenGrid_Main.thegrid.AssetRecvKey; | ||
127 | SimLoginRespData["user_url"]=OpenGrid_Main.thegrid.DefaultUserServer; | ||
128 | SimLoginRespData["user_sendkey"]=OpenGrid_Main.thegrid.UserSendKey; | ||
129 | SimLoginRespData["user_recvkey"]=OpenGrid_Main.thegrid.UserRecvKey; | ||
130 | SimLoginRespData["authkey"]=OpenGrid_Main.thegrid.SimSendKey; | ||
131 | SimLoginResp.Value=SimLoginRespData; | ||
132 | return(Regex.Replace(XmlRpcResponseSerializer.Singleton.Serialize(SimLoginResp),"utf-16","utf-8")); | ||
133 | break; | ||
134 | } | ||
112 | } catch(Exception e) { | 135 | } catch(Exception e) { |
113 | Console.WriteLine(e.ToString()); | 136 | Console.WriteLine(e.ToString()); |
114 | } | 137 | } |
115 | return ""; | 138 | return ""; |
116 | } | 139 | } |
117 | 140 | ||
118 | static string ParseREST(string requestBody, string requestURL) { | 141 | static string ParseREST(string requestBody, string requestURL, string HTTPmethod) { |
119 | char[] splitter = {'/'}; | 142 | char[] splitter = {'/'}; |
120 | string[] rest_params = requestURL.Split(splitter); | 143 | string[] rest_params = requestURL.Split(splitter); |
121 | string req_type = rest_params[1]; // First part of the URL is the type of request - | 144 | string req_type = rest_params[0]; // First part of the URL is the type of request - |
122 | switch(req_type) { | 145 | string respstring; |
123 | case "regions": | 146 | switch(req_type) { |
124 | ulong regionhandle = (ulong)Convert.ToInt64(rest_params[2]); // get usersessions/sessionid | 147 | case "sims": |
125 | switch(rest_params[3]) { | 148 | LLUUID UUID = new LLUUID((string)rest_params[1]); |
126 | case "neighbours": | 149 | SimProfileBase TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByLLUUID(UUID); |
127 | return OpenGrid_Main.thegrid._regionmanager.GetXMLNeighbours(regionhandle); | 150 | if(!(TheSim==null)) { |
128 | break; | 151 | switch(HTTPmethod) { |
152 | case "GET": | ||
153 | respstring="<authkey>" + OpenGrid_Main.thegrid.SimSendKey + "</authkey>"; | ||
154 | respstring+="<sim>"; | ||
155 | respstring+="<uuid>" + TheSim.UUID.ToString() + "</uuid>"; | ||
156 | respstring+="<regionname>" + TheSim.regionname + "</regionname>"; | ||
157 | respstring+="<sim_ip>" + TheSim.sim_ip + "</sim_ip>"; | ||
158 | respstring+="<sim_port>" + TheSim.sim_port.ToString() + "</sim_port>"; | ||
159 | respstring+="<region_locx>" + TheSim.RegionLocX.ToString() + "</region_locx>"; | ||
160 | respstring+="<region_locy>" + TheSim.RegionLocY.ToString() + "</region_locy>"; | ||
161 | respstring+="<estate_id>1</estate_id>"; | ||
162 | respstring+="</sim>"; | ||
163 | break; | ||
164 | } | ||
129 | } | 165 | } |
130 | return "OK"; | ||
131 | break; | 166 | break; |
132 | } | 167 | case "highestuuid": |
168 | |||
169 | break; | ||
170 | } | ||
133 | return ""; | 171 | return ""; |
134 | 172 | ||
135 | } | 173 | } |
136 | 174 | ||
137 | 175 | ||
@@ -152,18 +190,20 @@ namespace OpenGridServices.GridServer | |||
152 | body.Close(); | 190 | body.Close(); |
153 | reader.Close(); | 191 | reader.Close(); |
154 | 192 | ||
193 | // TODO: AUTHENTICATION!!!!!!!!! MUST ADD!!!!!!!!!! SCRIPT KIDDIES LOVE LACK OF IT!!!!!!!!!! | ||
194 | |||
155 | string responseString=""; | 195 | string responseString=""; |
156 | switch(request.ContentType) { | 196 | switch(request.ContentType) { |
157 | case "text/xml": | 197 | case "text/xml": |
158 | // must be XML-RPC, so pass to the XML-RPC parser | 198 | // must be XML-RPC, so pass to the XML-RPC parser |
159 | 199 | ||
160 | responseString=ParseXMLRPC(requestBody); | 200 | responseString=ParseXMLRPC(requestBody,request.Headers["Referer"]); |
161 | response.AddHeader("Content-type","text/xml"); | 201 | response.AddHeader("Content-type","text/xml"); |
162 | break; | 202 | break; |
163 | 203 | ||
164 | case null: | 204 | case null: |
165 | // must be REST or invalid crap, so pass to the REST parser | 205 | // must be REST or invalid crap, so pass to the REST parser |
166 | responseString=ParseREST(request.Url.OriginalString,requestBody); | 206 | responseString=ParseREST(request.Url.OriginalString,requestBody,request.HttpMethod); |
167 | break; | 207 | break; |
168 | } | 208 | } |
169 | 209 | ||
diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs index 2382fd7..46041d9 100644 --- a/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices.GridServer/Main.cs | |||
@@ -39,7 +39,6 @@ namespace OpenGridServices.GridServer | |||
39 | /// </summary> | 39 | /// </summary> |
40 | public class OpenGrid_Main : conscmd_callback | 40 | public class OpenGrid_Main : conscmd_callback |
41 | { | 41 | { |
42 | |||
43 | public static OpenGrid_Main thegrid; | 42 | public static OpenGrid_Main thegrid; |
44 | public string GridOwner; | 43 | public string GridOwner; |
45 | public string DefaultStartupMsg; | 44 | public string DefaultStartupMsg; |
@@ -49,6 +48,9 @@ namespace OpenGridServices.GridServer | |||
49 | public string DefaultUserServer; | 48 | public string DefaultUserServer; |
50 | public string UserSendKey; | 49 | public string UserSendKey; |
51 | public string UserRecvKey; | 50 | public string UserRecvKey; |
51 | public string SimSendKey; | ||
52 | public string SimRecvKey; | ||
53 | public LLUUID highestUUID; | ||
52 | 54 | ||
53 | public GridHTTPServer _httpd; | 55 | public GridHTTPServer _httpd; |
54 | public SimProfileManager _regionmanager; | 56 | public SimProfileManager _regionmanager; |
@@ -97,11 +99,16 @@ namespace OpenGridServices.GridServer | |||
97 | this.UserSendKey = m_console.CmdPrompt("Key to send to user server: "); | 99 | this.UserSendKey = m_console.CmdPrompt("Key to send to user server: "); |
98 | this.UserRecvKey = m_console.CmdPrompt("Key to expect from user server: "); | 100 | this.UserRecvKey = m_console.CmdPrompt("Key to expect from user server: "); |
99 | 101 | ||
100 | m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); | 102 | this.SimSendKey = m_console.CmdPrompt("Key to send to sims: "); |
103 | this.SimRecvKey = m_console.CmdPrompt("Key to expect from sims: "); | ||
104 | |||
105 | m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database"); | ||
106 | this._regionmanager = new SimProfileManager(); | ||
107 | _regionmanager.LoadProfiles(); | ||
108 | |||
109 | m_console.WriteLine("Main.cs:Startup() - Starting HTTP process"); | ||
101 | _httpd = new GridHTTPServer(); | 110 | _httpd = new GridHTTPServer(); |
102 | 111 | ||
103 | this._regionmanager = new SimProfileManager(); | ||
104 | _regionmanager.CreateNewProfile("OpenSim Test", "http://there-is-no-caps.com", "4.78.190.75", 9000, 997, 996, this.UserSendKey, this.UserRecvKey); | ||
105 | } | 112 | } |
106 | 113 | ||
107 | public void RunCmd(string cmd, string[] cmdparams) | 114 | public void RunCmd(string cmd, string[] cmdparams) |
diff --git a/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj index 71d603e..12b4933 100644 --- a/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj +++ b/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj | |||
@@ -1,113 +1,117 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
5 | <SchemaVersion>2.0</SchemaVersion> | 5 | <SchemaVersion>2.0</SchemaVersion> |
6 | <ProjectGuid>{21BFC8E2-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{53A65EE9-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon></ApplicationIcon> |
10 | <AssemblyKeyContainerName> | 10 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 11 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGridServices.GridServer</AssemblyName> | 12 | <AssemblyName>OpenGridServices.GridServer</AssemblyName> |
13 | <DefaultClientScript>JScript</DefaultClientScript> | 13 | <DefaultClientScript>JScript</DefaultClientScript> |
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | 14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> |
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 16 | <DelaySign>false</DelaySign> |
17 | <OutputType>Exe</OutputType> | 17 | <OutputType>Exe</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 18 | <AppDesignerFolder></AppDesignerFolder> |
19 | <RootNamespace>OpenGridServices.GridServer</RootNamespace> | 19 | <RootNamespace>OpenGridServices.GridServer</RootNamespace> |
20 | <StartupObject></StartupObject> | 20 | <StartupObject></StartupObject> |
21 | <FileUpgradeFlags> | 21 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 22 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 23 | </PropertyGroup> |
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | 24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
26 | <BaseAddress>285212672</BaseAddress> | 26 | <BaseAddress>285212672</BaseAddress> |
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | 27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
28 | <ConfigurationOverrideFile> | 28 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 29 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 30 | <DefineConstants>TRACE</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 31 | <DocumentationFile></DocumentationFile> |
32 | <DebugSymbols>True</DebugSymbols> | 32 | <DebugSymbols>False</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 33 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 34 | <Optimize>True</Optimize> |
35 | <OutputPath>..\bin\</OutputPath> | 35 | <OutputPath>../bin/</OutputPath> |
36 | <RegisterForComInterop>False</RegisterForComInterop> | 36 | <RegisterForComInterop>False</RegisterForComInterop> |
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 39 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 40 | <NoWarn></NoWarn> |
41 | </PropertyGroup> | 41 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
44 | <BaseAddress>285212672</BaseAddress> | 44 | <BaseAddress>285212672</BaseAddress> |
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | 45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
46 | <ConfigurationOverrideFile> | 46 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 47 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 48 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 49 | <DocumentationFile></DocumentationFile> |
50 | <DebugSymbols>False</DebugSymbols> | 50 | <DebugSymbols>True</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 51 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 52 | <Optimize>False</Optimize> |
53 | <OutputPath>..\bin\</OutputPath> | 53 | <OutputPath>../bin/</OutputPath> |
54 | <RegisterForComInterop>False</RegisterForComInterop> | 54 | <RegisterForComInterop>False</RegisterForComInterop> |
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 57 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 58 | <NoWarn></NoWarn> |
59 | </PropertyGroup> | 59 | </PropertyGroup> |
60 | <ItemGroup> | 60 | <ItemGroup> |
61 | <Reference Include="System" > | 61 | <Reference Include="System" > |
62 | <HintPath>System.dll</HintPath> | 62 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 63 | <Private>False</Private> |
64 | </Reference> | 64 | </Reference> |
65 | <Reference Include="System.Data" > | 65 | <Reference Include="System.Data" > |
66 | <HintPath>System.Data.dll</HintPath> | 66 | <HintPath>System.Data.dll</HintPath> |
67 | <Private>False</Private> | 67 | <Private>False</Private> |
68 | </Reference> | 68 | </Reference> |
69 | <Reference Include="System.Xml" > | 69 | <Reference Include="System.Xml" > |
70 | <HintPath>System.Xml.dll</HintPath> | 70 | <HintPath>System.Xml.dll</HintPath> |
71 | <Private>False</Private> | 71 | <Private>False</Private> |
72 | </Reference> | 72 | </Reference> |
73 | <Reference Include="libsecondlife.dll" > | 73 | <Reference Include="libsecondlife.dll" > |
74 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 74 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
75 | <Private>False</Private> | 75 | <Private>False</Private> |
76 | </Reference> | 76 | </Reference> |
77 | </ItemGroup> | 77 | <Reference Include="Db4objects.Db4o.dll" > |
78 | <ItemGroup> | 78 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> |
79 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> | 79 | <Private>False</Private> |
80 | <Name>OpenSim.Framework</Name> | 80 | </Reference> |
81 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 81 | </ItemGroup> |
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 82 | <ItemGroup> |
83 | <Private>False</Private> | 83 | <ProjectReference Include="../OpenSim.Framework/OpenSim.Framework.csproj"> |
84 | </ProjectReference> | 84 | <Name>OpenSim.Framework</Name> |
85 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | 85 | <Project>{7404933D-0000-0000-0000-000000000000}</Project> |
86 | <Name>OpenSim.Framework.Console</Name> | 86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 87 | <Private>False</Private> |
88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 88 | </ProjectReference> |
89 | <Private>False</Private> | 89 | <ProjectReference Include="../OpenSim.Framework.Console/OpenSim.Framework.Console.csproj"> |
90 | </ProjectReference> | 90 | <Name>OpenSim.Framework.Console</Name> |
91 | </ItemGroup> | 91 | <Project>{16759386-0000-0000-0000-000000000000}</Project> |
92 | <ItemGroup> | 92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
93 | <Compile Include="GridHttp.cs"> | 93 | <Private>False</Private> |
94 | <SubType>Code</SubType> | 94 | </ProjectReference> |
95 | </Compile> | 95 | </ItemGroup> |
96 | <Compile Include="Main.cs"> | 96 | <ItemGroup> |
97 | <SubType>Code</SubType> | 97 | <Compile Include="GridHttp.cs"> |
98 | </Compile> | 98 | <SubType>Code</SubType> |
99 | <Compile Include="SimProfiles.cs"> | 99 | </Compile> |
100 | <SubType>Code</SubType> | 100 | <Compile Include="Main.cs"> |
101 | </Compile> | 101 | <SubType>Code</SubType> |
102 | <Compile Include="Properties\AssemblyInfo.cs"> | 102 | </Compile> |
103 | <SubType>Code</SubType> | 103 | <Compile Include="SimProfiles.cs"> |
104 | </Compile> | 104 | <SubType>Code</SubType> |
105 | </ItemGroup> | 105 | </Compile> |
106 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | 106 | <Compile Include="Properties/AssemblyInfo.cs"> |
107 | <PropertyGroup> | 107 | <SubType>Code</SubType> |
108 | <PreBuildEvent> | 108 | </Compile> |
109 | </PreBuildEvent> | 109 | </ItemGroup> |
110 | <PostBuildEvent> | 110 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
111 | </PostBuildEvent> | 111 | <PropertyGroup> |
112 | </PropertyGroup> | 112 | <PreBuildEvent> |
113 | </Project> | 113 | </PreBuildEvent> |
114 | <PostBuildEvent> | ||
115 | </PostBuildEvent> | ||
116 | </PropertyGroup> | ||
117 | </Project> | ||
diff --git a/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build index a25536e..111e2f7 100644 --- a/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build +++ b/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build | |||
@@ -1,47 +1,48 @@ | |||
1 | <?xml version="1.0" ?> | 1 | <?xml version="1.0" ?> |
2 | <project name="OpenGridServices.GridServer" default="build"> | 2 | <project name="OpenGridServices.GridServer" default="build"> |
3 | <target name="build"> | 3 | <target name="build"> |
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | 4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> |
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | 5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> |
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | 6 | <copy todir="${project::get-base-directory()}/${build.dir}"> |
7 | <fileset basedir="${project::get-base-directory()}"> | 7 | <fileset basedir="${project::get-base-directory()}"> |
8 | </fileset> | 8 | </fileset> |
9 | </copy> | 9 | </copy> |
10 | <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> | 10 | <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe"> |
11 | <resources prefix="OpenGridServices.GridServer" dynamicprefix="true" > | 11 | <resources prefix="OpenGridServices.GridServer" dynamicprefix="true" > |
12 | </resources> | 12 | </resources> |
13 | <sources failonempty="true"> | 13 | <sources failonempty="true"> |
14 | <include name="GridHttp.cs" /> | 14 | <include name="GridHttp.cs" /> |
15 | <include name="Main.cs" /> | 15 | <include name="Main.cs" /> |
16 | <include name="SimProfiles.cs" /> | 16 | <include name="SimProfiles.cs" /> |
17 | <include name="Properties/AssemblyInfo.cs" /> | 17 | <include name="Properties/AssemblyInfo.cs" /> |
18 | </sources> | 18 | </sources> |
19 | <references basedir="${project::get-base-directory()}"> | 19 | <references basedir="${project::get-base-directory()}"> |
20 | <lib> | 20 | <lib> |
21 | <include name="${project::get-base-directory()}" /> | 21 | <include name="${project::get-base-directory()}" /> |
22 | <include name="${project::get-base-directory()}/${build.dir}" /> | 22 | <include name="${project::get-base-directory()}/${build.dir}" /> |
23 | </lib> | 23 | </lib> |
24 | <include name="System.dll" /> | 24 | <include name="System.dll" /> |
25 | <include name="System.Data.dll" /> | 25 | <include name="System.Data.dll" /> |
26 | <include name="System.Xml.dll" /> | 26 | <include name="System.Xml.dll" /> |
27 | <include name="../bin/OpenSim.Framework.dll" /> | 27 | <include name="../bin/OpenSim.Framework.dll" /> |
28 | <include name="../bin/OpenSim.Framework.Console.dll" /> | 28 | <include name="../bin/OpenSim.Framework.Console.dll" /> |
29 | <include name="../bin/libsecondlife.dll" /> | 29 | <include name="../bin/libsecondlife.dll" /> |
30 | </references> | 30 | <include name="../bin/Db4objects.Db4o.dll" /> |
31 | </csc> | 31 | </references> |
32 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> | 32 | </csc> |
33 | <mkdir dir="${project::get-base-directory()}/../bin/"/> | 33 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" /> |
34 | <copy todir="${project::get-base-directory()}/../bin/"> | 34 | <mkdir dir="${project::get-base-directory()}/../bin/"/> |
35 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | 35 | <copy todir="${project::get-base-directory()}/../bin/"> |
36 | <include name="*.dll"/> | 36 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > |
37 | <include name="*.exe"/> | 37 | <include name="*.dll"/> |
38 | </fileset> | 38 | <include name="*.exe"/> |
39 | </copy> | 39 | </fileset> |
40 | </target> | 40 | </copy> |
41 | <target name="clean"> | 41 | </target> |
42 | <delete dir="${bin.dir}" failonerror="false" /> | 42 | <target name="clean"> |
43 | <delete dir="${obj.dir}" failonerror="false" /> | 43 | <delete dir="${bin.dir}" failonerror="false" /> |
44 | </target> | 44 | <delete dir="${obj.dir}" failonerror="false" /> |
45 | <target name="doc" description="Creates documentation."> | 45 | </target> |
46 | </target> | 46 | <target name="doc" description="Creates documentation."> |
47 | </project> | 47 | </target> |
48 | </project> | ||
diff --git a/OpenGridServices.GridServer/SimProfiles.cs b/OpenGridServices.GridServer/SimProfiles.cs index 253c2d4..7aff434 100644 --- a/OpenGridServices.GridServer/SimProfiles.cs +++ b/OpenGridServices.GridServer/SimProfiles.cs | |||
@@ -33,7 +33,9 @@ using System.Collections; | |||
33 | using System.Collections.Generic; | 33 | using System.Collections.Generic; |
34 | using libsecondlife; | 34 | using libsecondlife; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | using OpenSim.Framework.Console; | ||
36 | using OpenSim.Framework.Sims; | 37 | using OpenSim.Framework.Sims; |
38 | using Db4objects.Db4o; | ||
37 | 39 | ||
38 | namespace OpenGridServices.GridServer | 40 | namespace OpenGridServices.GridServer |
39 | { | 41 | { |
@@ -46,8 +48,15 @@ namespace OpenGridServices.GridServer | |||
46 | public SimProfileManager() { | 48 | public SimProfileManager() { |
47 | } | 49 | } |
48 | 50 | ||
49 | public void InitSimProfiles() { | 51 | public void LoadProfiles() { // should abstract this out |
50 | // TODO: need to load from database | 52 | IObjectContainer db; |
53 | db = Db4oFactory.OpenFile("simprofiles.yap"); | ||
54 | IObjectSet result = db.Get(typeof(SimProfileBase)); | ||
55 | foreach (SimProfileBase simprof in result) { | ||
56 | SimProfiles.Add(simprof.UUID, simprof); | ||
57 | } | ||
58 | MainConsole.Instance.WriteLine("SimProfiles.Cs:LoadProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); | ||
59 | db.Close(); | ||
51 | } | 60 | } |
52 | 61 | ||
53 | public SimProfileBase GetProfileByHandle(ulong reqhandle) { | 62 | public SimProfileBase GetProfileByHandle(ulong reqhandle) { |