aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-19 17:51:42 +0000
committerJustin Clarke Casey2008-10-19 17:51:42 +0000
commitf7205da1d9e9aacf07c6e8e65f68f03848f2cb04 (patch)
treef60a02578aca207bcd6d95e034fdc790dcef9ac9 /OpenSim/Region/Environment
parent* Fixed UDP server (again) (diff)
downloadopensim-SC-f7205da1d9e9aacf07c6e8e65f68f03848f2cb04.zip
opensim-SC-f7205da1d9e9aacf07c6e8e65f68f03848f2cb04.tar.gz
opensim-SC-f7205da1d9e9aacf07c6e8e65f68f03848f2cb04.tar.bz2
opensim-SC-f7205da1d9e9aacf07c6e8e65f68f03848f2cb04.tar.xz
* move command line parsing code from inventory archive modules to opensim server
* use default inventory archive name if none is given * other minor cleanups * this facility is not useable yet
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs23
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs26
2 files changed, 24 insertions, 25 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 91763a7..79e00cd 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -45,14 +45,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
45{ 45{
46 public class InventoryArchiveReadRequest 46 public class InventoryArchiveReadRequest
47 { 47 {
48 private static ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
48 protected Scene scene; 50 protected Scene scene;
49 protected TarArchiveReader archive; 51 protected TarArchiveReader archive;
50 private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); 52 private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
51 ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53
52 CachedUserInfo userInfo; 54 CachedUserInfo userInfo;
53 UserProfileData userProfile; 55 UserProfileData userProfile;
54 CommunicationsManager commsManager; 56 CommunicationsManager commsManager;
55 string loadPath;
56 57
57 public InventoryArchiveReadRequest(Scene currentScene, CommunicationsManager commsManager) 58 public InventoryArchiveReadRequest(Scene currentScene, CommunicationsManager commsManager)
58 { 59 {
@@ -142,22 +143,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
142 return item; 143 return item;
143 } 144 }
144 145
145 public void execute(string[] cmdparams) 146 public void execute(string firstName, string lastName, string invPath, string loadPath)
146 { 147 {
147 string filePath = "ERROR"; 148 string filePath = "ERROR";
148 int successfulAssetRestores = 0; 149 int successfulAssetRestores = 0;
149 int failedAssetRestores = 0; 150 int failedAssetRestores = 0;
150 151 int successfulItemRestores = 0;
151 string firstName = cmdparams[0];
152 string lastName = cmdparams[1];
153 //string invPath = cmdparams[2];
154 loadPath = (cmdparams.Length > 3 ? cmdparams[3] : "inventory.tar.gz");
155 152
156 archive 153 archive
157 = new TarArchiveReader(new GZipStream( 154 = new TarArchiveReader(new GZipStream(
158 new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)); 155 new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress));
159 156
160
161 userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); 157 userProfile = commsManager.UserService.GetUserProfile(firstName, lastName);
162 userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); 158 userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID);
163 159
@@ -175,13 +171,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
175 { 171 {
176 //Load the item 172 //Load the item
177 InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); 173 InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data));
178 if (item != null) userInfo.AddItem(item); 174 if (item != null)
175 {
176 userInfo.AddItem(item);
177 successfulItemRestores++;
178 }
179 } 179 }
180 } 180 }
181 181
182 archive.Close(); 182 archive.Close();
183 183
184 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); 184 m_log.DebugFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
185 m_log.InfoFormat("[ARCHIVER]: Restored {0} items", successfulItemRestores);
185 } 186 }
186 187
187 /// <summary> 188 /// <summary>
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 195dade..017ebcc 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -41,15 +41,20 @@ using log4net;
41 41
42 42
43namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver 43namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
44{ 44{
45 public class InventoryArchiveWriteRequest 45 public class InventoryArchiveWriteRequest
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
47 protected Scene scene; 49 protected Scene scene;
48 protected TarArchiveWriter archive; 50 protected TarArchiveWriter archive;
49 protected CommunicationsManager commsManager; 51 protected CommunicationsManager commsManager;
50 Dictionary<UUID, int> assetUuids; 52 Dictionary<UUID, int> assetUuids;
51 string savePath; 53
52 54 /// <value>
55 /// The path to which the inventory archive will be saved.
56 /// </value>
57 private string m_savePath;
53 58
54 public InventoryArchiveWriteRequest(Scene currentScene, CommunicationsManager commsManager) 59 public InventoryArchiveWriteRequest(Scene currentScene, CommunicationsManager commsManager)
55 { 60 {
@@ -63,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
63 { 68 {
64 AssetsArchiver assetsArchiver = new AssetsArchiver(assetsFound); 69 AssetsArchiver assetsArchiver = new AssetsArchiver(assetsFound);
65 assetsArchiver.Archive(archive); 70 assetsArchiver.Archive(archive);
66 archive.WriteTar(new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress)); 71 archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress));
67 } 72 }
68 73
69 protected void saveInvItem(InventoryItemBase inventoryItem, string path) 74 protected void saveInvItem(InventoryItemBase inventoryItem, string path)
@@ -156,15 +161,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
156 } 161 }
157 } 162 }
158 163
159 public void execute(string[] cmdparams) 164 public void execute(string firstName, string lastName, string invPath, string savePath)
160 { 165 {
161 ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 166 m_savePath = savePath;
162 167
163 string firstName = cmdparams[0];
164 string lastName = cmdparams[1];
165 string invPath = cmdparams[2];
166 savePath = (cmdparams.Length > 3 ? cmdparams[3] : "inventory.tar.gz");
167
168 UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); 168 UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName);
169 if (null == userProfile) 169 if (null == userProfile)
170 { 170 {
@@ -242,8 +242,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
242 } 242 }
243 243
244 new AssetsRequest(assetUuids.Keys, scene.AssetCache, ReceivedAllAssets).Execute(); 244 new AssetsRequest(assetUuids.Keys, scene.AssetCache, ReceivedAllAssets).Execute();
245
246 } 245 }
247
248 } 246 }
249} 247}