peterreilly 2005/07/08 06:34:43
Modified: src/main/org/apache/tools/ant/taskdefs/optional/ssh
AbstractSshMessage.java
Log:
javadoc
Revision Changes Path
1.12 +51 -2
ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java
Index: AbstractSshMessage.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AbstractSshMessage.java 22 Nov 2004 09:23:34 -0000 1.11
+++ AbstractSshMessage.java 8 Jul 2005 13:34:43 -0000 1.12
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 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.
@@ -29,6 +29,9 @@
import org.apache.tools.ant.BuildException;
+/**
+ * Abstract class for ssh upload and download
+ */
public abstract class AbstractSshMessage {
private Session session;
@@ -39,11 +42,18 @@
}
};
+ /**
+ * Constructor for AbstractSshMessage
+ * @param session the ssh session to use
+ */
public AbstractSshMessage(Session session) {
this(false, session);
}
/**
+ * Constructor for AbstractSshMessage
+ * @param verbose if true do verbose logging
+ * @param session the ssh session to use
* @since Ant 1.6.2
*/
public AbstractSshMessage(boolean verbose, Session session) {
@@ -51,6 +61,12 @@
this.session = session;
}
+ /**
+ * Open an ssh channel.
+ * @param command the command to use
+ * @return the channel
+ * @throws JSchException on error
+ */
protected Channel openExecChannel(String command) throws JSchException {
ChannelExec channel = (ChannelExec) session.openChannel("exec");
channel.setCommand(command);
@@ -58,6 +74,11 @@
return channel;
}
+ /**
+ * Send an ack.
+ * @param out the output stream to use
+ * @throws IOException on error
+ */
protected void sendAck(OutputStream out) throws IOException {
byte[] buf = new byte[1];
buf[0] = 0;
@@ -68,6 +89,9 @@
/**
* Reads the response, throws a BuildException if the response
* indicates an error.
+ * @param in the input stream to use
+ * @throws IOException on I/O error
+ * @throws BuildException on other errors
*/
protected void waitForAck(InputStream in)
throws IOException, BuildException {
@@ -102,16 +126,35 @@
}
}
+ /**
+ * Carry out the transfer.
+ * @throws IOException on I/O errors
+ * @throws JSchException on ssh errors
+ */
public abstract void execute() throws IOException, JSchException;
+ /**
+ * Set a log listener.
+ * @param aListener the log listener
+ */
public void setLogListener(LogListener aListener) {
listener = aListener;
}
+ /**
+ * Log a message to the log listener.
+ * @param message the message to log
+ */
protected void log(String message) {
listener.log(message);
}
+ /**
+ * Log transfer stats to the log listener.
+ * @param timeStarted the time started
+ * @param timeEnded the finishing time
+ * @param totalLength the total length
+ */
protected void logStats(long timeStarted,
long timeEnded,
int totalLength) {
@@ -125,15 +168,21 @@
}
/**
+ * Is the verbose attribute set.
+ * @return true if the verbose attribute is set
* @since Ant 1.6.2
*/
protected final boolean getVerbose() {
return verbose;
}
- /*
+ /**
* Track progress every 10% if 100kb < filesize < 1mb. For larger
* files track progress for every percent transmitted.
+ * @param filesize the size of the file been transmitted
+ * @param totalLength the total transmission size
+ * @param percentTransmitted the current percent transmitted
+ * @return the percent that the file is of the total
*/
protected final int trackProgress(int filesize, int totalLength,
int percentTransmitted) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]