Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.tools.ant.installer
Class InstallerLogger

java.lang.Object
  extended by org.hyperic.tools.ant.installer.InstallerLogger
All Implemented Interfaces:
java.util.EventListener, org.apache.tools.ant.BuildListener, org.apache.tools.ant.BuildLogger

public class InstallerLogger
extends java.lang.Object
implements org.apache.tools.ant.BuildLogger


Field Summary
protected  InstallerMessageHandler currentHandler
           
static java.lang.String DEBUG_HANDLER
           
protected  java.io.PrintStream err
          PrintStream to write error messages to
protected  WritableFile logfile
           
protected  java.io.FileWriter logfileStream
           
static java.lang.String[] MESSAGE_HANDLERS
           
protected  java.util.Map messageHandlers
           
protected  java.io.PrintStream out
          PrintStream to write non-error messages to
static java.lang.String PREFIX
           
protected  org.apache.tools.ant.Project project
           
static java.lang.String PROP_LOGFILE
           
static java.lang.String PROP_LOGFILE_PATH
           
static java.lang.String PROP_NOWRAP
           
 
Constructor Summary
InstallerLogger()
           
 
Method Summary
 void buildFinished(org.apache.tools.ant.BuildEvent event)
          Closes the logfile
 void buildStarted(org.apache.tools.ant.BuildEvent event)
          Initializes the logfile
 java.lang.String generatePrefix(java.lang.String prefix)
           
protected  InstallerMessageHandler getMessageHandler(java.lang.String msg, java.lang.StringBuffer msgbuf)
          Determine the message type for a given message.
 void handleMessage(org.apache.tools.ant.BuildEvent event)
           
 void handleMessage(java.lang.String message)
           
protected  void initMessageHandlers()
           
protected  void logToFile(java.lang.String message)
           
 void messageLogged(org.apache.tools.ant.BuildEvent event)
           
protected  void printEndMessageToLog()
           
protected  void printMessage(java.lang.String message)
          Each message handler will callback to this method to perform actual writes.
protected  void printStartMessageToLog()
           
protected  void registerMessageHandler(java.lang.String msgWriterClass)
           
 void setEmacsMode(boolean emacsMode)
          Does nothing - this logger doesn't care about emacs mode
 void setErrorPrintStream(java.io.PrintStream err)
           
 void setMessageOutputLevel(int level)
          Does nothing - this logger doesn't care about levels
 void setOutputPrintStream(java.io.PrintStream output)
           
 void targetFinished(org.apache.tools.ant.BuildEvent event)
           
 void targetStarted(org.apache.tools.ant.BuildEvent event)
           
 void taskFinished(org.apache.tools.ant.BuildEvent event)
           
 void taskStarted(org.apache.tools.ant.BuildEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_LOGFILE

public static final java.lang.String PROP_LOGFILE
See Also:
Constant Field Values

PROP_NOWRAP

public static final java.lang.String PROP_NOWRAP
See Also:
Constant Field Values

PROP_LOGFILE_PATH

public static final java.lang.String PROP_LOGFILE_PATH
See Also:
Constant Field Values

PREFIX

public static final java.lang.String PREFIX
See Also:
Constant Field Values

MESSAGE_HANDLERS

public static final java.lang.String[] MESSAGE_HANDLERS

DEBUG_HANDLER

public static final java.lang.String DEBUG_HANDLER
See Also:
Constant Field Values

messageHandlers

protected java.util.Map messageHandlers

out

protected java.io.PrintStream out
PrintStream to write non-error messages to


err

protected java.io.PrintStream err
PrintStream to write error messages to


currentHandler

protected InstallerMessageHandler currentHandler

project

protected org.apache.tools.ant.Project project

logfile

protected WritableFile logfile

logfileStream

protected java.io.FileWriter logfileStream
Constructor Detail

InstallerLogger

public InstallerLogger()
Method Detail

registerMessageHandler

protected void registerMessageHandler(java.lang.String msgWriterClass)

generatePrefix

public java.lang.String generatePrefix(java.lang.String prefix)
Parameters:
prefix - The prefix of a specific message handler
Returns:
The prefix that will be matched on - this is just the prefix that is passed in, with the global PREFIX prepended, and a colon (:) appended.

initMessageHandlers

protected void initMessageHandlers()

setMessageOutputLevel

public void setMessageOutputLevel(int level)
Does nothing - this logger doesn't care about levels

Specified by:
setMessageOutputLevel in interface org.apache.tools.ant.BuildLogger

setEmacsMode

public void setEmacsMode(boolean emacsMode)
Does nothing - this logger doesn't care about emacs mode

Specified by:
setEmacsMode in interface org.apache.tools.ant.BuildLogger

setOutputPrintStream

public void setOutputPrintStream(java.io.PrintStream output)
Specified by:
setOutputPrintStream in interface org.apache.tools.ant.BuildLogger

setErrorPrintStream

public void setErrorPrintStream(java.io.PrintStream err)
Specified by:
setErrorPrintStream in interface org.apache.tools.ant.BuildLogger

buildStarted

public void buildStarted(org.apache.tools.ant.BuildEvent event)
Initializes the logfile

Specified by:
buildStarted in interface org.apache.tools.ant.BuildListener

buildFinished

public void buildFinished(org.apache.tools.ant.BuildEvent event)
Closes the logfile

Specified by:
buildFinished in interface org.apache.tools.ant.BuildListener

getMessageHandler

protected InstallerMessageHandler getMessageHandler(java.lang.String msg,
                                                    java.lang.StringBuffer msgbuf)
Determine the message type for a given message.

Parameters:
msg - The message to examine
msgbuf - The buffer to use to store the actual message, with the prefix stripped.
Returns:
The type of the message, one of the MSGTYPE_XXX constants.

targetStarted

public void targetStarted(org.apache.tools.ant.BuildEvent event)
Specified by:
targetStarted in interface org.apache.tools.ant.BuildListener

targetFinished

public void targetFinished(org.apache.tools.ant.BuildEvent event)
Specified by:
targetFinished in interface org.apache.tools.ant.BuildListener

taskStarted

public void taskStarted(org.apache.tools.ant.BuildEvent event)
Specified by:
taskStarted in interface org.apache.tools.ant.BuildListener

taskFinished

public void taskFinished(org.apache.tools.ant.BuildEvent event)
Specified by:
taskFinished in interface org.apache.tools.ant.BuildListener

messageLogged

public void messageLogged(org.apache.tools.ant.BuildEvent event)
Specified by:
messageLogged in interface org.apache.tools.ant.BuildListener

handleMessage

public void handleMessage(org.apache.tools.ant.BuildEvent event)

handleMessage

public void handleMessage(java.lang.String message)

printMessage

protected void printMessage(java.lang.String message)
Each message handler will callback to this method to perform actual writes.


logToFile

protected void logToFile(java.lang.String message)

printStartMessageToLog

protected void printStartMessageToLog()

printEndMessageToLog

protected void printEndMessageToLog()

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.