com.aurigalogic.aurigadoc.core
Class BaseConverter

java.lang.Object
  |
  +--com.aurigalogic.aurigadoc.core.BaseConverter
All Implemented Interfaces:
ADConverter
Direct Known Subclasses:
AWTConverter, FOConverter, HTMLConverter, MANConverter, MHTConverter, MHTMLConverter, RTFConverter

public class BaseConverter
extends java.lang.Object
implements ADConverter

This class is the base converter for the AurigaDoc package. Its main purpose is to provide common menthods for all other converter classes. All other converters are derived from this class.

Version:
$Revision: 1.12 $ $Date: 2003/11/06 10:04:37 $
Author:
Khurshidali Shaikh

Field Summary
protected  java.lang.String AURIGADOC_HOME
          AURIGADOC HOME
protected  java.lang.String inputFile
          The input file path
protected  Logger logger
          The logger
protected static java.lang.String OUTPUT_HTML
          Output Method for html
protected static java.lang.String OUTPUT_TEXT
          Output Method for text
protected static java.lang.String OUTPUT_XML
          Output Method for xml
protected  java.lang.String outputFile
          The output file/dir path
protected  java.util.Properties parameters
          Options collection
protected  java.util.Properties props
          Properties collection
protected static java.lang.String XML2AWT
          Stylesheet for AWT output
protected static java.lang.String XML2CHMHHC
          Stylesheet for CHM HHC output
protected static java.lang.String XML2CHMHHP
          Stylesheet for CHM HHP output
protected static java.lang.String XML2DHTMLFRAMESET
          Stylesheet for DHTML main frame output
protected static java.lang.String XML2DHTMLNAV
          Stylesheet for DHTML navigation frame output
protected static java.lang.String XML2FO
          Stylesheet for FO output
protected static java.lang.String XML2HTML
          Stylesheet for HTML output
protected static java.lang.String XML2JHELPHS
          Stylesheet for JHELP HS output
protected static java.lang.String XML2JHELPMAP
          Stylesheet for JHELP Map output
protected static java.lang.String XML2JHELPTOC
          Stylesheet for JHELP TOC output
protected static java.lang.String XML2MAN
          Stylesheet for unix man source output
protected static java.lang.String XML2MHTML
          Stylesheet for MULTI-HTML output
protected static java.lang.String XML2OHJHS
          Stylesheet for OHJ HELP HS output
protected static java.lang.String XML2OHJMAP
          Stylesheet for OHJ Map output
protected static java.lang.String XML2OHJTOC
          Stylesheet for OHJ TOC output
protected static java.lang.String XML2PDF
          Stylesheet for PDF output
protected static java.lang.String XML2PS
          Stylesheet for PS output
protected static java.lang.String XML2RTF
          Stylesheet for RTF output
static java.lang.String XSL
          Identifier for specifying the main xsl which generates html, fo, man, etc
 
Constructor Summary
BaseConverter()
          Default constructor.
 
Method Summary
 void convert()
          Main method wich does the conversion.
 void convert(java.lang.String inputFile, java.lang.String outFile)
          Converts the file given by the inputFile store the output in the file named by outputFile.
protected  void copyFiles(java.lang.String srcDir, java.lang.String destDir)
          Copies all files form the srcDir to destDir.
protected  void doTransform(java.io.InputStream inputStream, java.io.OutputStream outputStream, java.lang.String xslFile, java.lang.String outputMethod)
          Takes the xml source and write the output to the given stream by doing an xsl transformation.
protected  java.lang.String getDefaultXSLUrl(java.lang.String xslName)
          Get the xsl path as a url string for the default xsl.
protected  java.lang.String getParameter(java.lang.String key)
          Get the value of the parameter speecified by key.
 java.lang.String getProperty(java.lang.String key)
          Return the value of the property identified by key key.
protected  java.lang.String getXSLForKey(java.lang.String key, java.lang.String defaultXSL)
          Gets the url of the xsl with the specified key.
protected  void logDebug(java.lang.String msg)
          Log the msg as debug using the logger set with setLogger.
protected  void logError(java.lang.String msg, java.lang.Exception e)
          Log the msg as error using the logger set with setLogger.
protected  void logInfo(java.lang.String msg)
          Log the msg as info using the logger set with setLogger.
