continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r219443 - in /maven/continuum/trunk: continuum-core-it/src/test/java/org/apache/maven/continuum/it/ continuum-core/src/main/java/org/apache/maven/continuum/core/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum...
Date Mon, 18 Jul 2005 02:39:25 GMT
Author: trygvis
Date: Sun Jul 17 19:39:16 2005
New Revision: 219443

URL: http://svn.apache.org/viewcvs?rev=219443&view=rev
Log:
o Switching to the hand made JDO store.

Added:
    maven/continuum/trunk/continuum-model/src/main/resources/META-INF/
    maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo
Modified:
    maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
    maven/continuum/trunk/continuum-model/pom.xml
    maven/continuum/trunk/continuum-plexus-application/pom.xml

Modified: maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
(original)
+++ maven/continuum/trunk/continuum-core-it/src/test/java/org/apache/maven/continuum/it/AbstractIntegrationTest.java
Sun Jul 17 19:39:16 2005
@@ -35,6 +35,7 @@
 
 import org.apache.maven.continuum.xmlrpc.XmlRpcHelper;
 import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.scm.ScmResult;
 import org.apache.maven.continuum.scm.ScmFile;
 import org.apache.maven.continuum.project.ContinuumProject;
@@ -135,6 +136,7 @@
         line();
         print( "IT root: " + rootDirectory.getAbsolutePath() );
         print( "Remoting method: " + remotingMethod );
+        print( "Store implementation: " + lookup( ContinuumStore.ROLE ).getClass() );
         line();
 
         deleteAndCreateDirectory( rootDirectory );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/DefaultContinuumCore.java
Sun Jul 17 19:39:16 2005
@@ -214,6 +214,8 @@
     {
         try
         {
+            project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments()
) );
+
             store.updateProject( project );
         }
         catch ( ContinuumStoreException ex )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
Sun Jul 17 19:39:16 2005
@@ -9,6 +9,8 @@
 import java.io.File;
 import java.util.Map;
 
+import org.codehaus.plexus.util.StringUtils;
+
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
@@ -47,6 +49,8 @@
         // figure out what it is.
 
         project.setWorkingDirectory( projectWorkingDirectory.getAbsolutePath() );
+
+        project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments()
) );
 
         getStore().updateProject( project );
     }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Sun Jul 17 19:39:16 2005
@@ -163,19 +163,21 @@
 
             query.declareParameters( "String name" );
 
-            query.setFilter( "this.name = name" );
+            query.setFilter( "this.name == name" );
 
             Collection result = ( (Collection) query.execute( name ) );
 
-            commit( tx );
-
             if ( result.size() == 0 )
             {
+                commit( tx );
+
                 return null;
             }
 
             Object object = pm.detachCopy( result.iterator().next() );
 
+            commit( tx );
+
             return (ContinuumProject) object;
         }
         finally
@@ -201,19 +203,21 @@
 
             query.declareParameters( "String scmUrl" );
 
-            query.setFilter( "this.scmUrl = scmUrl" );
+            query.setFilter( "this.scmUrl == scmUrl" );
 
             Collection result = ( (Collection) query.execute( scmUrl ) );
 
-            commit( tx );
-
             if ( result.size() == 0 )
             {
+                commit( tx );
+
                 return null;
             }
 
             Object object = pm.detachCopy( result.iterator().next() );
 
+            commit( tx );
+
             return (ContinuumProject) object;
         }
         finally
@@ -254,8 +258,33 @@
     public ScmResult getScmResultForProject( String projectId )
         throws ContinuumStoreException
     {
-        // TODO:
-        throw new UnsupportedOperationException();
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            ContinuumProject project = getContinuumProject( pm, projectId );
+
+            ScmResult scmResult = project.getScmResult();
+
+            if ( scmResult == null )
+            {
+                return null;
+            }
+
+            scmResult = (ScmResult) pm.detachCopy( scmResult );
+
+            commit( tx );
+
+            return scmResult;
+        }
+        finally
+        {
+            rollback( tx );
+        }
     }
 
     public String addBuild( String projectId, ContinuumBuild build )
