|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.data.transport.smtp.TouchySMTPClientManager
public class TouchySMTPClientManager
This is a simple manager for a clean SMTP client.
Version History
EPG - Adapted from another project - 23 NOV 06
Field Summary | |
---|---|
static int |
CONNECTION_TIMEOUT
|
static int |
DEFAULT_STREAM_MAX
This is the default number of messages sent per stream. |
Constructor Summary | |
---|---|
TouchySMTPClientManager()
|
Method Summary | |
---|---|
void |
disconnect()
Force a disconnection. |
void |
init(Logger aLogger,
java.lang.String name,
java.lang.String targetAddress,
int targetPort,
boolean isStreaming,
boolean extensions)
Init the system. |
boolean |
isExtensionsSet()
Are extensions supported? |
RESULT |
meassuredSubmit(java.lang.String senderInet,
java.lang.String recipientInet,
java.lang.String id,
java.io.InputStream... dataStream)
Submit a message and return the result. |
void |
setDSN(DSN dsn)
Set a DSN for all subsequent sends. |
void |
setStreamMax(int max)
Set the maximum number of messages a stream can send before it is closed and reestablished. |
void |
setTimeout(int timeout)
Set a new timeout. |
Reply |
submit(java.lang.String senderInet,
java.lang.String recipientInet,
java.io.InputStream... dataStream)
Submit a message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CONNECTION_TIMEOUT
public static final int DEFAULT_STREAM_MAX
Constructor Detail |
---|
public TouchySMTPClientManager()
Method Detail |
---|
public void init(Logger aLogger, java.lang.String name, java.lang.String targetAddress, int targetPort, boolean isStreaming, boolean extensions) throws ThingsException, java.lang.InterruptedException
init
in interface SMTPClientManager
aLogger
- name
- targetAddress
- targetPort
- isStreaming
- does it stream? (Streaming attempts to reuse the connection).extensions
- if true, server extensions will be supported.
UserException
ThingsException
java.lang.InterruptedException
public void setStreamMax(int max) throws ThingsException, java.lang.InterruptedException
setStreamMax
in interface SMTPClientManager
max
- the maximum number. It must be 1 or greater or you'll get an exception.
ThingsException
java.lang.InterruptedException
public void setTimeout(int timeout) throws ThingsException
setTimeout
in interface SMTPClientManager
timeout
- in milliseconds.
ThingsException
public void setDSN(DSN dsn)
setDSN
in interface SMTPClientManager
dsn
- the dsnpublic boolean isExtensionsSet()
isExtensionsSet
in interface SMTPClientManager
public Reply submit(java.lang.String senderInet, java.lang.String recipientInet, java.io.InputStream... dataStream) throws ThingsException, java.lang.InterruptedException
submit
in interface SMTPClientManager
senderInet
- recipientInet
- dataStream
- InputStreams to be sent in turn. Null entries are allowed and ignored.
ThingsException
- if not successful for any reason. (Don't change this without modifying the other submit methods.)
java.lang.InterruptedException
public RESULT meassuredSubmit(java.lang.String senderInet, java.lang.String recipientInet, java.lang.String id, java.io.InputStream... dataStream) throws UserException, java.lang.InterruptedException
A FAULT will result in a Type.EXCEPTION. An ERROR will result in a Type.FAIL. A successful transaction will result in a Type.PASS.
The metrics will contain a valid size giving the actual byte sent in the difference field, as well as count values.
meassuredSubmit
in interface SMTPClientManager
senderInet
- recipientInet
- dataStream
- InputStreams to send in turn.id
- the id of the operations.
UserException
- for any really serious stuff. Most problems will be returned in the RESULT.
java.lang.InterruptedException
public void disconnect() throws ThingsException, java.lang.InterruptedException
disconnect
in interface SMTPClientManager
ThingsException
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |