things.data.transport.smtp
Interface SMTPClientManager

All Known Implementing Classes:
TolerantSMTPClientManager, TouchySMTPClientManager

public interface SMTPClientManager

Interface for the client managers.

Version:
1.0

Version History

EPG - Adapted from another project - 23 NOV 06
 
Author:
Erich P. Gatejen

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.
 

Method Detail

init

void init(Logger aLogger,
          java.lang.String name,
          java.lang.String targetAddress,
          int targetPort,
          boolean isStreaming,
          boolean extensions)
          throws ThingsException,
                 java.lang.InterruptedException
Init the system. This is a one-time deal. The managers are one use only. By default, no extensions will be supported.

Parameters:
aLogger -
name -
targetAddress -
targetPort -
isStreaming - does it stream? (Streaming attempts to reuse the connection).
extensions - if true, server extensions will be supported.
Throws:
UserException
ThingsException
java.lang.InterruptedException

setStreamMax

void setStreamMax(int max)
                  throws ThingsException,
                         java.lang.InterruptedException
Set the maximum number of messages a stream can send before it is closed and reestablished.

Parameters:
max - the maximum number. It must be 1 or greater or you'll get an exception.
Throws:
ThingsException
java.lang.InterruptedException

setTimeout

void setTimeout(int timeout)
                throws ThingsException
Set a new timeout. It'll take effect after the next connection is made (which might not be obvious).

Parameters:
timeout - in milliseconds.
Throws:
ThingsException

setDSN

void setDSN(DSN dsn)
Set a DSN for all subsequent sends. If set to null, it will not be used. Extensions must be supported for this to work.

Parameters:
dsn - the dsn

isExtensionsSet

boolean isExtensionsSet()
Are extensions supported?

Returns:
true if they are

submit

Reply submit(java.lang.String senderInet,
             java.lang.String recipientInet,
             java.io.InputStream... dataStream)
             throws ThingsException,
                    java.lang.InterruptedException
Submit a message. We'll let InterruptedExceptions out like a good THINGS citizen.

Parameters:
senderInet -
recipientInet -
dataStream - InputStreams to be sent in turn. Null entries are allowed and ignored.
Returns:
the SMTP reply for the send. The size field is useful.
Throws:
ThingsException - if not successful for any reason. (Don't change this without modifying the other submit methods.)
java.lang.InterruptedException

meassuredSubmit

RESULT meassuredSubmit(java.lang.String senderInet,
                       java.lang.String recipientInet,
                       java.lang.String id,
                       java.io.InputStream... dataStream)
                       throws UserException,
                              java.lang.InterruptedException
Submit a message and return the result. We'll let InterruptedExceptions out like a good THINGS citizen. It will not let any other exception escape, but will reflect them in the RESULT. (It will log complex info if debug is enabled.)

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.

Parameters:
senderInet -
recipientInet -
dataStream - InputStreams to send in turn.
id - the id of the operations.
Throws:
UserException - for any really serious stuff. Most problems will be returned in the RESULT.
java.lang.InterruptedException

disconnect

void disconnect()
                throws ThingsException,
                       java.lang.InterruptedException
Force a disconnection. It is nice, but not necessary, to call this when you are done--or just done for a while. It doesn't ruin the client. You could still use it again (but remember, init is only once!).

Throws:
ThingsException
java.lang.InterruptedException


Things.