* Zomg inventory server (incomplete shell)

zircon^2
Adam Frisby 2007-06-01 20:21:00 +00:00
parent 30f810a03e
commit aba0f0774c
4 changed files with 268 additions and 0 deletions

View File

@ -0,0 +1,97 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using OpenGrid.Framework.Data;
using libsecondlife;
using System.Reflection;
using System.Xml;
using Nwc.XmlRpc;
using OpenSim.Framework.Sims;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities;
using System.Security.Cryptography;
namespace OpenGridServices.InventoryServer
{
class InventoryManager
{
Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>();
/// <summary>
/// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
/// </summary>
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
public void AddPlugin(string FileName)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IInventoryData", true);
if (typeInterface != null)
{
IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
this._plugins.Add(plug.getName(), plug);
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Added IUserData Interface");
}
typeInterface = null;
}
}
pluginAssembly = null;
}
public List<InventoryFolderBase> getRootFolders(LLUUID user)
{
foreach (KeyValuePair<string, IInventoryData> kvp in _plugins)
{
try
{
return kvp.Value.getUserRootFolders(user);
}
catch (Exception e)
{
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")");
}
}
}
public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable();
// Stuff happens here
if (requestData.ContainsKey("Access-type"))
{
if (requestData["access-type"] == "rootfolders")
{
// responseData["rootfolders"] =
}
}
else
{
responseData["error"] = "No access-type specified.";
}
// Stuff stops happening here
response.Value = responseData;
return response;
}
}
}

View File

@ -0,0 +1,60 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.IO;
using System.Text;
using libsecondlife;
using OpenSim.Framework.User;
using OpenSim.Framework.Sims;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Console;
using OpenSim.Servers;
using OpenSim.Framework.Utilities;
namespace OpenGridServices.InventoryServer
{
public class OpenInventory_Main : BaseServer, conscmd_callback
{
ConsoleBase m_console;
InventoryManager m_inventoryManager;
public static void Main(string[] args)
{
}
public OpenInventory_Main()
{
m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
MainConsole.Instance = m_console;
}
public void Startup()
{
MainConsole.Instance.WriteLine("Initialising inventory manager...");
m_inventoryManager = new InventoryManager();
MainConsole.Instance.WriteLine("Starting HTTP server");
BaseHttpServer httpServer = new BaseHttpServer(8004);
//httpServer.AddRestHandler("GET","/rootfolders/",Rest
}
public void RunCmd(string cmd, string[] cmdparams)
{
switch (cmd)
{
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
}
}
public void Show(string ShowWhat)
{
}
}
}

View File

@ -0,0 +1,78 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{596B9D58-F27D-430B-99D2-4C1B95F74A76}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenGridServices.InventoryServer</RootNamespace>
<AssemblyName>OpenGridServices.InventoryServer</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\libsecondlife.dll</HintPath>
</Reference>
<Reference Include="OpenSim.Framework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\OpenSim.Framework.dll</HintPath>
</Reference>
<Reference Include="OpenSim.Framework.Console, Version=1.0.2706.24499, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath>
</Reference>
<Reference Include="OpenSim.Servers, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\OpenSim.Servers.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="XMLRPC, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\XMLRPC.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="InventoryManager.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenGridServices\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj">
<Project>{62CDF671-0000-0000-0000-000000000000}</Project>
<Name>OpenGrid.Framework.Data</Name>
</ProjectReference>
<ProjectReference Include="..\OpenGridServices\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj">
<Project>{7924FD35-0000-0000-0000-000000000000}</Project>
<Name>OpenGrid.Framework.Manager</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,33 @@
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("OpenGridServices.InventoryServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenGridServices.InventoryServer")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d410d983-9489-46db-ac77-a7470291c01d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]