|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.filter.EnumToStringFilter
public class EnumToStringFilter
EnumToStringFilter transforms enum data type values to corresponding string
representation as follows:
1. On each event it checks whether targeted table has enum data type column.
2. If it does, corresponding enum column values of the event are mapped from
integer into string representations.
The filter is to be used with row replication.
Filter takes an optional parameter for performance tuning. Instead of
checking all the tables you may define only a specific comma-delimited list
in process_tables_schemas parameter. Eg.:
replicator.filter.enumtostringfilter.process_tables_schemas=myschema.mytable1,myschema.mytable2
| Constructor Summary | |
|---|---|
EnumToStringFilter()
|
|
| Method Summary | |
|---|---|
protected void |
checkForListType(OneRowChange orc)
Checks for ENUM columns in the event. |
protected void |
checkForListType(OneRowChange orc,
java.lang.String type)
Checks for ENUM/SET type columns in the event. |
void |
configure(PluginContext context)
Complete plug-in configuration. |
ReplDBMSEvent |
filter(ReplDBMSEvent event)
Filter the event. |
static int |
largestElement(java.lang.String[] enumValues)
|
static int |
largestElementLen(java.lang.String enumDefinition)
|
static int |
largestElementLen(java.lang.String[] enumValues)
Returns how long is the largest element of enumeration. |
static java.lang.String[] |
parseEnumeration(java.lang.String enumDefinition)
Parses MySQL enum type definition statement. |
static java.lang.String[] |
parseListDefString(java.lang.String colType,
java.lang.String definition)
Parses strings of the following form: enum('val1','val2',...) set('val1','val2',...) |
protected java.lang.String[] |
parseListType(java.lang.String listTypeDefinition)
|
void |
prepare(PluginContext context)
Prepare plug-in for use. |
void |
release(PluginContext context)
Release all resources used by plug-in. |
void |
setPassword(java.lang.String password)
|
void |
setProcessTablesSchemas(java.lang.String processTablesSchemas)
|
void |
setUrl(java.lang.String url)
|
void |
setUser(java.lang.String user)
|
protected void |
transformColumns(java.util.ArrayList<OneRowChange.ColumnSpec> columns,
java.util.ArrayList<java.util.ArrayList<OneRowChange.ColumnVal>> columnValues,
java.util.HashMap<java.lang.Integer,java.lang.String[]> enumDefinitions,
java.lang.String typeCaption)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EnumToStringFilter()
| Method Detail |
|---|
public void configure(PluginContext context)
throws ReplicatorException
configure in interface ReplicatorPluginReplicatorException - Thrown if configuration is incomplete or
failsReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)
public void prepare(PluginContext context)
throws ReplicatorException
prepare in interface ReplicatorPluginReplicatorException - Thrown if resource allocation failsReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)
public void release(PluginContext context)
throws ReplicatorException
release in interface ReplicatorPluginReplicatorException - Thrown if resource deallocation failsReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)
public ReplDBMSEvent filter(ReplDBMSEvent event)
throws ReplicatorException,
java.lang.InterruptedException
filter in interface Filterevent - An event to be filtered
ReplicatorException - Thrown if there is a processing error
java.lang.InterruptedException - Must be thrown if the filter is interrupted
or the replicator may hangFilter.filter(com.continuent.tungsten.replicator.event.ReplDBMSEvent)protected java.lang.String[] parseListType(java.lang.String listTypeDefinition)
public static java.lang.String[] parseEnumeration(java.lang.String enumDefinition)
enumDefinition - String of the following form:
enum('val1','val2',...)
public static java.lang.String[] parseListDefString(java.lang.String colType,
java.lang.String definition)
colType - "enum" or "string"definition - String like "enum('val1','val2',...)" or
"set('val1','val2',...)".
public static int largestElementLen(java.lang.String enumDefinition)
enumDefinition - String of the following form:
enum('val1','val2',...)
largestElement(String[])public static int largestElementLen(java.lang.String[] enumValues)
enumValues - Values of enumeration. Eg.: 'No','Yes'
public static int largestElement(java.lang.String[] enumValues)
protected void checkForListType(OneRowChange orc)
throws java.sql.SQLException,
ReplicatorException
orc -
java.sql.SQLException
ReplicatorException
protected void checkForListType(OneRowChange orc,
java.lang.String type)
throws java.sql.SQLException,
ReplicatorException
type - "ENUM" or "SET".
java.sql.SQLException
ReplicatorException
protected void transformColumns(java.util.ArrayList<OneRowChange.ColumnSpec> columns,
java.util.ArrayList<java.util.ArrayList<OneRowChange.ColumnVal>> columnValues,
java.util.HashMap<java.lang.Integer,java.lang.String[]> enumDefinitions,
java.lang.String typeCaption)
throws ReplicatorException
ReplicatorExceptionpublic void setUser(java.lang.String user)
public void setUrl(java.lang.String url)
public void setPassword(java.lang.String password)
public void setProcessTablesSchemas(java.lang.String processTablesSchemas)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||