Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 54904 invoked from network); 31 May 2005 16:29:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 May 2005 16:29:49 -0000 Received: (qmail 33984 invoked by uid 500); 31 May 2005 16:29:48 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 33966 invoked by uid 500); 31 May 2005 16:29:48 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 33952 invoked by uid 99); 31 May 2005 16:29:46 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 31 May 2005 09:29:40 -0700 Received: (qmail 54806 invoked by uid 65534); 31 May 2005 16:29:16 -0000 Message-ID: <20050531162916.54805.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r179234 - in /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum: core/action/ core/action/AbstractContinuumAction.java core/action/CheckOutProjectContinuumAction.java core/action/ContinuumAction.java scm/queue/CheckOutTaskExecutor.java Date: Tue, 31 May 2005 16:29:15 -0000 To: continuum-commits@maven.apache.org From: trygvis@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: trygvis Date: Tue May 31 09:29:14 2005 New Revision: 179234 URL: http://svn.apache.org/viewcvs?rev=3D179234&view=3Drev Log: (empty) Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/AbstractContinuumAction.java (with props) maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/CheckOutProjectContinuumAction.java (with props) maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/ContinuumAction.java (with props) Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/scm/queue/CheckOutTaskExecutor.java Added: 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.j= ava?rev=3D179234&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/AbstractContinuumAction.java (added) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/AbstractContinuumAction.java Tue May 31 09:29:14 2005 @@ -0,0 +1,149 @@ +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 java.io.File; + +import org.apache.maven.continuum.store.ContinuumStore; +import org.apache.maven.continuum.store.ContinuumStoreException; +import org.apache.maven.continuum.scm.ContinuumScm; +import org.apache.maven.continuum.scm.CheckOutScmResult; + +import org.codehaus.plexus.logging.AbstractLogEnabled; + +/** + * @author Trygve Laugstøl + * @version $Id$ + */ +public abstract class AbstractContinuumAction + extends AbstractLogEnabled + implements ContinuumAction +{ + public final static String KEY_PROJECT_ID =3D "projectId"; + + public static final String KEY_WORKING_DIRECTORY =3D "workingDirectory= "; + + public static final String KEY_CHECKOUT_RESULT =3D "checkOutResult"; + + // -------------------------------------------------------------------= --- + // + // -------------------------------------------------------------------= --- + + /** + * @plexus.requirement + */ + private ContinuumStore store; + + /** + * @plexus.requirement + */ + private ContinuumScm scm; + + // -------------------------------------------------------------------= --- + // + // -------------------------------------------------------------------= --- + + protected abstract void doExecute( Map context ) + throws Exception; + + protected abstract void handleException( Map context, Throwable throwa= ble ) + throws ContinuumStoreException; + + protected void handleContinuumStoreException( ContinuumStoreException = exception ) + { + getLogger().fatalError( "Error using the store.", exception ); + } + + // -------------------------------------------------------------------= --- + // + // -------------------------------------------------------------------= --- + + protected ContinuumStore getStore() + { + return store; + } + + protected ContinuumScm getContinuumScm() + { + return scm; + } + + protected String getProjectId( Map context ) + throws ContinuumStoreException + { + return getString( context, KEY_PROJECT_ID ); + } + + protected File getWorkingDirectory( Map context ) + { + return new File( getString( context, KEY_WORKING_DIRECTORY ) ); + } + + protected CheckOutScmResult getCheckOutResult( Map context ) + { + return (CheckOutScmResult) getObject( context, KEY_CHECKOUT_RESULT= ); + } + + // -------------------------------------------------------------------= --- + // ContinuumAction Implementatin + // -------------------------------------------------------------------= --- + + public void execute( Map context ) + { + try + { + doExecute( context ); + } + catch ( ContinuumStoreException e ) + { + handleContinuumStoreException( e ); + } + catch ( Exception e ) + { + try + { + handleException( context, e ); + } + catch ( ContinuumStoreException e2 ) + { + handleContinuumStoreException( e2 ); + } + } + } + + // -------------------------------------------------------------------= --- + // + // -------------------------------------------------------------------= --- + + private String getString( Map context, String key ) + { + return (String) getObject( context, key ); + } + + private Object getObject( Map context, String key ) + { + Object value =3D context.get( key ); + + if ( value =3D=3D null ) + { + throw new RuntimeException( "Missing value for key '" + key + = "'." ); + } + + return value; + } +} Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/AbstractContinuumAction.java ---------------------------------------------------------------------------= --- svn:eol-style =3D native Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/AbstractContinuumAction.java ---------------------------------------------------------------------------= --- svn:keywords =3D Id Added: 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/CheckOutProjectContinuumA= ction.java?rev=3D179234&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/CheckOutProjectContinuumAction.java (added) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/CheckOutProjectContinuumAction.java Tue May 31 09:29:14 = 2005 @@ -0,0 +1,72 @@ +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; +import org.apache.maven.continuum.scm.CheckOutScmResult; +import org.apache.maven.continuum.store.ContinuumStoreException; +import org.apache.maven.scm.manager.NoSuchScmProviderException; + +/** + * @author Trygve Laugstøl + * @version $Id$ + */ +public class CheckOutProjectContinuumAction + extends AbstractContinuumAction +{ + protected void doExecute( Map context ) + throws Exception + { + String projectId =3D getProjectId( context ); + + ContinuumProject project =3D getStore().getProject( projectId ); + + File workingDirectory =3D getWorkingDirectory( context ); + + CheckOutScmResult result; + + result =3D getContinuumScm().checkOut( project, workingDirectory ); + + getStore().setCheckoutDone( projectId, result, null, null ); + + context.put( KEY_CHECKOUT_RESULT, result ); + } + + protected void handleException( Map context, Throwable throwable ) + throws ContinuumStoreException + { + String errorMessage =3D null; + + // TODO: Dissect the scm exception to be able to give better feedb= ack + Throwable cause =3D throwable.getCause(); + + if ( cause instanceof NoSuchScmProviderException ) + { + errorMessage =3D cause.getMessage(); + + throwable =3D null; + } + + getStore().setCheckoutDone( getProjectId( context ), + getCheckOutResult( context ), + errorMessage, + throwable ); + } +} Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/CheckOutProjectContinuumAction.java ---------------------------------------------------------------------------= --- svn:eol-style =3D native Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/CheckOutProjectContinuumAction.java ---------------------------------------------------------------------------= --- svn:keywords =3D Id Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/= continuum/core/action/ContinuumAction.java URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src= /main/java/org/apache/maven/continuum/core/action/ContinuumAction.java?rev= =3D179234&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/ContinuumAction.java (added) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/core/action/ContinuumAction.java Tue May 31 09:29:14 2005 @@ -0,0 +1,28 @@ +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; + +/** + * @author Trygve Laugstøl + * @version $Id$ + */ +public interface ContinuumAction +{ + void execute( Map context ); +} Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/ContinuumAction.java ---------------------------------------------------------------------------= --- svn:eol-style =3D native Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/m= aven/continuum/core/action/ContinuumAction.java ---------------------------------------------------------------------------= --- svn:keywords =3D Id Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/mav= en/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?r= ev=3D179234&r1=3D179233&r2=3D179234&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/scm/queue/CheckOutTaskExecutor.java (original) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/con= tinuum/scm/queue/CheckOutTaskExecutor.java Tue May 31 09:29:14 2005 @@ -33,7 +33,7 @@ =20 /** * @author Trygve Laugstøl - * @version $Id:$ + * @version $Id$ */ public class CheckOutTaskExecutor extends AbstractLogEnabled @@ -52,6 +52,8 @@ public void executeTask( Task t ) throws TaskExecutionException { + // TODO: Replace with a exection of the "check out project" action + CheckOutTask task =3D (CheckOutTask) t; =20 String projectId =3D task.getProjectId();