org.openeai.config
Class MailServiceConfig

java.lang.Object
  extended by org.openeai.OpenEaiObject
      extended by org.openeai.config.EnterpriseConfigurationObjectImpl
          extended by org.openeai.config.MailServiceConfig
All Implemented Interfaces:
EnterpriseConfigurationObject

public class MailServiceConfig
extends EnterpriseConfigurationObjectImpl
implements EnterpriseConfigurationObject

A MailServiceConfig is a wrapper class that takes information stored in an OpenEAI Deployment document (MailServiceConfig Element) and stores it in a Java object. Then the configuration object can be retrieved from AppConfig and the Properties object associated to the config object can be used within the application.

The MailServiceConfig object is simply an object that reads the elements contained in the deployment document and is used to instantiate a MailService object

Configuration Parameters:

These are the configuration parameters specified by the MailServiceConfig Element in the Deployment document. NOTE: Like all other OpenEAI configuration objects, there is a "container" level associated to MailServiceConfig objects. Many Elements and attributes are required at that level and may be optionally overridden at this level. This is to avoid having to enter redundant information in the Deployment document if all (or most) MailServiceConfig objects being configured should use the same configuration information. Therefore, many of the MailServiceConfig elements are optional at this level but required at the "container" level. Where this is the case, it will be indicated by an "*".

Name Required Description
name yes Name of the MailServiceConfig object. This is how the object will be stored in AppConfig and should be unique. This allows developers to conveniently categorize MailService objects for an application and retrieve them by name
ConfigClass no* Name of the configuration class that wraps the config Element (this class)
ObjectClass no* Name of the Java object that will be instantiated with this Config class (for now, it's the org.openeai.loggingutils.MailService object)
RecipientList yes A comma separated list of email addresses to which an email message will be sent. This list can be overriden at runtime if needed.
FromAddress yes The email address of the sending application. This can be overriden at runtime if needed and doesn't have to be a "real" email address.
MailHost yes The SMTP host that will be used to send the email message. This can be overriden at runtime if needed.
Subject no A default subject to include with the message. Applications using this object will likely wish to override this default subject at runtime.
MessageBody no A default message body to include with the message. Applications using this object will likely wish to override this default MessageBody at runtime. Currently, only "text" is supported in the body.

Version:
4.0 - 26 April 2005
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
MailService

Field Summary
 
Fields inherited from class org.openeai.OpenEaiObject
logger
 
Constructor Summary
MailServiceConfig()
          This is the constructor used by AppConfig to instantiate the config object.
 
Method Summary
 java.lang.String getFromAddress()
          returns the from address variable
 java.lang.String getMailHost()
          returns the value of the mail host variable
 java.lang.String getMessageBody()
          returns the message body of the current message
 java.lang.String getRecipientList()
          Returns the to address variable
 java.lang.String getSubject()
          returns the subject of the current message
 void init(org.jdom.Element configElement)
          Implements the init(Element) method that all EnterpriseConfiguration objects must implement.
 void setFromAddress(java.lang.String fromAddr)
          Sets the fromAddr class variable to the data passed in
 void setMailHost(java.lang.String mailHost)
          Sets the mailHost variable to the data passed in
 void setMessageBody(java.lang.String msg)
          sets the msgBody variable to data passed from the client.
 void setRecipientList(java.lang.String addr)
          Sets the toAddr class variable to the data passed in
 void setSubject(java.lang.String subject)
          sets the subject variable to data passed in from the client
 
Methods inherited from class org.openeai.config.EnterpriseConfigurationObjectImpl
addProperty, getAppName, getConfigDoc, getConfigElementByAttributeValue, getElementByAttributeValue, getName, getType, getValidation, refresh, setAppName, setConfigDoc, setName, setRefresh, setType, setValidation
 
Methods inherited from class org.openeai.OpenEaiObject
getDebug, getFromAddr, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setDebug, setFromAddr, setMailService, setProperties, setToAddr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openeai.config.EnterpriseConfigurationObject
getAppName, getProperties, refresh, setAppName
 

Constructor Detail

MailServiceConfig

public MailServiceConfig()
This is the constructor used by AppConfig to instantiate the config object. Then, AppConfig calls this object's init(Element) method passing the configuration element it retrieved from the XML configuration document which this object uses to configure itself. After this object has initialized itself, it will be used to instantiate and initialize the framework object (MessageObject, Producers, Consumers, ThreadPools etc.) with the properties it's been initialized with.

Method Detail

setMailHost

public void setMailHost(java.lang.String mailHost)
Sets the mailHost variable to the data passed in

Overrides:
setMailHost in class OpenEaiObject
Parameters:
mailHost - mail host set by the calling client

getMailHost

public java.lang.String getMailHost()
returns the value of the mail host variable

Overrides:
getMailHost in class OpenEaiObject
Returns:
String.mail host

setRecipientList

public void setRecipientList(java.lang.String addr)
Sets the toAddr class variable to the data passed in

Parameters:
addr - String coma separated list of email addresses to send messages to set by the client
Throws:
AddressException

getRecipientList

public java.lang.String getRecipientList()
Returns the to address variable

Returns:
String email addresses of the recipients of a message

getFromAddress

public java.lang.String getFromAddress()
returns the from address variable

Returns:
String email address of the sender of the message

setFromAddress

public void setFromAddress(java.lang.String fromAddr)
Sets the fromAddr class variable to the data passed in

Parameters:
fromAddr - Address that messages are coming from

setSubject

public void setSubject(java.lang.String subject)
sets the subject variable to data passed in from the client

Parameters:
subject - subject of the message passed from the client

getSubject

public java.lang.String getSubject()
returns the subject of the current message

Returns:
String subject of the email message

setMessageBody

public void setMessageBody(java.lang.String msg)
sets the msgBody variable to data passed from the client.

Parameters:
msg - String message to be sent

getMessageBody

public java.lang.String getMessageBody()
returns the message body of the current message

Returns:
String message text

init

public void init(org.jdom.Element configElement)
          throws EnterpriseConfigurationObjectException
Implements the init(Element) method that all EnterpriseConfiguration objects must implement. This init method takes the Configuration element passed in and builds a Java properties object from its contents. This information can then be retreived by the application via the getProperties() method after getting the property config object from AppConfig.

The Properties object that gets built is inherited from OpenEaiObject.

Specified by:
init in interface EnterpriseConfigurationObject
Overrides:
init in class EnterpriseConfigurationObjectImpl
Parameters:
configElement - Element the configuration element that AppConfig has pulled from the configuration document relevant to the PropertyConfig object being configured. Or, the element that was found in the init() method.
Throws:
EnterpriseConfigurationObjectException - if errors occur processing the configuration Element.
See Also:
OpenEaiObject, EnterpriseConfigurationObjectImpl.init(org.jdom.Element)


Copyright © 2002,2003 OpenEAI Software Foundation