org.mmbase.util.xml
Class DatabaseReader

java.lang.Object
  extended byorg.mmbase.util.xml.DocumentReader
      extended byorg.mmbase.util.XMLBasicReader
          extended byorg.mmbase.util.xml.DatabaseReader
Direct Known Subclasses:
XMLDatabaseReader

public class DatabaseReader
extends XMLBasicReader

Used to parse and retrieve data from a database configuration file. The parser support databases for database dtd 1.2.

Since:
MMBase 1.7
Version:
$Id: DatabaseReader.java,v 1.1 2003/07/21 12:19:06 pierre Exp $
Author:
Case Roole, Rico Jansen, Pierre van Rooden

Field Summary
static java.lang.String DTD_DATABASE
          DTD resource filename of the most Database DTD
static java.lang.String DTD_DATABASE_1_0
          DTD resource filename of the Database DTD version 1.0
static java.lang.String DTD_DATABASE_1_1
          DTD resource filename of the Database DTD version 1.1
static java.lang.String DTD_DATABASE_1_2
          DTD resource filename of the Database DTD version 1.2
static java.lang.String PUBLIC_ID_DATABASE
          Public ID of the most recent Database DTD
static java.lang.String PUBLIC_ID_DATABASE_1_0
          Public ID of the Database DTD version 1.0
static java.lang.String PUBLIC_ID_DATABASE_1_1
          Public ID of the Database DTD version 1.1
static java.lang.String PUBLIC_ID_DATABASE_1_2
          Public ID of the Database DTD version 1.2
 
Fields inherited from class org.mmbase.util.xml.DocumentReader
document, DTD_ERROR, DTD_ERROR_1_0, FILENOTFOUND, PUBLIC_ID_ERROR, PUBLIC_ID_ERROR_1_0
 
Constructor Summary
DatabaseReader(org.xml.sax.InputSource source)
          Constructor.
DatabaseReader(java.lang.String path)
          Constructor
 
Method Summary
 java.lang.String getBlobDataDir()
          Retrieves the file path where binary objects are to be stored.
 java.util.List getChainedSqlHandlers()
          Returns names of the chained handlers to use, these are classes extending ChainedSqlHandler.
 java.lang.String getCreateExtendedScheme()
          Retrieves the create scheme for extending tables.
 java.lang.String getCreateScheme()
          Retrieves the create scheme
 java.util.Hashtable getDisallowedFields()
          Retrieve a map of fieldnames that are disallowed (i.e reserved words) for this database.
 java.lang.String getForeignKeyScheme()
          Retrieves the foreign key scheme.
 java.lang.String getKeyScheme()
          Retrieves the key scheme.
 int getMaxDropSize()
          Get the max drop size for this database.
 java.lang.String getMMBaseDatabaseDriver()
          Returns the mmbase database driver class for this database.
 java.lang.String getName()
          Returns the name of the database.
 java.lang.String getNotNullScheme()
          Retrieves the not null scheme.
 java.lang.String getPrimaryKeyScheme()
          Retrieves the primary key scheme.
 java.lang.String getSqlHandler()
          Returns the sql handler class to be used, this is a class implementing the SqlHandler interface.
 java.util.Hashtable getTypeMapping()
          Obtains the type map.
static void registerPublicIDs()
          Register the Public Ids for DTDs used by DatabaseReader This method is called by XMLEntityResolver.
 
Methods inherited from class org.mmbase.util.XMLBasicReader
getChildElements, getChildElements, getChildElements, getChildElements, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getElementAttributeValue, getElementAttributeValue, getElementByPath, getElementByPath, getElementName, getElementValue, getElementValue
 
Methods inherited from class org.mmbase.util.xml.DocumentReader
getFileName, getNodeTextValue, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_ID_DATABASE_1_0

public static final java.lang.String PUBLIC_ID_DATABASE_1_0
Public ID of the Database DTD version 1.0

See Also:
Constant Field Values

PUBLIC_ID_DATABASE_1_1

public static final java.lang.String PUBLIC_ID_DATABASE_1_1
Public ID of the Database DTD version 1.1

See Also:
Constant Field Values

PUBLIC_ID_DATABASE_1_2

