diff options
author | Adam Frisby | 2007-06-05 20:22:10 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-05 20:22:10 +0000 |
commit | 65268a51ca094cd4510f5e30d0f15602bff1e4ee (patch) | |
tree | 7871474d60e03cc64c4033e2b46f983a5e362bbc /OpenGridServices/OpenGridServices.InventoryServer | |
parent | * Fixed OGS build (diff) | |
download | opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.zip opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.gz opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.bz2 opensim-SC_OLD-65268a51ca094cd4510f5e30d0f15602bff1e4ee.tar.xz |
* Weird didnt commit inventory before
Diffstat (limited to 'OpenGridServices/OpenGridServices.InventoryServer')
3 files changed, 287 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs new file mode 100644 index 0000000..a16d3d2 --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/InventoryManager.cs | |||
@@ -0,0 +1,98 @@ | |||
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.Verbose( "Invenstorage: Attempting to load " + FileName); | ||
30 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
31 | |||
32 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "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.Verbose( "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.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | ||
65 | } | ||
66 | } | ||
67 | return null; | ||
68 | } | ||
69 | |||
70 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | ||
71 | { | ||
72 | XmlRpcResponse response = new XmlRpcResponse(); | ||
73 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
74 | |||
75 | Hashtable responseData = new Hashtable(); | ||
76 | |||
77 | // Stuff happens here | ||
78 | |||
79 | if (requestData.ContainsKey("Access-type")) | ||
80 | { | ||
81 | if (requestData["access-type"] == "rootfolders") | ||
82 | { | ||
83 | // responseData["rootfolders"] = | ||
84 | } | ||
85 | } | ||
86 | else | ||
87 | { | ||
88 | responseData["error"] = "No access-type specified."; | ||
89 | } | ||
90 | |||
91 | |||
92 | // Stuff stops happening here | ||
93 | |||
94 | response.Value = responseData; | ||
95 | return response; | ||
96 | } | ||
97 | } | ||
98 | } | ||
diff --git a/OpenGridServices/OpenGridServices.InventoryServer/Main.cs b/OpenGridServices/OpenGridServices.InventoryServer/Main.cs new file mode 100644 index 0000000..7bce965 --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/Main.cs | |||
@@ -0,0 +1,61 @@ | |||
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.Notice("Initialising inventory manager..."); | ||
37 | m_inventoryManager = new InventoryManager(); | ||
38 | |||
39 | MainConsole.Instance.Notice("Starting HTTP server"); | ||
40 | BaseHttpServer httpServer = new BaseHttpServer(8004); | ||
41 | |||
42 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); | ||
43 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | ||
44 | } | ||
45 | |||
46 | public void RunCmd(string cmd, string[] cmdparams) | ||
47 | { | ||
48 | switch (cmd) | ||
49 | { | ||
50 | case "shutdown": | ||
51 | m_console.Close(); | ||
52 | Environment.Exit(0); | ||
53 | break; | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public void Show(string ShowWhat) | ||
58 | { | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj new file mode 100644 index 0000000..0836b8d --- /dev/null +++ b/OpenGridServices/OpenGridServices.InventoryServer/OpenGridServices.InventoryServer.csproj | |||
@@ -0,0 +1,128 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{338FA00B-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGridServices.InventoryServer</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Exe</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGridServices.InventoryServer</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="System" > | ||
62 | <HintPath>System.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System.Data" > | ||
66 | <HintPath>System.Data.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Xml" > | ||
70 | <HintPath>System.Xml.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework" > | ||
74 | <HintPath>OpenSim.Framework.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="OpenSim.Framework.Console" > | ||
78 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | <Reference Include="OpenSim.GridInterfaces.Local" > | ||
82 | <HintPath>OpenSim.GridInterfaces.Local.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
85 | <Reference Include="OpenSim.Servers" > | ||
86 | <HintPath>OpenSim.Servers.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
89 | <Reference Include="libsecondlife.dll" > | ||
90 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
91 | <Private>False</Private> | ||
92 | </Reference> | ||
93 | <Reference Include="Db4objects.Db4o.dll" > | ||
94 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
95 | <Private>False</Private> | ||
96 | </Reference> | ||
97 | <Reference Include="XMLRPC" > | ||
98 | <HintPath>XMLRPC.dll</HintPath> | ||
99 | <Private>False</Private> | ||
100 | </Reference> | ||
101 | </ItemGroup> | ||
102 | <ItemGroup> | ||
103 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
104 | <Name>OpenGrid.Framework.Data</Name> | ||
105 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
107 | <Private>False</Private> | ||
108 | </ProjectReference> | ||
109 | </ItemGroup> | ||
110 | <ItemGroup> | ||
111 | <Compile Include="InventoryManager.cs"> | ||
112 | <SubType>Code</SubType> | ||
113 | </Compile> | ||
114 | <Compile Include="Main.cs"> | ||
115 | <SubType>Code</SubType> | ||
116 | </Compile> | ||
117 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
118 | <SubType>Code</SubType> | ||
119 | </Compile> | ||
120 | </ItemGroup> | ||
121 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
122 | <PropertyGroup> | ||
123 | <PreBuildEvent> | ||
124 | </PreBuildEvent> | ||
125 | <PostBuildEvent> | ||
126 | </PostBuildEvent> | ||
127 | </PropertyGroup> | ||
128 | </Project> | ||