org.enhydra.xml.xmlc.taskdef
Class XmlcUtils

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.taskdef.XmlcUtils
Direct Known Subclasses:
DefaultXmlcUtilsImpl

public abstract class XmlcUtils
extends Object

Abstract base xmlc utilities class

Version:
1.0
Author:
Robert Leftwich

Field Summary
static String DEFAULT_OPTIONS_FILENAME
          The name of the default XMLC options file.
static String DEFAULT_OPTIONS_FILETYPE
          The default extension for an XMLC options file.
static String DEFAULT_UTILS_CLASS_KEY
          The system property holding the classname of the class to instantiate when XmlcUtils.create() is called.
static String DEFAULT_UTILS_CLASS_NAME
          The default classname of the class to instantiate when XmlcUtils.create() is called.
 
Constructor Summary
protected XmlcUtils()
          Construct default XmlcUtils (protected to force the use of XmlcUtils.create() factory method).
 
Method Summary
abstract  String buildClassName(String theFullBaseFileName, String theModifier)
          Build a Java class name out of the specified components.
abstract  String buildFullBaseFileName(String thePackageName, String thePackageDir, String theBaseFileName)
          Build a full base file name (i.e.
static XmlcUtils create()
          Factory method for creating instances of the XmlcUtils class.
abstract  String[] getOptionFiles(File theDirectory)
          Get a list of options files for the specified directory.
abstract  String[] getOptionFiles(File[] theDirectories, String theOptionsFileName)
          Get a list of options files for the specified directories, having the specified name.
abstract  String[] getOptionFiles(File[] theDirectories, String[] theOptionsFileNames)
          Get a list of options files for the specified directories, having the specified names.
abstract  String[] getOptionFiles(File theDirectory, String theOptionsFileName)
          Get a list of options files for the specified directory, having the specified name.
abstract  String[] getOptionFiles(File theDirectory, String[] theOptionsFileNames)
          Get a list of options files for the specified directory, having the specified names.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OPTIONS_FILETYPE

public static final String DEFAULT_OPTIONS_FILETYPE
The default extension for an XMLC options file.

DEFAULT_OPTIONS_FILENAME

public static final String DEFAULT_OPTIONS_FILENAME
The name of the default XMLC options file.

DEFAULT_UTILS_CLASS_KEY

public static final String DEFAULT_UTILS_CLASS_KEY
The system property holding the classname of the class to instantiate when XmlcUtils.create() is called.

DEFAULT_UTILS_CLASS_NAME

public static final String DEFAULT_UTILS_CLASS_NAME
The default classname of the class to instantiate when XmlcUtils.create() is called.
Constructor Detail

XmlcUtils

protected XmlcUtils()
Construct default XmlcUtils (protected to force the use of XmlcUtils.create() factory method).
Method Detail

getOptionFiles

public abstract String[] getOptionFiles(File theDirectory)
Get a list of options files for the specified directory. This method will search for the default options file name (options.xmlc) in the specified directory and the user.dir directory as well. It will return them in that order.
Parameters:
theDirectory - The directory to look in for the options file.
Returns:
An array of options files with absolute paths. An empty array if none found.

getOptionFiles

public abstract String[] getOptionFiles(File theDirectory,
                                        String theOptionsFileName)
Get a list of options files for the specified directory, having the specified name. This method will search for the specified options file name and the default options file name (options.xmlc) in the specified directory and the user.dir directory as well. It will return them in that order.
Parameters:
theDirectory - The directory to look in for the options file.
theOptionsFileName - The name of the options file to look for.
Returns:
An array of options files with absolute paths. An empty array if none found.

getOptionFiles

public abstract String[] getOptionFiles(File theDirectory,
                                        String[] theOptionsFileNames)
Get a list of options files for the specified directory, having the specified names. This method will search for the specified options file names and the default options file name (options.xmlc) in the specified directory and the user.dir directory as well. It will return them in that order.
Parameters:
theDirectory - The directory to look in for the options file.
theOptionsFileNames - The list of names of the options file to look for.
Returns:
An array of options files with absolute paths. An empty array if none found.

getOptionFiles

public abstract String[] getOptionFiles(File[] theDirectories,
                                        String theOptionsFileName)
Get a list of options files for the specified directories, having the specified name. This method will search for the specified options file name and the default options file name (options.xmlc) in the specified directories and the user.dir directory as well. It will return them in that order.
Parameters:
theDirectories - The list of directories to look in for the options files.
theOptionsFileName - The name of the options file to look for.
Returns:
An array of options files with absolute paths. An empty array if none found.

getOptionFiles

public abstract String[] getOptionFiles(File[] theDirectories,
                                        String[] theOptionsFileNames)
Get a list of options files for the specified directories, having the specified names. This method will search for the specified options file names and the default options file name (options.xmlc) in the specified directories and the user.dir directory as well. It will return them in that order.
Parameters:
theDirectories - The list of directories to look in for the options files.
theOptionsFileNames - The list of names of the options file to look for.
Returns:
An array of options files with absolute paths. An empty array if none found.

buildFullBaseFileName

public abstract String buildFullBaseFileName(String thePackageName,
                                             String thePackageDir,
                                             String theBaseFileName)
Build a full base file name (i.e. with no file type) out of the specified components. Note that any directory prefix on the theBaseFileName file is stripped before thePackageDir is applied. So that the following call : buildFullBaseFileName("a.b.c", "foo/resources", "config/test.html"); will return a string of "a/b/c/foo/resources/test" and this call : buildFullBaseFileName("a.b.c", "", "config/test.html"); will return a string of "a/b/c/config/test"
Parameters:
thePackageName - The name of the package to prepend to the file name. This should be specified using the Java naming convention i.e. org.enhydra.xmlc
thePackageDir - The name of the directory to prepend to the file name. This is a directory path that can be specified using either '/' or '\' i.e. foo/resources
theBaseFileName - The base file name that the preceding strings are prepended to.
Returns:
A string representing the full path resulting from the specified components with all separators set to '/'

buildClassName

public abstract String buildClassName(String theFullBaseFileName,
                                      String theModifier)
Build a Java class name out of the specified components.
Parameters:
theFullBaseFileName - The full base file name (specified with '/' separators) and no file type. e.g. "org.enhydra.test"
theModifier - The file modifier to append to the class name e.g. HTML
Returns:
A Java class name string

create

public static XmlcUtils create()
Factory method for creating instances of the XmlcUtils class. The actual implementation instantiated is controlled by setting the system property DEFAULT_UTILS_CLASSKEY (currently 'xmlcutils.classname') to the fully qualified class name of the sub-class of XmlcUtils that you want to use. By default (or if the value specified is invalid) this method will return an instance of DefaultXmlcUtilsImpl
Returns:
An instance of a XmlcUtils class


Copyright © 1999-2002 David Li, enhydra.org. All Rights reserved.