tigase.server.ssender

## Class JDBCTask

- java.lang.Object
- - java.util.TimerTask
  - - tigase.server.ssender.SenderTask
    - - tigase.server.ssender.JDBCTask

- All Implemented Interfaces:
    Runnable

      public class JDBCTask
      extends SenderTask

  `JDBCTask` implements tasks for cyclic retrieving stanzas from database and sending them to the StanzaHandler object.

  Database table format:

  - id - numerical unique record indetifier.
  - stanza - text field containing valid XML data with XMPP stanza to send.
  Any record in this table is treated the same way - Tigase assmes it contains valid XML data with XMPP stanza to send. No other data are allowed in this table. All stanzas must be complete including correct "from" and "to" attriutes.

  By default it looks for stanzas in `xmpp_stanza` table but you can specify different table name in connection string. Sample connection string:

      jdbc:mysql://localhost/tigasedb?user=tigase&password=pass&table=xmpp_stanza

  Created: Fri Apr 20 12:10:55 2007

  Version:
    $Rev$
  Author:
    Artur Hefczyc

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JDBCTask()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancel()`
    `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.

    - ### Methods inherited from class tigase.server.ssender.SenderTask

      `getName, setName`

    - ### Methods inherited from class java.util.TimerTask

      `scheduledExecutionTime`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JDBCTask

          public JDBCTask()

  - ### Method Detail

    - #### init

          public void init(StanzaHandler handler,
                  String initString)
                    throws IOException

      `init` method is a task specific initialization rountine.
      Specified by:
        `init` in class `SenderTask`
      Parameters:
        `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.
      Throws:
        `IOException` - if an error occurs during task or data storage initialization.

    - #### getInitString

          public String getInitString()

      `getInitString` method returns initialization string passed to it in `init()` method.
      Specified by:
        `getInitString` in class `SenderTask`
      Returns:
        a `String` value of initialization string.

    - #### cancel

          public boolean cancel()

      Overrides:
        `cancel` in class `TimerTask`

    - #### run

          public void run()

      `run` method is where all task work is done.
      Specified by:
        `run` in interface `Runnable`
      Specified by:
        `run` in class `TimerTask`

Copyright © 2013 Tigase. All rights reserved.