Author: sgoeschl
Date: Mon Oct 10 02:33:10 2005
New Revision: 312591

URL: http://svn.apache.org/viewcvs?rev=312591&view=rev
Log:
Updating the HSQLDB service

+) Removing the access to the Avalon context
+) Using HSQLDB 1.8.0.1 which also fixes GUMP
+) Got rid of the cast to the service implementation class to stop the database 
since the cast fails when using dynamic proxies

Modified:
    jakarta/turbine/fulcrum/trunk/hsqldb/project.xml
    
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLService.java
    
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLServiceImpl.java
    jakarta/turbine/fulcrum/trunk/hsqldb/src/test/TestComponentConfig.xml
    
jakarta/turbine/fulcrum/trunk/hsqldb/src/test/org/apache/fulcrum/hsqldb/HSQLServiceTest.java
    jakarta/turbine/fulcrum/trunk/hsqldb/xdocs/changes.xml

Modified: jakarta/turbine/fulcrum/trunk/hsqldb/project.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/project.xml?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/hsqldb/project.xml (original)
+++ jakarta/turbine/fulcrum/trunk/hsqldb/project.xml Mon Oct 10 02:33:10 2005
@@ -8,10 +8,10 @@
   <dependencies>
   
     <dependency>
-        <groupId>hsqldb</groupId>
-        <artifactId>hsqldb</artifactId>
-        <version>1.7.2.2</version>
-        <url>http://hsqldb.sourceforge.net/</url>
+      <groupId>hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <version>1.8.0.1</version>
+      <url>http://hsqldb.sourceforge.net/</url>
     </dependency> 
     
     <!--  Needed only for testing -->

Modified: 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLService.java
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLService.java?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLService.java
 (original)
+++ 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLService.java
 Mon Oct 10 02:33:10 2005
@@ -1,5 +1,7 @@
 package org.apache.fulcrum.hsqldb;
 
+import org.apache.avalon.framework.activity.Startable;
+
 /*
  * Copyright 2004 Apache Software Foundation
  * Licensed  under the  Apache License,  Version 2.0  (the "License");
@@ -24,8 +26,27 @@
  * @author <a href="mailto:[EMAIL PROTECTED]">Peter Tillemans</a>
  * @author <a href="mailto:[EMAIL PROTECTED]">Siegfried Goeschl</a>
  */
