xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.replication.impl
Class DefaultMapper

java.lang.Object
  extended by org.xmlBlaster.contrib.replication.impl.DefaultMapper
All Implemented Interfaces:
I_ContribPlugin, I_Mapper
Direct Known Subclasses:
SearchableConfig

public class DefaultMapper
extends java.lang.Object
implements I_Mapper

DefaultMapper makes a one to one mapping unless for tables in which case it is read from the property 'replication.mapper.tables'. This property will follow the syntax: table1=tableOne,table2=tableTwo,... All tables not found the the configuration are mapped one to one.

Author:
Michele Laghi

Field Summary
protected  java.util.Map columnMap
           
protected  java.util.Map<java.lang.String,java.lang.String> excludeColumns
           
protected  java.util.Map schemaMap
           
protected  java.util.Map tableMap
           
 
Fields inherited from interface org.xmlBlaster.contrib.replication.I_Mapper
COLUMN_TO_IGNORE
 
Constructor Summary
DefaultMapper()
           
 
Method Summary
protected  void doInit(I_Info info, DbMetaHelper dbHelper)
           
 java.lang.String getMappedCatalog(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column, java.lang.String def)
          Returns the mapped catalog or null.
 java.lang.String getMappedColumn(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column, java.lang.String def)
          Gets the mapped column.
 java.lang.String getMappedSchema(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column, java.lang.String def)
          Table and column are ignored here.
 java.lang.String getMappedTable(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column, java.lang.String def)
          Columns are ignored here.
 java.lang.String getMappedType(java.lang.String catalog, java.lang.String Schema, java.lang.String table, java.lang.String column, java.lang.String type, java.lang.String def)
          This method is currently unused, and is here for future releases.
 java.util.Set getUsedPropertyKeys()
          Gets all property keys which may be used by this object.
 void init(I_Info info)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnMap

protected java.util.Map columnMap

tableMap

protected java.util.Map tableMap

schemaMap

protected java.util.Map schemaMap

excludeColumns

protected java.util.Map<java.lang.String,java.lang.String> excludeColumns
Constructor Detail

DefaultMapper

public DefaultMapper()
Method Detail

getMappedCatalog

public java.lang.String getMappedCatalog(java.lang.String catalog,
                                         java.lang.String schema,
                                         java.lang.String table,
                                         java.lang.String column,
                                         java.lang.String def)
Description copied from interface: I_Mapper
Returns the mapped catalog or null.

Specified by:
getMappedCatalog in interface I_Mapper
Parameters:
catalog - The catalog name of the source (the master catalog). Null is allowed and means unspecified.
schema - The schema name of the source (the master). Null is allowed and means unspecified.
table - The table name of the source. On null it is considered a default.
column - The column name of the source. On null it is considered a default.
def - the default value if no entry has been found.
Returns:
the catalog name of the destination (the slave catalog), or null which means that catalog info will not be used on the destination.

getMappedSchema

public java.lang.String getMappedSchema(java.lang.String catalog,
                                        java.lang.String schema,
                                        java.lang.String table,
                                        java.lang.String column,
                                        java.lang.String def)
Table and column are ignored here. Schema must be specified. If no schema, then null is returned.

Specified by:
getMappedSchema in interface I_Mapper
Parameters:
catalog - The catalog name of the source (the master). Null is allowed and means unspecified.
schema - The schema name of the source (the master). Null is allowed and means unspecified.
table - The table name of the source. On null it is considered a default.
column - The column name of the source. On null it is considered a default.
def - the default value if no entry has been found.
Returns:
the schema name of the destination (the slave), or null which means that schema info will not be used on the destination.

getMappedTable

public java.lang.String getMappedTable(java.lang.String catalog,
                                       java.lang.String schema,
                                       java.lang.String table,
                                       java.lang.String column,
                                       java.lang.String def)
Columns are ignored here.

Specified by:
getMappedTable in interface I_Mapper
Parameters:
catalog - The catalog name of the source (the master). Null is allowed and means unspecified.
schema - The schema name of the source (the master). Null is allowed and means unspecified.
table - The table name of the source. On null the behaviour is unspecified and implementation dependant.
column - The column name of the source. On null the behaviour is unspecified and implementation dependant.
def - the default value if no entry has been found.
Returns:
the table name to be used on the slave. If null it means that this table is not further processed.

getMappedColumn

public java.lang.String getMappedColumn(java.lang.String catalog,
                                        java.lang.String schema,
                                        java.lang.String table,
                                        java.lang.String column,
                                        java.lang.String def)
Description copied from interface: I_Mapper
Gets the mapped column.

Specified by:
getMappedColumn in interface I_Mapper
Parameters:
catalog - The catalog name of the source (the master). Null is allowed and means unspecified.
table - The table name of the source. On null the behaviour is unspecified and implementation dependant.
column - The column name of the source. On null the behaviour is unspecified and implementation dependant.
def - the default value if no entry has been found.
Returns:
the table name to be used on the slave. If null it means that this table is not further processed.

getMappedType

public java.lang.String getMappedType(java.lang.String catalog,
                                      java.lang.String Schema,
                                      java.lang.String table,
                                      java.lang.String column,
                                      java.lang.String type,
                                      java.lang.String def)
Description copied from interface: I_Mapper
This method is currently unused, and is here for future releases.

Specified by:
getMappedType in interface I_Mapper
Parameters:
catalog - The catalog name of the source (the master). Null is allowed and means unspecified.
table - The table name of the source. On null the behaviour is unspecified and implementation dependant.
column - The column name of the source. On null the behaviour is unspecified and implementation dependant.
def - the default value if no entry has been found.
Returns:

getUsedPropertyKeys

public java.util.Set getUsedPropertyKeys()
Description copied from interface: I_ContribPlugin
Gets all property keys which may be used by this object.

Specified by:
getUsedPropertyKeys in interface I_ContribPlugin
Returns:
See Also:
I_ContribPlugin.getUsedPropertyKeys()

init

public void init(I_Info info)
          throws java.lang.Exception
Specified by:
init in interface I_ContribPlugin
Throws:
java.lang.Exception

doInit

protected void doInit(I_Info info,
                      DbMetaHelper dbHelper)
               throws java.lang.Exception
Throws:
java.lang.Exception

shutdown

public void shutdown()
              throws java.lang.Exception
Specified by:
shutdown in interface I_ContribPlugin
Throws:
java.lang.Exception
See Also:
I_Plugin

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.