diff options
author | Adam Frisby | 2007-05-16 21:10:45 +0000 |
---|---|---|
committer | Adam Frisby | 2007-05-16 21:10:45 +0000 |
commit | dc2acaa8a887e986644480237910308701c84c1a (patch) | |
tree | d5f292670f2295877cbece26ca43444dba82f03b /OpenGridServices.UserServer | |
parent | * sing loud, sing proud, sing from the heart (diff) | |
download | opensim-SC_OLD-dc2acaa8a887e986644480237910308701c84c1a.zip opensim-SC_OLD-dc2acaa8a887e986644480237910308701c84c1a.tar.gz opensim-SC_OLD-dc2acaa8a887e986644480237910308701c84c1a.tar.bz2 opensim-SC_OLD-dc2acaa8a887e986644480237910308701c84c1a.tar.xz |
Let stuff be broken!
Diffstat (limited to 'OpenGridServices.UserServer')
-rw-r--r-- | OpenGridServices.UserServer/Main.cs | 6 | ||||
-rw-r--r-- | OpenGridServices.UserServer/OpenGridServices.UserServer.csproj | 48 | ||||
-rw-r--r-- | OpenGridServices.UserServer/UserManager.cs | 102 |
3 files changed, 138 insertions, 18 deletions
diff --git a/OpenGridServices.UserServer/Main.cs b/OpenGridServices.UserServer/Main.cs index ed7b768..1c6ad8c 100644 --- a/OpenGridServices.UserServer/Main.cs +++ b/OpenGridServices.UserServer/Main.cs | |||
@@ -50,6 +50,8 @@ namespace OpenGridServices.UserServer | |||
50 | private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; | 50 | private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; |
51 | private UserConfig Cfg; | 51 | private UserConfig Cfg; |
52 | 52 | ||
53 | public UserManager m_userManager; // Replaces below. | ||
54 | |||
53 | private UserProfileManager m_userProfileManager; | 55 | private UserProfileManager m_userProfileManager; |
54 | 56 | ||
55 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); | 57 | public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>(); |
@@ -62,6 +64,7 @@ namespace OpenGridServices.UserServer | |||
62 | Console.WriteLine("Starting...\n"); | 64 | Console.WriteLine("Starting...\n"); |
63 | 65 | ||
64 | OpenUser_Main userserver = new OpenUser_Main(); | 66 | OpenUser_Main userserver = new OpenUser_Main(); |
67 | |||
65 | userserver.Startup(); | 68 | userserver.Startup(); |
66 | userserver.Work(); | 69 | userserver.Work(); |
67 | } | 70 | } |
@@ -88,6 +91,9 @@ namespace OpenGridServices.UserServer | |||
88 | Cfg = this.LoadConfigDll(this.ConfigDll); | 91 | Cfg = this.LoadConfigDll(this.ConfigDll); |
89 | Cfg.InitConfig(); | 92 | Cfg.InitConfig(); |
90 | 93 | ||
94 | MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Establishing data connection"); | ||
95 | m_userManager = new UserManager(); | ||
96 | |||
91 | MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Creating user profile manager"); | 97 | MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Creating user profile manager"); |
92 | m_userProfileManager = new UserProfileManager(); | 98 | m_userProfileManager = new UserProfileManager(); |
93 | m_userProfileManager.InitUserProfiles(); | 99 | m_userProfileManager.InitUserProfiles(); |
diff --git a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj index 888b62d..75642b3 100644 --- a/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj +++ b/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj | |||
@@ -1,4 +1,4 @@ | |||
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> |
@@ -6,7 +6,8 @@ | |||
6 | <ProjectGuid>{66591469-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{66591469-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> |
10 | </ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | 11 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 12 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenGridServices.UserServer</AssemblyName> | 13 | <AssemblyName>OpenGridServices.UserServer</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Exe</OutputType> | 18 | <OutputType>Exe</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenGridServices.UserServer</RootNamespace> | 21 | <RootNamespace>OpenGridServices.UserServer</RootNamespace> |
20 | <StartupObject></StartupObject> | 22 | <StartupObject> |
23 | </StartupObject> | ||
21 | <FileUpgradeFlags> | 24 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 25 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 26 | </PropertyGroup> |
@@ -28,7 +31,8 @@ | |||
28 | <ConfigurationOverrideFile> | 31 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 32 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 33 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 34 | <DocumentationFile> |
35 | </DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | 36 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 37 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>False</Optimize> | 38 | <Optimize>False</Optimize> |
@@ -37,7 +41,8 @@ | |||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 41 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 42 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 43 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 44 | <NoWarn> |
45 | </NoWarn> | ||
41 | </PropertyGroup> | 46 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 47 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 48 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
@@ -46,7 +51,8 @@ | |||
46 | <ConfigurationOverrideFile> | 51 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 52 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE</DefineConstants> | 53 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 54 | <DocumentationFile> |
55 | </DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | 56 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 57 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>True</Optimize> | 58 | <Optimize>True</Optimize> |
@@ -55,54 +61,59 @@ | |||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 61 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 62 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 63 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 64 | <NoWarn> |
65 | </NoWarn> | ||
59 | </PropertyGroup> | 66 | </PropertyGroup> |
60 | <ItemGroup> | 67 | <ItemGroup> |
61 | <Reference Include="System" > | 68 | <Reference Include="System"> |
62 | <HintPath>System.dll</HintPath> | 69 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 70 | <Private>False</Private> |
64 | </Reference> | 71 | </Reference> |
65 | <Reference Include="System.Data" > | 72 | <Reference Include="System.Data"> |
66 | <HintPath>System.Data.dll</HintPath> | 73 | <HintPath>System.Data.dll</HintPath> |
67 | <Private>False</Private> | 74 | <Private>False</Private> |
68 | </Reference> | 75 | </Reference> |
69 | <Reference Include="System.Xml" > | 76 | <Reference Include="System.Xml"> |
70 | <HintPath>System.Xml.dll</HintPath> | 77 | <HintPath>System.Xml.dll</HintPath> |
71 | <Private>False</Private> | 78 | <Private>False</Private> |
72 | </Reference> | 79 | </Reference> |
73 | <Reference Include="libsecondlife.dll" > | 80 | <Reference Include="libsecondlife.dll"> |
74 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 81 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
75 | <Private>False</Private> | 82 | <Private>False</Private> |
76 | </Reference> | 83 | </Reference> |
77 | <Reference Include="Db4objects.Db4o.dll" > | 84 | <Reference Include="Db4objects.Db4o.dll"> |
78 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> | 85 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> |
79 | <Private>False</Private> | 86 | <Private>False</Private> |
80 | </Reference> | 87 | </Reference> |
81 | </ItemGroup> | 88 | </ItemGroup> |
82 | <ItemGroup> | 89 | <ItemGroup> |
90 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
91 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
92 | <Name>OpenGrid.Framework.Data</Name> | ||
93 | </ProjectReference> | ||
83 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> | 94 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> |
84 | <Name>OpenSim.Framework</Name> | 95 | <Name>OpenSim.Framework</Name> |
85 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 96 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 97 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 98 | <Private>False</Private> |
88 | </ProjectReference> | 99 | </ProjectReference> |
89 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | 100 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> |
90 | <Name>OpenSim.Framework.Console</Name> | 101 | <Name>OpenSim.Framework.Console</Name> |
91 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 102 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 103 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
93 | <Private>False</Private> | 104 | <Private>False</Private> |
94 | </ProjectReference> | 105 | </ProjectReference> |
95 | <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj"> | 106 | <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj"> |
96 | <Name>OpenSim.Servers</Name> | 107 | <Name>OpenSim.Servers</Name> |
97 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | 108 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> |
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 109 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
99 | <Private>False</Private> | 110 | <Private>False</Private> |
100 | </ProjectReference> | 111 | </ProjectReference> |
101 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> | 112 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> |
102 | <Name>XMLRPC</Name> | 113 | <Name>XMLRPC</Name> |
103 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | 114 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> |
104 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 115 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
105 | <Private>False</Private> | 116 | <Private>False</Private> |
106 | </ProjectReference> | 117 | </ProjectReference> |
107 | </ItemGroup> | 118 | </ItemGroup> |
108 | <ItemGroup> | 119 | <ItemGroup> |
@@ -112,6 +123,7 @@ | |||
112 | <Compile Include="Properties\AssemblyInfo.cs"> | 123 | <Compile Include="Properties\AssemblyInfo.cs"> |
113 | <SubType>Code</SubType> | 124 | <SubType>Code</SubType> |
114 | </Compile> | 125 | </Compile> |
126 | <Compile Include="UserManager.cs" /> | ||
115 | </ItemGroup> | 127 | </ItemGroup> |
116 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | 128 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
117 | <PropertyGroup> | 129 | <PropertyGroup> |
@@ -120,4 +132,4 @@ | |||
120 | <PostBuildEvent> | 132 | <PostBuildEvent> |
121 | </PostBuildEvent> | 133 | </PostBuildEvent> |
122 | </PropertyGroup> | 134 | </PropertyGroup> |
123 | </Project> | 135 | </Project> \ No newline at end of file |
diff --git a/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices.UserServer/UserManager.cs new file mode 100644 index 0000000..7473685 --- /dev/null +++ b/OpenGridServices.UserServer/UserManager.cs | |||
@@ -0,0 +1,102 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenGrid.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | using System.Reflection; | ||
7 | |||
8 | using System.Xml; | ||
9 | using Nwc.XmlRpc; | ||
10 | using OpenSim.Framework.Sims; | ||
11 | using OpenSim.Framework.Inventory; | ||
12 | using OpenSim.Framework.Utilities; | ||
13 | |||
14 | namespace OpenGridServices.UserServer | ||
15 | { | ||
16 | public class UserManager | ||
17 | { | ||
18 | Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); | ||
19 | |||
20 | /// <summary> | ||
21 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | ||
22 | /// </summary> | ||
23 | /// <param name="FileName">The filename to the user server plugin DLL</param> | ||
24 | public void AddPlugin(string FileName) | ||
25 | { | ||
26 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Storage: Attempting to load " + FileName); | ||
27 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
28 | |||
29 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Storage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | ||
30 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
31 | { | ||
32 | if (!pluginType.IsAbstract) | ||
33 | { | ||
34 | Type typeInterface = pluginType.GetInterface("IUserData", true); | ||
35 | |||
36 | if (typeInterface != null) | ||
37 | { | ||
38 | IUserData plug = (IUserData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
39 | plug.Initialise(); | ||
40 | this._plugins.Add(plug.getName(), plug); | ||
41 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Storage: Added IUserData Interface"); | ||
42 | } | ||
43 | |||
44 | typeInterface = null; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | pluginAssembly = null; | ||
49 | } | ||
50 | |||
51 | public UserProfileData getUserProfile(LLUUID uuid) | ||
52 | { | ||
53 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
54 | { | ||
55 | try | ||
56 | { | ||
57 | return plugin.Value.getUserByUUID(uuid); | ||
58 | } | ||
59 | catch (Exception e) | ||
60 | { | ||
61 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | return null; | ||
66 | } | ||
67 | |||
68 | public UserProfileData getUserProfile(string name) | ||
69 | { | ||
70 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
71 | { | ||
72 | try | ||
73 | { | ||
74 | return plugin.Value.getUserByName(name); | ||
75 | } | ||
76 | catch (Exception e) | ||
77 | { | ||
78 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | return null; | ||
83 | } | ||
84 | |||
85 | public UserProfileData getUserProfile(string fname, string lname) | ||
86 | { | ||
87 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
88 | { | ||
89 | try | ||
90 | { | ||
91 | return plugin.Value.getUserByName(fname,lname); | ||
92 | } | ||
93 | catch (Exception e) | ||
94 | { | ||
95 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | return null; | ||
100 | } | ||
101 | } | ||
102 | } | ||