You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by tr...@apache.org on 2005/07/04 15:52:50 UTC
svn commit: r209078 - in /maven/continuum/trunk:
continuum-api/src/main/java/org/apache/maven/continuum/
continuum-core/src/main/java/org/apache/maven/continuum/
continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/
continuum-core/sr...
Author: trygvis
Date: Mon Jul 4 06:52:47 2005
New Revision: 209078
URL: http://svn.apache.org/viewcvs?rev=209078&view=rev
Log:
Fixing: CONTINUUM-191
o Cleaning up the web templates a bit.
- Making sure that errors are properly shown.
- Moving checkout errors to the project view template.
o Splitting up the "checkout project" action into "checkout project" and "store
checkout result".
Added:
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java (with props)
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
- copied, changed from r208961, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckOutProjectContinuumAction.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java (with props)
Removed:
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckOutProjectContinuumAction.java
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.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-web/src/main/resources/META-INF/plexus/components.xml
maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm
maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuilds.vm
maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm
Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java Mon Jul 4 06:52:47 2005
@@ -43,9 +43,6 @@
void removeProject( String projectId )
throws ContinuumException;
- boolean isBuilding( String id )
- throws ContinuumException;
-
void checkoutProject( String id )
throws ContinuumException;
@@ -68,6 +65,13 @@
throws ContinuumException;
ContinuumBuild getLatestBuildForProject( String id )
+ throws ContinuumException;
+
+ // ----------------------------------------------------------------------
+ // Queues
+ // ----------------------------------------------------------------------
+
+ boolean isInBuildingQueue( String id )
throws ContinuumException;
// ----------------------------------------------------------------------
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Mon Jul 4 06:52:47 2005
@@ -122,19 +122,23 @@
}
// ----------------------------------------------------------------------
- //
+ // Queues
// ----------------------------------------------------------------------
- public void removeProject( String projectId )
+ public boolean isInBuildingQueue( String id )
throws ContinuumException
{
- core.removeProject( projectId );
+ return core.isBuilding( id );
}
- public boolean isBuilding( String id )
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public void removeProject( String projectId )
throws ContinuumException
{
- return core.isBuilding( id );
+ core.removeProject( projectId );
}
public void checkoutProject( String id )
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java Mon Jul 4 06:52:47 2005
@@ -20,6 +20,7 @@
import java.io.StringWriter;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.apache.maven.continuum.core.action.AbstractContinuumAction;
@@ -27,12 +28,15 @@
import org.apache.maven.continuum.project.ContinuumBuild;
import org.apache.maven.continuum.project.ContinuumProject;
import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.scm.CheckOutScmResult;
+import org.apache.maven.continuum.scm.ScmFile;
import org.apache.maven.continuum.scm.UpdateScmResult;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.action.ActionManager;
import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -99,7 +103,73 @@
try
{
- actionManager.lookup( "update-working-directory-from-scm" ).execute( actionContext );
+ actionManager.lookup( "check-working-directory" ).execute( actionContext );
+
+ boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext, AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS );
+
+ if ( workingDirectoryExists )
+ {
+ actionManager.lookup( "update-working-directory-from-scm" ).execute( actionContext );
+ }
+ else
+ {
+ actionContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY, project.getWorkingDirectory() );
+
+ actionManager.lookup( "checkout-project" ).execute( actionContext );
+
+ CheckOutScmResult checkOutScmResult = AbstractContinuumAction.getCheckoutResult( actionContext );
+
+ String checkoutErrorMessage = AbstractContinuumAction.getCheckoutErrorMessage( actionContext );
+
+ String checkoutErrorException = AbstractContinuumAction.getCheckoutErrorException( actionContext );
+
+ // ----------------------------------------------------------------------
+ // Check to see if there was a error while checking out the project
+ // ----------------------------------------------------------------------
+
+ // TODO: remove once CONTINUUM-193 is resolved
+ if ( StringUtils.isEmpty( checkoutErrorMessage ) && StringUtils.isEmpty( checkoutErrorException ) )
+ {
+ UpdateScmResult updateScmResult = new UpdateScmResult();
+
+ updateScmResult.setCommandOutput( checkOutScmResult.getCommandOutput() );
+
+ updateScmResult.setProviderMessage( checkOutScmResult.getProviderMessage() );
+
+ updateScmResult.setSuccess( checkOutScmResult.isSuccess() );
+
+ for ( Iterator it = checkOutScmResult.getCheckedOutFiles().iterator(); it.hasNext(); )
+ {
+ ScmFile scmFile = (ScmFile) it.next();
+
+ updateScmResult.getUpdatedFiles().add( scmFile );
+ }
+
+ actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, updateScmResult );
+ }
+ else
+ {
+ ContinuumBuild build = makeBuildResult( scmResult, startTime, forced );
+
+ String error = "";
+
+ if ( !StringUtils.isEmpty( checkoutErrorMessage ) )
+ {
+ error = checkoutErrorMessage + System.getProperty( "line.separator" );
+ }
+
+ if ( !StringUtils.isEmpty( checkoutErrorException ) )
+ {
+ error += checkoutErrorException;
+ }
+
+ build.setError( error );
+
+ buildId = storeBuild( project, build );
+
+ return;
+ }
+ }
scmResult = (UpdateScmResult) actionContext.get( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT );
@@ -111,10 +181,13 @@
}
catch ( Throwable e )
{
- buildId = makeAndSetErrorBuildResult( store.getProject( projectId ),
- scmResult,
- startTime,
- forced, e );
+ getLogger().error( "Error while building project.", e );
+
+ ContinuumBuild build = makeBuildResult( scmResult, startTime, forced );
+
+ build.setError( throwableToString( e ) );
+
+ buildId = storeBuild( project, build );
}
/////////////////////// This section should delegate to UpdateWorkingDirectoryFromScmContinuumAction
@@ -222,7 +295,7 @@
{
getLogger().fatalError( "Error while updating from SCM. Project id '" + context.project.getId() + "'." );
- makeAndSetErrorBuildResult( context, e );
+ makeAndStoreErrorBuildResult( context, e );
return false;
}
@@ -250,7 +323,7 @@
{
getLogger().fatalError( "Error while updating project metadata from check out.", e );
- makeAndSetErrorBuildResult( context, e );
+ makeAndStoreErrorBuildResult( context, e );
return false;
}
@@ -287,7 +360,7 @@
{
getLogger().fatalError( "Error building the project, project id: '" + context.project.getId() + "'.", ex );
- makeAndSetErrorBuildResult( context, ex );
+ makeAndStoreErrorBuildResult( context, ex );
}
finally
{
@@ -299,15 +372,20 @@
//
// ----------------------------------------------------------------------
- private String makeAndSetErrorBuildResult( ContinuumProject project,
- UpdateScmResult scmResult,
- long startTime,
- boolean forced,
- Throwable e )
+ private String storeBuild( ContinuumProject project, ContinuumBuild build )
throws ContinuumStoreException
{
- getLogger().error( "Error while building project.", e );
+ String buildId = store.addBuild( project.getId(), build );
+
+ getLogger().info( "Build id: '" + buildId + "'." );
+ return buildId;
+ }
+
+ private ContinuumBuild makeBuildResult( UpdateScmResult scmResult,
+ long startTime,
+ boolean forced )
+ {
ContinuumBuild build = new ContinuumBuild();
build.setState( ContinuumProjectState.ERROR );
@@ -318,17 +396,11 @@
build.setEndTime( System.currentTimeMillis() );
- build.setError( throwableToString( e ) );
-
build.setSuccess( false );
build.setUpdateScmResult( scmResult );
- String buildId = store.addBuild( project.getId(), build );
-
- getLogger().info( "Build id: '" + buildId + "'." );
-
- return buildId;
+ return build;
}
// Check to see if there is only a single build in the builds list.
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AbstractContinuumAction.java Mon Jul 4 06:52:47 2005
@@ -47,17 +47,23 @@
// Keys for the values that can be in the context
// ----------------------------------------------------------------------
- public final static String KEY_PROJECT_ID = "projectId";
+ public final static String KEY_PROJECT_ID = "project-id";
- public final static String KEY_UNVALIDATED_PROJECT = "unvalidatedProject";
+ public final static String KEY_UNVALIDATED_PROJECT = "unvalidated-project";
- public final static String KEY_BUILD_ID = "buildId";
+ public final static String KEY_BUILD_ID = "build-id";
- public static final String KEY_WORKING_DIRECTORY = "workingDirectory";
+ public static final String KEY_WORKING_DIRECTORY = "working-directory";
- public static final String KEY_CHECKOUT_SCM_RESULT = "checkOutResult";
+ public static final String KEY_WORKING_DIRECTORY_EXISTS = "working-directory-exists";
- public static final String KEY_UPDATE_SCM_RESULT = "updateResult";
+ public static final String KEY_CHECKOUT_SCM_RESULT = "checkout-result";
+
+ public static final String KEY_CHECKOUT_ERROR_MESSAGE = "checkout-error-message";
+
+ public static final String KEY_CHECKOUT_ERROR_EXCEPTION = "checkout-error-exception";
+
+ public static final String KEY_UPDATE_SCM_RESULT = "update-result";
public static final String KEY_FORCED = "forced";
@@ -137,20 +143,19 @@
//
// ----------------------------------------------------------------------
- public String getProjectId( Map context )
+ public static String getProjectId( Map context )
{
return getString( context, KEY_PROJECT_ID );
}
- public String getBuildId( Map context )
+ public static String getBuildId( Map context )
{
return getString( context, KEY_BUILD_ID );
}
- protected boolean isForced( Map context )
- throws ContinuumStoreException
+ public static boolean isForced( Map context )
{
- return ((Boolean) getObject( context, KEY_FORCED )).booleanValue();
+ return getBoolean( context, KEY_FORCED );
}
protected ContinuumProject getProject( Map context )
@@ -159,8 +164,7 @@
return getStore().getProject( getProjectId( context ) );
}
- protected ContinuumProject getUnvalidatedProject( Map context )
- throws ContinuumStoreException
+ public static ContinuumProject getUnvalidatedProject( Map context )
{
return ((ContinuumProject) getObject( context, KEY_UNVALIDATED_PROJECT ) );
}
@@ -171,22 +175,32 @@
return getStore().getBuild( getBuildId( context ) );
}
- protected File getWorkingDirectory( Map context )
+ public static File getWorkingDirectory( Map context )
{
return new File( getString( context, KEY_WORKING_DIRECTORY ) );
}
- protected CheckOutScmResult getCheckOutResult( Map context )
+ public static CheckOutScmResult getCheckoutResult( Map context )
{
return (CheckOutScmResult) getObject( context, KEY_CHECKOUT_SCM_RESULT );
}
- protected UpdateScmResult getUpdateScmResult( Map context )
+ public static String getCheckoutErrorMessage( Map context )
+ {
+ return getString( context, KEY_CHECKOUT_ERROR_MESSAGE );
+ }
+
+ public static String getCheckoutErrorException( Map context )
+ {
+ return getString( context, KEY_CHECKOUT_ERROR_EXCEPTION );
+ }
+
+ public static UpdateScmResult getUpdateScmResult( Map context )
{
return (UpdateScmResult) getObject( context, KEY_UPDATE_SCM_RESULT );
}
- protected UpdateScmResult getUpdateScmResult( Map context, UpdateScmResult defaultValue )
+ public static UpdateScmResult getUpdateScmResult( Map context, UpdateScmResult defaultValue )
{
return (UpdateScmResult) getObject( context, KEY_UPDATE_SCM_RESULT, defaultValue );
}
@@ -195,12 +209,17 @@
//
// ----------------------------------------------------------------------
- protected String getString( Map context, String key )
+ protected static String getString( Map context, String key )
{
return (String) context.get( key );
}
- private Object getObject( Map context, String key )
+ public static boolean getBoolean( Map context, String key )
+ {
+ return ( (Boolean) getObject( context, key ) ).booleanValue();
+ }
+
+ private static Object getObject( Map context, String key )
{
Object value = context.get( key );
@@ -212,7 +231,7 @@
return value;
}
- private Object getObject( Map context, String key, Object defaultValue )
+ private static Object getObject( Map context, String key, Object defaultValue )
{
Object value = context.get( key );
Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java?rev=209078&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java (added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java Mon Jul 4 06:52:47 2005
@@ -0,0 +1,40 @@
+package org.apache.maven.continuum.core.action;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.maven.continuum.project.ContinuumProject;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class CheckWorkingDirectoryAction
+ extends AbstractContinuumAction
+{
+ public void execute( Map context )
+ throws Exception
+ {
+ ContinuumProject project = getProject( context );
+
+ File workingDirectory = new File( project.getWorkingDirectory() );
+
+ context.put( KEY_WORKING_DIRECTORY_EXISTS, Boolean.valueOf( workingDirectory.exists() ) );
+ }
+}
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckWorkingDirectoryAction.java
------------------------------------------------------------------------------
svn:keywords = Id
Copied: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java (from r208961, maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckOutProjectContinuumAction.java)
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?p2=maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java&p1=maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckOutProjectContinuumAction.java&r1=208961&r2=209078&rev=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckOutProjectContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java Mon Jul 4 06:52:47 2005
@@ -16,32 +16,26 @@
* limitations under the License.
*/
+import java.io.File;
+import java.util.Map;
+
import org.apache.maven.continuum.project.ContinuumProject;
import org.apache.maven.continuum.scm.CheckOutScmResult;
import org.apache.maven.continuum.scm.ContinuumScmException;
import org.apache.maven.continuum.store.AbstractContinuumStore;
-import org.apache.maven.continuum.store.ContinuumStoreException;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
-import java.io.File;
-import java.util.Map;
-
-import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
-
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @version $Id$
*/
-public class CheckOutProjectContinuumAction
+public class CheckoutProjectContinuumAction
extends AbstractContinuumAction
{
public void execute( Map context )
throws Exception
{
- String projectId = getProjectId( context );
-
- // TODO: just make this get project and hide the store
- ContinuumProject project = getStore().getProject( projectId );
+ ContinuumProject project = getProject( context );
File workingDirectory = getWorkingDirectory( context );
@@ -79,30 +73,13 @@
}
// ----------------------------------------------------------------------
- // Store the check out result or error
+ // Store the result in the context
// ----------------------------------------------------------------------
- try
- {
- project = getStore().getProject( projectId );
-
- project.setCheckOutScmResult( result );
-
- project.setCheckOutErrorMessage( nullIfEmpty( errorMessage ) );
-
- project.setCheckOutErrorException( nullIfEmpty( AbstractContinuumStore.throwableToString( exception ) ) );
-
- getStore().updateProject( project );
- }
- catch ( ContinuumStoreException e )
- {
- throw new TaskExecutionException( "Error while storing the check out result.", e );
- }
+ context.put( KEY_CHECKOUT_SCM_RESULT, result );
- // ----------------------------------------------------------------------
- // Safe the result in the context
- // ----------------------------------------------------------------------
+ context.put( KEY_CHECKOUT_ERROR_MESSAGE, errorMessage );
- context.put( KEY_CHECKOUT_SCM_RESULT, result );
+ context.put( KEY_CHECKOUT_ERROR_EXCEPTION, AbstractContinuumStore.throwableToString( exception ) );
}
}
Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java?rev=209078&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java (added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java Mon Jul 4 06:52:47 2005
@@ -0,0 +1,54 @@
+package org.apache.maven.continuum.core.action;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import java.util.Map;
+
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.store.AbstractContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import org.codehaus.plexus.taskqueue.execution.TaskExecutionException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class StoreCheckOutScmResultAction
+ extends AbstractContinuumAction
+{
+ public void execute( Map context )
+ throws Exception
+ {
+ try
+ {
+ ContinuumProject project = getProject( context );
+
+ project.setCheckOutScmResult( getCheckoutResult( context ) );
+
+ project.setCheckOutErrorMessage( nullIfEmpty( getCheckoutErrorMessage( context ) ) );
+
+ project.setCheckOutErrorException( nullIfEmpty( getCheckoutErrorException( context ) ) );
+
+ getStore().updateProject( project );
+ }
+ catch ( ContinuumStoreException e )
+ {
+ throw new TaskExecutionException( "Error while storing the checkout result.", e );
+ }
+ }
+}
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreCheckOutScmResultAction.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromWorkingDirectoryContinuumAction.java Mon Jul 4 06:52:47 2005
@@ -20,8 +20,6 @@
import java.io.File;
import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
-import org.apache.maven.continuum.execution.ContinuumBuildExecutorException;
-import org.apache.maven.continuum.store.ContinuumStoreException;
import org.apache.maven.continuum.project.ContinuumProject;
/**
@@ -36,7 +34,7 @@
{
ContinuumProject project = getProject( context );
- getLogger().info( "Updating project '" + project.getName() + "'." );
+ getLogger().info( "Updating project '" + project.getName() + "' from checkout." );
// ----------------------------------------------------------------------
// Make a new descriptor
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java Mon Jul 4 06:52:47 2005
@@ -36,7 +36,7 @@
extends AbstractLogEnabled
implements ContinuumScm
{
- /** @requirement */
+ /** @plexus.requirement */
private ScmManager scmManager;
// ----------------------------------------------------------------------
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/queue/CheckOutTaskExecutor.java Mon Jul 4 06:52:47 2005
@@ -16,11 +16,10 @@
* limitations under the License.
*/
-import java.io.File;
import java.util.HashMap;
import java.util.Map;
-import org.apache.maven.continuum.core.action.CheckOutProjectContinuumAction;
+import org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction;
import org.codehaus.plexus.action.ActionManager;
import org.codehaus.plexus.logging.AbstractLogEnabled;
@@ -54,13 +53,15 @@
Map context = new HashMap();
- context.put( CheckOutProjectContinuumAction.KEY_PROJECT_ID, projectId );
+ context.put( CheckoutProjectContinuumAction.KEY_PROJECT_ID, projectId );
- context.put( CheckOutProjectContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
+ context.put( CheckoutProjectContinuumAction.KEY_WORKING_DIRECTORY, workingDirectory );
try
{
actionManager.lookup( "checkout-project" ).execute( context );
+
+ actionManager.lookup( "store-checkout-scm-result" ).execute( context );
}
catch ( Exception e )
{
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=209078&r1=209077&r2=209078&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 Mon Jul 4 06:52:47 2005
@@ -20,6 +20,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Collections;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
@@ -418,6 +419,11 @@
store.begin();
ContinuumBuild build = store.getContinuumBuild( buildId, false );
+
+ if ( build.getUpdateScmResult() == null )
+ {
+ return Collections.EMPTY_LIST;
+ }
// TODO: Having to copy the objects feels a /bit/ strange.
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=209078&r1=209077&r2=209078&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 Mon Jul 4 06:52:47 2005
@@ -546,7 +546,17 @@
<component>
<role>org.codehaus.plexus.action.Action</role>
<role-hint>checkout-project</role-hint>
- <implementation>org.apache.maven.continuum.core.action.CheckOutProjectContinuumAction</implementation>
+ <implementation>org.apache.maven.continuum.core.action.CheckoutProjectContinuumAction</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.continuum.core.ContinuumCore</role>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.action.Action</role>
+ <role-hint>store-checkout-scm-result</role-hint>
+ <implementation>org.apache.maven.continuum.core.action.StoreCheckOutScmResultAction</implementation>
<requirements>
<requirement>
<role>org.apache.maven.continuum.core.ContinuumCore</role>
@@ -603,6 +613,16 @@
<role>org.codehaus.plexus.action.Action</role>
<role-hint>update-project-from-working-directory</role-hint>
<implementation>org.apache.maven.continuum.core.action.UpdateProjectFromWorkingDirectoryContinuumAction</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.continuum.core.ContinuumCore</role>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.action.Action</role>
+ <role-hint>check-working-directory</role-hint>
+ <implementation>org.apache.maven.continuum.core.action.CheckWorkingDirectoryAction</implementation>
<requirements>
<requirement>
<role>org.apache.maven.continuum.core.ContinuumCore</role>
Modified: maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/META-INF/plexus/components.xml Mon Jul 4 06:52:47 2005
@@ -178,14 +178,6 @@
<id>build</id>
<expression>getBuild(#buildId)</expression>
</scalar>
- <scalar>
- <id>buildResult</id>
- <expression>getBuildResultForBuild(#buildId)</expression>
- </scalar>
- <scalar>
- <id>changedFiles</id>
- <expression>getChangedFilesForBuild(#buildId)</expression>
- </scalar>
</scalars>
</view>
</views>
Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuild.vm Mon Jul 4 06:52:47 2005
@@ -12,16 +12,21 @@
<th>End Time</th>
<td>$date.format('medium',$build.endTime)</td>
</tr>
+ <tr class="a">
+ <th>Build forced</th>
+ <td>$build.forced</td>
+ </tr>
</table>
</p>
+ #if ( $build.updateScmResult )
<h4>Changes</h4>
<p>
- #if ( !$changedFiles.iterator().hasNext() )
+ #if ( $build.updateScmResult.updatedFiles.size() == 0 )
<b>No files changed</b>
#else
<table border="1" cellspacing="2" cellpadding="3" width="100%">
- #foreach ( $file in $changedFiles )
+ #foreach ( $file in $build.updateScmResult.updatedFiles )
<tr class="a">
<td>$file.path</td>
</tr>
@@ -29,24 +34,37 @@
</table>
#end
</p>
-#if ( $buildResult.standardOutput )
-#set( $stdout = $buildResult.standardOutput )
-#else
-#set( $stdout = "No output on standard output" )
-#end
+ #end
-#if ( $buildResult.standardError )
-#set( $stderr = $buildResult.standardError )
+#if ( $build.state == 4 )
+ <h4>Build Error</h4>
+ <p>
+ <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width: 1px">
+ <code><pre>$build.error</pre></code>
+ </div>
+ </p>
#else
-#set( $stderr = "No output on standard error" )
-#end
<h4>Standard Output</h4>
<p>
- <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width: 1px"><code><pre>$stdout</pre></code></div>
+#if ( $build.standardOutput && $build.standardOutput != "" )
+ <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width: 1px">
+ <code><pre>$build.standardOutput</pre></code>
+ </div>
+#else
+No output on standard output
+#end
</p>
<h4>Standard Error</h4>
<p>
- <div style="width:100%; height:200px; overflow:auto; border-style: solid; border-width: 1px"><code><pre>$stderr</pre></code></div>
+ #if ( $build.standardError && $build.standardError != "" )
+ <div style="width:100%; height:200px; overflow:auto; border-style: solid; border-width: 1px">
+ <code><pre>$build.standardError</pre></code>
+ </div>
+ #else
+ No output on standard error
+ #end
</p>
+#end
+
</div>
Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuilds.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuilds.vm?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuilds.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ProjectBuilds.vm Mon Jul 4 06:52:47 2005
@@ -1,16 +1,6 @@
$page.setTitle( "Continuum - ${project.name} Builds" )
<div class="app">
- #if ( !$project.checkOutScmResult.success )
- <h3>Checkout Exception</h3>
- <p>
- There was a error while checking out the project: $project.checkOutErrorMessage
-
- #if ( $project.checkOutErrorException && $project.checkOutErrorException != "" )
- <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width: 1px"><code><pre>$project.checkOutErrorException</pre></code></div>
- #end
- </p>
- #end
<h3>Build results for $project.name</h3>
<p>
<table border="1" cellspacing="2" cellpadding="3" width="100%">
Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm?rev=209078&r1=209077&r2=209078&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/View.vm Mon Jul 4 06:52:47 2005
@@ -50,4 +50,21 @@
#bar()
</div>
+ #if ( ( $project.checkOutException && $project.checkOutException != "" ) || ( $project.checkOutErrorMessage && $project.checkOutErrorMessage != "" ) )
+ <div id="h3">
+ <h3>Checkout Error</h3>
+ <p>
+ There was a error while checking out the project.
+
+ #if ( $project.checkOutErrorMessage && $project.checkOutErrorMessage != "" )
+ Error message: $project.checkOutErrorMessage
+ #end
+
+ #if ( $project.checkOutErrorException && $project.checkOutErrorException != "" )
+ <div style="width:100%; height:500px; overflow:auto; border-style: solid; border-width: 1px"><code><pre>$project.checkOutErrorException</pre></code></div>
+ #end
+ </p>
+ </div>
+ #end
+
</div>