continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r358372 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ resources/ webapp/
Date Wed, 21 Dec 2005 20:45:26 GMT
Author: evenisse
Date: Wed Dec 21 12:45:18 2005
New Revision: 358372

URL: http://svn.apache.org/viewcvs?rev=358372&view=rev
Log:
Use file upload feature of webwork

Modified:
    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/AddMavenTwoProjectAction.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/webwork.properties
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenOneProject.jsp
    maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- 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
Wed Dec 21 12:45:18 2005
@@ -16,10 +16,6 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -29,6 +25,11 @@
 
 import com.opensymphony.xwork.ActionSupport;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
 /**
  * @author Nick Gonzalez
  * @version $Id$
@@ -40,39 +41,50 @@
 
     private String m1PomUrl;
 
-    private String m1PomFile;
+    private File m1PomFile;
 
     private String m1Pom = null;
 
     public String execute()
-        throws IOException, MalformedURLException, ContinuumException
     {
-		if ( !StringUtils.isEmpty( m1PomUrl ) )
-		{
-		    m1Pom = m1PomUrl;
-		}
-		else
-		{
-
-			URL url = new URL( "file:/" + m1PomFile );
-
-			String content = IOUtil.toString( url.openStream() ); 
-
-		    if ( !StringUtils.isEmpty( content ) )
-		    {
-		        m1Pom = url.toString();
-		    }
-		}
-
-		if ( !StringUtils.isEmpty( m1Pom ) )
-		{
-			ContinuumProjectBuildingResult result = continuum.addMavenOneProject( m1Pom );
-
-		    if( result.getWarnings().size() > 0 )
-		    {
-		    	addActionMessage( result.getWarnings().toArray().toString() );
-		    }
-		}
+        if ( !StringUtils.isEmpty( m1PomUrl ) )
+        {
+            m1Pom = m1PomUrl;
+        }
+        else
+        {
+            if ( m1PomFile != null )
+            {
+                try
+                {
+                    m1Pom = m1PomFile.toURL().toString();
+                }
+                catch ( MalformedURLException e )
+                {
+                    return INPUT;
+                }
+            }
+            else
+            {
+                return INPUT;
+            }
+        }
+
+        ContinuumProjectBuildingResult result = null;
+
+        try
+        {
+            result = continuum.addMavenOneProject( m1Pom );
+        }
+        catch ( ContinuumException e )
+        {
+            return INPUT;
+        }
+
+        if( result.getWarnings().size() > 0 )
+        {
+            addActionMessage( result.getWarnings().toArray().toString() );
+        }
 
         return SUCCESS;
     }
@@ -82,33 +94,33 @@
         return INPUT;
     }
 
-	public String getM1Pom()
-	{
-		return m1Pom;
-	}
-
-	public void setM1Pom(String pom)
-	{
-		m1Pom = pom;
-	}
-
-	public String getM1PomFile()
-	{
-		return m1PomFile;
-	}
-
-	public void setM1PomFile(String pomFile)
-	{
-		m1PomFile = pomFile;
-	}
-
-	public String getM1PomUrl()
-	{
-		return m1PomUrl;
-	}
-
-	public void setM1PomUrl(String pomUrl)
-	{
-		m1PomUrl = pomUrl;
-	}
+    public String getM1Pom()
+    {
+        return m1Pom;
+    }
+
+    public void setM1Pom( String pom )
+    {
+        m1Pom = pom;
+    }
+
+    public File getM1PomFile()
+    {
+        return m1PomFile;
+    }
+
+    public void setM1PomFile( File pomFile )
+    {
+        m1PomFile = pomFile;
+    }
+
+    public String getM1PomUrl()
+    {
+        return m1PomUrl;
+    }
+
+    public void setM1PomUrl( String pomUrl )
+    {
+        m1PomUrl = pomUrl;
+    }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- 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
Wed Dec 21 12:45:18 2005
@@ -16,7 +16,6 @@
  * limitations under the License.
  */
 
-import com.opensymphony.xwork.ActionSupport;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -24,6 +23,9 @@
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
 
+import com.opensymphony.xwork.ActionSupport;
+
+import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -39,38 +41,55 @@
 
     private String m2PomUrl;
 
-    private String m2PomFile;
+    private File m2PomFile;
 
     private String m2Pom = null;
 
     public String execute()