protected  void logWarning(java.lang.String msg)
          Log the msg as warning using the logger set with setLogger.
 void setHome(java.lang.String home)
          Set the home path.
 void setInputFile(java.lang.String inFile)
          Set the input file.
 void setLogger(Logger logger)
          Set the logger.
 void setOutputFile(java.lang.String outFile)
          Set the output file.
 void setParameters(java.util.Properties parameters)
          Set additional parameters required for each converter.
 void setTransformerParameter(java.lang.String paramName, java.lang.String paramValue)
          Sets the tarnsformer parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

protected java.util.Properties parameters
Options collection


props

protected java.util.Properties props
Properties collection


AURIGADOC_HOME

protected java.lang.String AURIGADOC_HOME
AURIGADOC HOME


XML2HTML

protected static final java.lang.String XML2HTML
Stylesheet for HTML output

See Also:
Constant Field Values

XML2MHTML

protected static final java.lang.String XML2MHTML
Stylesheet for MULTI-HTML output

See Also:
Constant Field Values

XML2DHTMLFRAMESET

protected static final java.lang.String XML2DHTMLFRAMESET
Stylesheet for DHTML main frame output

See Also:
Constant Field Values

XML2DHTMLNAV

protected static final java.lang.String XML2DHTMLNAV
Stylesheet for DHTML navigation frame output

See Also:
Constant Field Values

XML2PDF

protected static final java.lang.String XML2PDF
Stylesheet for PDF output

See Also:
Constant Field Values

XML2PS

protected static final java.lang.String XML2PS
Stylesheet for PS output

See Also:
Constant Field Values

XML2RTF

protected static final java.lang.String XML2RTF
Stylesheet for RTF output

See Also:
Constant Field Values

XML2AWT

protected static final java.lang.String XML2AWT
Stylesheet for AWT output

See Also:
Constant Field Values

XML2FO

protected static final java.lang.String XML2FO
Stylesheet for FO output

See Also:
Constant Field Values

XML2JHELPHS

protected static final java.lang.String XML2JHELPHS
Stylesheet for JHELP HS output

See Also:
Constant Field Values

XML2JHELPTOC

protected static final java.lang.String XML2JHELPTOC
Stylesheet for JHELP TOC output

See Also:
Constant Field Values

XML2JHELPMAP

protected static final java.lang.String XML2JHELPMAP
Stylesheet for JHELP Map output

See Also:
Constant Field Values

XML2CHMHHC

protected static final java.lang.String XML2CHMHHC
Stylesheet for CHM HHC output

See Also:
Constant Field Values

XML2CHMHHP

protected static final java.lang.String XML2CHMHHP
Stylesheet for CHM HHP output

See Also:
Constant Field Values

XML2MAN

protected static final java.lang.String XML2MAN
Stylesheet for unix man source output

See Also:
Constant Field Values

XML2OHJHS

protected static final java.lang.String XML2OHJHS
Stylesheet for OHJ HELP HS output

See Also:
Constant Field Values

XML2OHJTOC

protected static final java.lang.String XML2OHJTOC
Stylesheet for OHJ TOC output

See Also:
Constant Field Values

XML2OHJMAP

protected static final java.lang.String XML2OHJMAP
Stylesheet for OHJ Map output

See Also:
Constant Field Values

OUTPUT_HTML

protected static final java.lang.String OUTPUT_HTML
Output Method for html

See Also:
Constant Field Values

OUTPUT_XML

protected static final java.lang.String OUTPUT_XML
Output Method for xml

See Also:
Constant Field Values

OUTPUT_TEXT

protected static final java.lang.String OUTPUT_TEXT
Output Method for text

See Also:
Constant Field Values

inputFile

protected java.lang.String inputFile
The input file path


outputFile

protected java.lang.String outputFile
The output file/dir path


logger

protected Logger logger
The logger


XSL

public static final java.lang.String XSL
Identifier for specifying the main xsl which generates html, fo, man, etc

See Also:
Constant Field Values
Constructor Detail

BaseConverter

public BaseConverter()
Default constructor.

Method Detail

setOutputFile

public void setOutputFile(java.lang.String outFile)
Set the output file.

