org.mmbase.storage.database
Class Support2Storage

java.lang.Object
  extended byorg.mmbase.module.database.support.BaseJdbc2Node
      extended byorg.mmbase.storage.database.Support2Storage
All Implemented Interfaces:
DatabaseStorage, MMJdbc2NodeInterface, SearchQueryHandler, Storage
Direct Known Subclasses:
AbstractDatabaseStorage

Deprecated. This code is scheduled for removal once MMBase has been fully converted to the new StorageManager implementation.

public abstract class Support2Storage
extends BaseJdbc2Node
implements DatabaseStorage, MMJdbc2NodeInterface

Support2Storage implements a number of methods that allow a DatabaseStorage class to also implement the MMJdbc2NodeInterface, for backward compatibility. This code may become deprecated in the future.

Since:
MMBase-1.6
Version:
$Id: Support2Storage.java,v 1.8 2004/01/27 12:04:47 pierre Exp $
Author:
Pierre van Rooden

Field Summary
 
Fields inherited from interface org.mmbase.storage.database.DatabaseStorage
KEY_FOREIGN, KEY_NONE, KEY_NOTNULL, KEY_PRIMARY, KEY_SECONDARY
 
Fields inherited from interface org.mmbase.storage.search.SearchQueryHandler
FEATURE_MAX_NUMBER, FEATURE_OFFSET, SUPPORT_NONE, SUPPORT_NORMAL, SUPPORT_OPTIMAL, SUPPORT_WEAK
 
Constructor Summary
protected Support2Storage()
          Deprecated. Constructs the Support2Storage database layer support class
 
Method Summary
 boolean commit(MMObjectBuilder builder, MMObjectNode node)
          Deprecated. use commit(org.mmbase.module.core.MMObjectNode)
abstract  boolean commit(MMObjectNode node)
          Deprecated. Commit this node to the specified builder.
abstract  int createKey()
          Deprecated. Gives an unique number for a node to be inserted.
abstract  boolean createObjectStorage()
          Deprecated. Create the object storage (the storage where to register all objects).
 boolean createObjectTable(java.lang.String baseName)
          Deprecated. use createObjectStorage()
 MMObjectNode decodeDBnodeField(MMObjectNode node, java.lang.String fieldName, java.sql.ResultSet rs, int i)
          Deprecated. use loadFieldFromTable(org.mmbase.module.core.MMObjectNode, java.lang.String, java.sql.ResultSet, int)
 MMObjectNode decodeDBnodeField(MMObjectNode node, java.lang.String fieldName, java.sql.ResultSet rs, int i, java.lang.String prefix)
          Deprecated. use loadFieldFromTable(org.mmbase.module.core.MMObjectNode, java.lang.String, java.sql.ResultSet, int)
abstract  boolean delete(MMObjectNode node)
          Deprecated. Delete a node
 java.lang.String getAllowedField(java.lang.String disallowedfield)
          Deprecated. use mapToTableFieldName(java.lang.String)