-        throws IOException, MalformedURLException, ContinuumException
     {
-		if ( !StringUtils.isEmpty( m2PomUrl ) )
-		{
-		    m2Pom = m2PomUrl;
-		}
-		else
-		{
-			URL url = new URL( "file:/" + m2PomFile );
-
-			String content = IOUtil.toString( url.openStream() ); 
-				
-		    if ( !StringUtils.isEmpty( content ) )
-		    {
-		        m2Pom = url.toString();
-		    }
-		}
-
-		if ( !StringUtils.isEmpty( m2Pom ) )
-		{
-			ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( m2Pom );
-		    
-		    if( result.getWarnings().size() > 0 )
-		    {
-		    	addActionMessage( result.getWarnings().toArray().toString() );
-		    }
-		}
+        if ( !StringUtils.isEmpty( m2PomUrl ) )
+        {
+            m2Pom = m2PomUrl;
+        }
+        else
+        {
+            if ( m2PomFile != null )
+            {
+                try
+                {
+                    m2Pom = m2PomFile.toURL().toString();
+                }
+                catch ( MalformedURLException e )
+                {
+                    System.out.println( "aaa" );
+                    return INPUT;
+                }
+            }
+            else
+            {
+                System.out.println( "bbb" );
+                return INPUT;
+            }
+        }
+
+        ContinuumProjectBuildingResult result = null;
+
+        try
+        {
+            result = continuum.addMavenTwoProject( m2Pom );
+        }
+        catch ( ContinuumException e )
+        {
+            System.out.println( "ccc" );
+            return INPUT;
+        }
+        
+        if( result.getWarnings().size() > 0 )
+        {
+            addActionMessage( result.getWarnings().toArray().toString() );
+
+            return INPUT;
+        }
 
         return SUCCESS;
     }
@@ -80,23 +99,22 @@
         return INPUT;
     }
 
-	public void setM2Pom( String pom ) {
-		m2Pom = pom;
-	}
-
-	public String getM2PomFile() {
-		return m2PomFile;
-	}
-
-	public void setM2PomFile( String pomFile ){
-			m2PomFile = pomFile;
-	}
-
-	public String getM2PomUrl() {
-		return m2PomUrl;
-	}
-
-	public void setM2PomUrl( String pomUrl ) {
-		m2PomUrl = pomUrl;
-	}
+    public File getM2PomFile() {
+        return m2PomFile;
+    }
+
+    public void setM2PomFile( File pomFile )
+    {
+        m2PomFile = pomFile;
+    }
+
+    public String getM2PomUrl()
+    {
+        return m2PomUrl;
+    }
+
+    public void setM2PomUrl( String pomUrl )
+    {
+        m2PomUrl = pomUrl;
+    }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
Wed Dec 21 12:45:18 2005
@@ -16,14 +16,15 @@
  * limitations under the License.
  */
 
-import java.util.Map;
-
 import org.apache.maven.continuum.Continuum;
+import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
 
 import com.opensymphony.webwork.ServletActionContext;
 import com.opensymphony.xwork.ActionSupport;
 