Specified by:
setOutputFile in interface ADConverter
Parameters:
outFile - the output file/dir path.

setInputFile

public void setInputFile(java.lang.String inFile)
Set the input file.

Specified by:
setInputFile in interface ADConverter
Parameters:
inFile - the input file path.

setLogger

public void setLogger(Logger logger)
Set the logger.

Specified by:
setLogger in interface ADConverter
Parameters:
logger - the logger to be used for logging.

setHome

public void setHome(java.lang.String home)
Set the home path.

Parameters:
home - the path of aurigadoc installation.

convert

public void convert(java.lang.String inputFile,
                    java.lang.String outFile)
             throws java.lang.Exception
Converts the file given by the inputFile store the output in the file named by outputFile.

Specified by:
convert in interface ADConverter
Parameters:
inputFile - the path of the inputFile file.
outFile - the path of the output file.
Throws:
java.lang.Exception - in case of an error.

convert

public void convert()
             throws java.lang.Exception
Main method wich does the conversion. This method does not do anything and if called throws an exception.

Specified by:
convert in interface ADConverter
Throws:
java.lang.Exception - if called.

doTransform

protected void doTransform(java.io.InputStream inputStream,
                           java.io.OutputStream outputStream,
                           java.lang.String xslFile,
                           java.lang.String outputMethod)
                    throws java.lang.Exception
Takes the xml source and write the output to the given stream by doing an xsl transformation.

Parameters:
inputStream - the input stream
outputStream - the output stream
xslFile - the xsl file path
outputMethod - the output method(text,html,xml)
Throws:
java.lang.Exception - in case of an error.

copyFiles

protected void copyFiles(java.lang.String srcDir,
                         java.lang.String destDir)
                  throws java.lang.Exception
Copies all files form the srcDir to destDir.

Parameters:
srcDir - the source directory path
destDir - the destination directory path
Throws:
java.lang.Exception - in case of an error.

getProperty

public java.lang.String getProperty(java.lang.String key)
Return the value of the property identified by key key.

Parameters:
key - the key for the property
Returns:
the property value

getDefaultXSLUrl

protected java.lang.String getDefaultXSLUrl(java.lang.String xslName)
                                     throws java.lang.Exception
Get the xsl path as a url string for the default xsl.

Parameters:
xslName - the xsl file name
Returns:
the xsl path as a url string.
Throws:
java.lang.Exception - in case of an error.

logInfo

protected void logInfo(java.lang.String msg)
Log the msg as info using the logger set with setLogger. If no logger is set no messages are logged.

Parameters:
msg - the message to log.

logDebug

protected void logDebug(java.lang.String msg)
Log the msg as debug using the logger set with setLogger. If no logger is set no messages are logged.

Parameters:
msg - the message to log.

logError

protected void logError(java.lang.String msg,
                        java.lang.Exception e)
Log the msg as error using the logger set with setLogger. If no logger is set no messages are logged.

Parameters:
msg - the message to log.
e - the exception to log.

logWarning

protected void logWarning(java.lang.String msg)
Log the msg as warning using the logger set with setLogger. If no logger is set no messages are logged.

Parameters:
msg - the message to log.

setParameters

public void setParameters(java.util.Properties parameters)
Set additional parameters required for each converter.

Specified by:
setParameters in interface ADConverter
Parameters:
parameters - the parameters collection

getParameter

protected java.lang.String getParameter(java.lang.String key)
Get the value of the parameter speecified by key.

Parameters:
key - the key of the option
Returns:
the option value

setTransformerParameter

public void setTransformerParameter(java.lang.String paramName,
                                    java.lang.String paramValue)
Sets the tarnsformer parameter.

Parameters:
paramName - the parameter name
paramValue - the parameter value

getXSLForKey

protected java.lang.String getXSLForKey(java.lang.String key,
                                        java.lang.String defaultXSL)
                                 throws java.lang.Exception
Gets the url of the xsl with the specified key. If an xsl with that key does not exist, the default specified is used.

Parameters:
key - the xsl with the given key
defaultXSL - the default xsl to use if the custom xsl is not specified.
Returns:
the xsl as a url string.
Throws:
java.lang.Exception - in case of an error.


Copyright © 2000, 2003 Auriga Logic Pvt. Ltd. All Rights Reserved.