com.continuent.tungsten.replicator.shard
Class ShardFilter

java.lang.Object
  extended by com.continuent.tungsten.replicator.shard.ShardFilter
All Implemented Interfaces:
Filter, ReplicatorPlugin

public class ShardFilter
extends java.lang.Object
implements Filter

Version:
1.0
Author:
Stephane Giron

Constructor Summary
ShardFilter()
           
 
Method Summary
 void configure(PluginContext context)
          Complete plug-in configuration.
 ReplDBMSEvent filter(ReplDBMSEvent event)
          Filter the event.
 void prepare(PluginContext context)
          Prepare plug-in for use.
 void release(PluginContext context)
          Release all resources used by plug-in.
 void setAllowWhitelisted(boolean allowWhitelisted)
          If true, we allow whitelisted shards in remote services.
 void setAutoCreate(boolean autoCreate)
          If true we auto-create shards when new shard appears.
 void setEnabled(boolean enabled)
          If true the shard is enabled.
 void setEnforceHome(boolean enforceHome)
          If true, we enforce shard homes in remote services.
 void setUnknownShardPolicy(java.lang.String policy)
          Defines policy for unknown shards.
 void setUnwantedShardPolicy(java.lang.String policy)
          Defines policy for unwanted shards.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShardFilter

public ShardFilter()
Method Detail

configure

public void configure(PluginContext context)
               throws ReplicatorException,
                      java.lang.InterruptedException
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
See Also:
ReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)

prepare

public void prepare(PluginContext context)
             throws ReplicatorException,
                    java.lang.InterruptedException
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
See Also:
ReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)

release

public void release(PluginContext context)
             throws ReplicatorException,
                    java.lang.InterruptedException
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
See Also:
ReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)

filter

public ReplDBMSEvent filter(ReplDBMSEvent event)
                     throws ReplicatorException,
                            java.lang.InterruptedException
Filter the event. Filters may transform the event or return null if the event should be discarded. Filters must be prepared to be interrupted, which mechanism is used to cancel processing.

Specified by:
filter in interface Filter
Parameters:
event - An event to be filtered
Returns:
Filtered ReplDBMSEvent or null
Throws:
ReplicatorException - Thrown if there is a processing error
java.lang.InterruptedException - Must be thrown if the filter is interrupted or the replicator may hang
See Also:
Filter.filter(com.continuent.tungsten.replicator.event.ReplDBMSEvent)

setEnabled

public void setEnabled(boolean enabled)
If true the shard is enabled.


setEnforceHome

public void setEnforceHome(boolean enforceHome)
If true, we enforce shard homes in remote services.


setAllowWhitelisted

public void setAllowWhitelisted(boolean allowWhitelisted)
If true, we allow whitelisted shards in remote services.


setAutoCreate

public void setAutoCreate(boolean autoCreate)
If true we auto-create shards when new shard appears.


setUnwantedShardPolicy

public void setUnwantedShardPolicy(java.lang.String policy)
Defines policy for unwanted shards.


setUnknownShardPolicy

public void setUnknownShardPolicy(java.lang.String policy)
Defines policy for unknown shards.