diff options
author | Mike Mazur | 2009-03-12 06:03:59 +0000 |
---|---|---|
committer | Mike Mazur | 2009-03-12 06:03:59 +0000 |
commit | f784620780e7364d10bb821719eb684eed3b4903 (patch) | |
tree | cc4a5d2af1fb69017be4b56b5966913283c7fb9d /OpenSim | |
parent | Minor bug fix. Thanks daTwitch. (diff) | |
download | opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.zip opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.gz opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.bz2 opensim-SC_OLD-f784620780e7364d10bb821719eb684eed3b4903.tar.xz |
Moving TarArchive to OpenSim.Framework.Archive
We now build OpenSim.Framework.Archive.dll which aims to contain code
used for archiving various things in OpenSim. Also remove trailing
whitespace.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Archive/TarArchiveReader.cs (renamed from OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs) | 24 | ||||
-rw-r--r-- | OpenSim/Framework/Archive/TarArchiveWriter.cs (renamed from OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs) | 26 | ||||
-rw-r--r-- | OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 3 |
10 files changed, 35 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs b/OpenSim/Framework/Archive/TarArchiveReader.cs index 070f597..eee65f5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveReader.cs +++ b/OpenSim/Framework/Archive/TarArchiveReader.cs | |||
@@ -31,7 +31,7 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using log4net; | 32 | using log4net; |
33 | 33 | ||
34 | namespace OpenSim.Region.CoreModules.World.Archiver | 34 | namespace OpenSim.Framework.Archive |
35 | { | 35 | { |
36 | /// <summary> | 36 | /// <summary> |
37 | /// Temporary code to do the bare minimum required to read a tar archive for our purposes | 37 | /// Temporary code to do the bare minimum required to read a tar archive for our purposes |
@@ -39,8 +39,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
39 | public class TarArchiveReader | 39 | public class TarArchiveReader |
40 | { | 40 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | public enum TarEntryType | 43 | public enum TarEntryType |
44 | { | 44 | { |
45 | TYPE_UNKNOWN = 0, | 45 | TYPE_UNKNOWN = 0, |
46 | TYPE_NORMAL_FILE = 1, | 46 | TYPE_NORMAL_FILE = 1, |
@@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
89 | return null; | 89 | return null; |
90 | 90 | ||
91 | entryType = header.EntryType; | 91 | entryType = header.EntryType; |
92 | filePath = header.FilePath; | 92 | filePath = header.FilePath; |
93 | return ReadData(header.FileSize); | 93 | return ReadData(header.FileSize); |
94 | } | 94 | } |
95 | 95 | ||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | // If we've reached the end of the archive we'll be in null block territory, which means | 104 | // If we've reached the end of the archive we'll be in null block territory, which means |
105 | // the next byte will be 0 | 105 | // the next byte will be 0 |
106 | if (header[0] == 0) | 106 | if (header[0] == 0) |
107 | return null; | 107 | return null; |
108 | 108 | ||
109 | TarHeader tarHeader = new TarHeader(); | 109 | TarHeader tarHeader = new TarHeader(); |
110 | 110 | ||
@@ -117,15 +117,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
117 | header = m_br.ReadBytes(512); | 117 | header = m_br.ReadBytes(512); |
118 | } | 118 | } |
119 | else | 119 | else |
120 | { | 120 | { |
121 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | 121 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); |
122 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | 122 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); |
123 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); | 123 | //m_log.DebugFormat("[TAR ARCHIVE READER]: Got short file name {0}", tarHeader.FilePath); |
124 | } | 124 | } |
125 | 125 | ||
126 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); | 126 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); |
127 | 127 | ||
128 | switch (header[156]) | 128 | switch (header[156]) |
129 | { | 129 | { |
130 | case 0: | 130 | case 0: |
131 | tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE; | 131 | tarHeader.EntryType = TarEntryType.TYPE_NORMAL_FILE; |
@@ -154,11 +154,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
154 | case (byte)'7': | 154 | case (byte)'7': |
155 | tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE; | 155 | tarHeader.EntryType = TarEntryType.TYPE_CONTIGUOUS_FILE; |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | 158 | ||
159 | return tarHeader; | 159 | return tarHeader; |
160 | } | 160 | } |
161 | 161 | ||
162 | /// <summary> | 162 | /// <summary> |
163 | /// Read data following a header | 163 | /// Read data following a header |
164 | /// </summary> | 164 | /// </summary> |
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
179 | 179 | ||
180 | m_br.ReadBytes(paddingLeft); | 180 | m_br.ReadBytes(paddingLeft); |
181 | } | 181 | } |
182 | 182 | ||
183 | return data; | 183 | return data; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Framework/Archive/TarArchiveWriter.cs index 506fcc5..59198b8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/TarArchiveWriter.cs +++ b/OpenSim/Framework/Archive/TarArchiveWriter.cs | |||
@@ -30,7 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Text; | 31 | using System.Text; |
32 | 32 | ||
33 | namespace OpenSim.Region.CoreModules.World.Archiver | 33 | namespace OpenSim.Framework.Archive |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Temporary code to produce a tar archive in tar v7 format | 36 | /// Temporary code to produce a tar archive in tar v7 format |
@@ -45,12 +45,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
45 | /// Binary writer for the underlying stream | 45 | /// Binary writer for the underlying stream |
46 | /// </summary> | 46 | /// </summary> |
47 | protected BinaryWriter m_bw; | 47 | protected BinaryWriter m_bw; |
48 | 48 | ||
49 | public TarArchiveWriter(Stream s) | 49 | public TarArchiveWriter(Stream s) |
50 | { | 50 | { |
51 | m_bw = new BinaryWriter(s); | 51 | m_bw = new BinaryWriter(s); |
52 | } | 52 | } |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Write a directory entry to the tar archive. We can only handle one path level right now! | 55 | /// Write a directory entry to the tar archive. We can only handle one path level right now! |
56 | /// </summary> | 56 | /// </summary> |
@@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
63 | 63 | ||
64 | WriteFile(dirName, new byte[0]); | 64 | WriteFile(dirName, new byte[0]); |
65 | } | 65 | } |
66 | 66 | ||
67 | /// <summary> | 67 | /// <summary> |
68 | /// Write a file to the tar archive | 68 | /// Write a file to the tar archive |
69 | /// </summary> | 69 | /// </summary> |
@@ -83,9 +83,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
83 | { | 83 | { |
84 | if (filePath.Length > 100) | 84 | if (filePath.Length > 100) |
85 | WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); | 85 | WriteEntry("././@LongLink", m_asciiEncoding.GetBytes(filePath), 'L'); |
86 | 86 | ||
87 | char fileType; | 87 | char fileType; |
88 | 88 | ||
89 | if (filePath.EndsWith("/")) | 89 | if (filePath.EndsWith("/")) |
90 | { | 90 | { |
91 | fileType = '5'; | 91 | fileType = '5'; |
@@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
93 | else | 93 | else |
94 | { | 94 | { |
95 | fileType = '0'; | 95 | fileType = '0'; |
96 | } | 96 | } |
97 | 97 | ||
98 | WriteEntry(filePath, data, fileType); | 98 | WriteEntry(filePath, data, fileType); |
99 | } | 99 | } |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Finish writing the raw tar archive data to a stream. The stream will be closed on completion. | 102 | /// Finish writing the raw tar archive data to a stream. The stream will be closed on completion. |
103 | /// </summary> | 103 | /// </summary> |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
106 | public void Close() | 106 | public void Close() |
107 | { | 107 | { |
108 | //m_log.Debug("[TAR ARCHIVE WRITER]: Writing final consecutive 0 blocks"); | 108 | //m_log.Debug("[TAR ARCHIVE WRITER]: Writing final consecutive 0 blocks"); |
109 | 109 | ||
110 | // Write two consecutive 0 blocks to end the archive | 110 | // Write two consecutive 0 blocks to end the archive |
111 | byte[] finalZeroPadding = new byte[1024]; | 111 | byte[] finalZeroPadding = new byte[1024]; |
112 | m_bw.Write(finalZeroPadding); | 112 | m_bw.Write(finalZeroPadding); |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
133 | byte[] oBytes = m_asciiEncoding.GetBytes(oString); | 133 | byte[] oBytes = m_asciiEncoding.GetBytes(oString); |
134 | 134 | ||
135 | return oBytes; | 135 | return oBytes; |
136 | } | 136 | } |
137 | 137 | ||
138 | /// <summary> | 138 | /// <summary> |
139 | /// Write a particular entry | 139 | /// Write a particular entry |
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
211 | 211 | ||
212 | byte[] padding = new byte[paddingRequired]; | 212 | byte[] padding = new byte[paddingRequired]; |
213 | m_bw.Write(padding); | 213 | m_bw.Write(padding); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs index 8d60aa6..ceded03 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs | |||
@@ -33,8 +33,8 @@ using System.Xml; | |||
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Archive; | ||
36 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
37 | using OpenSim.Region.CoreModules.World.Archiver; | ||
38 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 38 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
39 | using log4net; | 39 | using log4net; |
40 | 40 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 4a681bc..5de8adc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -35,6 +35,7 @@ using System.Xml; | |||
35 | using log4net; | 35 | using log4net; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Archive; | ||
38 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Region.CoreModules.World.Archiver; | 41 | using OpenSim.Region.CoreModules.World.Archiver; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index b0f2742..71c4740 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -34,6 +34,7 @@ using System.Xml; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Archive; | ||
37 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Region.CoreModules.World.Archiver; | 40 | using OpenSim.Region.CoreModules.World.Archiver; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 5cc0340..ef7f93f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -34,6 +34,7 @@ using NUnit.Framework.SyntaxHelpers; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Data; | 35 | using OpenSim.Data; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Archive; | ||
37 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 40 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
@@ -182,4 +183,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
182 | // TODO: Test presence of more files and contents of files. | 183 | // TODO: Test presence of more files and contents of files. |
183 | } | 184 | } |
184 | } | 185 | } |
185 | } \ No newline at end of file | 186 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 3525e04..69766d4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -35,6 +35,7 @@ using System.Text; | |||
35 | using log4net; | 35 | using log4net; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Archive; | ||
38 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
39 | using OpenSim.Region.CoreModules.World.Terrain; | 40 | using OpenSim.Region.CoreModules.World.Terrain; |
40 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index cc4eadb..34332f8 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -33,6 +33,7 @@ using System.Xml; | |||
33 | using log4net; | 33 | using log4net; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Archive; | ||
36 | using OpenSim.Region.CoreModules.World.Terrain; | 37 | using OpenSim.Region.CoreModules.World.Terrain; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs index 8debfcf..fb78af9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs | |||
@@ -32,6 +32,7 @@ using System.Xml; | |||
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Archive; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.CoreModules.World.Archiver | 37 | namespace OpenSim.Region.CoreModules.World.Archiver |
37 | { | 38 | { |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index ba5fa31..b5a2d13 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -33,6 +33,7 @@ using NUnit.Framework; | |||
33 | using NUnit.Framework.SyntaxHelpers; | 33 | using NUnit.Framework.SyntaxHelpers; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Archive; | ||
36 | using OpenSim.Region.CoreModules.World.Serialiser; | 37 | using OpenSim.Region.CoreModules.World.Serialiser; |
37 | using OpenSim.Region.CoreModules.World.Terrain; | 38 | using OpenSim.Region.CoreModules.World.Terrain; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
@@ -303,4 +304,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
303 | } | 304 | } |
304 | } | 305 | } |
305 | } | 306 | } |
306 | } \ No newline at end of file | 307 | } |