View Javadoc
1   /**
2    * Copyright 2010-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.channel.api;
17  
18  import java.io.File;
19  import java.io.IOException;
20  import java.io.InputStream;
21  import java.io.OutputStream;
22  import java.util.List;
23  
24  import org.kuali.common.util.channel.model.CommandContext;
25  import org.kuali.common.util.channel.model.CommandResult;
26  import org.kuali.common.util.channel.model.CopyResult;
27  import org.kuali.common.util.channel.model.RemoteFile;
28  
29  public interface SecureChannel {
30  
31  	CommandResult exec(CommandContext context);
32  
33  	List<CommandResult> exec(CommandContext... contexts);
34  
35  	/**
36  	 * Pass this command to a remote server as a sequence of bytes encoded using UTF-8
37  	 */
38  	CommandResult exec(String command);
39  
40  	/**
41  	 * Pass each command to a remote server as a sequence of bytes encoded using UTF-8
42  	 */
43  	List<CommandResult> exec(String... commands);
44  
45  	/**
46  	 * Pass this command to a remote server as a sequence of bytes encoded using UTF-8
47  	 */
48  	void execNoWait(String command);
49  
50  	void execNoWait(byte[] command);
51  
52  	CopyResult scp(File source, RemoteFile destination);
53  
54  	CopyResult scp(String location, RemoteFile destination);
55  
56  	CopyResult scp(InputStream source, RemoteFile destination);
57  
58  	/**
59  	 * Copy the contents of <code>string</code> to <code>destination</code>
60  	 */
61  	CopyResult scpString(String string, RemoteFile destination);
62  
63  	CopyResult scpToDir(String location, RemoteFile directory);
64  
65  	CopyResult scpToDir(File source, RemoteFile directory);
66  
67  	CopyResult scp(RemoteFile source, File destination);
68  
69  	CopyResult scpToDir(RemoteFile source, File directory);
70  
71  	RemoteFile getMetaData(String absolutePath);
72  
73  	boolean exists(String absolutePath);
74  
75  	boolean isDirectory(String absolutePath);
76  
77  	void deleteFile(String absolutePath);
78  
79  	void createDirectory(RemoteFile dir);
80  
81  	RemoteFile getWorkingDirectory();
82  
83  	CopyResult scp(String absolutePath, OutputStream out) throws IOException;
84  
85  	CopyResult scp(RemoteFile source, OutputStream out) throws IOException;
86  
87  	String toString(RemoteFile source);
88  
89  	void close();
90  
91  }