net.sf.farrago.db
Class FarragoDbSessionFactory

java.lang.Object
  extended by net.sf.farrago.db.FarragoDbSessionFactory
All Implemented Interfaces:
FarragoSessionFactory, FarragoSessionPersonalityFactory
Direct Known Subclasses:
FarragoAutoCalcRulesTest.TestDbSessionFactory, FarragoDefaultSessionFactory

public class FarragoDbSessionFactory
extends Object
implements FarragoSessionFactory

FarragoDbSessionFactory is a basic implementation for the FarragoSessionFactory interface.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/db/FarragoDbSessionFactory.java#32 $
Author:
John V. Sichi

Field Summary
private  FarragoPluginClassLoader pluginClassLoader
           
 
Constructor Summary
FarragoDbSessionFactory()
           
 
Method Summary
 void applyFennelExtensionParameters(Properties map)
          Allows extensions of Farrago to add their own parameters to the Fennel configuration parameters.
 void cleanupSessions()
          Gives this factory a chance to clean up after a session has been closed.
 void defineResourceBundles(List<ResourceBundle> bundleList)
          Defines resource bundles to be used for localizing model object names.
 FarragoPluginClassLoader getPluginClassLoader()
           
 FennelCmdExecutor newFennelCmdExecutor()
          Creates a new intrepreter for Fennel commands.
 FennelTxnContext newFennelTxnContext(FarragoRepos repos, FennelDbHandle fennelDbHandle)
          Creates a new Fennel transaction context.
 FarragoSessionModelExtension newModelExtension(FarragoPluginClassLoader pcl, FemJar femJar)
          Loads a model extension plugin instance.
 FarragoSession newReentrantSession(FarragoSession session)
          Creates a new reentrant session.
 FarragoRepos newRepos(FarragoAllocationOwner owner, boolean userRepos)
          Opens a new repositor instance.
 FarragoSession newSession(String url, Properties info)
          Creates a new session.
 FarragoSessionPersonality newSessionPersonality(FarragoSession session, FarragoSessionPersonality defaultPersonality)
          Creates a new session personality.
 FarragoSessionTxnMgr newTxnMgr()
           
 void releaseReentrantSession(FarragoSession session)
          Release a reentrant session.
 void setPluginClassLoader(FarragoPluginClassLoader pluginClassLoader)
          Sets the class loader for plugins.
 void specializedInitialization(FarragoAllocationOwner owner)
          Allows extensions of Farrago to perform their own initialization tasks.
 void specializedShutdown()
          Allows extensions of Farrago to perform their own shutdown tasks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pluginClassLoader

private FarragoPluginClassLoader pluginClassLoader
Constructor Detail

FarragoDbSessionFactory

public FarragoDbSessionFactory()
Method Detail

newSession

public FarragoSession newSession(String url,
                                 Properties info)
Description copied from interface: FarragoSessionFactory
Creates a new session.

Specified by:
newSession in interface FarragoSessionFactory
Parameters:
url - (same as for JDBC connect)
info - (same as for JDBC connect)
Returns:
new session

newReentrantSession

public FarragoSession newReentrantSession(FarragoSession session)
Description copied from interface: FarragoSessionFactory
Creates a new reentrant session. The base session is cloned with a cloned copy of the base session's session variables.

Specified by:
newReentrantSession in interface FarragoSessionFactory
Parameters:
session - the existing session on which to base the re-entrant session

releaseReentrantSession

public void releaseReentrantSession(FarragoSession session)
Description copied from interface: FarragoSessionFactory
Release a reentrant session.

Specified by:
releaseReentrantSession in interface FarragoSessionFactory

newSessionPersonality

public FarragoSessionPersonality newSessionPersonality(FarragoSession session,
                                                       FarragoSessionPersonality defaultPersonality)
Description copied from interface: FarragoSessionPersonalityFactory
Creates a new session personality.

