diff options
author | Melanie Thielker | 2009-05-08 14:08:41 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-08 14:08:41 +0000 |
commit | aec069d161e6d818c4b1d9b7448aebade62c29c5 (patch) | |
tree | d1a27527d0119b98d6fbf1255ad5cff7294524fe | |
parent | now that creatorID is no longer a strict UUID, and the column can still be NULL, (diff) | |
download | opensim-SC_OLD-aec069d161e6d818c4b1d9b7448aebade62c29c5.zip opensim-SC_OLD-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.gz opensim-SC_OLD-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.bz2 opensim-SC_OLD-aec069d161e6d818c4b1d9b7448aebade62c29c5.tar.xz |
More additions to the nextgen reference UGAIM
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Servers/Asset/AssetServerConnector.cs | 44 | ||||
-rw-r--r-- | OpenSim/Servers/Asset/AssetServerMain.cs | 49 | ||||
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 94 | ||||
-rw-r--r-- | OpenSim/Services/AssetService/AssetServiceBase.cs | 76 | ||||
-rw-r--r-- | OpenSim/Services/Base/ServiceBase.cs | 74 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IAssetService.cs | 53 | ||||
-rw-r--r-- | OpenSim/Services/UserService/UserServiceBase.cs | 37 | ||||
-rw-r--r-- | bin/OpenSim.Servers.UserServer.ini.example | 4 | ||||
-rw-r--r-- | prebuild.xml | 88 |
9 files changed, 490 insertions, 29 deletions
diff --git a/OpenSim/Servers/Asset/AssetServerConnector.cs b/OpenSim/Servers/Asset/AssetServerConnector.cs new file mode 100644 index 0000000..fb84211 --- /dev/null +++ b/OpenSim/Servers/Asset/AssetServerConnector.cs | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using Nini.Config; | ||
29 | using OpenSim.Services.Interfaces; | ||
30 | using OpenSim.Services.AssetService; | ||
31 | using OpenSim.Framework.Servers.HttpServer; | ||
32 | |||
33 | namespace OpenSim.Servers.AssetServer | ||
34 | { | ||
35 | public class AssetServiceConnector | ||
36 | { | ||
37 | private IAssetService m_AssetService; | ||
38 | |||
39 | public AssetServiceConnector(IConfigSource config, IHttpServer server) | ||
40 | { | ||
41 | m_AssetService = new AssetService(config); | ||
42 | } | ||
43 | } | ||
44 | } | ||
diff --git a/OpenSim/Servers/Asset/AssetServerMain.cs b/OpenSim/Servers/Asset/AssetServerMain.cs new file mode 100644 index 0000000..bc738d7 --- /dev/null +++ b/OpenSim/Servers/Asset/AssetServerMain.cs | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenSim.Servers.Base; | ||
30 | |||
31 | namespace OpenSim.Servers.AssetServer | ||
32 | { | ||
33 | public class AssetServer | ||
34 | { | ||
35 | protected static HttpServerBase m_Server = null; | ||
36 | |||
37 | protected static AssetServiceConnector m_AssetServiceConnector; | ||
38 | |||
39 | static int Main(string[] args) | ||
40 | { | ||
41 | m_Server = new HttpServerBase("Asset", args); | ||
42 | |||
43 | m_AssetServiceConnector = new AssetServiceConnector(m_Server.Config, | ||
44 | m_Server.HttpServer); | ||
45 | |||
46 | return m_Server.Run(); | ||
47 | } | ||
48 | } | ||
49 | } | ||
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs new file mode 100644 index 0000000..233fa62 --- /dev/null +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using log4net; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Data; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | |||
36 | namespace OpenSim.Services.AssetService | ||
37 | { | ||
38 | public class AssetService : AssetServiceBase, IAssetService | ||
39 | { | ||
40 | private static readonly ILog m_log = | ||
41 | LogManager.GetLogger( | ||
42 | MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
44 | public AssetService(IConfigSource config) : base(config) | ||
45 | { | ||
46 | if (m_AssetLoader != null) | ||
47 | { | ||
48 | IConfig assetConfig = config.Configs["AssetService"]; | ||
49 | if (assetConfig == null) | ||
50 | throw new Exception("No AssetService configuration"); | ||
51 | |||
52 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", | ||
53 | String.Empty); | ||
54 | |||
55 | m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); | ||
56 | m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, | ||
57 | delegate(AssetBase a) | ||
58 | { | ||
59 | Store(a); | ||
60 | }); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public AssetBase Get(string id) | ||
65 | { | ||
66 | return null; | ||
67 | } | ||
68 | |||
69 | public AssetMetadata GetMetadata(string id) | ||
70 | { | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public byte[] GetData(string id) | ||
75 | { | ||
76 | return null; | ||
77 | } | ||
78 | |||
79 | public string Store(AssetBase asset) | ||
80 | { | ||
81 | return String.Empty; | ||
82 | } | ||
83 | |||
84 | public bool UpdateContent(string id, byte[] data) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | |||
89 | public bool Delete(string id) | ||
90 | { | ||
91 | return false; | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs new file mode 100644 index 0000000..4c5ba0f --- /dev/null +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenSim.Services.Base; | ||
35 | |||
36 | namespace OpenSim.Services.AssetService | ||
37 | { | ||
38 | public class AssetServiceBase : ServiceBase | ||
39 | { | ||
40 | protected IAssetDataPlugin m_Database = null; | ||
41 | protected IAssetLoader m_AssetLoader = null; | ||
42 | |||
43 | public AssetServiceBase(IConfigSource config) : base(config) | ||
44 | { | ||
45 | IConfig assetConfig = config.Configs["AssetService"]; | ||
46 | if (assetConfig == null) | ||
47 | throw new Exception("No AssetService configuration"); | ||
48 | |||
49 | string dllName = assetConfig.GetString("StorageProvider", | ||
50 | String.Empty); | ||
51 | |||
52 | if (dllName == String.Empty) | ||
53 | throw new Exception("No StorageProvider configured"); | ||
54 | |||
55 | string connString = assetConfig.GetString("ConnectionString", | ||
56 | String.Empty); | ||
57 | |||
58 | m_Database = LoadPlugin<IAssetDataPlugin>(dllName); | ||
59 | if (m_Database == null) | ||
60 | throw new Exception("Could not find a storage interface in the given module"); | ||
61 | |||
62 | m_Database.Initialise(connString); | ||
63 | |||
64 | string loaderName = assetConfig.GetString("DefaultAssetLoader", | ||
65 | String.Empty); | ||
66 | |||
67 | if (loaderName != String.Empty) | ||
68 | { | ||
69 | m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName); | ||
70 | |||
71 | if (m_AssetLoader == null) | ||
72 | throw new Exception("Asset loader could not be loaded"); | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | } | ||
diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs new file mode 100644 index 0000000..800b172 --- /dev/null +++ b/OpenSim/Services/Base/ServiceBase.cs | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using Nini.Config; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Services.Base | ||
34 | { | ||
35 | public class ServiceBase | ||
36 | { | ||
37 | public T LoadPlugin<T>(string dllName) where T:class | ||
38 | { | ||
39 | string interfaceName = typeof(T).ToString(); | ||
40 | |||
41 | try | ||
42 | { | ||
43 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
44 | |||
45 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
46 | { | ||
47 | if (pluginType.IsPublic) | ||
48 | { | ||
49 | Type typeInterface = | ||
50 | pluginType.GetInterface(interfaceName, true); | ||
51 | if (typeInterface != null) | ||
52 | { | ||
53 | T plug = (T)Activator.CreateInstance( | ||
54 | pluginAssembly.GetType( | ||
55 | pluginType.ToString())); | ||
56 | |||
57 | return plug; | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | |||
62 | return null; | ||
63 | } | ||
64 | catch (Exception e) | ||
65 | { | ||
66 | return null; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | public ServiceBase(IConfigSource config) | ||
71 | { | ||
72 | } | ||
73 | } | ||
74 | } | ||
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs new file mode 100644 index 0000000..e1717d0 --- /dev/null +++ b/OpenSim/Services/Interfaces/IAssetService.cs | |||
@@ -0,0 +1,53 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenSim.Framework; | ||
29 | |||
30 | namespace OpenSim.Services.Interfaces | ||
31 | { | ||
32 | public interface IAssetService | ||
33 | { | ||
34 | // Three different ways to retrieve an asset | ||
35 | // | ||
36 | AssetBase Get(string id); | ||
37 | AssetMetadata GetMetadata(string id); | ||
38 | byte[] GetData(string id); | ||
39 | |||
40 | // Creates a new asset | ||
41 | // Returns a random ID if none is passed into it | ||
42 | // | ||
43 | string Store(AssetBase asset); | ||
44 | |||
45 | // Attachments and bare scripts need this!! | ||
46 | // | ||
47 | bool UpdateContent(string id, byte[] data); | ||
48 | |||
49 | // Kill an asset | ||
50 | // | ||
51 | bool Delete(string id); | ||
52 | } | ||
53 | } | ||
diff --git a/OpenSim/Services/UserService/UserServiceBase.cs b/OpenSim/Services/UserService/UserServiceBase.cs index 6a20670..0cf24a4 100644 --- a/OpenSim/Services/UserService/UserServiceBase.cs +++ b/OpenSim/Services/UserService/UserServiceBase.cs | |||
@@ -30,18 +30,19 @@ using System.Reflection; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Data; | 31 | using OpenSim.Data; |
32 | using OpenSim.Services.Interfaces; | 32 | using OpenSim.Services.Interfaces; |
33 | using OpenSim.Services.Base; | ||
33 | 34 | ||
34 | namespace OpenSim.Services.UserService | 35 | namespace OpenSim.Services.UserService |
35 | { | 36 | { |
36 | public class UserServiceBase | 37 | public class UserServiceBase: ServiceBase |
37 | { | 38 | { |
38 | protected IUserDataPlugin m_Database = null; | 39 | protected IUserDataPlugin m_Database = null; |
39 | 40 | ||
40 | public UserServiceBase(IConfigSource config) | 41 | public UserServiceBase(IConfigSource config) : base(config) |
41 | { | 42 | { |
42 | IConfig userConfig = config.Configs["UserService"]; | 43 | IConfig userConfig = config.Configs["UserService"]; |
43 | if (userConfig == null) | 44 | if (userConfig == null) |
44 | throw new Exception("No userService configuration"); | 45 | throw new Exception("No UserService configuration"); |
45 | 46 | ||
46 | string dllName = userConfig.GetString("StorageProvider", | 47 | string dllName = userConfig.GetString("StorageProvider", |
47 | String.Empty); | 48 | String.Empty); |
@@ -52,34 +53,12 @@ namespace OpenSim.Services.UserService | |||
52 | string connString = userConfig.GetString("ConnectionString", | 53 | string connString = userConfig.GetString("ConnectionString", |
53 | String.Empty); | 54 | String.Empty); |
54 | 55 | ||
55 | try | 56 | m_Database = LoadPlugin<IUserDataPlugin>(dllName); |
56 | { | ||
57 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
58 | 57 | ||
59 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 58 | if (m_Database == null) |
60 | { | 59 | throw new Exception("Could not find a storage interface in the given module"); |
61 | if (pluginType.IsPublic) | ||
62 | { | ||
63 | Type typeInterface = | ||
64 | pluginType.GetInterface("IUserDataPlugin", true); | ||
65 | if (typeInterface != null) | ||
66 | { | ||
67 | IUserDataPlugin plug = | ||
68 | (IUserDataPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
69 | plug.Initialise(connString); | ||
70 | 60 | ||
71 | m_Database = plug; | 61 | m_Database.Initialise(connString); |
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | if (m_Database == null) | ||
77 | throw new Exception("Could not find a storage interface in the given module"); | ||
78 | } | ||
79 | catch (Exception e) | ||
80 | { | ||
81 | throw new Exception("Can't open database module: "+e.Message); | ||
82 | } | ||
83 | } | 62 | } |
84 | } | 63 | } |
85 | } | 64 | } |
diff --git a/bin/OpenSim.Servers.UserServer.ini.example b/bin/OpenSim.Servers.UserServer.ini.example index 2a80f27..39d0ace 100644 --- a/bin/OpenSim.Servers.UserServer.ini.example +++ b/bin/OpenSim.Servers.UserServer.ini.example | |||
@@ -1,2 +1,6 @@ | |||
1 | [Network] | 1 | [Network] |
2 | port = 8002 | 2 | port = 8002 |
3 | |||
4 | [UserService] | ||
5 | StorageProvider = "OpenSim.Data.MySQL.dll" | ||
6 | ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim;" | ||
diff --git a/prebuild.xml b/prebuild.xml index 2e7a59c..66a255c 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -1236,6 +1236,33 @@ | |||
1236 | </Files> | 1236 | </Files> |
1237 | </Project> | 1237 | </Project> |
1238 | 1238 | ||
1239 | <Project name="OpenSim.Services.Base" path="OpenSim/Services/Base" type="Library"> | ||
1240 | <Configuration name="Debug"> | ||
1241 | <Options> | ||
1242 | <OutputPath>../../../bin/</OutputPath> | ||
1243 | </Options> | ||
1244 | </Configuration> | ||
1245 | <Configuration name="Release"> | ||
1246 | <Options> | ||
1247 | <OutputPath>../../../bin/</OutputPath> | ||
1248 | </Options> | ||
1249 | </Configuration> | ||
1250 | |||
1251 | <ReferencePath>../../../bin/</ReferencePath> | ||
1252 | <Reference name="System"/> | ||
1253 | <Reference name="OpenMetaverseTypes.dll"/> | ||
1254 | <Reference name="OpenMetaverse.dll"/> | ||
1255 | <Reference name="OpenSim.Framework"/> | ||
1256 | <Reference name="OpenSim.Framework.Console"/> | ||
1257 | <Reference name="OpenSim.Services.Interfaces"/> | ||
1258 | <Reference name="Nini.dll" /> | ||
1259 | <Reference name="log4net.dll"/> | ||
1260 | |||
1261 | <Files> | ||
1262 | <Match pattern="*.cs" recurse="true"/> | ||
1263 | </Files> | ||
1264 | </Project> | ||
1265 | |||
1239 | <Project name="OpenSim.Services.UserService" path="OpenSim/Services/UserService" type="Library"> | 1266 | <Project name="OpenSim.Services.UserService" path="OpenSim/Services/UserService" type="Library"> |
1240 | <Configuration name="Debug"> | 1267 | <Configuration name="Debug"> |
1241 | <Options> | 1268 | <Options> |
@@ -1256,6 +1283,37 @@ | |||
1256 | <Reference name="OpenSim.Framework.Console"/> | 1283 | <Reference name="OpenSim.Framework.Console"/> |
1257 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | 1284 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> |
1258 | <Reference name="OpenSim.Services.Interfaces"/> | 1285 | <Reference name="OpenSim.Services.Interfaces"/> |
1286 | <Reference name="OpenSim.Services.Base"/> | ||
1287 | <Reference name="OpenSim.Data"/> | ||
1288 | <Reference name="Nini.dll" /> | ||
1289 | <Reference name="log4net.dll"/> | ||
1290 | |||
1291 | <Files> | ||
1292 | <Match pattern="*.cs" recurse="true"/> | ||
1293 | </Files> | ||
1294 | </Project> | ||
1295 | |||
1296 | <Project name="OpenSim.Services.AssetService" path="OpenSim/Services/AssetService" type="Library"> | ||
1297 | <Configuration name="Debug"> | ||
1298 | <Options> | ||
1299 | <OutputPath>../../../bin/</OutputPath> | ||
1300 | </Options> | ||
1301 | </Configuration> | ||
1302 | <Configuration name="Release"> | ||
1303 | <Options> | ||
1304 | <OutputPath>../../../bin/</OutputPath> | ||
1305 | </Options> | ||
1306 | </Configuration> | ||
1307 | |||
1308 | <ReferencePath>../../../bin/</ReferencePath> | ||
1309 | <Reference name="System"/> | ||
1310 | <Reference name="OpenMetaverseTypes.dll"/> | ||
1311 | <Reference name="OpenMetaverse.dll"/> | ||
1312 | <Reference name="OpenSim.Framework"/> | ||
1313 | <Reference name="OpenSim.Framework.Console"/> | ||
1314 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | ||
1315 | <Reference name="OpenSim.Services.Interfaces"/> | ||
1316 | <Reference name="OpenSim.Services.Base"/> | ||
1259 | <Reference name="OpenSim.Data"/> | 1317 | <Reference name="OpenSim.Data"/> |
1260 | <Reference name="Nini.dll" /> | 1318 | <Reference name="Nini.dll" /> |
1261 | <Reference name="log4net.dll"/> | 1319 | <Reference name="log4net.dll"/> |
@@ -1323,6 +1381,36 @@ | |||
1323 | </Files> | 1381 | </Files> |
1324 | </Project> | 1382 | </Project> |
1325 | 1383 | ||
1384 | <Project name="OpenSim.Servers.AssetServer" path="OpenSim/Servers/Asset" type="Exe"> | ||
1385 | <Configuration name="Debug"> | ||
1386 | <Options> | ||
1387 | <OutputPath>../../../bin/</OutputPath> | ||
1388 | </Options> | ||
1389 | </Configuration> | ||
1390 | <Configuration name="Release"> | ||
1391 | <Options> | ||
1392 | <OutputPath>../../../bin/</OutputPath> | ||
1393 | </Options> | ||
1394 | </Configuration> | ||
1395 | |||
1396 | <ReferencePath>../../../bin/</ReferencePath> | ||
1397 | <Reference name="System"/> | ||
1398 | <Reference name="OpenMetaverseTypes.dll"/> | ||
1399 | <Reference name="OpenMetaverse.dll"/> | ||
1400 | <Reference name="OpenSim.Framework"/> | ||
1401 | <Reference name="OpenSim.Framework.Console"/> | ||
1402 | <Reference name="OpenSim.Framework.Servers.HttpServer"/> | ||
1403 | <Reference name="OpenSim.Servers.Base"/> | ||
1404 | <Reference name="OpenSim.Services.Interfaces"/> | ||
1405 | <Reference name="OpenSim.Services.AssetService"/> | ||
1406 | <Reference name="Nini.dll" /> | ||
1407 | <Reference name="log4net.dll"/> | ||
1408 | |||
1409 | <Files> | ||
1410 | <Match pattern="*.cs" recurse="true"/> | ||
1411 | </Files> | ||
1412 | </Project> | ||
1413 | |||
1326 | <Project name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> | 1414 | <Project name="OpenSim.Region.CoreModules" path="OpenSim/Region/CoreModules" type="Library"> |
1327 | <Configuration name="Debug"> | 1415 | <Configuration name="Debug"> |
1328 | <Options> | 1416 | <Options> |