diff --git a/artifact/project.xml b/artifact/project.xml
index c2fbdf41..7af30b18 100644
--- a/artifact/project.xml
+++ b/artifact/project.xml
@@ -25,7 +25,7 @@
Maven Artifact Plugin
- 1.4.2-SNAPSHOT
+ 1.5-SNAPSHOT
Tools to manage artifacts and deployment.
Tools to manage artifacts and deployment
http://maven.apache.org/reference/plugins/artifact/
@@ -104,7 +104,7 @@
jsch
jsch
- 0.1.5
+ 0.1.14
jar
@@ -123,8 +123,33 @@
velocity
velocity
- 1.4-dev
+ 1.4
jar
+
+ maven
+ wagon-provider-api
+ 1.0-alpha-2-SNAPSHOT
+
+
+ maven
+ wagon-http
+ 1.0-alpha-2-SNAPSHOT
+
+
+ maven
+ wagon-ftp
+ 1.0-alpha-2-SNAPSHOT
+
+
+ maven
+ wagon-ssh
+ 1.0-alpha-2-SNAPSHOT
+
+
+ maven
+ wagon-file
+ 1.0-alpha-2-SNAPSHOT
+
diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
index 79c03b1b..66058da5 100644
--- a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
+++ b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
@@ -17,28 +17,39 @@ package org.apache.maven.artifact.deployer;
* ====================================================================
*/
-import java.io.File;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.TimeZone;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenException;
-import org.apache.maven.deploy.DeployTool;
-import org.apache.maven.deploy.RepositoryInfo;
import org.apache.maven.project.Project;
import org.apache.maven.repository.ArtifactTypeHandler;
import org.apache.maven.repository.DefaultArtifactTypeHandler;
import org.apache.maven.util.MD5Sum;
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.providers.file.FileWagon;
+import org.apache.maven.wagon.providers.ftp.FtpWagon;
+import org.apache.maven.wagon.providers.http.HttpWagon;
+import org.apache.maven.wagon.providers.ssh.ScpWagon;
+import org.apache.maven.wagon.repository.Repository;
import org.codehaus.plexus.util.FileUtils;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TimeZone;
+
/**
*
* Default implementation of Artifact Deployer interface.
@@ -108,8 +119,8 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
handler.constructRepositoryFullPath(type, project, project.getCurrentVersion());
List srcFiles = new ArrayList();
- srcFiles.add(file.getAbsolutePath());
- srcFiles.add(md5File.getAbsolutePath());
+ srcFiles.add(file);
+ srcFiles.add(md5File);
List destFiles = new ArrayList();
destFiles.add(repositoryPath);
@@ -150,10 +161,10 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
createSnapshotVersionFile(file, snapshotSignature, project, type);
try {
List srcFiles = new ArrayList();
- srcFiles.add(file.getAbsolutePath());
- srcFiles.add(md5File.getAbsolutePath());
- srcFiles.add(file.getAbsolutePath());
- srcFiles.add(md5File.getAbsolutePath());
+ srcFiles.add(file);
+ srcFiles.add(md5File);
+ srcFiles.add(file);
+ srcFiles.add(md5File);
String snapshotFilename =
handler.constructRepositoryFullPath(
@@ -169,7 +180,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
destFiles.add(timestampedFilename);
destFiles.add(timestampedFilename + ".md5");
- srcFiles.add(snapshotVersionFile.getAbsolutePath());
+ srcFiles.add(snapshotVersionFile);
String snapshotVersionsFilename =
handler.constructRepositoryDirectoryPath(type, project)
@@ -254,7 +265,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
/**
* Install given file in local repository
- * @param artifact the artifact file to install
+ * @param file the artifact file to install
* @param type The type of the artiafct
* @param project
* @param version String denominating the version of the artifact
@@ -331,18 +342,9 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
return null;
}
- /**
- * @param artifact
- * @param type
- * @param project
- * @param snapshot
- */
private void doDeploy(List srcFiles, List destFiles, Project project)
throws MavenException
{
-
- DeployTool deployTool = new DeployTool();
-
// trick add special values to context for default repository;
String repoStr =
@@ -381,24 +383,20 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
String repo = repos[i].trim();
LOG.info("Deploying to repository: " + repo);
- RepositoryInfo repoInfo = null;
+ Repository repository = RepositoryBuilder.getRepository(project, repo);
try
{
- repoInfo =
- RepositoryInfoBuilder.getRepositoryInfo(project, repo);
-
- deployTool.deploy(repoInfo, srcFiles, destFiles);
+ deployFiles( repository, srcFiles, destFiles );
success = true;
}
catch (Exception e)
{
String msg =
"Failed to deploy to: "
- + repoInfo.getRepositoryAlias()
+ + repository.getId()
+ " Reason: "
- + e.getMessage();
- LOG.warn(msg);
- LOG.debug(e);
+ + e;
+ LOG.warn(msg, e);
// deploy to next repository
continue;
}
@@ -409,6 +407,71 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
}
}
+ private void deployFiles( Repository repository, List srcFiles, List destFiles )
+ throws ConnectionException, AuthenticationException, ResourceDoesNotExistException, TransferFailedException,
+ AuthorizationException, MalformedURLException
+ {
+
+ if (srcFiles.size() != destFiles.size())
+ {
+ String msg = "Lengths of the lists should be the same";
+ throw new IllegalArgumentException(msg);
+ }
+
+ Wagon wagon = getWagon( repository.getProtocol() );
+ wagon.addTransferListener( new UploadMeter());
+
+ try
+ {
+ wagon.connect( repository );
+ Iterator srcIterator = srcFiles.iterator();
+ Iterator destIterator = destFiles.iterator();
+ while (srcIterator.hasNext())
+ {
+ File srcFile = (File) srcIterator.next();
+ String destFile = (String) destIterator.next();
+ wagon.put( srcFile, destFile );
+ }
+ }
+ finally
+ {
+ try
+ {
+ wagon.disconnect();
+ }
+ catch (Exception e)
+ {
+ LOG.error("Error cleaning up from the deployer", e);
+ }
+ }
+ }
+
+ private Wagon getWagon( String protocol )
+ throws MalformedURLException
+ {
+ // TODO: implement others (SFTP, SCPEXE)
+ if ( protocol.equals( "http" ) )
+ {
+ return new HttpWagon();
+ }
+ else if ( protocol.equals( "ftp" ) )
+ {
+ return new FtpWagon();
+ }
+ else if ( protocol.equals( "file" ) )
+ {
+ return new FileWagon();
+ }
+ else if ( protocol.equals( "scp" ) )
+ {
+ return new ScpWagon();
+ }
+ else
+ {
+ throw new MalformedURLException( "Unknown Wagon protocol: " + protocol );
+ }
+ }
+
/**
* Return the local repository path form given project
* @param project
@@ -491,7 +554,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer
/**
* Create MD5 checksum file for given file. File is created
* in the same folder
- * @param File
+ * @param file
* @return The File which contatins MD5 checksum
* @throws MavenException when opertaion failed
*/
diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java b/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
index d2fa81e3..7218c6e7 100644
--- a/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
+++ b/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
@@ -18,8 +18,6 @@ package org.apache.maven.artifact.deployer;
*/
import org.apache.maven.MavenException;
-import org.apache.maven.artifact.deployer.ArtifactDeployer;
-import org.apache.maven.artifact.deployer.DefaultArtifactDeployer;
import org.apache.maven.project.Project;
import org.apache.maven.repository.ArtifactTypeHandler;
import org.apache.maven.repository.DefaultArtifactTypeHandler;
@@ -30,7 +28,7 @@ import org.apache.maven.repository.DefaultArtifactTypeHandler;
* from jelly scripts.
*
* @author Michal Maczka
- * @version $Id: DeployBean.java,v 1.6 2004/06/23 13:04:28 brett Exp $
+ * @version $Id$
*/
public class DeployBean
{
diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java b/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
new file mode 100755
index 00000000..ab4e4980
--- /dev/null
+++ b/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryBuilder.java
@@ -0,0 +1,180 @@
+package org.apache.maven.artifact.deployer;
+
+/* ====================================================================
+ * Copyright 2001-2004 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 org.apache.maven.project.Project;
+import org.apache.maven.wagon.repository.Repository;
+import org.apache.maven.wagon.repository.RepositoryPermissions;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.apache.maven.MavenConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.net.MalformedURLException;
+
+/**
+ * Perform mapping between project's properties and attributes of Wagon Repository class.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class RepositoryBuilder
+{
+ private static final Log LOG = LogFactory.getLog( RepositoryBuilder.class );
+
+ public static Repository getRepository( Project project, String id )
+ {
+ String url = (String) project.getContext().getVariable( "maven.repo." + id );
+
+ Repository repository = new Repository( id, url );
+
+ String username = (String) project.getContext().getVariable( "maven.repo." + id + ".username" );
+ String password = (String) project.getContext().getVariable( "maven.repo." + id + ".password" );
+ String passphrase = (String) project.getContext().getVariable( "maven.repo." + id + ".passphrase" );
+ String privateKey = (String) project.getContext().getVariable( "maven.repo." + id + ".privatekey" );
+
+ if ( username == null )
+ {
+ username = (String) project.getContext().getVariable( "maven.username" );
+ }
+
+ AuthenticationInfo authenticationInfo = new AuthenticationInfo();
+ authenticationInfo.setUserName( username );
+ authenticationInfo.setPassword( password );
+ authenticationInfo.setPrivateKey( privateKey );
+ authenticationInfo.setPassphrase( passphrase );
+ repository.setAuthenticationInfo( authenticationInfo );
+
+ String dir = (String) project.getContext().getVariable( "maven.repo." + id + ".directory" );
+ repository.setBasedir( dir );
+
+ String port = (String) project.getContext().getVariable( "maven.repo." + id + ".port" );
+ if ( port != null )
+ {
+ try
+ {
+ repository.setPort( Integer.valueOf( port ).intValue() );
+ }
+ catch ( NumberFormatException e )
+ {
+ LOG.warn("Invalid format for port: " + port);
+ }
+ }
+
+ String remoteGroup = (String) project.getContext().getVariable( "maven.repo." + id + ".group" );
+ String remoteMode = (String) project.getContext().getVariable( "maven.repo." + id + ".mode" );
+ String remoteDirectoryMode = (String) project.getContext().getVariable( "maven.repo." + id + ".directory.mode" );
+
+ if ( remoteMode == null )
+ {
+ remoteMode = "g+w";
+ }
+
+ if ( remoteDirectoryMode == null )
+ {
+ remoteDirectoryMode = remoteMode;
+ }
+
+ RepositoryPermissions permissions = new RepositoryPermissions();
+ permissions.setDirectoryMode( remoteDirectoryMode );
+ permissions.setFileMode( remoteMode );
+ permissions.setGroup( remoteGroup );
+ repository.setPermissions( permissions );
+
+ // TODO: provider specific settings
+/*
+ String passiveModeOn = (String) project.getContext().getVariable( "maven.repo." + id + ".passiveModeOn" );
+
+ String compress = (String) project.getContext().getVariable( "maven.repo." + id + ".compress" );
+
+ String scpExe = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.executable" );
+ if ( scpExe == null )
+ {
+ scpExe = (String) project.getContext().getVariable( "maven.scp.executable" );
+ }
+ String scpArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".scp.args" );
+ if ( scpArgs == null )
+ {
+ scpArgs = (String) project.getContext().getVariable( "maven.scp.args" );
+ }
+ String sshExe = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.executable" );
+ if ( sshExe == null )
+ {
+ sshExe = (String) project.getContext().getVariable( "maven.ssh.executable" );
+ }
+ String sshArgs = (String) project.getContext().getVariable( "maven.repo." + id + ".ssh.args" );
+ if ( sshArgs == null )
+ {
+ sshArgs = (String) project.getContext().getVariable( "maven.ssh.args" );
+ }
+
+ if ( passiveModeOn != null )
+ {
+ if ( "false".equalsIgnoreCase( passiveModeOn ) )
+ {
+ repoInfo.setPassiveModeOn( false );
+ }
+ }
+ if ( compress != null )
+ {
+ try
+ {
+ repoInfo.setCompress( new Boolean( compress ).booleanValue() );
+ }
+ catch ( Exception e )
+ {
+ throw new MalformedURLException( "maven.repo." + id + ".compress should be a boolean" );
+ }
+ }
+*/
+
+ return repository;
+ }
+
+ public static void getProxyInfo( Project project )
+ {
+ ProxyInfo proxyInfo = new ProxyInfo();
+
+ String proxyHost = (String) project.getContext().getProxyHost();
+ String proxyUser = (String) project.getContext().getProxyUserName();
+ String proxyPassword = (String) project.getContext().getProxyPassword();
+ String proxyPort = (String) project.getContext().getProxyPort();
+
+ if ( proxyPort != null )
+ {
+ try
+ {
+ proxyInfo.setPort( Integer.valueOf( proxyPort ).intValue() );
+ }
+ catch ( NumberFormatException e )
+ {
+ LOG.warn("Invalid format for port: " + proxyPort);
+ }
+ }
+
+ proxyInfo.setType( "http" );
+ proxyInfo.setHost( proxyHost );
+ proxyInfo.setNonProxyHosts( (String) project.getContext().getVariable( "maven.proxy.nonProxyHosts" ));
+ proxyInfo.setNtlmDomain( (String) project.getContext().getVariable( "maven.proxy.ntlm.domain" ));
+ proxyInfo.setNtlmHost( (String) project.getContext().getVariable( "maven.proxy.ntlm.host" ));
+ proxyInfo.setUserName( proxyUser );
+ proxyInfo.setPassword( proxyPassword );
+ }
+
+}
diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryInfoBuilder.java b/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryInfoBuilder.java
deleted file mode 100644
index d5bec1e1..00000000
--- a/artifact/src/main/org/apache/maven/artifact/deployer/RepositoryInfoBuilder.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package org.apache.maven.artifact.deployer;
-
-/* ====================================================================
- * Copyright 2001-2004 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.MalformedURLException;
-
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.project.Project;
-
-/**
- *
- * Perform mapping between project's properties and attributes of DeployRequest class.
- *
- * @author Michal Maczka
- * @version $Id: RepositoryInfoBuilder.java,v 1.9 2004/09/29 10:56:03 brett Exp $
- */
-public class RepositoryInfoBuilder
-{
-
- /**
- *
- * @param project. Will lookup the properties in the context of this project
- * @param repository The name (alias) of the repository
- * like repo1 taken from property: maven.deploy.repos= repo1, repo2
- * @return Deploy request
- * @throws WrongParameterException
- */
- public static RepositoryInfo getRepositoryInfo(
- Project project,
- String repository)
- throws MalformedURLException
- {
-
- RepositoryInfo repoInfo = new RepositoryInfo();
- repoInfo.setRepositoryAlias(repository);
- String url =
- (String) project.getContext().getVariable(
- "maven.repo." + repository);
- String username =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".username");
-
- String password =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".password");
-
- String passphrase =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".passphrase");
-
- String privateKey =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".privatekey");
-
- String compress =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".compress");
-
- String dir =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".directory");
-
- String port =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".port");
-
- String remoteGroup =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".group");
-
- String remoteMode =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".mode");
-
- String remoteDirectoryMode =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".directory.mode");
-
- String passiveModeOn =
- (String) project.getContext().getVariable(
- "maven.repo." + repository + ".passiveModeOn");
-
- String proxyHost = (String) project.getContext().getProxyHost();
- String proxyUser = (String) project.getContext().getProxyUserName();
-
- String proxyPassword = (String) project.getContext().getProxyPassword();
-
- String proxyPort = (String) project.getContext().getProxyPort();
-
- String scpExe = (String) project.getContext().getVariable("maven.repo." + repository + ".scp.executable");
- if (scpExe == null) {
- scpExe = (String) project.getContext().getVariable("maven.scp.executable");
- }
- String scpArgs = (String) project.getContext().getVariable("maven.repo." + repository + ".scp.args");
- if (scpArgs == null) {
- scpArgs = (String) project.getContext().getVariable("maven.scp.args");
- }
- String sshExe = (String) project.getContext().getVariable("maven.repo." + repository + ".ssh.executable");
- if (sshExe == null) {
- sshExe = (String) project.getContext().getVariable("maven.ssh.executable");
- }
- String sshArgs = (String) project.getContext().getVariable("maven.repo." + repository + ".ssh.args");
- if (sshArgs == null) {
- sshArgs = (String) project.getContext().getVariable("maven.ssh.args");
- }
-
- if (username == null) {
- username = (String) project.getContext().getVariable("maven.username");
- }
-
- if (remoteMode == null) {
- remoteMode = "g+w";
- }
-
- if (remoteDirectoryMode == null) {
- remoteDirectoryMode = remoteMode;
- }
-
- repoInfo.setUserName(username);
- repoInfo.setPassword(password);
- repoInfo.setPassphrase(passphrase);
- repoInfo.setPrivateKey(privateKey);
- repoInfo.setGroup(remoteGroup);
- repoInfo.setMode(remoteMode);
- repoInfo.setDirectoryMode(remoteDirectoryMode);
- repoInfo.setUrl(url);
- repoInfo.setProxyHost(proxyHost);
- repoInfo.setProxyUserName(proxyUser);
- repoInfo.setProxyPassword(proxyPassword);
- repoInfo.setScpExe(scpExe);
- repoInfo.setScpArgs(scpArgs);
- repoInfo.setSshExe(sshExe);
- repoInfo.setSshArgs(sshArgs);
- if (passiveModeOn != null)
- {
- if ("false".equalsIgnoreCase(passiveModeOn))
- {
- repoInfo.setPassiveModeOn(false);
- }
- }
- if (compress != null)
- {
- try
- {
- repoInfo.setCompress(new Boolean(compress).booleanValue());
- }
- catch (Exception e)
- {
- throw new MalformedURLException(
- "maven.repo." + repository + ".compress should be a boolean");
- }
- }
- if (port != null)
- {
- try
- {
-
- repoInfo.setPort(Integer.parseInt(port));
- }
- catch (Exception e)
- {
- throw new MalformedURLException(
- "maven.repo." + repository + ".port should be an integer");
- }
- }
- if (proxyPort != null)
- {
- try
- {
- repoInfo.setProxyPort(
- Integer.parseInt(proxyPort.trim()));
- }
- catch (Exception e)
- {
- throw new MalformedURLException(
- "maven.repo."
- + repository
- + ".proxy.port should be an integer");
- }
- }
-
- repoInfo.setBasedir(dir);
- return repoInfo;
-
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java b/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
new file mode 100755
index 00000000..86f6300e
--- /dev/null
+++ b/artifact/src/main/org/apache/maven/artifact/deployer/UploadMeter.java
@@ -0,0 +1,98 @@
+package org.apache.maven.artifact.deployer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.maven.wagon.events.TransferEvent;
+import org.apache.maven.wagon.events.TransferListener;
+import org.apache.maven.util.BootstrapDownloadMeter;
+
+/* ====================================================================
+ * Copyright 2001-2004 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.
+ * ====================================================================
+ */
+
+/**
+ * Bootstrap download progress meter.
+ *
+ * @author Brett Porter
+ * @version $Id$
+ */
+public class UploadMeter implements TransferListener
+{
+ /** log for debug output */
+ private static final Log log = LogFactory.getLog(UploadMeter.class);
+
+ private int shownSoFar = 0;
+ private final int numHashes;
+ private final char hashChar;
+ private long complete = 0;
+ private long total;
+
+ public UploadMeter()
+ {
+ this( 20, '.' );
+ }
+
+ public UploadMeter(int numHashes, char hashChar)
+ {
+ this.numHashes = numHashes;
+ this.hashChar = hashChar;
+ }
+
+ public void transferStarted( TransferEvent transferEvent )
+ {
+ shownSoFar = 0;
+ complete = 0;
+ System.out.println( "Uploading " + transferEvent.getLocalFile().getName() + ": " );
+ total = transferEvent.getLocalFile().length();
+ }
+
+ public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length )
+ {
+// TODO: fix
+// long total = transferEvent.getResource().getContentLength();
+
+ complete += length;
+
+ if (total > 0)
+ {
+ int numToShow = (int) ( ( complete * numHashes ) / total );
+ for ( int i = shownSoFar + 1; i <= numToShow; i++ )
+ {
+ System.out.print( hashChar );
+ }
+ shownSoFar = numToShow;
+ }
+ }
+
+ public void transferCompleted( TransferEvent transferEvent )
+ {
+// TODO: fix
+// long total = transferEvent.getResource().getContentLength();
+
+ System.out.println(" (" + (total/1024) + "K)");
+ }
+
+ public void transferError( TransferEvent transferEvent )
+ {
+ log.error( transferEvent.getException().getMessage() );
+ }
+
+ public void debug( String message )
+ {
+ log.debug( message );
+ }
+}
+
diff --git a/artifact/src/main/org/apache/maven/deploy/DeployRequest.java b/artifact/src/main/org/apache/maven/deploy/DeployRequest.java
deleted file mode 100644
index 7b6a673e..00000000
--- a/artifact/src/main/org/apache/maven/deploy/DeployRequest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.deploy;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-/**
- * Holder of the variables which are used by deployers for
- * establishing connection to remote hosts and to
- * deploy the file to correct location in remote file system
- *
- * @author Michal Maczka
- * @version $Id: DeployRequest.java,v 1.10 2004/05/02 15:04:34 vmassol Exp $
- */
-public class DeployRequest
-{
- /** The filename in target file system */
- private String destFile;
-
- /** The file name in local file system */
- private String srcFile;
-
- public DeployRequest(String srcFile, String destFile)
- {
- this.srcFile = srcFile;
- this.destFile = destFile;
- }
-
- /**
- * @return
- */
- public String getDestFile()
- {
- return destFile;
- }
-
- /**
- * @param destFile
- */
- public void setDestFile(String destFile)
- {
- this.destFile = destFile;
- }
-
- /**
- * @return
- */
- public String getSrcFile()
- {
- return srcFile;
- }
-
- /**
- * @param srcFile
- */
- public void setSrcFile(String srcFile)
- {
- this.srcFile = srcFile;
- }
-
- /**
- * Returns the directory path portion of a file specification string.
- * Matches the equally named unix command.
- * @return The directory portion excluding the ending file separator.
- */
- public String dirname()
- {
- int i = destFile.lastIndexOf("/");
- return (i >= 0 ? destFile.substring(0, i) : "");
- }
-
- /**
- * Returns the filename portion of a file specification string.
- * @return The filename string with extension.
- */
- public String filename()
- {
- int i = destFile.lastIndexOf("/");
- return (i >= 0 ? destFile.substring(i + 1) : destFile);
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/DeployTool.java b/artifact/src/main/org/apache/maven/deploy/DeployTool.java
deleted file mode 100644
index 31c7851d..00000000
--- a/artifact/src/main/org/apache/maven/deploy/DeployTool.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.apache.maven.deploy;
-
-/* ====================================================================
- * Copyright 2001-2004 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.Iterator;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.maven.deploy.deployers.Deployer;
-import org.apache.maven.deploy.deployers.ExternalDeployer;
-import org.apache.maven.deploy.deployers.FileDeployer;
-import org.apache.maven.deploy.deployers.FtpDeployer;
-import org.apache.maven.deploy.deployers.HttpDeployer;
-import org.apache.maven.deploy.deployers.SFtpDeployer;
-import org.apache.maven.deploy.deployers.ScpDeployer;
-import org.apache.maven.deploy.deployers.ScpExeDeployer;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-import org.apache.maven.deploy.exceptions.UnsupportedProtocolException;
-
-/**
- * Utility class
- *
- * @author Michal Maczka
- * @version $Id: DeployTool.java,v 1.13 2004/07/06 13:42:25 brett Exp $
- */
-public class DeployTool
-{
- /** Current Version **/
- public static final String VERSION = "1.0-dev";
-
- private static final Log LOG = LogFactory.getLog(DeployTool.class);
-
- /**
- * Returns deployer which is able to deploy to repository
- * described by host info.
- * @param repoInfo
- * @throws DeployException When no deployer is supporting given protocol
- */
- public Deployer getDeployer(RepositoryInfo repoInfo)
- throws IllegalArgumentException, UnsupportedProtocolException
- {
- String url = repoInfo.getUrl();
- Deployer deployer = null;
-
- if (url == null || url.length() == 1)
- {
- throw new UnsupportedProtocolException(
- "No URL was provided repository: "
- + repoInfo.getRepositoryAlias());
- }
- if (url.startsWith(HttpDeployer.PROTOCOL))
- {
- deployer = new HttpDeployer();
- }
- if (url.startsWith(FileDeployer.PROTOCOL))
- {
- deployer = new FileDeployer();
- }
- if (url.startsWith(FtpDeployer.PROTOCOL))
- {
- deployer = new FtpDeployer();
- }
- if (url.startsWith(SFtpDeployer.PROTOCOL))
- {
- deployer = new SFtpDeployer();
- }
- if (url.startsWith(ScpDeployer.PROTOCOL))
- {
- deployer = new ScpDeployer();
- }
- if (url.startsWith(ExternalDeployer.PROTOCOL))
- {
- deployer = new ExternalDeployer();
- }
- if (url.startsWith(ScpExeDeployer.PROTOCOL))
- {
- deployer = new ScpExeDeployer();
- }
- if (deployer == null)
- {
- throw new UnsupportedProtocolException(url);
- }
-
- return deployer;
- }
-
-
- /**
- * Deploy given list of files to remote repository
- * @param repoInfo the
- * @param srcFiles the list containing local filenames which will be deployed to remote host
- * @param destFiles the list contating the remote filenames. The size of this list
- * must match the size of srcFiles list
- * @throws TransferFailedException when copying operation fails
- * @throws UnsupportedProtocolException when no deployer is capable to deploy to given host
- * @throws AuthenticationException when authentication related problem occures
- */
- public void deploy(
- RepositoryInfo repoInfo,
- List srcFiles,
- List destFiles)
- throws
- TransferFailedException,
- UnsupportedProtocolException,
- AuthenticationException
- {
-
- if (srcFiles.size() != destFiles.size())
- {
- String msg = "Lengths of the lists should be the same";
- throw new IllegalArgumentException(msg);
- }
- Deployer deployer = getDeployer(repoInfo);
-
- try
- {
- deployer.init(repoInfo);
- Iterator srcIterator = srcFiles.iterator();
- Iterator destIterator = destFiles.iterator();
- while (srcIterator.hasNext())
- {
- String srcFile = (String) srcIterator.next();
- String destFile = (String) destIterator.next();
- DeployRequest request = new DeployRequest(srcFile, destFile);
- LOG.info("Deploying: " + srcFile + "-->" + destFile);
- deployer.deploy(request);
- }
- }
- finally
- {
- try
- {
- deployer.release();
- }
- catch (Exception e)
- {
- LOG.error("Error cleaning up from the deployer", e);
- }
- }
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/RepositoryInfo.java b/artifact/src/main/org/apache/maven/deploy/RepositoryInfo.java
deleted file mode 100644
index 4c866bf3..00000000
--- a/artifact/src/main/org/apache/maven/deploy/RepositoryInfo.java
+++ /dev/null
@@ -1,442 +0,0 @@
-package org.apache.maven.deploy;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-/**
- * Contatins the set of poperties which are necessery
- * for esatblishing connection to remote hosts and to
- * perform a deployment.
- *
- * @author Michal Maczka
- * @version $Id: RepositoryInfo.java,v 1.8 2004/09/29 10:56:04 brett Exp $
- */
-public class RepositoryInfo
-{
-
- /** Idicates that port has not been set */
- public final static int UNKNOWN_PORT = -1;
-
- /** The nickname (alias) of the repository*/
- private String repositoryAlias;
-
- /** Indicates if Passive Mode should be used.
- * Use passive mode as default because most of us are
- * behind firewalls these days.
- */
- private boolean passiveModeOn = true;
-
- /** URL of the remote host*/
- private String url;
-
- /** Port of remote host */
- private int port = UNKNOWN_PORT;
-
- /** The login name of the user in @ remote host*/
- private String userName;
-
- /** Password */
- private String password;
-
- /** Remote group name */
- private String group;
-
- /** File mode. */
- private String mode;
-
- /** Directory mode. */
- private String directoryMode;
-
- /** The passpharse of the user's private key file */
- private String passphrase;
-
- /** The absoluth path to private key file */
- private String privateKey;
-
- /** Proxy Server host*/
- private String proxyHost = null;
-
- /** the login name of the user @ Proxy Server host*/
- private String proxyUserName = null;
-
- /** the password user @ Proxy Server host*/
- private String proxyPassword = null;
-
- /** Proxy server port */
- private int proxyPort = UNKNOWN_PORT;
-
- /** Indicates if debug mode should be used*/
- private boolean debugOn = true;
-
- /** basedir */
- private String basedir;
-
- /** compress */
- private boolean compress;
-
- /** parms for ScpExeDeployer */
- private String sshExe;
- private String sshArgs;
- private String scpExe;
- private String scpArgs;
-
- /**
- * @param compress
- */
- public void setCompress(boolean compress)
- {
- this.compress = compress;
- }
-
- /**
- * @return
- */
- public boolean getCompress()
- {
- return compress;
- }
-
- /**
- * @return
- */
- public String getBasedir()
- {
- return basedir;
- }
-
- /**
- * @param basedir
- */
- public void setBasedir(String basedir)
- {
- this.basedir = basedir;
- }
-
- /**
- * Set the alias of the repository
- * @param repositoryAlias
- */
- public void setRepositoryAlias(String repositoryAlias)
- {
- this.repositoryAlias = repositoryAlias;
- }
-
- /**
- * Get the port of the host
- * @return the port of the remote host where repository resides.
- */
- public int getPort()
- {
- return port;
- }
-
- /**
- * Set the port of the remote host
- * @param port
- */
- public void setPort(int port)
- {
- this.port = port;
- }
-
- /**
- * Get the passphrase of the private key file.
- * Passphrase is used only when host/protocol supports
- * authetification via exchange of private/public keys
- * and private key was provided.
- *
- * @return the passphrase of the private key file
- */
- public String getPassphrase()
- {
- return passphrase;
- }
-
- /**
- * Set the passphrase of the private key file
- * @param passphrase the passphrase of the private key file
- */
- public void setPassphrase(String passphrase)
- {
- this.passphrase = passphrase;
- }
-
- /**
- * Get the absoluth path to the private key
- * @return the path to private key
- */
- public String getPrivateKey()
- {
- return privateKey;
- }
-
- /**
- * Set the aboluth path to private key
- * @param privateKey The path to private key in local file system
- */
- public void setPrivateKey(String privateKey)
- {
- this.privateKey = privateKey;
- }
-
- public String getDirectoryMode()
- {
- return directoryMode;
- }
-
- public void setDirectoryMode( String directoryMode )
- {
- this.directoryMode = directoryMode;
- }
-
- public String getMode()
- {
- return mode;
- }
-
- public void setMode( String mode )
- {
- this.mode = mode;
- }
-
- /**
- * Get the remote group to which will belong to
- * after deployemnt. Not all protolcols support
- * allow to change the group of the artifact
- * @return remote group
- */
- public String getGroup()
- {
- return group;
- }
-
- /**
- * Set the remote group for artifact which is deployed
- * @param group The remote group to which
- * artifact which is deployed will belong
- */
- public void setGroup(String group)
- {
- this.group = group;
- }
-
- /**
- * Get the password to be used when user will be authetificated
- * while connection to remote host is established
- * @return the password of user
- */
- public String getPassword()
- {
- return password;
- }
-
- /**
- *
- *
- * @param password
- */
- public void setPassword(String pass)
- {
- this.password = pass;
- }
-
- /**
- * Returhn proxy server host name
- * @return proxy server host name
- */
- public String getProxyHost()
- {
- return proxyHost;
- }
-
- /**
- * Set proxy host name
- * @param proxyHost
- */
- public void setProxyHost(String proxyHost)
- {
- this.proxyHost = proxyHost;
- }
-
- /**
- * Get user's password used to login to proxy server
- * @return the user's password at proxy host
- */
- public String getProxyPassword()
- {
- return proxyPassword;
- }
-
- /**
- * Set the proxy server password
- * @param proxyPassword teh epassword to use to login to a proxy server
- */
- public void setProxyPassword(String proxyPass)
- {
- this.proxyPassword = proxyPass;
- }
-
- /**
- * Get the proxy port
- * @return Poroxy server port
- */
- public int getProxyPort()
- {
- return proxyPort;
- }
-
- /**
- * Set the proxy port
- * @param proxyPort
- */
- public void setProxyPort(int proxyPort)
- {
- this.proxyPort = proxyPort;
- }
-
- /**
- *
- * Get the proxy user name
- * @return
- */
- public String getProxyUserName()
- {
- return proxyUserName;
- }
-
- /**
- * Set the proxy user name
- * @param proxyUserName the proxy user name
- */
- public void setProxyUserName(String proxyUser)
- {
- this.proxyUserName = proxyUser;
- }
-
- /**
- * Get url of remote host
- * @return URL (with protocol) of remote host
- */
- public String getUrl()
- {
- return url;
- }
-
- /**
- * Set url of remote host
- * @param url url of remote host
- */
- public void setUrl(String url)
- {
- this.url = url;
- }
-
- /**
- * Get user login name at remote host
- * @return user name at remote host
- */
- public String getUserName()
- {
- return userName;
- }
-
- /**
- * Set user name at remote host
- * @param userName
- */
- public void setUserName(String user)
- {
- this.userName = user;
- }
-
- /**
- * Return the host name (Cuts of protocol from the URL)
- * @return The host name
- */
- public String getHost()
- {
- if (url == null)
- {
- return "localhost";
- }
- return url.substring(url.indexOf("://") + 3).trim();
- }
-
- /**
- * Get the name of the repository to which deploy attempt will be made
- *
- * @return the name (nickname, alias) of the repository
- */
- public String getRepositoryAlias()
- {
-
- return repositoryAlias;
- }
-
- /**
- * Get Debug mode
- * @return the debug mode
- */
- public boolean isDebugOn()
- {
- return debugOn;
- }
-
- /**
- * Set deplyer in debug mode - more messages will be wriiten
- * @param debugOn
- */
- public void setDebugOn(boolean debugOn)
- {
- this.debugOn = debugOn;
- }
-
- public boolean isPassiveModeOn()
- {
- return passiveModeOn;
- }
-
- public void setPassiveModeOn(boolean passiveModeOn)
- {
- this.passiveModeOn = passiveModeOn;
- }
-
- public String getScpArgs() {
- return scpArgs;
- }
- public void setScpArgs(String scpArgs) {
- this.scpArgs = scpArgs;
- }
- public String getScpExe() {
- return scpExe;
- }
- public void setScpExe(String scpExe) {
- this.scpExe = scpExe;
- }
- public String getSshArgs() {
- return sshArgs;
- }
- public void setSshArgs(String sshArgs) {
- this.sshArgs = sshArgs;
- }
- public String getSshExe() {
- return sshExe;
- }
- public void setSshExe(String sshExe) {
- this.sshExe = sshExe;
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/AbstractDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/AbstractDeployer.java
deleted file mode 100644
index 9bdebc21..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/AbstractDeployer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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 org.apache.maven.deploy.exceptions.TransferFailedException;
-
-
-/**
- * Base deployer from which all deployers are derived.
- *
- * @author Jason van Zyl
- * @author Michal Maczka
- * @version $Id: AbstractDeployer.java,v 1.4 2004/03/02 14:59:31 evenisse Exp $
- */
-public abstract class AbstractDeployer implements Deployer
-{
- public void flush() throws TransferFailedException
- {
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/Deployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/Deployer.java
deleted file mode 100644
index 16f52c59..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/Deployer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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 org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-/**
- *
- * Common interface for classes capable of uploading a file to remote host
-
- *
- * @author Michal Maczka
- * @version $Id: Deployer.java,v 1.6 2004/03/02 14:59:31 evenisse Exp $
- */
-public interface Deployer
-{
- /**
- * Set the information about host to which we will deploy.
- * In this method deployer can allocate the resources which will
- * be needed to perform an upload. E.g. connection to remote host
- * can be opened,
- * Resources allocated in this metod should
- * be release when deloyer is not needed any more
- * @see #release()
- *
- * @param repoInfo
- * @throws AuthenticationException when connection to remote host cannot be established
- */
- public void init( RepositoryInfo repoInfo )
- throws AuthenticationException;
-
- /**
- * Release all resources which were allocated
- * by this deployer (e.g. a connection to remote host)
- *
- */
- public void release( );
-
- /**
- * Perform an upload of single file to remote host
- * @param request DeployRequest which should contatin all parameters
- * which are necessery to upload a file
- * to remote host.
- */
- public void deploy( DeployRequest request )
- throws TransferFailedException;
-
- /**
- *
- */
- public void flush() throws TransferFailedException;
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/ExternalDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/ExternalDeployer.java
deleted file mode 100644
index 7e13fdad..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/ExternalDeployer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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 org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-
-/**
- * Deployers which for every deployment request
- * starts a new external process (e.g batch file, shell script)
- *
- * @version $Id: ExternalDeployer.java,v 1.5 2004/06/25 13:50:05 brett Exp $
- * @todo still have to account for differing setups for people deploying to
- * their own sites and to the central repository.
- * @todo finich
- */
-public class ExternalDeployer extends AbstractDeployer
-{
-
- public final static String PROTOCOL = "external://";
-
- private String cmd = null;
-
- private static final Log LOG = LogFactory.getLog(ExternalDeployer.class);
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo) throws AuthenticationException
- {
-
- cmd = repoInfo.getHost();
-
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
-
-
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#deploy(org.apache.maven.deploy.DeployRequest)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
-
- String[] params = { request.getSrcFile(), request.getDestFile(), };
-
- try
- {
- LOG.debug(
- "Staring external process: '"
- + cmd
- + "' to deploy:'"
- + request.getDestFile());
- Process process = Runtime.getRuntime().exec(cmd, params);
- process.waitFor();
- LOG.debug("External process finished");
- }
- catch (Exception e)
- {
- throw new TransferFailedException(
- "Failed to deploy with external program",
- e);
- }
-
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java
deleted file mode 100644
index 590e7fe1..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.File;
-import java.io.IOException;
-
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Deployer which deploys to directory visible in local
- * file system.
- *
- * @author Michal Maczka
- * @version $Id$
- */
-public class FileDeployer extends AbstractDeployer
-{
-
- private RepositoryInfo repoInfo;
-
- /** Protocol understandable by this deployer*/
- public final static String PROTOCOL = "file://";
-
- /**
- * Do nothing
- */
- public void init(RepositoryInfo repoInfo)
- {
- this.repoInfo = repoInfo;
- }
-
- /**
- * Do nothing
- */
- public void release()
- {
- }
-
- /**
- * @see org.apache.maven.fetch.fetchers.Fetcher#fetchUrl(java.lang.String, java.io.OutputStream)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
- try
- {
- File srcFile = new File(request.getSrcFile());
-
- File destFile =
- new File(
- repoInfo.getHost(),
- repoInfo.getBasedir());
- destFile = new File(destFile, request.dirname());
- if (!destFile.exists())
- {
- destFile.mkdirs();
- }
- destFile = new File(destFile, request.filename());
- FileUtils.copyFile(srcFile, destFile);
- }
- catch (IOException e)
- {
- throw new TransferFailedException(
- "Cannot copy file: " + e.getMessage(), e);
- }
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java
deleted file mode 100644
index 2f409272..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.FileInputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.net.ProtocolCommandEvent;
-import org.apache.commons.net.ProtocolCommandListener;
-import org.apache.commons.net.ftp.FTP;
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPReply;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-/**
- * An FTP deployer based on the FTPClient in the Commons Net package.
- *
- * Proxy server for FTPClient is not supported:
- * {@link http://issues.apache.org/bugzilla/show_bug.cgi?id=18039}
- *
- * @author Jason van Zyl
- * @author Michal Maczka
- * @version $Id$
- *
- * @todo review exception handling
- * @todo don't spool to System.out
- *
- */
-public class FtpDeployer extends AbstractDeployer
-{
- /** Protocol understandable by this deployer*/
- public final static String PROTOCOL = "ftp://";
-
- private FTPClient ftp = null;
- private RepositoryInfo repoInfo = null;
- private static final Log LOG = LogFactory.getLog(FtpDeployer.class);
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo)
- throws AuthenticationException
- {
- String username = repoInfo.getUserName();
- String password = repoInfo.getPassword();
- String host = repoInfo.getHost();
-
- ftp = new FTPClient();
-
- if (repoInfo.isDebugOn())
- {
- ftp.addProtocolCommandListener(
- new PrintCommandListener(new PrintWriter(System.out)));
- }
- try
- {
- int reply;
- if (repoInfo.getPort()
- != RepositoryInfo.UNKNOWN_PORT)
- {
- ftp.connect(host, repoInfo.getPort());
- }
- else
- {
- ftp.connect(host);
- }
- LOG.info("Connected to " + host + ".");
-
- // After connection attempt, you should check the reply code to verify
- // success.
- reply = ftp.getReplyCode();
-
- if (FTPReply.isPositiveCompletion(reply) == false)
- {
- ftp.disconnect();
- throw new AuthenticationException("FTP server refused connection.");
- }
- }
- catch (IOException e)
- {
- if (ftp.isConnected())
- {
- try
- {
- ftp.disconnect();
- }
- catch (IOException f)
- {
- // do nothing
- }
- }
- throw new AuthenticationException("Could not connect to server.",e);
- }
-
- try
- {
- if (ftp.login(username.trim(), password.trim()) == false)
- {
- throw new AuthenticationException("Cannot login to remote system");
- }
-
- LOG.info("Remote system is " + ftp.getSystemName());
-
- // Set to binary mode.
- ftp.setFileType(FTP.BINARY_FILE_TYPE);
-
- if(repoInfo.isPassiveModeOn())
- {
- ftp.enterLocalPassiveMode();
- }
- handleCommand( ftp.changeWorkingDirectory(repoInfo.getBasedir()));
- }
- catch (IOException e)
- {
- throw new AuthenticationException("Cannot login to remote system",e);
- }
- catch (TransferFailedException e)
- {
- throw new AuthenticationException("Cannot locate base directory", e );
- }
- this.repoInfo = repoInfo;
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
- if (ftp.isConnected())
- {
- try
- {
- ftp.disconnect();
- }
- catch (IOException e)
- {
- // do nothing
- }
- }
-
- }
-
- /**
- * @see Deployer#deploy(DeployRequest)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
-
- try
- {
- String[] dirs = StringUtils.split(request.dirname(), "/");
- for (int i = 0; i < dirs.length; i++)
- {
- if ( !ftp.changeWorkingDirectory(dirs[i])) {
- handleCommand( ftp.makeDirectory(dirs[i]));
- // Ignore errors
- ftp.sendSiteCommand( "CHGRP " + repoInfo.getGroup() + " " + dirs[i] );
- ftp.sendSiteCommand( "CHMOD " + repoInfo.getDirectoryMode() + " " + dirs[i] );
- handleCommand( ftp.changeWorkingDirectory(dirs[i]));
- }
- }
- handleCommand( ftp.storeFile(
- request.filename(),
- new FileInputStream(request.getSrcFile())));
- // Ignore errors
- ftp.sendSiteCommand( "CHGRP " + repoInfo.getGroup() + " " + request.filename() );
- ftp.sendSiteCommand( "CHMOD " + repoInfo.getMode() + " " + request.filename() );
- for (int i = 0; i < dirs.length; i++)
- {
- handleCommand( ftp.changeWorkingDirectory(".."));
- }
-
- }
- catch (TransferFailedException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new TransferFailedException(e.getMessage(),e);
- }
-
- }
-
- private void handleCommand( boolean response ) throws TransferFailedException
- {
- if ( !response )
- {
- throw new TransferFailedException( "Error executing FTP command" );
- }
- }
-
- /**
- * Description of the Class
- */
- public class PrintCommandListener implements ProtocolCommandListener
- {
- private PrintWriter writer;
-
- /**
- * Constructor for the PrintCommandListener object
- *
- * @param writer
- */
- public PrintCommandListener(PrintWriter writer)
- {
- this.writer = writer;
- }
-
- /**
- * Description of the Method
- */
- public void protocolCommandSent(ProtocolCommandEvent event)
- {
- writer.print(event.getMessage());
- writer.flush();
- }
-
- /**
- * Description of the Method
- */
- public void protocolReplyReceived(ProtocolCommandEvent event)
- {
- writer.print(event.getMessage());
- writer.flush();
- }
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java
deleted file mode 100644
index b80acac4..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java
+++ /dev/null
@@ -1,253 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.File;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.Proxy;
-import com.jcraft.jsch.ProxyHTTP;
-import com.jcraft.jsch.ProxySOCKS5;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.UserInfo;
-
-/**
- * A base class for deployers using protocols from SSH2 family
- * and JSch library for underlining implmenetation
- *
- * This is responsible for authentification stage of the process.
- *
- * We will first try to
- * use public keys for authentication
- * and if that doesn't work then we fall back
- * to using the login and password
- *
- * @version $Id: GenericSshDeployer.java,v 1.12 2004/09/28 09:20:40 brett Exp $
- * @todo still have to account for differing setups for people deploying to
- * their own sites and to the central repository.
- * @todo improve exception handling
- */
-public abstract class GenericSshDeployer extends AbstractDeployer
-{
-
- private RepositoryInfo repoInfo;
-
- /** Default port used for SSH protocol */
- public final static int DEFAULT_SSH_PORT = 22;
-
- /** Default port used by SOCKS5 proxy server */
- public final static int SOCKS5_PROXY_PORT = 1080;
-
- private Session session = null;
-
- private static final Log LOG = LogFactory.getLog(GenericSshDeployer.class);
-
- /**
- * @return
- */
- public Session getSession()
- {
- return session;
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#getAuthenticationInfo()
- */
- public RepositoryInfo getRepositoryInfo()
- {
- return repoInfo;
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
- if ( session != null )
- {
- session.disconnect();
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo)
- throws AuthenticationException
- {
- try {
- Class.forName( "javax.crypto.spec.DHParameterSpec" );
- }
- catch ( ClassNotFoundException e )
- {
- LOG.error( "JCE is required for an SSH based deployer" );
- LOG.error( "Please use JDK 1.4 or above, or install a JCE provider" );
- LOG.error( "A free (GPL) provider is available from Bouncycastle:" );
- LOG.error( "http://www.bouncycastle.org/" );
-
- throw new AuthenticationException( "JCE required" );
- }
-
- try
- {
- this.repoInfo = repoInfo;
- JSch jsch = new JSch();
-
- int port = repoInfo.getPort();
- if (port == RepositoryInfo.UNKNOWN_PORT)
- {
- port = DEFAULT_SSH_PORT;
- }
- LOG.debug("host: '" + repoInfo.getHost() + "'");
- String host = repoInfo.getHost();
- session =
- jsch.getSession(repoInfo.getUserName(), host, port);
-
- // Look for the private key and use it if available.
- if (repoInfo.getPrivateKey() != null)
- {
- File privateKey = new File(repoInfo.getPrivateKey());
-
- if (privateKey.exists())
- {
- if (repoInfo.getPassphrase() == null)
- {
- repoInfo.setPassphrase("");
- }
-
- LOG.info("Using private key: " + privateKey);
- jsch.addIdentity(
- privateKey.getAbsolutePath(),
- repoInfo.getPassphrase());
- }
- else
- {
- String msg = "Private key: " + privateKey + " not found ";
- throw new AuthenticationException(msg);
- }
- }
-
- String proxyHost = repoInfo.getProxyHost();
-
- if (proxyHost != null)
- {
- Proxy proxy = null;
- int proxyPort = repoInfo.getProxyPort();
- // HACK:
- //if port == 1080 we will use SOCKS5 Proxy
- // otherwise will use HTTP Proxy
-
- if (proxyPort == SOCKS5_PROXY_PORT)
- {
- proxy = new ProxySOCKS5(proxyHost);
- ((ProxySOCKS5) proxy).setUserPasswd(
- repoInfo.getProxyUserName(),
- repoInfo.getProxyPassword());
- }
- else
- {
- proxy = new ProxyHTTP(proxyHost, proxyPort);
- ((ProxyHTTP) proxy).setUserPasswd(
- repoInfo.getProxyUserName(),
- repoInfo.getProxyPassword());
- }
- proxy.connect(session, host, port);
-
- }
- // username and password will be given via UserInfo interface.
- UserInfo ui = new MavenUserInfo(repoInfo);
- session.setUserInfo(ui);
- session.connect();
-
- }
- catch (Exception e)
- {
- LOG.debug("Connection failure exception", e);
- throw new AuthenticationException( "Cannot connect. Reason: " + e.getMessage() );
- }
- }
-
- /**
- * MavenUserInfo class which returns the necessary name and password from
- * the POM to secure an ssh connection.
- */
- public class MavenUserInfo implements UserInfo
- {
-
- RepositoryInfo repoInfo;
-
- MavenUserInfo(RepositoryInfo repoInfo)
- {
- this.repoInfo = repoInfo;
- }
-
- public String getPassphrase()
- {
- return repoInfo.getPassphrase();
- }
-
- /* (non-Javadoc)
- * @see com.jcraft.jsch.UserInfo#getPassword()
- */
- public String getPassword()
- {
- return repoInfo.getPassword();
- }
-
- /* (non-Javadoc)
- * @see com.jcraft.jsch.UserInfo#promptPassphrase(java.lang.String)
- */
- public boolean promptPassphrase(String arg0)
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see com.jcraft.jsch.UserInfo#promptPassword(java.lang.String)
- */
- public boolean promptPassword(String arg0)
- {
- return true;
- }
-
- /**
- * @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String)
- */
- public boolean promptYesNo(String arg0)
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String)
- */
- public void showMessage(String message)
- {
- LOG.info(message);
-
- }
-
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/HttpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/HttpDeployer.java
deleted file mode 100644
index d93cd775..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/HttpDeployer.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HostConfiguration;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-/**
- * An HTTP deployer based the Commons HttpClient library.
- *
- * @author Jason van Zyl
- * @version $Id: HttpDeployer.java,v 1.7 2004/06/25 13:50:05 brett Exp $
- *
- * @todo still have to account for differing setups for people deploying to
- * their own sites and to the central repository.
- *
- * @todo deal with proxies
- * @todo deal with authentication
- *
- * @todo this class in not really functional. It should be completly refactored.
- */
-public class HttpDeployer extends AbstractDeployer
-{
- private RepositoryInfo repoInfo;
-
-
- /**Protocol understood by by this deployer*/
- public final static String PROTOCOL = "http://";
-
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo)
-
- {
- this.repoInfo = repoInfo;
-
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * Description of the Method
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
- URL url = null;
- try
- {
- url = new URL(repoInfo.getUrl());
- }
- catch (MalformedURLException murle)
- {
- }
-
- Credentials creds =
- new UsernamePasswordCredentials(
- repoInfo.getUserName(),
- repoInfo.getPassword());
-
- //create a singular HttpClient object
- HttpClient client = new HttpClient();
-
-
- //establish a connection within 5 seconds
- client.setConnectionTimeout(5000);
-
- //set username / password
- if (creds != null)
- {
- client.getState().setCredentials(null, creds);
- }
-
- //
- HostConfiguration hc = new HostConfiguration();
- hc.setHost(repoInfo.getHost());
- //start a session with the webserver
- client.setHostConfiguration(hc);
-
- //create a method object
- PutMethod method = new PutMethod(url.getPath());
-
- try
- {
- method.setRequestBody(new FileInputStream(request.getSrcFile()));
- }
- catch(FileNotFoundException io)
- {
- throw new TransferFailedException("input file: '"+ request.getSrcFile() + " not found ");
- }
-
- //turn follow redirects off
- method.setFollowRedirects(false);
-
- //turn strict mode on
- method.setStrictMode(false);
-
- //execute the method
- try
- {
- client.executeMethod(method);
- }
- catch (HttpException e)
- {
- throw new TransferFailedException("Http error connecting to '" + url + "'", e);
- }
- catch (IOException e)
- {
- throw new TransferFailedException("Unable to connect to '" + url + "'", e);
- }
-
- //get the request headers
- Header[] requestHeaders = method.getRequestHeaders();
-
- //get the response headers
- Header[] responseHeaders = method.getResponseHeaders();
-
- //get the response body
- byte[] responseBody = method.getResponseBody();
-
- method.releaseConnection();
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java
deleted file mode 100644
index e2215efa..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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 org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-import com.jcraft.jsch.ChannelSftp;
-import com.jcraft.jsch.SftpATTRS;
-import com.jcraft.jsch.SftpException;
-import com.jcraft.jsch.SftpProgressMonitor;
-
-/**
- * An SSH2/SFTP deployer
- *
- * @author Michal Maczka
- * @version $Revision: 1.12 $ $Date: 2004/09/28 09:20:40 $
- */
-public class SFtpDeployer extends GenericSshDeployer
-{
- private static final Log LOG = LogFactory.getLog(SFtpDeployer.class);
-
- /**Protocol understood by by this deployer*/
- public final static String PROTOCOL = "sftp://";
-
- /** SSH2 Chanel names used to communicate with the server*/
- private final static String SFTP_CHANNEL = "sftp";
-
- /** artibute of file used in SSH which denotes is given file is a directory*/
- private static final int S_IFDIR = 0x4000;
-
- private ChannelSftp channel = null;
-
- private Integer groupId = null;
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo)
- throws AuthenticationException
- {
-
- try
- {
- if (repoInfo.getGroup() != null)
- {
- groupId = Integer.getInteger(repoInfo.getGroup());
- }
- }
- catch (NumberFormatException e)
- {
- throw new AuthenticationException("SFTP deployer: remote group should be an integer");
- }
- super.init(repoInfo);
-
- channel = null;
- try
- {
- channel = (ChannelSftp) getSession().openChannel(SFTP_CHANNEL);
- channel.connect();
- channel.cd(repoInfo.getBasedir());
- }
- catch (Exception e)
- {
- throw new AuthenticationException(e.getMessage(),e);
- }
-
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
- channel.disconnect();
- super.release();
- }
-
- /**
- * @see Deployer#deploy(DeployRequest)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
- try
- {
-
- // iterate over all directories in the path. try to create
- // directory
- String[] dirs = StringUtils.split(request.dirname(), "/");
- for (int i = 0; i < dirs.length; i++)
- {
- try
- {
- SftpATTRS attrs = channel.stat(dirs[i]);
- if ((attrs.getPermissions() & S_IFDIR) != 0)
- {
- // file exists and is dierctory
- channel.cd(dirs[i]);
- }
- else
- {
- throw new TransferFailedException(
- "Incorrect remote path:" + request.getDestFile());
- }
- }
- catch (Exception e)
- {
- // file most probably does not exists
- channel.mkdir(dirs[i]);
- channel.cd(dirs[i]);
- }
-
- }
- if (getRepositoryInfo().isDebugOn())
- {
- channel.put(
- request.getSrcFile(),
- request.filename(),
- new ProgressMonitor());
- }
- else
- {
-
- channel.put(request.getSrcFile(), request.filename());
-
- }
-
- if (groupId != null)
- {
- if (getRepositoryInfo().isDebugOn())
- {
- LOG.info("Changing group to: " + groupId);
- }
- channel.chgrp(groupId.intValue(), request.filename());
- if (getRepositoryInfo().isDebugOn())
- {
- LOG.info("Group successfully changed");
- }
-
- }
- // change back the working directory to repository root
- for (int i = 0; i < dirs.length; i++)
- {
- channel.cd("..");
- }
- }
- catch (SftpException e)
- {
-
- String msg =
- "Error occured while deploying to remote host:"
- + getRepositoryInfo().getHost()
- + ":"
- + e.getMessage();
- throw new TransferFailedException(msg, e);
- }
-
- }
-
- /** @todo use logger */
- class ProgressMonitor implements SftpProgressMonitor
- {
-
- public boolean count(long count)
- {
- System.out.print("#");
- return true;
- }
-
- public void end()
- {
- System.out.println();
-
- }
-
- public void init(int op, String src, String dest, long max)
- {
-
- }
-
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java
deleted file mode 100644
index 1038ac43..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java
+++ /dev/null
@@ -1,421 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-/* ====================================================================
- * Copyright 2001-2004 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 com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.Session;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-import org.apache.maven.deploy.util.Packager;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * An SSH2/SCP deployer
- *
- * @author Michal Maczka
- * @version $Revision: 1.13 $ $Date: 2004/09/28 09:20:40 $
- */
-public class ScpDeployer extends GenericSshDeployer
-{
- private static final Log LOG = LogFactory.getLog(ScpDeployer.class);
-
- /**Protocol understood by this deployer*/
- public final static String PROTOCOL = "scp://";
-
- /** SSH2 Channel name used to communicate with the server*/
- public final static String EXEC_CHANNEL = "exec";
-
- /**
- * I want to have compression by default
- * so if system property is missing flag will be set to false
- * that's why I am using deployNotCompressed variable name instead of
- * straight forward deployCompressed
- */
- public boolean deployNotCompressed = true;
- private List srcFiles = new LinkedList();
- private List destFiles = new LinkedList();
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void flush() throws TransferFailedException
- {
- if (!deployNotCompressed)
- {
- doDeployCompressed();
- }
-
- super.flush();
- }
-
- /**
- * @return
- */
- public boolean isDeployNotCompressed()
- {
- return deployNotCompressed;
- }
-
- /**
- * @param deployCompressed
- */
- public void setDeployNotCompressed(boolean deployNotCompressed)
- {
- this.deployNotCompressed = deployNotCompressed;
- }
-
- /**
- * @todo Find better way to configure deployer
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.RepositoryInfo)
- */
- public void init(RepositoryInfo repoInfo) throws AuthenticationException
- {
- setDeployNotCompressed(!repoInfo.getCompress());
- super.init(repoInfo);
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#deploy(org.apache.maven.deploy.DeployRequest)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
- LOG.debug("deployNotCompressed=" + deployNotCompressed);
- if (deployNotCompressed)
- {
- doDeployNotCompressed(request);
- }
- else
- {
- srcFiles.add(request.getSrcFile());
- destFiles.add(request.getDestFile());
- doDeployCompressed();
- }
- }
-
- /**
- * @see Deployer#deploy(DeployRequest)
- *
- */
- public void doDeployNotCompressed(DeployRequest request)
- throws TransferFailedException
- {
- Session session = getSession();
- String mkdirCmd =
- "mkdir -p "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.dirname()
- + "\n";
-
- executeSimpleCommand(session, mkdirCmd);
-
- // If an old SNAPSHOT exists, remove it
- if (request.getDestFile().indexOf("SNAPSHOT") > 0) {
- String cmd =
- "rm -f "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(session, cmd);
- }
-
- doCopy(session, request);
-
- if (getRepositoryInfo().getGroup() != null)
- {
- String chgrpCmd =
- "chgrp "
- + getRepositoryInfo().getGroup()
- + " "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(session, chgrpCmd);
- }
-
- if (getRepositoryInfo().getMode() != null)
- {
- String chmodCmd =
- "chmod "
- + getRepositoryInfo().getMode()
- + " "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(session, chmodCmd);
- }
- }
-
- /**
- * @see Deployer#deploy(DeployRequest)
- *
- */
- public void doDeployCompressed() throws TransferFailedException
- {
- Session session = getSession();
- File zip = null;
-
- try
- {
- zip = File.createTempFile("maven-deployer-", ".zip");
- Packager.createZip(srcFiles, destFiles, zip);
- }
- catch (IOException e)
- {
- if ((zip != null) && zip.exists())
- {
- try
- {
- zip.delete();
- }
- catch (Exception ee)
- {
- // ignore
- // file is left in temp directory
- // no tragedy
- }
- }
-
- throw new TransferFailedException("Cannot create ZIP file",e);
- }
-
- try
- {
- DeployRequest request =
- new DeployRequest(zip.getAbsolutePath(), zip.getName());
-
- doCopy(session, request);
-
- String unzipCmd =
- "unzip -uo "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + " -d "
- + getRepositoryInfo().getBasedir()
- + "\n";
- executeSimpleCommand(session, unzipCmd);
-
- //@ this is not working!
- String rmCmd =
- "rm -f "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(session, rmCmd);
-
- if (getRepositoryInfo().getGroup() != null)
- {
- String chgrpCmd =
- "chgrp -r "
- + getRepositoryInfo().getGroup()
- + " "
- + getRepositoryInfo().getBasedir()
- + "\n";
-
- executeSimpleCommand(session, chgrpCmd);
- }
-
- }
- finally
- {
- if ((zip != null) && zip.exists())
- {
- try
- {
- zip.delete();
- }
- catch (Exception ee)
- {
- // ignore
- // file is left in temp directory
- // no tragedy
- }
- }
- }
- }
-
- /**
- * Execute "simple" remote command using exec channel
- */
- private void executeSimpleCommand(Session session, String command)
- throws TransferFailedException
- {
- LOG.info("Executing command: " + command);
-
- ChannelExec channel = null;
-
- try
- {
- channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);
- channel.setCommand(command);
-
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
- }
- catch (Exception e)
- {
- throw new TransferFailedException(
- "Cannot execute remote command: " + command,e);
- }
- finally
- {
- if (channel != null)
- {
- channel.disconnect();
- }
- }
- }
-
- /**
- * Copy artifact to remote host.
- * Code extracted from JSCH exaples
- */
- private void doCopy(Session session, DeployRequest request)
- throws TransferFailedException
- {
- ChannelExec channel = null;
-
- try
- {
- String srcFile = request.getSrcFile();
- String destFile =
- getRepositoryInfo().getBasedir() + "/" + request.getDestFile();
-
- // exec 'scp -t rfile' remotely
- String command = "scp -t " + destFile;
-
- LOG.debug("Executing command: " + command);
- channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);
- channel.setCommand(command);
-
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- byte[] tmp = new byte[1];
-
- // wait for '\0'
- do
- {
- in.read(tmp, 0, 1);
- }
- while (tmp[0] != 0);
-
- // send "C0644 filesize filename", where filename should not include '/'
- int filesize = (int) (new File(srcFile)).length();
-
- command = "C0644 " + filesize + " ";
-
- if (srcFile.lastIndexOf('/') > 0)
- {
- command += srcFile.substring(srcFile.lastIndexOf('/') + 1);
- }
- else
- {
- command += srcFile;
- }
-
- command += "\n";
-
- out.write(command.getBytes());
- out.flush();
-
- // wait for '\0'
- do
- {
- in.read(tmp, 0, 1);
- }
- while (tmp[0] != 0);
-
- // send a content of inputFile
- byte[] buf = new byte[1024];
- FileInputStream fis = new FileInputStream(srcFile);
- try {
- while (true)
- {
- int len = fis.read(buf, 0, buf.length);
-
- if (len <= 0)
- {
- break;
- }
-
- out.write(buf, 0, len);
- out.flush();
- }
- }
- finally {
- fis.close();
- }
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- // wait for '\0'
- do
- {
- in.read(tmp, 0, 1);
- }
- while (tmp[0] != 0);
- }
- catch (Exception e)
- {
- String msg =
- "Error occured while deploying to remote host:"
- + getRepositoryInfo().getHost();
-
- throw new TransferFailedException(msg, e);
- }
- finally
- {
- if (channel != null)
- {
- channel.disconnect();
- }
- }
- }
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/deployers/ScpExeDeployer.java b/artifact/src/main/org/apache/maven/deploy/deployers/ScpExeDeployer.java
deleted file mode 100755
index 5d24ef56..00000000
--- a/artifact/src/main/org/apache/maven/deploy/deployers/ScpExeDeployer.java
+++ /dev/null
@@ -1,240 +0,0 @@
-package org.apache.maven.deploy.deployers;
-
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.maven.MavenUtils;
-import org.apache.maven.deploy.DeployRequest;
-import org.apache.maven.deploy.RepositoryInfo;
-import org.apache.maven.deploy.exceptions.AuthenticationException;
-import org.apache.maven.deploy.exceptions.TransferFailedException;
-
-
-/**
- * SCP deployer using "external" scp program. To allow for
- * ssh-agent type behavior. Also provides backwards compatible
- * support for those using the
- * maven.scp.executable/maven.scp.args
- * and maven.ssh.executable/maven.ssh.args
- *
- *
- */
-public class ScpExeDeployer extends AbstractDeployer
-{
-
- public final static String PROTOCOL = "scpexe://";
- private RepositoryInfo repositoryInfo = null;
-
- private String cmd = null;
-
- private static final Log LOG = LogFactory.getLog(ScpExeDeployer.class);
-
- /* (non-Javadoc)
- * @see org.apache.maven.deploy.deployers.Deployer#init(org.apache.maven.deploy.HostInfo)
- */
- public void init(RepositoryInfo repoInfo) throws AuthenticationException
- {
- repositoryInfo = repoInfo;
- }
-
- private RepositoryInfo getRepositoryInfo() {
- return repositoryInfo;
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#release()
- */
- public void release()
- {
- }
-
- /**
- * @see org.apache.maven.deploy.deployers.Deployer#deploy(org.apache.maven.deploy.DeployRequest)
- */
- public void deploy(DeployRequest request) throws TransferFailedException
- {
- String mkdirCmd =
- "mkdir -p "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.dirname()
- + "\n";
-
- executeSimpleCommand(mkdirCmd);
-
- doCopy(request);
-
- if (getRepositoryInfo().getGroup() != null)
- {
- String chgrpCmd =
- "chgrp "
- + getRepositoryInfo().getGroup()
- + " "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(chgrpCmd);
- }
-
- if (getRepositoryInfo().getMode() != null)
- {
- String chmodCmd =
- "chmod "
- + getRepositoryInfo().getMode()
- + " "
- + getRepositoryInfo().getBasedir()
- + "/"
- + request.getDestFile()
- + "\n";
-
- executeSimpleCommand(chmodCmd);
- }
- }
-
- private String arrayToString(String[] array) {
- StringBuffer sb = new StringBuffer();
- for (int i=0; i 0) {
- // If an old SNAPSHOT exists, remove it
- executeSimpleCommand("rm -f " + destFile);
- }
-
- String args = getRepositoryInfo().getScpArgs();
- String scpCmd = getRepositoryInfo().getScpExe() + " " +
- ( args == null ? "" : args + " " ) +
- srcFile + " " +
- getRepositoryInfo().getUserName() + "@" + getRepositoryInfo().getHost() + ":" + destFile;
- try {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Executing command: " + scpCmd);
- }
- Process p = Runtime.getRuntime().exec(scpCmd);
- // any error message?
- StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), "ERROR");
-
- // any output?
- StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream(), "OUTPUT");
-
- // kick them off
- errorGobbler.start();
- outputGobbler.start();
-
- int returnCode = p.waitFor();
- if (returnCode != 0) {
- LOG.debug( "exit code = " + returnCode );
- throw new TransferFailedException("Error executing command: " + scpCmd);
- }
- } catch (IOException e) {
- LOG.error("Error executing command: " + cmd);
- throw new TransferFailedException("Error executing command: ", e);
- } catch (InterruptedException e) {
- LOG.error("Error executing command: " + cmd);
- throw new TransferFailedException("Error executing command: ", e);
- }
-
- }
-
- private class StreamGobbler extends Thread
- {
- private InputStream is;
- private String type;
-
- public StreamGobbler(InputStream is, String type) {
- this.is = is;
- this.type = type;
- }
-
- public void run() {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line = null;
- while ((line = br.readLine()) != null) {
- LOG.debug(type + ">" + line);
- }
- br.close();
- isr.close();
-
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
- }
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/exceptions/AuthenticationException.java b/artifact/src/main/org/apache/maven/deploy/exceptions/AuthenticationException.java
deleted file mode 100644
index 560ea29b..00000000
--- a/artifact/src/main/org/apache/maven/deploy/exceptions/AuthenticationException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.maven.deploy.exceptions;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-/**
- *
- * @author Michal Maczka
- * @version $Id: AuthenticationException.java,v 1.3 2004/05/02 17:02:08 vmassol Exp $
- */
-public class AuthenticationException extends DeployException
-{
-
- /**
- * @param message
- */
- public AuthenticationException(String message)
- {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public AuthenticationException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/exceptions/DeployException.java b/artifact/src/main/org/apache/maven/deploy/exceptions/DeployException.java
deleted file mode 100644
index 6405b332..00000000
--- a/artifact/src/main/org/apache/maven/deploy/exceptions/DeployException.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.apache.maven.deploy.exceptions;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-
-/**
- * Root class for all exception thrown by Deployers
- * @author Michal Maczka
- * @version $Id: DeployException.java,v 1.4 2004/05/02 17:02:08 vmassol Exp $
- */
-public abstract class DeployException extends Exception
-{
- private final String message;
- private final Throwable cause;
- public DeployException(String message, Throwable cause)
- {
- this.message = message;
- this.cause = cause;
- }
-
- public DeployException(String message)
- {
- this.message = message;
- this.cause = null;
- }
-
- /**
- * @return
- */
- public Throwable getCause()
- {
- return cause;
- }
-
- /**
- * @return
- */
- public String getMessage()
- {
- return message;
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/exceptions/TransferFailedException.java b/artifact/src/main/org/apache/maven/deploy/exceptions/TransferFailedException.java
deleted file mode 100644
index 7bc7e716..00000000
--- a/artifact/src/main/org/apache/maven/deploy/exceptions/TransferFailedException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.apache.maven.deploy.exceptions;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-
-/**
- * Exception which should be thrown when IO error occures during
- * making remote copy of the file
- *
- * @author Michal Maczka
- * @version $Id: TransferFailedException.java,v 1.3 2004/05/02 17:02:08 vmassol Exp $
- */
-public class TransferFailedException extends DeployException
-{
-
- /**
- * @param message
- */
- public TransferFailedException(String message)
- {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public TransferFailedException(String message, Throwable cause)
- {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/exceptions/UnsupportedProtocolException.java b/artifact/src/main/org/apache/maven/deploy/exceptions/UnsupportedProtocolException.java
deleted file mode 100644
index 4411cd32..00000000
--- a/artifact/src/main/org/apache/maven/deploy/exceptions/UnsupportedProtocolException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.apache.maven.deploy.exceptions;
-
-/* ====================================================================
- * Copyright 2001-2004 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.
- * ====================================================================
- */
-
-
-/**
- *
- * @author Michal Maczka
- * @version $Id: UnsupportedProtocolException.java,v 1.3 2004/05/02 17:02:08 vmassol Exp $
- */
-public class UnsupportedProtocolException extends DeployException
-{
- /**
- * @param message
- */
- public UnsupportedProtocolException(String message)
- {
- super(message);
- }
-
- /**
- * @param message
- * @param cause
- */
- public UnsupportedProtocolException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
-}
diff --git a/artifact/src/main/org/apache/maven/deploy/util/Packager.java b/artifact/src/main/org/apache/maven/deploy/util/Packager.java
deleted file mode 100644
index 3c57bb4e..00000000
--- a/artifact/src/main/org/apache/maven/deploy/util/Packager.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.apache.maven.deploy.util;
-
-/* ====================================================================
- * Copyright 2001-2004 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.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.zip.Deflater;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- *
- * @author Michal Maczka
- * @version $Id: Packager.java,v 1.4 2004/05/02 17:02:09 vmassol Exp $
- */
-public class Packager
-{
- /**
- *
- * @param inputFiles
- * @param outputFiles
- * @param archive
- * @throws IOException
- */
- public static void createZip( List srcFiles, List destFiles, String archive )
- throws IOException
- {
- createZip( srcFiles, destFiles, new File( archive ) );
- }
-
- /**
- *
- * @param inputFiles
- * @param outputFiles
- * @param archive
- * @throws IOException
- */
- public static void createZip( List srcFiles, List destFiles, File archive )
- throws IOException
- {
- byte[] buf = new byte[1024];
-
- ZipOutputStream out = null;
-
- try
- {
- out = new ZipOutputStream( new FileOutputStream( archive ) );
- out.setLevel( Deflater.BEST_COMPRESSION );
- out.setMethod( ZipOutputStream.DEFLATED );
-
- Iterator iter1 = srcFiles.iterator( );
- Iterator iter2 = destFiles.iterator( );
-
- while ( iter1.hasNext( ) )
- {
- String inputFilename = ( String ) iter1.next( );
- String outputFilename = ( String ) iter2.next( );
-
- FileInputStream in = new FileInputStream( inputFilename );
-
- // Add ZIP entry to output stream.
- out.putNextEntry( new ZipEntry( outputFilename ) );
-
- // Transfer bytes from the file to the ZIP file
- int len;
-
- while ( ( len = in.read( buf ) ) > 0 )
- {
- out.write( buf, 0, len );
- }
-
- // Complete the entry
- out.closeEntry( );
- in.close( );
- }
- }
-
- // Complete the ZIP file
- finally
- {
- if ( out != null )
- {
- try
- {
- out.close( );
- }
- catch ( Exception e )
- {
- }
- }
- }
- }
-}
diff --git a/artifact/xdocs/changes.xml b/artifact/xdocs/changes.xml
index 128a616a..b238b9a0 100644
--- a/artifact/xdocs/changes.xml
+++ b/artifact/xdocs/changes.xml
@@ -25,6 +25,9 @@
Vincent Massol
+
+ Replace bulk of code with Wagon
+
Improve error handling in FTPDeployer
Allow scpexe protocol to work better with args