diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
7 files changed, 220 insertions, 230 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index dc7439c..806aa4f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -37,7 +37,6 @@ using log4net; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | |||
41 | using OpenSim.Framework.Communications.Osp; | 40 | using OpenSim.Framework.Communications.Osp; |
42 | using OpenSim.Framework.Serialization; | 41 | using OpenSim.Framework.Serialization; |
43 | using OpenSim.Framework.Serialization.External; | 42 | using OpenSim.Framework.Serialization.External; |
@@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
72 | scene, | 71 | scene, |
73 | userInfo, | 72 | userInfo, |
74 | invPath, | 73 | invPath, |
75 | new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)) | 74 | new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress)) |
76 | { | 75 | { |
77 | } | 76 | } |
78 | 77 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index cfe3caa..8f3f65b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -37,7 +37,6 @@ using OpenSim.Framework; | |||
37 | using OpenSim.Framework.Serialization; | 37 | using OpenSim.Framework.Serialization; |
38 | using OpenSim.Framework.Serialization.External; | 38 | using OpenSim.Framework.Serialization.External; |
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | |||
41 | using OpenSim.Framework.Communications.Osp; | 40 | using OpenSim.Framework.Communications.Osp; |
42 | using OpenSim.Region.CoreModules.World.Archiver; | 41 | using OpenSim.Region.CoreModules.World.Archiver; |
43 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index f570999..307db97 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -91,13 +91,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
91 | 91 | ||
92 | scene.AddCommand( | 92 | scene.AddCommand( |
93 | this, "load iar", | 93 | this, "load iar", |
94 | "load iar <first> <last> <inventory path> <password> [<archive path>]", | 94 | "load iar <first> <last> <inventory path> <password> [<IAR path>]", |
95 | "Load user inventory archive.", HandleLoadInvConsoleCommand); | 95 | "Load user inventory archive (IAR).", |
96 | "<first> is user's first name." + Environment.NewLine | ||
97 | + "<last> is user's last name." + Environment.NewLine | ||
98 | + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine | ||
99 | + "<password> is the user's password." + Environment.NewLine | ||
100 | + "<IAR path> is the filesystem path or URI from which to load the IAR." | ||
101 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | ||
102 | HandleLoadInvConsoleCommand); | ||
96 | 103 | ||
97 | scene.AddCommand( | 104 | scene.AddCommand( |
98 | this, "save iar", | 105 | this, "save iar", |
99 | "save iar <first> <last> <inventory path> <password> [<archive path>]", | 106 | "save iar <first> <last> <inventory path> <password> [<IAR path>]", |
100 | "Save user inventory archive.", HandleSaveInvConsoleCommand); | 107 | "Save user inventory archive (IAR).", |
108 | "<first> is the user's first name." + Environment.NewLine | ||
109 | + "<last> is the user's last name." + Environment.NewLine | ||
110 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine | ||
111 | + "<IAR path> is the filesystem path at which to save the IAR." | ||
112 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | ||
113 | HandleSaveInvConsoleCommand); | ||
101 | 114 | ||
102 | m_aScene = scene; | 115 | m_aScene = scene; |
103 | } | 116 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 9c95e78..c81f295 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -38,7 +38,6 @@ using OpenSim.Framework; | |||
38 | using OpenSim.Framework.Serialization; | 38 | using OpenSim.Framework.Serialization; |
39 | using OpenSim.Framework.Serialization.External; | 39 | using OpenSim.Framework.Serialization.External; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | |||
42 | using OpenSim.Framework.Communications.Osp; | 41 | using OpenSim.Framework.Communications.Osp; |
43 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 42 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
44 | using OpenSim.Region.CoreModules.World.Serialiser; | 43 | using OpenSim.Region.CoreModules.World.Serialiser; |
@@ -77,125 +76,118 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
77 | // Commenting for now! The mock inventory service needs more beef, at least for | 76 | // Commenting for now! The mock inventory service needs more beef, at least for |
78 | // GetFolderForType | 77 | // GetFolderForType |
79 | // REFACTORING PROBLEM. This needs to be rewritten. | 78 | // REFACTORING PROBLEM. This needs to be rewritten. |
79 | //[Test] | ||
80 | public void TestSaveIarV0_1() | ||
81 | { | ||
82 | TestHelper.InMethod(); | ||
83 | log4net.Config.XmlConfigurator.Configure(); | ||
80 | 84 | ||
81 | // [Test] | 85 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
82 | // public void TestSaveIarV0_1() | ||
83 | // { | ||
84 | // TestHelper.InMethod(); | ||
85 | // //log4net.Config.XmlConfigurator.Configure(); | ||
86 | |||
87 | // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | ||
88 | |||
89 | // Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | ||
90 | // SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | ||
91 | // CommunicationsManager cm = scene.CommsManager; | ||
92 | 86 | ||
93 | // // Create user | 87 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); |
94 | // string userFirstName = "Jock"; | 88 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
95 | // string userLastName = "Stirrup"; | ||
96 | // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | ||
97 | 89 | ||
98 | // lock (this) | 90 | // Create user |
99 | // { | 91 | string userFirstName = "Jock"; |
100 | // UserProfileTestUtils.CreateUserWithInventory( | 92 | string userLastName = "Stirrup"; |
101 | // cm, userFirstName, userLastName, userId, InventoryReceived); | 93 | string userPassword = "troll"; |
102 | // Monitor.Wait(this, 60000); | 94 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
103 | // } | 95 | UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); |
104 | 96 | ||
105 | // // Create asset | 97 | // Create asset |
106 | // SceneObjectGroup object1; | 98 | SceneObjectGroup object1; |
107 | // SceneObjectPart part1; | 99 | SceneObjectPart part1; |
108 | // { | 100 | { |
109 | // string partName = "My Little Dog Object"; | 101 | string partName = "My Little Dog Object"; |
110 | // UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 102 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
111 | // PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 103 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
112 | // Vector3 groupPosition = new Vector3(10, 20, 30); | 104 | Vector3 groupPosition = new Vector3(10, 20, 30); |
113 | // Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 105 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); |
114 | // Vector3 offsetPosition = new Vector3(5, 10, 15); | 106 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
115 | 107 | ||
116 | // part1 | 108 | part1 |
117 | // = new SceneObjectPart( | 109 | = new SceneObjectPart( |
118 | // ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 110 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
119 | // part1.Name = partName; | 111 | part1.Name = partName; |
120 | 112 | ||
121 | // object1 = new SceneObjectGroup(part1); | 113 | object1 = new SceneObjectGroup(part1); |
122 | // scene.AddNewSceneObject(object1, false); | 114 | scene.AddNewSceneObject(object1, false); |
123 | // } | 115 | } |
124 | |||
125 | // UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | ||
126 | // AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); | ||
127 | // scene.AssetService.Store(asset1); | ||
128 | |||
129 | // // Create item | ||
130 | // UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
131 | // InventoryItemBase item1 = new InventoryItemBase(); | ||
132 | // item1.Name = "My Little Dog"; | ||
133 | // item1.AssetID = asset1.FullID; | ||
134 | // item1.ID = item1Id; | ||
135 | // InventoryFolderBase objsFolder | ||
136 | // = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects"); | ||
137 | // item1.Folder = objsFolder.ID; | ||
138 | // scene.AddInventoryItem(userId, item1); | ||
139 | |||
140 | // MemoryStream archiveWriteStream = new MemoryStream(); | ||
141 | // archiverModule.OnInventoryArchiveSaved += SaveCompleted; | ||
142 | |||
143 | // mre.Reset(); | ||
144 | // archiverModule.ArchiveInventory( | ||
145 | // Guid.NewGuid(), userFirstName, userLastName, "Objects", "troll", archiveWriteStream); | ||
146 | // mre.WaitOne(60000, false); | ||
147 | |||
148 | // byte[] archive = archiveWriteStream.ToArray(); | ||
149 | // MemoryStream archiveReadStream = new MemoryStream(archive); | ||
150 | // TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | ||
151 | |||
152 | // //bool gotControlFile = false; | ||
153 | // bool gotObject1File = false; | ||
154 | // //bool gotObject2File = false; | ||
155 | // string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1); | ||
156 | // string expectedObject1FilePath = string.Format( | ||
157 | // "{0}{1}{2}", | ||
158 | // ArchiveConstants.INVENTORY_PATH, | ||
159 | // InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder), | ||
160 | // expectedObject1FileName); | ||
161 | 116 | ||
162 | // string filePath; | 117 | UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
163 | // TarArchiveReader.TarEntryType tarEntryType; | 118 | AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); |
119 | scene.AssetService.Store(asset1); | ||
120 | |||
121 | // Create item | ||
122 | UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); | ||
123 | InventoryItemBase item1 = new InventoryItemBase(); | ||
124 | item1.Name = "My Little Dog"; | ||
125 | item1.AssetID = asset1.FullID; | ||
126 | item1.ID = item1Id; | ||
127 | InventoryFolderBase objsFolder | ||
128 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects"); | ||
129 | item1.Folder = objsFolder.ID; | ||
130 | scene.AddInventoryItem(userId, item1); | ||
131 | |||
132 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
133 | archiverModule.OnInventoryArchiveSaved += SaveCompleted; | ||
134 | |||
135 | mre.Reset(); | ||
136 | archiverModule.ArchiveInventory( | ||
137 | Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); | ||
138 | mre.WaitOne(60000, false); | ||
139 | |||
140 | byte[] archive = archiveWriteStream.ToArray(); | ||
141 | MemoryStream archiveReadStream = new MemoryStream(archive); | ||
142 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | ||
143 | |||
144 | //bool gotControlFile = false; | ||
145 | bool gotObject1File = false; | ||
146 | //bool gotObject2File = false; | ||
147 | string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1); | ||
148 | string expectedObject1FilePath = string.Format( | ||
149 | "{0}{1}{2}", | ||
150 | ArchiveConstants.INVENTORY_PATH, | ||
151 | InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder), | ||
152 | expectedObject1FileName); | ||
153 | |||
154 | string filePath; | ||
155 | TarArchiveReader.TarEntryType tarEntryType; | ||
164 | 156 | ||
165 | // Console.WriteLine("Reading archive"); | 157 | // Console.WriteLine("Reading archive"); |
166 | 158 | ||
167 | // while (tar.ReadEntry(out filePath, out tarEntryType) != null) | 159 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) |
168 | // { | 160 | { |
169 | // Console.WriteLine("Got {0}", filePath); | 161 | Console.WriteLine("Got {0}", filePath); |
170 | 162 | ||
171 | //// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) | 163 | // if (ArchiveConstants.CONTROL_FILE_PATH == filePath) |
172 | //// { | ||
173 | //// gotControlFile = true; | ||
174 | //// } | ||
175 | |||
176 | // if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) | ||
177 | // { | 164 | // { |
178 | //// string fileName = filePath.Remove(0, "Objects/".Length); | 165 | // gotControlFile = true; |
179 | //// | ||
180 | //// if (fileName.StartsWith(part1.Name)) | ||
181 | //// { | ||
182 | // Assert.That(expectedObject1FilePath, Is.EqualTo(filePath)); | ||
183 | // gotObject1File = true; | ||
184 | //// } | ||
185 | //// else if (fileName.StartsWith(part2.Name)) | ||
186 | //// { | ||
187 | //// Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); | ||
188 | //// gotObject2File = true; | ||
189 | //// } | ||
190 | // } | 166 | // } |
191 | // } | 167 | |
168 | if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) | ||
169 | { | ||
170 | // string fileName = filePath.Remove(0, "Objects/".Length); | ||
171 | // | ||
172 | // if (fileName.StartsWith(part1.Name)) | ||
173 | // { | ||
174 | Assert.That(expectedObject1FilePath, Is.EqualTo(filePath)); | ||
175 | gotObject1File = true; | ||
176 | // } | ||
177 | // else if (fileName.StartsWith(part2.Name)) | ||
178 | // { | ||
179 | // Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); | ||
180 | // gotObject2File = true; | ||
181 | // } | ||
182 | } | ||
183 | } | ||
192 | 184 | ||
193 | //// Assert.That(gotControlFile, Is.True, "No control file in archive"); | 185 | // Assert.That(gotControlFile, Is.True, "No control file in archive"); |
194 | // Assert.That(gotObject1File, Is.True, "No item1 file in archive"); | 186 | Assert.That(gotObject1File, Is.True, "No item1 file in archive"); |
195 | //// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); | 187 | // Assert.That(gotObject2File, Is.True, "No object2 file in archive"); |
196 | 188 | ||
197 | // // TODO: Test presence of more files and contents of files. | 189 | // TODO: Test presence of more files and contents of files. |
198 | // } | 190 | } |
199 | 191 | ||
200 | /// <summary> | 192 | /// <summary> |
201 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 193 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
@@ -541,56 +533,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
541 | /// <summary> | 533 | /// <summary> |
542 | /// Test replication of an archive path to the user's inventory. | 534 | /// Test replication of an archive path to the user's inventory. |
543 | /// </summary> | 535 | /// </summary> |
544 | //[Test] | 536 | [Test] |
545 | //public void TestReplicateArchivePathToUserInventory() | 537 | public void TestReplicateArchivePathToUserInventory() |
546 | //{ | 538 | { |
547 | // TestHelper.InMethod(); | 539 | TestHelper.InMethod(); |
548 | 540 | //log4net.Config.XmlConfigurator.Configure(); | |
549 | // //log4net.Config.XmlConfigurator.Configure(); | 541 | |
550 | 542 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | |
551 | // Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 543 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
552 | // CommunicationsManager commsManager = scene.CommsManager; | 544 | |
553 | // CachedUserInfo userInfo; | 545 | Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); |
554 | 546 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); | |
555 | // lock (this) | 547 | |
556 | // { | 548 | string folder1Name = "a"; |
557 | // // !!! REFACTORING PROBLEM. This needs to be rewritten | 549 | string folder2Name = "b"; |
558 | // userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); | 550 | string itemName = "c.lsl"; |
559 | // Monitor.Wait(this, 60000); | 551 | |
560 | // } | 552 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); |
561 | 553 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | |
562 | // //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); | 554 | string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); |
563 | 555 | ||
564 | // Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); | 556 | string itemArchivePath |
565 | // List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); | 557 | = string.Format( |
566 | 558 | "{0}{1}{2}{3}", | |
567 | // string folder1Name = "a"; | 559 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); |
568 | // string folder2Name = "b"; | 560 | |
569 | // string itemName = "c.lsl"; | 561 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) |
570 | 562 | .ReplicateArchivePathToUserInventory( | |
571 | // string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); | 563 | itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
572 | // string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | 564 | foldersCreated, nodesLoaded); |
573 | // string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); | 565 | |
574 | 566 | InventoryFolderBase folder1 | |
575 | // string itemArchivePath | 567 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a"); |
576 | // = string.Format( | 568 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); |
577 | // "{0}{1}{2}{3}", | 569 | InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); |
578 | // ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); | 570 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); |
579 | 571 | } | |
580 | // //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); | ||
581 | |||
582 | // new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null) | ||
583 | // .ReplicateArchivePathToUserInventory( | ||
584 | // itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID), | ||
585 | // foldersCreated, nodesLoaded); | ||
586 | |||
587 | // //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); | ||
588 | // //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); | ||
589 | // InventoryFolderBase folder1 | ||
590 | // = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a"); | ||
591 | // Assert.That(folder1, Is.Not.Null, "Could not find folder a"); | ||
592 | // InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b"); | ||
593 | // Assert.That(folder2, Is.Not.Null, "Could not find folder b"); | ||
594 | //} | ||
595 | } | 572 | } |
596 | } | 573 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs index 880bd7c..ddc3dd7 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs | |||
@@ -25,6 +25,9 @@ | |||
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 System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
28 | using OpenMetaverse; | 31 | using OpenMetaverse; |
29 | using OpenSim.Framework.Serialization; | 32 | using OpenSim.Framework.Serialization; |
30 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
@@ -60,5 +63,66 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
60 | { | 63 | { |
61 | return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); | 64 | return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); |
62 | } | 65 | } |
66 | |||
67 | /// <summary> | ||
68 | /// Resolve path to a working FileStream | ||
69 | /// </summary> | ||
70 | /// <param name="path"></param> | ||
71 | /// <returns></returns> | ||
72 | public static Stream GetStream(string path) | ||
73 | { | ||
74 | if (File.Exists(path)) | ||
75 | { | ||
76 | return new FileStream(path, FileMode.Open, FileAccess.Read); | ||
77 | } | ||
78 | else | ||
79 | { | ||
80 | try | ||
81 | { | ||
82 | Uri uri = new Uri(path); | ||
83 | if (uri.Scheme == "file") | ||
84 | { | ||
85 | return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | if (uri.Scheme != "http") | ||
90 | throw new Exception(String.Format("Unsupported URI scheme ({0})", path)); | ||
91 | |||
92 | // OK, now we know we have an HTTP URI to work with | ||
93 | return URIFetch(uri); | ||
94 | } | ||
95 | } | ||
96 | catch (UriFormatException) | ||
97 | { | ||
98 | // In many cases the user will put in a plain old filename that cannot be found so assume that | ||
99 | // this is the problem rather than confusing the issue with a UriFormatException | ||
100 | throw new Exception(String.Format("Cannot find file {0}", path)); | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | |||
105 | public static Stream URIFetch(Uri uri) | ||
106 | { | ||
107 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | ||
108 | |||
109 | // request.Credentials = credentials; | ||
110 | |||
111 | request.ContentLength = 0; | ||
112 | request.KeepAlive = false; | ||
113 | |||
114 | WebResponse response = request.GetResponse(); | ||
115 | Stream file = response.GetResponseStream(); | ||
116 | |||
117 | // justincc: gonna ignore the content type for now and just try anything | ||
118 | //if (response.ContentType != "application/x-oar") | ||
119 | // throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString())); | ||
120 | |||
121 | if (response.ContentLength == 0) | ||
122 | throw new Exception(String.Format("{0} returned an empty file", uri.ToString())); | ||
123 | |||
124 | // return new BufferedStream(file, (int) response.ContentLength); | ||
125 | return new BufferedStream(file, 1000000); | ||
126 | } | ||
63 | } | 127 | } |
64 | } \ No newline at end of file | 128 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9c8193a..57b7672 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
78 | 78 | ||
79 | try | 79 | try |
80 | { | 80 | { |
81 | m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); | 81 | m_loadStream = new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress); |
82 | } | 82 | } |
83 | catch (EntryPointNotFoundException e) | 83 | catch (EntryPointNotFoundException e) |
84 | { | 84 | { |
@@ -473,68 +473,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
473 | } | 473 | } |
474 | 474 | ||
475 | /// <summary> | 475 | /// <summary> |
476 | /// Resolve path to a working FileStream | ||
477 | /// </summary> | ||
478 | /// <param name="path"></param> | ||
479 | /// <returns></returns> | ||
480 | private Stream GetStream(string path) | ||
481 | { | ||
482 | if (File.Exists(path)) | ||
483 | { | ||
484 | return new FileStream(path, FileMode.Open, FileAccess.Read); | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | try | ||
489 | { | ||
490 | Uri uri = new Uri(path); | ||
491 | if (uri.Scheme == "file") | ||
492 | { | ||
493 | return new FileStream(uri.AbsolutePath, FileMode.Open, FileAccess.Read); | ||
494 | } | ||
495 | else | ||
496 | { | ||
497 | if (uri.Scheme != "http") | ||
498 | throw new Exception(String.Format("Unsupported URI scheme ({0})", path)); | ||
499 | |||
500 | // OK, now we know we have an HTTP URI to work with | ||
501 | |||
502 | return URIFetch(uri); | ||
503 | } | ||
504 | } | ||
505 | catch (UriFormatException) | ||
506 | { | ||
507 | // In many cases the user will put in a plain old filename that cannot be found so assume that | ||
508 | // this is the problem rather than confusing the issue with a UriFormatException | ||
509 | throw new Exception(String.Format("Cannot find file {0}", path)); | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
514 | private static Stream URIFetch(Uri uri) | ||
515 | { | ||
516 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | ||
517 | |||
518 | // request.Credentials = credentials; | ||
519 | |||
520 | request.ContentLength = 0; | ||
521 | request.KeepAlive = false; | ||
522 | |||
523 | WebResponse response = request.GetResponse(); | ||
524 | Stream file = response.GetResponseStream(); | ||
525 | |||
526 | // justincc: gonna ignore the content type for now and just try anything | ||
527 | //if (response.ContentType != "application/x-oar") | ||
528 | // throw new Exception(String.Format("{0} does not identify an OAR file", uri.ToString())); | ||
529 | |||
530 | if (response.ContentLength == 0) | ||
531 | throw new Exception(String.Format("{0} returned an empty file", uri.ToString())); | ||
532 | |||
533 | // return new BufferedStream(file, (int) response.ContentLength); | ||
534 | return new BufferedStream(file, 1000000); | ||
535 | } | ||
536 | |||
537 | /// <summary> | ||
538 | /// Load oar control file | 476 | /// Load oar control file |
539 | /// </summary> | 477 | /// </summary> |
540 | /// <param name="path"></param> | 478 | /// <param name="path"></param> |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index ac6a633..c6fb18d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1014,7 +1014,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1014 | 1014 | ||
1015 | int lastMapRefresh = 0; | 1015 | int lastMapRefresh = 0; |
1016 | int twoDays = 172800; | 1016 | int twoDays = 172800; |
1017 | int RefreshSeconds = twoDays; | 1017 | // int RefreshSeconds = twoDays; |
1018 | 1018 | ||
1019 | try | 1019 | try |
1020 | { | 1020 | { |