org.mmbase.module.builders
Class Email

java.lang.Object
  |
  +--org.mmbase.module.core.MMTable
        |
        +--org.mmbase.module.core.MMObjectBuilder
              |
              +--org.mmbase.module.builders.Email

public class Email
extends MMObjectBuilder

Version:
15 May 2001 email builder, keeps and manages a queue of emails that need to be send by the SendMail module. It allows for emailing on time, repeat mail, stats and using urls as input for subject and body.
Author:
Daniel Ockeloen

Field Summary
static int STATE_DELIVERED
          Indicates the email has been delivered.
static int STATE_FAILED
          Indicates the email has not been delivered due to an failure.
static int STATE_QUEUED
          Indicates the email has been queued and is waiting to be delivered.
static int STATE_SPAMGARDE
          Indicates the email has been mark as spam.
static int STATE_UNKNOWN
          Indicates the state of the email is unknown.
static int STATE_WAITING
          Indicates the email is waiting to be queued.
static int TYPE_ONESHOT
          Email will be sent and removed after sending.
static int TYPE_ONESHOTKEEP
          Email will be sent and will not be removed.
static int TYPE_REPEATMAIL
          Email will be sent and scheduled after sending for a next time
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
broadcastChanges, className, database, debug, description, descriptions, fields, NODE_MAX_SIZE, nodeCache, obj2type, OBJ2TYPE_MAX_SIZE, oType, replaceCache, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
Email()
           
 
Method Summary
 void checkMailNode(MMObjectNode node)
          check the message object
 void checkOneShotKeepMail(MMObjectNode node)
          check the message object, now if state is 1 (oneshot)
 void checkOneShotMail(MMObjectNode node)
          check the message object, now if state is 1 (oneshot) it mails and removed itself from the cloud when done
 void checkRepeatMail(MMObjectNode node)
          check the message object, now if state is 1 (oneshot) it mails and removed itself from the cloud when done
 java.util.Vector getList(scanpage sp, StringTagger tagger, java.util.StringTokenizer tok)
          some list commands for the email admin tool
 int getMaxNumberOfTasks()
          return the maximum number of tasks we queue in memory
 int getMaxQueuedTime()
          return the max time of queued messages
 java.util.Vector getMemTasks()
          enum the tasks in memory for the admin tool
 int getNumberOfQueued()
          return the number of queued messages
 int getNumberOfTasks()
          return the number of tasks
 java.lang.String getPage(java.lang.String url)
          getPage, using the scanparser (remember this is a hack to be replaced by a new version soon).
 int getQueueProbeTime()
          return the time interval we check the database for queued messages
 boolean init()
          init
 int insert(java.lang.String owner, MMObjectNode node)
          insert new email object
 boolean performTask(MMObjectNode node)
          performTask, called by the email probe if a email object needs to be handled (mostly because its mail time has passed).
 java.lang.String replace(scanpage sp, java.util.StringTokenizer tok)
          some stat calls used by the email admin tool
 int sendMailNode(MMObjectNode node)
           
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, create, createAlias, created, debug, deleteNodeCache, executeFunction, fieldLocalChanged, getAge, getAliasedNode, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescription, getDescriptions, getDutchSName, getEditFields, getField, getFieldNames, getFields, getFullTableName, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNode, getNode, getNode, getNode, getNodeType, getNumberFromName, getPluralName, getPluralName, getPluralNames, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTableName, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, getXMLSetup, hostname_function, init_obj2type, insert, insertDone, isNodeCached, isVirtual, isXMLConfig, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, putTmpNode, readSearchResults, removeField, removeNode, removeRelations, removeTmpNode, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setClassName, setDBLayout_xml, setDBLayout, setDebug, setDefaults, setDescription, setDescriptions, setDutchSName, setInitParameter, setMaintainer, setMMBase, setPluralNames, setSearchAge, setSingularNames, setTableName, setValue, setValue, setVersion, setXmlConfig, setXMLPath, setXMLValues, signalNewObject, testValidData, toXML, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_UNKNOWN

