org.mule.providers.file
Class FileConnector

java.lang.Object
  extended byorg.mule.providers.AbstractConnector
      extended byorg.mule.providers.file.FileConnector
All Implemented Interfaces:
Disposable, EventListener, ExceptionListener, Initialisable, UMOConnectable, UMOConnector, WorkListener

public class FileConnector
extends AbstractConnector

FileConnector is used for setting up listeners on a directory and for writing files to a directory. The connecotry provides support for defining file output patterns and filters for receiving files.


Field Summary
static long DEFAULT_POLLING_FREQUENCY
           
 FilenameParser filenameParser
           
static String PROPERTY_DELETE_ON_READ
           
static String PROPERTY_DIRECTORY
           
static String PROPERTY_FILE_AGE
           
static String PROPERTY_FILENAME
           
static String PROPERTY_MOVE_TO_DIRECTORY
           
static String PROPERTY_MOVE_TO_PATTERN
           
static String PROPERTY_ORIGINAL_FILENAME
           
static String PROPERTY_OUTPUT_PATTERN
           
static String PROPERTY_POLLING_FREQUENCY
           
static String PROPERTY_SERVICE_OVERRIDE
           
static String PROPERTY_WRITE_TO_DIRECTORY
           
 
Fields inherited from class org.mule.providers.AbstractConnector
connected, connecting, connectionStrategy, createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, defaultInboundTransformer, defaultOutboundTransformer, defaultResponseTransformer, dispatcherFactory, dispatchers, disposed, disposing, exceptionListener, initialised, name, numberOfConcurrentTransactedReceivers, receivers, serviceDescriptor, serviceOverrides, sessionHandler, started, startOnConnect
 
Fields inherited from interface org.mule.umo.provider.UMOConnector
INT_VALUE_NOT_SET
 
Constructor Summary
FileConnector()
           
 
Method Summary
 UMOMessageReceiver createReceiver(UMOComponent component, UMOEndpoint endpoint)
          Registers a listener for a particular directory The following properties can be overriden in the endpoint declaration moveToDirectory filterPatterns filterClass pollingFrequency
protected  void doConnect()
          Template method where any connections should be made for the connector
protected  void doDisconnect()
          Template method where any connected resources used by the connector should be disconnected
protected  void doDispose()
          Template method to perform any work when destroying the connectoe
protected  void doInitialise()
           
protected  void doStart()
          Template method to perform any work when starting the connectoe
protected  void doStop()
          Template method to perform any work when stopping the connectoe
 boolean getCheckFileAge()
           
 long getFileAge()
           
 FilenameParser getFilenameParser()
           
 String getMoveToDirectory()
           
 String getMoveToPattern()
           
 String getOutputPattern()
           
 FileOutputStream getOutputStream()
           
 OutputStream getOutputStream(UMOImmutableEndpoint endpoint, UMOMessage message)
          Well get the output stream (if any) for this type of transport.
 long getPollingFrequency()
           
 String getProtocol()
           
protected  Object getReceiverKey(UMOComponent component, UMOEndpoint endpoint)
          The method determines the key used to store the receiver against.
 String getWriteToDirectory()
           
 boolean isAutoDelete()
           
 boolean isOutputAppend()
           
 boolean isSerialiseObjects()
           
 void setAutoDelete(boolean autoDelete)
           
 void setFileAge(long fileAge)
           
 void setFilenameParser(FilenameParser filenameParser)
           
 void setMoveToDirectory(String dir)
           
 void setMoveToPattern(String moveToPattern)
           
 void setOutputAppend(boolean outputAppend)
           
 void setOutputPattern(String outputPattern)
           
 void setOutputStream(FileOutputStream outputStream)
           
 void setPollingFrequency(long pollingFrequency)
           
 void setSerialiseObjects(boolean serialiseObjects)
           
 void setWriteToDirectory(String dir)
           
 
