com.admc.jamama
Class Mit

java.lang.Object
  extended bycom.admc.jamama.Mit

public class Mit
extends java.lang.Object

Messsage-In-Transit. Every Message-In-Transit corresponds to a message in a traditional Sendmail queue. These are messages that in the act of being delivered, or in a deferred or frozen state, in which case they can be either dropped or transmitted in the future. Once a message reaches a destination for the designated recipient, it is no longer a Mit because it is no longer in transite. For the time being, I am just making the data fields publicly accessible because Mits are primarily targets of actions, not typical Java objects that control their own fate and behavior. If somebody can show me why encapsulation of these fields would lead to some advantage, please do so. If the objection is that the "user" shouldn't need to know how x is implemented if they just want to "o.getX()", I agree that they don't need to know-- but in our case it hurts nothing and it takes less code than a bunch of unnecessary gets and sets. For visibility purposes, it makes no difference whether I publish "getX()" and "setX(y)" rather than "x" since I anticipate adding no associated behavior related to "x". For the few cases where we want to impart some control over data fields, we'll use traditional methods for access. May need another field like routerData, but for data to be persisted. Could store reason for previous failures, what it is that this Mit is waiting on, etc.

Version:
$Revision: 1.3 $
Author:
Blaine Simpson

Field Summary
 java.lang.String explicitRouter
          The name of a Jamama Router instance that we want this Mit routed to next.
 java.lang.String[] oldRecipients
          SMTP RCPT Recipients that have been removed from this message since Jamama received it.
 java.util.HashMap routeData
          Name/value pairs valid for a single pass through a Pipeline.
 java.lang.String[] routeHistory
          Route History for the last or current Routing Run.
 java.lang.String[] routeRunHistory
          Routing Run History.
 SMTPMessage smtpMessage
          This contains everything needed to transmit or receive or write a message to a UNIX mailbox.
 int state
           
static int STATE_CONSUMED
          Mit is dead and should not be used for anything
static int STATE_DEFERRED
          Mit waiting for routing to be attempted
static int STATE_FROZEN
          Mit should not be routed
static int STATE_INCIPIENT
          Mit is has not yet been routed or persisted
static int STATE_ROUTENOW
          Mit should be routed immediately
static int STATE_ROUTING
          Mit is currently being Routed
 java.lang.String status
          A very brief explanation of current status, like "Unable to reach host 'mail.x.com'".
 
Constructor Summary
Mit(Repository inRepository)
           
 
Method Summary
 void accept()
          Satisfy SMTP requirements for accepting a message.
 Mit clone(Address[] newRecipients, java.lang.String newExplicitRouter)
          Make a copy of self with specified SMTP recipients and explicitRouter.
 Repository getRepository()
           
 void persist(boolean exists)
          Store this to the repository.
 java.lang.String toString()
          Prints all the stuff you would want to persist, except for the message contents (due to resource cost).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_INCIPIENT

public static final int STATE_INCIPIENT
Mit is has not yet been routed or persisted

See Also:
Constant Field Values

STATE_ROUTING

public static final int STATE_ROUTING
Mit is currently being Routed

See Also:
Constant Field Values

STATE_DEFERRED

public static final int STATE_DEFERRED
Mit waiting for routing to be attempted

See Also:
Constant Field Values

STATE_FROZEN

public static final int STATE_FROZEN
Mit should not be routed

See Also:
Constant Field Values

STATE_ROUTENOW

public static final int STATE_ROUTENOW
Mit should be routed immediately

See Also:
Constant Field Values

STATE_CONSUMED

public static final int STATE_CONSUMED
Mit is dead and should not be used for anything

See Also:
Constant Field Values

state

public int state

smtpMessage

public SMTPMessage smtpMessage
This contains everything needed to transmit or receive or write a message to a UNIX mailbox. TODO: It looks like MimeMessage.set/getRecipients corresponds are NOT SMTP Envelope RCPT fields. Need to find how to get/set them!!!


oldRecipients

public java.lang.String[] oldRecipients
SMTP RCPT Recipients that have been removed from this message since Jamama received it.


explicitRouter

public java.lang.String explicitRouter
The name of a Jamama Router instance that we want this Mit routed to next. null means to route to the head of the pipeline.


routeRunHistory

public java.lang.String[] routeRunHistory
Routing Run History. One entry reporting each time that Jamama attempted to route this Mit. The most important justification for this field is that Routers need it to check for loops. The comment for using a Collection type for RCPTs also applies to oldRCPTs.


routeHistory

public java.lang.String[] routeHistory
Route History for the last or current Routing Run. One entry per Router. The comment for using a Collection type for RCPTs also applies to oldRCPTs.


routeData

public java.util.HashMap routeData
Name/value pairs valid for a single pass through a Pipeline. Used to pass data among Routers. This is not persisted by Mit.persist().


status

public java.lang.String status
A very brief explanation of current status, like "Unable to reach host 'mail.x.com'".

Constructor Detail

Mit

public Mit(Repository inRepository)
Method Detail

getRepository

public Repository getRepository()

clone

public Mit clone(Address[] newRecipients,
                 java.lang.String newExplicitRouter)
Make a copy of self with specified SMTP recipients and explicitRouter. Keep in mind that the new Mit will never be routed (I'm not talking about ping routes) until it is persisted and the state is set appropriately (like with mit.persist() and mit.state = Mit.STATE_ROUTENOW).

Parameters:
newRecipients - Contents of the new Recipients field
newExplicitRouter - Name of a Router that is valid with the Routing Director.

accept

public void accept()
Satisfy SMTP requirements for accepting a message. Do research if we should create Message-Id: here


persist

public void persist(boolean exists)
             throws java.io.IOException
Store this to the repository.

Parameters:
exists - Whether "this" already exists in the repository
Throws:
java.io.IOException

toString

public java.lang.String toString()
Prints all the stuff you would want to persist, except for the message contents (due to resource cost). User can get smtpMessage.getContent() separately if they want to.