You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by mi...@apache.org on 2003/06/25 17:25:20 UTC
cvs commit: maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy DeployRequest.java
michal 2003/06/25 08:25:19
Modified: src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers
FtpDeployer.java SFtpDeployer.java ScpDeployer.java
FileDeployer.java HttpDeployer.java
GenericSshDeployer.java
src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer
DefaultArtifactDeployer.java DeployBean.java
src/plugins-build/artifact/src/main/org/apache/maven/deploy
DeployRequest.java
Added: src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer
DeployRequestBuilder.java
Removed: src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer
MavenDeployRequest.java
Log:
Code cleanup
Revision Changes Path
1.4 +5 -5 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java
Index: FtpDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FtpDeployer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FtpDeployer.java 24 Jun 2003 22:22:54 -0000 1.3
+++ FtpDeployer.java 25 Jun 2003 15:25:18 -0000 1.4
@@ -95,7 +95,7 @@
public void deploy(DeployRequest request) throws DeployException
{
String username = request.getUser();
- String password = request.getPass();
+ String password = request.getPassword();
String host = request.getHost();
FTPClient ftp = new FTPClient();
@@ -159,13 +159,13 @@
// Use passive mode as default because most of us are
// behind firewalls these days.
ftp.enterLocalPassiveMode();
- String workingDir = request.getOutputDir();
- String filename = request.getOutputFile();
+ String workingDir = request.getDestDir();
+ String filename = request.getDestFile();
System.out.println("Working directory " + workingDir);
System.out.println("Filename: " + filename);
ftp.makeDirectory(workingDir);
ftp.changeWorkingDirectory( workingDir);
- ftp.storeFile(filename, new FileInputStream(request.getInputFile()));
+ ftp.storeFile(filename, new FileInputStream(request.getSrcFile()));
ftp.logout();
}
catch (FTPConnectionClosedException e)
1.3 +21 -35 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java
Index: SFtpDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/SFtpDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SFtpDeployer.java 25 Jun 2003 12:33:11 -0000 1.2
+++ SFtpDeployer.java 25 Jun 2003 15:25:18 -0000 1.3
@@ -67,7 +67,7 @@
import com.jcraft.jsch.SftpException;
/**
- * An SSH2 SFTP deployer
+ * An SSH2/SFTP deployer
*
* @author Michal Maczka
* @version $Revision$ $Date$
@@ -76,8 +76,8 @@
{
public final static String PROTOCOL = "sftp://";
- public final static String SFTP_CHANNEL = "sftp";
-
+ private final static String SFTP_CHANNEL = "sftp";
+ private static final int S_IFDIR = 0x4000;
/**
* @see Deployer#project
@@ -96,7 +96,7 @@
}
catch (NumberFormatException e)
{
- throw new DeployException("For sftp protocol remote group should be an integer");
+ throw new DeployException("SFTP deployer: remote group should be an integer");
}
Session session = getSession(request);
@@ -107,10 +107,9 @@
channel.connect();
// iterate over all directories in the path. try to create
// directory
- String[] dirs = StringUtils.split(request.getOutputDir(), "/");
+ String[] dirs = StringUtils.split(request.getDestDir(), "/");
for (int i = 0; i < dirs.length; i++)
- {
- System.out.println("processing: " + dirs[i]);
+ {
try
{
SftpATTRS attrs = channel.stat(dirs[i]);
@@ -122,9 +121,7 @@
else
{
throw new DeployException(
- "Remote path:"
- + request.getOutputDir()
- + "is not correct");
+ "Incorrect remote path:" + request.getDestDir());
}
}
catch (Exception e)
@@ -136,45 +133,34 @@
}
- channel.put(request.getInputFile(), request.getOutputFile());
+ channel.put(request.getSrcFile(), request.getDestFile());
if (groupId != null)
{
- channel.chgrp(groupId.intValue(), request.getOutputFile());
+ channel.chgrp(groupId.intValue(), request.getDestFile());
}
}
catch (SftpException e)
{
- throw new DeployException(
- "Cannot deploy. Reason: " + e.getMessage(),
- e);
+
+ String msg =
+ "Error occured while deploying to remote host:"
+ + request.getHost();
+ throw new DeployException(msg, e);
}
catch (JSchException e)
{
- throw new DeployException(
- "Cannot deploy. Reason: " + e.getMessage(),
- e);
+ String msg =
+ "Error occured while deploying to remote host:"
+ + request.getHost();
+ throw new DeployException(msg, e);
}
finally
{
- try
- {
- channel.disconnect();
- }
- catch (Exception e)
- {
- //just ignore.
- }
- try
- {
- session.disconnect();
- }
- catch (Exception e)
- {
- // just ignore.
- }
+ channel.disconnect();
+ session.disconnect();
}
}
1.2 +23 -54 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java
Index: ScpDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/ScpDeployer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ScpDeployer.java 25 Jun 2003 12:33:11 -0000 1.1
+++ ScpDeployer.java 25 Jun 2003 15:25:18 -0000 1.2
@@ -58,8 +58,6 @@
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -67,11 +65,10 @@
import org.apache.maven.deploy.exceptions.DeployException;
import com.jcraft.jsch.ChannelExec;
-import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
/**
- * An SSH2 SFTP deployer
+ * An SSH2/SCP deployer
*
* @author Michal Maczka
* @version $Revision$ $Date$
@@ -95,34 +92,26 @@
try
{
- //String scpCmd = "scp -t " + request.getOutputFile() + "\n";
- executeSimpleCommand(
- session,
- "mkdir -p " + request.getOutputDir() + "\n");
-
+ String mkdirCmd = "mkdir -p " + request.getDestDir() + "\n";
+ executeSimpleCommand(session, mkdirCmd);
+
doCopy(session, request);
if (request.getGroup() != null)
{
- executeSimpleCommand(
- session,
+
+ String chgrpCmd =
"chgrp "
+ request.getGroup()
+ " "
- + request.getOutputFile()
- + "\n");
+ + request.getDestFile()
+ + "\n";
+ executeSimpleCommand(session, chgrpCmd);
}
}
finally
{
- try
- {
- session.disconnect();
- }
- catch (Exception e)
- {
- // just ignore.
- }
+ session.disconnect();
}
}
@@ -150,24 +139,16 @@
}
finally
{
- //when channel cannot be closed it is still ok. this "local"
- //failure is not global failure
if (channel != null)
{
- try
- {
- channel.disconnect();
- }
- catch (Exception e)
- {
- //ignore
- }
+ channel.disconnect();
}
}
}
/**
- * Copy artifact file using streams (pipes)
+ * Copy artifact to remote host.
+ * Code extracted from JSCH exaples
*/
private void doCopy(Session session, DeployRequest request)
throws DeployException
@@ -175,10 +156,10 @@
try
{
- String inputFile = request.getInputFile();
- String outputFile = request.getOutputFile();
- String outputDir = request.getOutputDir();
- // exec 'scp -t rfile' remotely
+ String inputFile = request.getSrcFile();
+ String outputFile = request.getDestFile();
+ String outputDir = request.getDestDir();
+ // exec 'scp -t rfile' remotely
String command = "scp -t " + outputDir + "/" + outputFile;
System.out.println("Executing command: " + command);
ChannelExec channel =
@@ -245,24 +226,12 @@
}
while (tmp[0] != 0);
}
- catch (FileNotFoundException e)
- {
-
- throw new DeployException(
- "Input file was not found: " + request.getInputFile(),
- e);
- }
- catch (IOException e)
- {
- throw new DeployException(
- "IO error while sending file: " + request.getInputFile(),
- e);
- }
- catch (JSchException e)
+ catch (Exception e)
{
- throw new DeployException(
- "Error occured while copying file to remote host",
- e);
+ String msg =
+ "Error occured while deploying to remote host:"
+ + request.getHost();
+ throw new DeployException(msg,e);
}
}
1.5 +4 -4 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java
Index: FileDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/FileDeployer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FileDeployer.java 24 Jun 2003 22:22:54 -0000 1.4
+++ FileDeployer.java 25 Jun 2003 15:25:18 -0000 1.5
@@ -80,16 +80,16 @@
{
try
{
- File inputFile = new File(request.getInputFile());
+ File inputFile = new File(request.getSrcFile());
File outputFile =
- new File(request.getHost(), request.getOutputDir());
+ new File(request.getHost(), request.getDestDir());
if (! outputFile.exists())
{
outputFile.mkdirs();
}
- outputFile = new File( outputFile, request.getOutputFile());
+ outputFile = new File( outputFile, request.getDestFile());
FileUtils.copyFile(inputFile, outputFile);
}
catch (IOException e)
1.3 +4 -4 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/HttpDeployer.java
Index: HttpDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/HttpDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpDeployer.java 24 Jun 2003 22:22:54 -0000 1.2
+++ HttpDeployer.java 25 Jun 2003 15:25:18 -0000 1.3
@@ -105,7 +105,7 @@
Credentials creds =
new UsernamePasswordCredentials(
request.getUser(),
- request.getPass());
+ request.getPassword());
//create a singular HttpClient object
HttpClient client = new HttpClient();
@@ -131,11 +131,11 @@
try
{
- method.setRequestBody(new FileInputStream(request.getInputFile()));
+ method.setRequestBody(new FileInputStream(request.getSrcFile()));
}
catch(FileNotFoundException io)
{
- throw new DeployException("input file: '"+ request.getInputFile() + " not found ");
+ throw new DeployException("input file: '"+ request.getSrcFile() + " not found ");
}
//turn follow redirects off
1.2 +2 -2 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java
Index: GenericSshDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/deployers/GenericSshDeployer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenericSshDeployer.java 25 Jun 2003 12:33:11 -0000 1.1
+++ GenericSshDeployer.java 25 Jun 2003 15:25:18 -0000 1.2
@@ -191,7 +191,7 @@
*/
public String getPassword()
{
- return request.getPass();
+ return request.getPassword();
}
/* (non-Javadoc)
1.9 +61 -56 maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
Index: DefaultArtifactDeployer.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultArtifactDeployer.java 24 Jun 2003 22:22:55 -0000 1.8
+++ DefaultArtifactDeployer.java 25 Jun 2003 15:25:19 -0000 1.9
@@ -65,13 +65,15 @@
import org.apache.commons.lang.StringUtils;
import org.apache.maven.MavenConstants;
import org.apache.maven.MavenException;
+import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.DeployTool;
import org.apache.maven.project.Project;
import org.apache.maven.util.MD5Sum;
/**
*
- * Default implemenataion of Artifact Deployer interface
+ * Default implemenataion of Artifact Deployer interface.
+ *
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
@@ -87,6 +89,7 @@
/**
* @see ArtifactDeployer#deploy(String, String, Project)
+ *
* This is "5 files" version.
* It deploys (example):
* foo-20030620.124616.jar,
@@ -95,7 +98,6 @@
* foo-SNAPSHOT.jar.md5
* foo-snapshot-version
*
- *
*/
public void deploy(String artifact, String type, Project project)
throws MavenException
@@ -108,12 +110,12 @@
String repositoryFile =
getRepositoryFile(type, project, project.getCurrentVersion());
- String[] inputFilenames =
+ String[] srcFilenames =
{ file.getAbsolutePath(), md5File.getAbsolutePath()};
- String[] outputFilenames = { repositoryFile, repositoryFile + ".md5" };
+ String[] destFilenames = { repositoryFile, repositoryFile + ".md5" };
- doDeploy(inputFilenames, outputFilenames, repositoryPath, project);
+ doDeploy(srcFilenames, destFilenames, repositoryPath, project);
}
/**
@@ -131,24 +133,24 @@
String repositoryPath =
getRepositoryPath(type, project, MavenConstants.SNAPSHOT_SIGNIFIER);
- String[] inputFilenames = new String[5];
- inputFilenames[0] = file.getAbsolutePath();
- inputFilenames[1] = file.getAbsolutePath();
- inputFilenames[2] = md5File.getAbsolutePath();
- inputFilenames[3] = md5File.getAbsolutePath();
- inputFilenames[4] = snapshotVersionFile.getAbsolutePath();
+ String[] srcFilenames = new String[5];
+ srcFilenames[0] = file.getAbsolutePath();
+ srcFilenames[1] = file.getAbsolutePath();
+ srcFilenames[2] = md5File.getAbsolutePath();
+ srcFilenames[3] = md5File.getAbsolutePath();
+ srcFilenames[4] = snapshotVersionFile.getAbsolutePath();
String out1 =
getRepositoryFile(type, project, MavenConstants.SNAPSHOT_SIGNIFIER);
String out2 = getRepositoryFile(type, project, snapshotVersion);
- String[] outputFilenames = new String[5];
- outputFilenames[0] = out1;
- outputFilenames[1] = out2;
- outputFilenames[2] = out1 + ".md5";
- outputFilenames[3] = out2 + ".md5";
- outputFilenames[4] = project.getArtifactId() + "-snapshot-version";
- doDeploy(inputFilenames, outputFilenames, repositoryPath, project);
+ String[] destFilenames = new String[5];
+ destFilenames[0] = out1;
+ destFilenames[1] = out2;
+ destFilenames[2] = out1 + ".md5";
+ destFilenames[3] = out2 + ".md5";
+ destFilenames[4] = project.getArtifactId() + "-snapshot-version";
+ doDeploy(srcFilenames, destFilenames, repositoryPath, project);
};
@@ -214,7 +216,8 @@
{
destFile.mkdirs();
}
- destFile = new File(destFile, getRepositoryFile(type, project, version));
+ destFile =
+ new File(destFile, getRepositoryFile(type, project, version));
System.out.println(
"Copying: from '" + file + "' to: '" + destFile + "'");
FileUtils.copyFile(file, destFile);
@@ -239,9 +242,9 @@
* @param snapshot
*/
private void doDeploy(
- String[] inputFilenames,
- String[] outputFilenames,
- String outputPath,
+ String[] srcFilenames,
+ String[] destFilenames,
+ String destPath,
Project project)
throws MavenException
{
@@ -284,37 +287,40 @@
String repo = repoArray[i].trim();
System.out.println("Deploying to repo: " + repo);
- for (int j = 0; j < inputFilenames.length; j++)
+ for (int j = 0; j < srcFilenames.length; j++)
{
- MavenDeployRequest deployRequest =
- new MavenDeployRequest(
- repo,
- project,
- repo,
- inputFilenames[j],
- outputPath,
- outputFilenames[j]);
-
+ DeployRequest request = null;
try
{
+ request =
+ DeployRequestBuilder.getDeployRequest(
+ repo,
+ project,
+ repo,
+ srcFilenames[j],
+ destPath,
+ destFilenames[j]);
+
System.out.println(
"Deploying: '"
- + outputFilenames[j]
+ + destFilenames[j]
+ "' to host: '"
- + deployRequest.getHost()
+ + request.getHost()
+ "' remote path: '"
- + deployRequest.getOutputDir()
+ + request.getDestDir()
+ "' remote file: '"
- + deployRequest.getOutputFile());
- deployTool.performUpload(deployRequest);
+ + request.getDestFile());
+ deployTool.performUpload(request);
}
catch (Exception e)
{
- e.printStackTrace();
- throw new MavenException(
- "Cannot deploy. Reason:" + e.getMessage(),
- e);
+ String msg =
+ "Cannot deploy to: "
+ + request.getRepositoryAlias()
+ + ". Reason:"
+ + e.getMessage();
+ throw new MavenException(msg, e);
}
}
}
@@ -376,20 +382,6 @@
/**
*
- * @todo Dirty hack util Repository Layout Service is used
- * @return
- */
- private String extensionForType(String type)
- {
- if (type.equals("ejb"))
- {
- return "jar";
- }
- return type;
- }
-
- /**
- *
* @param artifact
* @return
*/
@@ -480,7 +472,20 @@
}
return md5ChecksumFile;
+ }
+ /**
+ *
+ * @todo Dirty hack util Repository Layout Service is used
+ * @return
+ */
+ private String extensionForType(String type)
+ {
+ if (type.equals("ejb"))
+ {
+ return "jar";
+ }
+ return type;
}
}
1.2 +3 -2 maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java
Index: DeployBean.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DeployBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeployBean.java 16 Jun 2003 14:26:01 -0000 1.1
+++ DeployBean.java 25 Jun 2003 15:25:19 -0000 1.2
@@ -63,7 +63,8 @@
/**
*
- * The Bean which serves as Proxy for Jelly scripts To Artifact Deployement API
+ * The Bean which provides access to Artifact Deployement API
+ * for jelly scripts.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id$
1.1 maven/src/plugins-build/artifact/src/main/org/apache/maven/artifact/deployer/DeployRequestBuilder.java
Index: DeployRequestBuilder.java
===================================================================
package org.apache.maven.artifact.deployer;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache MavenSession" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache MavenSession", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
import org.apache.maven.deploy.DeployRequest;
import org.apache.maven.deploy.exceptions.DeployException;
import org.apache.maven.project.Project;
/**
*
* Perform mapping between project's properties and attributes of DeployRequest class.
*
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
* @version $Id: DeployRequestBuilder.java,v 1.1 2003/06/25 15:25:19 michal Exp $
*/
public class DeployRequestBuilder
{
/**
*
* @param project
* @param repository Alias(name) of the repository
* like </i>repo1</i> taken from propertt: <i>maven.deploy.repos= repo1, repo2</i>
* @param srcDir
* @param srcDir
* @param destFile
*/
public static DeployRequest getDeployRequest(
String repositoryAlias,
Project project,
String repository,
String srcFile,
String destDir,
String destFile) throws DeployException
{
DeployRequest request = new DeployRequest();
request.setRepositoryAlias(repositoryAlias);
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 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 proxyHost =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy");
String proxyUser =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy.username");
String proxyPassword =
(String) project.getContext().getVariable(
"maven.repo." + repository + ".proxy.password");
String proxyPort =
(String) project.getContext().getVariable(
"maven." + repository + ".proxy.port");
request.setUser(username);
request.setPassword(password);
request.setPassphrase(passphrase);
request.setPrivateKey(privateKey);
request.setGroup(remoteGroup);
request.setUrl(url);
request.setProxyHost(proxyHost);
request.setProxyUser(proxyUser);
request.setProxyPass(proxyPassword);
if (port != null)
{
try
{
request.setPort(Integer.parseInt(port));
}
catch (Exception e)
{
throw new DeployException("maven.repo." + repository + ".port should be an integer");
}
}
if (proxyPort != null)
{
try
{
request.setProxyPort(Integer.parseInt(proxyPort.trim()));
}
catch (Exception e)
{
throw new DeployException("maven.repo." + repository + ".proxy.port should be an integer");
}
}
request.setSrcFile(srcFile);
if (dir != null)
{
destDir = dir + "/" + destDir;
}
request.setDestFile(destFile);
request.setDestDir(destDir);
return request;
}
}
1.4 +40 -61 maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/DeployRequest.java
Index: DeployRequest.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/artifact/src/main/org/apache/maven/deploy/DeployRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeployRequest.java 24 Jun 2003 22:22:55 -0000 1.3
+++ DeployRequest.java 25 Jun 2003 15:25:19 -0000 1.4
@@ -63,27 +63,35 @@
*/
public class DeployRequest
{
-
public final static int UNKNOWN_PORT = -1;
+ public final static String HEADER_USER_AGENT =
+ "Maven-Deploy-" + DeployTool.VERSION;
-
private String repositoryAlias;
private String url;
private int port = UNKNOWN_PORT;
- private String outputDir;
- private String outputFile;
- private String inputFile;
+ private String destDir;
+ private String destFile;
+ private String srcFile;
/*
- * Resource access user / pass /group
+ * Resource access user / password /group
*/
private String user;
- private String pass;
+ private String password;
private String group;
private String passphrase;
private String privateKey;
+ /*
+ * Proxy server settings. If proxy host is not null, settings will be used.
+ */
+ private String proxyHost = null;
+ private String proxyUser = null;
+ private String proxyPass = null;
+ private int proxyPort = UNKNOWN_PORT;
+
/**
* @param repositoryAlias
*/
@@ -92,27 +100,6 @@
this.repositoryAlias = repositoryAlias;
}
- public DeployRequest()
- {
-
- }
-
- public DeployRequest(String url)
- {
- this.url = url;
- }
-
- // private boolean resumeDownload = false;
- private String headerUserAgent = "Maven-Deploy-" + DeployTool.VERSION;
-
- /*
- * Proxy settings. If proxyHost is not null, settings will be used.
- */
- private String proxyHost = null;
- private String proxyUser = null;
- private String proxyPass = null;
- private int proxyPort = UNKNOWN_PORT;
-
/**
* @return
*/
@@ -182,79 +169,71 @@
*/
public String getHeaderUserAgent()
{
- return headerUserAgent;
- }
-
- /**
- * @param headerUserAgent
- */
- public void setHeaderUserAgent(String headerUserAgent)
- {
- this.headerUserAgent = headerUserAgent;
+ return HEADER_USER_AGENT;
}
/**
* @return
*/
- public String getInputFile()
+ public String getSrcFile()
{
- return inputFile;
+ return srcFile;
}
/**
- * @param inputFile
+ * @param srcFile
*/
- public void setInputFile(String inputFile)
+ public void setSrcFile(String inputFile)
{
- this.inputFile = inputFile;
+ this.srcFile = inputFile;
}
/**
* @return
*/
- public String getOutputDir()
+ public String getDestDir()
{
- return outputDir;
+ return destDir;
}
/**
- * @param outputDir
+ * @param destDir
*/
- public void setOutputDir(String outputDir)
+ public void setDestDir(String outputDir)
{
- this.outputDir = outputDir;
+ this.destDir = outputDir;
}
/**
* @return
*/
- public String getOutputFile()
+ public String getDestFile()
{
- return outputFile;
+ return destFile;
}
/**
- * @param outputFile
+ * @param destFile
*/
- public void setOutputFile(String outputFile)
+ public void setDestFile(String outputFile)
{
- this.outputFile = outputFile;
+ this.destFile = outputFile;
}
/**
* @return
*/
- public String getPass()
+ public String getPassword()
{
- return pass;
+ return password;
}
/**
- * @param pass
+ * @param password
*/
- public void setPass(String pass)
+ public void setPassword(String pass)
{
- this.pass = pass;
+ this.password = pass;
}
/**
@@ -359,9 +338,9 @@
*/
public String getHost()
{
- if (url == null )
+ if (url == null)
{
- return "localhost";
+ return "localhost";
}
return url.substring(url.indexOf("://") + 3);
}
@@ -371,7 +350,7 @@
*/
public String getRepositoryAlias()
{
-
+
return repositoryAlias;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org