|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.servicemix.common.endpoints.AbstractEndpoint
org.apache.servicemix.common.endpoints.SimpleEndpoint
org.apache.servicemix.common.endpoints.ConsumerEndpoint
org.apache.servicemix.common.endpoints.PollingEndpoint
org.apache.servicemix.vfs.VFSPollingEndpoint
public class VFSPollingEndpoint
A polling endpoint that looks for a file or files in a virtual file system
and sends the files to a target service (via the JBI bus), deleting the files
by default when they are processed. The polling endpoint uses a file marshaler
to send the data as a JBI message; by default this marshaler expects XML
payload. For non-XML payload, e.g. plain-text or binary files, use an
alternative marshaler such as the
org.apache.servicemix.components.util.BinaryFileMarshaler
| Field Summary |
|---|
| Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint |
|---|
definition, description, endpoint, interfaceName, service, serviceUnit |
| Constructor Summary | |
|---|---|
VFSPollingEndpoint()
default constructor |
|
VFSPollingEndpoint(DefaultComponent component,
javax.jbi.servicedesc.ServiceEndpoint endpoint)
creates a VFS polling endpoint |
|
VFSPollingEndpoint(ServiceUnit serviceUnit,
QName service,
String endpoint)
creates a VFS polling endpoint |
|
| Method Summary | |
|---|---|
protected LockManager |
createLockManager()
returns the lock manager |
Comparator<org.apache.commons.vfs.FileObject> |
getComparator()
|
org.apache.commons.vfs.FileSystemManager |
getFileSystemManager()
|
String |
getLocationURI()
|
LockManager |
getLockManager()
|
org.apache.servicemix.components.util.FileMarshaler |
getMarshaler()
|
String |
getPath()
|
org.apache.commons.vfs.FileSelector |
getSelector()
|
Set<org.apache.commons.vfs.FileObject> |
getWorkingSet()
The set of FTPFiles that this component is currently working on |
boolean |
isConcurrentExchange()
|
boolean |
isDeleteFile()
|
boolean |
isRecursive()
|
void |
poll()
|
protected void |
pollFile(org.apache.commons.vfs.FileObject aFile)
polls a file object |
protected void |
pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory)
polls a file which is not clear to be a file or folder |
protected void |
pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory,
boolean processDir)
recursive method for processing a file or a folder |
void |
process(javax.jbi.messaging.MessageExchange exchange)
|
protected void |
processFile(org.apache.commons.vfs.FileObject file)
does the real processing logic |
protected void |
processFileNow(org.apache.commons.vfs.FileObject aFile)
processes a file |
void |
setComparator(Comparator<org.apache.commons.vfs.FileObject> comparator)
Specifies a Comparator object. |
void |
setConcurrentExchange(boolean concurrentExchange)
|
void |
setDeleteFile(boolean deleteFile)
Specifies if files should be deleted after they are processed. |
void |
setFileSystemManager(org.apache.commons.vfs.FileSystemManager fileSystemManager)
sets the file system manager |
void |
setLockManager(LockManager lockManager)
Bean defining the class implementing the file locking strategy. |
void |
setMarshaler(org.apache.servicemix.components.util.FileMarshaler marshaler)
Specifies a FileMarshaler object that will marshal file data
into the NMR. |
void |
setPath(String path)
Specifies a String object representing the path of the
file/folder to be polled. |
void |
setRecursive(boolean recursive)
|
void |
setSelector(org.apache.commons.vfs.FileSelector selector)
Specifies a FileSelector object. |
void |
start()
|
| 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, getTargetOperation, getTargetService, getTargetUri, setTargetEndpoint, setTargetInterface, setTargetOperation, setTargetService, setTargetUri, validate |
| 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 |
|---|
public VFSPollingEndpoint()
public VFSPollingEndpoint(ServiceUnit serviceUnit,
QName service,
String endpoint)
serviceUnit - the service unitservice - the service nameendpoint - the endpoint name
public VFSPollingEndpoint(DefaultComponent component,
javax.jbi.servicedesc.ServiceEndpoint endpoint)
component - the default componentendpoint - the endpoint| Method Detail |
|---|
public void start()
throws Exception
start in interface Endpointstart in class PollingEndpointExceptionprotected LockManager createLockManager()
public String getLocationURI()
getLocationURI in class ConsumerEndpoint
public void process(javax.jbi.messaging.MessageExchange exchange)
throws Exception
process in interface Endpointprocess in class AbstractEndpointException
public void poll()
throws Exception
poll in class PollingEndpointException
protected void pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory)
throws Exception
fileOrDirectory - the file or folder object
Exception - on IO errors
protected void pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory,
boolean processDir)
throws Exception
fileOrDirectory - the file or folder objectprocessDir - flag if processing should act recursive
Exception - on IO errors
protected void pollFile(org.apache.commons.vfs.FileObject aFile)
throws Exception
aFile - the file object
Exception - on IO errorsprotected void processFileNow(org.apache.commons.vfs.FileObject aFile)
aFile - the file to process
protected void processFile(org.apache.commons.vfs.FileObject file)
throws Exception
file - the file to process
Exception - on processing errorspublic void setDeleteFile(boolean deleteFile)
true.
deleteFile - a boolean specifying if the file should be deletedpublic boolean isDeleteFile()
public void setLockManager(LockManager lockManager)
org.apache.servicemix.locks.LockManager interface. By
default, this will be set to an instances of
org.apache.servicemix.common.locks.impl.SimpleLockManager.
lockManager - the LockManager implementation to usepublic LockManager getLockManager()
public void setMarshaler(org.apache.servicemix.components.util.FileMarshaler marshaler)
FileMarshaler object that will marshal file data
into the NMR. The default file marshaller can read valid XML data.
FileMarshaler objects are implementations of
org.apache.servicemix.components.util.FileMarshaler.
marshaler - a FileMarshaler object that can read data
from the file system.public org.apache.servicemix.components.util.FileMarshaler getMarshaler()
public void setComparator(Comparator<org.apache.commons.vfs.FileObject> comparator)
Comparator object.
comparator - a Comparator object.public Comparator<org.apache.commons.vfs.FileObject> getComparator()
public void setSelector(org.apache.commons.vfs.FileSelector selector)
FileSelector object.
selector - a FileSelector objectpublic org.apache.commons.vfs.FileSelector getSelector()
public void setPath(String path)
String object representing the path of the
file/folder to be polled.http://commons.apache.org/vfs/filesystems.html.
path - a String object that represents a file/folder/vfspublic String getPath()
public void setFileSystemManager(org.apache.commons.vfs.FileSystemManager fileSystemManager)
fileSystemManager - the file system managerpublic org.apache.commons.vfs.FileSystemManager getFileSystemManager()
public Set<org.apache.commons.vfs.FileObject> getWorkingSet()
public boolean isRecursive()
public void setRecursive(boolean recursive)
recursive - The recursive to set.public boolean isConcurrentExchange()
public void setConcurrentExchange(boolean concurrentExchange)
concurrentExchange - the concurrentExchange to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||