org.databene.platform.db
Class DBSystem

java.lang.Object
  extended by org.databene.model.storage.AbstractStorageSystem
      extended by org.databene.platform.db.DBSystem
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, DescriptorProvider, StorageSystem

public class DBSystem
extends AbstractStorageSystem

RDBMS implementation of the StorageSystem interface.

Created: 27.06.2007 23:04:19

Since:
0.3
Author:
Volker Bergmann

Field Summary
protected static org.databene.commons.bean.ArrayPropertyExtractor<java.lang.String> nameExtractor
           
 
Constructor Summary
DBSystem(java.lang.String id, java.lang.String environment)
           
DBSystem(java.lang.String id, java.lang.String url, java.lang.String driver, java.lang.String user, java.lang.String password)
           
 
Method Summary
 void close()
          Closes the database.
 long countEntities(java.lang.String tableName)
           
 java.sql.Connection createConnection()
           
 void createSequence(java.lang.String name)
           
 void dropSequence(java.lang.String name)
           
 java.lang.Object execute(java.lang.String sql)
          Executes a command on the storage system
 void flush()
          Assures that all data that has been StorageSystem.store(Entity)d, is send to the target system.
 java.lang.String getCatalog()
           
 java.sql.Connection getConnection()
           
 org.databene.jdbacl.model.Database getDbMetaData()
           
 org.databene.jdbacl.DatabaseDialect getDialect()
           
 java.lang.String getDriver()
           
 java.lang.String getEnvironment()
           
 java.lang.String getExcludeTables()
           
 int getFetchSize()
           
 java.lang.String getId()
          Returns a name that identifies the database
 java.lang.String getIncludeTables()
           
 java.lang.String getPassword()
           
 java.lang.String getSchema()
           
 java.lang.String getSystem()
           
 TypeDescriptor getTypeDescriptor(java.lang.String tableName)
           
 TypeDescriptor[] getTypeDescriptors()
           
 java.lang.String getUrl()
           
 java.lang.String getUser()
           
 Consumer<Entity> inserter()
           
 Consumer<Entity> inserter(java.lang.String table)
           
 void invalidate()
           
 boolean isBatch()
           
 boolean isLazy()
           
 boolean isMetaDataCache()
           
 boolean isReadOnly()
           
 ComplexTypeDescriptor mapTableToComplexTypeDescriptor(org.databene.jdbacl.model.DBTable table, ComplexTypeDescriptor complexType)
           
 long nextSequenceValue(java.lang.String sequenceName)
           
 void parseMetaData()
           
<T> org.databene.commons.HeavyweightTypedIterable<T>
query(java.lang.String query, org.databene.commons.Context context)
          Creates an Iterable for repetitive iteration through the results of the specified query.
 org.databene.commons.TypedIterable<Entity> queryEntities(java.lang.String type, java.lang.String selector, org.databene.commons.Context context)
          Creates an iterator that provides all entities of given type.
 Entity queryEntityById(java.lang.String tableName, java.lang.Object id)
           
<T> org.databene.commons.TypedIterable<T>
queryEntityIds(java.lang.String tableName, java.lang.String selector, org.databene.commons.Context context)
          Queries for entity ids
 void setAcceptUnknownColumnTypes(boolean acceptUnknownColumnTypes)
           
 void setBatch(boolean batch)
           
 void setCatalog(java.lang.String catalog)
           
 void setDriver(java.lang.String driver)
           
 void setDynamicQuerySupported(boolean dynamicQuerySupported)
           
 void setExcludeTables(java.lang.String excludeTables)
           
 void setFetchSize(int fetchSize)
           
 void setId(java.lang.String id)
           
 void setIncludeTables(java.lang.String includeTables)
           
 void setLazy(boolean lazy)
           
 void setMetaDataCache(boolean metaDataCache)
           
 void setPassword(java.lang.String password)
           
 void setReadOnly(boolean readOnly)
           
 void setSchema(java.lang.String schema)
           
 void setSequenceValue(java.lang.String sequenceName, long increment)
           
 void setTableFilter(java.lang.String tableFilter)
          Deprecated. 
 void setUrl(java.lang.String url)
           
 void setUser(java.lang.String user)
           
 void store(Entity entity)
          Persists a new entity.
 boolean tableExists(java.lang.String tableName)
           
 java.lang.String toString()
           
 void update(Entity entity)
          Updates an existing entity.
 Consumer<Entity> updater()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nameExtractor

protected static final org.databene.commons.bean.ArrayPropertyExtractor<java.lang.String> nameExtractor
Constructor Detail

DBSystem

public DBSystem(java.lang.String id,
                java.lang.String url,
                java.lang.String driver,
                java.lang.String user,
                java.lang.String password)

DBSystem

public DBSystem(java.lang.String id,
                java.lang.String environment)
