|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Storage interface for use with a database. This interface adds two type of methods. The first are methods used to configure the database, or to store the current configuration, either by using a Document or through seperate calls. The second methods are used as callback methods by a DatabaseTransaction object, to handle specific database dependent routines, such as storing binary objects.
| Field Summary | |
static int |
KEY_FOREIGN
Indicates a field is a foreign key |
static int |
KEY_NONE
Indicates a field is not a key, and nullable |
static int |
KEY_NOTNULL
Indicates a field is not a key, and not nullable |
static int |
KEY_PRIMARY
Indicates a field is a primary key |
static int |
KEY_SECONDARY
Indicates a field is a unique secondary key |
| Method Summary | |
void |
deployDatabaseDocument(XMLDatabaseReader document)
This reads database specific content from the database configuration document. |
java.lang.String |
getBinaryFilePath()
Returns the filepath where binary objects are stored. |
java.lang.String |
getCreateExtendedScheme()
Returns the scheme (SQL command) to use for creating a table that extends another table |
java.lang.String |
getCreateScheme()
Returns the scheme (SQL command) to use for creating a table |
java.util.Map |
getFieldNameMap()
Returns the current mapping of disallowed fieldsnames (typically reserved words) and their replacement names. |
java.lang.String |
getForeignKeyScheme()
Returns the scheme (SQL command) to use for creating a key |
JDBCInterface |
getJDBC()
Returns the JDBC module used by this class to connect to the database. |
java.lang.String |
getKeyScheme()
Returns the scheme (SQL command) to use for creating a key |
int |
getMaxDropSize()
Returns the maximum table drop size. |
java.lang.String |
getNotNullScheme()
Returns the scheme (SQL command) to use for creating a non-null field |
java.lang.String |
getPrimaryKeyScheme()
Returns the scheme (SQL command) to use for creating a primary key |
boolean |
getStoreBinaryAsFile()
Returns whether binary objects are stored as files (rather than in the database) |
java.util.Map |
getTypeMap()
Obtains the type map. |
void |
init(MMBase mmb,
XMLDatabaseReader document)
Initializes the database layer. |
void |
loadFieldFromTable(MMObjectNode node,
java.lang.String fieldname,
java.sql.ResultSet rs,
int i)
Stores a field in a table ResultSet in a MMObjectNode. |
java.lang.String |
mapToMMBaseFieldName(java.lang.String fieldname)
Maps a database fieldname to a fieldname as used by the MMbase system |
java.lang.String |
mapToTableFieldName(java.lang.String fieldname)
Maps a MMBase fieldname to a fieldname acceptable to the database |
void |
registerChanged(MMObjectNode node,
java.lang.String change)
Registers the change to a node. |
void |
setBinaryFilePath(java.lang.String path)
Sets the filepath where binary objects are stored. |
void |
setCreateExtendedScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a table that extends another table |
void |
setCreateScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a table |
void |
setFieldNameMap(java.util.Map fieldmap)
Sets the mapping of MMBase fieldnames (typically reserved words) to database fieldnames. |
void |
setForeignKeyScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a key |
void |
setKeyScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a key |
void |
setMaxDropSize(int value)
Sets the maximum table drop size. |
void |
setNotNullScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a non-null field |
void |
setPrimaryKeyScheme(java.lang.String scheme)
Sets the scheme (SQL command) to use for creating a primary key |
void |
setStoreBinaryAsFile(boolean value)
Sets whether binary objects are stored as files (rather than in the database) |
void |
setTypeMap(java.util.Map typeMap)
Sets the type map. |
boolean |
setValuePreparedStatement(java.sql.PreparedStatement stmt,
MMObjectNode node,
java.lang.String key,
int i)
Set prepared statement field i with value of key from node |
boolean |
supportsExtendedTables()
Returns whether this storage layer supports extended tables. |
| Methods inherited from interface org.mmbase.storage.Storage |
addField, changeField, commit, commit, create, create, created, createKey, createKey, createObjectStorage, createObjectStorage, createTransaction, delete, delete, drop, getBytes, getNode, getNode, getNodeType, getNodeType, getText, insert, insert, isAllowedParentBuilder, registerParentBuilder, removeField, size, supportsRollback, updateStorage |
| Field Detail |
public static final int KEY_NONE
public static final int KEY_PRIMARY
public static final int KEY_SECONDARY
public static final int KEY_FOREIGN
public static final int KEY_NOTNULL
| Method Detail |
public void init(MMBase mmb,
XMLDatabaseReader document)
mmb - the MBase instance that uses this database layerdocument - the database configuration documentpublic void deployDatabaseDocument(XMLDatabaseReader document)
document - the database configuration documentpublic boolean getStoreBinaryAsFile()
public void setStoreBinaryAsFile(boolean value)
value - if true, binary objects will be stored as filespublic java.lang.String getBinaryFilePath()
getStoreBinaryAsFile() returns true.public void setBinaryFilePath(java.lang.String path)
getStoreBinaryAsFile() returns true.path - the file pathpublic void setFieldNameMap(java.util.Map fieldmap)
fieldmap - Map of field mappings. The map contins a key value pairs where the key is
the MMbase fieldname, and the value the replacement acceptable to the database.public java.util.Map getFieldNameMap()
setFieldNameMap(java.util.Map).public void setTypeMap(java.util.Map typeMap)
typemap - Map of MMBase types and their database type.public java.util.Map getTypeMap()
setTypeMap(java.util.Map).
However, the individual map elements are not copies - changing the dTypeInfo objects wil
affect the database layer directly.public void setPrimaryKeyScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getPrimaryKeyScheme()
public void setNotNullScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getNotNullScheme()
public void setKeyScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getKeyScheme()
public void setForeignKeyScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getForeignKeyScheme()
public void setCreateScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getCreateScheme()
public void setCreateExtendedScheme(java.lang.String scheme)
scheme - the scheme to usepublic java.lang.String getCreateExtendedScheme()
public void setMaxDropSize(int value)
value - the maximum size to setpublic int getMaxDropSize()
public boolean supportsExtendedTables()
public java.lang.String mapToTableFieldName(java.lang.String fieldname)
fieldname - the fieldname to mappublic java.lang.String mapToMMBaseFieldName(java.lang.String fieldname)
fieldname - the fieldname to mappublic JDBCInterface getJDBC()
public void loadFieldFromTable(MMObjectNode node,
java.lang.String fieldname,
java.sql.ResultSet rs,
int i)
node - the node to store the field infieldname - the name of the field as it is known to MMBasers - the ResultSet containing the table rowi - the index of the field in the ResultSet
public boolean setValuePreparedStatement(java.sql.PreparedStatement stmt,
MMObjectNode node,
java.lang.String key,
int i)
throws java.sql.SQLException
java.sql.SQLException - if an error occurred while filling in the fields
public void registerChanged(MMObjectNode node,
java.lang.String change)
node - the node to registerchange - the type of change: "n": new, "c": commit, "d": delete
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||