You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ri...@apache.org on 2006/12/31 06:06:48 UTC

svn commit: r491387 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/ibatis/ main/resources/org/ main/resources/org/apache/ main/resources/org/apache/maven/ main/resources/org/apache/mave...

Author: rinku
Date: Sat Dec 30 21:06:47 2006
New Revision: 491387

URL: http://svn.apache.org/viewvc?view=rev&rev=491387
Log:
o  ibatis DAO updates. (re-attempting check-in)

Added:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml   (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml   (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml   (with props)
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties   (with props)
Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/AbstractIbatisStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/AbstractJdoStoreTestCase.java

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/AbstractIbatisStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/AbstractIbatisStore.java?view=diff&rev=491387&r1=491386&r2=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/AbstractIbatisStore.java (original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/AbstractIbatisStore.java Sat Dec 30 21:06:47 2006
@@ -16,6 +16,7 @@
  * the License.
  */
 
+import org.codehaus.plexus.ibatis.PlexusIbatisHelper;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -31,6 +32,11 @@
 {
 
     /**
+     * @plexus.requirement role-hint="continuum-ibatis"
+     */
+    private PlexusIbatisHelper plexusIbatisHelper;
+
+    /**
      * Acts as a client to initiate operations on the underlying data store.
      */
     private SqlMapClient sqlMapClient;
@@ -42,7 +48,7 @@
      */
     public void initialize() throws InitializationException
     {
-        // TODO: initialize SQL Map client.
+        this.sqlMapClient = this.plexusIbatisHelper.getSqlMapClient();
     }
 
     /**

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupStore.java?view=diff&rev=491387&r1=491386&r2=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupStore.java (original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupStore.java Sat Dec 30 21:06:47 2006
@@ -105,8 +105,29 @@
      */
     public List getAllProjectGroups() throws ContinuumStoreException
     {
-        // TODO Auto-generated method stub
-        return null;
+        try
+        {
+            getSqlMapClient().startTransaction();
+
+            return getSqlMapClient().queryForList( SQLMAP_GET_ALL_PROJECT_GROUPS, null );
+
+        }
+        catch ( SQLException e )
+        {
+            throw new ContinuumStoreException( "Unable to retrieve ProjectGroups.", e );
+        }
+        finally
+        {
+            try
+            {
+                getSqlMapClient().endTransaction();
+            }
+            catch ( SQLException e )
+            {
+                // log and forget
+                getLogger().warn( "Unable to end transaction.", e );
+            }
+        }
     }
 
     /**
@@ -126,9 +147,10 @@
      * 
      * @see org.apache.maven.continuum.store.ProjectGroupStore#saveProjectGroup(org.apache.maven.continuum.model.project.ProjectGroup)
      */
-    public ProjectGroup saveProjectGroup( ProjectGroup projectGroup ) throws ContinuumStoreException
+    public ProjectGroup saveProjectGroup( ProjectGroup group ) throws ContinuumStoreException
     {
         // TODO Auto-generated method stub
+
         return null;
     }
 

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml?view=auto&rev=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml (added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml Sat Dec 30 21:06:47 2006
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
+
+<sqlMap namespace="continuum.model.project.ProjectGroup">
+
+  <resultMap id="RM.GetAllProjectGroups" class="org.apache.maven.continuum.model.project.ProjectGroup">
+    <result property="id" />
+    <result property="description" />
+    <result property="groupId" />
+    <result property="key" />
+    <result property="modelEncoding" nullValue="" />
+    <result property="name" />
+  </resultMap>
+
+  <select id="GetAllProjectGroups" resultMap="RM.GetAllProjectGroups">
+    select
+      id,
+      description, 
+      groupId,
+      key,
+      modelEncoding,
+      name
+    from
+      PROJECTGROUP    
+  </select>
+ 
+ 
+</sqlMap>

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/model/project/ProjectGroup.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml?view=auto&rev=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml (added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml Sat Dec 30 21:06:47 2006
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE sqlMapConfig
+    PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
+    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
+
+<sqlMapConfig>
+  <settings
+    cacheModelsEnabled="true"
+    enhancementEnabled="true"
+    lazyLoadingEnabled="true"
+    maxRequests="32"
+    maxSessions="10"
+    maxTransactions="5"
+    useStatementNamespaces="false"
+    />
+
+  <transactionManager type="JDBC">
+    <dataSource type="SIMPLE">
+      <property name="JDBC.Driver" value="org.hsqldb.jdbcDriver"/>
+      <property name="JDBC.ConnectionURL" value="jdbc:hsqldb:mem:continuum"/>
+      <property name="JDBC.Username" value="sa"/>
+      <property name="JDBC.Password" value=""/>
+    </dataSource>
+  </transactionManager>
+  
+  <sqlMap resource="org/apache/maven/continuum/model/project/ProjectGroup.xml"/>
+  
+</sqlMapConfig>

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/main/resources/org/apache/maven/continuum/store/ibatis/ibatis-config.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupTestCase.java?view=diff&rev=491387&r1=491386&r2=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupTestCase.java (original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ibatis/IbatisProjectGroupTestCase.java Sat Dec 30 21:06:47 2006
@@ -19,9 +19,12 @@
 import org.apache.maven.continuum.store.ProjectGroupStore;
 import org.codehaus.plexus.PlexusTestCase;
 
+import java.util.List;
+
 /**
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
- * @version $Id$
+ * @version $Id: IbatisProjectGroupTestCase.java 491371 2006-12-31 03:00:05Z
+ *          rinku $
  */
 public class IbatisProjectGroupTestCase extends PlexusTestCase
 {
@@ -34,6 +37,9 @@
 
     public void testLookupProjectGroup() throws Exception
     {
+        IbatisProjectGroupStore store = (IbatisProjectGroupStore) lookup( ProjectGroupStore.ROLE, "ibatis" );
+        List list = store.getAllProjectGroups();
+        assertNotNull( list );
 
     }
 

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/AbstractJdoStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/AbstractJdoStoreTestCase.java?view=diff&rev=491387&r1=491386&r2=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/AbstractJdoStoreTestCase.java (original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/AbstractJdoStoreTestCase.java Sat Dec 30 21:06:47 2006
@@ -34,7 +34,6 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml?view=auto&rev=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml (added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml Sat Dec 30 21:06:47 2006
@@ -0,0 +1,30 @@
+<plexus>
+  <components>
+    <component>
+      <role>org.codehaus.plexus.ibatis.PlexusIbatisHelper</role>
+      <implementation>org.codehaus.plexus.ibatis.DefaultPlexusIbatisHelper</implementation>
+      <role-hint>continuum-ibatis</role-hint>
+      <configuration>
+        <resource>org/apache/maven/continuum/store/ibatis/ibatis-config.xml</resource>
+        <properties>
+          <property>
+            <name>jdbc.driver</name>
+            <value>org.hsqldb.jdbcDriver</value>
+          </property>
+          <property>
+            <name>jdbc.url</name>
+            <value>jdbc:hsqldb:mem:continuum</value>
+          </property>
+          <property>
+            <name>jdbc.username</name>
+            <value>sa</value>
+          </property>
+          <property>
+            <name>jdbc.password</name>
+            <value></value>
+          </property>
+        </properties>
+      </configuration>
+    </component>
+  </components>
+</plexus>

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties?view=auto&rev=491387
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties (added)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties Sat Dec 30 21:06:47 2006
@@ -0,0 +1,4 @@
+jdbc.driver=org.hsqldb.jdbcDriver
+jdbc.url=jdbc:hsqldb:mem:continuum
+jdbc.username=sa
+jdbc.password=
\ No newline at end of file

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/ibatis-config.properties
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"