annotate src/com/five_ten_sg/connectbot/transport/AbsTransport.java @ 97:586b2eedb0d5

Added tag stable-1.8.0 for changeset 5e52fa030308
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jun 2014 18:02:30 -0700
parents 33eb63352be5
children 9204fe526e65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
1 /*
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
2 * ConnectBot: simple, powerful, open-source SSH client for Android
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
3 * Copyright 2007 Kenny Root, Jeffrey Sharkey
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
4 *
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
5 * Licensed under the Apache License, Version 2.0 (the "License");
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
6 * you may not use this file except in compliance with the License.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
7 * You may obtain a copy of the License at
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
8 *
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
9 * http://www.apache.org/licenses/LICENSE-2.0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
10 *
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
11 * Unless required by applicable law or agreed to in writing, software
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
12 * distributed under the License is distributed on an "AS IS" BASIS,
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
14 * See the License for the specific language governing permissions and
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
15 * limitations under the License.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
16 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
17
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
18 package com.five_ten_sg.connectbot.transport;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
19
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
20 import java.io.IOException;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
21 import java.util.List;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
22 import java.util.Map;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
23
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
24 import com.five_ten_sg.connectbot.bean.HostBean;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
25 import com.five_ten_sg.connectbot.bean.PortForwardBean;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
26 import com.five_ten_sg.connectbot.service.TerminalBridge;
29
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
27 import com.five_ten_sg.connectbot.service.TerminalKeyListener;
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
28 import com.five_ten_sg.connectbot.service.TerminalManager;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
29 import android.content.Context;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
30 import android.net.Uri;
43
6b0f1ece1d91 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
31 import android.util.Log;
29
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
32 import de.mud.terminal.vt320;
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
33
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
34 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
35 * @author Kenny Root
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
36 *
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
37 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
38 public abstract class AbsTransport {
44
959ebe0247b5 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
39 protected String TAG;
959ebe0247b5 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
40 protected TerminalManager manager;
959ebe0247b5 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
41 protected TerminalBridge bridge;
91
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
42 protected String homeDirectory;
44
959ebe0247b5 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
43 protected HostBean host;
45
80dcebe51af2 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 44
diff changeset
44 protected vt320 buffer = null;
44
959ebe0247b5 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 43
diff changeset
45 protected String emulation;
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
46
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
47 class vt320Default extends vt320 {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
48 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
49 public void debug(String s) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
50 Log.d(TAG, s);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
51 }
69
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
52
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
53 // terminal key listener sending to the host
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
54 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
55 public void write(byte[] b) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
56 try {
43
6b0f1ece1d91 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
57 if (bridge.monitor != null) bridge.monitor.hostData(b);
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
58
43
6b0f1ece1d91 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
59 AbsTransport.this.write(b);
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
60 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
61 catch (IOException e) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
62 Log.e(TAG, "Problem writing outgoing data in vt320() thread", e);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
63 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
64 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
65 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
66 public void write(int b) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
67 try {
43
6b0f1ece1d91 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
68 if (bridge.monitor != null) bridge.monitor.hostData(b);
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
69
43
6b0f1ece1d91 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 42
diff changeset
70 AbsTransport.this.write(b);
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
71 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
72 catch (IOException e) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
73 Log.e(TAG, "Problem writing outgoing data in vt320() thread", e);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
74 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
75 }
69
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
76
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
77 // We don't use telnet sequences.
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
78 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
79 public void sendTelnetCommand(byte cmd) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
80 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
81 // We don't want remote to resize our window.
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
82 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
83 public void setWindowSize(int c, int r) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
84 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
85 // play beep noise
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
86 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
87 public void beep() {
47
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
88 if ((bridge.parent != null) && (bridge.parent.isShown()))
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
89 manager.playBeep();
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
90 else
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
91 manager.sendActivityNotification(host);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
92 }
69
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
93
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
94 // test for changed screen contents
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
95 @Override
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
96 public void testChanged() {
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
97 if (bridge.monitor != null) bridge.monitor.testChanged();
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
98 }
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
99 // relay socket writing to the screen
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
100 // bridge.monitor placement of new characters
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
101 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
102 public void putChar(int c, int l, char ch, int attributes) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
103 if (bridge.monitor != null) bridge.monitor.screenChanged(l, c);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
104
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
105 super.putChar(c, l, ch, attributes);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
106 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
107 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
108 public void insertChar(int c, int l, char ch, int attributes) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
109 if (bridge.monitor != null) bridge.monitor.screenChanged(l, l, c, width - 1);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
110
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
111 super.insertChar(c, l, ch, attributes);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
112 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
113 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
114 public void insertLine(int l, int n, boolean scrollDown) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
115 if (bridge.monitor != null) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
116 if (scrollDown) bridge.monitor.screenChanged(l, height - 1, 0, width - 1);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
117 else bridge.monitor.screenChanged(0, l, 0, width - 1);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
118 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
119
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
120 super.insertLine(l, n, scrollDown);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
121 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
122 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
123 public void deleteLine(int l) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
124 if (bridge.monitor != null) bridge.monitor.screenChanged(l, height - 1, 0, width - 1);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
125
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
126 super.deleteLine(l);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
127 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
128 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
129 public void deleteChar(int c, int l) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
130 if (bridge.monitor != null) bridge.monitor.screenChanged(l, l, c, width - 1);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
131
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
132 super.deleteChar(c, l);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
133 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
134 @Override
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
135 public void setCursorPosition(int c, int l) {
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
136 if (bridge.monitor != null) bridge.monitor.cursorMove(l, c);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
137
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
138 super.setCursorPosition(c, l);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
139 }
69
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
140
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
141 // monitor setField()
294435151b0c use 5250 encryption config entry
Carl Byington <carl@five-ten-sg.com>
parents: 47
diff changeset
142
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
143 };
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
144
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
145
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
146 public AbsTransport() {}
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
147
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
148 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
149 * @return protocol part of the URI
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
150 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
151 public static String getProtocolName() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
152 return "unknown";
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
153 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
154
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
155 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
156 * Encode the current transport into a URI that can be passed via intent calls.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
157 * @return URI to host
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
158 */
11
f3b3bbd227b8 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents: 0
diff changeset
159 public abstract Uri getUri(String input);
f3b3bbd227b8 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents: 0
diff changeset
160
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
161
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
162 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
163 * Causes transport to connect to the target host. After connecting but before a
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
164 * session is started, must call back to {@link TerminalBridge#onConnected()}.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
165 * After that call a session may be opened.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
166 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
167 public abstract void connect();
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
168
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
169 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
170 * Checks if read() will block. If there are no bytes remaining in
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
171 * the underlying transport, return true.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
172 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
173 public abstract boolean willBlock();
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
174
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
175 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
176 * Reads from the transport. Transport must support reading into a byte array
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
177 * <code>buffer</code> at the start of <code>offset</code> and a maximum of
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
178 * <code>length</code> bytes. If the remote host disconnects, throw an
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
179 * {@link IOException}.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
180 * @param buffer byte buffer to store read bytes into
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
181 * @param offset where to start writing in the buffer
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
182 * @param length maximum number of bytes to read
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
183 * @return number of bytes read
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
184 * @throws IOException when remote host disconnects
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
185 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
186 public abstract int read(byte[] buffer, int offset, int length) throws IOException;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
187
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
188 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
189 * Writes to the transport. If the host is not yet connected, simply return without
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
190 * doing anything. An {@link IOException} should be thrown if there is an error after
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
191 * connection.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
192 * @param buffer bytes to write to transport
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
193 * @throws IOException when there is a problem writing after connection
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
194 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
195 public abstract void write(byte[] buffer) throws IOException;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
196
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
197 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
198 * Writes to the transport. See {@link #write(byte[])} for behavior details.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
199 * @param c character to write to the transport
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
200 * @throws IOException when there is a problem writing after connection
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
201 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
202 public abstract void write(int c) throws IOException;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
203
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
204 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
205 * Flushes the write commands to the transport.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
206 * @throws IOException when there is a problem writing after connection
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
207 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
208 public abstract void flush() throws IOException;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
209
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
210 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
211 * Closes the connection to the terminal. Note that the resulting failure to read
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
212 * should call {@link TerminalBridge#dispatchDisconnect(boolean)}.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
213 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
214 public abstract void close();
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
215
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
216 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
217 * Tells the transport what dimensions the display is currently
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
218 * @param columns columns of text
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
219 * @param rows rows of text
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
220 * @param width width in pixels
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
221 * @param height height in pixels
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
222 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
223 public abstract void setDimensions(int columns, int rows, int width, int height);
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
224
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
225 public void setOptions(Map<String, String> options) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
226 // do nothing
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
227 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
228
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
229 public Map<String, String> getOptions() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
230 return null;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
231 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
232
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
233 public void setCompression(boolean compression) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
234 // do nothing
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
235 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
236
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
237 public void setHttpproxy(String httpproxy) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
238 // do nothing
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
239 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
240
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
241 public void setUseAuthAgent(String useAuthAgent) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
242 // do nothing
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
243 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
244
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
245 public String getEmulation() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
246 return emulation;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
247 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
248
47
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
249 protected vt320 setupTransportBuffer() {
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
250 int scrollback = (host.getWantSession()) ? manager.getScrollback() : 0;
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
251 buffer.setBufferSize(scrollback);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
252 buffer.setDisplay(bridge);
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
253 return buffer;
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
254 }
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
255
47
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
256 public vt320 getTransportBuffer() {
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
257 buffer = new vt320Default();
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
258 return setupTransportBuffer();
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
259 }
a3fd10a8c0de start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 45
diff changeset
260
91
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
261 public void setLinks(TerminalManager manager, TerminalBridge bridge, String homeDirectory, HostBean host, String emulation) {
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
262 this.manager = manager;
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
263 this.bridge = bridge;
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
264 this.homeDirectory = homeDirectory;
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
265 this.host = host;
33eb63352be5 remove 5250 configuration
Carl Byington <carl@five-ten-sg.com>
parents: 69
diff changeset
266 this.emulation = emulation;
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
267 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
268
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
269 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
270 * Whether or not this transport type can forward ports.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
271 * @return true on ability to forward ports
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
272 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
273 public boolean canForwardPorts() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
274 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
275 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
276
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
277 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
278 * Adds the {@link PortForwardBean} to the list.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
279 * @param portForward the port forward bean to add
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
280 * @return true on successful addition
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
281 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
282 public boolean addPortForward(PortForwardBean portForward) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
283 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
284 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
285
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
286 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
287 * Enables a port forward member. After calling this method, the port forward should
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
288 * be operational iff it could be enabled by the transport.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
289 * @param portForward member of our current port forwards list to enable
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
290 * @return true on successful port forward setup
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
291 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
292 public boolean enablePortForward(PortForwardBean portForward) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
293 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
294 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
295
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
296 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
297 * Disables a port forward member. After calling this method, the port forward should
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
298 * be non-functioning iff it could be disabled by the transport.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
299 * @param portForward member of our current port forwards list to enable
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
300 * @return true on successful port forward tear-down
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
301 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
302 public boolean disablePortForward(PortForwardBean portForward) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
303 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
304 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
305
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
306 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
307 * Removes the {@link PortForwardBean} from the available port forwards.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
308 * @param portForward the port forward bean to remove
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
309 * @return true on successful removal
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
310 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
311 public boolean removePortForward(PortForwardBean portForward) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
312 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
313 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
314
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
315 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
316 * Gets a list of the {@link PortForwardBean} currently used by this transport.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
317 * @return the list of port forwards
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
318 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
319 public List<PortForwardBean> getPortForwards() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
320 return null;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
321 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
322
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
323 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
324 * Whether or not this transport type can transfer files.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
325 * @return true on ability to transfer files
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
326 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
327 public boolean canTransferFiles() {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
328 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
329 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
330
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
331 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
332 * Downloads the specified remote file to a local folder.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
333 * @param remoteFile The path to the remote file to be downloaded. Must be non-null.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
334 * @param localFolder The path to local folder. Null = default external storage folder.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
335 * @return true on success, false on failure
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
336 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
337 public boolean downloadFile(String remoteFile, String localFolder) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
338 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
339 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
340
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
341 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
342 * Uploads the specified local file to the remote host.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
343 * @param localFile The path to the local file to be uploaded. Must be non-null.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
344 * @param remoteFolder The path to the remote directory. Null == default remote directory.
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
345 * @return true on success, false on failure
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
346 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
347 public boolean uploadFile(String localFile, String remoteFile,
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
348 String remoteFolder, String mode) {
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
349 return false;
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
350 }
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
351
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
352
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
353 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
354 * @return int default port for protocol
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
355 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
356 public abstract int getDefaultPort();
31
139394237973 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 30
diff changeset
357 public abstract boolean isConnected();
139394237973 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 30
diff changeset
358 public abstract boolean isSessionOpen();
139394237973 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 30
diff changeset
359 public abstract boolean isAuthenticated();
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
360
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
361 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
362 * @param username
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
363 * @param hostname
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
364 * @param port
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
365 * @return
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
366 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
367 public abstract String getDefaultNickname(String username, String hostname, int port);
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
368
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
369 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
370 * @param uri
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
371 * @param selectionKeys
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
372 * @param selectionValues
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
373 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
374 public abstract void getSelectionArgs(Uri uri, Map<String, String> selection);
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
375
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
376 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
377 * @param uri
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
378 * @return
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
379 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
380 public abstract HostBean createHost(Uri uri);
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
381
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
382 /**
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
383 * @param context context containing the correct resources
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
384 * @return string that hints at the format for connection
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
385 */
11
f3b3bbd227b8 adding tn5250 files
Carl Byington <carl@five-ten-sg.com>
parents: 0
diff changeset
386 public abstract String getFormatHint(Context context);
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
387
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
388 /**
29
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
389 * @return do we use the network
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
390 */
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
391 public abstract boolean usesNetwork();
29
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
392
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
393 /**
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
394 * @return do we need a relay object to read from the transport
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
395 * and send the data into the vt320 buffer
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
396 */
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
397 public boolean needsRelay() {
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
398 return true;
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
399 }
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
400
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
401 /**
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
402 * @return a key listener
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
403 */
31
139394237973 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 30
diff changeset
404 public TerminalKeyListener getTerminalKeyListener() {
42
7ac846a07ed4 start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 31
diff changeset
405 return new TerminalKeyListener(manager, bridge, buffer, host.getEncoding());
29
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
406 }
017eeed8332c start tn5250 integration
Carl Byington <carl@five-ten-sg.com>
parents: 11
diff changeset
407
0
0ce5cc452d02 initial version
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
408 }