ca.cbc.sportwire.util
Class PathUtil
java.lang.Object
|
+--ca.cbc.sportwire.util.PathUtil
- public class PathUtil
- extends java.lang.Object
PathString: Static operations for manipulating file paths
for the Sportwire
Created: Sun Dec 9 20:49:16 2001
$Log: PathUtil.java,v $
Revision 1.8 2002/02/11 07:09:25 garym
TTL will now test for Stoppable instead of Periodic
Revision 1.7 2002/02/08 04:42:33 garym
findfile accommodates missing file separator; wildcard paths support
Revision 1.6 2002/01/29 21:43:42 garym
Fixed concurrent mod bug
Revision 1.5 2002/01/28 07:01:36 garym
Implement JDOM transform caching and document parse thread.
Revision 1.4 2002/01/24 19:49:24 garym
added path search and debug statements
Revision 1.3 2002/01/16 23:09:25 garym
Implemented the JDBC pool support and sql property beans
Revision 1.2 2002/01/14 21:51:46 garym
bug fixes in topics and config files migration to Extended Properties
Revision 1.1 2002/01/03 03:41:59 garym
Added interface to Brian's TemplateLineup objects
- Version:
- $Id: PathUtil.java,v 1.8 2002/02/11 07:09:25 garym Exp $
- Author:
- Gary Lawrence Murphy
Field Summary |
(package private) static org.apache.log4j.Category |
cat
|
Method Summary |
static java.util.ArrayList |
asArrayList(java.lang.String path)
asArrayList : parses a string on the file separator
and returns an array list object that can be used with Velocity
foreach |
static java.lang.String |
findFile(java.util.List paths,
java.util.List exts,
java.lang.String basepath)
findFile : Given a list of search paths and a list
of optional extensions, search for the base filename. |
static java.lang.String |
findFile(java.util.List paths,
java.lang.String pathdefault,
java.util.List exts,
java.lang.String extdefault,
java.lang.String base)
findFile : if either of the search lists is null or
empty, take the default as a comma-delimited string; this is
used to check the lists coming from the property file, using
the hard-coded defaults if the property was not defined. |
static java.util.List |
findFiles(java.util.List paths,
java.util.List exts,
java.lang.String regexp)
findFiles : returns a list of files matching the
perl-like regexp; searches the paths/exts until it finds at
least one match, then ceases to search other paths. |
static java.util.List |
findFiles(java.util.List paths,
java.lang.String pathdefault,
java.util.List exts,
java.lang.String extdefault,
java.lang.String regexp)
findFiles : Expanded form allowing property defaults. |
static java.lang.String |
findRelative(java.util.List paths,
java.util.List exts,
java.lang.String pathinfo)
findRelative : Like findFile except that only the
file extension is resolved. |
static java.util.List |
listOrDefault(java.util.List l,
java.lang.String defs)
listOrDefault will return the list if it has
elements, otherwise it parses the comma-delimited string into
elements and returns that list. |
static java.lang.String |
packageOf(java.lang.String path)
packageOf : mungs a normal file page into a java
package-like dot-delimited string that is used to find
properties in the config file |
static boolean |
verified(java.lang.String filename)
verified : |
static boolean |
verified(java.lang.StringBuffer filename)
verified : |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
cat
static org.apache.log4j.Category cat
PathUtil
private PathUtil()
asArrayList
public static java.util.ArrayList asArrayList(java.lang.String path)
asArrayList
: parses a string on the file separator
and returns an array list object that can be used with Velocity
foreach
- Parameters:
path
- as a String
value- Returns:
- an
ArrayList
packageOf
public static java.lang.String packageOf(java.lang.String path)
packageOf
: mungs a normal file page into a java
package-like dot-delimited string that is used to find
properties in the config file
- Parameters:
path
- a String
value- Returns:
- a
String
value
verified
public static boolean verified(java.lang.StringBuffer filename)
verified
:
- Parameters:
filename
- a StringBuffer
value- Returns:
- a
boolean
value
verified
public static boolean verified(java.lang.String filename)
verified
:
- Parameters:
filename
- a String
value- Returns:
- a
boolean
value
listOrDefault
public static java.util.List listOrDefault(java.util.List l,
java.lang.String defs)
listOrDefault
will return the list if it has
elements, otherwise it parses the comma-delimited string into
elements and returns that list.
- Parameters:
l
- a List
valuedefs
- a String
value- Returns:
- a
List
value
findFile
public static java.lang.String findFile(java.util.List paths,
java.util.List exts,
java.lang.String basepath)
findFile
: Given a list of search paths and a list
of optional extensions, search for the base filename. returns
the combination of path + basebath + ext which first returns a
readable file.
- Parameters:
paths
- a List
valueexts
- a List
valuebasepath
- a String
value- Returns:
- a
String
value
findFile
public static java.lang.String findFile(java.util.List paths,
java.lang.String pathdefault,
java.util.List exts,
java.lang.String extdefault,
java.lang.String base)
findFile
: if either of the search lists is null or
empty, take the default as a comma-delimited string; this is
used to check the lists coming from the property file, using
the hard-coded defaults if the property was not defined.
- Parameters:
paths
- a List
valuepathdefault
- a String
valueexts
- a List
valueextdefault
- a String
valuebase
- a String
value- Returns:
- a
String
value
findFiles
public static java.util.List findFiles(java.util.List paths,
java.util.List exts,
java.lang.String regexp)
findFiles
: returns a list of files matching the
perl-like regexp; searches the paths/exts until it finds at
least one match, then ceases to search other paths. Like
findFiles
this will return the path + base + ext
for each file matching the pattern.
- Parameters:
paths
- a List
valueexts
- a List
valueregexp
- a String
value- Returns:
- a
List
of File values
findFiles
public static java.util.List findFiles(java.util.List paths,
java.lang.String pathdefault,
java.util.List exts,
java.lang.String extdefault,
java.lang.String regexp)
findFiles
: Expanded form allowing property defaults.
- Parameters:
paths
- a List
valuepathdefault
- a String
valueexts
- a List
valueextdefault
- a String
valueregexp
- a String
value- Returns:
- a
List
of File values
findRelative
public static java.lang.String findRelative(java.util.List paths,
java.util.List exts,
java.lang.String pathinfo)
findRelative
: Like findFile except that only the
file extension is resolved. this is needed to create a
filename from a base name where the next step will do its own
resolution of the absolute path, for example, in passing the
path info into Velocity #parse
(Velocity must find
the string in its own template path)
- Parameters:
paths
- a List
valueexts
- a List
valuepathinfo
- a String
value- Returns:
- a
String
value