Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enableit.db.daf.castor
Class JdoFactory  view JdoFactory download JdoFactory.java

java.lang.Object
  extended byorg.enableit.db.daf.castor.JdoFactory

public final class JdoFactory
extends java.lang.Object

Factory pattern for creating connections to a JDO managed datasource.
This class is final to prevent a breach of security by subclassing.
The JDO implementation is Castor from exolab.org.


Field Summary
static java.lang.String DATABASE_FILE
           
static java.lang.String DATABASE_WITHOUT_CONTAINER_FILE
           
private static java.lang.String databaseName
           
private static JDO jdo
           
private static org.apache.log4j.Category logger
          Define a static Category instance for logging Use one per package
private static Mapping mapping
           
static java.lang.String MAPPING_FILE
           
 
Constructor Summary
JdoFactory()
           
 
Method Summary
static java.sql.Connection getConnection()
          Return a standard JDBC connection, nothing to do with JDO.
static Database getDatabase()
          Get a JDO Database object.
static java.lang.String getIdentity(java.lang.Class clazz)
          Get the property name that holds the database key.
static JDO getJdo()
          Get a JDO object.
static void setDatabaseName(java.lang.String newDatabaseName)
          Sets the database name to be used and resets the internal JDO reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

private static Mapping mapping

jdo

private static JDO jdo

databaseName

private static java.lang.String databaseName

DATABASE_FILE

public static final java.lang.String DATABASE_FILE
See Also:
Constant Field Values

DATABASE_WITHOUT_CONTAINER_FILE

public static final java.lang.String DATABASE_WITHOUT_CONTAINER_FILE
See Also:
Constant Field Values

MAPPING_FILE

public static final java.lang.String MAPPING_FILE
See Also:
Constant Field Values

logger

private static org.apache.log4j.Category logger
Define a static Category instance for logging Use one per package

Constructor Detail

JdoFactory

public JdoFactory()
Method Detail

setDatabaseName

public static void setDatabaseName(java.lang.String newDatabaseName)
Sets the database name to be used and resets the internal JDO reference. This is useful if either the mapping or database configuration files has been changed.


getJdo

public static final JDO getJdo()
Get a JDO object. This is analogous to a JDBC 2 DataSource.


getDatabase

public static final Database getDatabase()
Get a JDO Database object. This is analogous to a JDBC Connection.


getIdentity

public static java.lang.String getIdentity(java.lang.Class clazz)
Get the property name that holds the database key.


getConnection

public static final java.sql.Connection getConnection()
Return a standard JDBC connection, nothing to do with JDO.