You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by oc...@apache.org on 2008/03/11 08:59:39 UTC

svn commit: r635836 - in /maven/archiva/trunk: ./ archiva-web/archiva-webapp/ archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ archiva-web/archiva-webapp/src/main/resources/ archiva-web/archiva-webapp/src/main/webapp/WEB-IN...

Author: oching
Date: Tue Mar 11 00:59:35 2008
New Revision: 635836

URL: http://svn.apache.org/viewvc?rev=635836&view=rev
Log:
[MRM-216]
Submitted by Wendy Smoak

-added jsp page and action class for uploading single artifacts
-added commons-file-upload as dependency
-i commented out some parts in UploadAction as they need to be modified to reflect the changes in some of the Archiva components used.


Added:
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp
Modified:
    maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/webwork.properties
    maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/pom.xml

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml?rev=635836&r1=635835&r2=635836&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/pom.xml Tue Mar 11 00:59:35 2008
@@ -238,6 +238,10 @@
       <version>${redback.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java?rev=635836&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java Tue Mar 11 00:59:35 2008
@@ -0,0 +1,166 @@
+package org.apache.maven.archiva.web.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.codehaus.plexus.xwork.action.PlexusActionSupport;
+import org.apache.maven.archiva.configuration.Configuration; 
+// import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+// import org.apache.maven.archiva.configuration.RepositoryConfiguration;
+// import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
+// import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
+// import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.model.ArchivaArtifact;
+import java.io.File;
+
+/**
+ * Upload an artifact.
+ * 
+ * @author Wendy Smoak
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="uploadAction"
+ */
+public class UploadAction
+    extends PlexusActionSupport
+{
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String packaging;
+
+    private String classifier;
+
+    private File file;
+
+    private String contentType;
+
+    private String filename;
+
+    private String repositoryId;
+
+    /**
+     * @plexus.requirement role-hint="default"
+     */
+    // private ArchivaConfiguration configuration;
+    /**
+     * @plexus.requirement role-hint="default"
+     */
+    // private BidirectionalRepositoryLayoutFactory layoutFactory;
+    public void setUpload( File file )
+    {
+        this.file = file;
+    }
+
+    public void setUploadContentType( String contentType )
+    {
+        this.contentType = contentType;
+    }
+
+    public void setUploadFileName( String filename )
+    {
+        this.filename = filename;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getPackaging()
+    {
+        return packaging;
+    }
+
+    public void setPackaging( String packaging )
+    {
+        this.packaging = packaging;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public void setClassifier( String classifier )
+    {
+        this.classifier = classifier;
+    }
+
+    public String getRepositoryId()
+    {
+        return repositoryId;
+    }
+
+    public void setRepositoryId( String repositoryId )
+    {
+        this.repositoryId = repositoryId;
+    }
+
+    public String upload()
+    {
+        getLogger().debug( "upload" );
+        return SUCCESS;
+    }
+
+    public String doUpload()
+    // throws LayoutException
+    {
+        // TODO: adapt to changes in RepositoryConfiguration from the MRM-462 branch
+        // RepositoryConfiguration rc = configuration.getConfiguration().findRepositoryById( repositoryId );
+        // String layout = rc.getLayout();
+        // String url = rc.getUrl();
+        // ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, packaging );
+        // BidirectionalRepositoryLayout repositoryLayout = layoutFactory.getLayout( layout );
+
+        // output from getLogger().debug(...) not appearing in logs, so...
+        // System.out.println( "doUpload, file: " + file.getAbsolutePath() );
+        // System.out.println( "doUpload, path: " + repositoryLayout.toPath( artifact ) );
+
+        return SUCCESS;
+    }
+    
+}

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/webwork.properties
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/webwork.properties?rev=635836&r1=635835&r2=635836&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/webwork.properties (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/webwork.properties Tue Mar 11 00:59:35 2008
@@ -22,7 +22,8 @@
 webwork.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
 webwork.url.includeParams = none
 
-# webwork.devMode = true
+webwork.devMode = true
+webwork.multipart.parser=jakarta
 
 # TODO: package up a theme and share with Continuum. Should contain everything from xhtml, and set templateDir to WEB-INF/themes
 

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?rev=635836&r1=635835&r2=635836&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Tue Mar 11 00:59:35 2008
@@ -164,6 +164,16 @@
       </result>
     </action>
 
+    <action name="upload" class="uploadAction" method="upload">
+      <result>/WEB-INF/jsp/upload.jsp</result>
+    </action>
+
+    <action name="doUpload" class="uploadAction" method="doUpload">
+      <interceptor-ref name="fileUpload"/>
+      <interceptor-ref name="basicStack"/>
+      <result name="success">/WEB-INF/jsp/upload.jsp</result>
+    </action>
+
     <action name="browse" class="browseAction" method="browse">
       <result>/WEB-INF/jsp/browse.jsp</result>
     </action>

Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp?rev=635836&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/upload.jsp Tue Mar 11 00:59:35 2008
@@ -0,0 +1,52 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  --%>
+
+<%-- http://www.opensymphony.com/webwork/wikidocs/File%20Upload%20Interceptor.html --%>
+
+<%@ taglib prefix="ww" uri="/webwork" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %>
+<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
+
+<html>
+<head>
+  <title>Upload Artifact</title>
+  <ww:head/>
+</head>
+
+<body>
+
+<h1>Upload Artifact</h1>
+<div id="contentArea">
+  <ww:form action="doUpload" method="post" enctype="multipart/form-data">
+    <p>groupId: <input type="text" name="groupId" size="50" value="" id="groupId"/></p>
+    <p>artifactId: <input type="text" name="artifactId" size="50" value="" id="artifactId"/></p>
+    <p>version: <input type="text" name="version" size="50" value="" id="version"/></p>
+    <p>packaging: <input type="text" name="packaging" size="50" value="" id="packaging"/></p>
+    <p>classifier: <input type="text" name="classifier" size="50" value="" id="classifier"/></p>
+    <p>repositoryId: <input type="text" name="repositoryId" size="50" value="" id="repositoryId"/></p>
+    <p>
+      <ww:file name="upload" label="File"/>
+      <ww:submit/>
+    </p>
+  </ww:form>
+</div>
+
+</body>
+</html>

Modified: maven/archiva/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/pom.xml?rev=635836&r1=635835&r2=635836&view=diff
==============================================================================
--- maven/archiva/trunk/pom.xml (original)
+++ maven/archiva/trunk/pom.xml Tue Mar 11 00:59:35 2008
@@ -321,6 +321,11 @@
         <version>3.2</version>
       </dependency>
       <dependency>
+        <groupId>commons-fileupload</groupId>
+        <artifactId>commons-fileupload</artifactId>
+        <version>1.2</version>
+      </dependency>
+      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>1.4</version>