org.pojava.persistence.sql
Class DatabaseCache

java.lang.Object
  extended by org.pojava.persistence.sql.DatabaseCache

public class DatabaseCache
extends Object

This singleton caches object properties that facilitate interchange between Java and external data stores.

Author:
John Pile

Constructor Summary
DatabaseCache()
           
 
Method Summary
static DataSource getDataSource(String dsName)
          Fetch a DataSource from the registry.
static DataSourceMetadata getDataSourceMetadata(String dsName)
          Return the metadata for the named DataSource
static
<T> TableMap<T>
getTableMap(Class<T> javaClass, String tableName, String dataSourceName)
          Retrieve a tableMap
static void registerDataSource(String dataSourceName, DataSource dataSource)
          Register a DataSource.
static void registerTableMap(TableMap<? extends Object> tableMap)
          Register a tableMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseCache

public DatabaseCache()
Method Detail

getDataSourceMetadata

public static DataSourceMetadata getDataSourceMetadata(String dsName)
                                                throws SQLException
Return the metadata for the named DataSource

Parameters:
dsName - Name of DataSource
Returns:
Metadata gathered from a connection from this dataSource
Throws:
SQLException

getDataSource

public static DataSource getDataSource(String dsName)
Fetch a DataSource from the registry.

Parameters:
dsName -
Returns:
DataSource retrieved from cache or JNDI registry.

registerTableMap

public static void registerTableMap(TableMap<? extends Object> tableMap)
Register a tableMap

Parameters:
tableMap -

registerDataSource

public static void registerDataSource(String dataSourceName,
                                      DataSource dataSource)
Register a DataSource.

Parameters:
dataSourceName -
dataSource -

getTableMap

public static <T> TableMap<T> getTableMap(Class<T> javaClass,
                                          String tableName,
                                          String dataSourceName)
Retrieve a tableMap

Parameters:
javaClass -
tableName -
dataSourceName -
Returns:
TableMap or null if not found.


Copyright © 2011. All Rights Reserved.