Methods inherited from class org.mule.providers.AbstractConnector
checkDisposed, connect, destroyReceiver, disconnect, dispatch, dispose, disposeDispatchers, disposeReceivers, disposeWorkManagers, exceptionThrown, fireNotification, getConnectEventId, getConnectionDescription, getConnectionStrategy, getDefaultInboundTransformer, getDefaultOutboundTransformer, getDefaultResponseTransformer, getDispatcherFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getExceptionListener, getMaxDispatchersActive, getMessageAdapter, getName, getNumberOfConcurrentTransactedReceivers, getReceiver, getReceivers, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getReplyToHandler, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getStreamMessageAdapter, getSupportedProtocols, handleException, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, isConnected, isCreateMultipleTransactedReceivers, isDisposed, isDisposing, isEnableMessageEvents, isRemoteSyncEnabled, isStarted, lookupReceiver, receive, receive, registerListener, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, send, setConnectionStrategy, setCreateMultipleTransactedReceivers, setDefaultInboundTransformer, setDefaultOutboundTransformer, setDefaultResponseTransformer, setDispatcherFactory, setDispatcherThreadingProfile, setEnableMessageEvents, setExceptionListener, setMaxDispatchersActive, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setServiceOverrides, setSessionHandler, setSupportedProtocols, startConnector, stopConnector, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_POLLING_FREQUENCY

public static final String PROPERTY_POLLING_FREQUENCY
See Also:
Constant Field Values

PROPERTY_FILE_AGE

public static final String PROPERTY_FILE_AGE
See Also:
Constant Field Values

PROPERTY_FILENAME

public static final String PROPERTY_FILENAME
See Also:
Constant Field Values

PROPERTY_ORIGINAL_FILENAME

public static final String PROPERTY_ORIGINAL_FILENAME
See Also:
Constant Field Values

PROPERTY_OUTPUT_PATTERN

public static final String PROPERTY_OUTPUT_PATTERN
See Also:
Constant Field Values

PROPERTY_MOVE_TO_PATTERN

public static final String PROPERTY_MOVE_TO_PATTERN
See Also:
Constant Field Values

PROPERTY_MOVE_TO_DIRECTORY

public static final String PROPERTY_MOVE_TO_DIRECTORY
See Also:
Constant Field Values

PROPERTY_DELETE_ON_READ

public static final String PROPERTY_DELETE_ON_READ
See Also:
Constant Field Values

PROPERTY_DIRECTORY

public static final String PROPERTY_DIRECTORY
See Also:
Constant Field Values

PROPERTY_SERVICE_OVERRIDE

public static final String PROPERTY_SERVICE_OVERRIDE
See Also:
Constant Field Values

PROPERTY_WRITE_TO_DIRECTORY

public static final String PROPERTY_WRITE_TO_DIRECTORY
See Also:
Constant Field Values

DEFAULT_POLLING_FREQUENCY

public static final long DEFAULT_POLLING_FREQUENCY
See Also:
Constant Field Values

filenameParser

public FilenameParser filenameParser
Constructor Detail

FileConnector

public FileConnector()
Method Detail

getReceiverKey

protected Object getReceiverKey(UMOComponent component,
                                UMOEndpoint endpoint)
Description copied from class: AbstractConnector
The method determines the key used to store the receiver against.

Overrides:
getReceiverKey in class AbstractConnector
Parameters:
component - the component for which the endpoint is being registered
endpoint - the endpoint being registered for the component
Returns:
the key to store the newly created receiver against

createReceiver

public UMOMessageReceiver createReceiver(UMOComponent component,
                                         UMOEndpoint endpoint)
                                  throws Exception
Registers a listener for a particular directory The following properties can be overriden in the endpoint declaration

Overrides:
createReceiver in class AbstractConnector
Parameters:
component - the component that will receive events from this receiver, the listener
endpoint - the endpoint that defies this inbound communication
Returns:
an instance of the message receiver defined in this connectors' TransportServiceDescriptor initialised using the component and endpoint.
Throws:
Exception - if there is a problem creating the receiver. This exception really depends on the underlying transport, thus any exception could be thrown

getProtocol

