net.sf.xbus.technical.mail
Class POP3XMLReceiver

java.lang.Object
  extended by net.sf.xbus.technical.mail.POP3XMLReceiver
All Implemented Interfaces:
TAResource, Receiver, ReceiverSingleInterface
Direct Known Subclasses:
POP3Receiver

public class POP3XMLReceiver
extends java.lang.Object
implements Receiver, TAResource, ReceiverSingleInterface

TODO Kommentierung

When the POP3XMLReceiver receives a request it reads the emails into a String and calls the application layer.

Version:
1.3
Author:
Dominique Boivin

Field Summary
protected  javax.mail.Folder mFolder
           
protected  javax.mail.Message mMessage
           
 
Constructor Summary
POP3XMLReceiver()
           
 
Method Summary
 void close()
          This method will close the connection with the POP3 server
protected  void closeFolder()
           
 void commit()
          Implemented method commit from TAResource interface.
 void deleteMail()
          Do the action of deleting the message from the pop3 inbox account
protected  boolean doReceive(XBUSSystem xbusSystem)
           
protected  java.lang.String getAddress()
           
 java.lang.String getOnError()
          Returns the onError.
protected  java.lang.Object getRequestContent(java.lang.String system)
          getRequestContent delivers the content of the request.
protected  java.lang.String getReturncode()
           
 java.lang.String getType()
          A Receiver can receive data either as a String or as an Object from a neighboring system.
 void open()
          This method will open the connection with the POP3 server
protected  void readConfiguration(java.lang.String system)
          Reads standard configuration and stores follow data in the class variables: Host specified the host address of the POP3 account Username specified the useraname of the POP3 account Password specified the passowrd of the POP3 account
 void receive(java.lang.String systemName)
          This method will open the Transaction manager for this ressource adb use the doReceive(XBUSSystem)method to process the reading
 void rollback()
          Implemented method rollback from TAResource ignores all changes have made since the beginning of the process (transaction).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mFolder

protected javax.mail.Folder mFolder

mMessage

protected javax.mail.Message mMessage
Constructor Detail

POP3XMLReceiver

public POP3XMLReceiver()
Method Detail

receive

public void receive(java.lang.String systemName)
This method will open the Transaction manager for this ressource adb use the doReceive(XBUSSystem)method to process the reading

Specified by:
receive in interface ReceiverSingleInterface
Parameters:
systemName - name of the interface definition
Throws:
XException - if something goes wrong
See Also:
XBUSSystem.getSystems(String, String)

doReceive

protected boolean doReceive(XBUSSystem xbusSystem)

getRequestContent

protected java.lang.Object getRequestContent(java.lang.String system)
                                      throws XException
getRequestContent delivers the content of the request. Subclasses may define their own request content.

Returns:
the interface file content as String but casted to Object for compliance reasons
Throws:
XException

commit

public void commit()
            throws XException
Implemented method commit from TAResource interface. The purpose of commit actions is to remove any backup information that had been created during process(tansaction).

Depending on the FinalResolution, the following acts commit all actions.

Resolution Acts
Preserve delete copy file
Delete  1. delete the email

Specified by:
commit in interface TAResource
Throws:
XException - if any error occurs
See Also:
TAResource.commit()

rollback

public void rollback()
              throws XException
Implemented method rollback from TAResource ignores all changes have made since the beginning of the process (transaction).

Depending on the FinalResolution, the following acts roll back all modifications that have been made in the file system:

Resolution Acts
Delete

Specified by:
rollback in interface TAResource
Throws:
XException - if any error occurs
See Also:
TAResource.rollback()

open

public void open()
          throws XException
This method will open the connection with the POP3 server

Specified by:
open in interface TAResource
Throws:
XException - if something goes wrong

close

public void close()
           throws XException
This method will close the connection with the POP3 server

Specified by:
close in interface TAResource
Throws:
XException - if something goes wrong

getOnError

public java.lang.String getOnError()
Returns the onError.

Returns:
String

deleteMail

public void deleteMail()
                throws XException
Do the action of deleting the message from the pop3 inbox account

Throws:
XException

getType

public java.lang.String getType()
Description copied from interface: Receiver
A Receiver can receive data either as a String or as an Object from a neighboring system.

Specified by:
getType in interface Receiver

readConfiguration

protected void readConfiguration(java.lang.String system)
                          throws XException
Reads standard configuration and stores follow data in the class variables:

Host specified the host address of the POP3 account
Username specified the useraname of the POP3 account
Password specified the passowrd of the POP3 account

Parameters:
system - name of the interface definition
Throws:
XException - if something goes wrong

closeFolder

protected void closeFolder()
                    throws XException
Throws:
XException

getAddress

protected java.lang.String getAddress()

getReturncode

protected java.lang.String getReturncode()
Returns:
Returns the mReturncode.