public static final int STATE_UNKNOWN
Indicates the state of the email is unknown.

STATE_WAITING

public static final int STATE_WAITING
Indicates the email is waiting to be queued.

STATE_DELIVERED

public static final int STATE_DELIVERED
Indicates the email has been delivered.

STATE_FAILED

public static final int STATE_FAILED
Indicates the email has not been delivered due to an failure.

STATE_SPAMGARDE

public static final int STATE_SPAMGARDE
Indicates the email has been mark as spam.

STATE_QUEUED

public static final int STATE_QUEUED
Indicates the email has been queued and is waiting to be delivered.

TYPE_ONESHOT

public static final int TYPE_ONESHOT
Email will be sent and removed after sending.

TYPE_REPEATMAIL

public static final int TYPE_REPEATMAIL
Email will be sent and scheduled after sending for a next time

TYPE_ONESHOTKEEP

public static final int TYPE_ONESHOTKEEP
Email will be sent and will not be removed.
Constructor Detail

Email

public Email()
Method Detail

init

public boolean init()
init
Overrides:
init in class MMObjectBuilder
Following copied from class: org.mmbase.module.core.MMObjectBuilder
Returns:
Always true.
See Also:
MMObjectBuilder.create()

insert

public int insert(java.lang.String owner,
                  MMObjectNode node)
insert new email object
Overrides:
insert in class MMObjectBuilder
Following copied from class: org.mmbase.module.core.MMObjectBuilder
Parameters:
owner - The administrator creating the node
node - The object to insert. The object need be of the same type as the current builder.
Returns:
An int value which is the new object's unique number, -1 if the insert failed.

checkOneShotMail

public void checkOneShotMail(MMObjectNode node)
check the message object, now if state is 1 (oneshot) it mails and removed itself from the cloud when done

checkOneShotKeepMail

public void checkOneShotKeepMail(MMObjectNode node)
check the message object, now if state is 1 (oneshot)

checkRepeatMail

public void checkRepeatMail(MMObjectNode node)
check the message object, now if state is 1 (oneshot) it mails and removed itself from the cloud when done

sendMailNode

public int sendMailNode(MMObjectNode node)

checkMailNode

public void checkMailNode(MMObjectNode node)
check the message object

getPage

public java.lang.String getPage(java.lang.String url)
getPage, using the scanparser (remember this is a hack to be replaced by a new version soon).

performTask

public boolean performTask(MMObjectNode node)
performTask, called by the email probe if a email object needs to be handled (mostly because its mail time has passed).

replace

public java.lang.String replace(scanpage sp,
                                java.util.StringTokenizer tok)
some stat calls used by the email admin tool
Overrides:
replace in class MMObjectBuilder
Following copied from class: org.mmbase.module.core.MMObjectBuilder
Parameters:
sp - The scanpage (containing http and user info) that calls the function
tok - a list of strings that describe the (sub)command to execute
Returns:
the result value as a String

getList

public java.util.Vector getList(scanpage sp,
                                StringTagger tagger,
                                java.util.StringTokenizer tok)
some list commands for the email admin tool
Overrides:
getList in class MMObjectBuilder
Following copied from class: org.mmbase.module.core.MMObjectBuilder
Parameters:
sp - The scanpage (containing http and user info) that calls the function
tagger - a Hashtable of parameters (name-value pairs) for the command
tok - a list of strings that describe the (sub)command to execute
Returns:
a Vector containing the result values as a String

getMemTasks

public java.util.Vector getMemTasks()
enum the tasks in memory for the admin tool

getNumberOfQueued

public int getNumberOfQueued()
return the number of queued messages

getMaxQueuedTime

public int getMaxQueuedTime()
return the max time of queued messages

getQueueProbeTime

public int getQueueProbeTime()
return the time interval we check the database for queued messages

getNumberOfTasks

public int getNumberOfTasks()
return the number of tasks

getMaxNumberOfTasks

public int getMaxNumberOfTasks()
return the maximum number of tasks we queue in memory


MMBase 2002