public class ProducerTask
extends org.apache.tools.ant.Task
ProducerTask
is an Ant task which will
publish all of the given text files as a JMS Text Message
using a given JMS Connection (Messenger) and a Destination
Modifier and Type | Field and Description |
---|---|
private javax.jms.Destination |
destination |
private java.io.File |
file |
private java.util.Vector |
filesets |
private Messenger |
messenger |
private MessengerManager |
messengerManager |
private java.lang.String |
messengerName |
private long |
sleep
Holds value of property sleep.
|
private java.lang.String |
subject |
Constructor and Description |
---|
ProducerTask() |
Modifier and Type | Method and Description |
---|---|
void |
addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of files (nested fileset attribute).
|
void |
execute()
Performs the copy operation.
|
javax.jms.Destination |
getDestination()
Getter for property destination.
|
java.io.File |
getFile()
Returns the single file to be sent instead of a FileSet
|
Messenger |
getMessenger() |
MessengerManager |
getMessengerManager()
Getter for property messengerManager.
|
java.lang.String |
getMessengerName()
Getter for property messengerName.
|
long |
getSleep()
Getter for property sleep, which defines the number of milliseconds to
sleep for before each send.
|
java.lang.String |
getSubject()
Getter for property subject.
|
protected java.lang.String |
readText(java.io.Reader in)
Reads the given text stream into a single string
|
protected void |
sendFile(java.io.File file,
Messenger messenger,
javax.jms.Destination destination)
Sends the contents of the given file to the given Destination
using the given Messenger instance
|
void |
setConfiguration(java.lang.String uri)
Sets the URI of the Messenger.xml configuration document to use
to configure the messengers to use for this task.
|
void |
setDestination(javax.jms.Destination destination)
Setter for property destination.
|
void |
setFile(java.io.File file)
Allows a single file to be sent via the Ant Task
|
void |
setMessenger(Messenger messenger)
Sets the Messenger to be used
|
void |
setMessengerManager(MessengerManager messengerManager)
Setter for property messengerManager.
|
void |
setMessengerName(java.lang.String messengerName)
Setter for property messengerName.
|
void |
setSleep(long sleep)
Setter for property sleep, which defines the number of milliseconds to
sleep for before each send.
|
void |
setSubject(java.lang.String subject)
Setter for property subject.
|
protected void |
sleep()
Sleeps for a configurable amount of time between each message send
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
private java.util.Vector filesets
private Messenger messenger
private java.lang.String messengerName
private javax.jms.Destination destination
private java.lang.String subject
private MessengerManager messengerManager
private java.io.File file
private long sleep
public void addFileset(org.apache.tools.ant.types.FileSet set)
public Messenger getMessenger() throws javax.jms.JMSException
javax.jms.JMSException
public void setMessenger(Messenger messenger)
public java.lang.String getMessengerName()
public void setMessengerName(java.lang.String messengerName)
messengerName
- New value of property messengerName.public javax.jms.Destination getDestination() throws javax.jms.JMSException
javax.jms.JMSException
public void setDestination(javax.jms.Destination destination)
destination
- New value of property destination.public java.lang.String getSubject()
public void setSubject(java.lang.String subject)
subject
- New value of property subject.public MessengerManager getMessengerManager()
public void setMessengerManager(MessengerManager messengerManager)
messengerManager
- New value of property messengerManager.public void setConfiguration(java.lang.String uri) throws javax.jms.JMSException
javax.jms.JMSException
public long getSleep()
public void setSleep(long sleep)
sleep
- New value of property sleep.public java.io.File getFile()
public void setFile(java.io.File file)
file
- The file to setpublic void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
protected void sendFile(java.io.File file, Messenger messenger, javax.jms.Destination destination) throws java.io.IOException, javax.jms.JMSException
java.io.IOException
javax.jms.JMSException
protected java.lang.String readText(java.io.Reader in) throws java.io.IOException
java.io.IOException
protected void sleep()