Top Description Inners Fields Constructors Methods
org.apache.tools.ant.listener

public Class MailLogger

extends DefaultLogger
Class Inheritance
Imports
java.io.IOException, .InputStream, .PrintStream, java.nio.file.Files, .Paths, java.util.Map, .Properties, .StringTokenizer, .Vector, java.util.stream.Collectors, .Stream, org.apache.tools.ant.BuildEvent, .BuildException, .DefaultLogger, .Project, org.apache.tools.ant.taskdefs.email.EmailAddress, .Mailer, .Message, org.apache.tools.ant.util.ClasspathUtils, .DateUtils, .FileUtils, org.apache.tools.mail.MailMessage

Buffers log messages from DefaultLogger, and sends an e-mail with the results. The following Project properties are used to send the mail. These properties are set using standard Ant property setting mechanisms (<property>, command-line -D, etc). Ant properties can be overridden by specifying the filename of a properties file in the MailLogger.properties.file property . Any properties defined in that file will override Ant properties.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private StringBuffer
buffer

Buffer in which the message is constructed prior to sending

private static final String
Inherited from org.apache.tools.ant.DefaultLogger:
emacsModeerrLEFT_COLUMN_SIZElSepmsgOutputLevelout

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
buildFinished(BuildEvent
the build finished event
event
)

Overrides org.apache.tools.ant.DefaultLogger.buildFinished.

Implements org.apache.tools.ant.BuildListener.buildFinished.

Sends an e-mail with the log results.
private String
private String

Returns:

The value of the property, or default value.
getValue
(Map<String, Object>
Properties to obtain value from
properties
,
String
suffix of property name. "MailLogger." will be prepended internally.
name
,
String
value returned if not present in the properties. Set to null to make required.
defaultValue
)

Gets the value of a property.

protected void
log(String
the message being logger
message
)

Overrides org.apache.tools.ant.DefaultLogger.log.

Receives and buffers log messages.
private void
private void
sendMail(MailLogger.Values
the various values.
values
,
String
mail body
message
)

Send the mail

private void
sendMimeMail(Project
current ant project
project
,
MailLogger.Values
various values
values
,
String
mail body
message
)

Send the mail (MimeMail)

private Vector<EmailAddress>
Inherited from org.apache.tools.ant.DefaultLogger:
buildStartedextractProjectNameformatTimegetBuildFailedMessagegetBuildSuccessfulMessagegetMessageOutputLevelgetTimestampmessageLoggedprintMessagesetEmacsModesetErrorPrintStreamsetMessageOutputLevelsetOutputPrintStreamtargetFinishedtargetStartedtaskFinishedtaskStarted

Field Detail

bufferback to summary
private StringBuffer buffer

Buffer in which the message is constructed prior to sending

DEFAULT_MIME_TYPEback to summary
private static final String DEFAULT_MIME_TYPE

Constructor Detail

MailLoggerback to summary
public MailLogger()

Method Detail

buildFinishedback to summary
public void buildFinished(BuildEvent event)

Overrides org.apache.tools.ant.DefaultLogger.buildFinished.

Implements org.apache.tools.ant.BuildListener.buildFinished.

Sends an e-mail with the log results.

Parameters
event:BuildEvent

the build finished event

Annotations
@Override
getMailerImplementationback to summary
private String getMailerImplementation()
getValueback to summary
private String getValue(Map<String, Object> properties, String name, String defaultValue)

Gets the value of a property.

Parameters
properties:Map<String, Object>

Properties to obtain value from

name:String

suffix of property name. "MailLogger." will be prepended internally.

defaultValue:String

value returned if not present in the properties. Set to null to make required.

Returns:String

The value of the property, or default value.

logback to summary
protected void log(String message)

Overrides org.apache.tools.ant.DefaultLogger.log.

Receives and buffers log messages.

Parameters
message:String

the message being logger

Annotations
@Override
logBuildExceptionback to summary
private void logBuildException(String reason, BuildException e)
sendMailback to summary
private void sendMail(MailLogger.Values values, String message) throws IOException

Send the mail

Parameters
values:MailLogger.Values

the various values.

message:String

mail body

Exceptions
IOException:
thrown if sending message fails
sendMimeMailback to summary
private void sendMimeMail(Project project, MailLogger.Values values, String message)

Send the mail (MimeMail)

Parameters
project:Project

current ant project

values:MailLogger.Values

various values

message:String

mail body

splitEmailAddressesback to summary
private Vector<EmailAddress> splitEmailAddresses(String listString)
org.apache.tools.ant.listener back to summary

private Class MailLogger.Values

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private String
private String
private String
private int
private String
private boolean
private boolean
private String
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
body()

public MailLogger.Values
body(String body)

public String
public MailLogger.Values
charset(String charset)

public String
from()

public MailLogger.Values
from(String from)

public String
public MailLogger.Values
mailhost(String mailhost)

public String
public MailLogger.Values
mimeType(String mimeType)

public String
public MailLogger.Values
password(String password)

public int
port()

public MailLogger.Values
port(int port)

public String
public MailLogger.Values
replytoList(String replytoList)

public boolean
ssl()

public MailLogger.Values
ssl(boolean ssl)

public boolean
public MailLogger.Values
starttls(boolean starttls)

public String
public MailLogger.Values
subject(String subject)

public String
public MailLogger.Values
toBccList(String toBccList)

public String
public MailLogger.Values
toCcList(String toCcList)

public String
public MailLogger.Values
toList(String toList)

public String
user()

public MailLogger.Values
user(String user)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyback to summary
private String body
charsetback to summary
private String charset
fromback to summary
private String from
mailhostback to summary
private String mailhost
mimeTypeback to summary
private String mimeType
passwordback to summary
private String password
portback to summary
private int port
replytoListback to summary
private String replytoList
sslback to summary
private boolean ssl
starttlsback to summary
private boolean starttls
subjectback to summary
private String subject
toBccListback to summary
private String toBccList
toCcListback to summary
private String toCcList
toListback to summary
private String toList
userback to summary
private String user

Constructor Detail

Valuesback to summary
private Values()

Method Detail

bodyback to summary
public String body()
bodyback to summary
public MailLogger.Values body(String body)
charsetback to summary
public String charset()
charsetback to summary
public MailLogger.Values charset(String charset)
fromback to summary
public String from()
fromback to summary
public MailLogger.Values from(String from)
mailhostback to summary
public String mailhost()
mailhostback to summary
public MailLogger.Values mailhost(String mailhost)
mimeTypeback to summary
public String mimeType()
mimeTypeback to summary
public MailLogger.Values mimeType(String mimeType)
passwordback to summary
public String password()
passwordback to summary
public MailLogger.Values password(String password)
portback to summary
public int port()
portback to summary
public MailLogger.Values port(int port)
replytoListback to summary
public String replytoList()
replytoListback to summary
public MailLogger.Values replytoList(String replytoList)
sslback to summary
public boolean ssl()
sslback to summary
public MailLogger.Values ssl(boolean ssl)
starttlsback to summary
public boolean starttls()
starttlsback to summary
public MailLogger.Values starttls(boolean starttls)
subjectback to summary
public String subject()
subjectback to summary
public MailLogger.Values subject(String subject)
toBccListback to summary
public String toBccList()
toBccListback to summary
public MailLogger.Values toBccList(String toBccList)
toCcListback to summary
public String toCcList()
toCcListback to summary
public MailLogger.Values toCcList(String toCcList)
toListback to summary
public String toList()
toListback to summary
public MailLogger.Values toList(String toList)
userback to summary
public String user()
userback to summary
public MailLogger.Values user(String user)