com.continuent.tungsten.replicator.thl
Class Connector

java.lang.Object
  extended by com.continuent.tungsten.replicator.thl.Connector
All Implemented Interfaces:
ReplicatorPlugin

public class Connector
extends java.lang.Object
implements ReplicatorPlugin

This class defines a Connector

Version:
1.0
Author:
Teemu Ollakka

Field Summary
protected  int heartbeatMillis
           
protected  java.lang.String host
           
protected  long lastEpochNumber
           
protected  java.lang.String lastEventId
           
protected  long lastSeqno
           
protected  PluginContext pluginContext
           
protected  int port
           
protected  int resetPeriod
           
protected  boolean useSSL
           
 
Constructor Summary
Connector()
          Creates a new instance.
Connector(PluginContext context, java.lang.String remoteURI, int resetPeriod, long lastSeqno, long lastEpochNumber, int heartbeatMillis)
          Creates a new Connector object Creates a new Connector object
 
Method Summary
 void close()
          Close channel.
 void configure(PluginContext context)
          Complete plug-in configuration.
 void connect()
          TODO: connect definition.
 long getMaxSeqNo()
          Return maximum sequence number stored on server.
 long getMinSeqNo()
          Return minimum sequence number stored on server.
 java.lang.String getServerCapability(java.lang.String name)
          Return server capability by name.
 void prepare(PluginContext context)
          Prepare plug-in for use.
 void release(PluginContext context)
          Release all resources used by plug-in.
 ReplEvent requestEvent(long seqNo)
          Fetch an event from server.
 void setHeartbeatMillis(int heartbeatMillis)
          Sets the number of milliseconds between heartbeats.
 void setLastEpochNumber(long lastEpochNumber)
          Sets the lastEpochNumber value.
 void setLastEventId(java.lang.String lastEventId)
           
 void setLastSeqno(long lastSeqno)
          Sets the lastSeqno value.
 void setResetPeriod(int resetPeriod)
          Sets the resetPeriod value.
 void setURI(java.lang.String connectUri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pluginContext

protected PluginContext pluginContext

host

protected java.lang.String host

port

protected int port

useSSL

protected boolean useSSL

resetPeriod

protected int resetPeriod

lastSeqno

protected long lastSeqno

lastEpochNumber

protected long lastEpochNumber

heartbeatMillis

protected int heartbeatMillis

lastEventId

protected java.lang.String lastEventId
Constructor Detail

Connector

public Connector()
Creates a new instance. This is required so the connector can be instantiated as a replicator plugin.


Connector

public Connector(PluginContext context,
                 java.lang.String remoteURI,
                 int resetPeriod,
                 long lastSeqno,
                 long lastEpochNumber,
                 int heartbeatMillis)
          throws ReplicatorException
Creates a new Connector object Creates a new Connector object

Parameters:
remoteURI - URI string pointing to remote host
resetPeriod - output stream resetting period
Throws:
ReplicatorException
Method Detail

connect

public void connect()
             throws ReplicatorException,
                    java.io.IOException
TODO: connect definition.

Throws:
ReplicatorException
java.io.IOException

close

public void close()
Close channel. This is synchronized to prevent accidental double calls.


requestEvent

public ReplEvent requestEvent(long seqNo)
                       throws ReplicatorException,
                              java.io.IOException
Fetch an event from server.

Parameters:
seqNo -
Returns:
ReplEvent
Throws:
ReplicatorException
java.io.IOException

getServerCapability

public java.lang.String getServerCapability(java.lang.String name)
Return server capability by name.


getMinSeqNo

public long getMinSeqNo()
Return minimum sequence number stored on server.


getMaxSeqNo

public long getMaxSeqNo()
Return maximum sequence number stored on server.


configure

public void configure(PluginContext context)
               throws ReplicatorException,
                      java.lang.InterruptedException
Description copied from interface: ReplicatorPlugin
Complete plug-in configuration. This is called after setters are invoked at the time that the replicator goes through configuration.

Specified by:
configure in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if configuration is incomplete or fails
java.lang.InterruptedException

prepare

public void prepare(PluginContext context)
             throws ReplicatorException,
                    java.lang.InterruptedException
Description copied from interface: ReplicatorPlugin
Prepare plug-in for use. This method is assumed to allocate all required resources. It is called before the plug-in performs any operations.

Specified by:
prepare in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if resource allocation fails
java.lang.InterruptedException

release

public void release(PluginContext context)
             throws ReplicatorException,
                    java.lang.InterruptedException
Description copied from interface: ReplicatorPlugin
Release all resources used by plug-in. This is called before the plug-in is deallocated.

Specified by:
release in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if resource deallocation fails
java.lang.InterruptedException

setResetPeriod

public void setResetPeriod(int resetPeriod)
Sets the resetPeriod value.

Parameters:
resetPeriod - The resetPeriod to set.

setLastSeqno

public void setLastSeqno(long lastSeqno)
Sets the lastSeqno value.

Parameters:
lastSeqno - The lastSeqno to set.

setLastEpochNumber

public void setLastEpochNumber(long lastEpochNumber)
Sets the lastEpochNumber value.

Parameters:
lastEpochNumber - The lastEpochNumber to set.

setURI

public void setURI(java.lang.String connectUri)

setHeartbeatMillis

public void setHeartbeatMillis(int heartbeatMillis)
Sets the number of milliseconds between heartbeats.


setLastEventId

public void setLastEventId(java.lang.String lastEventId)