diff --git a/OpenGridServices.AssetServer/Main.cs b/OpenGridServices.AssetServer/Main.cs
index 69cba9c9dd..473c483ce1 100644
--- a/OpenGridServices.AssetServer/Main.cs
+++ b/OpenGridServices.AssetServer/Main.cs
@@ -37,24 +37,20 @@ using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Sims;
using OpenSim.Framework.Console;
-using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Interfaces;
+using OpenSim.GridInterfaces.Local; // REFACTORING IS NEEDED!!!!!!!!!!!
using OpenSim.Servers;
-namespace OpenGridServices.GridServer
+namespace OpenGridServices.AssetServer
{
///
///
- public class OpenGrid_Main : BaseServer, conscmd_callback
+ public class OpenAsset_Main : BaseServer, conscmd_callback
{
- private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll";
- public GridConfig Cfg;
+ private IObjectContainer db;
- public static OpenGrid_Main thegrid;
-
- //public LLUUID highestUUID;
-
- private SimProfileManager m_simProfileManager;
-
+ public static OpenAsset_Main assetserver;
+
private ConsoleBase m_console;
[STAThread]
@@ -62,10 +58,10 @@ namespace OpenGridServices.GridServer
{
Console.WriteLine("Starting...\n");
- thegrid = new OpenGrid_Main();
- thegrid.Startup();
+ assetserver = new OpenAsset_Main();
+ assetserver.Startup();
- thegrid.Work();
+ assetserver.Work();
}
private void Work()
@@ -78,57 +74,34 @@ namespace OpenGridServices.GridServer
}
}
- private OpenGrid_Main()
+ private OpenAsset_Main()
{
- m_console = new ConsoleBase("opengrid-gridserver-console.log", "OpenGrid", this, false);
+ m_console = new ConsoleBase("opengrid-AssetServer-console.log", "OpenGrid", this, false);
MainConsole.Instance = m_console;
}
public void Startup()
{
- m_console.WriteLine("Main.cs:Startup() - Loading configuration");
+ /*m_console.WriteLine("Main.cs:Startup() - Loading configuration");
Cfg = this.LoadConfigDll(this.ConfigDll);
- Cfg.InitConfig();
-
- m_console.WriteLine("Main.cs:Startup() - Loading sim profiles from database");
- m_simProfileManager = new SimProfileManager( this );
- m_simProfileManager.LoadProfiles();
+ Cfg.InitConfig();
*/
+
m_console.WriteLine("Main.cs:Startup() - Starting HTTP process");
- BaseHttpServer httpServer = new BaseHttpServer(8001);
+ BaseHttpServer httpServer = new BaseHttpServer(8003);
- httpServer.AddXmlRPCHandler("simulator_login", m_simProfileManager.XmlRpcLoginToSimulatorMethod);
-
- httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod);
+ /*httpServer.AddRestHandler("GET", "/sims/", m_simProfileManager.RestGetSimMethod);
httpServer.AddRestHandler("POST", "/sims/", m_simProfileManager.RestSetSimMethod);
httpServer.AddRestHandler("GET", "/regions/", m_simProfileManager.RestGetRegionMethod);
- httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod);
-
+ httpServer.AddRestHandler("POST", "/regions/", m_simProfileManager.RestSetRegionMethod);
*/
+ httpServer.AddRestHAndler("GET", "/assets/", this.assetGetMethod);
- // lbsa71 : This code snippet taken from old http server.
- // I have no idea what this was supposed to do - looks like an infinite recursion to me.
- // case "regions":
- //// DIRTY HACK ALERT
- //Console.WriteLine("/regions/ accessed");
- //TheSim = OpenGrid_Main.thegrid._regionmanager.GetProfileByHandle((ulong)Convert.ToUInt64(rest_params[1]));
- //respstring = ParseREST("/regions/" + rest_params[1], requestBody, HTTPmethod);
- //break;
-
- // lbsa71 : I guess these were never used?
- //Listener.Prefixes.Add("http://+:8001/gods/");
- //Listener.Prefixes.Add("http://+:8001/highestuuid/");
- //Listener.Prefixes.Add("http://+:8001/uuidblocks/");
httpServer.Start();
- m_console.WriteLine("Main.cs:Startup() - Starting sim status checker");
-
- Timer simCheckTimer = new Timer( 300000 ); // 5 minutes
- simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
- simCheckTimer.Enabled = true;
}
- private GridConfig LoadConfigDll(string dllName)
+ /*private GridConfig LoadConfigDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
GridConfig config = null;
@@ -154,49 +127,14 @@ namespace OpenGridServices.GridServer
}
pluginAssembly = null;
return config;
- }
-
- public void CheckSims(object sender, ElapsedEventArgs e)
- {
- foreach (SimProfileBase sim in m_simProfileManager.SimProfiles.Values)
- {
- string SimResponse = "";
- try
- {
- WebRequest CheckSim = WebRequest.Create("http://" + sim.sim_ip + ":" + sim.sim_port.ToString() + "/checkstatus/");
- CheckSim.Method = "GET";
- CheckSim.ContentType = "text/plaintext";
- CheckSim.ContentLength = 0;
-
- StreamWriter stOut = new StreamWriter(CheckSim.GetRequestStream(), System.Text.Encoding.ASCII);
- stOut.Write("");
- stOut.Close();
-
- StreamReader stIn = new StreamReader(CheckSim.GetResponse().GetResponseStream());
- SimResponse = stIn.ReadToEnd();
- stIn.Close();
- }
- catch
- {
- }
-
- if (SimResponse == "OK")
- {
- m_simProfileManager.SimProfiles[sim.UUID].online = true;
- }
- else
- {
- m_simProfileManager.SimProfiles[sim.UUID].online = false;
- }
- }
- }
+ }*/
public void RunCmd(string cmd, string[] cmdparams)
{
switch (cmd)
{
case "help":
- m_console.WriteLine("shutdown - shutdown the grid (USE CAUTION!)");
+ m_console.WriteLine("shutdown - shutdown this asset server (USE CAUTION!)");
break;
case "shutdown":
diff --git a/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs b/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
index 8471e6b067..7014284367 100644
--- a/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenGridServices.AssetServer/Properties/AssemblyInfo.cs
@@ -1,15 +1,15 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("OGS-GridServer")]
+[assembly: AssemblyTitle("OGS-AssetServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OGS-GridServer")]
+[assembly: AssemblyProduct("OGS-AssetServer")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/OpenGridServices.AssetServer/SimProfiles.cs b/OpenGridServices.AssetServer/SimProfiles.cs
deleted file mode 100644
index ae40133ec4..0000000000
--- a/OpenGridServices.AssetServer/SimProfiles.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-Copyright (c) OpenGrid project, http://osgrid.org/
-
-
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-using System;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using libsecondlife;
-using OpenSim.Framework.Utilities;
-using OpenSim.Framework.Console;
-using OpenSim.Framework.Sims;
-using Db4objects.Db4o;
-using Nwc.XmlRpc;
-using System.Xml;
-
-namespace OpenGridServices.GridServer
-{
- ///
- ///
- public class SimProfileManager
- {
-
- public Dictionary SimProfiles = new Dictionary();
- private OpenGrid_Main m_gridManager;
-
- public SimProfileManager(OpenGrid_Main gridManager)
- {
- m_gridManager = gridManager;
- }
-
- 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)
- {
- foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys)
- {
- if (SimProfiles[UUID].regionhandle == reqhandle) return SimProfiles[UUID];
- }
- return null;
- }
-
- public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID)
- {
- foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys)
- {
- if (SimProfiles[UUID].UUID == ProfileLLUUID) return SimProfiles[UUID];
- }
- return null;
- }
-
- public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey)
- {
- SimProfileBase TheSim = GetProfileByHandle(regionhandle);
- if (TheSim != null)
- if (TheSim.recvkey == simrecvkey)
- {
- return true;
- }
- else
- {
- return false;
- }
- else return false;
-
- }
-
- public string GetXMLNeighbours(ulong reqhandle)
- {
- string response = "";
- SimProfileBase central_region = GetProfileByHandle(reqhandle);
- SimProfileBase neighbour;
- for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
- {
- if (GetProfileByHandle(Util.UIntsToLong((uint)((central_region.RegionLocX + x) * 256), (uint)(central_region.RegionLocY + y) * 256)) != null)
- {
- neighbour = GetProfileByHandle(Util.UIntsToLong((uint)((central_region.RegionLocX + x) * 256), (uint)(central_region.RegionLocY + y) * 256));
- response += "";
- response += "" + neighbour.sim_ip + "";
- response += "" + neighbour.sim_port.ToString() + "";
- response += "" + neighbour.RegionLocX.ToString() + "";
- response += "" + neighbour.RegionLocY.ToString() + "";
- response += "" + neighbour.regionhandle.ToString() + "";
- response += "";
-
- }
- }
- return response;
- }
-
- public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey)
- {
- SimProfileBase newprofile = new SimProfileBase();
- newprofile.regionname = regionname;
- newprofile.sim_ip = sim_ip;
- newprofile.sim_port = sim_port;
- newprofile.RegionLocX = RegionLocX;
- newprofile.RegionLocY = RegionLocY;
- newprofile.caps_url = "http://" + sim_ip + ":9000/";
- newprofile.sendkey = sendkey;
- newprofile.recvkey = recvkey;
- newprofile.regionhandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
- newprofile.UUID = LLUUID.Random();
- this.SimProfiles.Add(newprofile.UUID, newprofile);
- return newprofile;
- }
-
- public XmlRpcResponse XmlRpcLoginToSimulatorMethod(XmlRpcRequest request)
- {
- XmlRpcResponse response = new XmlRpcResponse();
- Hashtable responseData = new Hashtable();
- response.Value = responseData;
-
- SimProfileBase TheSim = null;
- Hashtable requestData = (Hashtable)request.Params[0];
-
- if (requestData.ContainsKey("UUID"))
- {
- TheSim = GetProfileByLLUUID(new LLUUID((string)requestData["UUID"]));
- }
- else if (requestData.ContainsKey("region_handle"))
- {
- TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(requestData["region_handle"]));
- }
-
- if (TheSim == null)
- {
- responseData["error"] = "sim not found";
- }
- else
- {
-
- ArrayList SimNeighboursData = new ArrayList();
-
- SimProfileBase neighbour;
- Hashtable NeighbourBlock;
- for (int x = -1; x < 2; x++) for (int y = -1; y < 2; y++)
- {
- if (GetProfileByHandle(Helpers.UIntsToLong((uint)((TheSim.RegionLocX + x) * 256), (uint)(TheSim.RegionLocY + y) * 256)) != null)
- {
- neighbour = 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();
-
- if (neighbour.UUID != TheSim.UUID) SimNeighboursData.Add(NeighbourBlock);
- }
- }
-
- responseData["UUID"] = TheSim.UUID.ToString();
- responseData["region_locx"] = TheSim.RegionLocX.ToString();
- responseData["region_locy"] = TheSim.RegionLocY.ToString();
- responseData["regionname"] = TheSim.regionname;
- responseData["estate_id"] = "1";
- responseData["neighbours"] = SimNeighboursData;
-
- responseData["sim_ip"] = TheSim.sim_ip;
- responseData["sim_port"] = TheSim.sim_port.ToString();
- responseData["asset_url"] = m_gridManager.Cfg.DefaultAssetServer;
- responseData["asset_sendkey"] = m_gridManager.Cfg.AssetSendKey;
- responseData["asset_recvkey"] = m_gridManager.Cfg.AssetRecvKey;
- responseData["user_url"] = m_gridManager.Cfg.DefaultUserServer;
- responseData["user_sendkey"] = m_gridManager.Cfg.UserSendKey;
- responseData["user_recvkey"] = m_gridManager.Cfg.UserRecvKey;
- responseData["authkey"] = m_gridManager.Cfg.SimSendKey;
- }
-
- return response;
- }
-
- public string RestSetSimMethod(string request, string path, string param)
- {
- Console.WriteLine("SimProfiles.cs:RestSetSimMethod() - processing request......");
- SimProfileBase TheSim;
- TheSim = GetProfileByLLUUID(new LLUUID(param));
- if ((TheSim) == null)
- {
- TheSim = new SimProfileBase();
- LLUUID UUID = new LLUUID(param);
- TheSim.UUID = UUID;
- }
-
- XmlDocument doc = new XmlDocument();
- doc.LoadXml(request);
- XmlNode rootnode = doc.FirstChild;
- XmlNode authkeynode = rootnode.ChildNodes[0];
- if (authkeynode.Name != "authkey")
- {
- return "ERROR! bad XML - expected authkey tag";
- }
-
- XmlNode simnode = rootnode.ChildNodes[1];
- if (simnode.Name != "sim")
- {
- return "ERROR! bad XML - expected sim tag";
- }
-
- if (authkeynode.InnerText != m_gridManager.Cfg.SimRecvKey)
- {
- return "ERROR! invalid key";
- }
- for (int i = 0; i < simnode.ChildNodes.Count; i++)
- {
- switch (simnode.ChildNodes[i].Name)
- {
- case "regionname":
- TheSim.regionname = simnode.ChildNodes[i].InnerText;
- break;
-
- case "sim_ip":
- TheSim.sim_ip = simnode.ChildNodes[i].InnerText;
- break;
-
- case "sim_port":
- TheSim.sim_port = Convert.ToUInt32(simnode.ChildNodes[i].InnerText);
- break;
-
- case "region_locx":
- TheSim.RegionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
- TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
- break;
-
- case "region_locy":
- TheSim.RegionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText);
- TheSim.regionhandle = Helpers.UIntsToLong((TheSim.RegionLocX * 256), (TheSim.RegionLocY * 256));
- break;
- }
- }
-
- try
- {
- SimProfiles.Add(TheSim.UUID, TheSim);
- IObjectContainer db;
- db = Db4oFactory.OpenFile("simprofiles.yap");
- db.Set(TheSim);
- db.Close();
- return "OK";
- }
- catch (Exception e)
- {
- return "ERROR! could not save to database!";
- }
-
- }
-
- public string RestGetRegionMethod(string request, string path, string param)
- {
- SimProfileBase TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(param));
- return RestGetSimMethod("", "/sims/", param);
- }
-
- public string RestSetRegionMethod(string request, string path, string param)
- {
- SimProfileBase TheSim = GetProfileByHandle((ulong)Convert.ToUInt64(param));
- return RestSetSimMethod("", "/sims/", param);
- }
-
- public string RestGetSimMethod(string request, string path, string param)
- {
- string respstring = String.Empty;
-
- SimProfileBase TheSim;
- LLUUID UUID = new LLUUID(param);
- TheSim = GetProfileByLLUUID(UUID);
-
- if (!(TheSim == null))
- {
- respstring = "";
- respstring += "" + m_gridManager.Cfg.SimSendKey + "";
- respstring += "";
- respstring += "" + TheSim.UUID.ToString() + "";
- respstring += "" + TheSim.regionname + "";
- respstring += "" + TheSim.sim_ip + "";
- respstring += "" + TheSim.sim_port.ToString() + "";
- respstring += "" + TheSim.RegionLocX.ToString() + "";
- respstring += "" + TheSim.RegionLocY.ToString() + "";
- respstring += "1";
- respstring += "";
- respstring += "";
- }
-
- return respstring;
- }
-
- }
-
-
-}
diff --git a/OpenSim.Framework/OpenSim.Framework.dll.build b/OpenSim.Framework/OpenSim.Framework.dll.build
index 84f7e1f391..69ea10a393 100644
--- a/OpenSim.Framework/OpenSim.Framework.dll.build
+++ b/OpenSim.Framework/OpenSim.Framework.dll.build
@@ -37,6 +37,7 @@
+
diff --git a/OpenSim.GridInterfaces/Local/LocalGridServer.cs b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
index f4b8872b3b..e08d635095 100644
--- a/OpenSim.GridInterfaces/Local/LocalGridServer.cs
+++ b/OpenSim.GridInterfaces/Local/LocalGridServer.cs
@@ -145,12 +145,5 @@ namespace OpenSim.GridInterfaces.Local
return (asset.UUID == _findID);
}
}
-
- public class AssetStorage
- {
- public byte[] Data;
- public sbyte Type;
- public string Name;
- public LLUUID UUID;
- }
+
}
diff --git a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
index d2f8de11d0..bcebf821b4 100644
--- a/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
+++ b/OpenSim.GridInterfaces/Remote/RemoteAssetServer.cs
@@ -62,11 +62,12 @@ namespace OpenSim.GridInterfaces.Remote
{
while (true)
{
- //we need to add support for the asset server not knowing about a requested asset
+ //we need to add support for the asset server not knowing about a requested asset
+ // 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
ARequest req = this._assetRequests.Dequeue();
LLUUID assetID = req.AssetID;
- OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
- WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "getasset/" + AssetSendKey + "/" + assetID + "/data");
+ OpenSim.Framework.Console.MainConsole.Instance.WriteLine(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID + "/data");
+ WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID + "/data");
WebResponse AssetResponse = AssetLoad.GetResponse();
byte[] idata = new byte[(int)AssetResponse.ContentLength];
BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
diff --git a/OpenSim.build b/OpenSim.build
index 15b6371736..656d788c44 100644
--- a/OpenSim.build
+++ b/OpenSim.build
@@ -61,6 +61,7 @@
+
@@ -76,6 +77,7 @@
+
@@ -118,6 +120,7 @@
+
diff --git a/prebuild.xml b/prebuild.xml
index 741fc6dcd7..3d5c4bc4e6 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -153,6 +153,35 @@
+
+
+
+ ../bin/
+
+
+
+
+ ../bin/
+
+
+
+ ../bin/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+