org.apache.servicemix.ftp
Class FtpPollerEndpoint

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ConsumerEndpoint
              extended by org.apache.servicemix.common.endpoints.PollingEndpoint
                  extended by org.apache.servicemix.ftp.FtpPollerEndpoint
All Implemented Interfaces:
Endpoint, FtpEndpointType

public class FtpPollerEndpoint
extends PollingEndpoint
implements FtpEndpointType

A polling endpoint which looks for a file or files in a directory and sends the files into the JBI bus as messages, deleting the files by default when they are processed.

Version:
$Revision: 468487 $

Nested Class Summary
protected  class FtpPollerEndpoint.FtpData
           
 
Field Summary
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
FtpPollerEndpoint()
           
FtpPollerEndpoint(DefaultComponent component, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
FtpPollerEndpoint(ServiceUnit serviceUnit, QName service, String endpoint)
           
 
Method Summary
protected  org.apache.commons.net.ftp.FTPClient borrowClient()
           
protected  FTPClientPool createClientPool()
           
protected  LockManager createLockManager()
           
 FTPClientPool getClientPool()
           
 FileFilter getFilter()
           
 String getLocationURI()
           
 org.apache.servicemix.components.util.FileMarshaler getMarshaler()
           
 QName getTargetOperation()
           
 URI getUri()
           
 boolean isDeleteFile()
          Returns whether or not we should delete the file when its processed
 boolean isRecursive()
           
 boolean isStateless()
           
 void poll()
           
protected  void pollFile(String file)
           
protected  void pollFileOrDirectory(org.apache.commons.net.ftp.FTPClient ftp, String fileOrDirectory, boolean processDir)
           
protected  void pollFileOrDirectory(String fileOrDirectory)
           
 void process(javax.jbi.messaging.MessageExchange exchange)
           
protected  void processFile(org.apache.commons.net.ftp.FTPClient ftp, String file)
           
protected  void processFileNow(String file)
           
protected  void returnClient(org.apache.commons.net.ftp.FTPClient client)
           
 void setChangeWorkingDirectory(boolean changeWorkingDirectory)
           
 void setClientPool(FTPClientPool clientPool)
           
 void setDeleteFile(boolean deleteFile)
           
 void setFilter(FileFilter filter)
          Sets the optional filter to choose which files to process
 void setMarshaler(org.apache.servicemix.components.util.FileMarshaler marshaler)
           
 void setRecursive(boolean recursive)
           
 void setStateless(boolean stateless)
           
 void setTargetOperation(QName targetOperation)
           
 void setUri(URI uri)
           
 void start()
           
 void validate()
           
 
Methods inherited from class org.apache.servicemix.common.endpoints.PollingEndpoint
getDelay, getExecutor, getFirstTime, getPeriod, getScheduler, handlePollException, isConcurrentPolling, setConcurrentPolling, setDelay, setFirstTime, setPeriod, setScheduler, stop
 
Methods inherited from class org.apache.servicemix.common.endpoints.ConsumerEndpoint
activate, configureExchangeTarget, deactivate, getRole, getTargetEndpoint, getTargetInterface, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetService, setTargetUri
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getDefinition, getDescription, getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FtpPollerEndpoint

public FtpPollerEndpoint()

FtpPollerEndpoint

public FtpPollerEndpoint(ServiceUnit serviceUnit,
                         QName service,
                         String endpoint)

FtpPollerEndpoint

public FtpPollerEndpoint(DefaultComponent component,
                         javax.jbi.servicedesc.ServiceEndpoint endpoint)
Method Detail

poll

public void poll()
          throws Exception
Specified by:
poll in class PollingEndpoint
Throws:
Exception

validate

public void validate()
              throws javax.jbi.management.DeploymentException
Specified by:
validate in interface Endpoint
Overrides:
validate in class ConsumerEndpoint
Throws:
javax.jbi.management.DeploymentException

start

public void start()
           throws Exception
Specified by:
start in interface Endpoint
Overrides:
start in class PollingEndpoint
Throws:
Exception

createLockManager

protected LockManager createLockManager()

getClientPool

public FTPClientPool getClientPool()
Returns:
the clientPool

setClientPool

public void setClientPool(FTPClientPool clientPool)
Parameters:
clientPool - the clientPool to set

getUri

public URI getUri()
Returns:
the uri

setUri

public void setUri(URI uri)
Parameters:
uri - the uri to set

getFilter

public FileFilter getFilter()

setFilter

public void setFilter(FileFilter filter)
Sets the optional filter to choose which files to process


isDeleteFile

public boolean isDeleteFile()
Returns whether or not we should delete the file when its processed


setDeleteFile

public void setDeleteFile(boolean deleteFile)

isRecursive

public boolean isRecursive()

setRecursive

public void setRecursive(boolean recursive)

getMarshaler

public org.apache.servicemix.components.util.FileMarshaler getMarshaler()

setMarshaler

public void setMarshaler(org.apache.servicemix.components.util.FileMarshaler marshaler)

getTargetOperation

public QName getTargetOperation()
Overrides:
getTargetOperation in class ConsumerEndpoint

setTargetOperation

public void setTargetOperation(QName targetOperation)
Overrides:
setTargetOperation in class ConsumerEndpoint

setChangeWorkingDirectory

public void setChangeWorkingDirectory(boolean changeWorkingDirectory)

isStateless

public boolean isStateless()

setStateless

public void setStateless(boolean stateless)

pollFileOrDirectory

protected void pollFileOrDirectory(String fileOrDirectory)
                            throws Exception
Throws:
Exception

pollFileOrDirectory

protected void pollFileOrDirectory(org.apache.commons.net.ftp.FTPClient ftp,
                                   String fileOrDirectory,
                                   boolean processDir)
                            throws Exception
Throws:
Exception

pollFile

protected void pollFile(String file)

processFileNow

protected void processFileNow(String file)

processFile

protected void processFile(org.apache.commons.net.ftp.FTPClient ftp,
                           String file)
                    throws Exception
Throws:
Exception

getLocationURI

public String getLocationURI()
Overrides:
getLocationURI in class ConsumerEndpoint

process

public void process(javax.jbi.messaging.MessageExchange exchange)
             throws Exception
Specified by:
process in interface Endpoint
Specified by:
process in class AbstractEndpoint
Throws:
Exception

createClientPool

protected FTPClientPool createClientPool()
                                  throws Exception
Throws:
Exception

borrowClient

protected org.apache.commons.net.ftp.FTPClient borrowClient()
                                                     throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

returnClient

protected void returnClient(org.apache.commons.net.ftp.FTPClient client)


Copyright © 2005-2009 The Apache Software Foundation. All Rights Reserved.