aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/AssetInventoryServer/Metadata.cs
diff options
context:
space:
mode:
authorMike Mazur2009-02-16 02:28:34 +0000
committerMike Mazur2009-02-16 02:28:34 +0000
commitab5e3328323a66028bfd47562d9d515dbec433be (patch)
treed81184cd1f8788c20b4600649195be66e03f48c3 /OpenSim/Grid/AssetInventoryServer/Metadata.cs
parentWe need to return a zero-length byte array from the Handle() routine. (diff)
downloadopensim-SC-ab5e3328323a66028bfd47562d9d515dbec433be.zip
opensim-SC-ab5e3328323a66028bfd47562d9d515dbec433be.tar.gz
opensim-SC-ab5e3328323a66028bfd47562d9d515dbec433be.tar.bz2
opensim-SC-ab5e3328323a66028bfd47562d9d515dbec433be.tar.xz
- removed OpenSim.Grid.AssetInventoryServer.Metadata class in favor of
OpenSim.Framework.AssetMetadata and related updates in AssetInventory server - removed dependency on MySql.Data.MySqlClient - commented out the bulk of OpenSimInventoryStorage due to missing MySql.Data dependency - refactor asset creation in OpenSimAssetFrontend - commented out ForEach implementation, which also depended on MySql.Data, until it's supported by OpenSim backends - commented out some handlers in BrowseFrontend and ReferenceFrontend as they relied on either ForEach or the removed Metadata class
Diffstat (limited to 'OpenSim/Grid/AssetInventoryServer/Metadata.cs')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Metadata.cs84
1 files changed, 0 insertions, 84 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Metadata.cs b/OpenSim/Grid/AssetInventoryServer/Metadata.cs
deleted file mode 100644
index ebd379d..0000000
--- a/OpenSim/Grid/AssetInventoryServer/Metadata.cs
+++ /dev/null
@@ -1,84 +0,0 @@
1using System;
2using System.Collections.Generic;
3using OpenMetaverse;
4using OpenMetaverse.StructuredData;
5
6namespace OpenSim.Grid.AssetInventoryServer
7{
8 public class Metadata
9 {
10 public UUID ID;
11 public string Name;
12 public string Description;
13 public DateTime CreationDate;
14 public string ContentType;
15 public byte[] SHA1;
16 public bool Temporary;
17 public Dictionary<string, Uri> Methods = new Dictionary<string, Uri>();
18 public OSDMap ExtraData;
19
20 public OSDMap SerializeToOSD()
21 {
22 OSDMap osdata = new OSDMap();
23
24 if (ID != UUID.Zero) osdata["id"] = OSD.FromUUID(ID);
25 osdata["name"] = OSD.FromString(Name);
26 osdata["description"] = OSD.FromString(Description);
27 osdata["creation_date"] = OSD.FromDate(CreationDate);
28 osdata["type"] = OSD.FromString(ContentType);
29 osdata["sha1"] = OSD.FromBinary(SHA1);
30 osdata["temporary"] = OSD.FromBoolean(Temporary);
31
32 OSDMap methods = new OSDMap(Methods.Count);
33 foreach (KeyValuePair<string, Uri> kvp in Methods)
34 methods.Add(kvp.Key, OSD.FromUri(kvp.Value));
35 osdata["methods"] = methods;
36
37 if (ExtraData != null) osdata["extra_data"] = ExtraData;
38
39 return osdata;
40 }
41
42 public byte[] SerializeToBytes()
43 {
44 LitJson.JsonData jsonData = OSDParser.SerializeJson(SerializeToOSD());
45 return System.Text.Encoding.UTF8.GetBytes(jsonData.ToJson());
46 }
47
48 public void Deserialize(byte[] data)
49 {
50 OSD osdata = OSDParser.DeserializeJson(System.Text.Encoding.UTF8.GetString(data));
51 Deserialize(osdata);
52 }
53
54 public void Deserialize(string data)
55 {
56 OSD osdata = OSDParser.DeserializeJson(data);
57 Deserialize(osdata);
58 }
59
60 public void Deserialize(OSD osdata)
61 {
62 if (osdata.Type == OSDType.Map)
63 {
64 OSDMap map = (OSDMap)osdata;
65 ID = map["id"].AsUUID();
66 Name = map["name"].AsString();
67 Description = map["description"].AsString();
68 CreationDate = map["creation_date"].AsDate();
69 ContentType = map["type"].AsString();
70 SHA1 = map["sha1"].AsBinary();
71 Temporary = map["temporary"].AsBoolean();
72
73 OSDMap methods = map["methods"] as OSDMap;
74 if (methods != null)
75 {
76 foreach (KeyValuePair<string, OSD> kvp in methods)
77 Methods.Add(kvp.Key, kvp.Value.AsUri());
78 }
79
80 ExtraData = map["extra_data"] as OSDMap;
81 }
82 }
83 }
84}