org.j2ee.dao
Class DAOFactory
java.lang.Object
|
+--org.j2ee.dao.DAOFactory
- Direct Known Subclasses:
- DefaultDAOFactoryImpl
- public abstract class DAOFactory
- extends java.lang.Object
Initial Factory for the DAO Pattern
It will locate daofactory.properties file in four differente way:
First:
Test for the system propertie: org.j2ee.dao.factory
and try to open it as File
Usage: java -Dorg.j2ee.dao.factory=file:/tmp/daofactory.properties
Second:
Test for the JNDI name: java:comp/env/daoFactoryProperty
and try to open it as ResourceBoundle class loader spec
Usage (Define it in your ejb-jar.xml):
daoFactoryProperty
java.lang.String
my.pkg.daofactory
Third:
Test in the root classpath
and try to load it using Resource Boundle semantic
Usage: put daofactory.properties in the root classpath of your .jar
Fourth:
Test in the DAO classpath (org.j2ee.dao)
and try to load it using Resource Boundle semantic
Usage: put daofactory.properties in org/j2ee/dao directory of your .jar
Based on an example of book Code Notes for J2EE, Edited by GREGORY BRILL,
e-ISBN 0-679-64727-9
Last modified $Date: 2004/05/18 10:50:12 $
- Version:
- $Revision: 1.1.1.1 $
- Author:
- jvlio (jvlio@users.sourceforge.net)
- See Also:
ResourceBundle
Method Summary |
abstract org.j2ee.dao.DAOAction |
getAction(java.lang.String action_name)
|
static org.j2ee.dao.DAOFactory |
getDAOFactory()
Returns a default factory |
static org.j2ee.dao.DAOFactory |
getDAOFactory(java.lang.String whichFactory)
Search in factories Map if find a key named "whichFactory", if find
is succefully then compare the object instance, if is a string, then
load class named in this way, otherwise the object is a Factory. |
abstract org.j2ee.dao.DAOActionProcessor |
getProcessor()
|
abstract org.j2ee.dao.DAOActionProcessor |
getProcessor(java.lang.String processor_name)
|
static java.util.ResourceBundle |
getProperties()
|
protected static java.lang.String |
getResourceString(java.util.ResourceBundle resources,
java.lang.String key)
|
protected abstract void |
inizialize(java.lang.String factoryName)
|
protected static java.lang.String[] |
tokenize(java.lang.String input)
Take the given string and chop it up into a series
of strings on whitespace boundries. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FACTORIES_ENTRY
public static final java.lang.String FACTORIES_ENTRY
- See Also:
- Constant Field Values
DEFAULT_FACTORY_ENTRY
public static final java.lang.String DEFAULT_FACTORY_ENTRY
- See Also:
- Constant Field Values
FACTORY_CLASS_SUFFIX
public static final java.lang.String FACTORY_CLASS_SUFFIX
- See Also:
- Constant Field Values
ACTIONS_ENTRY
public static final java.lang.String ACTIONS_ENTRY
- See Also:
- Constant Field Values
GROUPS_ENTRY
public static final java.lang.String GROUPS_ENTRY
- See Also:
- Constant Field Values
ACTION_CLASS_SUFFIX
public static final java.lang.String ACTION_CLASS_SUFFIX
- See Also:
- Constant Field Values
factoryMap
protected static java.util.Map factoryMap
rb
protected static java.util.ResourceBundle rb
DAOFactory
public DAOFactory()
inizialize
protected abstract void inizialize(java.lang.String factoryName)
getDAOFactory
public static final org.j2ee.dao.DAOFactory getDAOFactory()
- Returns a default factory
getDAOFactory
public static final org.j2ee.dao.DAOFactory getDAOFactory(java.lang.String whichFactory)
- Search in factories Map if find a key named "whichFactory", if find
is succefully then compare the object instance, if is a string, then
load class named in this way, otherwise the object is a Factory.
If the key not found, then i guest is a class name and load this
Factory class.
getProperties
public static java.util.ResourceBundle getProperties()
getResourceString
protected static java.lang.String getResourceString(java.util.ResourceBundle resources,
java.lang.String key)
tokenize
protected static java.lang.String[] tokenize(java.lang.String input)
- Take the given string and chop it up into a series
of strings on whitespace boundries. This is useful
for trying to get an array of strings out of the
resource file.
getProcessor
public abstract org.j2ee.dao.DAOActionProcessor getProcessor()
getProcessor
public abstract org.j2ee.dao.DAOActionProcessor getProcessor(java.lang.String processor_name)
getAction
public abstract org.j2ee.dao.DAOAction getAction(java.lang.String action_name)
Copyright © 2004 DAO Action Patterm. All Rights Reserved.