xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.dbwriter.info
Class SqlDescription

java.lang.Object
  extended by org.xmlBlaster.contrib.dbwriter.info.SqlDescription

public class SqlDescription
extends java.lang.Object

This info object is mainly used for two purposes: the one is the parsed object returned by each message. The other is as an info object for each table in the replication (hold in cache to contain meta information of the table on which to perform the operations (either INSERT, UPDATE or DELETE).

Author:
Michele Laghi

Field Summary
static java.lang.String COMMAND_TAG
           
static java.lang.String DESC_TAG
           
static java.lang.String IDENT_TAG
           
static java.lang.String ME
           
 
Constructor Summary
SqlDescription(I_Info info)
           
 
Method Summary
 void addAttributes(java.util.Map map)
          It copies (stores) all entries found in the map into the attributes.
 void addColumn(SqlColumn column)
           
 void clearColumnDescriptions()
           
 int delete(java.sql.Connection conn, SqlRow row)
          Returns the number of entries deleted
 org.xmlBlaster.util.qos.ClientProperty getAttribute(java.lang.String key)
          Returns the requested attribute.
 java.lang.String[] getAttributeNames()
           
 java.util.Map getAttributesClone()
           
 java.lang.String getCatalog()
          Gets the name of the schema.
 SqlColumn getColumn(java.lang.String colName)
           
 SqlColumn getColumnAtPosition(int pos)
          Gets the column at position given by pos.
 SqlColumn[] getColumns()
           
 java.lang.String getCommand()
           
 java.lang.String getCompleteTableName()
           
static java.lang.String getDifferences(SqlDescription description1, SqlDescription description2)
           
 java.lang.String getIdentity()
           
 int getNumOfColumns()
           
 java.lang.String getSchema()
          Gets the name of the schema.
 int insert(java.sql.Connection conn, SqlRow row)
          Returns the number of entries inserted
 boolean isColumnSearchConfigured(java.lang.String column)
           
static void main(java.lang.String[] args)
           
 void setAttribute(org.xmlBlaster.util.qos.ClientProperty value)
          Stores the client property as a new value.
 void setAttribute(java.lang.String key, java.lang.String value)
          Stores the String as a new value.
 void setCommand(java.lang.String command)
           
 void setIdentity(java.lang.String identity)
           
 java.lang.String toXml(java.lang.String extraOffset)
           
 int update(java.sql.Connection conn, SqlRow newRow, I_Parser parserForOld)
          Returns the number of entries updated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ME

public static final java.lang.String ME
See Also:
Constant Field Values

DESC_TAG

public static final java.lang.String DESC_TAG
See Also:
Constant Field Values

IDENT_TAG

public static final java.lang.String IDENT_TAG
See Also:
Constant Field Values

COMMAND_TAG

public static final java.lang.String COMMAND_TAG
See Also:
Constant Field Values
Constructor Detail

SqlDescription

public SqlDescription(I_Info info)
Method Detail

getSchema

public java.lang.String getSchema()
Gets the name of the schema. Since this information is not contained in the object iself but in the Column information (since views could be a combination of more than one schema or catalog), this method checks that the schema is the same for all columns. If it is different, or if it is not assigned, then null is returned.

Returns:

getCompleteTableName

public java.lang.String getCompleteTableName()

getCatalog

public java.lang.String getCatalog()
Gets the name of the schema. Since this information is not contained in the object iself but in the Column information (since views could be a combination of more than one schema or catalog), this method checks that the catalog is the same for all columns. If it is different, or if it is not assigned, then null is returned.

Returns:

getAttributeNames

public java.lang.String[] getAttributeNames()

clearColumnDescriptions

public void clearColumnDescriptions()

getAttributesClone

public java.util.Map getAttributesClone()

getAttribute

public org.xmlBlaster.util.qos.ClientProperty getAttribute(java.lang.String key)
Returns the requested attribute. If 'caseSensitive' has been set, the characters of the key are compared case sensitively. If it is set to false, then it first searches for the case sensitive match, if nothing is found it looks for the lowercase of the key, and finally if still no match it looks for the uppercase alternative. If none of these is found, null is returned.

Parameters:
key - the key of the attribute
Returns:
the ClientProperty object associated with the key, or if none found, null is returned.

setAttribute

public void setAttribute(org.xmlBlaster.util.qos.ClientProperty value)
Stores the client property as a new value.

Parameters:
value - the value to store as an attribute.

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Stores the String as a new value. The passed String is directly transformed into a ClientProperty object.

Parameters:
value - the value to store as an attribute.

addAttributes

public void addAttributes(java.util.Map map)
It copies (stores) all entries found in the map into the attributes. As values only String and ClientProperty objects are allowed. If another type is found, an IllegalArgumentException is thrown. If null is passed, nothing is done.

Parameters:
map -

update

public int update(java.sql.Connection conn,
                  SqlRow newRow,
                  I_Parser parserForOld)
           throws java.lang.Exception
Returns the number of entries updated

Parameters:
conn -
row -
Returns:
Throws:
java.lang.Exception

delete

public int delete(java.sql.Connection conn,
                  SqlRow row)
           throws java.lang.Exception
Returns the number of entries deleted

Parameters:
conn -
row -
Returns:
Throws:
java.lang.Exception

insert

public int insert(java.sql.Connection conn,
                  SqlRow row)
           throws java.lang.Exception
Returns the number of entries inserted

Parameters:
conn -
row -
Returns:
Throws:
java.lang.Exception

getCommand

public java.lang.String getCommand()

setCommand

public void setCommand(java.lang.String command)

getIdentity

public java.lang.String getIdentity()

setIdentity

public void setIdentity(java.lang.String identity)

addColumn

public void addColumn(SqlColumn column)

getColumns

public SqlColumn[] getColumns()

getColumn

public SqlColumn getColumn(java.lang.String colName)

getNumOfColumns

public int getNumOfColumns()

getColumnAtPosition

public SqlColumn getColumnAtPosition(int pos)
Gets the column at position given by pos. Note that the first position is 1 (not 0).

Parameters:
pos -
Returns:
Throws:
java.lang.IllegalArgumentException - if the number is less than 1 or bigger than the size of the list or if for some reason the entry has not been found.

toXml

public java.lang.String toXml(java.lang.String extraOffset)

getDifferences

public static java.lang.String getDifferences(SqlDescription description1,
                                              SqlDescription description2)

main

public static void main(java.lang.String[] args)

isColumnSearchConfigured

public boolean isColumnSearchConfigured(java.lang.String column)
Parameters:
column - the name of the column to check or null if a global check for the table.
Returns:
true if the specified column is configured as searchable false otherwise. If you passed null as the column name, then true is returned if at least one column is searchable, false otherwise.

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.