public static final java.lang.String PUBLIC_ID_DATABASE_1_2
Public ID of the Database DTD version 1.2

See Also:
Constant Field Values

DTD_DATABASE_1_0

public static final java.lang.String DTD_DATABASE_1_0
DTD resource filename of the Database DTD version 1.0

See Also:
Constant Field Values

DTD_DATABASE_1_1

public static final java.lang.String DTD_DATABASE_1_1
DTD resource filename of the Database DTD version 1.1

See Also:
Constant Field Values

DTD_DATABASE_1_2

public static final java.lang.String DTD_DATABASE_1_2
DTD resource filename of the Database DTD version 1.2

See Also:
Constant Field Values

PUBLIC_ID_DATABASE

public static final java.lang.String PUBLIC_ID_DATABASE
Public ID of the most recent Database DTD

See Also:
Constant Field Values

DTD_DATABASE

public static final java.lang.String DTD_DATABASE
DTD resource filename of the most Database DTD

See Also:
Constant Field Values
Constructor Detail

DatabaseReader

public DatabaseReader(java.lang.String path)
Constructor

Parameters:
path - the filename

DatabaseReader

public DatabaseReader(org.xml.sax.InputSource source)
Constructor.

Parameters:
source - Inputsource to the xml document.
Since:
MMBase-1.7
Method Detail

registerPublicIDs

public static void registerPublicIDs()
Register the Public Ids for DTDs used by DatabaseReader This method is called by XMLEntityResolver.


getName

public java.lang.String getName()
Returns the name of the database.

Returns:
the name as a string

getMMBaseDatabaseDriver

public java.lang.String getMMBaseDatabaseDriver()
Returns the mmbase database driver class for this database.

Returns:
the name of the class

getSqlHandler

public java.lang.String getSqlHandler()
Returns the sql handler class to be used, this is a class implementing the SqlHandler interface.

Returns:
The name of the class
Since:
MMBase-1.7

getChainedSqlHandlers

public java.util.List getChainedSqlHandlers()
Returns names of the chained handlers to use, these are classes extending ChainedSqlHandler.

Returns:
List of names of the classes.
Since:
MMBase-1.7

getBlobDataDir

public java.lang.String getBlobDataDir()
Retrieves the file path where binary objects are to be stored. If this value is set, binary objects are stored as files, not in the databse.

Returns:
the path, or the empty string if not specified

getMaxDropSize

public int getMaxDropSize()
Get the max drop size for this database. The max drop size determines whether a table can be dropped as part of a table alteration command.

Returns:
the max drop size in number of records

getDisallowedFields

public java.util.Hashtable getDisallowedFields()
Retrieve a map of fieldnames that are disallowed (i.e reserved words) for this database. Each entry in the map has as its key the disallowed name, and as its value the name with which it needs to be replaced.

Returns:
the map with the disallowed fields

getCreateScheme

public java.lang.String getCreateScheme()
Retrieves the create scheme

Returns:
the create scheme, or the empty string if not available

getCreateExtendedScheme

public java.lang.String getCreateExtendedScheme()
Retrieves the create scheme for extending tables.

Returns:
the create extended scheme, or the empty string if not available
Since:
MMBase 1.6

getPrimaryKeyScheme

public java.lang.String getPrimaryKeyScheme()
Retrieves the primary key scheme.

Returns:
the primary key scheme, or the empty string if not available

getForeignKeyScheme

public java.lang.String getForeignKeyScheme()
Retrieves the foreign key scheme.

Returns:
the foreign key scheme, or the empty string if not available
Since:
MMBase 1.6

getKeyScheme

public java.lang.String getKeyScheme()
Retrieves the key scheme.

Returns:
the key scheme, or the empty string if not available

getNotNullScheme

public java.lang.String getNotNullScheme()
Retrieves the not null scheme.

Returns:
the not null scheme, or the empty string if not available

getTypeMapping

public java.util.Hashtable getTypeMapping()
Obtains the type map. The type map is used to convert MMBase types to database types (needed for creating tables). The kyes in the map are Integer object whos evalues match the MMBase object types as defined in FieldDefs.The value are dTypeInfos objects.

Returns:
a Map of MMBase types and their database type.


MMBase build 1.7.1.20041002