diff --git a/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/ISshCommandExecutor.java b/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/ISshCommandExecutor.java new file mode 100644 index 0000000000000000000000000000000000000000..c07c37c2286d332403a03a5b53d41d9d448d36a5 --- /dev/null +++ b/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/ISshCommandExecutor.java @@ -0,0 +1,41 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed 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 ch.systemsx.cisd.common.filesystem.ssh; + +import java.io.File; + +import ch.systemsx.cisd.common.filesystem.BooleanStatus; +import ch.systemsx.cisd.common.process.ProcessResult; + +/** + * @author Piotr Buczek + */ +public interface ISshCommandExecutor +{ + + public abstract BooleanStatus exists(File file, final long timeOutMillis); + + public abstract BooleanStatus checkDirectoryAccessible(final String pathString, + final long timeOutMillis); + + public abstract ProcessResult tryExecuteCommandRemotely(final String localCmd, + final long timeOutMillis); + + public abstract ProcessResult tryExecuteCommandRemotely(final String localCmd, + final long timeOutMillis, final boolean logResult); + +} \ No newline at end of file diff --git a/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/SshCommandExecutor.java b/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/SshCommandExecutor.java index 48cc7c353518c3ecd82918073462ed06b3c33734..4ae11a145e850680906f1607173a2df1e608d8f4 100644 --- a/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/SshCommandExecutor.java +++ b/common/source/java/ch/systemsx/cisd/common/filesystem/ssh/SshCommandExecutor.java @@ -37,7 +37,7 @@ import ch.systemsx.cisd.common.process.ProcessExecutionHelper.OutputReadingStrat * * @author Piotr Buczek */ -public class SshCommandExecutor implements Serializable +public class SshCommandExecutor implements ISshCommandExecutor, Serializable { private static final long serialVersionUID = 1L; @@ -62,7 +62,7 @@ public class SshCommandExecutor implements Serializable this.sshCommandBuilder = sshCommandBuilder; } - public String getHost() + private String getHost() { assert host != null : "host cannot be null"; return host;