From 2ea3261e168bb4d9ff18b41b845587f281f5f8b2 Mon Sep 17 00:00:00 2001 From: stefanp Date: Fri, 14 Mar 2003 11:36:48 +0000 Subject: [PATCH] added addExclude() and isExcluded() which are backed by a HashSet so that we can have a per-app config of excluded strings. added readProps() which parses app.properties for helma.excludeDocs setting --- src/helma/doc/DocApplication.java | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/helma/doc/DocApplication.java b/src/helma/doc/DocApplication.java index be1bbb38..1878eaaf 100644 --- a/src/helma/doc/DocApplication.java +++ b/src/helma/doc/DocApplication.java @@ -2,11 +2,14 @@ package helma.doc; import helma.framework.IPathElement; import helma.main.Server; +import helma.util.SystemProperties; import java.io.*; import java.util.*; public class DocApplication extends DocDirElement { + HashSet excluded; + public static void main (String args[]) { // DocApplication app; // app = new DocApplication (args[0], args[1]); @@ -28,10 +31,41 @@ public class DocApplication extends DocDirElement { public DocApplication (String name, File location) throws DocException { super (name, location, APPLICATION); + readProps (); } public DocApplication (String name, String appDir) throws DocException { super (name, new File (appDir), APPLICATION); + readProps (); + } + + /** + * reads the app.properties file and parses for helma.excludeDocs + */ + private void readProps () { + File propsFile = new File (location, "app.properties"); + SystemProperties serverProps = Server.getServer ().getProperties (); + SystemProperties appProps = new SystemProperties(propsFile.getAbsolutePath (), serverProps); + + excluded = new HashSet (); + addExclude ("cvs"); + addExclude (".docs"); + String excludeProps = appProps.getProperty ("helma.excludeDocs"); + if (excludeProps != null) { + StringTokenizer tok = new StringTokenizer (excludeProps, ","); + while (tok.hasMoreTokens ()) { + String str = tok.nextToken ().trim (); + addExclude (str); + } + } + } + + public void addExclude (String str) { + excluded.add (str.toLowerCase ()); + } + + public boolean isExcluded (String str) { + return (excluded.contains (str.toLowerCase ())); } @@ -39,10 +73,11 @@ public class DocApplication extends DocDirElement { * reads all prototypes and files of the application */ public void readApplication () { + readProps (); String arr[] = location.list (); children.clear (); for (int i=0; i