You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2018/04/16 11:48:13 UTC
[26/30] mina-sshd git commit: [SSHD-815] Extract SFTP in its own
module
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtension.java
deleted file mode 100644
index ab00f9e..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractMD5HashExtension.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.buffer.BufferUtils;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public abstract class AbstractMD5HashExtension extends AbstractSftpClientExtension {
- protected AbstractMD5HashExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) {
- super(name, client, raw, extras);
- }
-
- protected byte[] doGetHash(Object target, long offset, long length, byte[] quickHash) throws IOException {
- Buffer buffer = getCommandBuffer(target, Long.SIZE + 2 * Long.BYTES + Integer.BYTES + NumberUtils.length(quickHash));
- String opcode = getName();
- putTarget(buffer, target);
- buffer.putLong(offset);
- buffer.putLong(length);
- buffer.putBytes((quickHash == null) ? GenericUtils.EMPTY_BYTE_ARRAY : quickHash);
-
- boolean debugEnabled = log.isDebugEnabled();
- if (debugEnabled) {
- log.debug("doGetHash({})[{}] - offset={}, length={}, quick-hash={}",
- opcode, (target instanceof CharSequence) ? target : BufferUtils.toHex(BufferUtils.EMPTY_HEX_SEPARATOR, (byte[]) target),
- offset, length, BufferUtils.toHex(':', quickHash));
- }
-
- buffer = checkExtendedReplyBuffer(receive(sendExtendedCommand(buffer)));
- if (buffer == null) {
- throw new StreamCorruptedException("Missing extended reply data");
- }
-
- String targetType = buffer.getString();
- if (String.CASE_INSENSITIVE_ORDER.compare(targetType, opcode) != 0) {
- throw new StreamCorruptedException("Mismatched reply target type: expected=" + opcode + ", actual=" + targetType);
- }
-
- byte[] hashValue = buffer.getBytes();
- if (debugEnabled) {
- log.debug("doGetHash({})[{}] - offset={}, length={}, quick-hash={} - result={}",
- opcode, target, offset, length,
- BufferUtils.toHex(':', quickHash), BufferUtils.toHex(':', hashValue));
- }
-
- return hashValue;
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
deleted file mode 100644
index 6b179c9..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/AbstractSftpClientExtension.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-import org.apache.sshd.common.SshException;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.subsystem.sftp.SftpException;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.ValidateUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.buffer.ByteArrayBuffer;
-import org.apache.sshd.common.util.logging.AbstractLoggingBean;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public abstract class AbstractSftpClientExtension extends AbstractLoggingBean implements SftpClientExtension, RawSftpClient {
- private final String name;
- private final SftpClient client;
- private final RawSftpClient raw;
- private final boolean supported;
-
- protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Collection<String> extras) {
- this(name, client, raw, GenericUtils.isNotEmpty(extras) && extras.contains(name));
- }
-
- protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
- this(name, client, raw, GenericUtils.isNotEmpty(extensions) && extensions.containsKey(name));
- }
-
- protected AbstractSftpClientExtension(String name, SftpClient client, RawSftpClient raw, boolean supported) {
- this.name = ValidateUtils.checkNotNullAndNotEmpty(name, "No extension name");
- this.client = Objects.requireNonNull(client, "No client instance");
- this.raw = Objects.requireNonNull(raw, "No raw access");
- this.supported = supported;
- }
-
- @Override
- public final String getName() {
- return name;
- }
-
- @Override
- public final SftpClient getClient() {
- return client;
- }
-
- protected void sendAndCheckExtendedCommandStatus(Buffer buffer) throws IOException {
- int reqId = sendExtendedCommand(buffer);
- if (log.isDebugEnabled()) {
- log.debug("sendAndCheckExtendedCommandStatus(" + getName() + ") id=" + reqId);
- }
- checkStatus(receive(reqId));
- }
-
- protected int sendExtendedCommand(Buffer buffer) throws IOException {
- return send(SftpConstants.SSH_FXP_EXTENDED, buffer);
- }
-
- @Override
- public int send(int cmd, Buffer buffer) throws IOException {
- return raw.send(cmd, buffer);
- }
-
- @Override
- public Buffer receive(int id) throws IOException {
- return raw.receive(id);
- }
-
- @Override
- public final boolean isSupported() {
- return supported;
- }
-
- protected void checkStatus(Buffer buffer) throws IOException {
- if (checkExtendedReplyBuffer(buffer) != null) {
- throw new StreamCorruptedException("Unexpected extended reply received");
- }
- }
-
- /**
- * @param buffer The {@link Buffer}
- * @param target A target path {@link String} or {@link Handle} or {@code byte[]}
- * to be encoded in the buffer
- * @return The updated buffer
- * @throws UnsupportedOperationException If target is not one of the above
- * supported types
- */
- public Buffer putTarget(Buffer buffer, Object target) {
- if (target instanceof CharSequence) {
- buffer.putString(target.toString());
- } else if (target instanceof byte[]) {
- buffer.putBytes((byte[]) target);
- } else if (target instanceof Handle) {
- buffer.putBytes(((Handle) target).getIdentifier());
- } else {
- throw new UnsupportedOperationException("Unknown target type: " + target);
- }
-
- return buffer;
- }
-
- /**
- * @param target A target path {@link String} or {@link Handle} or {@code byte[]}
- * to be encoded in the buffer
- * @return A {@link Buffer} with the extension name set
- * @see #getCommandBuffer(Object, int)
- */
- protected Buffer getCommandBuffer(Object target) {
- return getCommandBuffer(target, 0);
- }
-
- /**
- * @param target A target path {@link String} or {@link Handle} or {@code byte[]}
- * to be encoded in the buffer
- * @param extraSize Extra size - beyond the path/handle to be allocated
- * @return A {@link Buffer} with the extension name set
- * @see #getCommandBuffer(int)
- */
- protected Buffer getCommandBuffer(Object target, int extraSize) {
- if (target instanceof CharSequence) {
- return getCommandBuffer(Integer.BYTES + ((CharSequence) target).length() + extraSize);
- } else if (target instanceof byte[]) {
- return getCommandBuffer(Integer.BYTES + ((byte[]) target).length + extraSize);
- } else if (target instanceof Handle) {
- return getCommandBuffer(Integer.BYTES + ((Handle) target).length() + extraSize);
- } else {
- return getCommandBuffer(extraSize);
- }
- }
-
- /**
- * @param extraSize Extra size - besides the extension name
- * @return A {@link Buffer} with the extension name set
- */
- protected Buffer getCommandBuffer(int extraSize) {
- String opcode = getName();
- Buffer buffer = new ByteArrayBuffer(Integer.BYTES + GenericUtils.length(opcode) + extraSize + Byte.SIZE, false);
- buffer.putString(opcode);
- return buffer;
- }
-
- /**
- * @param buffer The {@link Buffer} to check
- * @return The {@link Buffer} if this is an {@link SftpConstants#SSH_FXP_EXTENDED_REPLY},
- * or {@code null} if this is a {@link SftpConstants#SSH_FXP_STATUS} carrying
- * an {@link SftpConstants#SSH_FX_OK} result
- * @throws IOException If a non-{@link SftpConstants#SSH_FX_OK} result or
- * not a {@link SftpConstants#SSH_FXP_EXTENDED_REPLY} buffer
- */
- protected Buffer checkExtendedReplyBuffer(Buffer buffer) throws IOException {
- int length = buffer.getInt();
- int type = buffer.getUByte();
- int id = buffer.getInt();
- if (type == SftpConstants.SSH_FXP_STATUS) {
- int substatus = buffer.getInt();
- String msg = buffer.getString();
- String lang = buffer.getString();
- if (log.isDebugEnabled()) {
- log.debug("checkExtendedReplyBuffer({}}[id={}] - status: {} [{}] {}",
- getName(), id, substatus, lang, msg);
- }
-
- if (substatus != SftpConstants.SSH_FX_OK) {
- throwStatusException(id, substatus, msg, lang);
- }
-
- return null;
- } else if (type == SftpConstants.SSH_FXP_EXTENDED_REPLY) {
- return buffer;
- } else {
- throw new SshException("Unexpected SFTP packet received: type=" + type + ", id=" + id + ", length=" + length);
- }
- }
-
- protected void throwStatusException(int id, int substatus, String msg, String lang) throws IOException {
- throw new SftpException(substatus, msg);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
deleted file mode 100644
index 1a464c3..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileHandleExtensionImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.AbstractMap.SimpleImmutableEntry;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.CheckFileHandleExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-
-/**
- * Implements "check-file-handle" extension
- *
- * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 - section 9.1.2</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class CheckFileHandleExtensionImpl extends AbstractCheckFileExtension implements CheckFileHandleExtension {
- public CheckFileHandleExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extras) {
- super(SftpConstants.EXT_CHECK_FILE_HANDLE, client, raw, extras);
- }
-
- @Override
- public SimpleImmutableEntry<String, Collection<byte[]>> checkFileHandle(
- Handle handle, Collection<String> algorithms, long startOffset, long length, int blockSize)
- throws IOException {
- return doGetHash(handle.getIdentifier(), algorithms, startOffset, length, blockSize);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
deleted file mode 100644
index 1b615c8..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CheckFileNameExtensionImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.AbstractMap.SimpleImmutableEntry;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.CheckFileNameExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-
-/**
- * Implements "check-file-name" extension
- *
- * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 - section 9.1.2</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class CheckFileNameExtensionImpl extends AbstractCheckFileExtension implements CheckFileNameExtension {
- public CheckFileNameExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extras) {
- super(SftpConstants.EXT_CHECK_FILE_NAME, client, raw, extras);
- }
-
- @Override
- public SimpleImmutableEntry<String, Collection<byte[]>> checkFileName(
- String name, Collection<String> algorithms, long startOffset, long length, int blockSize)
- throws IOException {
- return doGetHash(name, algorithms, startOffset, length, blockSize);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImpl.java
deleted file mode 100644
index 85623b8..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyDataExtensionImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.CopyDataExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * Implements the "copy-data" extension
- *
- * @see <A HREF="http://tools.ietf.org/id/draft-ietf-secsh-filexfer-extensions-00.txt">DRFAT 00 - section 7</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class CopyDataExtensionImpl extends AbstractSftpClientExtension implements CopyDataExtension {
- public CopyDataExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extra) {
- super(SftpConstants.EXT_COPY_DATA, client, raw, extra);
- }
-
- @Override
- public void copyData(Handle readHandle, long readOffset, long readLength, Handle writeHandle, long writeOffset) throws IOException {
- byte[] srcId = readHandle.getIdentifier();
- byte[] dstId = writeHandle.getIdentifier();
- Buffer buffer = getCommandBuffer(Integer.BYTES + NumberUtils.length(srcId)
- + Integer.BYTES + NumberUtils.length(dstId)
- + (3 * (Long.SIZE + Integer.BYTES)));
- buffer.putBytes(srcId);
- buffer.putLong(readOffset);
- buffer.putLong(readLength);
- buffer.putBytes(dstId);
- buffer.putLong(writeOffset);
- sendAndCheckExtendedCommandStatus(buffer);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImpl.java
deleted file mode 100644
index 63f79e5..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/CopyFileExtensionImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.CopyFileExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.util.GenericUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * Implements the "copy-file" extension
- *
- * @see <A HREF="http://tools.ietf.org/id/draft-ietf-secsh-filexfer-extensions-00.txt">DRFAT 00 - section 6</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class CopyFileExtensionImpl extends AbstractSftpClientExtension implements CopyFileExtension {
- public CopyFileExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extra) {
- super(SftpConstants.EXT_COPY_FILE, client, raw, extra);
- }
-
- @Override
- public void copyFile(String src, String dst, boolean overwriteDestination) throws IOException {
- Buffer buffer = getCommandBuffer(Integer.BYTES + GenericUtils.length(src)
- + Integer.BYTES + GenericUtils.length(dst)
- + 1 /* override destination */);
- buffer.putString(src);
- buffer.putString(dst);
- buffer.putBoolean(overwriteDestination);
- sendAndCheckExtendedCommandStatus(buffer);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5FileExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5FileExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5FileExtensionImpl.java
deleted file mode 100644
index bc6149e..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5FileExtensionImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.MD5FileExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-
-/**
- * Implements "md5-hash" extension
- *
- * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 - section 9.1.1</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class MD5FileExtensionImpl extends AbstractMD5HashExtension implements MD5FileExtension {
- public MD5FileExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extra) {
- super(SftpConstants.EXT_MD5_HASH, client, raw, extra);
- }
-
- @Override
- public byte[] getHash(String path, long offset, long length, byte[] quickHash) throws IOException {
- return doGetHash(path, offset, length, quickHash);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5HandleExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5HandleExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5HandleExtensionImpl.java
deleted file mode 100644
index d71edd6..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/MD5HandleExtensionImpl.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.MD5HandleExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-
-/**
- * Implements "md5-hash-handle" extension
- *
- * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 - section 9.1.1</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class MD5HandleExtensionImpl extends AbstractMD5HashExtension implements MD5HandleExtension {
- public MD5HandleExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extra) {
- super(SftpConstants.EXT_MD5_HASH_HANDLE, client, raw, extra);
- }
-
- @Override
- public byte[] getHash(SftpClient.Handle handle, long offset, long length, byte[] quickHash) throws IOException {
- return doGetHash(handle.getIdentifier(), offset, length, quickHash);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImpl.java
deleted file mode 100644
index 6fc0745..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/helpers/SpaceAvailableExtensionImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.helpers;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.util.Collection;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.SpaceAvailableExtension;
-import org.apache.sshd.common.subsystem.sftp.SftpConstants;
-import org.apache.sshd.common.subsystem.sftp.extensions.SpaceAvailableExtensionInfo;
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * Implements "space-available" extension
- *
- * @see <A HREF="http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-09.txt">DRAFT 09 - section 9.3</A>
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class SpaceAvailableExtensionImpl extends AbstractSftpClientExtension implements SpaceAvailableExtension {
- public SpaceAvailableExtensionImpl(SftpClient client, RawSftpClient raw, Collection<String> extra) {
- super(SftpConstants.EXT_SPACE_AVAILABLE, client, raw, extra);
- }
-
- @Override
- public SpaceAvailableExtensionInfo available(String path) throws IOException {
- Buffer buffer = getCommandBuffer(path);
- buffer.putString(path);
- buffer = checkExtendedReplyBuffer(receive(sendExtendedCommand(buffer)));
-
- if (buffer == null) {
- throw new StreamCorruptedException("Missing extended reply data");
- }
-
- return new SpaceAvailableExtensionInfo(buffer);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHFsyncExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHFsyncExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHFsyncExtension.java
deleted file mode 100644
index bfdbc0e..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHFsyncExtension.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh;
-
-import java.io.IOException;
-
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-
-/**
- * Implements the "fsync@openssh.com" extension
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- * @see <A HREF="https://github.com/openssh/openssh-portable/blob/master/PROTOCOL">OpenSSH - section 10</A>
- */
-public interface OpenSSHFsyncExtension extends SftpClientExtension {
- void fsync(Handle fileHandle) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatExtensionInfo.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatExtensionInfo.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatExtensionInfo.java
deleted file mode 100644
index a9cd944..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatExtensionInfo.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh;
-
-import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * Response for the "statvfs@openssh.com" and "fstatvfs@openssh.com"
- * extension commands.
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- * @see <A HREF="http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/ssh/PROTOCOL?rev=1.28&content-type=text/plain">OpenSSH section 3.4</A>
- */
-public class OpenSSHStatExtensionInfo implements Cloneable {
- // The values of the f_flag bitmask
- public static final long SSH_FXE_STATVFS_ST_RDONLY = 0x1; /* read-only */
- public static final long SSH_FXE_STATVFS_ST_NOSUID = 0x2; /* no setuid */
-
- // CHECKSTYLE:OFF
- public long f_bsize; /* file system block size */
- public long f_frsize; /* fundamental fs block size */
- public long f_blocks; /* number of blocks (unit f_frsize) */
- public long f_bfree; /* free blocks in file system */
- public long f_bavail; /* free blocks for non-root */
- public long f_files; /* total file inodes */
- public long f_ffree; /* free file inodes */
- public long f_favail; /* free file inodes for to non-root */
- public long f_fsid; /* file system id */
- public long f_flag; /* bit mask of f_flag values */
- public long f_namemax; /* maximum filename length */
- // CHECKSTYLE:ON
-
- public OpenSSHStatExtensionInfo() {
- super();
- }
-
- public OpenSSHStatExtensionInfo(Buffer buffer) {
- decode(buffer, this);
- }
-
- @Override
- public int hashCode() {
- return NumberUtils.hashCode(this.f_bsize, this.f_frsize, this.f_blocks,
- this.f_bfree, this.f_bavail, this.f_files, this.f_ffree,
- this.f_favail, this.f_fsid, this.f_flag, this.f_namemax);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
-
- OpenSSHStatExtensionInfo other = (OpenSSHStatExtensionInfo) obj;
- // debug breakpoint
- return this.f_bsize == other.f_bsize
- && this.f_frsize == other.f_frsize
- && this.f_blocks == other.f_blocks
- && this.f_bfree == other.f_bfree
- && this.f_bavail == other.f_bavail
- && this.f_files == other.f_files
- && this.f_ffree == other.f_ffree
- && this.f_favail == other.f_favail
- && this.f_fsid == other.f_fsid
- && this.f_flag == other.f_flag
- && this.f_namemax == other.f_namemax;
- }
-
- @Override
- public OpenSSHStatExtensionInfo clone() {
- try {
- return getClass().cast(super.clone());
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException("Failed to close " + toString() + ": " + e.getMessage());
- }
- }
-
- @Override
- public String toString() {
- return "f_bsize=" + f_bsize
- + ",f_frsize=" + f_frsize
- + ",f_blocks=" + f_blocks
- + ",f_bfree=" + f_bfree
- + ",f_bavail=" + f_bavail
- + ",f_files=" + f_files
- + ",f_ffree=" + f_ffree
- + ",f_favail=" + f_favail
- + ",f_fsid=" + f_fsid
- + ",f_flag=0x" + Long.toHexString(f_flag)
- + ",f_namemax=" + f_namemax;
- }
-
- public static void encode(Buffer buffer, OpenSSHStatExtensionInfo info) {
- buffer.putLong(info.f_bsize);
- buffer.putLong(info.f_frsize);
- buffer.putLong(info.f_blocks);
- buffer.putLong(info.f_bfree);
- buffer.putLong(info.f_bavail);
- buffer.putLong(info.f_files);
- buffer.putLong(info.f_ffree);
- buffer.putLong(info.f_favail);
- buffer.putLong(info.f_fsid);
- buffer.putLong(info.f_flag);
- buffer.putLong(info.f_namemax);
- }
-
- public static OpenSSHStatExtensionInfo decode(Buffer buffer) {
- OpenSSHStatExtensionInfo info = new OpenSSHStatExtensionInfo();
- decode(buffer, info);
- return info;
- }
-
- public static void decode(Buffer buffer, OpenSSHStatExtensionInfo info) {
- info.f_bsize = buffer.getLong();
- info.f_frsize = buffer.getLong();
- info.f_blocks = buffer.getLong();
- info.f_bfree = buffer.getLong();
- info.f_bavail = buffer.getLong();
- info.f_files = buffer.getLong();
- info.f_ffree = buffer.getLong();
- info.f_favail = buffer.getLong();
- info.f_fsid = buffer.getLong();
- info.f_flag = buffer.getLong();
- info.f_namemax = buffer.getLong();
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatHandleExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatHandleExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatHandleExtension.java
deleted file mode 100644
index 7fa76a6..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatHandleExtension.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh;
-
-import java.io.IOException;
-
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-
-/**
- * Implements the "fstatvfs@openssh.com" extension command
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public interface OpenSSHStatHandleExtension extends SftpClientExtension {
- OpenSSHStatExtensionInfo stat(Handle handle) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatPathExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatPathExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatPathExtension.java
deleted file mode 100644
index 9d9853d..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/OpenSSHStatPathExtension.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh;
-
-import java.io.IOException;
-
-import org.apache.sshd.client.subsystem.sftp.extensions.SftpClientExtension;
-
-/**
- * Implements the "statvfs@openssh.com" extension command
- *
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- * @see <A HREF="http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/ssh/PROTOCOL?rev=1.28&content-type=text/plain">OpenSSH section 3.4</A>
- */
-public interface OpenSSHStatPathExtension extends SftpClientExtension {
- OpenSSHStatExtensionInfo stat(String path) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/AbstractOpenSSHStatCommandExtension.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/AbstractOpenSSHStatCommandExtension.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/AbstractOpenSSHStatCommandExtension.java
deleted file mode 100644
index 70550ee..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/AbstractOpenSSHStatCommandExtension.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh.helpers;
-
-import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.util.Map;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.helpers.AbstractSftpClientExtension;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatExtensionInfo;
-import org.apache.sshd.common.util.buffer.Buffer;
-import org.apache.sshd.common.util.buffer.BufferUtils;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public abstract class AbstractOpenSSHStatCommandExtension extends AbstractSftpClientExtension {
- protected AbstractOpenSSHStatCommandExtension(String name, SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
- super(name, client, raw, extensions);
- }
-
- protected OpenSSHStatExtensionInfo doGetStat(Object target) throws IOException {
- Buffer buffer = getCommandBuffer(target);
- putTarget(buffer, target);
-
- if (log.isDebugEnabled()) {
- log.debug("doGetStat({})[{}]", getName(),
- (target instanceof CharSequence) ? target : BufferUtils.toHex(BufferUtils.EMPTY_HEX_SEPARATOR, (byte[]) target));
- }
-
- buffer = checkExtendedReplyBuffer(receive(sendExtendedCommand(buffer)));
- if (buffer == null) {
- throw new StreamCorruptedException("Missing extended reply data");
- }
-
- return new OpenSSHStatExtensionInfo(buffer);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHFsyncExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHFsyncExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHFsyncExtensionImpl.java
deleted file mode 100644
index e83ea11..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHFsyncExtensionImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh.helpers;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.helpers.AbstractSftpClientExtension;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHFsyncExtension;
-import org.apache.sshd.common.subsystem.sftp.extensions.openssh.FsyncExtensionParser;
-import org.apache.sshd.common.util.NumberUtils;
-import org.apache.sshd.common.util.buffer.Buffer;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class OpenSSHFsyncExtensionImpl extends AbstractSftpClientExtension implements OpenSSHFsyncExtension {
- public OpenSSHFsyncExtensionImpl(SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
- super(FsyncExtensionParser.NAME, client, raw, extensions);
- }
-
- @Override
- public void fsync(Handle fileHandle) throws IOException {
- byte[] handle = fileHandle.getIdentifier();
- Buffer buffer = getCommandBuffer(Integer.BYTES + NumberUtils.length(handle));
- buffer.putBytes(handle);
- sendAndCheckExtendedCommandStatus(buffer);
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatHandleExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatHandleExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatHandleExtensionImpl.java
deleted file mode 100644
index de5f780..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatHandleExtensionImpl.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh.helpers;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient.Handle;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatExtensionInfo;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatHandleExtension;
-import org.apache.sshd.common.subsystem.sftp.extensions.openssh.FstatVfsExtensionParser;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class OpenSSHStatHandleExtensionImpl extends AbstractOpenSSHStatCommandExtension implements OpenSSHStatHandleExtension {
- public OpenSSHStatHandleExtensionImpl(SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
- super(FstatVfsExtensionParser.NAME, client, raw, extensions);
- }
-
- @Override
- public OpenSSHStatExtensionInfo stat(Handle handle) throws IOException {
- return doGetStat(handle.getIdentifier());
- }
-}
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/251db9b9/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatPathExtensionImpl.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatPathExtensionImpl.java b/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatPathExtensionImpl.java
deleted file mode 100644
index 1cf3956..0000000
--- a/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/extensions/openssh/helpers/OpenSSHStatPathExtensionImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.subsystem.sftp.extensions.openssh.helpers;
-
-import java.io.IOException;
-import java.util.Map;
-
-import org.apache.sshd.client.subsystem.sftp.RawSftpClient;
-import org.apache.sshd.client.subsystem.sftp.SftpClient;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatExtensionInfo;
-import org.apache.sshd.client.subsystem.sftp.extensions.openssh.OpenSSHStatPathExtension;
-import org.apache.sshd.common.subsystem.sftp.extensions.openssh.StatVfsExtensionParser;
-
-/**
- * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
- */
-public class OpenSSHStatPathExtensionImpl extends AbstractOpenSSHStatCommandExtension implements OpenSSHStatPathExtension {
- public OpenSSHStatPathExtensionImpl(SftpClient client, RawSftpClient raw, Map<String, byte[]> extensions) {
- super(StatVfsExtensionParser.NAME, client, raw, extensions);
- }
-
- @Override
- public OpenSSHStatExtensionInfo stat(String path) throws IOException {
- return doGetStat(path);
- }
-}