aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorRobert Adams2014-01-19 11:03:08 -0800
committerRobert Adams2014-01-19 11:03:08 -0800
commit6fbfb47b92cf01b839208d0cc7898749306e19f4 (patch)
treeb833914d24f624662550e637b0ecabaf92d3e387 /OpenSim/Region/CoreModules/World
parentvarregion: add --displacement parameter to 'load oar'. (diff)
downloadopensim-SC-6fbfb47b92cf01b839208d0cc7898749306e19f4.zip
opensim-SC-6fbfb47b92cf01b839208d0cc7898749306e19f4.tar.gz
opensim-SC-6fbfb47b92cf01b839208d0cc7898749306e19f4.tar.bz2
opensim-SC-6fbfb47b92cf01b839208d0cc7898749306e19f4.tar.xz
varregion: add --noterrain and --noparcel to 'load oar'.
--noterrain suppresses the loading of the terrain from the oar. --noparcels suppresses the loading of parcel information from the oar.
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs17
3 files changed, 54 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index d249129..637c4a3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -100,6 +100,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
100 protected bool m_merge; 100 protected bool m_merge;
101 101
102 /// <value> 102 /// <value>
103 /// If true, suppresses the loading of terrain from the oar file
104 /// </value>
105 protected bool m_noTerrain;
106
107 /// <value>
108 /// If true, suppresses the loading of parcels from the oar file
109 /// </value>
110 protected bool m_noParcels;
111
112 /// <value>
103 /// Should we ignore any assets when reloading the archive? 113 /// Should we ignore any assets when reloading the archive?
104 /// </value> 114 /// </value>
105 protected bool m_skipAssets; 115 protected bool m_skipAssets;
@@ -107,7 +117,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
107 /// <value> 117 /// <value>
108 /// Displacement added to each object as it is added to the world 118 /// Displacement added to each object as it is added to the world
109 /// </value> 119 /// </value>
110 protected Vector3 m_displacement = new Vector3(0f, 0f, 0f); 120 protected Vector3 m_displacement = Vector3.Zero;
111 121
112 /// <summary> 122 /// <summary>
113 /// Used to cache lookups for valid uuids. 123 /// Used to cache lookups for valid uuids.
@@ -137,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 private IAssetService m_assetService = null; 147 private IAssetService m_assetService = null;
138 148
139 149
140 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Vector3 displacement, Guid requestId) 150 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
141 { 151 {
142 m_rootScene = scene; 152 m_rootScene = scene;
143 153
@@ -155,10 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 } 165 }
156 166
157 m_errorMessage = String.Empty; 167 m_errorMessage = String.Empty;
158 m_merge = merge; 168 m_merge = options.ContainsKey("merge");
159 m_skipAssets = skipAssets; 169 m_noTerrain = options.ContainsKey("noTerrain");
170 m_noParcels = options.ContainsKey("noParcels");
171 m_skipAssets = options.ContainsKey("skipAssets");
160 m_requestId = requestId; 172 m_requestId = requestId;
161 m_displacement = displacement; 173 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
162 174
163 // Zero can never be a valid user id 175 // Zero can never be a valid user id
164 m_validUserUuids[UUID.Zero] = false; 176 m_validUserUuids[UUID.Zero] = false;
@@ -167,13 +179,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
167 m_assetService = m_rootScene.AssetService; 179 m_assetService = m_rootScene.AssetService;
168 } 180 }
169 181
170 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) 182 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options)
171 { 183 {
172 m_rootScene = scene; 184 m_rootScene = scene;
173 m_loadPath = null; 185 m_loadPath = null;
174 m_loadStream = loadStream; 186 m_loadStream = loadStream;
175 m_merge = merge; 187 m_skipAssets = options.ContainsKey("skipAssets");
176 m_skipAssets = skipAssets; 188 m_merge = options.ContainsKey("merge");
177 m_requestId = requestId; 189 m_requestId = requestId;
178 190
179 // Zero can never be a valid user id 191 // Zero can never be a valid user id
@@ -249,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
249 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) 261 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
250 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); 262 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
251 } 263 }
252 else if (!m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) 264 else if (!m_noTerrain && !m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
253 { 265 {
254 LoadTerrain(scene, filePath, data); 266 LoadTerrain(scene, filePath, data);
255 } 267 }
@@ -257,7 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
257 { 269 {
258 LoadRegionSettings(scene, filePath, data, dearchivedScenes); 270 LoadRegionSettings(scene, filePath, data, dearchivedScenes);
259 } 271 }
260 else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) 272 else if (!m_noParcels && !m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
261 { 273 {
262 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); 274 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data));
263 } 275 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index fb694de..df5b443 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -104,11 +104,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
104 { 104 {
105 bool mergeOar = false; 105 bool mergeOar = false;
106 bool skipAssets = false; 106 bool skipAssets = false;
107 bool noTerrain = false;
108 bool noParcels = false;
107 Vector3 displacement = new Vector3(0f, 0f, 0f); 109 Vector3 displacement = new Vector3(0f, 0f, 0f);
108 110
109 OptionSet options = new OptionSet(); 111 OptionSet options = new OptionSet();
110 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); 112 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); });
111 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); 113 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); });
114 options.Add("noterrain", delegate (string v) { noTerrain = (v != null); });
115 options.Add("noparcels", delegate (string v) { noParcels = (v != null); });
112 options.Add("displacement=", delegate (string v) { 116 options.Add("displacement=", delegate (string v) {
113 try 117 try
114 { 118 {
@@ -138,13 +142,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
138// foreach (string param in mainParams) 142// foreach (string param in mainParams)
139// m_log.DebugFormat("GOT PARAM [{0}]", param); 143// m_log.DebugFormat("GOT PARAM [{0}]", param);
140 144
145 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
146 if (mergeOar) archiveOptions.Add("merge", null);
147 if (skipAssets) archiveOptions.Add("skipAssets", null);
148 if (noTerrain) archiveOptions.Add("noTerrain", null);
149 if (noParcels) archiveOptions.Add("noParcels", null);
150 if (displacement != Vector3.Zero) archiveOptions.Add("displacement", displacement);
151
141 if (mainParams.Count > 2) 152 if (mainParams.Count > 2)
142 { 153 {
143 DearchiveRegion(mainParams[2], mergeOar, skipAssets, displacement, Guid.Empty); 154 DearchiveRegion(mainParams[2], Guid.Empty, archiveOptions);
144 } 155 }
145 else 156 else
146 { 157 {
147 DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, skipAssets, displacement, Guid.Empty); 158 DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, Guid.Empty, archiveOptions);
148 } 159 }
149 } 160 }
150 161
@@ -214,25 +225,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
214 225
215 public void DearchiveRegion(string loadPath) 226 public void DearchiveRegion(string loadPath)
216 { 227 {
217 DearchiveRegion(loadPath, false, false, new Vector3(0f, 0f, 0f), Guid.Empty); 228 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
229 DearchiveRegion(loadPath, Guid.Empty, archiveOptions);
218 } 230 }
219 231
220 public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Vector3 displacement, Guid requestId) 232 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options)
221 { 233 {
222 m_log.InfoFormat( 234 m_log.InfoFormat(
223 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); 235 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
224 236
225 new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, displacement, requestId).DearchiveRegion(); 237 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion();
226 } 238 }
227 239
228 public void DearchiveRegion(Stream loadStream) 240 public void DearchiveRegion(Stream loadStream)
229 { 241 {
230 DearchiveRegion(loadStream, false, false, new Vector3(0f, 0f, 0f), Guid.Empty); 242 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
243 DearchiveRegion(loadStream, Guid.Empty, archiveOptions);
231 } 244 }
232 245
233 public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Vector3 displacement, Guid requestId) 246 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options)
234 { 247 {
235 new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion(); 248 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion();
236 } 249 }
237 } 250 }
238} 251}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index c412acb..53f41f9 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -224,8 +224,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
224 224
225 byte[] data = tar.ReadEntry(out filePath, out tarEntryType); 225 byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
226 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); 226 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
227 227
228 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); 228 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
229 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, Guid.Empty, archiveOptions);
229 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo()); 230 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo());
230 231
231 Assert.That(arr.ControlFileLoaded, Is.True); 232 Assert.That(arr.ControlFileLoaded, Is.True);
@@ -308,8 +309,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
308 309
309 byte[] data = tar.ReadEntry(out filePath, out tarEntryType); 310 byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
310 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); 311 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
311 312
312 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); 313 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
314 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, Guid.Empty, archiveOptions);
313 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo()); 315 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo());
314 316
315 Assert.That(arr.ControlFileLoaded, Is.True); 317 Assert.That(arr.ControlFileLoaded, Is.True);
@@ -752,7 +754,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
752 byte[] archive = archiveWriteStream.ToArray(); 754 byte[] archive = archiveWriteStream.ToArray();
753 MemoryStream archiveReadStream = new MemoryStream(archive); 755 MemoryStream archiveReadStream = new MemoryStream(archive);
754 756
755 m_archiverModule.DearchiveRegion(archiveReadStream, true, false, new Vector3(0f, 0f, 0f), Guid.Empty); 757 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
758 archiveOptions.Add("merge", null);
759 m_archiverModule.DearchiveRegion(archiveReadStream, Guid.Empty, archiveOptions);
756 760
757 SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); 761 SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name);
758 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); 762 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");
@@ -860,7 +864,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
860 byte[] data = tar.ReadEntry(out filePath, out tarEntryType); 864 byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
861 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); 865 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
862 866
863 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, false, false, Guid.Empty); 867 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
868 ArchiveReadRequest arr = new ArchiveReadRequest(m_scene, (Stream)null, Guid.Empty, archiveOptions);
864 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo()); 869 arr.LoadControlFile(filePath, data, new DearchiveScenesInfo());
865 870
866 Assert.That(arr.ControlFileLoaded, Is.True); 871 Assert.That(arr.ControlFileLoaded, Is.True);