站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 .net API Documentation 英文版文档

MailTransportService (JBoss.Net API) - JBoss 4.0.1 sp1 .net API Documentation 英文版文档


org.jboss.net.axis.transport.mailto.server
Class MailTransportService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.net.axis.transport.mailto.AbstractMailTransportService
              extended byorg.jboss.net.axis.transport.mailto.server.MailTransportService
All Implemented Interfaces:
MailConstants, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class MailTransportService
extends AbstractMailTransportService
implements MailConstants

Title:
Mail Transport MBean

Description:

This MBean is the service that polls the mail box (pop/imap) and processes any soap messages it finds there.

To define a mail transport and the transport level handlers, the jboss-net.sar/server-config.wsdd file must be modified to include:

   <transport name="mail">
     <requestFlow>
       <handler type="java:org.jboss.net.axis.transport.mail.server.handler.TargetServiceHandler"/>
     </requestFlow>
     <responseFlow>
       <!-- response flow specific handlers can go here -->
     </responseFlow>
   </transport>
 

To enable this service edit the jboss-net.sar/META-INF/jboss-service.xml file to include :

   <mbean code="org.jboss.net.axis.transport.mailto.server.MailTransportService" 
          name="jboss.net:service=MailTransport">
     <depends>jboss.net:service=Axis</depends>
     <attribute name="SessionName">java:/Mail</attribute>
     <attribute name="FolderName">INBOX</attribute>
     <attribute name="TransportName">mail</attribute>
     <attribute name="EngineName">jboss.net:service=Axis</attribute>
     <attribute name="DeleteMail">true</attribute>
   </mbean>
 

If you don't want to hammer on the pollMail button from the mbean interface (jmx|web-console) then it would be best to set up a schedule to do it for you (again in the jboss-service.xml file:

   <mbean code="org.jboss.varia.scheduler.Scheduler" 
         name="jboss.net:service=Scheduler,name=MailTransport">
      <attribute name="StartAtStartup">true</attribute>
      <attribute name="SchedulableMBean">jboss.net:service=MailTransport</attribute>
      <attribute name="SchedulableMBeanMethod">pollMail()</attribute>
      <attribute name="InitialStartDate">NOW</attribute>
      <attribute name="SchedulePeriod">30000</attribute>
      <attribute name="InitialRepetitions">-1</attribute>
   </mbean>
 

This transport assumes the use of ws-addressing handlers and as such has no provision for sending a response. The addressing handler will create a new call with the response if there is a wsa:Reply-To header. Otherwise the response will disappear into the ether with nary a log entry.

Version:
$Revision: 1.2 $
Author:
Jason Essington

Field Summary
 
Fields inherited from class org.jboss.net.axis.transport.mailto.AbstractMailTransportService
ENGINE_NAME, FOLDER_NAME, SESSION_NAME
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.net.axis.transport.mailto.MailConstants
HEADER_CONTENT_TRANSFER_ENCODING, HEADER_CONTENT_TYPE, HEADER_FROM, HEADER_IN_REPLY_TO, HEADER_MESSAGE_ID, HEADER_TO
 
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
MailTransportService()
           
 
Method Summary
protected  void archiveMessage(String msgID, org.apache.axis.MessageContext msgCtx)
          Override this method if you need to store incoming messages.
Note: If web service security handlers are in the handler chain, the message will not have been verified/decrypted yet.
protected  org.apache.axis.MessageContext createMessageContext(org.apache.axis.AxisEngine engine, javax.mail.Message msg)
          Creates a message context that will be used while processing this request.
 org.apache.axis.server.AxisServer getEngine()
          override AxisServlet.getEngine() in order to redirect to the corresponding AxisEngine.
 String getTransportName()
           
protected  String processHeaders(org.apache.axis.MessageContext ctx, javax.mail.Message msg)
           
protected  void processMessageBody(org.apache.axis.MessageContext mc, javax.mail.Message msg)
          Serialize the email message body into a SOAPMessage.
protected  void processMessages(javax.mail.Message[] msgs)
           
 void setTransportName(String name)
           
 
Methods inherited from class org.jboss.net.axis.transport.mailto.AbstractMailTransportService
closeFolder, closeStore, fetchMessages, getDeleteMail, getEngineName, getFolderName, getMailFolder, getMailSession, getMailStore, getSessionName, pollMail, setDeleteMail, setEngineName, setFolderName, setSessionName
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailTransportService

public MailTransportService()
Method Detail

getTransportName

public String getTransportName()
Returns:
The name this transport has been given.

setTransportName

public void setTransportName(String name)
Parameters:
name - The name this transport will be known as (smtp for instance).

getEngine

public org.apache.axis.server.AxisServer getEngine()
                                            throws org.apache.axis.AxisFault
override AxisServlet.getEngine() in order to redirect to the corresponding AxisEngine. This is taken pretty much verbatem from the AxisServiceServlet

Throws:
org.apache.axis.AxisFault

processMessages

protected void processMessages(javax.mail.Message[] msgs)
Specified by:
processMessages in class AbstractMailTransportService

createMessageContext

protected org.apache.axis.MessageContext createMessageContext(org.apache.axis.AxisEngine engine,
                                                              javax.mail.Message msg)
                                                       throws org.apache.axis.AxisFault
Creates a message context that will be used while processing this request.

Parameters:
engine - Server engine
msg - Email message
Returns:
Throws:
org.apache.axis.AxisFault

processMessageBody

protected void processMessageBody(org.apache.axis.MessageContext mc,
                                  javax.mail.Message msg)
                           throws org.apache.axis.AxisFault
Serialize the email message body into a SOAPMessage.

Parameters:
mc - MessageContext that will be used while processing this message
msg - Email Message
Throws:
org.apache.axis.AxisFault - if we need to abort this message (drop the context and delete the email message with out sending a response message.)

processHeaders

protected String processHeaders(org.apache.axis.MessageContext ctx,
                                javax.mail.Message msg)
                         throws org.apache.axis.AxisFault
Parameters:
ctx - MessageContext that is being used for processing this request
msg - Email message that is theoretically holding a SOAP request.
Returns:
The value of the first Message-ID header found.
Throws:
org.apache.axis.AxisFault

archiveMessage

protected void archiveMessage(String msgID,
                              org.apache.axis.MessageContext msgCtx)
Override this method if you need to store incoming messages.
Note: If web service security handlers are in the handler chain, the message will not have been verified/decrypted yet.

Parameters:
msgID -
msgCtx -


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.