org.apache.camel.component.file.remote
Class RemoteFileProducer<T>

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.impl.DefaultProducer
          extended by org.apache.camel.component.file.GenericFileProducer<T>
              extended by org.apache.camel.component.file.remote.RemoteFileProducer<T>
All Implemented Interfaces:
IsSingleton, Processor, Producer, Service, ServicePoolAware, ShutdownableService

public class RemoteFileProducer<T>
extends GenericFileProducer<T>
implements ServicePoolAware

Generic remote file producer for all the FTP variations.


Field Summary
 
Fields inherited from class org.apache.camel.component.file.GenericFileProducer
endpoint, log, operations
 
Constructor Summary
protected RemoteFileProducer(RemoteFileEndpoint<T> endpoint, RemoteFileOperations<T> operations)
           
 
Method Summary
protected  void connectIfNecessary()
           
 void disconnect()
           
protected  void doStart()
           
protected  void doStop()
           
 RemoteFileEndpoint<T> getEndpoint()
          Gets the endpoint this producer sends to.
 String getFileSeparator()
           
protected  RemoteFileOperations getOperations()
           
 void handleFailedWrite(Exchange exchange, Exception exception)
          The file could not be written.
 boolean isSingleton()
          Whether this class supports being singleton or not.
 String normalizePath(String name)
           
 void postWriteCheck()
          Perform any actions that need to occur after we are done such as disconnecting.
 void preWriteCheck()
          Perform any actions that need to occur before we write such as connecting to an FTP server etc.
 void process(Exchange exchange)
          Processes the message exchange
protected  void recoverableConnectIfNecessary()
           
 String toString()
           
 
Methods inherited from class org.apache.camel.component.file.GenericFileProducer
createFileName, createTempFileName, processExchange, setOperations, writeFile
 
Methods inherited from class org.apache.camel.impl.DefaultProducer
createExchange, createExchange, createExchange
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, removeChildService, resume, shutdown, start, start, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Constructor Detail

RemoteFileProducer

protected RemoteFileProducer(RemoteFileEndpoint<T> endpoint,
                             RemoteFileOperations<T> operations)
Method Detail

getFileSeparator

public String getFileSeparator()
Overrides:
getFileSeparator in class GenericFileProducer<T>

normalizePath

public String normalizePath(String name)
Overrides:
normalizePath in class GenericFileProducer<T>

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Overrides:
process in class GenericFileProducer<T>
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.

getOperations

protected RemoteFileOperations getOperations()

getEndpoint

public RemoteFileEndpoint<T> getEndpoint()
Description copied from interface: Producer
Gets the endpoint this producer sends to.

Specified by:
getEndpoint in interface Producer
Overrides:
getEndpoint in class DefaultProducer
Returns:
the endpoint

handleFailedWrite

public void handleFailedWrite(Exchange exchange,
                              Exception exception)
                       throws Exception
The file could not be written. We need to disconnect from the remote server.

Overrides:
handleFailedWrite in class GenericFileProducer<T>
Throws:
Exception

disconnect

public void disconnect()
                throws GenericFileOperationFailedException
Throws:
GenericFileOperationFailedException

preWriteCheck

public void preWriteCheck()
                   throws Exception
Description copied from class: GenericFileProducer
Perform any actions that need to occur before we write such as connecting to an FTP server etc.

Overrides:
preWriteCheck in class GenericFileProducer<T>
Throws:
Exception

postWriteCheck

public void postWriteCheck()
Description copied from class: GenericFileProducer
Perform any actions that need to occur after we are done such as disconnecting.

Overrides:
postWriteCheck in class GenericFileProducer<T>

doStart

protected void doStart()
                throws Exception
Overrides:
doStart in class GenericFileProducer<T>
Throws:
Exception

doStop

protected void doStop()
               throws Exception
Overrides:
doStop in class GenericFileProducer<T>
Throws:
Exception

recoverableConnectIfNecessary

protected void recoverableConnectIfNecessary()
                                      throws Exception
Throws:
Exception

connectIfNecessary

protected void connectIfNecessary()
                           throws GenericFileOperationFailedException
Throws:
GenericFileOperationFailedException

isSingleton

public boolean isSingleton()
Description copied from interface: IsSingleton
Whether this class supports being singleton or not.

Specified by:
isSingleton in interface IsSingleton
Overrides:
isSingleton in class DefaultProducer
Returns:
true to be a single shared instance, false to create new instances.

toString

public String toString()
Overrides:
toString in class DefaultProducer


Apache CAMEL