common-util

local.tomas.common.xml
Class XMLSqlStore

java.lang.Object
  extended by local.tomas.common.xml.XMLSqlStore
Direct Known Subclasses:
SqlStoreImpl

public abstract class XMLSqlStore
extends Object

Use this class to store and retrieve XML in a database.

Author:
tomas

Field Summary
static int ID_FIELD
          Name of ID column in table.
static int SEQUENCE_FIELD
          Name of sequence column in table.
static int TABLE_NAME
           
static int TYPE_FIELD
          Name of type column in table.
static int VALUE_FIELD
          Name of value column in table.
 
Constructor Summary
protected XMLSqlStore()
           
 
Method Summary
static XMLSqlStore createStore(Connection conn)
          Create an SQL store for a database connection.
abstract  void deleteXml(int id)
          Delete an XML structure from the database.
abstract  int getBatchSize()
          Get batch size for inserts.
abstract  String getField(int id)
          Get database table or column name.
abstract  int getMaxValueSize()
          Get the maximum number of characters used to store values in the value column of the database.
abstract  Result getResult(int id)
          Get XML transformation result to store an XML structure in the database.
abstract  Source getSource(int id)
          Get XML transformation source to retrieve an XML structure from the database.
abstract  void setBatchSize(int size)
          Set batch size for inserts.
abstract  void setField(int id, String value)
          Define database table or column name.
abstract  void setMaxValueSize(int size)
          Set the maximum number of characters used to store values in the value column of the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final int TABLE_NAME
See Also:
Constant Field Values

ID_FIELD

public static final int ID_FIELD
Name of ID column in table. Data type is integer. Defaults to xml_id.

See Also:
Constant Field Values

SEQUENCE_FIELD

public static final int SEQUENCE_FIELD
Name of sequence column in table. Data type is integer. Defaults to xml_seq.

See Also:
Constant Field Values

TYPE_FIELD

public static final int TYPE_FIELD
Name of type column in table. Data type is CHAR(3) or VARCHAR(3). Defaults to xml_type.

See Also:
Constant Field Values

VALUE_FIELD

public static final int VALUE_FIELD
Name of value column in table. Data type is VARCHAR. Size of this field must be at least getMaxValueSize() (default 128).

See Also:
Constant Field Values
Constructor Detail

XMLSqlStore

protected XMLSqlStore()
Method Detail

createStore

public static XMLSqlStore createStore(Connection conn)
Create an SQL store for a database connection.

Parameters:
conn - - the database connection
Returns:
the store

setField

public abstract void setField(int id,
                              String value)
Define database table or column name.

Parameters:
id - - used to identify the column. See the constants of this class.
value - - new name.

getField

public abstract String getField(int id)
Get database table or column name.

Parameters:
id - - used to identify the column. See the constants of this class.
Returns:
- the current name.

setMaxValueSize

public abstract void setMaxValueSize(int size)
Set the maximum number of characters used to store values in the value column of the database.

Parameters:
size - - number of characters

getMaxValueSize

public abstract int getMaxValueSize()
Get the maximum number of characters used to store values in the value column of the database.

Returns:
the number of characters

getBatchSize

public abstract int getBatchSize()
Get batch size for inserts.

Returns:
batch size

setBatchSize

public abstract void setBatchSize(int size)
Set batch size for inserts.

Parameters:
size - batch size

getSource

public abstract Source getSource(int id)
                          throws XMLException
Get XML transformation source to retrieve an XML structure from the database.

Parameters:
id - - unique identifier of XML structure in the database
Returns:
transformation source
Throws:
XMLException

getResult

public abstract Result getResult(int id)
                          throws XMLException
Get XML transformation result to store an XML structure in the database.

Parameters:
id - - unique identifier of XML strucure in the database
Returns:
transformation result
Throws:
XMLException

deleteXml

public abstract void deleteXml(int id)
                        throws XMLException
Delete an XML structure from the database.

Parameters:
id - - unique identifier of XML structure in the database.
Throws:
XMLException

common-util

Copyright © 2007 null. All Rights Reserved.