diff options
author | Justin Clark-Casey (justincc) | 2010-07-01 22:52:31 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:19 +0100 |
commit | 9682e0c73310dae496912d7b8bc54add0fd0c3e7 (patch) | |
tree | 1491ee1b1cd4bc278b64753fde46acfd93f5cb02 /OpenSim/Data | |
parent | handle ObjectMediaNavigateMessage (diff) | |
download | opensim-SC-9682e0c73310dae496912d7b8bc54add0fd0c3e7.zip opensim-SC-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.gz opensim-SC-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.bz2 opensim-SC-9682e0c73310dae496912d7b8bc54add0fd0c3e7.tar.xz |
Implement media texture persistence over server restarts for sqlite
This is currently persisting media as an OSDArray serialized to LLSD XML.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 81d0ac4..fc9667b 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -34,6 +34,7 @@ using System.Reflection; | |||
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Data.Sqlite; | 35 | using Mono.Data.Sqlite; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -974,6 +975,8 @@ namespace OpenSim.Data.SQLite | |||
974 | createCol(prims, "CollisionSoundVolume", typeof(Double)); | 975 | createCol(prims, "CollisionSoundVolume", typeof(Double)); |
975 | 976 | ||
976 | createCol(prims, "VolumeDetect", typeof(Int16)); | 977 | createCol(prims, "VolumeDetect", typeof(Int16)); |
978 | |||
979 | createCol(prims, "MediaURL", typeof(String)); | ||
977 | 980 | ||
978 | // Add in contraints | 981 | // Add in contraints |
979 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; | 982 | prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; |
@@ -1021,6 +1024,7 @@ namespace OpenSim.Data.SQLite | |||
1021 | // way to specify this as a blob atm | 1024 | // way to specify this as a blob atm |
1022 | createCol(shapes, "Texture", typeof (Byte[])); | 1025 | createCol(shapes, "Texture", typeof (Byte[])); |
1023 | createCol(shapes, "ExtraParams", typeof (Byte[])); | 1026 | createCol(shapes, "ExtraParams", typeof (Byte[])); |
1027 | createCol(shapes, "Media", typeof(String)); | ||
1024 | 1028 | ||
1025 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; | 1029 | shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]}; |
1026 | 1030 | ||
@@ -1339,6 +1343,12 @@ namespace OpenSim.Data.SQLite | |||
1339 | 1343 | ||
1340 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) | 1344 | if (Convert.ToInt16(row["VolumeDetect"]) != 0) |
1341 | prim.VolumeDetectActive = true; | 1345 | prim.VolumeDetectActive = true; |
1346 | |||
1347 | if (!(row["MediaURL"] is System.DBNull)) | ||
1348 | { | ||
1349 | m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); | ||
1350 | prim.MediaUrl = (string)row["MediaURL"]; | ||
1351 | } | ||
1342 | 1352 | ||
1343 | return prim; | 1353 | return prim; |
1344 | } | 1354 | } |
@@ -1614,7 +1624,6 @@ namespace OpenSim.Data.SQLite | |||
1614 | row["PayButton3"] = prim.PayPrice[3]; | 1624 | row["PayButton3"] = prim.PayPrice[3]; |
1615 | row["PayButton4"] = prim.PayPrice[4]; | 1625 | row["PayButton4"] = prim.PayPrice[4]; |
1616 | 1626 | ||
1617 | |||
1618 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); | 1627 | row["TextureAnimation"] = Convert.ToBase64String(prim.TextureAnimation); |
1619 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); | 1628 | row["ParticleSystem"] = Convert.ToBase64String(prim.ParticleSystem); |
1620 | 1629 | ||
@@ -1674,7 +1683,8 @@ namespace OpenSim.Data.SQLite | |||
1674 | row["VolumeDetect"] = 1; | 1683 | row["VolumeDetect"] = 1; |
1675 | else | 1684 | else |
1676 | row["VolumeDetect"] = 0; | 1685 | row["VolumeDetect"] = 0; |
1677 | 1686 | ||
1687 | row["MediaURL"] = prim.MediaUrl; | ||
1678 | } | 1688 | } |
1679 | 1689 | ||
1680 | /// <summary> | 1690 | /// <summary> |
@@ -1849,6 +1859,19 @@ namespace OpenSim.Data.SQLite | |||
1849 | s.TextureEntry = textureEntry; | 1859 | s.TextureEntry = textureEntry; |
1850 | 1860 | ||
1851 | s.ExtraParams = (byte[]) row["ExtraParams"]; | 1861 | s.ExtraParams = (byte[]) row["ExtraParams"]; |
1862 | |||
1863 | if (!(row["Media"] is System.DBNull)) | ||
1864 | { | ||
1865 | string rawMeArray = (string)row["Media"]; | ||
1866 | OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(rawMeArray); | ||
1867 | |||
1868 | List<MediaEntry> mediaEntries = new List<MediaEntry>(); | ||
1869 | foreach (OSD osdMe in osdMeArray) | ||
1870 | mediaEntries.Add(MediaEntry.FromOSD(osdMe)); | ||
1871 | |||
1872 | s.Media = mediaEntries; | ||
1873 | } | ||
1874 | |||
1852 | return s; | 1875 | return s; |
1853 | } | 1876 | } |
1854 | 1877 | ||
@@ -1892,17 +1915,22 @@ namespace OpenSim.Data.SQLite | |||
1892 | 1915 | ||
1893 | row["Texture"] = s.TextureEntry; | 1916 | row["Texture"] = s.TextureEntry; |
1894 | row["ExtraParams"] = s.ExtraParams; | 1917 | row["ExtraParams"] = s.ExtraParams; |
1918 | |||
1919 | OSDArray meArray = new OSDArray(); | ||
1920 | foreach (MediaEntry me in s.Media) | ||
1921 | meArray.Add(me.GetOSD()); | ||
1922 | |||
1923 | row["Media"] = OSDParser.SerializeLLSDXmlString(meArray); | ||
1895 | } | 1924 | } |
1896 | 1925 | ||
1897 | /// <summary> | 1926 | /// <summary> |
1898 | /// | 1927 | /// Persistently store a prim. |
1899 | /// </summary> | 1928 | /// </summary> |
1900 | /// <param name="prim"></param> | 1929 | /// <param name="prim"></param> |
1901 | /// <param name="sceneGroupID"></param> | 1930 | /// <param name="sceneGroupID"></param> |
1902 | /// <param name="regionUUID"></param> | 1931 | /// <param name="regionUUID"></param> |
1903 | private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) | 1932 | private void addPrim(SceneObjectPart prim, UUID sceneGroupID, UUID regionUUID) |
1904 | { | 1933 | { |
1905 | |||
1906 | DataTable prims = ds.Tables["prims"]; | 1934 | DataTable prims = ds.Tables["prims"]; |
1907 | DataTable shapes = ds.Tables["primshapes"]; | 1935 | DataTable shapes = ds.Tables["primshapes"]; |
1908 | 1936 | ||