|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.file.monitors.AbstractEventDrivenFileMonitor
public abstract class AbstractEventDrivenFileMonitor
This component will support event-based (not poller based) notifications of files from a file system. Immediate implementations will center around supporting other adapters's delivery of files once they've been synced from a remote system. Potential future expansions for consumer consumption might be a push / event-based file adapter based on either native code or Java 7's NIO.2 WaterService or other third party implementations.
In the meantime, this provides us with a base class for building event driven file adapters quickly. The two cases I see are:
Field Summary |
---|
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
AbstractEventDrivenFileMonitor()
|
Method Summary | |
---|---|
protected void |
installDirectoryIfRequired(File directoryToMonitor)
Handles ensuring that the directory we're monitroring exists or can be created |
void |
monitor(File directory,
FileAdditionListener fileAdditionListener)
installs directory, and then kicks of an event pump |
protected void |
onInit()
Subclasses may implement this for initialization logic. |
protected void |
prescan()
Obviously, we're trying to keep away from scanning, but this may be necessary at startup to catch up the backlog |
protected void |
publishNewFileReceived(File file)
|
protected void |
publishNewFileReceived(String path)
|
void |
setAutoCreateDirectory(boolean autoCreateDirectory)
|
void |
setExecutor(Executor executor)
|
void |
setFilter(EntryListFilter<File> filter)
|
void |
setMaxQueueSize(int maxQueueSize)
|
void |
setScanDirectoryOnLoad(boolean scanDirectoryOnLoad)
|
protected void |
start()
Custom initialization hook - override at your discretion |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getRequiredMetadataPersister, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractEventDrivenFileMonitor()
Method Detail |
---|
public void setScanDirectoryOnLoad(boolean scanDirectoryOnLoad)
public void monitor(File directory, FileAdditionListener fileAdditionListener) throws Exception
monitor
in interface EventDrivenDirectoryMonitor
directory
- the directory to start watching from. Unspecified if this implies recursion or not.fileAdditionListener
- the callback
Exception
public void setMaxQueueSize(int maxQueueSize)
public void setFilter(EntryListFilter<File> filter)
public void setExecutor(Executor executor)
public void setAutoCreateDirectory(boolean autoCreateDirectory)
protected void publishNewFileReceived(String path)
protected void publishNewFileReceived(File file)
protected void prescan()
protected void installDirectoryIfRequired(File directoryToMonitor) throws Exception
directoryToMonitor
- the directory to monitor
Exception
protected void start() throws Exception
Exception
protected void onInit() throws Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
Exception
|
Spring Integration | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |