continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r486076 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/
Date Tue, 12 Dec 2006 09:54:38 GMT
Author: evenisse
Date: Tue Dec 12 01:54:37 2006
New Revision: 486076

URL: http://svn.apache.org/viewvc?view=rev&rev=486076
Log:
Fix upload pom feature

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-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?view=diff&rev=486076&r1=486075&r2=486076
==============================================================================
--- 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
Tue Dec 12 01:54:37 2006
@@ -200,6 +200,17 @@
         throws ContinuumException;
 
     /**
+     * Add a Maven 2 project to the list of projects. 
+     * 
+     * @param metadataUrl url of the pom.xml
+     * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
+     * @return a holder with the projects, project groups and errors occurred during the
project adding
+     * @throws ContinuumException
+     */
+    ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, boolean checkProtocol
)
+        throws ContinuumException;
+
+    /**
      * Add a Maven 2 project to the list of projects.
      *
      * @param metadataUrl url of the pom.xml
@@ -211,6 +222,18 @@
         throws ContinuumException;
 
     /**
+     * Add a Maven 2 project to the list of projects.
+     *
+     * @param metadataUrl url of the pom.xml
+     * @param projectGroupId id of the project group to use
+     * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
+     * @return a holder with the projects, project groups and errors occurred during the
project adding
+     * @throws ContinuumException
+     */
+    ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId,
boolean checkProtocol )
+        throws ContinuumException;
+
+    /**
      * Add a Maven 1 project to the list of projects. 
      * 
      * @param metadataUrl url of the project.xml
@@ -221,6 +244,17 @@
         throws ContinuumException;
 
     /**
+     * Add a Maven 1 project to the list of projects. 
+     * 
+     * @param metadataUrl url of the project.xml
+     * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
+     * @return a holder with the projects, project groups and errors occurred during the
project adding
+     * @throws ContinuumException
+     */
+   ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, boolean checkProtocol
)
+        throws ContinuumException;
+
+    /**
      * Add a Maven 1 project to the list of projects.
      *
      * @param metadataUrl url of the project.xml
@@ -229,6 +263,18 @@
      * @throws ContinuumException
      */
     ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId
)
+         throws ContinuumException;
+
+    /**
+     * Add a Maven 1 project to the list of projects.
+     *
+     * @param metadataUrl url of the project.xml
+     * @param projectGroupId id of the project group to use
+     * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
+     * @return a holder with the projects, project groups and errors occurred during the
project adding
+     * @throws ContinuumException
+     */
+    ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId,
boolean checkProtocol )
          throws ContinuumException;
 
     void updateProject( Project project )

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=486076&r1=486075&r2=486076
==============================================================================
--- 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
Tue Dec 12 01:54:37 2006
@@ -1008,14 +1008,26 @@
     public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl )
         throws ContinuumException
     {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenOneContinuumProjectBuilder.ID
);
+        return addMavenOneProject( metadataUrl, true );
+    }
+
+    public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, boolean
checkProtocol )
+        throws ContinuumException
+    {
+        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenOneContinuumProjectBuilder.ID,
checkProtocol );
     }
 
     public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId
)
         throws ContinuumException
     {
+        return addMavenOneProject( metadataUrl, projectGroupId, true );
+    }
+
+    public ContinuumProjectBuildingResult addMavenOneProject( String metadataUrl, int projectGroupId,
boolean checkProtocol )
+        throws ContinuumException
+    {
         return executeAddProjectsFromMetadataActivity( metadataUrl, MavenOneContinuumProjectBuilder.ID,
-                                                       projectGroupId );
+                                                       projectGroupId, checkProtocol );
     }
 
     // ----------------------------------------------------------------------
@@ -1025,14 +1037,27 @@
     public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
         throws ContinuumException
     {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID
);
+        return addMavenTwoProject( metadataUrl, true );
+    }
+
+    public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, boolean
checkProtocol )
+        throws ContinuumException
+    {
+        return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
checkProtocol );
     }
 
     public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId
)
         throws ContinuumException
     {
+        return addMavenTwoProject( metadataUrl, projectGroupId, true );
+    }
+
+    public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl, int projectGroupId,
+                                                              boolean checkProtocol )
+        throws ContinuumException
+    {
         return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID,
-                                                       projectGroupId );
+                                                       projectGroupId, checkProtocol );
     }
 
     // ----------------------------------------------------------------------
@@ -1111,29 +1136,34 @@
      * @throws ContinuumException
      */
     private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
-                                                                                   String
projectBuilderId )
+                                                                                   String
projectBuilderId,
+                                                                                   boolean
checkProtocol )
         throws ContinuumException
     {
-        return executeAddProjectsFromMetadataActivity( metadataUrl, projectBuilderId, -1
);
+        return executeAddProjectsFromMetadataActivity( metadataUrl, projectBuilderId, -1,
checkProtocol );
     }
 
     private ContinuumProjectBuildingResult executeAddProjectsFromMetadataActivity( String
metadataUrl,
                                                                                    String
projectBuilderId,
-                                                                                   int projectGroupId
)
+                                                                                   int projectGroupId,
+                                                                                   boolean
checkProtocol )
         throws ContinuumException
     {
-        try
+        if ( checkProtocol )
         {
-            if ( !urlValidator.validate( metadataUrl ) )
+            try
             {
-                ContinuumProjectBuildingResult res = new ContinuumProjectBuildingResult();
-                res.addError( ContinuumProjectBuildingResult.ERROR_PROTOCOL_NOT_ALLOWED );
-                return res;
+                if ( !urlValidator.validate( metadataUrl ) )
+                {
+                    ContinuumProjectBuildingResult res = new ContinuumProjectBuildingResult();
+                    res.addError( ContinuumProjectBuildingResult.ERROR_PROTOCOL_NOT_ALLOWED
);
+                    return res;
+                }
+            }
+            catch( FormicaException e )
+            {
+                //can't be thrown
             }
-        }
-        catch( FormicaException e )
-        {
-            //can't be thrown
         }
 
         Map context = new HashMap();

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java?view=diff&rev=486076&r1=486075&r2=486076
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
Tue Dec 12 01:54:37 2006
@@ -36,10 +36,10 @@
     extends AddMavenProjectAction
 {
 
-    protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup
)
+    protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup,
boolean checkProtocol )
         throws ContinuumException
     {
-        return getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup );
+        return getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup, checkProtocol
);
     }
 
     /**

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java?view=diff&rev=486076&r1=486075&r2=486076
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
Tue Dec 12 01:54:37 2006
@@ -68,6 +68,8 @@
     public String execute()
         throws ContinuumException
     {
+        boolean checkProtocol = true;
+
         if ( !StringUtils.isEmpty( pomUrl ) )
         {
             try
@@ -104,6 +106,7 @@
                 try
                 {
                     pom = pomFile.toURL().toString();
+                    checkProtocol = false;
                 }
                 catch ( MalformedURLException e )
                 {
@@ -119,7 +122,7 @@
             }
         }
 
-        ContinuumProjectBuildingResult result = doExecute( pom, selectedProjectGroup );
+        ContinuumProjectBuildingResult result = doExecute( pom, selectedProjectGroup, checkProtocol
);
 
         if ( result.hasErrors() )
         {
@@ -141,9 +144,10 @@
      * 
      * @param pomUrl url of the pom specified by the user
      * @param selectedProjectGroup project group id selected by the user
+     * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
      * @return result of adding the pom to continuum
      */
-    protected abstract ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup
)
+    protected abstract ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup,
boolean checkProtocol )
         throws ContinuumException;
 
     public String doDefault()

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?view=diff&rev=486076&r1=486075&r2=486076
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
Tue Dec 12 01:54:37 2006
@@ -39,10 +39,10 @@
     extends AddMavenProjectAction
 {
 
-    protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup
)
+    protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup,
boolean checkProtocol )
         throws ContinuumException
     {
-        return getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup );
+        return getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol
);
     }
 
     public String doDefault()



Mime
View raw message