com.instantbank.component.lettersftpmdb.ejb
Class LettersJobFtpMdb

java.lang.Object
  |
  +--com.instantbank.component.lettersftpmdb.ejb.LettersJobFtpMdb
All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.MessageDrivenBean, javax.jms.MessageListener, java.io.Serializable

public class LettersJobFtpMdb
extends java.lang.Object
implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener

Message Driven bean that sends letter zip files by ftp. See onMessage(Message) for message description.

Author:
InstantBank (Rodrigo Lopez)
See Also:
Serialized Form

Field Summary
private  Debug debug
          The ubiquitous debugger object.
static long WAIT_RETRY
          Number of milliseconds to wait for retry when all locations have been tried and failed.
 
Constructor Summary
LettersJobFtpMdb()
           
 
Method Summary
 void ejbCreate()
          Initializes the Debug facility.
 void ejbRemove()
          This method has void body for Message Driven Beans.
private  com.enterprisedt.net.ftp.FTPClient ftpTransfer(CompanyLocation location, java.lang.String filePath)
          Sends a file to a location's ip address.
 void onMessage(javax.jms.Message jobMsg)
          Sends by ftp a zip file.
 void setMessageDrivenContext(javax.ejb.MessageDrivenContext mdc)
          Nothing interesting here.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug

private Debug debug
The ubiquitous debugger object.

WAIT_RETRY

public static final long WAIT_RETRY
Number of milliseconds to wait for retry when all locations have been tried and failed.
Constructor Detail

LettersJobFtpMdb

public LettersJobFtpMdb()
Method Detail

ejbRemove

public void ejbRemove()
               throws javax.ejb.EJBException
This method has void body for Message Driven Beans.
Specified by:
ejbRemove in interface javax.ejb.MessageDrivenBean
Throws:
javax.ejb.EJBException - Description of the Exception

setMessageDrivenContext

public void setMessageDrivenContext(javax.ejb.MessageDrivenContext mdc)
                             throws javax.ejb.EJBException
Nothing interesting here.
Specified by:
setMessageDrivenContext in interface javax.ejb.MessageDrivenBean
Parameters:
mdc - The new messageDrivenContext value
Throws:
javax.ejb.EJBException - Description of the Exception

ejbCreate

public void ejbCreate()
Initializes the Debug facility.

onMessage

public void onMessage(javax.jms.Message jobMsg)
Sends by ftp a zip file. Messages are expected to be MapMessages containing: Information is stored in the LETT_JOB_FTP_LOG table recording whether or not the file was sent, and a comment in case ftp fails.
Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
jobMsg - Description of the Parameter

ftpTransfer

private com.enterprisedt.net.ftp.FTPClient ftpTransfer(CompanyLocation location,
                                                       java.lang.String filePath)
                                                throws com.enterprisedt.net.ftp.FTPException
Sends a file to a location's ip address.
Parameters:
location - Information about the target location.
filePath - Full path of the file to be sent.
Returns:
The ftp client that succeded sending the file.
Throws:
com.enterprisedt.net.ftp.FTPException - if anything goes wrong.