diff options
author | Adam Frisby | 2007-06-01 20:21:00 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-01 20:21:00 +0000 |
commit | aba0f0774c32abf3dfbe837585354aaea9ebcede (patch) | |
tree | 5f5d11602ada5a369b06f46ecf77c9d6ede4b7d4 /OpenGridServices.InventoryServer | |
parent | * MySQL Inventory data interfaces written - can now write an inventory server... (diff) | |
download | opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.zip opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.gz opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.bz2 opensim-SC-aba0f0774c32abf3dfbe837585354aaea9ebcede.tar.xz |
* Zomg inventory server (incomplete shell)
Diffstat (limited to '')
4 files changed, 268 insertions, 0 deletions
diff --git a/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000..01fd825 --- /dev/null +++ b/OpenGridServices.InventoryServer/InventoryManager.cs | |||
@@ -0,0 +1,97 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using OpenGrid.Framework.Data; | ||
6 | using libsecondlife; | ||
7 | using System.Reflection; | ||
8 | |||
9 | using System.Xml; | ||
10 | using Nwc.XmlRpc; | ||
11 | using OpenSim.Framework.Sims; | ||
12 | using OpenSim.Framework.Inventory; | ||
13 | using OpenSim.Framework.Utilities; | ||
14 | |||
15 | using System.Security.Cryptography; | ||
16 | |||
17 | namespace OpenGridServices.InventoryServer | ||
18 | { | ||
19 | class InventoryManager | ||
20 | { | ||
21 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); | ||
22 | |||
23 | /// <summary> | ||
24 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. | ||
25 | /// </summary> | ||
26 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> | ||
27 | public void AddPlugin(string FileName) | ||
28 | { | ||
29 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Attempting to load " + FileName); | ||
30 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
31 | |||
32 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
33 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
34 | { | ||
35 | if (!pluginType.IsAbstract) | ||
36 | { | ||
37 | Type typeInterface = pluginType.GetInterface("IInventoryData", true); | ||
38 | |||
39 | if (typeInterface != null) | ||
40 | { | ||
41 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
42 | plug.Initialise(); | ||
43 | this._plugins.Add(plug.getName(), plug); | ||
44 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Invenstorage: Added IUserData Interface"); | ||
45 | } | ||
46 | |||
47 | typeInterface = null; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | pluginAssembly = null; | ||
52 | } | ||
53 | |||
54 | public List<InventoryFolderBase> getRootFolders(LLUUID user) | ||
55 | { | ||
56 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) | ||
57 | { | ||
58 | try | ||
59 | { | ||
60 | return kvp.Value.getUserRootFolders(user); | ||
61 | } | ||
62 | catch (Exception e) | ||
63 | { | ||
64 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
69 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | ||
70 | { | ||
71 | XmlRpcResponse response = new XmlRpcResponse(); | ||
72 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
73 | |||
74 | Hashtable responseData = new Hashtable(); | ||
75 | |||
76 | // Stuff happens here | ||
77 | |||
78 | if (requestData.ContainsKey("Access-type")) | ||
79 | { | ||
80 | if (requestData["access-type"] == "rootfolders") | ||
81 | { | ||
82 | // responseData["rootfolders"] = | ||
83 | } | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | responseData["error"] = "No access-type specified."; | ||
88 | } | ||
89 | |||
90 | |||
91 | // Stuff stops happening here | ||
92 | |||
93 | response.Value = responseData; | ||
94 | return response; | ||
95 | } | ||
96 | } | ||
97 | } | ||
diff --git a/OpenGridServices.InventoryServer/Main.cs b/OpenGridServices.InventoryServer/Main.cs new file mode 100644 index 0000000..14b6f85 --- /dev/null +++ b/OpenGridServices.InventoryServer/Main.cs | |||
@@ -0,0 +1,60 @@ | |||
1 | |||
2 | using System; | ||
3 | using System.Collections; | ||
4 | using System.Collections.Generic; | ||
5 | using System.Reflection; | ||
6 | using System.IO; | ||
7 | using System.Text; | ||
8 | using libsecondlife; | ||
9 | using OpenSim.Framework.User; | ||
10 | using OpenSim.Framework.Sims; | ||
11 | using OpenSim.Framework.Inventory; | ||
12 | using OpenSim.Framework.Interfaces; | ||
13 | using OpenSim.Framework.Console; | ||
14 | using OpenSim.Servers; | ||
15 | using OpenSim.Framework.Utilities; | ||
16 | |||
17 | namespace OpenGridServices.InventoryServer | ||
18 | { | ||
19 | public class OpenInventory_Main : BaseServer, conscmd_callback | ||
20 | { | ||
21 | ConsoleBase m_console; | ||
22 | InventoryManager m_inventoryManager; | ||
23 | |||
24 | public static void Main(string[] args) | ||
25 | { | ||
26 | } | ||
27 | |||
28 | public OpenInventory_Main() | ||
29 | { | ||
30 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); | ||
31 | MainConsole.Instance = m_console; | ||
32 | } | ||
33 | |||
34 | public void Startup() | ||
35 | { | ||
36 | MainConsole.Instance.WriteLine("Initialising inventory manager..."); | ||
37 | m_inventoryManager = new InventoryManager(); | ||
38 | |||
39 | MainConsole.Instance.WriteLine("Starting HTTP server"); | ||
40 | BaseHttpServer httpServer = new BaseHttpServer(8004); | ||
41 | |||
42 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | ||
43 | } | ||
44 | |||
45 | public void RunCmd(string cmd, string[] cmdparams) | ||
46 | { | ||
47 | switch (cmd) | ||
48 | { | ||
49 | case "shutdown": | ||
50 | m_console.Close(); | ||
51 | Environment.Exit(0); | ||
52 | break; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | public void Show(string ShowWhat) | ||
57 | { | ||
58 | } | ||
59 | } | ||
60 | } | ||
diff --git a/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj b/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj new file mode 100644 index 0000000..4cfab2f --- /dev/null +++ b/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj | |||
@@ -0,0 +1,78 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
4 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
5 | <ProductVersion>8.0.50727</ProductVersion> | ||
6 | <SchemaVersion>2.0</SchemaVersion> | ||
7 | <ProjectGuid>{596B9D58-F27D-430B-99D2-4C1B95F74A76}</ProjectGuid> | ||
8 | <OutputType>Exe</OutputType> | ||
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
10 | <RootNamespace>OpenGridServices.InventoryServer</RootNamespace> | ||
11 | <AssemblyName>OpenGridServices.InventoryServer</AssemblyName> | ||
12 | </PropertyGroup> | ||
13 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
14 | <DebugSymbols>true</DebugSymbols> | ||
15 | <DebugType>full</DebugType> | ||
16 | <Optimize>false</Optimize> | ||
17 | <OutputPath>bin\Debug\</OutputPath> | ||
18 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
19 | <ErrorReport>prompt</ErrorReport> | ||
20 | <WarningLevel>4</WarningLevel> | ||
21 | </PropertyGroup> | ||
22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
23 | <DebugType>pdbonly</DebugType> | ||
24 | <Optimize>true</Optimize> | ||
25 | <OutputPath>bin\Release\</OutputPath> | ||
26 | <DefineConstants>TRACE</DefineConstants> | ||
27 | <ErrorReport>prompt</ErrorReport> | ||
28 | <WarningLevel>4</WarningLevel> | ||
29 | </PropertyGroup> | ||
30 | <ItemGroup> | ||
31 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
32 | <SpecificVersion>False</SpecificVersion> | ||
33 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
34 | </Reference> | ||
35 | <Reference Include="OpenSim.Framework, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
36 | <SpecificVersion>False</SpecificVersion> | ||
37 | <HintPath>..\bin\OpenSim.Framework.dll</HintPath> | ||
38 | </Reference> | ||
39 | <Reference Include="OpenSim.Framework.Console, Version=1.0.2706.24499, Culture=neutral, processorArchitecture=MSIL"> | ||
40 | <SpecificVersion>False</SpecificVersion> | ||
41 | <HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath> | ||
42 | </Reference> | ||
43 | <Reference Include="OpenSim.Servers, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
44 | <SpecificVersion>False</SpecificVersion> | ||
45 | <HintPath>..\bin\OpenSim.Servers.dll</HintPath> | ||
46 | </Reference> | ||
47 | <Reference Include="System" /> | ||
48 | <Reference Include="System.Data" /> | ||
49 | <Reference Include="System.Xml" /> | ||
50 | <Reference Include="XMLRPC, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
51 | <SpecificVersion>False</SpecificVersion> | ||
52 | <HintPath>..\bin\XMLRPC.dll</HintPath> | ||
53 | </Reference> | ||
54 | </ItemGroup> | ||
55 | <ItemGroup> | ||
56 | <Compile Include="InventoryManager.cs" /> | ||
57 | <Compile Include="Main.cs" /> | ||
58 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
59 | </ItemGroup> | ||
60 | <ItemGroup> | ||
61 | <ProjectReference Include="..\OpenGridServices\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
62 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
63 | <Name>OpenGrid.Framework.Data</Name> | ||
64 | </ProjectReference> | ||
65 | <ProjectReference Include="..\OpenGridServices\OpenGrid.Framework.Manager\OpenGrid.Framework.Manager.csproj"> | ||
66 | <Project>{7924FD35-0000-0000-0000-000000000000}</Project> | ||
67 | <Name>OpenGrid.Framework.Manager</Name> | ||
68 | </ProjectReference> | ||
69 | </ItemGroup> | ||
70 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
71 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
72 | Other similar extension points exist, see Microsoft.Common.targets. | ||
73 | <Target Name="BeforeBuild"> | ||
74 | </Target> | ||
75 | <Target Name="AfterBuild"> | ||
76 | </Target> | ||
77 | --> | ||
78 | </Project> \ No newline at end of file | ||
diff --git a/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs b/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ba8dc8b --- /dev/null +++ b/OpenGridServices.InventoryServer/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,33 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGridServices.InventoryServer")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGridServices.InventoryServer")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("d410d983-9489-46db-ac77-a7470291c01d")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | [assembly: AssemblyVersion("1.0.0.0")] | ||
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||