@@ -400,22 +429,45 @@
     public List getChangedFilesForBuild( String buildId )
         throws ContinuumStoreException
     {
-        // TODO:
-        throw new UnsupportedOperationException();
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            ContinuumBuild build  = getContinuumBuild( pm, buildId );
+
+            ScmResult scmResult = build.getScmResult();
+
+            if ( scmResult == null )
+            {
+                return null;
+            }
+
+            List files = (List) pm.detachCopyAll( scmResult.getFiles() );
+
+            commit( tx );
+
+            return files;
+        }
+        finally
+        {
+            rollback( tx );
+        }
     }
 
     public void removeNotifier( Object notifier )
         throws ContinuumStoreException
     {
-        // TODO:
-        throw new UnsupportedOperationException();
+        attachAndDelete( notifier );
     }
 
     public void storeNotifier( Object notifier )
         throws ContinuumStoreException
     {
-        // TODO:
-        throw new UnsupportedOperationException();
+        updateObject( notifier );
     }
 
     // ----------------------------------------------------------------------
@@ -468,6 +520,28 @@
         Object id = pm.getObjectId( object );
 
         return pm.getObjectById( id );
+    }
+
+    private void attachAndDelete( Object object )
+    {
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        try
+        {
+            tx.begin();
+
+            pm.attachCopy( object, true );
+
+            pm.deletePersistent( object );
+
+            commit( tx );
+        }
+        finally
+        {
+            rollback( tx );
+        }
     }
 
     private void deletePersistentById( Class clazz, Object identifier )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
Sun Jul 17 19:39:16 2005
@@ -115,8 +115,6 @@
             store.deleteContinuumProject( projectId );
 
             store.commit();
