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/08/20 10:52:41 UTC
mina-sshd git commit: [SSHD-556] Use consistent Channel hierarchy
model
Repository: mina-sshd
Updated Branches:
refs/heads/master 788c6c58c -> 89809dfb3
[SSHD-556] Use consistent Channel hierarchy model
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/89809dfb
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/89809dfb
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/89809dfb
Branch: refs/heads/master
Commit: 89809dfb37aa17dff8591ed9259336bc725633c1
Parents: 788c6c5
Author: Lyor Goldstein <lg...@vmware.com>
Authored: Thu Aug 20 11:52:32 2015 +0300
Committer: Lyor Goldstein <lg...@vmware.com>
Committed: Thu Aug 20 11:52:32 2015 +0300
----------------------------------------------------------------------
.../sshd/client/channel/ClientChannel.java | 3 +-
.../sshd/common/channel/AbstractChannel.java | 4 +--
.../apache/sshd/common/util/CloseableUtils.java | 6 ++--
.../util/logging/AbstractLoggingBean.java | 12 ++++++--
.../server/channel/AbstractServerChannel.java | 4 +--
.../sshd/server/channel/ServerChannel.java | 29 ++++++++++++++++++++
6 files changed, 47 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannel.java b/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannel.java
index 7392690..5fa1484 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/channel/ClientChannel.java
@@ -21,9 +21,9 @@ package org.apache.sshd.client.channel;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.nio.channels.Channel;
import org.apache.sshd.client.future.OpenFuture;
+import org.apache.sshd.common.channel.Channel;
import org.apache.sshd.common.future.CloseFuture;
import org.apache.sshd.common.io.IoInputStream;
import org.apache.sshd.common.io.IoOutputStream;
@@ -97,6 +97,7 @@ public interface ClientChannel extends Channel {
int waitFor(int mask, long timeout);
+ @Override
CloseFuture close(boolean immediate);
Integer getExitStatus();
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
index 11bf526..e468da4 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/channel/AbstractChannel.java
@@ -82,7 +82,7 @@ public abstract class AbstractChannel
protected final List<RequestHandler<Channel>> handlers = new ArrayList<RequestHandler<Channel>>();
protected AbstractChannel() {
- super();
+ this("");
}
protected AbstractChannel(String discriminator) {
@@ -155,7 +155,7 @@ public abstract class AbstractChannel
log.warn("Error processing channel request " + req, e);
result = RequestHandler.Result.ReplyFailure;
}
-
+
// if Unsupported then check the next handler in line
if (RequestHandler.Result.Unsupported.equals(result)) {
if (log.isTraceEnabled()) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java b/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
index c70c96e..1d046d0 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/CloseableUtils.java
@@ -156,7 +156,7 @@ public final class CloseableUtils {
public abstract static class IoBaseCloseable extends AbstractLoggingBean implements Closeable {
protected IoBaseCloseable() {
- super();
+ this("");
}
protected IoBaseCloseable(String discriminator) {
@@ -330,7 +330,7 @@ public final class CloseableUtils {
protected final CloseFuture closeFuture = new DefaultCloseFuture(lock);
protected AbstractCloseable() {
- super();
+ this("");
}
protected AbstractCloseable(String discriminator) {
@@ -422,7 +422,7 @@ public final class CloseableUtils {
public abstract static class AbstractInnerCloseable extends AbstractCloseable {
protected AbstractInnerCloseable() {
- super();
+ this("");
}
protected AbstractInnerCloseable(String discriminator) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/common/util/logging/AbstractLoggingBean.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/AbstractLoggingBean.java b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/AbstractLoggingBean.java
index 9cd4621..5cd9eba 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/util/logging/AbstractLoggingBean.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/util/logging/AbstractLoggingBean.java
@@ -19,6 +19,7 @@
package org.apache.sshd.common.util.logging;
+import org.apache.sshd.common.util.GenericUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,16 +37,21 @@ public abstract class AbstractLoggingBean {
* Default constructor - creates a logger using the full class name
*/
protected AbstractLoggingBean() {
- log = LoggerFactory.getLogger(getClass());
+ this("");
}
/**
* Create a logger for instances of the same class for which we might
* want to have a "discriminator" for them
*
- * @param discriminator The discriminator value
+ * @param discriminator The discriminator value - ignored if {@code null}
+ * or empty
*/
protected AbstractLoggingBean(String discriminator) {
- log = LoggerFactory.getLogger(getClass().getName() + "[" + discriminator + "]");
+ String name = getClass().getName();
+ if (GenericUtils.length(discriminator) > 0) {
+ name += "[" + discriminator + "]";
+ }
+ log = LoggerFactory.getLogger(name);
}
}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
index 7ed3e35..3b7be62 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/AbstractServerChannel.java
@@ -31,12 +31,12 @@ import org.apache.sshd.common.util.buffer.Buffer;
*
* @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
*/
-public abstract class AbstractServerChannel extends AbstractChannel {
+public abstract class AbstractServerChannel extends AbstractChannel implements ServerChannel {
protected boolean exitStatusSent;
protected AbstractServerChannel() {
- super();
+ this("");
}
protected AbstractServerChannel(String discriminator) {
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/89809dfb/sshd-core/src/main/java/org/apache/sshd/server/channel/ServerChannel.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/channel/ServerChannel.java b/sshd-core/src/main/java/org/apache/sshd/server/channel/ServerChannel.java
new file mode 100644
index 0000000..9aecce4
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/server/channel/ServerChannel.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.server.channel;
+
+import org.apache.sshd.common.channel.Channel;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public interface ServerChannel extends Channel {
+ // Marker interface
+}