org.apache.turbine.services.db
Class TurbineMapBrokerService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.db.TurbineMapBrokerService
All Implemented Interfaces:
Initable, MapBrokerService, Service

public class TurbineMapBrokerService
extends BaseService
implements MapBrokerService

Turbine's default implmentation of MapBrokerService.

Version:
$Id: TurbineMapBrokerService.java,v 1.4 2002/03/13 19:43:35 mpoeschl Exp $
Author:
Frank Y. Kim, Brett McLaughlin, Greg Ritter, Daniel Rall, Magnús Þór Torfason, Jason van Zyl, Rafal Krzewski

Field Summary
private  java.util.Map dbMaps
          The global cache of database maps
private  java.lang.String defaultMap
          Default database map
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.db.MapBrokerService
DEFAULT, DEFAULT_MAP, SERVICE_NAME
 
Constructor Summary
TurbineMapBrokerService()
           
 
Method Summary
 DatabaseMap getDatabaseMap()
          Returns the default database map information.
 DatabaseMap getDatabaseMap(java.lang.String name)
          Returns the database map information.
private static java.lang.String getDatabaseProperty(java.lang.String db, java.lang.String prop)
          Returns the specified property of the given database, or the empty string if no value is set for the property.
 java.lang.String getDefaultMap()
          Return the default map.
 void init()
          Initializes the service.
private  void setupIdTable(DatabaseMap map)
          Setup IDBroker's table information within given database map.
 void shutdown()
          Shuts down the service.
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, init, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Field Detail

dbMaps

private java.util.Map dbMaps
The global cache of database maps

defaultMap

private java.lang.String defaultMap
Default database map
Constructor Detail

TurbineMapBrokerService

public TurbineMapBrokerService()
Method Detail

init

public void init()
Initializes the service.
Specified by:
init in interface Initable
Overrides:
init in class BaseInitable
Following copied from interface: org.apache.turbine.services.Initable
Throws:
InitializationException, - if initialization of this class was not successful.

getDefaultMap

public java.lang.String getDefaultMap()
Return the default map.
Specified by:
getDefaultMap in interface MapBrokerService

shutdown

public void shutdown()
Shuts down the service. This method halts the IDBroker's daemon thread in all of the DatabaseMap's.
Specified by:
shutdown in interface Initable
Overrides:
shutdown in class BaseInitable

getDatabaseMap

public DatabaseMap getDatabaseMap()
                           throws TurbineException
Returns the default database map information.
Specified by:
getDatabaseMap in interface MapBrokerService
Returns:
A DatabaseMap.
Throws:
TurbineException - Any exceptions caught during procssing will be rethrown wrapped into a TurbineException.

getDatabaseMap

public DatabaseMap getDatabaseMap(java.lang.String name)
                           throws TurbineException
Returns the database map information. Name relates to the name of the connection pool to associate with the map.
Specified by:
getDatabaseMap in interface MapBrokerService
Parameters:
name - The name of the DatabaseMap to retrieve.
Returns:
The named DatabaseMap.
Throws:
TurbineException - Any exceptions caught during procssing will be rethrown wrapped into a TurbineException.

getDatabaseProperty

private static final java.lang.String getDatabaseProperty(java.lang.String db,
                                                          java.lang.String prop)
Returns the specified property of the given database, or the empty string if no value is set for the property.
Parameters:
db - The name of the database whose property to get.
prop - The name of the property to get.
Returns:
The property's value.

setupIdTable

private void setupIdTable(DatabaseMap map)
Setup IDBroker's table information within given database map. This method should be called on all new database map to ensure that IDBroker functionality is available in all databases userd by the application.
Parameters:
map - the DataBaseMap to setup.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.