|
||||||||||
| 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,
javax.xml.namespace.QName service,
java.lang.String endpoint)
creates a VFS polling endpoint |
|
| Method Summary | |
|---|---|
protected LockManager |
createLockManager()
returns the lock manager |
java.util.Comparator<org.apache.commons.vfs.FileObject> |
getComparator()
|
org.apache.commons.vfs.FileSystemManager |
getFileSystemManager()
|
java.lang.String |
getLocationURI()
|
LockManager |
getLockManager()
|
org.apache.servicemix.components.util.FileMarshaler |
getMarshaler()
|
java.lang.String |
getPath()
|
org.apache.commons.vfs.FileSelector |
getSelector()
|
java.util.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(java.util.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(java.lang.String path)
Specifies a String object representing the path of the
file/folder to be polled.Examples: file:///home/lhein/pollFolder zip:file:///home/lhein/pollFolder/myFile.zip jar:http://www.myhost.com/files/Examples.jar jar:../lib/classes.jar!/META-INF/manifest.mf tar:gz:http://anyhost/dir/mytar.tar.gz!/mytar.tar!/path/in/tar/README.txt tgz:file://anyhost/dir/mytar.tgz!/somepath/somefile gz:/my/gz/file.gz http://myusername@somehost/index.html webdav://somehost:8080/dist ftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz sftp://myusername:mypassword@somehost/pub/downloads/somefile.tgz smb://somehost/home tmp://dir/somefile.txt res:path/in/classpath/image.png ram:///any/path/to/file.txt mime:file:///your/path/mail/anymail.mime!/filename.pdf For further details have a look at http://commons.apache.org/vfs/filesystems.html. |
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,
javax.xml.namespace.QName service,
java.lang.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 java.lang.Exception
start in interface Endpointstart in class PollingEndpointjava.lang.Exceptionprotected LockManager createLockManager()
public java.lang.String getLocationURI()
getLocationURI in class ConsumerEndpoint
public void process(javax.jbi.messaging.MessageExchange exchange)
throws java.lang.Exception
process in interface Endpointprocess in class AbstractEndpointjava.lang.Exception
public void poll()
throws java.lang.Exception
poll in class PollingEndpointjava.lang.Exception
protected void pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory)
throws java.lang.Exception
fileOrDirectory - the file or folder object
java.lang.Exception - on IO errors
protected void pollFileOrDirectory(org.apache.commons.vfs.FileObject fileOrDirectory,
boolean processDir)
throws java.lang.Exception
fileOrDirectory - the file or folder objectprocessDir - flag if processing should act recursive
java.lang.Exception - on IO errors
protected void pollFile(org.apache.commons.vfs.FileObject aFile)
throws java.lang.Exception
aFile - the file object
java.lang.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 java.lang.Exception
file - the file to process
java.lang.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(java.util.Comparator<org.apache.commons.vfs.FileObject> comparator)
Comparator object.
comparator - a Comparator object.public java.util.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(java.lang.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 java.lang.String getPath()
public void setFileSystemManager(org.apache.commons.vfs.FileSystemManager fileSystemManager)
fileSystemManager - the file system managerpublic org.apache.commons.vfs.FileSystemManager getFileSystemManager()
public java.util.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 | |||||||||