-public interface HSQLService 
+public interface HSQLService extends Startable
 {
+    /**
+     * 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.
+     *  
+     * @see org.apache.avalon.framework.activity.Startable#start()
+     */
+    public void start() 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.
+     * 
+     * @see org.apache.avalon.framework.activity.Startable#stop()
+     */
+    public void stop() throws Exception;
+
     /**
      * Check if the server is running
      * 

Modified: 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLServiceImpl.java
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLServiceImpl.java?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLServiceImpl.java
 (original)
+++ 
jakarta/turbine/fulcrum/trunk/hsqldb/src/java/org/apache/fulcrum/hsqldb/HSQLServiceImpl.java
 Mon Oct 10 02:33:10 2005
@@ -17,22 +17,16 @@
  * limitations under the License.
  */
 
-import java.io.File;
-
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
 import org.apache.avalon.framework.activity.Startable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-
-import org.hsqldb.HsqlProperties;
 import org.hsqldb.Server;
 import org.hsqldb.ServerConstants;
+import org.hsqldb.persist.HsqlProperties;
 
 /**
  * The originial implementation was taken from
@@ -71,17 +65,14 @@
  */
 public class HSQLServiceImpl 
        extends AbstractLogEnabled 
-       implements HSQLService, Configurable, Initializable, Contextualizable, 
Startable, Disposable
+       implements HSQLService, Configurable, Initializable, Startable, 
Disposable
 {
     /** the HSQLDB server instance */
     private Server server;
     
     /** the configuration properties */
     private HsqlProperties serverProperties;
-    
-    /** the application directory */
-    private File applicationDir;
-    
+        
     /////////////////////////////////////////////////////////////////////////
     // Avalon Service Lifecycle Implementation
     /////////////////////////////////////////////////////////////////////////
@@ -91,6 +82,7 @@
      */
     public HSQLServiceImpl()
     {
+        // nothing to do
     }
     
     public boolean isRunning() {
@@ -99,14 +91,6 @@
     }    
     
     /**
-     * @see 
org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
-     */
-    public void contextualize(Context context) throws ContextException
-    {
-        this.applicationDir = (File) context.get("urn:avalon:home");
-    }
-
-    /**
      * @see 
org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
      */
     public void configure(Configuration cfg) throws ConfigurationException 
@@ -124,6 +108,7 @@
         this.serverProperties.setProperty("server.trace", 
cfg.getAttributeAsBoolean("trace"));
         this.serverProperties.setProperty("server.silent", 
cfg.getAttributeAsBoolean("silent"));        
         this.serverProperties.setProperty("server.port", 
cfg.getAttribute("port"));
+        this.serverProperties.setProperty("server.tls", 
cfg.getAttribute("tls","false"));
     }
     
     /**
@@ -181,7 +166,6 @@
     {
         this.server = null;
         this.serverProperties = null;
-        this.applicationDir = null;
     }   
     
     /**

Modified: jakarta/turbine/fulcrum/trunk/hsqldb/src/test/TestComponentConfig.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/src/test/TestComponentConfig.xml?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/hsqldb/src/test/TestComponentConfig.xml 
(original)
+++ jakarta/turbine/fulcrum/trunk/hsqldb/src/test/TestComponentConfig.xml Mon 
Oct 10 02:33:10 2005
@@ -1,3 +1,3 @@
 <componentConfig>
-    <HSQLService database="./src/test/test" dbname="test" trace="true" 
silent="false" port="9001"/>
+    <HSQLService database="./src/test/test" dbname="test" trace="true" 
silent="false" port="9001" tls="false"/>
 </componentConfig>

Modified: 
jakarta/turbine/fulcrum/trunk/hsqldb/src/test/org/apache/fulcrum/hsqldb/HSQLServiceTest.java
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/src/test/org/apache/fulcrum/hsqldb/HSQLServiceTest.java?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- 
jakarta/turbine/fulcrum/trunk/hsqldb/src/test/org/apache/fulcrum/hsqldb/HSQLServiceTest.java
 (original)
+++ 
jakarta/turbine/fulcrum/trunk/hsqldb/src/test/org/apache/fulcrum/hsqldb/HSQLServiceTest.java
 Mon Oct 10 02:33:10 2005
@@ -108,9 +108,15 @@
     public void testIsRunning() throws Exception {
 
         assertTrue("Server was not started", service.isRunning());
-        ((HSQLServiceImpl)service).stop();
+        service.stop();
+        assertFalse("Server is still running", service.isRunning());       
+    }
+
+    public void testShutdown() throws Exception {
+
+        Connection conn = this.getConnection("test"); 
+        Statement stmt = conn.createStatement();
+        stmt.execute("SHUTDOWN;");        
         assertFalse("Server is still running", service.isRunning());
-       
     }
- 
 }

Modified: jakarta/turbine/fulcrum/trunk/hsqldb/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/hsqldb/xdocs/changes.xml?rev=312591&r1=312590&r2=312591&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/hsqldb/xdocs/changes.xml (original)
+++ jakarta/turbine/fulcrum/trunk/hsqldb/xdocs/changes.xml Mon Oct 10 02:33:10 
2005
@@ -4,17 +4,33 @@
     <title>Fulcrum HSQLDB Service</title>
     <author email="[EMAIL PROTECTED]">Siegfried Goeschl</author>
   </properties>
-
   <body>
+    <release version="1.0.1-dev" date="as in SVN">
+      <action dev="sgoeschl" type="update">
+       Removing the access to the Avalon context since it was never used.
+      </action>
+      <action dev="sgoeschl" type="update">
+        Using HSQLDB 1.8.0.1 which also fixes the GUMP spam about broken
+        builds.
+      </action>
+      <action dev="sgoeschl" type="add">
+        Using org.apache.avalon.framework.activity.Startable in the
+        service interface to start/stop the service.
+      </action>
+      <action dev="sgoeschl" type="update">
+        Got rid of the cast to the service implementation class to
+        stop the database since the cast fails when using dynamic
+        proxies
+      </action>
+    </release>
     <release version="1.0.0" date="as in CVS">
-     <action dev="epugh" type="update">
+      <action dev="epugh" type="update">
         Add additional tests submitted by Peter Tillemans in Scarab version of
         this service.
-      </action>        
-     <action dev="goeschsi" type="update">
+      </action>
+      <action dev="sgoeschl" type="update">
         Initial release
-      </action>      
-    </release>    
+      </action>
+    </release>
   </body>
 </document>
-



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to