public class FileTask extends SenderTask
FileTask
implements tasks for cyclic retrieving stanzas from
a directory and sending them to the StanzaHandler object.
It looks for any new stanza to send. Any single file can contain only single
stanza to send and any entry in database table can also contain only single
stanza to send. File on hard disk and record in database is deleted after
it is read.
Any file in given directory is treated the same way - Tigase assumes it contains valid XML data with XMPP stanza to send. You can however set in configuration, using wildchars which files contain stanzas. All stanzas must contain complete data including correct "from" and "to" attributes.
By default it looks for *.stanza
files in
/var/spool/jabber/
folder but you can specify different
directory name in initialization string. Sample initialization strings:
/var/spool/jabber/*.stanza
/var/spool/jabber/*
The last is equal to:
/var/spool/jabber/
Note the last forward slash '/' is required in such case if the last element of the path is a directory.
Please note! Tigase must have writing permissions for this directory, otherwise it may not function properly.
Created: Fri Apr 20 12:10:55 2007
Constructor and Description |
---|
FileTask() |
Modifier and Type | Method and Description |
---|---|
String |
getInitString()
getInitString method returns initialization string passed
to it in init() method. |
void |
init(StanzaHandler handler,
String initString)
init method is a task specific initialization rountine. |
void |
run()
run method is where all task work is done. |
getName, setName
cancel, scheduledExecutionTime
public void init(StanzaHandler handler, String initString) throws IOException
init
method is a task specific initialization rountine.init
in class SenderTask
handler
- a StanzaHandler
value is a reference to object
which handles all stanza retrieved from data source. The handler is
responsible for delivering stanza to destination address.initString
- a String
value is an initialization string
for this task. For example database tasks would expect database connection
string here, filesystem task would expect directory here.IOException
- if an error occurs during task or data storage
initialization.public String getInitString()
getInitString
method returns initialization string passed
to it in init()
method.getInitString
in class SenderTask
String
value of initialization string.Copyright © 2014 "Tigase, Inc.". All rights reserved.