continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r179627 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/core/ main/java/org/apache/maven/continuum/core/action/ main/java/org/apache/maven/continuum/project/builder/manager/ main/java/org/apache/maven/continuum/project/builder/maven/ test/java/org/apache/maven/continuum/project/builder/maven/
Date Thu, 02 Jun 2005 19:04:22 GMT
Author: trygvis
Date: Thu Jun  2 12:04:21 2005
New Revision: 179627

URL: http://svn.apache.org/viewcvs?rev=179627&view=rev
Log:
o Adding some actions.

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
  (with props)
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
  (with props)
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
  (with props)
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
  (with props)
Modified:
    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/AbstractContinuumAction.java
    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/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromScmContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectMetadataContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/ContinuumProjectBuilderManager.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java

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=179627&r1=179626&r2=179627&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
Thu Jun  2 12:04:21 2005
@@ -176,7 +176,7 @@
 
         try
         {
-            result = projectBuilder.createProjectsFromMetadata( url );
+            result = projectBuilder.buildProjectsFromMetadata( url );
         }
         catch ( ContinuumProjectBuilderException e )
         {
@@ -487,7 +487,7 @@
     {
         try
         {
-            return projectBuilderManager.getProjectCreator( projectBuilderId );
+            return projectBuilderManager.getProjectBuilder( projectBuilderId );
         }
         catch ( ContinuumProjectBuilderManagerException e )
         {

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=179627&r1=179626&r2=179627&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
Thu Jun  2 12:04:21 2005
@@ -83,17 +83,11 @@
     //
     // ----------------------------------------------------------------------
 
-    private static ThreadLocal threadContext = new ThreadLocal();
-
-    // ----------------------------------------------------------------------
-    //
-    // ----------------------------------------------------------------------
-
-    protected abstract void doExecute()
+    protected abstract void doExecute( Map context )
         throws Exception;
 
-    protected abstract void handleException( Throwable throwable )
-        throws ContinuumStoreException;
+//    protected abstract void handleException( Throwable throwable )
+//        throws ContinuumStoreException;
 
     protected void handleContinuumStoreException( ContinuumStoreException exception )
     {
@@ -133,94 +127,54 @@
     //
     // ----------------------------------------------------------------------
 
-    protected void putContext( String key, Object value )
-    {
-        getContext().put( key, value );
-    }
-
-    protected String getProjectId()
+    protected String getProjectId( Map context )
         throws ContinuumStoreException
     {
-        return getString( KEY_PROJECT_ID );
+        return getString( context, KEY_PROJECT_ID );
     }
 
-    protected String getBuildId()
+    protected String getBuildId( Map context )
         throws ContinuumStoreException
     {
-        return getString( KEY_BUILD_ID );
+        return getString( context, KEY_BUILD_ID );
     }
 
-    protected boolean isForced()
+    protected boolean isForced( Map context )
         throws ContinuumStoreException
     {
-        return ((Boolean) getObject( KEY_FORCED )).booleanValue();
+        return ((Boolean) getObject( context, KEY_FORCED )).booleanValue();
     }
 
-    protected ContinuumProject getProject()
+    protected ContinuumProject getProject( Map context )
         throws ContinuumStoreException
     {
-        return getStore().getProject( getProjectId() );
+        return getStore().getProject( getProjectId( context ) );
     }
 
-    protected ContinuumBuild getBuild()
+    protected ContinuumBuild getBuild( Map context )
         throws ContinuumStoreException
     {
-        return getStore().getBuild( getBuildId() );
+        return getStore().getBuild( getBuildId( context ) );
     }
 
-    protected File getWorkingDirectory()
+    protected File getWorkingDirectory( Map context )
     {
-        return new File( getString( KEY_WORKING_DIRECTORY ) );
+        return new File( getString( context, KEY_WORKING_DIRECTORY ) );
     }
 
-    protected CheckOutScmResult getCheckOutResult()
+    protected CheckOutScmResult getCheckOutResult( Map context )
     {
-        return (CheckOutScmResult) getObject( KEY_CHECKOUT_SCM_RESULT );
+        return (CheckOutScmResult) getObject( context, KEY_CHECKOUT_SCM_RESULT );
     }
 
-    protected UpdateScmResult getUpdateScmResult()
+    protected UpdateScmResult getUpdateScmResult( Map context )
     {
-        return (UpdateScmResult) getObject( KEY_UPDATE_SCM_RESULT );
+        return (UpdateScmResult) getObject( context, KEY_UPDATE_SCM_RESULT );
     }
 
-    protected UpdateScmResult getUpdateScmResult( UpdateScmResult defaultValue )
+    protected UpdateScmResult getUpdateScmResult(  Map context, UpdateScmResult defaultValue
)
     {
-        return (UpdateScmResult) getObject( KEY_UPDATE_SCM_RESULT, defaultValue );
-    }
-
-//    protected void buildCompleted()
-//    {
-//    }
-//
-//    protected void buildError( Throwable throwable )
-//        throws ContinuumStoreException
-//    {
-//        UpdateScmResult updateScmResult = getUpdateScmResult( null );
-//
-//        String buildId = getString( KEY_BUILD_ID, null );
-//
-//        if ( buildId == null )
-//        {
-//            createBuild().getId();
-//        }
-//
-//        getStore().setBuildResult( getProjectId(),
-//                                   ContinuumProjectState.ERROR,
-//                                   null,
-//                                   updateScmResult,
-//                                   throwable );
-//    }
-
-    private String getString( String key, String defaultValue )
-    {
-        String value = (String) getContext().get( key );
-
-        if ( value == null )
-        {
-            return defaultValue;
-        }
-
-        return value;
+        return (UpdateScmResult) getObject( context, KEY_UPDATE_SCM_RESULT, defaultValue
);
     }
 
     // ----------------------------------------------------------------------
@@ -229,11 +183,9 @@
 
     public void execute( Map context )
     {
-        threadContext.set( context );
-
         try
         {
-            doExecute();
+            doExecute( context );
         }
         catch ( ContinuumStoreException e )
         {
@@ -241,14 +193,15 @@
         }
         catch ( Exception e )
         {
-            try
-            {
-                handleException( e );
-            }
-            catch ( ContinuumStoreException e2 )
-            {
-                handleContinuumStoreException( e2 );
-            }
+            throw new RuntimeException( "Error while executing action.", e );
+//            try
+//            {
+//                handleException( e );
+//            }
+//            catch ( ContinuumStoreException e2 )
+//            {
+//                handleContinuumStoreException( e2 );
+//            }
         }
         finally
         {
@@ -260,8 +213,6 @@
             {
                 handleContinuumStoreException( e );
             }
-
-            threadContext.set( null );
         }
     }
 
@@ -269,19 +220,14 @@
     //
     // ----------------------------------------------------------------------
 
-    private Map getContext()
-    {
-        return (Map) threadContext.get();
-    }
-
-    private String getString( String key )
+    protected String getString( Map context, String key )
     {
-        return (String) getObject( key );
+        return (String) context.get( key );
     }
 
-    private Object getObject( String key )
+    private Object getObject( Map context, String key )
     {
-        Object value = getContext().get( key );
+        Object value = context.get( key );
 
         if ( value == null )
         {
@@ -291,9 +237,9 @@
         return value;
     }
 
-    private Object getObject( String key, Object defaultValue )
+    private Object getObject( Map context, String key, Object defaultValue )
     {
-        Object value = getContext().get( key );
+        Object value = context.get( key );
 
         if ( value == null )
         {

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java?rev=179627&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
Thu Jun  2 12:04:21 2005
@@ -0,0 +1,50 @@
+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.scm.queue.CheckOutTask;
+import org.apache.maven.continuum.project.ContinuumProject;
+
+import org.codehaus.plexus.taskqueue.TaskQueueException;
+import org.codehaus.plexus.taskqueue.TaskQueue;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class AddProjectToCheckOutQueueAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private TaskQueue checkOutQueue;
+
+    protected void doExecute( Map context )
+        throws Exception
+    {
+        ContinuumProject project = getProject( context );
+
+        CheckOutTask checkOutTask = new CheckOutTask( project.getId(),
+                                                      new File( project.getWorkingDirectory()
) );
+
+        checkOutQueue.put( checkOutTask );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddProjectToCheckOutQueueAction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java?rev=179627&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
Thu Jun  2 12:04:21 2005
@@ -0,0 +1,63 @@
+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.net.URL;
+import java.util.Map;
+
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuilder;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
+import org.apache.maven.continuum.project.builder.manager.ContinuumProjectBuilderManager;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class BuildProjectsFromMetadataAction
+    extends AbstractContinuumAction
+{
+    public static final String KEY_URL = "url";
+
+    public static final String KEY_PROJECT_BUILDER_ID = "builderId";
+
+    public static final String KEY_PROJECT_BUILDING_RESULT = "projectBuildingResult";
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumProjectBuilderManager projectBuilderManager;
+
+    protected void doExecute( Map context )
+        throws Exception
+    {
+        String projectBuilderId = getString( context, KEY_PROJECT_BUILDER_ID );
+
+        URL url = new URL( getString( context, KEY_URL ) );
+
+        ContinuumProjectBuilder projectBuilder = projectBuilderManager.getProjectBuilder(
projectBuilderId );
+
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
url );
+
+        context.put( KEY_PROJECT_BUILDING_RESULT, result );
+    }
+
+    protected void handleException( Throwable throwable )
+        throws ContinuumStoreException
+    {
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/BuildProjectsFromMetadataAction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 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?rev=179627&r1=179626&r2=179627&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
Thu Jun  2 12:04:21 2005
@@ -17,6 +17,7 @@
  */
 
 import java.io.File;
+import java.util.Map;
 
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.scm.CheckOutScmResult;
@@ -30,7 +31,7 @@
 public class CheckOutProjectContinuumAction
     extends AbstractContinuumAction
 {
-    protected void doExecute()
+    protected void doExecute( Map context )
         throws Exception
     {
         String projectId = getProjectId();

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Jun  2 12:04:21 2005
@@ -17,6 +17,7 @@
  */
 
 import java.util.Collection;
+import java.util.Map;
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
@@ -34,7 +35,7 @@
 public class ExecuteBuilderContinuumAction
     extends AbstractContinuumAction
 {
-    protected void doExecute()
+    protected void doExecute( Map context )
         throws Exception
     {
         // ----------------------------------------------------------------------

Added: 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=179627&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
Thu Jun  2 12:04:21 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.util.Map;
+import java.io.File;
+
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.ContinuumException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class StoreProjectAction
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    /**
+     * @plexus.configuration
+     *   default-value="${plexus.home}/temp"
+     */
+    private String workingDirectory;
+
+    protected void doExecute( Map context )
+        throws Exception
+    {
+        ContinuumProject project = getProject( context );
+
+        String projectId = store.addProject( project.getName(),
+                                             project.getScmUrl(),
+                                             project.getNagEmailAddress(),
+                                             project.getVersion(),
+                                             project.getCommandLineArguments(),
+                                             project.getExecutorId(),
+                                             null,
+                                             project.getConfiguration() );
+
+        // ----------------------------------------------------------------------
+        // Set the working directory
+        // ----------------------------------------------------------------------
+
+        File projectWorkingDirectory = new File( workingDirectory, projectId );
+
+        if ( !projectWorkingDirectory.exists() && !projectWorkingDirectory.mkdirs()
)
+        {
+            throw new ContinuumException( "Could not make the working directory for the project
" +
+                                          "'" + projectWorkingDirectory.getAbsolutePath()
+ "'." );
+        }
+
+        project.setWorkingDirectory( projectWorkingDirectory.getAbsolutePath() );
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/StoreProjectAction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromScmContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromScmContinuumAction.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromScmContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectFromScmContinuumAction.java
Thu Jun  2 12:04:21 2005
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.util.Map;
+
 import org.apache.maven.continuum.project.ContinuumProject;
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.scm.UpdateScmResult;
@@ -28,7 +30,7 @@
 public class UpdateProjectFromScmContinuumAction
     extends AbstractContinuumAction
 {
-    protected void doExecute()
+    protected void doExecute( Map context )
         throws Exception
     {
         ContinuumProject project = getProject();

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectMetadataContinuumAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectMetadataContinuumAction.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectMetadataContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateProjectMetadataContinuumAction.java
Thu Jun  2 12:04:21 2005
@@ -16,6 +16,8 @@
  * limitations under the License.
  */
 
+import java.util.Map;
+
 import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.store.ContinuumStoreException;
 
@@ -26,7 +28,7 @@
 public class UpdateProjectMetadataContinuumAction
     extends AbstractContinuumAction
 {
-    protected void doExecute()
+    protected void doExecute( Map context )
         throws Exception
     {
         getCore().updateProjectFromScm( getProjectId() );

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java?rev=179627&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
Thu Jun  2 12:04:21 2005
@@ -0,0 +1,88 @@
+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.ContinuumException;
+import org.apache.maven.continuum.core.ContinuumCore;
+import org.apache.maven.continuum.execution.manager.BuildExecutorManager;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.store.ContinuumStore;
+
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ * @version $Id$
+ */
+public class ValidateProject
+    extends AbstractContinuumAction
+{
+    /**
+     * @plexus.requirement
+     */
+    private BuildExecutorManager buildExecutorManager;
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumCore core;
+
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
+    protected void doExecute( Map context )
+        throws Exception
+    {
+        ContinuumProject project = getProject( context );
+
+        // ----------------------------------------------------------------------
+        // Make sure that the builder id is correct before starting to check
+        // stuff out
+        // ----------------------------------------------------------------------
+
+        if ( !buildExecutorManager.hasBuildExecutor( project.getExecutorId() ) )
+        {
+            throw new ContinuumException( "No such executor with id '" + project.getExecutorId()
+ "'." );
+        }
+
+        if ( store.getProjectByName( project.getName() ) != null )
+        {
+            throw new ContinuumException( "A project with the name '" + project.getName()
+ "' already exist." );
+        }
+
+//        if ( getProjectByScmUrl( scmUrl ) != null )
+//        {
+//            throw new ContinuumStoreException( "A project with the scm url '" + scmUrl
+ "' already exist." );
+//        }
+
+        // ----------------------------------------------------------------------
+        // Validate each field
+        // ----------------------------------------------------------------------
+
+        project.setCommandLineArguments( StringUtils.clean( project.getCommandLineArguments()
) );
+    }
+
+    protected void handleException( Throwable throwable )
+        throws ContinuumStoreException
+    {
+    }
+}

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ValidateProject.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/ContinuumProjectBuilderManager.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/ContinuumProjectBuilderManager.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/ContinuumProjectBuilderManager.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/ContinuumProjectBuilderManager.java
Thu Jun  2 12:04:21 2005
@@ -20,12 +20,12 @@
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id:$
+ * @version $Id$
  */
 public interface ContinuumProjectBuilderManager
 {
     String ROLE = ContinuumProjectBuilderManager.class.getName();
 
-    ContinuumProjectBuilder getProjectCreator( String id )
+    ContinuumProjectBuilder getProjectBuilder( String id )
         throws ContinuumProjectBuilderManagerException;
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/manager/DefaultContinuumProjectBuilderManager.java
Thu Jun  2 12:04:21 2005
@@ -24,7 +24,7 @@
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id:$
+ * @version $Id$
  */
 public class DefaultContinuumProjectBuilderManager
     extends AbstractLogEnabled
@@ -37,7 +37,7 @@
     // ProjectCreatorManager Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuilder getProjectCreator( String id )
+    public ContinuumProjectBuilder getProjectBuilder( String id )
         throws ContinuumProjectBuilderManagerException
     {
         ContinuumProjectBuilder projectBuilder = ( ContinuumProjectBuilder ) projectBuilders.get(
id );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilder.java
Thu Jun  2 12:04:21 2005
@@ -30,7 +30,7 @@
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
- * @version $Id:$
+ * @version $Id$
  */
 public class MavenOneContinuumProjectBuilder
     extends AbstractContinuumProjectBuilder
@@ -45,7 +45,7 @@
     // ProjectCreator Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuildingResult createProjectsFromMetadata( URL url )
+    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
         throws ContinuumProjectBuilderException
     {
         ContinuumProjectBuildingResult result = new ContinuumProjectBuildingResult();

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilder.java
Thu Jun  2 12:04:21 2005
@@ -53,7 +53,7 @@
     // ProjectCreator Implementation
     // ----------------------------------------------------------------------
 
-    public ContinuumProjectBuildingResult createProjectsFromMetadata( URL url )
+    public ContinuumProjectBuildingResult buildProjectsFromMetadata( URL url )
         throws ContinuumProjectBuilderException
     {
         // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenOneContinuumProjectBuilderTest.java
Thu Jun  2 12:04:21 2005
@@ -37,7 +37,7 @@
     {
         ContinuumProjectBuilder projectBuilder = (ContinuumProjectBuilder) lookup( ContinuumProjectBuilder.ROLE,
MavenOneContinuumProjectBuilder.ID );
 
-        ContinuumProjectBuildingResult result = projectBuilder.createProjectsFromMetadata(
getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL() );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
getTestFile( "src/test/resources/projects/maven-1.pom.xml" ).toURL() );
 
         assertNotNull( result.getProjects() );
 

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java?rev=179627&r1=179626&r2=179627&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/project/builder/maven/MavenTwoContinuumProjectBuilderTest.java
Thu Jun  2 12:04:21 2005
@@ -44,7 +44,7 @@
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-1.xml" );
 
-        ContinuumProjectBuildingResult result = projectBuilder.createProjectsFromMetadata(
pom.toURL() );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL() );
 
         assertNotNull( result.getProjects() );
 
@@ -63,7 +63,7 @@
 
         File pom = getTestFile( "src/test/repository/maven-builder-helper-2.xml" );
 
-        ContinuumProjectBuildingResult result = projectBuilder.createProjectsFromMetadata(
pom.toURL() );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
pom.toURL() );
 
         assertNotNull( result.getProjects() );
 
@@ -82,7 +82,7 @@
 
         String url = getTestFile( "src/test/resources/projects/continuum/pom.xml" ).toURL().toExternalForm();
 
-        ContinuumProjectBuildingResult result = projectBuilder.createProjectsFromMetadata(
new URL( url ) );
+        ContinuumProjectBuildingResult result = projectBuilder.buildProjectsFromMetadata(
new URL( url ) );
 
         assertNotNull( result );
 



Mime
View raw message