Specified by:
newSessionPersonality in interface FarragoSessionPersonalityFactory
Parameters:
session - session for which personality is being created; note that the personality may be used for other sessions as well, so no reference to this session should be retained
defaultPersonality - a default personality to which the new personality may delegate, or null if no default is available
Returns:
personality

setPluginClassLoader

public void setPluginClassLoader(FarragoPluginClassLoader pluginClassLoader)
Description copied from interface: FarragoSessionFactory
Sets the class loader for plugins.

Specified by:
setPluginClassLoader in interface FarragoSessionFactory
Parameters:
pluginClassLoader - classloader to use

getPluginClassLoader

public FarragoPluginClassLoader getPluginClassLoader()
Specified by:
getPluginClassLoader in interface FarragoSessionFactory
Returns:
plugin class loader to use

newModelExtension

public FarragoSessionModelExtension newModelExtension(FarragoPluginClassLoader pcl,
                                                      FemJar femJar)
Description copied from interface: FarragoSessionFactory
Loads a model extension plugin instance.

Specified by:
newModelExtension in interface FarragoSessionFactory
Parameters:
pcl - FarragoPluginClassLoader to use to load the plugin
femJar - catalog descriptor for jar from which plugin is loaded

newFennelCmdExecutor

public FennelCmdExecutor newFennelCmdExecutor()
Description copied from interface: FarragoSessionFactory
Creates a new intrepreter for Fennel commands.

Specified by:
newFennelCmdExecutor in interface FarragoSessionFactory
Returns:
new interpeter

newRepos

public FarragoRepos newRepos(FarragoAllocationOwner owner,
                             boolean userRepos)
Description copied from interface: FarragoSessionFactory
Opens a new repositor instance.

Specified by:
newRepos in interface FarragoSessionFactory
Parameters:
owner - the object which should own the new repos
userRepos - true for user repos; false for system repos
Returns:
new repos instance

newFennelTxnContext

public FennelTxnContext newFennelTxnContext(FarragoRepos repos,
                                            FennelDbHandle fennelDbHandle)
Description copied from interface: FarragoSessionFactory
Creates a new Fennel transaction context.

Specified by:
newFennelTxnContext in interface FarragoSessionFactory
Parameters:
repos - repos for transaction metadata access
fennelDbHandle - handle for database to access
Returns:
new context

newTxnMgr

public FarragoSessionTxnMgr newTxnMgr()
Specified by:
newTxnMgr in interface FarragoSessionFactory
Returns:
a new transaction manager

applyFennelExtensionParameters

public void applyFennelExtensionParameters(Properties map)
Description copied from interface: FarragoSessionFactory
Allows extensions of Farrago to add their own parameters to the Fennel configuration parameters.

Specified by:
applyFennelExtensionParameters in interface FarragoSessionFactory
Parameters:
map - a non-null, modifiable Map where configuration parameters can

specializedInitialization

public void specializedInitialization(FarragoAllocationOwner owner)
Description copied from interface: FarragoSessionFactory
Allows extensions of Farrago to perform their own initialization tasks.

Specified by:
specializedInitialization in interface FarragoSessionFactory
Parameters:
owner - the object that should own any allocated objects

specializedShutdown

public void specializedShutdown()
Description copied from interface: FarragoSessionFactory
Allows extensions of Farrago to perform their own shutdown tasks.

Specified by:
specializedShutdown in interface FarragoSessionFactory

cleanupSessions

public void cleanupSessions()
Description copied from interface: FarragoSessionFactory
Gives this factory a chance to clean up after a session has been closed.

Specified by:
cleanupSessions in interface FarragoSessionFactory

defineResourceBundles

public void defineResourceBundles(List<ResourceBundle> bundleList)
Description copied from interface: FarragoSessionFactory
Defines resource bundles to be used for localizing model object names. Any resource having a name of the form "UmlXXX" will be interpreted as the localized name for UML class XXX.

Specified by:
defineResourceBundles in interface FarragoSessionFactory
Parameters:
bundleList - receives instances of ResourceBundle