-
-            getLogger().info( "Removed project with id '" + projectId + "'." );
         }
         catch ( Exception e )
         {
@@ -131,8 +129,6 @@
     {
         try
         {
-            project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments()
) );
-
             store.storeContinuumProject( project );
 
             project = store.getContinuumProject( project.getId(), true );

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Sun Jul 17 19:39:16 2005
@@ -117,6 +117,19 @@
 
     <component>
       <role>org.apache.maven.continuum.store.ContinuumStore</role>
+      <implementation>org.apache.maven.continuum.store.JdoContinuumStore</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.jdo.JdoFactory</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <!-- TODO: Remove these two once the plexus bug where plexus would pick
+         the first component with role hint if no component without a role hint exists
+         and was looked up -->
+    <component>
+      <role>ContinuumStore</role>
       <role-hint>modello</role-hint>
       <implementation>org.apache.maven.continuum.store.ModelloJPoxContinuumStore</implementation>
       <requirements>
@@ -127,7 +140,7 @@
     </component>
 
     <component>
-      <role>org.apache.maven.continuum.store.ContinuumStore</role>
+      <role>ContinuumStore</role>
       <role-hint>jdo</role-hint>
       <implementation>org.apache.maven.continuum.store.JdoContinuumStore</implementation>
       <requirements>

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/AbstractContinuumTest.java
Sun Jul 17 19:39:16 2005
@@ -53,7 +53,7 @@
     protected ContinuumStore getStore()
         throws Exception
     {
-        return (ContinuumStore) lookup( ContinuumStore.ROLE, "jdo" );
+        return (ContinuumStore) lookup( ContinuumStore.ROLE );
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTest.java
Sun Jul 17 19:39:16 2005
@@ -63,7 +63,7 @@
     {
         super.setUp();
 
-        store = (ContinuumStore) lookup( ContinuumStore.ROLE, roleHint );
+        store = (ContinuumStore) lookup( "ContinuumStore", roleHint );
 
         assertEquals( implementationClass, store.getClass() );
 
@@ -152,7 +152,7 @@
 
         assertNotNull( project );
 
-        assertEquals( projectId, project );
+        assertEquals( projectId, project.getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -162,7 +162,7 @@
 
         assertNotNull( project );
 
-        assertEquals( projectId, project );
+        assertEquals( projectId, project.getId() );
 
         // ----------------------------------------------------------------------
         //
@@ -172,7 +172,7 @@
 
         assertNotNull( project );
 
-        assertEquals( projectId, project );
+        assertEquals( projectId, project.getId() );
 
         // ----------------------------------------------------------------------
         //

Modified: maven/continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/pom.xml?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/pom.xml (original)
+++ maven/continuum/trunk/continuum-model/pom.xml Sun Jul 17 19:39:16 2005
@@ -43,7 +43,9 @@
             <id>foo</id>
             <goals>
               <goal>java</goal>
+              <!--
               <goal>jpox-jdo-mapping</goal>
+              -->
               <goal>jpox-store</goal>
             </goals>
           </execution>

Added: maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo?rev=219443&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo (added)
+++ maven/continuum/trunk/continuum-model/src/main/resources/META-INF/package.jdo Sun Jul
17 19:39:16 2005
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jdo PUBLIC
+  "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN"
+  "http://java.sun.com/dtd/jdo_2_0.dtd">
+
+<jdo>
+  <package name="org.apache.maven.continuum.project">
+    <class name="ContinuumProject" detachable="true" identity-type="application">
+      <field name="id" persistence-modifier="persistent" null-value="exception" primary-key="true"
value-strategy="native"/>
+      <field name="name" persistence-modifier="persistent"/>
+      <field name="scmUrl" persistence-modifier="persistent"/>
+      <field name="version" persistence-modifier="persistent"/>
+      <field name="workingDirectory" persistence-modifier="persistent"/>
+      <field name="state" persistence-modifier="none"/>
+      <field name="executorId" persistence-modifier="persistent"/>
+      <field name="latestBuildId" persistence-modifier="persistent"/>
+      <field name="previousBuildId" persistence-modifier="persistent"/>
+      <field name="buildNumber" persistence-modifier="persistent"/>
+      <field name="builds" persistence-modifier="persistent">
+        <collection element-type="ContinuumBuild" dependent-element="true"/>
+      </field>
+      <field name="scmResult" persistence-modifier="persistent" default-fetch-group="true"
dependent="true"/>
+      <field name="checkOutErrorMessage" persistence-modifier="persistent"/>
+      <field name="checkOutErrorException" persistence-modifier="persistent"/>
+      <field name="mailType" persistence-modifier="persistent"/>
+      <field name="commandLineArguments" persistence-modifier="persistent"/>
+      <field name="url" persistence-modifier="persistent"/>
+      <field name="artifactId" persistence-modifier="persistent"/>
+      <field name="groupId" persistence-modifier="persistent"/>
+      <field name="testOutputDirectory" persistence-modifier="persistent"/>
+      <field name="developers" persistence-modifier="persistent" default-fetch-group="true">
+        <collection element-type="ContinuumDeveloper" dependent-element="true"/>
+      </field>
+      <field name="notifiers" persistence-modifier="persistent" default-fetch-group="true">
+        <collection element-type="ContinuumNotifier" dependent-element="true"/>
+      </field>
+      <field name="dependencies" persistence-modifier="persistent" default-fetch-group="true">
+        <collection element-type="ContinuumDependency" dependent-element="true"/>
+      </field>
+    </class>
+    <class name="ContinuumNotifier" detachable="true" identity-type="datastore">
+      <field name="type" persistence-modifier="persistent"/>
+      <field name="configuration" persistence-modifier="persistent" default-fetch-group="true">
+        <map key-type="java.lang.String" value-type="String" dependent-key="true" dependent-value="true"/>
+        <join/>
+      </field>
+    </class>
+    <class name="ContinuumDeveloper" detachable="true" identity-type="application">
+      <field name="id" persistence-modifier="persistent" primary-key="true" value-strategy="native"/>
+      <field name="name" persistence-modifier="persistent"/>
+      <field name="email" persistence-modifier="persistent"/>
+    </class>
+    <class name="ContinuumDependency" detachable="true" identity-type="datastore">
+      <field name="groupId" persistence-modifier="persistent"/>
+      <field name="artifactId" persistence-modifier="persistent"/>
+      <field name="version" persistence-modifier="persistent"/>
+    </class>
+    <class name="MavenTwoProject" persistence-capable-superclass="org.apache.maven.continuum.project.ContinuumProject"
detachable="true">
+      <inheritance strategy="new-table"/>
+      <field name="goals" persistence-modifier="persistent"/>
+    </class>
+    <class name="MavenOneProject" persistence-capable-superclass="org.apache.maven.continuum.project.ContinuumProject"
detachable="true">
+      <inheritance strategy="new-table"/>
+      <field name="goals" persistence-modifier="persistent"/>
+    </class>
+    <class name="AntProject" persistence-capable-superclass="org.apache.maven.continuum.project.ContinuumProject"
detachable="true">
+      <inheritance strategy="new-table"/>
+      <field name="executable" persistence-modifier="persistent"/>
+      <field name="targets" persistence-modifier="persistent"/>
+    </class>
+    <class name="ShellProject" persistence-capable-superclass="org.apache.maven.continuum.project.ContinuumProject"
detachable="true">
+      <inheritance strategy="new-table"/>
+      <field name="executable" persistence-modifier="persistent"/>
+    </class>
+    <class name="ContinuumBuild" detachable="true" identity-type="application">
+      <field name="project" persistence-modifier="persistent" null-value="exception" default-fetch-group="false"/>
+      <field name="id" persistence-modifier="persistent" primary-key="true" value-strategy="native"/>
+      <field name="state" persistence-modifier="persistent"/>
+      <field name="forced" persistence-modifier="persistent"/>
+      <field name="startTime" persistence-modifier="persistent"/>
+      <field name="endTime" persistence-modifier="persistent"/>
+      <field name="error" persistence-modifier="persistent">
+        <extension vendor-name="jpox" key="length" value="max 8000"/>
+      </field>
+      <field name="success" persistence-modifier="persistent"/>
+      <field name="standardOutput" persistence-modifier="persistent">
+        <extension vendor-name="jpox" key="length" value="max 8000"/>
+      </field>
+      <field name="standardError" persistence-modifier="persistent">
+        <extension vendor-name="jpox" key="length" value="max 8000"/>
+      </field>
+      <field name="exitCode" persistence-modifier="persistent"/>
+      <field name="scmResult" persistence-modifier="persistent" default-fetch-group="true"
dependent="true"/>
+    </class>
+  </package>
+  <package name="org.apache.maven.continuum.scm">
+    <class name="ScmResult" detachable="true" identity-type="datastore">
+      <field name="success" persistence-modifier="persistent"/>
+      <field name="providerMessage" persistence-modifier="persistent"/>
+      <field name="commandOutput" persistence-modifier="persistent"/>
+      <field name="files" persistence-modifier="persistent" default-fetch-group="true">
+        <collection element-type="ScmFile" dependent-element="true"/>
+      </field>
+      <field name="changes" persistence-modifier="persistent" default-fetch-group="true">
+        <collection element-type="ChangeSet" dependent-element="true"/>
+      </field>
+    </class>
+    <class name="ScmFile" detachable="true" identity-type="datastore">
+      <field name="path" persistence-modifier="persistent"/>
+    </class>
+    <class name="ChangeSet" detachable="true" identity-type="datastore">
+      <field name="author" persistence-modifier="persistent"/>
+      <field name="comment" persistence-modifier="persistent"/>
+      <field name="date" persistence-modifier="persistent"/>
+      <field name="file" persistence-modifier="persistent" default-fetch-group="true"
dependent="true"/>
+    </class>
+    <class name="ChangeFile" detachable="true" identity-type="datastore">
+      <field name="name" persistence-modifier="persistent"/>
+      <field name="revision" persistence-modifier="persistent"/>
+    </class>
+  </package>
+</jdo>

Modified: maven/continuum/trunk/continuum-plexus-application/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-plexus-application/pom.xml?rev=219443&r1=219442&r2=219443&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-plexus-application/pom.xml (original)
+++ maven/continuum/trunk/continuum-plexus-application/pom.xml Sun Jul 17 19:39:16 2005
@@ -163,7 +163,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plexus-plugin</artifactId>
-        <version>1.0-alpha-6-SNAPSHOT</version>
         <configuration>
           <applicationConfiguration>src/conf/application.xml</applicationConfiguration>
           <configurationsDirectory>src/conf</configurationsDirectory>
@@ -173,7 +172,6 @@
           <runtimeConfigurationProperties>app.properties</runtimeConfigurationProperties>
           <runtimePath>target/plexus-test-runtime</runtimePath>
         </configuration>
-<!--
         <executions>
           <execution>
             <goals>
@@ -183,7 +181,6 @@
             </goals>
           </execution>
         </executions>
--->
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>



Mime
View raw message