protected abstract  byte[] getBytes(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Utility method, defined in AbstractDatabaseStorage
 MultiConnection getConnection(JDBCInterface jdbc)
          Deprecated. Obsolete as the database should not connect to any other engine than the one loaded by the associated (known) MMBase instance. Use Storage.createTransaction() instead.
abstract  byte[] getDBByte(java.sql.ResultSet rs, int idx)
          Deprecated. Get byte of a database blob
 int getDBKey()
          Deprecated. use createKey()
abstract  java.lang.String getDBText(java.sql.ResultSet rs, int idx)
          Deprecated. Get text of a database blob
 java.lang.String getDisallowedField(java.lang.String allowedfield)
          Deprecated. use mapToMMBaseFieldName(java.lang.String)
protected abstract  java.lang.String getFullTableName(java.lang.String name)
          Deprecated. Utility method, defined in AbstractDatabaseStorage
 java.lang.String getMMNodeSearch2SQL(java.lang.String where, MMObjectBuilder builder)
          Deprecated. This is not supported by this database layer, and only included due to the interface requirements.
 java.lang.String getOTypeString()
          Deprecated. Maps the 'otype' fieldname to a fieldname acceptable to the database.
 java.lang.String getOwnerString()
          Deprecated. Maps the 'owner' fieldname to a fieldname acceptable to the database.
 byte[] getShortedByte(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. use /override getBytes(MMObjectNode, fieldname)
 java.lang.String getShortedText(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. use getText(MMObjectNode, fieldname);
abstract  boolean getStoreBinaryAsFile()
          Deprecated. Returns whether binary objects are stored as files (rather than in the database)
protected abstract  java.lang.String getText(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Utility method, defined in AbstractDatabaseStorage
 int insert(MMObjectBuilder builder, java.lang.String owner, MMObjectNode node)
          Deprecated. use insert(org.mmbase.module.core.MMObjectNode)
abstract  int insert(MMObjectNode node)
          Deprecated. This method inserts a new object, and registers the change.
abstract  void loadFieldFromTable(MMObjectNode node, java.lang.String fieldName, java.sql.ResultSet rs, int i)
          Deprecated. Stores a field in a table ResultSet in a MMObjectNode.
abstract  java.lang.String mapToMMBaseFieldName(java.lang.String allowedField)
          Deprecated. Maps a database fieldname to a fieldname as used by the MMbase system
abstract  java.lang.String mapToTableFieldName(java.lang.String disallowedField)
          Deprecated. Maps a MMBase fieldname to a fieldname acceptable to the database
protected abstract  byte[] readBytesFromFile(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Utility method, defined in SQL92DatabaseStorage
 void removeNode(MMObjectBuilder builder, MMObjectNode node)
          Deprecated. use delete(org.mmbase.module.core.MMObjectNode)
abstract  boolean updateStorage(MMObjectBuilder builder)
          Deprecated. Changes the storage of a builder to match its new configuration.
 boolean updateTable(MMObjectBuilder builder)
          Deprecated. use updateStorage(org.mmbase.module.core.MMObjectBuilder)
 
Methods inherited from class org.mmbase.module.database.support.BaseJdbc2Node
getNodes, getSupportLevel, getSupportLevel, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.storage.database.DatabaseStorage
getBinaryFilePath, getCreateExtendedScheme, getCreateScheme, getFieldNameMap, getForeignKeyScheme, getJDBC, getKeyScheme, getMaxDropSize, getNotNullScheme, getPrimaryKeyScheme, getTypeMap, init, registerChanged, setBinaryFilePath, setCreateExtendedScheme, setCreateScheme, setFieldNameMap, setForeignKeyScheme, setKeyScheme, setMaxDropSize, setNotNullScheme, setPrimaryKeyScheme, setStoreBinaryAsFile, setTypeMap, setValuePreparedStatement, supportsExtendedTables
 
Methods inherited from interface org.mmbase.storage.Storage
addField, changeField, commit, create, create, created, createKey, createObjectStorage, createTransaction, delete, drop, getBytes, getNode, getNode, getNodeType, getNodeType, getText, insert, isAllowedParentBuilder, registerParentBuilder, removeField, size, supportsRollback
 
Methods inherited from interface org.mmbase.storage.search.SearchQueryHandler
getNodes, getSupportLevel, getSupportLevel
 
Methods inherited from interface org.mmbase.module.database.support.MMJdbc2NodeInterface
addField, changeField, create, created, drop, getNumberString, init, isAllowedParentBuilder, registerParentBuilder, removeField, setDBByte
 

Constructor Detail

Support2Storage

protected Support2Storage()
Deprecated. 
Constructs the Support2Storage database layer support class

Method Detail

getFullTableName

protected abstract java.lang.String getFullTableName(java.lang.String name)
Deprecated. 
Utility method, defined in AbstractDatabaseStorage


getStoreBinaryAsFile

public abstract boolean getStoreBinaryAsFile()
Deprecated. 
Description copied from interface: DatabaseStorage
Returns whether binary objects are stored as files (rather than in the database)

Specified by:
getStoreBinaryAsFile in interface DatabaseStorage
Returns:
true if binary objects are stored as files

mapToMMBaseFieldName

public abstract java.lang.String mapToMMBaseFieldName(java.lang.String allowedField)
Deprecated. 
Description copied from interface: DatabaseStorage
Maps a database fieldname to a fieldname as used by the MMbase system

Specified by:
mapToMMBaseFieldName in interface DatabaseStorage

mapToTableFieldName

public abstract java.lang.String mapToTableFieldName(java.lang.String disallowedField)
Deprecated. 
Description copied from interface: DatabaseStorage
Maps a MMBase fieldname to a fieldname acceptable to the database

Specified by:
mapToTableFieldName in interface DatabaseStorage

loadFieldFromTable

public abstract void loadFieldFromTable(MMObjectNode node,
                                        java.lang.String fieldName,
                                        java.sql.ResultSet rs,
                                        int i)
Deprecated. 
Description copied from interface: DatabaseStorage
Stores a field in a table ResultSet in a MMObjectNode.

Specified by:
loadFieldFromTable in interface DatabaseStorage
Parameters:
node - the node to store the field in
rs - the ResultSet containing the table row
i - the index of the field in the ResultSet

getText

protected abstract java.lang.String getText(java.lang.String tableName,
                                            java.lang.String fieldName,
                                            int number)
Deprecated. 
Utility method, defined in AbstractDatabaseStorage


getBytes

protected abstract byte[] getBytes(java.lang.String tableName,
                                   java.lang.String fieldName,
                                   int number)
Deprecated. 
Utility method, defined in AbstractDatabaseStorage


readBytesFromFile

protected abstract byte[] readBytesFromFile(java.lang.String tableName,
                                            java.lang.String fieldName,
                                            int number)
Deprecated. 
Utility method, defined in SQL92DatabaseStorage


insert

public abstract int insert(MMObjectNode node)
Deprecated. 
Description copied from interface: Storage
This method inserts a new object, and registers the change. Only fields with states of DBSTATE_PERSISTENT or DBSTATE_SYSTEM are stored.

Specified by:
insert in interface Storage
Parameters:
node - The node to insert
Returns:
The (new) number for this node, or -1 if an error occurs.

commit

public abstract boolean commit(MMObjectNode node)
Deprecated. 
Description copied from interface: Storage
Commit this node to the specified builder.

Specified by:
commit in interface Storage
Parameters:
node - The node to commit
Returns:
true of succesful, false otherwise

delete

public abstract boolean delete(MMObjectNode node)
Deprecated. 
Description copied from interface: Storage
Delete a node

Specified by:
delete in interface Storage
Parameters:
node - The node to delete
Returns:
true if succesful

createObjectStorage

public abstract boolean createObjectStorage()
Deprecated. 
Description copied from interface: Storage
Create the object storage (the storage where to register all objects).

Specified by:
createObjectStorage in interface Storage
Returns:
true if the storage was succesfully created

createKey

public abstract int createKey()
Deprecated. 
Description copied from interface: Storage
Gives an unique number for a node to be inserted. This method should work with multiple mmbases

Specified by:
createKey in interface Storage
Returns:
unique number

updateStorage

public abstract boolean updateStorage(MMObjectBuilder builder)
Deprecated. 
Description copied from interface: Storage
Changes the storage of a builder to match its new configuration.

Specified by:
updateStorage in interface Storage
Parameters:
builder - the builder whose storage to change
Returns:
true if succesful

getDisallowedField

public java.lang.String getDisallowedField(java.lang.String allowedfield)
Deprecated. use mapToMMBaseFieldName(java.lang.String)

Maps a MMBase fieldname to a fieldname acceptable to the database.

Specified by:
getDisallowedField in interface MMJdbc2NodeInterface

getAllowedField

public java.lang.String getAllowedField(java.lang.String disallowedfield)
Deprecated. use mapToTableFieldName(java.lang.String)

Maps a database fieldname to a fieldname as used by the MMbase system.

Specified by:
getAllowedField in interface MMJdbc2NodeInterface

getOTypeString

public java.lang.String getOTypeString()
Deprecated. 
Maps the 'otype' fieldname to a fieldname acceptable to the database.

Specified by:
getOTypeString in interface MMJdbc2NodeInterface

getOwnerString

public java.lang.String getOwnerString()
Deprecated. 
Maps the 'owner' fieldname to a fieldname acceptable to the database.

Specified by:
getOwnerString in interface MMJdbc2NodeInterface

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldName,
                                      java.sql.ResultSet rs,
                                      int i)
Deprecated. use loadFieldFromTable(org.mmbase.module.core.MMObjectNode, java.lang.String, java.sql.ResultSet, int)

Stores a field in a table ResultSet in a MMObjectNode.

Specified by:
decodeDBnodeField in interface MMJdbc2NodeInterface
Parameters:
node - the node to store the field in
rs - the ResultSet containing the table row
i - the index of the field in the ResultSet
fieldName - The name of the field which must be set. This is expected to be the field as used by the database, not the field as used by MMBase.
Returns:
the MMObjectNode
See Also:
loadFieldFromTable(MMObjectNode,String, ResultSet,int)

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldName,
                                      java.sql.ResultSet rs,
                                      int i,
                                      java.lang.String prefix)
Deprecated. use loadFieldFromTable(org.mmbase.module.core.MMObjectNode, java.lang.String, java.sql.ResultSet, int)

Stores a field in a table ResultSet in a MMObjectNode.

Specified by:
decodeDBnodeField in interface MMJdbc2NodeInterface
Parameters:
node - the node to store the field in
rs - the ResultSet containing the table row
i - the index of the field in the ResultSet
prefix - a prefix to use when determining the node's fieldname. used for clusternodes
Returns:
the MMObjectNode
See Also:
MMJdbc2NodeInterface.decodeDBnodeField(MMObjectNode, String, ResultSet, int)

getMMNodeSearch2SQL

public java.lang.String getMMNodeSearch2SQL(java.lang.String where,
                                            MMObjectBuilder builder)
Deprecated. This is not supported by this database layer, and only included due to the interface requirements.

Converts a SCAN NODE syntax to SQL.

Specified by:
getMMNodeSearch2SQL in interface MMJdbc2NodeInterface
Parameters:
where - The MMNODE expression.
builder - The builder for the type of nodes that is queried.
Returns:
The SQL expression.
See Also:
MMObjectBuilder.convertMMNode2SQL(String)

getShortedText

public final java.lang.String getShortedText(java.lang.String tableName,
                                             java.lang.String fieldName,
                                             int number)
Deprecated. use getText(MMObjectNode, fieldname);

Get text from blob

Specified by:
getShortedText in interface MMJdbc2NodeInterface
Warning: No Java Documentation Available.

getShortedByte

public final byte[] getShortedByte(java.lang.String tableName,
                                   java.lang.String fieldName,
                                   int number)
Deprecated. use /override getBytes(MMObjectNode, fieldname)

Get byte of a database blob. It is unclear why this function is called 'getShorted..'. This function is final because if you extend Support2Storage, you should override storage interface functions, not support functions.

Specified by:
getShortedByte in interface MMJdbc2NodeInterface

getConnection

public MultiConnection getConnection(JDBCInterface jdbc)
                              throws java.sql.SQLException
Deprecated. Obsolete as the database should not connect to any other engine than the one loaded by the associated (known) MMBase instance. Use Storage.createTransaction() instead.

Obtain a connection to the database using the passed JDBC engine.

Specified by:
getConnection in interface MMJdbc2NodeInterface
Parameters:
jdbc - the JDBC engineto use
Throws:
java.sql.SQLException - if the connection could not be made

insert

public int insert(MMObjectBuilder builder,
                  java.lang.String owner,
                  MMObjectNode node)
Deprecated. use insert(org.mmbase.module.core.MMObjectNode)

This method inserts a new object in a specified builder table. Only fields with states of DBSTATE_PERSISTENT or DBSTATE_SYSTEM are stored in the database tables.

Specified by:
insert in interface MMJdbc2NodeInterface
Parameters:
owner - The nodes' owner. Ignored
node - The node to insert
Returns:
The (new) number for this node, or -1 if an error occurs.

commit

public boolean commit(MMObjectBuilder builder,
                      MMObjectNode node)
Deprecated. use commit(org.mmbase.module.core.MMObjectNode)

Commit this node to the specified builder table.

Specified by:
commit in interface MMJdbc2NodeInterface
Parameters:
builder - the builder to commit the node to. This can be a parentbuilder of the node's actual builder
node - The node to commit
Returns:
true of succesful, false otherwise

removeNode

public void removeNode(MMObjectBuilder builder,
                       MMObjectNode node)
Deprecated. use delete(org.mmbase.module.core.MMObjectNode)

Remove a node from the specified builder table.

Specified by:
removeNode in interface MMJdbc2NodeInterface
Parameters:
builder - the builder to remove the node from. This can be a parentbuilder of the node's actual builder
node - The node to delete

createObjectTable

public boolean createObjectTable(java.lang.String baseName)
Deprecated. use createObjectStorage()

Create the object table (the basic table for all objects) for the specified basename.

Specified by:
createObjectTable in interface MMJdbc2NodeInterface
Parameters:
baseName - the basename of the table to create. This parameter is already known and is ignored.
Returns:
true if the table was succesfully created

getDBKey

public int getDBKey()
Deprecated. use createKey()

Gives an unique number for a node to be inserted. This method will work with multiple mmbases

Specified by:
getDBKey in interface MMJdbc2NodeInterface
Returns:
unique number

updateTable

public boolean updateTable(MMObjectBuilder builder)
Deprecated. use updateStorage(org.mmbase.module.core.MMObjectBuilder)

Changes the table of a builder to match its new configuration.

Specified by:
updateTable in interface MMJdbc2NodeInterface
Parameters:
builder - the builder whose table to change
Returns:
true if succesful

getDBByte

public abstract byte[] getDBByte(java.sql.ResultSet rs,
                                 int idx)
Deprecated. 
Get byte of a database blob

Specified by:
getDBByte in interface MMJdbc2NodeInterface
Warning: No Java Documentation Available.

getDBText

public abstract java.lang.String getDBText(java.sql.ResultSet rs,
                                           int idx)
Deprecated. 
Get text of a database blob

Specified by:
getDBText in interface MMJdbc2NodeInterface
Warning: No Java Documentation Available.


MMBase build 1.7.4.20050922