diff options
author | Jeff Ames | 2009-06-22 10:07:27 +0000 |
---|---|---|
committer | Jeff Ames | 2009-06-22 10:07:27 +0000 |
commit | 142b481e032f7b8206a19e78af82847370b8bf9c (patch) | |
tree | 56fdf67bdc78d29214e2ea4742ffb7abcd36d212 /OpenSim/Services/Connectors | |
parent | * Panda no like LongRunningAttribute, no? Me now reverting minuscule fix, yes... (diff) | |
download | opensim-SC-142b481e032f7b8206a19e78af82847370b8bf9c.zip opensim-SC-142b481e032f7b8206a19e78af82847370b8bf9c.tar.gz opensim-SC-142b481e032f7b8206a19e78af82847370b8bf9c.tar.bz2 opensim-SC-142b481e032f7b8206a19e78af82847370b8bf9c.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Services/Connectors')
3 files changed, 544 insertions, 544 deletions
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs index 31e0aa9..677169d 100644 --- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs | |||
@@ -1,178 +1,178 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | 35 | ||
36 | namespace OpenSim.Services.Connectors | 36 | namespace OpenSim.Services.Connectors |
37 | { | 37 | { |
38 | public class HGAssetServiceConnector : IAssetService | 38 | public class HGAssetServiceConnector : IAssetService |
39 | { | 39 | { |
40 | private static readonly ILog m_log = | 40 | private static readonly ILog m_log = |
41 | LogManager.GetLogger( | 41 | LogManager.GetLogger( |
42 | MethodBase.GetCurrentMethod().DeclaringType); | 42 | MethodBase.GetCurrentMethod().DeclaringType); |
43 | 43 | ||
44 | private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>(); | 44 | private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>(); |
45 | 45 | ||
46 | public HGAssetServiceConnector(IConfigSource source) | 46 | public HGAssetServiceConnector(IConfigSource source) |
47 | { | 47 | { |
48 | IConfig moduleConfig = source.Configs["Modules"]; | 48 | IConfig moduleConfig = source.Configs["Modules"]; |
49 | if (moduleConfig != null) | 49 | if (moduleConfig != null) |
50 | { | 50 | { |
51 | // string name = moduleConfig.GetString("AssetServices", ""); | 51 | // string name = moduleConfig.GetString("AssetServices", ""); |
52 | 52 | ||
53 | IConfig assetConfig = source.Configs["AssetService"]; | 53 | IConfig assetConfig = source.Configs["AssetService"]; |
54 | if (assetConfig == null) | 54 | if (assetConfig == null) |
55 | { | 55 | { |
56 | m_log.Error("[HG ASSET SERVICE]: AssetService missing from OpenSim.ini"); | 56 | m_log.Error("[HG ASSET SERVICE]: AssetService missing from OpenSim.ini"); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | 59 | ||
60 | m_log.Info("[HG ASSET SERVICE]: HG asset service enabled"); | 60 | m_log.Info("[HG ASSET SERVICE]: HG asset service enabled"); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | private bool StringToUrlAndAssetID(string id, out string url, out string assetID) | 64 | private bool StringToUrlAndAssetID(string id, out string url, out string assetID) |
65 | { | 65 | { |
66 | url = String.Empty; | 66 | url = String.Empty; |
67 | assetID = String.Empty; | 67 | assetID = String.Empty; |
68 | 68 | ||
69 | Uri assetUri; | 69 | Uri assetUri; |
70 | 70 | ||
71 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | 71 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && |
72 | assetUri.Scheme == Uri.UriSchemeHttp) | 72 | assetUri.Scheme == Uri.UriSchemeHttp) |
73 | { | 73 | { |
74 | url = "http://" + assetUri.Authority; | 74 | url = "http://" + assetUri.Authority; |
75 | assetID = assetUri.LocalPath.Trim(new char[] {'/'}); | 75 | assetID = assetUri.LocalPath.Trim(new char[] {'/'}); |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | 81 | ||
82 | private IAssetService GetConnector(string url) | 82 | private IAssetService GetConnector(string url) |
83 | { | 83 | { |
84 | AssetServicesConnector connector = null; | 84 | AssetServicesConnector connector = null; |
85 | lock (m_connectors) | 85 | lock (m_connectors) |
86 | { | 86 | { |
87 | if (m_connectors.ContainsKey(url)) | 87 | if (m_connectors.ContainsKey(url)) |
88 | { | 88 | { |
89 | connector = m_connectors[url]; | 89 | connector = m_connectors[url]; |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | // We're instantiating this class explicitly, but this won't | 93 | // We're instantiating this class explicitly, but this won't |
94 | // work in general, because the remote grid may be running | 94 | // work in general, because the remote grid may be running |
95 | // an asset server that has a different protocol. | 95 | // an asset server that has a different protocol. |
96 | // Eventually we will want a piece of protocol asking | 96 | // Eventually we will want a piece of protocol asking |
97 | // the remote server about its kind. Definitely cool thing to do! | 97 | // the remote server about its kind. Definitely cool thing to do! |
98 | connector = new AssetServicesConnector(url); | 98 | connector = new AssetServicesConnector(url); |
99 | m_connectors.Add(url, connector); | 99 | m_connectors.Add(url, connector); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | return connector; | 102 | return connector; |
103 | } | 103 | } |
104 | 104 | ||
105 | public AssetBase Get(string id) | 105 | public AssetBase Get(string id) |
106 | { | 106 | { |
107 | string url = string.Empty; | 107 | string url = string.Empty; |
108 | string assetID = string.Empty; | 108 | string assetID = string.Empty; |
109 | 109 | ||
110 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 110 | if (StringToUrlAndAssetID(id, out url, out assetID)) |
111 | { | 111 | { |
112 | IAssetService connector = GetConnector(url); | 112 | IAssetService connector = GetConnector(url); |
113 | return connector.Get(assetID); | 113 | return connector.Get(assetID); |
114 | } | 114 | } |
115 | 115 | ||
116 | return null; | 116 | return null; |
117 | } | 117 | } |
118 | 118 | ||
119 | public AssetMetadata GetMetadata(string id) | 119 | public AssetMetadata GetMetadata(string id) |
120 | { | 120 | { |
121 | string url = string.Empty; | 121 | string url = string.Empty; |
122 | string assetID = string.Empty; | 122 | string assetID = string.Empty; |
123 | 123 | ||
124 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 124 | if (StringToUrlAndAssetID(id, out url, out assetID)) |
125 | { | 125 | { |
126 | IAssetService connector = GetConnector(url); | 126 | IAssetService connector = GetConnector(url); |
127 | return connector.GetMetadata(assetID); | 127 | return connector.GetMetadata(assetID); |
128 | } | 128 | } |
129 | 129 | ||
130 | return null; | 130 | return null; |
131 | } | 131 | } |
132 | 132 | ||
133 | public byte[] GetData(string id) | 133 | public byte[] GetData(string id) |
134 | { | 134 | { |
135 | return null; | 135 | return null; |
136 | } | 136 | } |
137 | 137 | ||
138 | public bool Get(string id, Object sender, AssetRetrieved handler) | 138 | public bool Get(string id, Object sender, AssetRetrieved handler) |
139 | { | 139 | { |
140 | string url = string.Empty; | 140 | string url = string.Empty; |
141 | string assetID = string.Empty; | 141 | string assetID = string.Empty; |
142 | 142 | ||
143 | if (StringToUrlAndAssetID(id, out url, out assetID)) | 143 | if (StringToUrlAndAssetID(id, out url, out assetID)) |
144 | { | 144 | { |
145 | IAssetService connector = GetConnector(url); | 145 | IAssetService connector = GetConnector(url); |
146 | return connector.Get(assetID, sender, handler); | 146 | return connector.Get(assetID, sender, handler); |
147 | } | 147 | } |
148 | 148 | ||
149 | return false; | 149 | return false; |
150 | } | 150 | } |
151 | 151 | ||
152 | public string Store(AssetBase asset) | 152 | public string Store(AssetBase asset) |
153 | { | 153 | { |
154 | string url = string.Empty; | 154 | string url = string.Empty; |
155 | string assetID = string.Empty; | 155 | string assetID = string.Empty; |
156 | 156 | ||
157 | if (StringToUrlAndAssetID(asset.ID, out url, out assetID)) | 157 | if (StringToUrlAndAssetID(asset.ID, out url, out assetID)) |
158 | { | 158 | { |
159 | IAssetService connector = GetConnector(url); | 159 | IAssetService connector = GetConnector(url); |
160 | // Restore the assetID to a simple UUID | 160 | // Restore the assetID to a simple UUID |
161 | asset.ID = assetID; | 161 | asset.ID = assetID; |
162 | return connector.Store(asset); | 162 | return connector.Store(asset); |
163 | } | 163 | } |
164 | 164 | ||
165 | return String.Empty; | 165 | return String.Empty; |
166 | } | 166 | } |
167 | 167 | ||
168 | public bool UpdateContent(string id, byte[] data) | 168 | public bool UpdateContent(string id, byte[] data) |
169 | { | 169 | { |
170 | return false; | 170 | return false; |
171 | } | 171 | } |
172 | 172 | ||
173 | public bool Delete(string id) | 173 | public bool Delete(string id) |
174 | { | 174 | { |
175 | return false; | 175 | return false; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | } | 178 | } |
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index e943ae4..01e517c 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs | |||
@@ -1,241 +1,241 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using System; | 30 | using System; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | 36 | ||
37 | namespace OpenSim.Services.Connectors.Inventory | 37 | namespace OpenSim.Services.Connectors.Inventory |
38 | { | 38 | { |
39 | public class HGInventoryServiceConnector : ISessionAuthInventoryService | 39 | public class HGInventoryServiceConnector : ISessionAuthInventoryService |
40 | { | 40 | { |
41 | private static readonly ILog m_log = | 41 | private static readonly ILog m_log = |
42 | LogManager.GetLogger( | 42 | LogManager.GetLogger( |
43 | MethodBase.GetCurrentMethod().DeclaringType); | 43 | MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | private Dictionary<string, InventoryServicesConnector> m_connectors = new Dictionary<string, InventoryServicesConnector>(); | 45 | private Dictionary<string, InventoryServicesConnector> m_connectors = new Dictionary<string, InventoryServicesConnector>(); |
46 | 46 | ||
47 | public HGInventoryServiceConnector(IConfigSource source) | 47 | public HGInventoryServiceConnector(IConfigSource source) |
48 | { | 48 | { |
49 | IConfig moduleConfig = source.Configs["Modules"]; | 49 | IConfig moduleConfig = source.Configs["Modules"]; |
50 | if (moduleConfig != null) | 50 | if (moduleConfig != null) |
51 | { | 51 | { |
52 | 52 | ||
53 | IConfig inventoryConfig = source.Configs["InventoryService"]; | 53 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
54 | if (inventoryConfig == null) | 54 | if (inventoryConfig == null) |
55 | { | 55 | { |
56 | m_log.Error("[HG INVENTORY SERVICE]: InventoryService missing from OpenSim.ini"); | 56 | m_log.Error("[HG INVENTORY SERVICE]: InventoryService missing from OpenSim.ini"); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | 59 | ||
60 | m_log.Info("[HG INVENTORY SERVICE]: HG inventory service enabled"); | 60 | m_log.Info("[HG INVENTORY SERVICE]: HG inventory service enabled"); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | private bool StringToUrlAndUserID(string id, out string url, out string userID) | 64 | private bool StringToUrlAndUserID(string id, out string url, out string userID) |
65 | { | 65 | { |
66 | url = String.Empty; | 66 | url = String.Empty; |
67 | userID = String.Empty; | 67 | userID = String.Empty; |
68 | 68 | ||
69 | Uri assetUri; | 69 | Uri assetUri; |
70 | 70 | ||
71 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | 71 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && |
72 | assetUri.Scheme == Uri.UriSchemeHttp) | 72 | assetUri.Scheme == Uri.UriSchemeHttp) |
73 | { | 73 | { |
74 | url = "http://" + assetUri.Authority; | 74 | url = "http://" + assetUri.Authority; |
75 | userID = assetUri.LocalPath.Trim(new char[] { '/' }); | 75 | userID = assetUri.LocalPath.Trim(new char[] { '/' }); |
76 | return true; | 76 | return true; |
77 | } | 77 | } |
78 | 78 | ||
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | private ISessionAuthInventoryService GetConnector(string url) | 81 | private ISessionAuthInventoryService GetConnector(string url) |
82 | { | 82 | { |
83 | InventoryServicesConnector connector = null; | 83 | InventoryServicesConnector connector = null; |
84 | lock (m_connectors) | 84 | lock (m_connectors) |
85 | { | 85 | { |
86 | if (m_connectors.ContainsKey(url)) | 86 | if (m_connectors.ContainsKey(url)) |
87 | { | 87 | { |
88 | connector = m_connectors[url]; | 88 | connector = m_connectors[url]; |
89 | } | 89 | } |
90 | else | 90 | else |
91 | { | 91 | { |
92 | // We're instantiating this class explicitly, but this won't | 92 | // We're instantiating this class explicitly, but this won't |
93 | // work in general, because the remote grid may be running | 93 | // work in general, because the remote grid may be running |
94 | // an inventory server that has a different protocol. | 94 | // an inventory server that has a different protocol. |
95 | // Eventually we will want a piece of protocol asking | 95 | // Eventually we will want a piece of protocol asking |
96 | // the remote server about its kind. Definitely cool thing to do! | 96 | // the remote server about its kind. Definitely cool thing to do! |
97 | connector = new InventoryServicesConnector(url); | 97 | connector = new InventoryServicesConnector(url); |
98 | m_connectors.Add(url, connector); | 98 | m_connectors.Add(url, connector); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | return connector; | 101 | return connector; |
102 | } | 102 | } |
103 | 103 | ||
104 | public string Host | 104 | public string Host |
105 | { | 105 | { |
106 | get { return string.Empty; } | 106 | get { return string.Empty; } |
107 | } | 107 | } |
108 | 108 | ||
109 | public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) | 109 | public void GetUserInventory(string id, UUID sessionID, InventoryReceiptCallback callback) |
110 | { | 110 | { |
111 | m_log.Debug("[HGInventory]: GetUserInventory " + id); | 111 | m_log.Debug("[HGInventory]: GetUserInventory " + id); |
112 | string url = string.Empty; | 112 | string url = string.Empty; |
113 | string userID = string.Empty; | 113 | string userID = string.Empty; |
114 | 114 | ||
115 | if (StringToUrlAndUserID(id, out url, out userID)) | 115 | if (StringToUrlAndUserID(id, out url, out userID)) |
116 | { | 116 | { |
117 | ISessionAuthInventoryService connector = GetConnector(url); | 117 | ISessionAuthInventoryService connector = GetConnector(url); |
118 | connector.GetUserInventory(userID, sessionID, callback); | 118 | connector.GetUserInventory(userID, sessionID, callback); |
119 | } | 119 | } |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) | 123 | public bool AddFolder(string id, InventoryFolderBase folder, UUID sessionID) |
124 | { | 124 | { |
125 | string url = string.Empty; | 125 | string url = string.Empty; |
126 | string userID = string.Empty; | 126 | string userID = string.Empty; |
127 | 127 | ||
128 | if (StringToUrlAndUserID(id, out url, out userID)) | 128 | if (StringToUrlAndUserID(id, out url, out userID)) |
129 | { | 129 | { |
130 | ISessionAuthInventoryService connector = GetConnector(url); | 130 | ISessionAuthInventoryService connector = GetConnector(url); |
131 | return connector.AddFolder(userID, folder, sessionID); | 131 | return connector.AddFolder(userID, folder, sessionID); |
132 | } | 132 | } |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | 135 | ||
136 | public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID) | 136 | public bool UpdateFolder(string id, InventoryFolderBase folder, UUID sessionID) |
137 | { | 137 | { |
138 | string url = string.Empty; | 138 | string url = string.Empty; |
139 | string userID = string.Empty; | 139 | string userID = string.Empty; |
140 | 140 | ||
141 | if (StringToUrlAndUserID(id, out url, out userID)) | 141 | if (StringToUrlAndUserID(id, out url, out userID)) |
142 | { | 142 | { |
143 | ISessionAuthInventoryService connector = GetConnector(url); | 143 | ISessionAuthInventoryService connector = GetConnector(url); |
144 | return connector.UpdateFolder(userID, folder, sessionID); | 144 | return connector.UpdateFolder(userID, folder, sessionID); |
145 | } | 145 | } |
146 | return false; | 146 | return false; |
147 | } | 147 | } |
148 | 148 | ||
149 | public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID) | 149 | public bool MoveFolder(string id, InventoryFolderBase folder, UUID sessionID) |
150 | { | 150 | { |
151 | string url = string.Empty; | 151 | string url = string.Empty; |
152 | string userID = string.Empty; | 152 | string userID = string.Empty; |
153 | 153 | ||
154 | if (StringToUrlAndUserID(id, out url, out userID)) | 154 | if (StringToUrlAndUserID(id, out url, out userID)) |
155 | { | 155 | { |
156 | ISessionAuthInventoryService connector = GetConnector(url); | 156 | ISessionAuthInventoryService connector = GetConnector(url); |
157 | return connector.MoveFolder(userID, folder, sessionID); | 157 | return connector.MoveFolder(userID, folder, sessionID); |
158 | } | 158 | } |
159 | return false; | 159 | return false; |
160 | } | 160 | } |
161 | 161 | ||
162 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) | 162 | public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) |
163 | { | 163 | { |
164 | string url = string.Empty; | 164 | string url = string.Empty; |
165 | string userID = string.Empty; | 165 | string userID = string.Empty; |
166 | 166 | ||
167 | if (StringToUrlAndUserID(id, out url, out userID)) | 167 | if (StringToUrlAndUserID(id, out url, out userID)) |
168 | { | 168 | { |
169 | ISessionAuthInventoryService connector = GetConnector(url); | 169 | ISessionAuthInventoryService connector = GetConnector(url); |
170 | return connector.PurgeFolder(userID, folder, sessionID); | 170 | return connector.PurgeFolder(userID, folder, sessionID); |
171 | } | 171 | } |
172 | return false; | 172 | return false; |
173 | } | 173 | } |
174 | 174 | ||
175 | public bool AddItem(string id, InventoryItemBase item, UUID sessionID) | 175 | public bool AddItem(string id, InventoryItemBase item, UUID sessionID) |
176 | { | 176 | { |
177 | string url = string.Empty; | 177 | string url = string.Empty; |
178 | string userID = string.Empty; | 178 | string userID = string.Empty; |
179 | 179 | ||
180 | if (StringToUrlAndUserID(id, out url, out userID)) | 180 | if (StringToUrlAndUserID(id, out url, out userID)) |
181 | { | 181 | { |
182 | ISessionAuthInventoryService connector = GetConnector(url); | 182 | ISessionAuthInventoryService connector = GetConnector(url); |
183 | return connector.AddItem(userID, item, sessionID); | 183 | return connector.AddItem(userID, item, sessionID); |
184 | } | 184 | } |
185 | return false; | 185 | return false; |
186 | } | 186 | } |
187 | 187 | ||
188 | public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID) | 188 | public bool UpdateItem(string id, InventoryItemBase item, UUID sessionID) |
189 | { | 189 | { |
190 | string url = string.Empty; | 190 | string url = string.Empty; |
191 | string userID = string.Empty; | 191 | string userID = string.Empty; |
192 | 192 | ||
193 | if (StringToUrlAndUserID(id, out url, out userID)) | 193 | if (StringToUrlAndUserID(id, out url, out userID)) |
194 | { | 194 | { |
195 | ISessionAuthInventoryService connector = GetConnector(url); | 195 | ISessionAuthInventoryService connector = GetConnector(url); |
196 | return connector.UpdateItem(userID, item, sessionID); | 196 | return connector.UpdateItem(userID, item, sessionID); |
197 | } | 197 | } |
198 | return false; | 198 | return false; |
199 | } | 199 | } |
200 | 200 | ||
201 | public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) | 201 | public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) |
202 | { | 202 | { |
203 | string url = string.Empty; | 203 | string url = string.Empty; |
204 | string userID = string.Empty; | 204 | string userID = string.Empty; |
205 | 205 | ||
206 | if (StringToUrlAndUserID(id, out url, out userID)) | 206 | if (StringToUrlAndUserID(id, out url, out userID)) |
207 | { | 207 | { |
208 | ISessionAuthInventoryService connector = GetConnector(url); | 208 | ISessionAuthInventoryService connector = GetConnector(url); |
209 | return connector.UpdateItem(userID, item, sessionID); | 209 | return connector.UpdateItem(userID, item, sessionID); |
210 | } | 210 | } |
211 | return false; | 211 | return false; |
212 | } | 212 | } |
213 | 213 | ||
214 | public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID) | 214 | public InventoryItemBase QueryItem(string id, InventoryItemBase item, UUID sessionID) |
215 | { | 215 | { |
216 | string url = string.Empty; | 216 | string url = string.Empty; |
217 | string userID = string.Empty; | 217 | string userID = string.Empty; |
218 | 218 | ||
219 | if (StringToUrlAndUserID(id, out url, out userID)) | 219 | if (StringToUrlAndUserID(id, out url, out userID)) |
220 | { | 220 | { |
221 | ISessionAuthInventoryService connector = GetConnector(url); | 221 | ISessionAuthInventoryService connector = GetConnector(url); |
222 | return connector.QueryItem(userID, item, sessionID); | 222 | return connector.QueryItem(userID, item, sessionID); |
223 | } | 223 | } |
224 | return null; | 224 | return null; |
225 | } | 225 | } |
226 | 226 | ||
227 | public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID) | 227 | public InventoryFolderBase QueryFolder(string id, InventoryFolderBase folder, UUID sessionID) |
228 | { | 228 | { |
229 | string url = string.Empty; | 229 | string url = string.Empty; |
230 | string userID = string.Empty; | 230 | string userID = string.Empty; |
231 | 231 | ||
232 | if (StringToUrlAndUserID(id, out url, out userID)) | 232 | if (StringToUrlAndUserID(id, out url, out userID)) |
233 | { | 233 | { |
234 | ISessionAuthInventoryService connector = GetConnector(url); | 234 | ISessionAuthInventoryService connector = GetConnector(url); |
235 | return connector.QueryFolder(userID, folder, sessionID); | 235 | return connector.QueryFolder(userID, folder, sessionID); |
236 | } | 236 | } |
237 | return null; | 237 | return null; |
238 | } | 238 | } |
239 | 239 | ||
240 | } | 240 | } |
241 | } | 241 | } |
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index e9375f5..0243f1f 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs | |||
@@ -1,125 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSimulator Project nor the | 12 | * * Neither the name of the OpenSimulator Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using Nwc.XmlRpc; | 40 | using Nwc.XmlRpc; |
41 | 41 | ||
42 | namespace OpenSim.Services.Connectors | 42 | namespace OpenSim.Services.Connectors |
43 | { | 43 | { |
44 | public class LandServicesConnector : ILandService | 44 | public class LandServicesConnector : ILandService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | protected IGridServices m_MapService = null; | 50 | protected IGridServices m_MapService = null; |
51 | 51 | ||
52 | public LandServicesConnector() | 52 | public LandServicesConnector() |
53 | { | 53 | { |
54 | } | 54 | } |
55 | 55 | ||
56 | public LandServicesConnector(IGridServices gridServices) | 56 | public LandServicesConnector(IGridServices gridServices) |
57 | { | 57 | { |
58 | Initialise(gridServices); | 58 | Initialise(gridServices); |
59 | } | 59 | } |
60 | 60 | ||
61 | public virtual void Initialise(IGridServices gridServices) | 61 | public virtual void Initialise(IGridServices gridServices) |
62 | { | 62 | { |
63 | m_MapService = gridServices; | 63 | m_MapService = gridServices; |
64 | } | 64 | } |
65 | 65 | ||
66 | public virtual LandData GetLandData(ulong regionHandle, uint x, uint y) | 66 | public virtual LandData GetLandData(ulong regionHandle, uint x, uint y) |
67 | { | 67 | { |
68 | LandData landData = null; | 68 | LandData landData = null; |
69 | Hashtable hash = new Hashtable(); | 69 | Hashtable hash = new Hashtable(); |
70 | hash["region_handle"] = regionHandle.ToString(); | 70 | hash["region_handle"] = regionHandle.ToString(); |
71 | hash["x"] = x.ToString(); | 71 | hash["x"] = x.ToString(); |
72 | hash["y"] = y.ToString(); | 72 | hash["y"] = y.ToString(); |
73 | 73 | ||
74 | IList paramList = new ArrayList(); | 74 | IList paramList = new ArrayList(); |
75 | paramList.Add(hash); | 75 | paramList.Add(hash); |
76 | 76 | ||
77 | try | 77 | try |
78 | { | 78 | { |
79 | RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle); | 79 | RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle); |
80 | if (info != null) // just to be sure | 80 | if (info != null) // just to be sure |
81 | { | 81 | { |
82 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 82 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
83 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 83 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; |
84 | XmlRpcResponse response = request.Send(uri, 10000); | 84 | XmlRpcResponse response = request.Send(uri, 10000); |
85 | if (response.IsFault) | 85 | if (response.IsFault) |
86 | { | 86 | { |
87 | m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString); | 87 | m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString); |
88 | } | 88 | } |
89 | else | 89 | else |
90 | { | 90 | { |
91 | hash = (Hashtable)response.Value; | 91 | hash = (Hashtable)response.Value; |
92 | try | 92 | try |
93 | { | 93 | { |
94 | landData = new LandData(); | 94 | landData = new LandData(); |
95 | landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); | 95 | landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); |
96 | landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); | 96 | landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); |
97 | landData.Area = Convert.ToInt32(hash["Area"]); | 97 | landData.Area = Convert.ToInt32(hash["Area"]); |
98 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); | 98 | landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); |
99 | landData.Description = (string)hash["Description"]; | 99 | landData.Description = (string)hash["Description"]; |
100 | landData.Flags = Convert.ToUInt32(hash["Flags"]); | 100 | landData.Flags = Convert.ToUInt32(hash["Flags"]); |
101 | landData.GlobalID = new UUID((string)hash["GlobalID"]); | 101 | landData.GlobalID = new UUID((string)hash["GlobalID"]); |
102 | landData.Name = (string)hash["Name"]; | 102 | landData.Name = (string)hash["Name"]; |
103 | landData.OwnerID = new UUID((string)hash["OwnerID"]); | 103 | landData.OwnerID = new UUID((string)hash["OwnerID"]); |
104 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); | 104 | landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); |
105 | landData.SnapshotID = new UUID((string)hash["SnapshotID"]); | 105 | landData.SnapshotID = new UUID((string)hash["SnapshotID"]); |
106 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); | 106 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); |
107 | m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); | 107 | m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); |
108 | } | 108 | } |
109 | catch (Exception e) | 109 | catch (Exception e) |
110 | { | 110 | { |
111 | m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e); | 111 | m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | } | 114 | } |
115 | else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle); | 115 | else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle); |
116 | } | 116 | } |
117 | catch (Exception e) | 117 | catch (Exception e) |
118 | { | 118 | { |
119 | m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e); | 119 | m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e); |
120 | } | 120 | } |
121 | 121 | ||
122 | return landData; | 122 | return landData; |
123 | } | 123 | } |
124 | } | 124 | } |
125 | } | 125 | } |