Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.transport.file
Class FileConnector

    java.lang.Object
      org.mule.transport.AbstractConnector
          org.mule.transport.file.FileConnector

All Implemented Interfaces:
  EventListener, javax.resource.spi.work.WorkListener, Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, NamedObject, Connectable, Connector

    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`
`static String` | `FILE`
`FilenameParser` | `filenameParser`
`static String` | `PROPERTY_DIRECTORY`
`static String` | `PROPERTY_FILE_AGE`
`static String` | `PROPERTY_FILE_SIZE`
`static String` | `PROPERTY_FILE_TIMESTAMP`
`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_READ_FROM_DIRECTORY`
`static String` | `PROPERTY_WRITE_TO_DIRECTORY`

Fields inherited from class org.mule.transport.AbstractConnector
`connected, createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatchers, initialStateStopped, lifecycleManager, muleContext, muleMessageFactory, name, numberOfConcurrentTransactedReceivers, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, startOnConnect`

Fields inherited from interface org.mule.api.transport.Connector
`INT_VALUE_NOT_SET`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`FileConnector(MuleContext context)`

Method Summary
`protected void` | `configureDispatcherPool()`
`MuleMessageFactory` | `createMuleMessageFactory()` Create a `MuleMessageFactory` from this connector's configuration, typically through the transport descriptor.
`MessageReceiver` | `createReceiver(FlowConstruct flowConstruct, InboundEndpoint 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(OutboundEndpoint endpoint, MuleMessage message)` Well get the output stream (if any) for this type of transport.
`long` | `getPollingFrequency()`
`String` | `getProtocol()`
`String` | `getReadFromDirectory()`
`protected Object` | `getReceiverKey(FlowConstruct flowConstruct, InboundEndpoint endpoint)` The method determines the key used to store the receiver against.
`String` | `getWorkDirectory()`
`String` | `getWorkFileNamePattern()`
`String` | `getWriteToDirectory()`
`boolean` | `isAutoDelete()`
`boolean` | `isOutputAppend()`
`boolean` | `isRecursive()`
`boolean` | `isSerialiseObjects()`
`boolean` | `isStreaming()`
`void` | `setAutoDelete(boolean autoDelete)`
`void` | `setFileAge(long fileAge)`
`void` | `setFilenameParser(FilenameParser filenameParser)`
`void` | `setMaxDispatchersActive(int value)` Configures the maximum number of dispatchers that can be concurrently active per endpoint
`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` | `setReadFromDirectory(String dir)`
`void` | `setRecursive(boolean recursive)`
`void` | `setSerialiseObjects(boolean serialiseObjects)`
`void` | `setStreaming(boolean streaming)`
`void` | `setWorkDirectory(String workDirectoryName)`
`void` | `setWorkFileNamePattern(String workFileNamePattern)`
`void` | `setWriteToDirectory(String dir)`

Methods inherited from class org.mule.transport.AbstractConnector
`clearDispatchers, clearRequesters, connect, createDispatcherMessageProcessor, createScheduler, destroyReceiver, disconnect, dispose, disposeReceivers, disposeWorkManagers, doUnregisterListener, exceptionThrown, fireNotification, getConnectEventId, getConnectionDescription, getDefaultExchangePattern, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getInboundExchangePatterns, getLifecycleState, getMaxDispatchersActive, getMaxRequestersActive, getMaxTotalDispatchers, getMuleContext, getMuleMessageFactory, getName, getNumberOfConcurrentTransactedReceivers, getOutboundExchangePatterns, getReceiver, getReceivers, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getReplyToHandler, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getRetryPolicyTemplate, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, handleException, handleException, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isCreateMultipleTransactedReceivers, isDisposed, isEnableMessageEvents, isInitialised, isInitialStateStopped, isResponseEnabled, isStarted, isStopped, isValidateConnections, lookupReceiver, registerListener, registerSupportedMetaProtocol, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, setConnected, setCreateMultipleTransactedReceivers, setDispatcherFactory, setDispatcherPoolMaxWait, setDispatcherPoolWhenExhaustedAction, setDispatcherThreadingProfile, setDynamicNotification, setInitialStateStopped, setMaxRequestersActive, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterPoolMaxWait, setRequesterPoolWhenExhaustedAction, setRequesterThreadingProfile, setRetryPolicyTemplate, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, setValidateConnections, shutdownScheduler, start, startAfterConnect, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, validateConnection, workAccepted, workCompleted, workRejected, workStarted`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### FILE

    public static final String FILE

See Also:
  Constant Field Values

### 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_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_READ_FROM_DIRECTORY

    public static final String PROPERTY_READ_FROM_DIRECTORY

See Also:
  Constant Field Values

### PROPERTY_OUTPUT_PATTERN

    public static final String PROPERTY_OUTPUT_PATTERN

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_DIRECTORY

    public static final String PROPERTY_DIRECTORY

See Also:
  Constant Field Values

### PROPERTY_WRITE_TO_DIRECTORY

    public static final String PROPERTY_WRITE_TO_DIRECTORY

See Also:
  Constant Field Values

### PROPERTY_FILE_SIZE

    public static final String PROPERTY_FILE_SIZE

See Also:
  Constant Field Values

### PROPERTY_FILE_TIMESTAMP

    public static final String PROPERTY_FILE_TIMESTAMP

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(MuleContext context)

Method Detail

### configureDispatcherPool

    protected void configureDispatcherPool()

  Overrides:
    `configureDispatcherPool` in class `AbstractConnector`

### setMaxDispatchersActive

    public void setMaxDispatchersActive(int value)

  Description copied from class: `AbstractConnector`
  Configures the maximum number of dispatchers that can be concurrently active per endpoint

  Overrides:
    `setMaxDispatchersActive` in class `AbstractConnector`
  Parameters:
    `value` - max. number of active dispatchers

### getReceiverKey

    protected Object getReceiverKey(FlowConstruct flowConstruct,
                                    InboundEndpoint endpoint)

  Description copied from class: `AbstractConnector`
  The method determines the key used to store the receiver against.

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

### createReceiver

    public MessageReceiver createReceiver(FlowConstruct flowConstruct,
                                          InboundEndpoint endpoint)
                                   throws Exception

  Registers a listener for a particular directory The following properties can be overriden in the endpoint declaration
  - moveToDirectory
  - filterPatterns
  - filterClass
  - pollingFrequency

  Overrides:
    `createReceiver` in class `AbstractConnector`
  Parameters:
    `flowConstruct` - the service 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 service 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 MuleException

  Description copied from class: `AbstractConnector`
  Template method to perform any work when starting the connectoe

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

### doStop

    protected void doStop()
                   throws MuleException

  Description copied from class: `AbstractConnector`
  Template method to perform any work when stopping the connectoe

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

### getMoveToDirectory

    public String getMoveToDirectory()

### setMoveToDirectory

    public void setMoveToDirectory(String dir)

### setWorkDirectory

    public void setWorkDirectory(String workDirectoryName)
                          throws IOException

  Throws:
    `IOException`

### getWorkDirectory

    public String getWorkDirectory()

### setWorkFileNamePattern

    public void setWorkFileNamePattern(String workFileNamePattern)

### getWorkFileNamePattern

    public String getWorkFileNamePattern()

### isOutputAppend

    public boolean isOutputAppend()

### setOutputAppend

    public void setOutputAppend(boolean outputAppend)

### getOutputPattern

    public String getOutputPattern()

### setOutputPattern

    public void setOutputPattern(String outputPattern)

### getOutputStream

    public FileOutputStream getOutputStream()

### setOutputStream

    public void setOutputStream(FileOutputStream outputStream)

### getPollingFrequency

    public long getPollingFrequency()

### setPollingFrequency

    public void setPollingFrequency(long pollingFrequency)

### getFileAge

    public long getFileAge()

### getCheckFileAge

    public boolean getCheckFileAge()

### setFileAge

    public void setFileAge(long fileAge)

### getWriteToDirectory

    public String getWriteToDirectory()

### setWriteToDirectory

    public void setWriteToDirectory(String dir)
                             throws IOException

  Throws:
    `IOException`

### getReadFromDirectory

    public String getReadFromDirectory()

### setReadFromDirectory

    public void setReadFromDirectory(String dir)
                              throws IOException

  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(OutboundEndpoint endpoint,
                                        MuleMessage message)
                                 throws MuleException

  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 `Connector`
  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:
    `MuleException`

### isStreaming

    public boolean isStreaming()

### setStreaming

    public void setStreaming(boolean streaming)

### createMuleMessageFactory

    public MuleMessageFactory createMuleMessageFactory()
                                                throws CreateException

  Description copied from class: `AbstractConnector`

  Create a `MuleMessageFactory` from this connector's configuration, typically through the transport descriptor.

  Attention! This method is not meant to be used by client code directly. It is only publicly available to service message receivers which should be used as real factories to create `MuleMessage` instances.

  Specified by:
    `createMuleMessageFactory` in interface `Connector`
  Overrides:
    `createMuleMessageFactory` in class `AbstractConnector`
  Throws:
    `CreateException`
  See Also:
    `MessageReceiver.createMuleMessage(Object)`, `MessageReceiver.createMuleMessage(Object, String)`

### isRecursive

    public boolean isRecursive()

### setRecursive

    public void setRecursive(boolean recursive)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.