continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r693083 - in /continuum/branches/continuum-transient-state: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-cor...
Date Mon, 08 Sep 2008 12:57:43 GMT
Author: ctan
Date: Mon Sep  8 05:57:42 2008
New Revision: 693083

URL: http://svn.apache.org/viewvc?rev=693083&view=rev
Log:
added viewing of scm result

Added:
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/continuum/web/action/ScmResultAction.java
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/webapp/WEB-INF/jsp/scmResult.jsp
Modified:
    continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectScmRootDao.java
    continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
    continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
    continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectScmRootDaoImpl.java
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/xwork.xml

Modified: continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectScmRootDao.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectScmRootDao.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectScmRootDao.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/continuum/dao/ProjectScmRootDao.java
Mon Sep  8 05:57:42 2008
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
 /**
@@ -42,6 +43,9 @@
 
     List<ProjectScmRoot> getProjectScmRootByProjectGroup( int projectGroupId );
 
+    ProjectScmRoot getProjectScmRoot( int projectScmRootId )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException;
+    
     ProjectScmRoot getProjectScmRootByProjectGroupAndScmRootAddress( int projectGroupId,
String scmRootAddress )
         throws ContinuumStoreException;
 }

Modified: continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Mon Sep  8 05:57:42 2008
@@ -667,6 +667,9 @@
     // ----------------------------------------------------------------------
     List<ProjectScmRoot> getProjectScmRootByProjectGroup( int projectGroupId );
 
+    ProjectScmRoot getProjectScmRoot( int projectScmRootId )
+        throws ContinuumException;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Sep  8 05:57:42 2008
@@ -3507,6 +3507,23 @@
         return projectScmRootDao.getProjectScmRootByProjectGroup( projectGroupId );
     }
 
+    public ProjectScmRoot getProjectScmRoot( int projectScmRootId )
+        throws ContinuumException
+    {
+        try
+        {
+            return projectScmRootDao.getProjectScmRoot( projectScmRootId );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            throw new ContinuumException( "No projectScmRoot found with the given id: " +
projectScmRootId );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumException( "Error while retrieving projectScmRoot ", e );
+        }
+    }
+   
     public Map<Integer, Integer> getProjectsAndBuildDefinitionsMap( Collection<Project>
projects, 
                                                                     List<BuildDefinition>
bds,
                                                                     boolean checkDefaultBuildDefinitionForProject
)

Modified: continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/PrepareBuildProjectsTaskExecutor.java
Mon Sep  8 05:57:42 2008
@@ -68,54 +68,59 @@
         Map<Integer, Integer> projectsBuildDefinitionsMap = prepareTask.getProjectsBuildDefinitionsMap();
         Set<Integer> projectsId = projectsBuildDefinitionsMap.keySet();
         Map context = new HashMap();
-        
-        for ( Integer projectId : projectsId )
+
+        try
         {
-            int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
-            
-            getLogger().info( "Initializing prepare build" );
-            context = initializeContext( projectId, buildDefinitionId );
-            
-            getLogger().info( "Starting prepare build of project: " + AbstractContinuumAction.getProject(
context ).getName() );
-            startPrepareBuild( context );
-            
-            if ( !checkProjectScmRoot( context ) )
+            for ( Integer projectId : projectsId )
             {
-                break;
-            }
-            
-            try
-            {
-                if ( AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh()
)
+                int buildDefinitionId = projectsBuildDefinitionsMap.get( projectId );
+                
+                getLogger().info( "Initializing prepare build" );
+                context = initializeContext( projectId, buildDefinitionId );
+                
+                getLogger().info( "Starting prepare build of project: " + AbstractContinuumAction.getProject(
context ).getName() );
+                startPrepareBuild( context );
+                
+                if ( !checkProjectScmRoot( context ) )
                 {
-                    getLogger().info( "Purging existing working copy" );
-                    cleanWorkingDirectory( context );
+                    break;
                 }
                 
-                // ----------------------------------------------------------------------
-                // TODO: Centralize the error handling from the SCM related actions.
-                // ContinuumScmResult should return a ContinuumScmResult from all
-                // methods, even in a case of failure.
-                // ----------------------------------------------------------------------
-                getLogger().info( "Updating working dir" );
-                updateWorkingDirectory( context );
-        
-                getLogger().info( "Merging SCM results" );
-                //CONTINUUM-1393
-                if ( !AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh()
)
+                try
                 {
-                    mergeScmResults( context );
+                    if ( AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh()
)
+                    {
+                        getLogger().info( "Purging existing working copy" );
+                        cleanWorkingDirectory( context );
+                    }
+                    
+                    // ----------------------------------------------------------------------
+                    // TODO: Centralize the error handling from the SCM related actions.
+                    // ContinuumScmResult should return a ContinuumScmResult from all
+                    // methods, even in a case of failure.
+                    // ----------------------------------------------------------------------
+                    getLogger().info( "Updating working dir" );
+                    updateWorkingDirectory( context );
+            
+                    getLogger().info( "Merging SCM results" );
+                    //CONTINUUM-1393
+                    if ( !AbstractContinuumAction.getBuildDefinition( context ).isBuildFresh()
)
+                    {
+                        mergeScmResults( context );
+                    }
+                }
+                finally
+                {
+                    getLogger().info( "Ending prepare build of project: " + AbstractContinuumAction.getProject(
context).getName() );
+                    endProjectPrepareBuild( context );
                 }
-            }
-            finally
-            {
-                getLogger().info( "Ending prepare build of project: " + AbstractContinuumAction.getProject(
context).getName() );
-                endProjectPrepareBuild( context );
             }
         }
-        
-        getLogger().info( "Ending prepare build" );
-        endPrepareBuild( context );
+        finally
+        {
+            getLogger().info( "Ending prepare build" );
+            endPrepareBuild( context );
+        }
     }
     
     private Map initializeContext( int projectId, int buildDefinitionId )

Modified: continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
(original)
+++ continuum/branches/continuum-transient-state/continuum-model/src/main/mdo/continuum.xml
Mon Sep  8 05:57:42 2008
@@ -1487,6 +1487,12 @@
       <packageName>org.apache.continuum.model.project</packageName>
       <fields>
         <field>
+          <name>id</name>
+          <version>1.1.2+</version>
+          <identifier>true</identifier>
+          <type>int</type>
+        </field>
+        <field>
           <name>scmRootAddress</name>
           <version>1.1.2+</version>
           <type>String</type>

Modified: continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectScmRootDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectScmRootDaoImpl.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectScmRootDaoImpl.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-store/src/main/java/org/apache/continuum/dao/ProjectScmRootDaoImpl.java
Mon Sep  8 05:57:42 2008
@@ -9,6 +9,7 @@
 import javax.jdo.Transaction;
 
 import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
 /**
@@ -117,4 +118,9 @@
         }
     }
     
+    public ProjectScmRoot getProjectScmRoot( int projectScmRootId )
+        throws ContinuumObjectNotFoundException, ContinuumStoreException
+    {
+        return (ProjectScmRoot) getObjectById( ProjectScmRoot.class, projectScmRootId );
+    }
 }

Added: continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/continuum/web/action/ScmResultAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/continuum/web/action/ScmResultAction.java?rev=693083&view=auto
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/continuum/web/action/ScmResultAction.java
(added)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/continuum/web/action/ScmResultAction.java
Mon Sep  8 05:57:42 2008
@@ -0,0 +1,103 @@
+package org.apache.continuum.web.action;
+
+import org.apache.continuum.model.project.ProjectScmRoot;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.web.action.ContinuumActionSupport;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.util.StateGenerator;
+import org.codehaus.plexus.util.StringUtils;
+
+import com.opensymphony.webwork.ServletActionContext;
+
+/**
+ * @author <a href="mailto:ctan@apache.org">Maria Catherine Tan</a>
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="scmResult"
+ */
+public class ScmResultAction
+    extends ContinuumActionSupport
+{
+   private int projectGroupId;
+
+   private int projectScmRootId;
+
+   private String projectGroupName;
+
+   private String state;
+
+   private ProjectScmRoot projectScmRoot;
+
+   public String execute()
+       throws Exception
+   {
+       try
+       {
+           checkViewProjectGroupAuthorization( getProjectGroupName() );
+       }
+       catch ( AuthorizationRequiredException e )
+       {
+           return REQUIRES_AUTHORIZATION;
+       }
+
+       projectScmRoot = getContinuum().getProjectScmRoot( projectScmRootId );
+
+       state = StateGenerator.generate( projectScmRoot.getState(), ServletActionContext.getRequest().getContextPath()
);
+       
+       return SUCCESS;
+   }
+
+   public int getProjectGroupId()
+   {
+       return projectGroupId;
+   }
+
+   public void setProjectGroupId( int projectGroupId )
+   {
+       this.projectGroupId = projectGroupId;
+   }
+
+   public int getProjectScmRootId()
+   {
+       return projectScmRootId;
+   }
+
+   public void setProjectScmRootId( int projectScmRootId )
+   {
+       this.projectScmRootId = projectScmRootId;
+   }
+
+   public ProjectScmRoot getProjectScmRoot()
+   {
+       return projectScmRoot;
+   }
+
+   public void setProjectScmRoot( ProjectScmRoot projectScmRoot )
+   {
+       this.projectScmRoot = projectScmRoot;
+   }
+
+   public String getProjectGroupName()
+       throws ContinuumException
+    {
+       if ( StringUtils.isEmpty( projectGroupName ) )
+       {
+           projectGroupName = getContinuum().getProjectGroup( getProjectGroupId() ).getName();
+       }
+    
+       return projectGroupName;
+    }
+   
+   public void setProjectGroupName( String projectGroupName )
+   {
+       this.projectGroupName = projectGroupName;
+   }
+
+   public String getState()
+   {
+       return state;
+   }
+
+   public void setState( String state )
+   {
+       this.state = state;
+   }
+}

