javadoc cleanup

This commit is contained in:
Shikhar Bhushan
2010-03-06 02:00:26 +01:00
parent 009c58e67b
commit fae9f78a74
17 changed files with 63 additions and 74 deletions

View File

@@ -125,7 +125,7 @@ public class Future<V, T extends Throwable> {
* Wait for {@code timeout} seconds for this future's value to be set. * Wait for {@code timeout} seconds for this future's value to be set.
* *
* @param timeout the timeout in seconds * @param timeout the timeout in seconds
* @param unit * @param unit time unit
* *
* @return the value * @return the value
* *
@@ -157,7 +157,7 @@ public class Future<V, T extends Throwable> {
} }
} }
/** @return Whether this future has a value set, and no error waiting to pop. */ /** @return whether this future has a value set, and no error waiting to pop. */
public boolean isSet() { public boolean isSet() {
lock(); lock();
try { try {
@@ -167,7 +167,7 @@ public class Future<V, T extends Throwable> {
} }
} }
/** @return Whether this future currently has an error set. */ /** @return whether this future currently has an error set. */
public boolean hasError() { public boolean hasError() {
lock(); lock();
try { try {
@@ -177,7 +177,7 @@ public class Future<V, T extends Throwable> {
} }
} }
/** @return Whether this future has threads waiting on it. */ /** @return whether this future has threads waiting on it. */
public boolean hasWaiters() { public boolean hasWaiters() {
lock(); lock();
try { try {

View File

@@ -154,7 +154,7 @@ public class SSHClient
/** /**
* Constructor that allows specifying a {@code config} to be used. * Constructor that allows specifying a {@code config} to be used.
* *
* @param config {@link ConfigImpl} instance * @param config {@link Config} instance
*/ */
public SSHClient(Config config) { public SSHClient(Config config) {
super(DEFAULT_PORT); super(DEFAULT_PORT);
@@ -367,7 +367,7 @@ public class SSHClient
assert !isConnected(); assert !isConnected();
} }
/** @return associated {@link Connection} instance. */ /** @return the associated {@link Connection} instance. */
public Connection getConnection() { public Connection getConnection() {
return conn; return conn;
} }
@@ -575,14 +575,14 @@ public class SSHClient
return x11f; return x11f;
} }
/** @return instantiated {@link SCPFileTransfer} implementation. */ /** @return Instantiated {@link SCPFileTransfer} implementation. */
public SCPFileTransfer newSCPFileTransfer() { public SCPFileTransfer newSCPFileTransfer() {
assert isConnected() && isAuthenticated(); assert isConnected() && isAuthenticated();
return new SCPFileTransfer(this); return new SCPFileTransfer(this);
} }
/** /**
* @return instantiated {@link SFTPClient} implementation. * @return Instantiated {@link SFTPClient} implementation.
* *
* @throws IOException if there is an error starting the {@code sftp} subsystem * @throws IOException if there is an error starting the {@code sftp} subsystem
* @see StatefulSFTPClient * @see StatefulSFTPClient

View File

@@ -20,11 +20,11 @@ import net.schmizz.sshj.common.SSHException;
import net.schmizz.sshj.common.SSHPacketHandler; import net.schmizz.sshj.common.SSHPacketHandler;
import net.schmizz.sshj.transport.TransportException; import net.schmizz.sshj.transport.TransportException;
/** Represents a service running on top of the SSH {@link net.schmizz.sshj.transport.Transport transport layer}. */ /** Represents a service running on top of the SSH transport layer. */
public interface Service public interface Service
extends SSHPacketHandler, ErrorNotifiable { extends SSHPacketHandler, ErrorNotifiable {
/** @return The assigned name for this SSH service. */ /** @return the assigned name for this SSH service. */
String getName(); String getName();
/** /**

View File

@@ -27,17 +27,16 @@ import net.schmizz.sshj.transport.TransportException;
public interface Connection { public interface Connection {
/** /**
* Attach a {@link net.schmizz.sshj.connection.channel.Channel} to this connection. A channel must be attached to * Attach a {@link Channel} to this connection. A channel must be attached to the connection if it is to receive any
* the connection if it is to receive any channel-specific data that is received. * channel-specific data that is received.
* *
* @param chan * @param chan
*/ */
void attach(Channel chan); void attach(Channel chan);
/** /**
* Attach a {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener} to this connection, which * Attach a {@link ForwardedChannelOpener} to this connection, which will be delegated opening of any {@code
* will be delegated opening of any {@code CHANNEL_OPEN} packets {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener#getChannelType() * CHANNEL_OPEN} packets {@link ForwardedChannelOpener#getChannelType() for which it is responsible}.
* for which it is responsible}.
* *
* @param opener * @param opener
*/ */
@@ -51,7 +50,7 @@ public interface Connection {
void forget(Channel chan); void forget(Channel chan);
/** /**
* Forget an attached {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener}. * Forget an attached {@link ForwardedChannelOpener}.
* *
* @param handler * @param handler
*/ */
@@ -80,7 +79,7 @@ public interface Connection {
*/ */
ForwardedChannelOpener get(String chanType); ForwardedChannelOpener get(String chanType);
/** Returns an available ID a {@link net.schmizz.sshj.connection.channel.Channel} can rightfully claim. */ /** Returns an available ID a {@link Channel} can rightfully claim. */
int nextID(); int nextID();
/** /**
@@ -88,10 +87,10 @@ public interface Connection {
* *
* @param name request name * @param name request name
* @param wantReply whether a reply is requested * @param wantReply whether a reply is requested
* @param specifics {@link net.schmizz.sshj.common.SSHPacket} containing fields specific to the request * @param specifics {@link SSHPacket} containing fields specific to the request
* *
* @return a {@link net.schmizz.concurrent.Future} for the reply data (in case {@code wantReply} is true) which * @return a {@link Future} for the reply data (in case {@code wantReply} is true) which allows waiting on the
* allows waiting on the reply, or {@code null} if a reply is not requested. * reply, or {@code null} if a reply is not requested.
* *
* @throws TransportException if there is an error sending the request * @throws TransportException if there is an error sending the request
*/ */
@@ -112,8 +111,8 @@ public interface Connection {
throws TransportException; throws TransportException;
/** /**
* Get the maximum packet size for the local window this connection recommends to any {@link Channel}'s that ask for * @return the maximum packet size for the local window this connection recommends to any {@link Channel}'s that ask
* it. * for it.
*/ */
int getMaxPacketSize(); int getMaxPacketSize();
@@ -123,28 +122,25 @@ public interface Connection {
*/ */
void setMaxPacketSize(int maxPacketSize); void setMaxPacketSize(int maxPacketSize);
/** /** Get the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */
* Get the size for the local window this connection recommends to any {@link net.schmizz.sshj.connection.channel.Channel}'s
* that ask for it.
*/
int getWindowSize(); int getWindowSize();
/** Set the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */ /** Set the size for the local window this connection recommends to any {@link Channel}'s that ask for it. */
void setWindowSize(int windowSize); void setWindowSize(int windowSize);
/** Get the associated {@link Transport}. */ /** @return the associated {@link Transport}. */
Transport getTransport(); Transport getTransport();
/** /**
* Get the {@code timeout} this connection uses for blocking operations and recommends to any {@link Channel other} * @return the {@code timeout} this connection uses for blocking operations and recommends to any {@link Channel
* {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener classes} that ask for it. * other} {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener classes} that ask for
* it.
*/ */
int getTimeout(); int getTimeout();
/** /**
* Set the {@code timeout} this connection uses for blocking operations and recommends to any {@link * Set the {@code timeout} this connection uses for blocking operations and recommends to any {@link Channel other}
* net.schmizz.sshj.connection.channel.Channel other} {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener * {@link ForwardedChannelOpener classes} that ask for it.
* classes} that ask for it.
*/ */
void setTimeout(int timeout); void setTimeout(int timeout);
} }

View File

@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
/** Base class for {@link net.schmizz.sshj.connection.channel.forwarded.ForwardedChannelOpener}'s. */ /** Base class for {@link ForwardedChannelOpener}'s. */
public abstract class AbstractForwardedChannelOpener public abstract class AbstractForwardedChannelOpener
implements ForwardedChannelOpener { implements ForwardedChannelOpener {

View File

@@ -27,7 +27,7 @@ public interface ConnectListener {
* Channel.Forwarded#confirm() confirm} or {@link Channel.Forwarded#reject(net.schmizz.sshj.connection.channel.OpenFailException.Reason, * Channel.Forwarded#confirm() confirm} or {@link Channel.Forwarded#reject(net.schmizz.sshj.connection.channel.OpenFailException.Reason,
* String)} reject} that channel. * String)} reject} that channel.
* *
* @param chan the {@link net.schmizz.sshj.connection.channel.Channel.Forwarded forwarded channel} * @param chan the {@link Channel.Forwarded forwarded channel}
* *
* @throws IOException * @throws IOException
*/ */

View File

@@ -28,8 +28,7 @@ public interface ForwardedChannelOpener {
/** /**
* Delegates a {@code SSH_MSG_CHANNEL_OPEN} request for the channel type claimed by this opener. * Delegates a {@code SSH_MSG_CHANNEL_OPEN} request for the channel type claimed by this opener.
* *
* @param buf {@link net.schmizz.sshj.common.SSHPacket} containg the request except for the message identifier and * @param buf {@link SSHPacket} containg the request except for the message identifier and channel type field
* channel type field
*/ */
void handleOpen(SSHPacket buf) void handleOpen(SSHPacket buf)
throws ConnectionException, TransportException; throws ConnectionException, TransportException;

View File

@@ -26,10 +26,7 @@ import java.io.IOException;
import java.net.Socket; import java.net.Socket;
import java.net.SocketAddress; import java.net.SocketAddress;
/** /** A {@link ConnectListener} that forwards what is received over the channel to a socket and vice-versa. */
* A {@link net.schmizz.sshj.connection.channel.forwarded.ConnectListener} that forwards what is received over the
* channel to a socket and vice-versa.
*/
public class SocketForwardingConnectListener public class SocketForwardingConnectListener
implements ConnectListener { implements ConnectListener {

View File

@@ -22,7 +22,7 @@ import net.schmizz.sshj.transport.TransportException;
/** /**
* Handles forwarded {@code x11} channels. The actual request to forward X11 should be made from the specific {@link * Handles forwarded {@code x11} channels. The actual request to forward X11 should be made from the specific {@link
* net.schmizz.sshj.connection.channel.direct.Session}. * Session}.
*/ */
public class X11Forwarder public class X11Forwarder
extends AbstractForwardedChannelOpener { extends AbstractForwardedChannelOpener {

View File

@@ -177,8 +177,7 @@ final class Decoder
/** /**
* Adds {@code len} bytes from {@code b} to the decoder buffer. When a packet has been successfully decoded, hooks * Adds {@code len} bytes from {@code b} to the decoder buffer. When a packet has been successfully decoded, hooks
* in to {@link net.schmizz.sshj.common.SSHPacketHandler#handle} of the {@link net.schmizz.sshj.common.SSHPacketHandler} * in to {@link SSHPacketHandler#handle} of the {@link SSHPacketHandler} this decoder was initialized with.
* this decoder was initialized with.
* <p/> * <p/>
* Returns the number of bytes expected in the next call in order to decode the packet length, and if the packet * Returns the number of bytes expected in the next call in order to decode the packet length, and if the packet
* length has already been decoded; to decode the payload. This number is accurate and should be taken to heart. * length has already been decoded; to decode the payload. This number is accurate and should be taken to heart.

View File

@@ -126,12 +126,12 @@ final class KeyExchanger
return Arrays.copyOf(sessionID, sessionID.length); return Arrays.copyOf(sessionID, sessionID.length);
} }
/** @return Whether key exchange has been completed */ /** @return whether key exchange has been completed */
boolean isKexDone() { boolean isKexDone() {
return done.isSet(); return done.isSet();
} }
/** @return Whether key exchange is currently ongoing */ /** @return whether key exchange is currently ongoing */
boolean isKexOngoing() { boolean isKexOngoing() {
return kexOngoing.get(); return kexOngoing.get();
} }

View File

@@ -67,15 +67,14 @@ public interface Transport
/** @return the version string used by this client to identify itself to an SSH server, e.g. "SSHJ_3_0" */ /** @return the version string used by this client to identify itself to an SSH server, e.g. "SSHJ_3_0" */
String getClientVersion(); String getClientVersion();
/** @return the {@link net.schmizz.sshj.ConfigImpl} associated with this transport. */ /** @return the {@link Config} associated with this transport. */
Config getConfig(); Config getConfig();
/** @return the timeout that is currently set for blocking operations. */ /** @return the timeout that is currently set for blocking operations. */
int getTimeout(); int getTimeout();
/** /**
* Set a timeout for method that may block, e.g. {@link #reqService(net.schmizz.sshj.Service)}, {@link * Set a timeout for methods that may block.
* KeyExchanger#waitForDone()}.
* *
* @param timeout the timeout in seconds * @param timeout the timeout in seconds
*/ */
@@ -85,10 +84,10 @@ public interface Transport
void setHeartbeatInterval(int interval); void setHeartbeatInterval(int interval);
/** Returns the hostname to which this transport is connected. */ /** @return the hostname to which this transport is connected. */
String getRemoteHost(); String getRemoteHost();
/** Returns the port number on the {@link #getRemoteHost() remote host} to which this transport is connected. */ /** @return the port number on the remote host to which this transport is connected. */
int getRemotePort(); int getRemotePort();
/** /**
@@ -102,12 +101,12 @@ public interface Transport
byte[] getSessionID(); byte[] getSessionID();
/** Returns the currently active {@link net.schmizz.sshj.Service} instance. */ /** @return the currently active {@link Service} instance. */
Service getService(); Service getService();
/** /**
* Request a SSH service represented by a {@link net.schmizz.sshj.Service} instance. A separate call to {@link * Request a SSH service represented by a {@link Service} instance. A separate call to {@link #setService} is not
* #setService} is not needed. * needed.
* *
* @param service the SSH service to be requested * @param service the SSH service to be requested
* *
@@ -117,13 +116,13 @@ public interface Transport
throws TransportException; throws TransportException;
/** /**
* Sets the currently active {@link net.schmizz.sshj.Service}. Handling of non-transport-layer packets is {@link * Sets the currently active {@link Service}. Handling of non-transport-layer packets is {@link Service#handle
* net.schmizz.sshj.Service#handle delegated} to that service. * delegated} to that service.
* <p/> * <p/>
* For this method to be successful, at least one service request via {@link #reqService} must have been successful * For this method to be successful, at least one service request via {@link #reqService} must have been successful
* (not necessarily for the service being set). * (not necessarily for the service being set).
* *
* @param service (null-ok) the {@link net.schmizz.sshj.Service} * @param service (null-ok) the {@link Service}
*/ */
void setService(Service service); void setService(Service service);
@@ -165,10 +164,7 @@ public interface Transport
/** Send a disconnection packet with reason as {@link DisconnectReason#BY_APPLICATION}, and closes this transport. */ /** Send a disconnection packet with reason as {@link DisconnectReason#BY_APPLICATION}, and closes this transport. */
void disconnect(); void disconnect();
/** /** Send a disconnect packet with the given {@link DisconnectReason reason}, and closes this transport. */
* Send a disconnect packet with the given {@link net.schmizz.sshj.common.DisconnectReason reason}, and closes this
* transport.
*/
void disconnect(DisconnectReason reason); void disconnect(DisconnectReason reason);
/** /**
@@ -183,10 +179,10 @@ public interface Transport
/** /**
* Write a packet over this transport. * Write a packet over this transport.
* <p/> * <p/>
* The {@code payload} {@link net.schmizz.sshj.common.SSHPacket} should have 5 bytes free at the beginning to avoid * The {@code payload} {@link SSHPacket} should have 5 bytes free at the beginning to avoid a performance penalty
* a performance penalty associated with making space for header bytes (packet length, padding length). * associated with making space for header bytes (packet length, padding length).
* *
* @param payload the {@link net.schmizz.sshj.common.SSHPacket} containing data to send * @param payload the {@link SSHPacket} containing data to send
* *
* @return sequence number of the sent packet * @return sequence number of the sent packet
* *

View File

@@ -26,7 +26,7 @@ public interface UserAuth {
/** /**
* Attempt to authenticate {@code username} using each of {@code methods} in order. {@code nextService} is the * Attempt to authenticate {@code username} using each of {@code methods} in order. {@code nextService} is the
* {@link net.schmizz.sshj.Service} that will be enabled on successful authentication. * {@link Service} that will be enabled on successful authentication.
* <p/> * <p/>
* Authentication fails if there are no method available, i.e. if all the method failed or there were method * Authentication fails if there are no method available, i.e. if all the method failed or there were method
* available but could not be attempted because the server did not allow them. In this case, a {@code * available but could not be attempted because the server did not allow them. In this case, a {@code
@@ -53,14 +53,14 @@ public interface UserAuth {
*/ */
String getBanner(); String getBanner();
/** @return Saved exceptions that might have been ignored because there were more authentication method available. */ /** @return saved exceptions that might have been ignored because there were more authentication method available. */
Deque<UserAuthException> getSavedExceptions(); Deque<UserAuthException> getSavedExceptions();
/** @return The {@code timeout} for a method to successfully authenticate before it is abandoned. */ /** @return the {@code timeout} for a method to successfully authenticate before it is abandoned. */
int getTimeout(); int getTimeout();
/** /**
* @return Whether authentication was partially successful. Some server's may be configured to require multiple * @return whether authentication was partially successful. Some server's may be configured to require multiple
* authentications; and this value will be {@code true} if at least one of the method supplied succeeded. * authentications; and this value will be {@code true} if at least one of the method supplied succeeded.
*/ */
boolean hadPartialSuccess(); boolean hadPartialSuccess();

View File

@@ -32,8 +32,8 @@ public interface AuthMethod
String getName(); String getName();
/** /**
* Initializes this {@link AuthMethod} with the {@link net.schmizz.sshj.userauth.AuthParams parameters} needed for * Initializes this {@link AuthMethod} with the {@link AuthParams parameters} needed for authentication. This method
* authentication. This method must be called before requesting authentication with this method. * must be called before requesting authentication with this method.
*/ */
void init(AuthParams params); void init(AuthParams params);

View File

@@ -33,7 +33,7 @@ public class PasswordUtils {
/** /**
* @param password the password as a char[] * @param password the password as a char[]
* *
* @return the constructed {@link net.schmizz.sshj.userauth.password.PasswordFinder} * @return the constructed {@link PasswordFinder}
*/ */
public static PasswordFinder createOneOff(final char[] password) { public static PasswordFinder createOneOff(final char[] password) {
if (password == null) if (password == null)

View File

@@ -27,7 +27,7 @@ import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/** Support for uploading files over a connected {@link net.schmizz.sshj.SSHClient} link using SCP. */ /** Support for uploading files over a connected link using SCP. */
public final class SCPDownloadClient public final class SCPDownloadClient
extends SCPEngine { extends SCPEngine {

View File

@@ -29,13 +29,14 @@ import java.security.GeneralSecurityException;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/** Tests {@link net.schmizz.sshj.common.SSHPacket} functionality */ /** Tests {@link SSHPacket} functionality */
public class BufferTest { public class BufferTest {
private Buffer.PlainBuffer posBuf; private Buffer.PlainBuffer posBuf;
private Buffer.PlainBuffer handyBuf; private Buffer.PlainBuffer handyBuf;
@Before @Before
public void setUp() throws UnsupportedEncodingException, GeneralSecurityException { public void setUp()
throws UnsupportedEncodingException, GeneralSecurityException {
// for position test // for position test
byte[] data = "Hello".getBytes("UTF-8"); byte[] data = "Hello".getBytes("UTF-8");
posBuf = new Buffer.PlainBuffer(data); posBuf = new Buffer.PlainBuffer(data);
@@ -74,7 +75,8 @@ public class BufferTest {
} }
@Test @Test
public void testPosition() throws UnsupportedEncodingException { public void testPosition()
throws UnsupportedEncodingException {
assertEquals(5, posBuf.wpos()); assertEquals(5, posBuf.wpos());
assertEquals(0, posBuf.rpos()); assertEquals(0, posBuf.rpos());
assertEquals(5, posBuf.available()); assertEquals(5, posBuf.available());