org.apache.fulcrum.hsqldb
Class HSQLServiceImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.fulcrum.hsqldb.HSQLServiceImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Startable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, HSQLService

public class HSQLServiceImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements HSQLService, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Startable, org.apache.avalon.framework.activity.Disposable

The original implementation was taken from http://scarab.tigris.org/source/browse/scarab/src/java/org/tigris/scarab/services/hsql/ and tweaked a little bit.

The component is configured from the componentConfig.xml file by specifying attributes on the service element

database
The directory path where the database files will be stored
dbname
The alias path used to refer to the database from the JDBC url.
trace
(true/false) a flag enabling tracing in the hsql server.
silent
(true/false) a flag to control the logging output of the hsql server.
start
(true/false) when true the database is started at configuration time, and does not need to be started under application control.
port
The listening port of the hsql server.
Example: ... ...

Author:
Peter Tillemans, Siegfried Goeschl

Constructor Summary
HSQLServiceImpl()
          Constructor
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration cfg)
           
 void dispose()
           
 void initialize()
           
 boolean isOnline()
          Is the HSQLDB server online and will accept SQL queries?
 void start()
          Starts the HSQLDB server.
 void stop()
          Stop the HSQLDB server.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSQLServiceImpl

public HSQLServiceImpl()
Constructor

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration cfg)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
Exception
See Also:
Initializable.initialize()

start

public void start()
           throws Exception
Starts the HSQLDB server. The implementation polls to ensure that the HSQLDB server is fully initialized otherwise we get spurious connection exceptions. If the HSQLDB server is not upand running within 10 seconds we throw an exception.

Specified by:
start in interface org.apache.avalon.framework.activity.Startable
Throws:
Exception
See Also:
Startable.start()

stop

public void stop()
          throws Exception
Stop the HSQLDB server. The implementation polls to ensure that the HSQLDB server has terminated otherwise someone could call System.exit() and break the database.

Specified by:
stop in interface org.apache.avalon.framework.activity.Startable
Throws:
Exception
See Also:
Startable.stop()

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

isOnline

public boolean isOnline()
Description copied from interface: HSQLService
Is the HSQLDB server online and will accept SQL queries?

Specified by:
isOnline in interface HSQLService
Returns:
true if the HSQLDB server is online


Copyright © 2005-2010 The Apache Software Foundation. All Rights Reserved.