You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2015/09/09 14:58:39 UTC
mina-sshd git commit: [SSHD-542] Checkstyle validation
Repository: mina-sshd
Updated Branches:
refs/heads/master 0ed91bc86 -> 20ac84673
[SSHD-542] Checkstyle validation
Upgraded the used plugin and validator versions + fixed the (new) reported problems
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/20ac8467
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/20ac8467
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/20ac8467
Branch: refs/heads/master
Commit: 20ac846730bf443ef9be051c1b4e65c7d313b3e5
Parents: 0ed91bc
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Wed Sep 9 15:58:27 2015 +0300
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Wed Sep 9 15:58:27 2015 +0300
----------------------------------------------------------------------
pom.xml | 32 ++++-
.../client/channel/AbstractClientChannel.java | 77 +++++-------
.../exit/AbstractChannelExitRequestHandler.java | 126 +++++++++++++++++++
.../exit/ExitSignalChannelRequestHandler.java | 46 +++++++
.../exit/ExitStatusChannelRequestHandler.java | 46 +++++++
.../sshd/client/scp/DefaultScpClient.java | 58 +--------
.../client/scp/DefaultScpStreamResolver.java | 86 +++++++++++++
.../sshd/client/subsystem/sftp/SftpClient.java | 6 +-
.../org/apache/sshd/common/BuiltinFactory.java | 3 +-
.../org/apache/sshd/common/NamedFactory.java | 2 +
.../org/apache/sshd/common/NamedResource.java | 2 +
.../org/apache/sshd/common/ServiceFactory.java | 2 +
.../channel/AbstractChannelRequestHandler.java | 29 +++++
.../common/channel/AbstractRequestHandler.java | 31 +++++
.../AbstractResourceKeyPairProvider.java | 2 +-
.../sshd/common/session/AbstractSession.java | 16 +--
.../org/apache/sshd/common/session/Session.java | 4 +-
.../apache/sshd/common/util/EventNotifier.java | 34 +++++
.../sshd/common/util/Int2IntFunction.java | 2 +
.../apache/sshd/common/util/SecurityUtils.java | 8 +-
.../apache/sshd/common/util/Transformer.java | 4 +-
.../sshd/server/channel/ChannelSession.java | 6 +-
.../server/channel/PuttyRequestHandler.java | 5 +-
23 files changed, 496 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 88067b2..d48cd3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -440,10 +440,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>2.15</version>
+ <version>2.16</version>
<configuration>
<logViolationsToConsole>true</logViolationsToConsole>
- <resourceExcludes>**/sshd-version.properties</resourceExcludes>
+ <resourceExcludes>**/*.properties</resourceExcludes>
<checkstyleRules>
<module name="Checker">
<!-- Checks whether files end with a new line. -->
@@ -471,6 +471,15 @@
<module name="JavadocStyle" />
-->
+ <!-- Check annotations conventions -->
+ <!-- See http://checkstyle.sourceforge.net/config_annotation.html -->
+ <module name="MissingOverride"/>
+ <module name="MissingDeprecated"/>
+ <module name="AnnotationLocation">
+ <property name="allowSamelineMultipleAnnotations" value="false"/>
+ <property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
+ <property name="allowSamelineParameterizedAnnotation" value="false"/>
+ </module>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
@@ -490,7 +499,6 @@
<module name="StaticVariableName" />
<module name="TypeName" />
-
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport" />
@@ -565,6 +573,9 @@
<module name="LeftCurly" />
<module name="NeedBraces" />
<module name="RightCurly" />
+ <module name="EmptyCatchBlock">
+ <property name="exceptionVariableName" value="expected|ignore"/>
+ </module>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
@@ -716,6 +727,21 @@
</module>
</checkstyleRules>
</configuration>
+ <dependencies>
+ <!-- see http://checkstyle.sourceforge.net/ for latest version -->
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>6.10.1</version>
+ <exclusions>
+ <!-- MCHECKSTYLE-156 -->
+ <exclusion>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</pluginManagement>
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
index 1983a45..ded389a 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/AbstractClientChannel.java
@@ -22,7 +22,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.sshd.client.channel.exit.ExitSignalChannelRequestHandler;
+import org.apache.sshd.client.channel.exit.ExitStatusChannelRequestHandler;
import org.apache.sshd.client.future.DefaultOpenFuture;
import org.apache.sshd.client.future.OpenFuture;
import org.apache.sshd.common.Closeable;
@@ -30,14 +33,13 @@ import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.common.SshConstants;
import org.apache.sshd.common.SshException;
import org.apache.sshd.common.channel.AbstractChannel;
-import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.ChannelAsyncInputStream;
import org.apache.sshd.common.channel.ChannelAsyncOutputStream;
import org.apache.sshd.common.channel.ChannelListener;
-import org.apache.sshd.common.channel.ChannelRequestHandler;
import org.apache.sshd.common.io.IoInputStream;
import org.apache.sshd.common.io.IoOutputStream;
import org.apache.sshd.common.session.Session;
+import org.apache.sshd.common.util.EventNotifier;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.common.util.ValidateUtils;
import org.apache.sshd.common.util.buffer.Buffer;
@@ -66,8 +68,8 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
protected InputStream invertedOut;
protected OutputStream err;
protected InputStream invertedErr;
- protected Integer exitStatus;
- protected String exitSignal;
+ protected final AtomicReference<Integer> exitStatusHolder = new AtomicReference<>(null);
+ protected final AtomicReference<String> exitSignalHolder = new AtomicReference<>(null);
protected int openFailureReason;
protected String openFailureMsg;
protected OpenFuture openFuture;
@@ -76,8 +78,17 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
super(true);
this.type = type;
this.streaming = Streaming.Sync;
- addRequestHandler(new ExitStatusChannelRequestHandler());
- addRequestHandler(new ExitSignalChannelRequestHandler());
+
+ final EventNotifier<String> notifier = new EventNotifier<String>() {
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void notifyEvent(String event) throws Exception {
+ log.debug("notifyEvent({})", event);
+ notifyStateChanged();
+ }
+ };
+ addRequestHandler(new ExitStatusChannelRequestHandler(exitStatusHolder, notifier));
+ addRequestHandler(new ExitSignalChannelRequestHandler(exitSignalHolder, notifier));
}
@Override
@@ -190,10 +201,16 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
if (isEofSignalled()) {
cond |= ClientChannel.EOF;
}
- if (exitStatus != null) {
+ if (exitStatusHolder.get() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("waitFor({}) mask=0x{} - exit status={}", this, Integer.toHexString(mask), exitStatusHolder);
+ }
cond |= ClientChannel.EXIT_STATUS;
}
- if (exitSignal != null) {
+ if (exitSignalHolder.get() != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("waitFor({}) mask=0x{} - exit signal={}", this, Integer.toHexString(mask), exitSignalHolder);
+ }
cond |= ClientChannel.EXIT_SIGNAL;
}
if ((cond & mask) != 0) {
@@ -203,12 +220,13 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
}
return cond;
}
- if (timeout > 0) {
- if (t == 0) {
+
+ if (timeout > 0L) {
+ if (t == 0L) {
t = System.currentTimeMillis() + timeout;
} else {
timeout = t - System.currentTimeMillis();
- if (timeout <= 0) {
+ if (timeout <= 0L) {
if (log.isTraceEnabled()) {
log.trace("WaitFor call timeout on channel {}, mask=0x{}", this, Integer.toHexString(mask));
}
@@ -360,41 +378,6 @@ public abstract class AbstractClientChannel extends AbstractChannel implements C
@Override
public Integer getExitStatus() {
- return exitStatus;
+ return exitStatusHolder.get();
}
-
- private class ExitStatusChannelRequestHandler implements ChannelRequestHandler {
- public ExitStatusChannelRequestHandler() {
- super();
- }
-
- @SuppressWarnings("synthetic-access")
- @Override
- public Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception {
- if ("exit-status".equals(request)) {
- exitStatus = buffer.getInt();
- notifyStateChanged();
- return Result.ReplySuccess;
- }
- return Result.Unsupported;
- }
- }
-
- private class ExitSignalChannelRequestHandler implements ChannelRequestHandler {
- public ExitSignalChannelRequestHandler() {
- super();
- }
-
- @SuppressWarnings("synthetic-access")
- @Override
- public Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception {
- if ("exit-signal".equals(request)) {
- exitSignal = buffer.getString();
- notifyStateChanged();
- return Result.ReplySuccess;
- }
- return Result.Unsupported;
- }
- }
-
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/AbstractChannelExitRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/AbstractChannelExitRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/AbstractChannelExitRequestHandler.java
new file mode 100644
index 0000000..3040c4a
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/AbstractChannelExitRequestHandler.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.sshd.client.channel.exit;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.sshd.common.NamedResource;
+import org.apache.sshd.common.channel.AbstractChannelRequestHandler;
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.util.EventNotifier;
+import org.apache.sshd.common.util.ValidateUtils;
+import org.apache.sshd.common.util.buffer.Buffer;
+
+/**
+ * Provides a common base class for channel request handlers that deal with
+ * various "<code>exit-XXX</code>" requests. Once such a request
+ * has been successfully processed, an {@link EventNotifier} can be invoked
+ * indicating the processed event.
+ *
+ * @param <V> Type of data being extracted from the request when processed
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public abstract class AbstractChannelExitRequestHandler<V> extends AbstractChannelRequestHandler implements NamedResource {
+ protected final AtomicReference<V> holder;
+ protected final EventNotifier<? super String> notifier;
+
+ /**
+ * @param holder An {@link AtomicReference} that will hold the extracted
+ * request data
+ * @param notifier An {@link EventNotifier} to be invoked when request is
+ * successfully processed and the holder has been updated
+ * with the processed request data
+ */
+ protected AbstractChannelExitRequestHandler(AtomicReference<V> holder, EventNotifier<? super String> notifier) {
+ this.holder = ValidateUtils.checkNotNull(holder, "No exit status holder");
+ this.notifier = ValidateUtils.checkNotNull(notifier, "No event notifier");
+ }
+
+ @Override
+ public Result process(Channel channel, String request, boolean wantReply, Buffer buffer) throws Exception {
+ String name = getName();
+ if (name.equals(request)) {
+ V value = processRequestValue(channel, request, buffer);
+ if (value != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("process({})[{}] wantReply={}: {}", channel, request, wantReply, value);
+ }
+
+ holder.set(value);
+ notifyStateChanged(channel, request, value);
+ return Result.ReplySuccess;
+ }
+ }
+
+ if (log.isTraceEnabled()) {
+ log.trace("process({}) wantReply={} ignore request={}", channel, wantReply, request);
+ }
+ return Result.Unsupported;
+ }
+
+ /**
+ * Invoked by default from {@link #process(Channel, String, boolean, Buffer)} when
+ * a request matching the handler's name is received
+ *
+ * @param channel The {@link Channel} through which the request was received
+ * @param request The received request - <B>Note:</B> guaranteed to match the
+ * handler's name if invoked from {@link #process(Channel, String, boolean, Buffer)}
+ * @param buffer The received {@link Buffer} for extracting the data
+ * @return The extracted data - if {@code null} then request is ignored and
+ * {@link Result#Unsupported} is returned
+ * @throws Exception If failed to process the received request buffer
+ */
+ protected abstract V processRequestValue(Channel channel, String request, Buffer buffer) throws Exception;
+
+ /**
+ * Notifies that some change has been made to the data in the holder. The
+ * reported event is obtained via the {@link #getEvent(Channel, String, Object)}
+ * call
+ *
+ * @param channel The {@link Channel} through which the request was received
+ * @param request The processed request
+ * @param value The processed value
+ */
+ protected void notifyStateChanged(Channel channel, String request, V value) {
+ String event = getEvent(channel, request, value);
+ try {
+ notifier.notifyEvent(event);
+ if (log.isDebugEnabled()) {
+ log.debug("notifyStateChanged({})", event);
+ }
+ } catch (Exception e) {
+ log.warn("Failed (" + e.getClass().getSimpleName() + ") to notify event=" + event + ": " + e.getMessage());
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException) e;
+ } else {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * @param channel The {@link Channel} through which the request was received
+ * @param request The processed request
+ * @param value The processed value
+ * @return The event name to be used - default: {@link #getName()} value
+ */
+ protected String getEvent(Channel channel, String request, V value) {
+ return getName();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitSignalChannelRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitSignalChannelRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitSignalChannelRequestHandler.java
new file mode 100644
index 0000000..fb01f4c
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitSignalChannelRequestHandler.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.sshd.client.channel.exit;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.util.EventNotifier;
+import org.apache.sshd.common.util.buffer.Buffer;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ExitSignalChannelRequestHandler extends AbstractChannelExitRequestHandler<String> {
+ public static final String NAME = "exit-signal";
+
+ public ExitSignalChannelRequestHandler(AtomicReference<String> holder, EventNotifier<? super String> notifier) {
+ super(holder, notifier);
+ }
+
+ @Override
+ public final String getName() {
+ return NAME;
+ }
+
+ @Override
+ protected String processRequestValue(Channel channel, String request, Buffer buffer) throws Exception {
+ return buffer.getString();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
new file mode 100644
index 0000000..4d6d4b7
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/exit/ExitStatusChannelRequestHandler.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.sshd.client.channel.exit;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.sshd.common.channel.Channel;
+import org.apache.sshd.common.util.EventNotifier;
+import org.apache.sshd.common.util.buffer.Buffer;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class ExitStatusChannelRequestHandler extends AbstractChannelExitRequestHandler<Integer> {
+ public static final String NAME = "exit-status";
+
+ public ExitStatusChannelRequestHandler(AtomicReference<Integer> holder, EventNotifier<? super String> notifier) {
+ super(holder, notifier);
+ }
+
+ @Override
+ public final String getName() {
+ return NAME;
+ }
+
+ @Override
+ protected Integer processRequestValue(Channel channel, String request, Buffer buffer) throws Exception {
+ return Integer.valueOf(buffer.getInt());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
index 2ab1702..b86df2f 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpClient.java
@@ -35,7 +35,6 @@ import org.apache.sshd.common.file.FileSystemFactory;
import org.apache.sshd.common.file.util.MockFileSystem;
import org.apache.sshd.common.file.util.MockPath;
import org.apache.sshd.common.scp.ScpHelper;
-import org.apache.sshd.common.scp.ScpSourceStreamResolver;
import org.apache.sshd.common.scp.ScpTimestamp;
import org.apache.sshd.common.scp.ScpTransferEventListener;
import org.apache.sshd.common.util.ValidateUtils;
@@ -102,7 +101,7 @@ public class DefaultScpClient extends AbstractScpClient {
try {
ScpHelper helper = new ScpHelper(channel.getInvertedOut(), channel.getInvertedIn(), new MockFileSystem(remote), listener);
final Path mockPath = new MockPath(remote);
- helper.sendStream(new StreamResolver(name, mockPath, perms, time, size, local, cmd),
+ helper.sendStream(new DefaultScpStreamResolver(name, mockPath, perms, time, size, local, cmd),
time != null, ScpHelper.DEFAULT_SEND_BUFFER_SIZE);
} finally {
channel.close(false);
@@ -138,59 +137,4 @@ public class DefaultScpClient extends AbstractScpClient {
channel.close(false);
}
}
-
- private static class StreamResolver implements ScpSourceStreamResolver {
- private final String name;
- private final Path mockPath;
- private final Collection<PosixFilePermission> perms;
- private final ScpTimestamp time;
- private final long size;
- private final java.io.InputStream local;
- private final String cmd;
-
- public StreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestamp time, long size, InputStream local, String cmd) {
- this.name = name;
- this.mockPath = mockPath;
- this.perms = perms;
- this.time = time;
- this.size = size;
- this.local = local;
- this.cmd = cmd;
- }
-
- @Override
- public String getFileName() throws java.io.IOException {
- return name;
- }
-
- @Override
- public Path getEventListenerFilePath() {
- return mockPath;
- }
-
- @Override
- public Collection<PosixFilePermission> getPermissions() throws IOException {
- return perms;
- }
-
- @Override
- public ScpTimestamp getTimestamp() throws IOException {
- return time;
- }
-
- @Override
- public long getSize() throws IOException {
- return size;
- }
-
- @Override
- public InputStream resolveSourceStream() throws IOException {
- return local;
- }
-
- @Override
- public String toString() {
- return cmd;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpStreamResolver.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpStreamResolver.java b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpStreamResolver.java
new file mode 100644
index 0000000..4ae22fb
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/client/scp/DefaultScpStreamResolver.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.sshd.client.scp;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.Collection;
+
+import org.apache.sshd.common.scp.ScpSourceStreamResolver;
+import org.apache.sshd.common.scp.ScpTimestamp;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class DefaultScpStreamResolver implements ScpSourceStreamResolver {
+ private final String name;
+ private final Path mockPath;
+ private final Collection<PosixFilePermission> perms;
+ private final ScpTimestamp time;
+ private final long size;
+ private final java.io.InputStream local;
+ private final String cmd;
+
+ public DefaultScpStreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestamp time, long size, InputStream local, String cmd) {
+ this.name = name;
+ this.mockPath = mockPath;
+ this.perms = perms;
+ this.time = time;
+ this.size = size;
+ this.local = local;
+ this.cmd = cmd;
+ }
+
+ @Override
+ public String getFileName() throws java.io.IOException {
+ return name;
+ }
+
+ @Override
+ public Path getEventListenerFilePath() {
+ return mockPath;
+ }
+
+ @Override
+ public Collection<PosixFilePermission> getPermissions() throws IOException {
+ return perms;
+ }
+
+ @Override
+ public ScpTimestamp getTimestamp() throws IOException {
+ return time;
+ }
+
+ @Override
+ public long getSize() throws IOException {
+ return size;
+ }
+
+ @Override
+ public InputStream resolveSourceStream() throws IOException {
+ return local;
+ }
+
+ @Override
+ public String toString() {
+ return cmd;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
index 7ec6e18..538b198 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java
@@ -76,7 +76,7 @@ public interface SftpClient extends SubsystemClient {
class Handle {
private final byte[] id;
- public Handle(byte[] id) {
+ Handle(byte[] id) {
// clone the original so the handle is imutable
this.id = ValidateUtils.checkNotNullAndNotEmpty(id, "No handle ID").clone();
}
@@ -122,11 +122,13 @@ public interface SftpClient extends SubsystemClient {
}
}
+ // CHECKSTYLE:OFF
abstract class CloseableHandle extends Handle implements Channel, Closeable {
protected CloseableHandle(byte[] id) {
super(id);
}
}
+ // CHECKSTYLE:ON
class Attributes {
// CHECKSTYLE:OFF
@@ -271,7 +273,7 @@ public interface SftpClient extends SubsystemClient {
public Attributes attributes;
// CHECKSTYLE:ON
- public DirEntry(String filename, String longFilename, Attributes attributes) {
+ DirEntry(String filename, String longFilename, Attributes attributes) {
this.filename = filename;
this.longFilename = longFilename;
this.attributes = attributes;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
index 87a204c..7a138e8 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/BuiltinFactory.java
@@ -30,7 +30,9 @@ import java.util.List;
*/
public interface BuiltinFactory<T> extends NamedFactory<T>, OptionalFeature {
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
private Utils() {
throw new UnsupportedOperationException("No instance allowed");
@@ -46,6 +48,5 @@ public interface BuiltinFactory<T> extends NamedFactory<T>, OptionalFeature {
}
return avail;
}
-
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
index 35f1604..5574552 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/NamedFactory.java
@@ -35,7 +35,9 @@ public interface NamedFactory<T> extends Factory<T>, NamedResource {
/**
* Utility class to help using NamedFactories
*/
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
private Utils() {
throw new UnsupportedOperationException("No instance allowed");
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java b/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
index 18e6f1b..9427201 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/NamedResource.java
@@ -68,7 +68,9 @@ public interface NamedResource {
/**
* Utility class to help using {@link NamedResource}s
*/
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
private Utils() {
throw new UnsupportedOperationException("No instance allowed");
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java b/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
index 73ce6a1..bd08a52 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/ServiceFactory.java
@@ -29,7 +29,9 @@ public interface ServiceFactory extends NamedResource {
/**
* Utility class to help using NamedFactories
*/
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
private Utils() {
throw new UnsupportedOperationException("No instance allowed");
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannelRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannelRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannelRequestHandler.java
new file mode 100644
index 0000000..0a00c53
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannelRequestHandler.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.sshd.common.channel;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public abstract class AbstractChannelRequestHandler extends AbstractRequestHandler<Channel> implements ChannelRequestHandler {
+ protected AbstractChannelRequestHandler() {
+ super();
+ }
+}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractRequestHandler.java
new file mode 100644
index 0000000..25b4415
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractRequestHandler.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.sshd.common.channel;
+
+import org.apache.sshd.common.util.logging.AbstractLoggingBean;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public abstract class AbstractRequestHandler<T> extends AbstractLoggingBean implements RequestHandler<T> {
+ protected AbstractRequestHandler() {
+ super();
+ }
+}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
index e997cf0..c954166 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/keyprovider/AbstractResourceKeyPairProvider.java
@@ -159,7 +159,7 @@ public abstract class AbstractResourceKeyPairProvider<R> extends AbstractKeyPair
private KeyPair nextKeyPair;
private boolean nextKeyPairSet;
- public KeyPairIterator(Collection<? extends R> resources) {
+ KeyPairIterator(Collection<? extends R> resources) {
iterator = resources.iterator();
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
index cdc41b7..e5a5bab 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/AbstractSession.java
@@ -428,7 +428,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
checkRekey();
}
- private void handleDisconnect(Buffer buffer) {
+ protected void handleDisconnect(Buffer buffer) {
int code = buffer.getInt();
String msg = buffer.getString();
if (log.isDebugEnabled()) {
@@ -437,7 +437,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
close(true);
}
- private void handleServiceRequest(Buffer buffer) throws IOException {
+ protected void handleServiceRequest(Buffer buffer) throws IOException {
String service = buffer.getString();
log.debug("Received SSH_MSG_SERVICE_REQUEST '{}'", service);
validateKexState(SshConstants.SSH_MSG_SERVICE_REQUEST, KexState.DONE);
@@ -454,13 +454,13 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
writePacket(response);
}
- private void handleServiceAccept() throws IOException {
+ protected void handleServiceAccept() throws IOException {
log.debug("Received SSH_MSG_SERVICE_ACCEPT");
validateKexState(SshConstants.SSH_MSG_SERVICE_ACCEPT, KexState.DONE);
serviceAccept();
}
- private void handleKexInit(Buffer buffer) throws Exception {
+ protected void handleKexInit(Buffer buffer) throws Exception {
log.debug("Received SSH_MSG_KEXINIT");
receiveKexInit(buffer);
if (kexState.compareAndSet(KexState.DONE, KexState.RUN)) {
@@ -479,7 +479,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
sendSessionEvent(SessionListener.Event.KexCompleted);
}
- private void handleNewKeys(int cmd) throws Exception {
+ protected void handleNewKeys(int cmd) throws Exception {
log.debug("Received SSH_MSG_NEWKEYS");
validateKexState(cmd, KexState.KEYS);
receiveNewKeys();
@@ -745,7 +745,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
* @param buffer the buffer to encode
* @throws IOException if an exception occurs during the encoding process
*/
- private void encode(Buffer buffer) throws IOException {
+ protected void encode(Buffer buffer) throws IOException {
try {
// Check that the packet has some free space for the header
if (buffer.rpos() < 5) {
@@ -1230,7 +1230,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
}
/**
- * Private method used while putting new keys into use that will resize the key used to
+ * Method used while putting new keys into use that will resize the key used to
* initialize the cipher to the needed length.
*
* @param e the key to resize
@@ -1241,7 +1241,7 @@ public abstract class AbstractSession extends AbstractInnerCloseable implements
* @return the resize key
* @throws Exception if a problem occur while resizing the key
*/
- private byte[] resizeKey(byte[] e, int blockSize, Digest hash, byte[] k, byte[] h) throws Exception {
+ protected byte[] resizeKey(byte[] e, int blockSize, Digest hash, byte[] k, byte[] h) throws Exception {
while (blockSize > e.length) {
Buffer buffer = new ByteArrayBuffer();
buffer.putMPInt(k);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
index 2a6a109..ec68375 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/Session.java
@@ -229,11 +229,13 @@ public interface Session extends SessionListenerManager, ChannelListenerManager,
* @param <T> type of value stored in the attribute.
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
- public class AttributeKey<T> {
+ // CHECKSTYLE:OFF
+ class AttributeKey<T> {
public AttributeKey() {
super();
}
}
+ // CHECKSTYLE:ON
void resetIdleTimeout();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java b/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
new file mode 100644
index 0000000..8e50cea
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/EventNotifier.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.sshd.common.util;
+
+/**
+ * Notify about the occurence of an event
+ *
+ * @param <E> type of event being notified
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public interface EventNotifier<E> {
+ /**
+ * @param event The event
+ * @throws Exception If failed to process the event notification
+ */
+ void notifyEvent(E event) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
index 7e15f64..90bab63 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Int2IntFunction.java
@@ -40,7 +40,9 @@ public interface Int2IntFunction {
*/
int apply(int value);
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
private Utils() {
throw new UnsupportedOperationException("No instance allowed");
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
index 0592d5f..53152b6 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/SecurityUtils.java
@@ -281,10 +281,10 @@ public final class SecurityUtils {
/**
* Named factory for the BouncyCastle <code>Random</code>
*/
- private static final class BouncyCastleRandomFactory implements RandomFactory {
+ public static final class BouncyCastleRandomFactory implements RandomFactory {
private static final BouncyCastleRandomFactory INSTANCE = new BouncyCastleRandomFactory();
- private BouncyCastleRandomFactory() {
+ public BouncyCastleRandomFactory() {
super();
}
@@ -312,11 +312,11 @@ public final class SecurityUtils {
*
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
- private static final class BouncyCastleRandom extends AbstractRandom {
+ public static final class BouncyCastleRandom extends AbstractRandom {
private final RandomGenerator random;
- public BouncyCastleRandom() {
+ BouncyCastleRandom() {
ValidateUtils.checkTrue(isBouncyCastleRegistered(), "BouncyCastle not registered");
this.random = new VMPCRandomGenerator();
byte[] seed = new SecureRandom().generateSeed(8);
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java b/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
index 8f00deb..d91ab6b 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/Transformer.java
@@ -58,7 +58,10 @@ public interface Transformer<I, O> {
*/
O transform(I input);
+ // CHECKSTYLE:OFF
final class Utils {
+ // CHECKSTYLE:ON
+
@SuppressWarnings("rawtypes")
private static final Transformer IDENTITY = new Transformer() {
@Override
@@ -75,6 +78,5 @@ public interface Transformer<I, O> {
public static <U extends V, V> Transformer<U, V> identity() {
return (Transformer<U, V>) IDENTITY;
}
-
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
index 8d722e7..98fe92d 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ChannelSession.java
@@ -38,10 +38,10 @@ import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.common.FactoryManagerUtils;
import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.common.SshConstants;
+import org.apache.sshd.common.channel.AbstractChannelRequestHandler;
import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.channel.ChannelAsyncOutputStream;
import org.apache.sshd.common.channel.ChannelOutputStream;
-import org.apache.sshd.common.channel.ChannelRequestHandler;
import org.apache.sshd.common.channel.PtyMode;
import org.apache.sshd.common.file.FileSystemAware;
import org.apache.sshd.common.file.FileSystemFactory;
@@ -670,8 +670,8 @@ public class ChannelSession extends AbstractServerChannel {
}
}
- private class ChannelSessionRequestHandler implements ChannelRequestHandler {
- public ChannelSessionRequestHandler() {
+ private class ChannelSessionRequestHandler extends AbstractChannelRequestHandler {
+ ChannelSessionRequestHandler() {
super();
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/20ac8467/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java
index 5f046dc..022b949 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/PuttyRequestHandler.java
@@ -18,17 +18,16 @@
*/
package org.apache.sshd.server.channel;
+import org.apache.sshd.common.channel.AbstractChannelRequestHandler;
import org.apache.sshd.common.channel.Channel;
-import org.apache.sshd.common.channel.ChannelRequestHandler;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.logging.AbstractLoggingBean;
/**
* Handles Putty specific channel requests as indicated by
* <A HREF="http://tartarus.org/~simon/putty-snapshots/htmldoc/AppendixF.html">Appendix F: SSH-2 names specified for PuTTY</A>
*/
-public class PuttyRequestHandler extends AbstractLoggingBean implements ChannelRequestHandler {
+public class PuttyRequestHandler extends AbstractChannelRequestHandler {
public static final String REQUEST_SUFFIX = "@putty.projects.tartarus.org";
public PuttyRequestHandler() {