From d4d13f5adca0e0e8ca873feffb39bba2ebd67259 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 7 Apr 2006 14:39:54 +0000 Subject: [PATCH] * Add support for SingleFileRepository. * Fix support for ZipRepository. --- src/helma/framework/core/ApplicationBean.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/helma/framework/core/ApplicationBean.java b/src/helma/framework/core/ApplicationBean.java index 7c0c0649..a34f843b 100644 --- a/src/helma/framework/core/ApplicationBean.java +++ b/src/helma/framework/core/ApplicationBean.java @@ -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 {