+import java.util.Map;
+
 /**
  * @author Nick Gonzalez
  * @version $Id$
@@ -31,7 +32,7 @@
 public class AddProjectAction
     extends ActionSupport
 {
-	private Continuum continuum;
+    private Continuum continuum;
 
     private Project project;
 
@@ -48,10 +49,9 @@
     private String projectScmTag;
 
     private String projectType;
-	
-	public String execute()
-	    throws Exception
-	{
+    
+    public String execute()
+    {
         project = new Project();
 
         project.setName( projectName );
@@ -66,84 +66,91 @@
 
         project.setScmTag( projectScmTag );
 
-        continuum.addProject( project, projectType );
+        try
+        {
+            continuum.addProject( project, projectType );
+        }
+        catch ( ContinuumException e )
+        {
+            return INPUT;
+        }
 
         return SUCCESS;
-	}
+    }
 
-	public String doDefault()
+    public String doDefault()
     {
-		setProjectType( ServletActionContext.getRequest().getParameter( "projectType" ) );		
+        setProjectType( ServletActionContext.getRequest().getParameter( "projectType" ) );
       
 
         return INPUT;
     }
 
-	public String getProjectName()
-	{
-		return projectName;
-	}
-
-	public void setProjectName( String projectName )
-	{
-		this.projectName = projectName;
-	}
-
-	public String getProjectScmPassword()
-	{
-		return projectScmPassword;
-	}
-
-	public void setProjectScmPassword( String projectScmPassword )
-	{
-		this.projectScmPassword = projectScmPassword;
-	}
-
-	public String getProjectScmTag()
-	{
-		return projectScmTag;
-	}
-
-	public void setProjectScmTag( String projectScmTag )
-	{
-		this.projectScmTag = projectScmTag;
-	}
-
-	public String getProjectScmUrl() {
-		return projectScmUrl;
-	}
-
-	public void setProjectScmUrl( String projectScmUrl )
-	{
-		this.projectScmUrl = projectScmUrl;
-	}
-
-	public String getProjectScmUsername()
-	{
-		return projectScmUsername;
-	}
-
-	public void setProjectScmUsername( String projectScmUsername )
-	{
-		this.projectScmUsername = projectScmUsername;
-	}
-
-	public String getProjectType()
-	{
-		return projectType;
-	}
-
-	public void setProjectType( String projectType )
-	{
-		this.projectType = projectType;
-	}
-
-	public String getProjectVersion()
-	{
-		return projectVersion;
-	}
-
-	public void setProjectVersion( String projectVersion )
-	{
-		this.projectVersion = projectVersion;
-	}
+    public String getProjectName()
+    {
+        return projectName;
+    }
+
+    public void setProjectName( String projectName )
+    {
+        this.projectName = projectName;
+    }
+
+    public String getProjectScmPassword()
+    {
+        return projectScmPassword;
+    }
+
+    public void setProjectScmPassword( String projectScmPassword )
+    {
+        this.projectScmPassword = projectScmPassword;
+    }
+
+    public String getProjectScmTag()
+    {
+        return projectScmTag;
+    }
+
+    public void setProjectScmTag( String projectScmTag )
+    {
+        this.projectScmTag = projectScmTag;
+    }
+
+    public String getProjectScmUrl() {
+        return projectScmUrl;
+    }
+
+    public void setProjectScmUrl( String projectScmUrl )
+    {
+        this.projectScmUrl = projectScmUrl;
+    }
+
+    public String getProjectScmUsername()
+    {
+        return projectScmUsername;
+    }
+
+    public void setProjectScmUsername( String projectScmUsername )
+    {
+        this.projectScmUsername = projectScmUsername;
+    }
+
+    public String getProjectType()
+    {
+        return projectType;
+    }
+
+    public void setProjectType( String projectType )
+    {
+        this.projectType = projectType;
+    }
+
+    public String getProjectVersion()
+    {
+        return projectVersion;
+    }
+
+    public void setProjectVersion( String projectVersion )
+    {
+        this.projectVersion = projectVersion;
+    }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/webwork.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/webwork.properties?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/webwork.properties (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/webwork.properties Wed Dec 21
12:45:18 2005
@@ -1 +1,3 @@
 webwork.tag.altSyntax = true
+
+webwork.multipart.parser = jakarta

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Wed Dec 21 12:45:18
2005
@@ -48,19 +48,19 @@
         <action name="addMavenTwoProject"
                 class="addMavenTwoProject">
             <result name="input">addMavenTwoProject.jsp</result>
-            <result name="success">summary.jsp</result>
+            <result name="success" type="redirect">summary.action</result>
         </action>
 
         <action name="addMavenOneProject"
                 class="addMavenOneProject">
             <result name="input">addMavenOneProject.jsp</result>
-            <result name="success">summary.jsp</result>
+            <result name="success" type="redirect">summary.action</result>
         </action>
 
         <action name="addProject"
                 class="addProject">
             <result name="input">addProject.jsp</result>
-            <result name="success">summary.jsp</result>
+            <result name="success" type="redirect">summary.action</result>
         </action>
     </package>
 </xwork>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenOneProject.jsp
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenOneProject.jsp?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenOneProject.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenOneProject.jsp Wed Dec
21 12:45:18 2005
@@ -8,8 +8,7 @@
 <div class="app">
     <div id="axial" class="h3">
     <h3><ww:text name="add.m1.project.section.title"/></h3>
-    <ww:form method="post" action="addMavenOneProject.action" name="addMavenOneProject"
><!--enctype="multipart/form-data"-->
-        <input type="hidden" name="m1PomFile" value="">
+    <ww:form method="post" action="addMavenOneProject.action" name="addMavenOneProject"
enctype="multipart/form-data">
         <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
         <tr>
@@ -28,7 +27,7 @@
         <tr>
             <th><ww:text name="add.m1.project.m1PomFile.label"/></th>
             <td >
-                <input type="file" name="m1PomFileBox" value="" size="100" onChange="addMavenOneProject.m1PomFile.value
= this.value"/>
+                <input type="file" name="m1PomFile" value="" size="100"/>
                 <p><ww:text name="add.m1.project.m1PomFile.message"/></p>
             </td>
         </tr>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp?rev=358372&r1=358371&r2=358372&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/addMavenTwoProject.jsp Wed Dec
21 12:45:18 2005
@@ -8,8 +8,7 @@
 <div class="app">
     <div id="axial" class="h3">
     <h3><ww:text name="add.m2.project.section.title"/></h3>
-    <ww:form method="post" action="addMavenTwoProject.action" name="addMavenTwoProject"
><!--enctype="multipart/form-data"-->
-        <input type="hidden" name="m2PomFile" value="">
+    <ww:form method="post" action="addMavenTwoProject.action" name="addMavenTwoProject"
enctype="multipart/form-data">
         <div class="axial">
         <table border="1" cellspacing="2" cellpadding="3" width="100%">
         <tr>
@@ -28,7 +27,7 @@
         <tr>
             <th><ww:text name="add.m2.project.m2PomFile.label"/></th>
             <td >
-                <input type="file" name="m2PomFileBox" value="" size="100" onChange="addMavenTwoProject.m2PomFile.value
= this.value"/>
+                <input type="file" name="m2PomFile" value="" size="100"/>
                 <p><ww:text name="add.m2.project.m2PomFile.message"/></p>
             </td>
         </tr>



Mime
View raw message