* @throws ServletException
*/
public static final ArrayList<Storage> getStorageDefintion(String subfolder)
throws StorageServletException {
IFile[] files;
Storage storage;
TreeMap<String, Storage> storages;
ArrayList<Storage> storagelist;
HtmlStorage htmlStorage;
InternalStorage internalStorage;
PhotoInternalStorage photoInternalStorage;
ImageLinkStorage imageLinkStorage;
int i;
Iterator<String> keys;
try {
IPath root = Configuration.getSystemRoot().getRoot().getFolderItem(subfolder);
files = getDefinitionFiles(root, "storage.xml");
storages = new TreeMap<String, Storage>();
for (i = 0; i < files.length; i++) {
try {
storage = Storage.load(files[i]);
if (storage instanceof ImageLinkStorage) {
imageLinkStorage = (ImageLinkStorage) storage;
imageLinkStorage.setImage(getUrl(files[i].getParent(), imageLinkStorage.getImage()));
} else if (storage instanceof InternalStorage) {
internalStorage = (InternalStorage) storage;
internalStorage.setUrl(getUrl(files[i].getParent(), internalStorage.getUrl()));
} else if (storage instanceof PhotoInternalStorage) {
photoInternalStorage = (PhotoInternalStorage) storage;
photoInternalStorage.setFullSizeBW(
getUrl(files[i].getParent(), photoInternalStorage.getFullSizeBW()));
photoInternalStorage.setFullSizeColor(
getUrl(files[i].getParent(), photoInternalStorage.getFullSizeColor()));
photoInternalStorage.setThumbnailBW(
getUrl(files[i].getParent(), photoInternalStorage.getThumbnailBW()));
photoInternalStorage.setThumbnailColor(
getUrl(files[i].getParent(), photoInternalStorage.getThumbnailColor()));
photoInternalStorage.setTitle(files[i].getParent().getName());
} else if (storage instanceof HtmlStorage) {
htmlStorage = (HtmlStorage) storage;
htmlStorage.setFile(
getNonServletUrl(files[i].getParent(), htmlStorage.getFile()));
}
storages.put(storage.getTitle() + i, storage);
} catch (Exception e) {
log.log(Level.SEVERE,
"could not load storage at '"
+ files[i].getAbsoluteName() + "'", e);
}