public String getProtocol()
Returns:
the primary protocol name for endpoints of this connector

getFilenameParser

public FilenameParser getFilenameParser()

setFilenameParser

public void setFilenameParser(FilenameParser filenameParser)

doDispose

protected void doDispose()
Description copied from class: AbstractConnector
Template method to perform any work when destroying the connectoe

Specified by:
doDispose in class AbstractConnector

doInitialise

protected void doInitialise()
                     throws InitialisationException
Specified by:
doInitialise in class AbstractConnector
Throws:
InitialisationException

doConnect

protected void doConnect()
                  throws Exception
Description copied from class: AbstractConnector
Template method where any connections should be made for the connector

Specified by:
doConnect in class AbstractConnector
Throws:
Exception

doDisconnect

protected void doDisconnect()
                     throws Exception
Description copied from class: AbstractConnector
Template method where any connected resources used by the connector should be disconnected

Specified by:
doDisconnect in class AbstractConnector
Throws:
Exception

doStart

protected void doStart()
                throws UMOException
Description copied from class: AbstractConnector
Template method to perform any work when starting the connectoe

Specified by:
doStart in class AbstractConnector
Throws:
UMOException - if the method fails

doStop

protected void doStop()
               throws UMOException
Description copied from class: AbstractConnector
Template method to perform any work when stopping the connectoe

Specified by:
doStop in class AbstractConnector
Throws:
UMOException - if the method fails

getMoveToDirectory

public String getMoveToDirectory()
Returns:
Returns the moveToDirectoryName.

setMoveToDirectory

public void setMoveToDirectory(String dir)
Parameters:
dir - The moveToDirectoryName to set.

isOutputAppend

public boolean isOutputAppend()
Returns:
Returns the outputAppend.

setOutputAppend

public void setOutputAppend(boolean outputAppend)
Parameters:
outputAppend - The outputAppend to set.

getOutputPattern

public String getOutputPattern()
Returns:
Returns the outputPattern.

setOutputPattern

public void setOutputPattern(String outputPattern)
Parameters:
outputPattern - The outputPattern to set.

getOutputStream

public FileOutputStream getOutputStream()
Returns:
Returns the outputStream.

setOutputStream

public void setOutputStream(FileOutputStream outputStream)
Parameters:
outputStream - The outputStream to set.

getPollingFrequency

public long getPollingFrequency()
Returns:
Returns the pollingFrequency.

setPollingFrequency

public void setPollingFrequency(long pollingFrequency)
Parameters:
pollingFrequency - The pollingFrequency to set.

getFileAge

public long getFileAge()
Returns:
Returns the fileAge.

getCheckFileAge

public boolean getCheckFileAge()

setFileAge

public void setFileAge(long fileAge)
Parameters:
fileAge - The fileAge in milliseconds to set.

getWriteToDirectory

public String getWriteToDirectory()
Returns:
Returns the writeToDirectory.

setWriteToDirectory

public void setWriteToDirectory(String dir)
                         throws IOException
Parameters:
dir - The writeToDirectory to set.
Throws:
IOException

isSerialiseObjects

public boolean isSerialiseObjects()

setSerialiseObjects

public void setSerialiseObjects(boolean serialiseObjects)

isAutoDelete

public boolean isAutoDelete()

setAutoDelete

public void setAutoDelete(boolean autoDelete)

getMoveToPattern

public String getMoveToPattern()

setMoveToPattern

public void setMoveToPattern(String moveToPattern)

getOutputStream

public OutputStream getOutputStream(UMOImmutableEndpoint endpoint,
                                    UMOMessage message)
                             throws UMOException
Well get the output stream (if any) for this type of transport. Typically this will be called only when Streaming is being used on an outbound endpoint

Specified by:
getOutputStream in interface UMOConnector
Overrides:
getOutputStream in class AbstractConnector
Parameters:
endpoint - the endpoint that releates to this Dispatcher
message - the current message being processed
Returns:
the output stream to use for this request or null if the transport does not support streaming
Throws:
UMOException


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.