Mercurial > hg > digilib-old
comparison servlet/src/digilib/io/AliasingDocuDirCache.java @ 197:bb4ed821d06e
Servlet version 1.18b6
- small fixes to the mapping code (really works now)
author | robcast |
---|---|
date | Tue, 23 Dec 2003 17:26:45 +0100 |
parents | afe7ff98bb71 |
children | f8c82fea551a |
comparison
equal
deleted
inserted
replaced
196:8125a068af80 | 197:bb4ed821d06e |
---|---|
56 pathMap = mapLoader.loadURL(confFile.toURL().toString()); | 56 pathMap = mapLoader.loadURL(confFile.toURL().toString()); |
57 } catch (Exception e) { | 57 } catch (Exception e) { |
58 throw new FileOpException("ERROR loading mapping file: " + e); | 58 throw new FileOpException("ERROR loading mapping file: " + e); |
59 } | 59 } |
60 if (pathMap == null) { | 60 if (pathMap == null) { |
61 throw new FileOpException("ERROR unable to load mapping file!"); | 61 throw new FileOpException("ERROR: unable to load mapping file!"); |
62 } | 62 } |
63 | 63 |
64 /* | 64 /* |
65 * load map entries into cache | 65 * load map entries into cache |
66 */ | 66 */ |
68 for (Iterator i = pathMap.keySet().iterator(); i.hasNext();) { | 68 for (Iterator i = pathMap.keySet().iterator(); i.hasNext();) { |
69 String link = (String)i.next(); | 69 String link = (String)i.next(); |
70 String dir = (String) pathMap.get(link); | 70 String dir = (String) pathMap.get(link); |
71 DocuDirectory destDir = new DocuDirectory(dir, this); | 71 DocuDirectory destDir = new DocuDirectory(dir, this); |
72 if (destDir.isValid()) { | 72 if (destDir.isValid()) { |
73 logger.debug("Aliasing dir: "+link); | |
73 // add the alias name | 74 // add the alias name |
74 putName(link, destDir); | 75 putName(link, destDir); |
75 // add the real dir | 76 // add the real dir |
76 putDir(destDir); | 77 putDir(destDir); |
77 } | 78 } |
83 * @param name | 84 * @param name |
84 * @param newdir | 85 * @param newdir |
85 */ | 86 */ |
86 public void putName(String name, DocuDirectory newdir) { | 87 public void putName(String name, DocuDirectory newdir) { |
87 if (map.containsKey(name)) { | 88 if (map.containsKey(name)) { |
88 logger.warn("Baah, duplicate key in AliasingDocuDirCache.put!"); | 89 logger.warn("Duplicate key in AliasingDocuDirCache.put -- ignored!"); |
89 } else { | 90 } else { |
90 map.put(name, newdir); | 91 map.put(name, newdir); |
91 } | 92 } |
92 } | 93 } |
93 | 94 |