aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs320
1 files changed, 160 insertions, 160 deletions
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index fc77431..7483582 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -1,160 +1,160 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.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 OpenSim Project nor the 12* * Neither the name of the OpenSim 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*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Threading; 30using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using System.Xml.Serialization; 32using System.Xml.Serialization;
33 33
34using libsecondlife; 34using libsecondlife;
35 35
36using Nini.Config; 36using Nini.Config;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework.Types; 39using OpenSim.Framework.Types;
40using OpenSim.Framework.Utilities; 40using OpenSim.Framework.Utilities;
41using OpenSim.Framework.Communications; 41using OpenSim.Framework.Communications;
42 42
43namespace OpenSim.Framework.Communications.Cache 43namespace OpenSim.Framework.Communications.Cache
44{ 44{
45 public class GridAssetClient : IAssetServer 45 public class GridAssetClient : IAssetServer
46 { 46 {
47 private string _assetServerUrl; 47 private string _assetServerUrl;
48 private IAssetReceiver _receiver; 48 private IAssetReceiver _receiver;
49 49
50 public GridAssetClient(string serverUrl) 50 public GridAssetClient(string serverUrl)
51 { 51 {
52 _assetServerUrl = serverUrl; 52 _assetServerUrl = serverUrl;
53 } 53 }
54 54
55 #region IAssetServer Members 55 #region IAssetServer Members
56 56
57 public void SetReceiver(IAssetReceiver receiver) 57 public void SetReceiver(IAssetReceiver receiver)
58 { 58 {
59 _receiver = receiver; 59 _receiver = receiver;
60 } 60 }
61 61
62 public void FetchAsset(LLUUID assetID, bool isTexture) 62 public void FetchAsset(LLUUID assetID, bool isTexture)
63 { 63 {
64 Stream s = null; 64 Stream s = null;
65 try 65 try
66 { 66 {
67 67
68 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); 68 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
69 69
70 RestClient rc = new RestClient(_assetServerUrl); 70 RestClient rc = new RestClient(_assetServerUrl);
71 rc.AddResourcePath("assets"); 71 rc.AddResourcePath("assets");
72 rc.AddResourcePath(assetID.ToString()); 72 rc.AddResourcePath(assetID.ToString());
73 if (isTexture) 73 if (isTexture)
74 rc.AddQueryParameter("texture"); 74 rc.AddQueryParameter("texture");
75 75
76 rc.RequestMethod = "GET"; 76 rc.RequestMethod = "GET";
77 s = rc.Request(); 77 s = rc.Request();
78 78
79 if (s.Length > 0) 79 if (s.Length > 0)
80 { 80 {
81 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 81 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
82 AssetBase asset = (AssetBase)xs.Deserialize(s); 82 AssetBase asset = (AssetBase)xs.Deserialize(s);
83 83
84 _receiver.AssetReceived(asset, isTexture); 84 _receiver.AssetReceived(asset, isTexture);
85 } 85 }
86 else 86 else
87 { 87 {
88 MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", assetID.ToString()); 88 MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", assetID.ToString());
89 _receiver.AssetNotFound(assetID); 89 _receiver.AssetNotFound(assetID);
90 } 90 }
91 } 91 }
92 catch (Exception e) 92 catch (Exception e)
93 { 93 {
94 MainLog.Instance.Error("ASSETCACHE", e.Message); 94 MainLog.Instance.Error("ASSETCACHE", e.Message);
95 MainLog.Instance.Error("ASSETCACHE", e.StackTrace); 95 MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
96 } 96 }
97 } 97 }
98 98
99 public void UpdateAsset(AssetBase asset) 99 public void UpdateAsset(AssetBase asset)
100 { 100 {
101 throw new Exception("The method or operation is not implemented."); 101 throw new Exception("The method or operation is not implemented.");
102 } 102 }
103 103
104 public void StoreAndCommitAsset(AssetBase asset) 104 public void StoreAndCommitAsset(AssetBase asset)
105 { 105 {
106 try 106 try
107 { 107 {
108 MemoryStream s = new MemoryStream(); 108 MemoryStream s = new MemoryStream();
109 109
110 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 110 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
111 xs.Serialize(s, asset); 111 xs.Serialize(s, asset);
112 RestClient rc = new RestClient(_assetServerUrl); 112 RestClient rc = new RestClient(_assetServerUrl);
113 rc.AddResourcePath("assets"); 113 rc.AddResourcePath("assets");
114 rc.RequestMethod = "POST"; 114 rc.RequestMethod = "POST";
115 rc.Request(s); 115 rc.Request(s);
116 } 116 }
117 catch (Exception e) 117 catch (Exception e)
118 { 118 {
119 MainLog.Instance.Error("ASSETS", e.Message); 119 MainLog.Instance.Error("ASSETS", e.Message);
120 } 120 }
121 } 121 }
122 122
123 public void Close() 123 public void Close()
124 { 124 {
125 throw new Exception("The method or operation is not implemented."); 125 throw new Exception("The method or operation is not implemented.");
126 } 126 }
127 127
128 public void LoadAsset(AssetBase info, bool image, string filename) 128 public void LoadAsset(AssetBase info, bool image, string filename)
129 { 129 {
130 throw new Exception("The method or operation is not implemented."); 130 throw new Exception("The method or operation is not implemented.");
131 } 131 }
132 132
133 public System.Collections.Generic.List<AssetBase> GetDefaultAssets() 133 public System.Collections.Generic.List<AssetBase> GetDefaultAssets()
134 { 134 {
135 throw new Exception("The method or operation is not implemented."); 135 throw new Exception("The method or operation is not implemented.");
136 } 136 }
137 137
138 public AssetBase CreateImageAsset(string assetIdStr, string name, string filename) 138 public AssetBase CreateImageAsset(string assetIdStr, string name, string filename)
139 { 139 {
140 throw new Exception("The method or operation is not implemented."); 140 throw new Exception("The method or operation is not implemented.");
141 } 141 }
142 142
143 public void ForEachDefaultAsset(Action<AssetBase> action) 143 public void ForEachDefaultAsset(Action<AssetBase> action)
144 { 144 {
145 throw new Exception("The method or operation is not implemented."); 145 throw new Exception("The method or operation is not implemented.");
146 } 146 }
147 147
148 public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage) 148 public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage)
149 { 149 {
150 throw new Exception("The method or operation is not implemented."); 150 throw new Exception("The method or operation is not implemented.");
151 } 151 }
152 152
153 public void ForEachXmlAsset(Action<AssetBase> action) 153 public void ForEachXmlAsset(Action<AssetBase> action)
154 { 154 {
155 throw new Exception("The method or operation is not implemented."); 155 throw new Exception("The method or operation is not implemented.");
156 } 156 }
157 157
158 #endregion 158 #endregion
159 } 159 }
160} 160}