* Add support for SingleFileRepository.

* Fix support for ZipRepository.
This commit is contained in:
hns 2006-04-07 14:39:54 +00:00
parent e431e18d45
commit d4d13f5adc

View file

@ -23,6 +23,8 @@ import helma.util.SystemMap;
import helma.util.WrappedMap;
import helma.framework.repository.Repository;
import helma.framework.repository.FileRepository;
import helma.framework.repository.SingleFileRepository;
import helma.framework.repository.ZipRepository;
import java.io.File;
import java.io.Serializable;
@ -143,9 +145,24 @@ public class ApplicationBean implements Serializable {
file = new File(path + ".zip").getAbsoluteFile();
}
if (!file.exists()) {
throw new RuntimeException("Repository path does not exist: " + file);
file = new File(path + ".js").getAbsoluteFile();
}
if (!file.exists()) {
throw new RuntimeException("Repository path does not exist: " + obj);
}
if (file.isDirectory()) {
rep = new FileRepository(file);
} else if (file.isFile()) {
if (file.getName().endsWith(".js")) {
rep = new SingleFileRepository(file);
} else if (file.getName().endsWith(".zip")) {
rep = new ZipRepository(file);
} else {
throw new RuntimeException("Unrecognized file type in addRepository: " + obj);
}
} else {
throw new RuntimeException("Unrecognized file type in addRepository: " + obj);
}
rep = new FileRepository(file);
} else if (obj instanceof Repository) {
rep = (Repository) obj;
} else {