Modified: continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Mon Sep  8 05:57:42 2008
@@ -161,10 +161,10 @@
 
             Map<Integer, Integer> projectsBuildDefsMap = getProjectsBuildDefsMap( sortedProjects
);
             
+            getContinuum().prepareBuildProjects( projectsBuildDefsMap );
+            
             for ( Project project : sortedProjects )
             {
-                getContinuum().prepareBuildProjects( projectsBuildDefsMap );
-                
                 if ( this.getBuildDefinitionId() <= 0 )
                 {
                     getContinuum().buildProject( project.getId(), projectsBuildDefsMap.get(
project.getId() ),

Modified: continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
(original)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/java/org/apache/maven/continuum/web/view/StateCell.java
Mon Sep  8 05:57:42 2008
@@ -70,7 +70,8 @@
                 {
                     String state = StateGenerator.generate( project.getState(), tableModel.getContext().getContextPath()
);
     
-                    if ( project.getLatestBuildId() != -1 && !StateGenerator.NEW.equals(
state ) )
+                    if ( project.getLatestBuildId() != -1 && !StateGenerator.NEW.equals(
state ) 
+                         && project.getState() != ContinuumProjectState.UPDATING
)
                     {
                         if ( isAuthorized( project.getProjectGroupName() ) )
                         {
@@ -156,7 +157,7 @@
 
         params.put( "projectGroupId", new Integer( scmRoot.getProjectGroup().getId() ) );
 
-        params.put( "scmRootAddress", scmRoot.getScmRootAddress() );
+        params.put( "projectScmRootId", new Integer( scmRoot.getId() ) );
 
         String url = UrlHelper.buildUrl( "/" + action + ".action", ServletActionContext.getRequest(),

                                          ServletActionContext.getResponse(), params );

Modified: continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/localization/Continuum.properties
Mon Sep  8 05:57:42 2008
@@ -894,3 +894,13 @@
 purgeConfig.description.label = Description
 purgeConfig.enabled.label = Enabled
 purgeConfig.no.repositories = No repositories to purge
+
+# ----------------------------------------------------------------------
+# Page: ScmResult
+# ----------------------------------------------------------------------
+scmResult.page.title = Continuum - SCM result
+scmResult.section.title = SCM result
+scmResult.state = State
+scmResult.projectGroupName = Project Group Name
+scmResult.scmRootAddress = SCM Root URL
+scmResult.scmError = SCM Error
\ No newline at end of file

Modified: continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/xwork.xml?rev=693083&r1=693082&r2=693083&view=diff
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/xwork.xml
(original)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/resources/xwork.xml
Mon Sep  8 05:57:42 2008
@@ -404,6 +404,10 @@
       </result>
     </action>
 
+    <action name="scmResult" class="scmResult">
+      <result name="success">/WEB-INF/jsp/scmResult.jsp</result>
+    </action>
+    
     <!--
     * schedule actions
     -->

Added: continuum/branches/continuum-transient-state/continuum-webapp/src/main/webapp/WEB-INF/jsp/scmResult.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-transient-state/continuum-webapp/src/main/webapp/WEB-INF/jsp/scmResult.jsp?rev=693083&view=auto
==============================================================================
--- continuum/branches/continuum-transient-state/continuum-webapp/src/main/webapp/WEB-INF/jsp/scmResult.jsp
(added)
+++ continuum/branches/continuum-transient-state/continuum-webapp/src/main/webapp/WEB-INF/jsp/scmResult.jsp
Mon Sep  8 05:57:42 2008
@@ -0,0 +1,56 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib prefix="c1" uri="continuum" %>
+<html>
+  <ww:i18n name="localization.Continuum">
+    <head>
+        <title><ww:text name="scmResult.page.title"/></title>
+    </head>
+    <body>
+      <div id="h3">
+
+        <ww:action name="projectGroupTab" executeResult="true"/>
+
+        <h3>
+            <ww:text name="scmResult.section.title"/>
+        </h3>
+        
+        <div class="axial">
+          <table border="1" cellspacing="2" cellpadding="3" width="100%">
+            <c1:data label="%{getText('scmResult.projectGroupName')}">
+                <ww:param name="after" value="projectGroupName"/>
+            </c1:data>
+            <c1:data label="%{getText('scmResult.scmRootAddress')}">
+                <ww:param name="after" value="projectScmRoot.scmRootAddress"/>
+            </c1:data>
+            <c1:data label="%{getText('scmResult.state')}">
+                <ww:param name="after" value="state"/>
+            </c1:data>
+          </table>
+        </div>
+        
+        <h4><ww:text name="scmResult.scmError"/></h4>
+        <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width:
1px">
+          <pre><ww:property value="projectScmRoot.error"/></pre>
+        </div>
+      </div>
+    </body>
+  </ww:i18n>
+</html>
\ No newline at end of file



Mime
View raw message