You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cd...@apache.org on 2006/12/03 17:41:56 UTC
svn commit: r481804 - in /portals/pluto/trunk: pluto-portal/
pluto-util/src/main/java/org/apache/pluto/util/deploy/
pluto-util/src/main/java/org/apache/pluto/util/deploy/file/
pluto-util/src/main/java/org/apache/pluto/util/install/file/
Author: cdoremus
Date: Sun Dec 3 08:41:56 2006
New Revision: 481804
URL: http://svn.apache.org/viewvc?view=rev&rev=481804
Log:
Updates to support PLUTO-215.
Modified:
portals/pluto/trunk/pluto-portal/pom.xml
portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/Deployer.java
portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/DeploymentConfig.java
portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/file/FileSystemDeployer.java
portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/file/FileSystemInstaller.java
Modified: portals/pluto/trunk/pluto-portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal/pom.xml?view=diff&rev=481804&r1=481803&r2=481804
==============================================================================
--- portals/pluto/trunk/pluto-portal/pom.xml (original)
+++ portals/pluto/trunk/pluto-portal/pom.xml Sun Dec 3 08:41:56 2006
@@ -79,7 +79,14 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
-
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>${commons-fileupload.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
</dependencies>
Modified: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/Deployer.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/Deployer.java?view=diff&rev=481804&r1=481803&r2=481804
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/Deployer.java (original)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/Deployer.java Sun Dec 3 08:41:56 2006
@@ -15,6 +15,7 @@
*/
package org.apache.pluto.util.deploy;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -35,8 +36,9 @@
* @throws IOException if an IO error occurs.
* @throws DeploymentException if a deployment error occurs.
*/
- public void deploy(DeploymentConfig config, InputStream webappInputStream)
- throws IOException, DeploymentException;
+// public void deploy(DeploymentConfig config, InputStream webappInputStream)
+ public void deploy(DeploymentConfig config, File webappFile)
+ throws IOException, DeploymentException;
}
Modified: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/DeploymentConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/DeploymentConfig.java?view=diff&rev=481804&r1=481803&r2=481804
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/DeploymentConfig.java (original)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/DeploymentConfig.java Sun Dec 3 08:41:56 2006
@@ -27,7 +27,11 @@
/** The deployment name. */
private String deploymentName = null;
-
+ /**
+ * Is the war already configured?
+ */
+ private boolean isConfigured = false;
+
/**
* Default Constructor.
* @param deploymentName the name of the deployment.
@@ -58,5 +62,17 @@
* @return
*/
public abstract String getDeploymentProperty(String key);
+
+ /**
+ * Is the war already configured?
+ * @return
+ */
+ public boolean isConfigured() {
+ return isConfigured;
+ }
+
+ public void setConfigured(boolean isConfigured) {
+ this.isConfigured = isConfigured;
+ }
}
Modified: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/file/FileSystemDeployer.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/file/FileSystemDeployer.java?view=diff&rev=481804&r1=481803&r2=481804
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/file/FileSystemDeployer.java (original)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/deploy/file/FileSystemDeployer.java Sun Dec 3 08:41:56 2006
@@ -20,6 +20,7 @@
import org.apache.pluto.util.deploy.DeploymentException;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -43,21 +44,36 @@
// Deployer Impl -----------------------------------------------------------
- public void deploy(DeploymentConfig config, InputStream webappInputStream)
+ public void deploy(DeploymentConfig config, File webappFile)
throws IOException, DeploymentException {
File dir = getWebApplicationDirectory(config);
File file = new File(dir, config.getDeploymentName() + ".war");
- FileOutputStream out = new FileOutputStream(file);
-
- int read = -1;
- byte[] bits = new byte[256];
- while ((read = webappInputStream.read(bits)) != -1) {
- out.write(bits, 0, read);
+ FileOutputStream out = null;
+ FileInputStream webappInputStream = null;
+ try {
+ out = new FileOutputStream(file);
+ webappInputStream = new FileInputStream(webappFile);
+
+ int read = -1;
+ byte[] bits = new byte[256];
+ while ((read = webappInputStream.read(bits)) != -1) {
+ out.write(bits, 0, read);
+ }
+ } finally {
+ if (out != null) {
+ out.flush();
+ out.close();
+ }
+
+ if (webappInputStream != null) {
+ webappInputStream.close();
+ }
+ }
+
+ if (!config.isConfigured()) {
+ configure(config);
}
- out.flush();
- out.close();
- configure(config);
}
Modified: portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/file/FileSystemInstaller.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/file/FileSystemInstaller.java?view=diff&rev=481804&r1=481803&r2=481804
==============================================================================
--- portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/file/FileSystemInstaller.java (original)
+++ portals/pluto/trunk/pluto-util/src/main/java/org/apache/pluto/util/install/file/FileSystemInstaller.java Sun Dec 3 08:41:56 2006
@@ -18,7 +18,7 @@
import org.apache.pluto.util.install.InstallationConfig;
import org.apache.pluto.util.install.PortalInstaller;
import org.apache.pluto.util.UtilityException;
-import org.codehaus.plexus.util.FileUtils;
+import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;