站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

MailModuleImpl - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.core.impl.mail
Class MailModuleImpl

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.portal.jems.as.system.AbstractJBossService
              extended byorg.jboss.portal.core.modules.AbstractModule
                  extended byorg.jboss.portal.core.impl.mail.MailModuleImpl
All Implemented Interfaces:
MailModule, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class MailModuleImpl
extends AbstractModule
implements MailModule

Author:
Julien Viet, Thomas Heute

Nested Class Summary
private static class MailModuleImpl.MailAuthenticator
          Used for sending through a gateway needing authentication
private  class MailModuleImpl.MyMessage
          Encapsulate a message in this class with a serial id version to keep track.
 
Field Summary
private  int currentSerialId
          A serial id used to track messages locally.
private  EDU.oswego.cs.dl.util.concurrent.QueuedExecutor executor
          The thread that will send the mail.
 java.lang.String gateway
          The SMTP gateway through which mail will be delivered.
private  boolean javaMailDebugEnabled
          True if javamail debug is enabled.
private  org.apache.log4j.Logger log
           
private  org.jboss.logging.util.LoggerStream logs
          The PrintStream java mail debug output is sent to.
private  java.util.Properties properties
          Javamail properties.
private  EDU.oswego.cs.dl.util.concurrent.Channel queue
          The queue that will held all the messages.
private  int queueCapacity
          Queue max capacity or -1 if unbounded.
private  MailModuleImpl.MailAuthenticator smtpAuth
          The Authenticator implementation used when stmp auth is needed.
private  int SMTPConnectionTimeout
          SMTP connection timeout.
private  java.lang.String smtpPassword
          The password for authenticating to the smtp gateway.
private  int SMTPTimeout
          SMTP timeout.
private  java.lang.String smtpUser
          The username for authenticating to the smtp gateway.
 
Fields inherited from class org.jboss.portal.core.modules.AbstractModule
jndiName
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
MailModuleImpl()
          Creates a new MailModuleImpl object.
 
Method Summary
 boolean deliver(int serialId, java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body)
           
private  boolean deliver(int serialId, java.lang.String host, java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body)
           
 int flushQueue()
           
 int getCurrentSerialId()
           
 java.lang.String getGateway()
           
 boolean getJavaMailDebugEnabled()
           
 int getQueueCapacity()
           
 int getQueueSize()
           
 int getSMTPConnectionTimeout()
           
 java.lang.String getSmtpPassword()
           
 int getSMTPTimeout()
           
 java.lang.String getSmtpUser()
           
 java.lang.String listProperties()
           
 void send(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body)
           
 void setGateway(java.lang.String gateway)
           
 void setJavaMailDebugEnabled(boolean javaMailDebugEnabled)
           
 void setQueueCapacity(int queueCapacity)
           
 void setSMTPConnectionTimeout(int SMTPConnectionTimeout)
           
 void setSmtpPassword(java.lang.String smtpPassword)
           
 void setSMTPTimeout(int SMTPTimeout)
           
 void setSmtpUser(java.lang.String smtpUser)
           
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.portal.core.modules.AbstractModule
getJNDIName, setJNDIName
 
Methods inherited from class org.jboss.portal.jems.as.system.AbstractJBossService
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
createService, destroyService, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final org.apache.log4j.Logger log

properties

private java.util.Properties properties
Javamail properties.


queueCapacity

private int queueCapacity
Queue max capacity or -1 if unbounded.


executor

private EDU.oswego.cs.dl.util.concurrent.QueuedExecutor executor
The thread that will send the mail.


queue

private EDU.oswego.cs.dl.util.concurrent.Channel queue
The queue that will held all the messages.


gateway

public java.lang.String gateway
The SMTP gateway through which mail will be delivered.


smtpUser

private java.lang.String smtpUser
The username for authenticating to the smtp gateway.


smtpPassword

private java.lang.String smtpPassword
The password for authenticating to the smtp gateway.


smtpAuth

private MailModuleImpl.MailAuthenticator smtpAuth
The Authenticator implementation used when stmp auth is needed.


javaMailDebugEnabled

private boolean javaMailDebugEnabled
True if javamail debug is enabled.


SMTPConnectionTimeout

private int SMTPConnectionTimeout
SMTP connection timeout.


SMTPTimeout

private int SMTPTimeout
SMTP timeout.


logs

private org.jboss.logging.util.LoggerStream logs
The PrintStream java mail debug output is sent to.


currentSerialId

private int currentSerialId
A serial id used to track messages locally.

Constructor Detail

MailModuleImpl

public MailModuleImpl()
Creates a new MailModuleImpl object.

Method Detail

getSMTPConnectionTimeout

public int getSMTPConnectionTimeout()

setSMTPConnectionTimeout

public void setSMTPConnectionTimeout(int SMTPConnectionTimeout)
Specified by:
setSMTPConnectionTimeout in interface MailModule

getSMTPTimeout

public int getSMTPTimeout()

setSMTPTimeout

public void setSMTPTimeout(int SMTPTimeout)
Specified by:
setSMTPTimeout in interface MailModule

getCurrentSerialId

public int getCurrentSerialId()

getGateway

public java.lang.String getGateway()

setGateway

public void setGateway(java.lang.String gateway)
Specified by:
setGateway in interface MailModule

getSmtpUser

public java.lang.String getSmtpUser()

setSmtpUser

public void setSmtpUser(java.lang.String smtpUser)
Specified by:
setSmtpUser in interface MailModule

getSmtpPassword

public java.lang.String getSmtpPassword()

setSmtpPassword

public void setSmtpPassword(java.lang.String smtpPassword)
Specified by:
setSmtpPassword in interface MailModule

getQueueSize

public int getQueueSize()

listProperties

public java.lang.String listProperties()

flushQueue

public int flushQueue()

getQueueCapacity

public int getQueueCapacity()

setQueueCapacity

public void setQueueCapacity(int queueCapacity)

getJavaMailDebugEnabled

public boolean getJavaMailDebugEnabled()

setJavaMailDebugEnabled

public void setJavaMailDebugEnabled(boolean javaMailDebugEnabled)
Specified by:
setJavaMailDebugEnabled in interface MailModule

send

public void send(java.lang.String from,
                 java.lang.String to,
                 java.lang.String subject,
                 java.lang.String body)
Specified by:
send in interface MailModule

startService

protected void startService()
                     throws java.lang.Exception
Overrides:
startService in class AbstractModule
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Overrides:
stopService in class AbstractModule
Throws:
java.lang.Exception

deliver

public boolean deliver(int serialId,
                       java.lang.String from,
                       java.lang.String to,
                       java.lang.String subject,
                       java.lang.String body)

deliver

private boolean deliver(int serialId,
                        java.lang.String host,
                        java.lang.String from,
                        java.lang.String to,
                        java.lang.String subject,
                        java.lang.String body)
                 throws javax.mail.internet.AddressException,
                        java.security.NoSuchProviderException,
                        javax.mail.MessagingException
Throws:
javax.mail.internet.AddressException
java.security.NoSuchProviderException
javax.mail.MessagingException