diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index b3852c0..ca7eb13 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs | |||
@@ -45,34 +45,34 @@ namespace OpenSim.Framework.Communications.Cache | |||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); | 47 | private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Holds the root library folder and all its descendents. This is really only used during inventory | 50 | /// Holds the root library folder and all its descendents. This is really only used during inventory |
51 | /// setup so that we don't have to repeatedly search the tree of library folders. | 51 | /// setup so that we don't have to repeatedly search the tree of library folders. |
52 | /// </summary> | 52 | /// </summary> |
53 | protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders | 53 | protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders |
54 | = new Dictionary<LLUUID, InventoryFolderImpl>(); | 54 | = new Dictionary<LLUUID, InventoryFolderImpl>(); |
55 | 55 | ||
56 | public LibraryRootFolder() | 56 | public LibraryRootFolder() |
57 | { | 57 | { |
58 | m_log.Info("[LIBRARY INVENTORY]: Loading library inventory"); | 58 | m_log.Info("[LIBRARY INVENTORY]: Loading library inventory"); |
59 | 59 | ||
60 | Owner = libOwner; | 60 | Owner = libOwner; |
61 | ID = new LLUUID("00000112-000f-0000-0000-000100bba000"); | 61 | ID = new LLUUID("00000112-000f-0000-0000-000100bba000"); |
62 | Name = "OpenSim Library"; | 62 | Name = "OpenSim Library"; |
63 | ParentID = LLUUID.Zero; | 63 | ParentID = LLUUID.Zero; |
64 | Type = (short) 8; | 64 | Type = (short) 8; |
65 | Version = (ushort) 1; | 65 | Version = (ushort) 1; |
66 | 66 | ||
67 | libraryFolders.Add(ID, this); | 67 | libraryFolders.Add(ID, this); |
68 | 68 | ||
69 | LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml")); | 69 | LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml")); |
70 | 70 | ||
71 | // CreateLibraryItems(); | 71 | // CreateLibraryItems(); |
72 | } | 72 | } |
73 | 73 | ||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Hardcoded item creation. Please don't add any more items here - future items should be created | 75 | /// Hardcoded item creation. Please don't add any more items here - future items should be created |
76 | /// in the xml in the bin/inventory folder. | 76 | /// in the xml in the bin/inventory folder. |
77 | /// </summary> | 77 | /// </summary> |
78 | /// | 78 | /// |
@@ -132,7 +132,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
132 | item.NextPermissions = 0x7FFFFFFF; | 132 | item.NextPermissions = 0x7FFFFFFF; |
133 | return item; | 133 | return item; |
134 | } | 134 | } |
135 | 135 | ||
136 | /// <summary> | 136 | /// <summary> |
137 | /// Use the asset set information at path to load assets | 137 | /// Use the asset set information at path to load assets |
138 | /// </summary> | 138 | /// </summary> |
@@ -142,49 +142,49 @@ namespace OpenSim.Framework.Communications.Cache | |||
142 | { | 142 | { |
143 | m_log.InfoFormat( | 143 | m_log.InfoFormat( |
144 | "[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath); | 144 | "[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath); |
145 | 145 | ||
146 | LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); | 146 | LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); |
147 | } | 147 | } |
148 | 148 | ||
149 | /// <summary> | 149 | /// <summary> |
150 | /// Read a library set from config | 150 | /// Read a library set from config |
151 | /// </summary> | 151 | /// </summary> |
152 | /// <param name="config"></param> | 152 | /// <param name="config"></param> |
153 | protected void ReadLibraryFromConfig(IConfig config) | 153 | protected void ReadLibraryFromConfig(IConfig config) |
154 | { | 154 | { |
155 | string foldersPath | 155 | string foldersPath |
156 | = Path.Combine( | 156 | = Path.Combine( |
157 | Util.inventoryDir(), config.GetString("foldersFile", String.Empty)); | 157 | Util.inventoryDir(), config.GetString("foldersFile", String.Empty)); |
158 | 158 | ||
159 | LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); | 159 | LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); |
160 | 160 | ||
161 | string itemsPath | 161 | string itemsPath |
162 | = Path.Combine( | 162 | = Path.Combine( |
163 | Util.inventoryDir(), config.GetString("itemsFile", String.Empty)); | 163 | Util.inventoryDir(), config.GetString("itemsFile", String.Empty)); |
164 | 164 | ||
165 | LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); | 165 | LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); |
166 | } | 166 | } |
167 | 167 | ||
168 | /// <summary> | 168 | /// <summary> |
169 | /// Read a library inventory folder from a loaded configuration | 169 | /// Read a library inventory folder from a loaded configuration |
170 | /// </summary> | 170 | /// </summary> |
171 | /// <param name="source"></param> | 171 | /// <param name="source"></param> |
172 | private void ReadFolderFromConfig(IConfig config) | 172 | private void ReadFolderFromConfig(IConfig config) |
173 | { | 173 | { |
174 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); | 174 | InventoryFolderImpl folderInfo = new InventoryFolderImpl(); |
175 | 175 | ||
176 | folderInfo.ID = new LLUUID(config.GetString("folderID", ID.ToString())); | 176 | folderInfo.ID = new LLUUID(config.GetString("folderID", ID.ToString())); |
177 | folderInfo.Name = config.GetString("name", "unknown"); | 177 | folderInfo.Name = config.GetString("name", "unknown"); |
178 | folderInfo.ParentID = new LLUUID(config.GetString("parentFolderID", ID.ToString())); | 178 | folderInfo.ParentID = new LLUUID(config.GetString("parentFolderID", ID.ToString())); |
179 | folderInfo.Type = (short)config.GetInt("type", 8); | 179 | folderInfo.Type = (short)config.GetInt("type", 8); |
180 | 180 | ||
181 | folderInfo.Owner = libOwner; | 181 | folderInfo.Owner = libOwner; |
182 | folderInfo.Version = 1; | 182 | folderInfo.Version = 1; |
183 | 183 | ||
184 | if (libraryFolders.ContainsKey(folderInfo.ParentID)) | 184 | if (libraryFolders.ContainsKey(folderInfo.ParentID)) |
185 | { | 185 | { |
186 | InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID]; | 186 | InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID]; |
187 | 187 | ||
188 | libraryFolders.Add(folderInfo.ID, folderInfo); | 188 | libraryFolders.Add(folderInfo.ID, folderInfo); |
189 | parentFolder.SubFolders.Add(folderInfo.ID, folderInfo); | 189 | parentFolder.SubFolders.Add(folderInfo.ID, folderInfo); |
190 | 190 | ||
@@ -201,7 +201,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
201 | /// <summary> | 201 | /// <summary> |
202 | /// Read a library inventory item metadata from a loaded configuration | 202 | /// Read a library inventory item metadata from a loaded configuration |
203 | /// </summary> | 203 | /// </summary> |
204 | /// <param name="source"></param> | 204 | /// <param name="source"></param> |
205 | private void ReadItemFromConfig(IConfig config) | 205 | private void ReadItemFromConfig(IConfig config) |
206 | { | 206 | { |
207 | InventoryItemBase item = new InventoryItemBase(); | 207 | InventoryItemBase item = new InventoryItemBase(); |
@@ -218,11 +218,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
218 | item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); | 218 | item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); |
219 | item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); | 219 | item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); |
220 | item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); | 220 | item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); |
221 | 221 | ||
222 | if (libraryFolders.ContainsKey(item.Folder)) | 222 | if (libraryFolders.ContainsKey(item.Folder)) |
223 | { | 223 | { |
224 | InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; | 224 | InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; |
225 | 225 | ||
226 | parentFolder.Items.Add(item.ID, item); | 226 | parentFolder.Items.Add(item.ID, item); |
227 | } | 227 | } |
228 | else | 228 | else |
@@ -230,11 +230,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
230 | m_log.WarnFormat( | 230 | m_log.WarnFormat( |
231 | "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", | 231 | "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", |
232 | item.Name, item.ID, item.Folder); | 232 | item.Name, item.ID, item.Folder); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | private delegate void ConfigAction(IConfig config); | 236 | private delegate void ConfigAction(IConfig config); |
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Load the given configuration at a path and perform an action on each Config contained within it | 239 | /// Load the given configuration at a path and perform an action on each Config contained within it |
240 | /// </summary> | 240 | /// </summary> |
@@ -242,7 +242,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
242 | /// <param name="fileDescription"></param> | 242 | /// <param name="fileDescription"></param> |
243 | /// <param name="action"></param> | 243 | /// <param name="action"></param> |
244 | private static void LoadFromFile(string path, string fileDescription, ConfigAction action) | 244 | private static void LoadFromFile(string path, string fileDescription, ConfigAction action) |
245 | { | 245 | { |
246 | if (File.Exists(path)) | 246 | if (File.Exists(path)) |
247 | { | 247 | { |
248 | try | 248 | try |
@@ -250,21 +250,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
250 | XmlConfigSource source = new XmlConfigSource(path); | 250 | XmlConfigSource source = new XmlConfigSource(path); |
251 | 251 | ||
252 | for (int i = 0; i < source.Configs.Count; i++) | 252 | for (int i = 0; i < source.Configs.Count; i++) |
253 | { | 253 | { |
254 | action(source.Configs[i]); | 254 | action(source.Configs[i]); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | catch (XmlException e) | 257 | catch (XmlException e) |
258 | { | 258 | { |
259 | m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e); | 259 | m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | else | 262 | else |
263 | { | 263 | { |
264 | m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path); | 264 | m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | /// <summary> | 268 | /// <summary> |
269 | /// Looks like a simple getter, but is written like this for some consistency with the other Request | 269 | /// Looks like a simple getter, but is written like this for some consistency with the other Request |
270 | /// methods in the superclass | 270 | /// methods in the superclass |