Method Detail

getId

public java.lang.String getId()
Description copied from interface: StorageSystem
Returns a name that identifies the database


setId

public void setId(java.lang.String id)

getEnvironment

public java.lang.String getEnvironment()

getDriver

public java.lang.String getDriver()

setDriver

public void setDriver(java.lang.String driver)

getUrl

public java.lang.String getUrl()

setUrl

public void setUrl(java.lang.String url)

getUser

public java.lang.String getUser()

setUser

public void setUser(java.lang.String user)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getCatalog

public java.lang.String getCatalog()

setCatalog

public void setCatalog(java.lang.String catalog)

getSchema

public java.lang.String getSchema()

setSchema

public void setSchema(java.lang.String schema)

setTableFilter

@Deprecated
public void setTableFilter(java.lang.String tableFilter)
Deprecated. 


getIncludeTables

public java.lang.String getIncludeTables()

setIncludeTables

public void setIncludeTables(java.lang.String includeTables)

getExcludeTables

public java.lang.String getExcludeTables()

setExcludeTables

public void setExcludeTables(java.lang.String excludeTables)

isMetaDataCache

public boolean isMetaDataCache()

setMetaDataCache

public void setMetaDataCache(boolean metaDataCache)

isBatch

public boolean isBatch()

setBatch

public void setBatch(boolean batch)

getFetchSize

public int getFetchSize()

setFetchSize

public void setFetchSize(int fetchSize)

isReadOnly

public boolean isReadOnly()

setReadOnly

public void setReadOnly(boolean readOnly)

isLazy

public boolean isLazy()

setLazy

public void setLazy(boolean lazy)

setDynamicQuerySupported

public void setDynamicQuerySupported(boolean dynamicQuerySupported)

setAcceptUnknownColumnTypes

public void setAcceptUnknownColumnTypes(boolean acceptUnknownColumnTypes)

getTypeDescriptors

public TypeDescriptor[] getTypeDescriptors()

getTypeDescriptor

public TypeDescriptor getTypeDescriptor(java.lang.String tableName)

store

public void store(Entity entity)
Description copied from interface: StorageSystem
Persists a new entity.


update

public void update(Entity entity)
Description copied from interface: StorageSystem
Updates an existing entity.


flush

public void flush()
Description copied from interface: StorageSystem
Assures that all data that has been StorageSystem.store(Entity)d, is send to the target system.


close

public void close()
Description copied from interface: StorageSystem
Closes the database.


queryEntityById

public Entity queryEntityById(java.lang.String tableName,
                              java.lang.Object id)

queryEntities

public org.databene.commons.TypedIterable<Entity> queryEntities(java.lang.String type,
                                                                java.lang.String selector,
                                                                org.databene.commons.Context context)
Description copied from interface: StorageSystem
Creates an iterator that provides all entities of given type.


countEntities

public long countEntities(java.lang.String tableName)

queryEntityIds

public <T> org.databene.commons.TypedIterable<T> queryEntityIds(java.lang.String tableName,
                                                                java.lang.String selector,
                                                                org.databene.commons.Context context)
Description copied from interface: StorageSystem
Queries for entity ids


query

public <T> org.databene.commons.HeavyweightTypedIterable<T> query(java.lang.String query,
                                                                  org.databene.commons.Context context)
Description copied from interface: StorageSystem
Creates an Iterable for repetitive iteration through the results of the specified query.


inserter

public Consumer<Entity> inserter()

inserter

public Consumer<Entity> inserter(java.lang.String table)

updater

public Consumer<Entity> updater()

tableExists

public boolean tableExists(java.lang.String tableName)

createSequence

public void createSequence(java.lang.String name)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

dropSequence

public void dropSequence(java.lang.String name)

execute

public java.lang.Object execute(java.lang.String sql)
Description copied from interface: StorageSystem
Executes a command on the storage system

Specified by:
execute in interface StorageSystem
Overrides:
execute in class AbstractStorageSystem

nextSequenceValue

public long nextSequenceValue(java.lang.String sequenceName)

setSequenceValue

public void setSequenceValue(java.lang.String sequenceName,
                             long increment)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

createConnection

public java.sql.Connection createConnection()

getConnection

public java.sql.Connection getConnection()

invalidate

public void invalidate()

parseMetaData

public void parseMetaData()

getDialect

public org.databene.jdbacl.DatabaseDialect getDialect()

getSystem

public java.lang.String getSystem()

getDbMetaData

public org.databene.jdbacl.model.Database getDbMetaData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

mapTableToComplexTypeDescriptor

public ComplexTypeDescriptor mapTableToComplexTypeDescriptor(org.databene.jdbacl.model.DBTable table,
                                                             ComplexTypeDescriptor complexType)


Copyright © 2011. All Rights Reserved.