org.apache.turbine.services.castor
Class TurbineCastorService
java.lang.Object
|
+--org.apache.turbine.services.BaseInitable
|
+--org.apache.turbine.services.BaseService
|
+--org.apache.turbine.services.TurbineBaseService
|
+--org.apache.turbine.services.castor.TurbineCastorService
- All Implemented Interfaces:
- CastorService, Initable, Service
- public class TurbineCastorService
- extends TurbineBaseService
- implements CastorService
This is a Service that offers access to the object to relational
mapping from Castor.
Here's an example of how you might use it:
TurbineServices ts = TurbineServices.getInstance();
CastorService cs = (CastorService) ts.getService (CastorService.SERVICE_NAME);
Database db = cs.getDatabase()
;
db.begin();
...
db.commit();
db.close();
The following properties are needed to configure this service:
services.CastorService.classname=org.apache.turbine.services.castor.TurbineCastorService
services.CastorService.properties.logfile=/tmp/castor.log
services.CastorService.properties.logprefix=turbinecastor
services.CastorService.properties.databasefile=/tmp/database.xml
services.CastorService.properties.databasename=turbine
- classname
- the classname of this service
- logfile
- the path to a writable file. Castor uses its own log file
- logprefix
- the prefix used in the logfile to distinguish from
Castor log entry and this Service. This is a recommended property
- databasefile
- the path to a readable file defining the mappings of the
java objects an the underlying tables/columns
- databasename
- references a name of a database definition tag used in
the mapping file
- Version:
- $Id: TurbineCastorService.java,v 1.2 2002/07/11 16:53:28 mpoeschl Exp $
- Author:
- Giacomo Pati, Christopher Elkins
Method Summary |
java.io.PrintWriter |
getCastorLogger()
Deprecated. Gets you the PrintWriter object Castor is using for logging. |
org.exolab.castor.jdo.Database |
getDatabase()
Deprecated. Gets a Castor Database object in the context of the defined
environment. |
org.exolab.castor.jdo.JDO |
getJDO()
Deprecated. Gets a JDO object initialized to the database mentioned in the
property databasename. |
void |
init()
Deprecated. Called the first time the Service is used. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TurbineCastorService
public TurbineCastorService()
- Deprecated.
init
public void init()
throws InitializationException
- Deprecated.
- Called the first time the Service is used.
- Specified by:
init
in interface Initable
- Overrides:
init
in class TurbineBaseService
- Following copied from interface:
org.apache.turbine.services.Initable
- Throws:
InitializationException,
- if initialization of this
class was not successful.
getCastorLogger
public java.io.PrintWriter getCastorLogger()
- Deprecated.
- Gets you the PrintWriter object Castor is using for logging.
- Specified by:
getCastorLogger
in interface CastorService
- Returns:
- PrintWriter logger object of Castor.
getJDO
public org.exolab.castor.jdo.JDO getJDO()
- Deprecated.
- Gets a JDO object initialized to the database mentioned in the
property databasename.
- Specified by:
getJDO
in interface CastorService
- Returns:
- JDO object initialized to the database mentioned in the
property databasename.
getDatabase
public org.exolab.castor.jdo.Database getDatabase()
throws org.exolab.castor.jdo.DatabaseNotFoundException,
org.exolab.castor.jdo.PersistenceException
- Deprecated.
- Gets a Castor Database object in the context of the defined
environment.
- Specified by:
getDatabase
in interface CastorService
- Returns:
- Database object
- Throws:
DatabaseNotFoundException,
- if attempted to open a
database that does not exist.PersistenceException,
- if database access failed.
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.