annotate src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java @ 48:6ebe870da138

this version resolve change host problem.
author one
date Tue, 18 Dec 2012 17:56:49 +0900
parents f3b775d3592a
children b0c7fad4c695
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
12c3a73be47f rename package
one
parents: 11
diff changeset
1 package jp.ac.u_ryukyu.treevnc.server;
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import java.awt.event.*;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 import java.io.*;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
5 import java.net.ServerSocket;
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
6 import java.net.Socket;
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
7 import java.net.UnknownHostException;
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
8 import java.util.LinkedList;
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 import java.util.logging.Logger;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
31
872d9bcbfe56 Before changing the Viewer.
one
parents: 28
diff changeset
11 import jp.ac.u_ryukyu.treevnc.AcceptThread;
40
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
12 import jp.ac.u_ryukyu.treevnc.server.state.ChangeHost;
31
872d9bcbfe56 Before changing the Viewer.
one
parents: 28
diff changeset
13
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 import com.glavsoft.exceptions.AuthenticationFailedException;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 import com.glavsoft.exceptions.FatalException;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 import com.glavsoft.exceptions.TransportException;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 import com.glavsoft.exceptions.UnsupportedProtocolVersionException;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 import com.glavsoft.exceptions.UnsupportedSecurityTypeException;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 import com.glavsoft.rfb.IChangeSettingsListener;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 import com.glavsoft.rfb.IRfbSessionListener;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 import com.glavsoft.rfb.protocol.Protocol;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 import com.glavsoft.rfb.protocol.ProtocolSettings;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 import com.glavsoft.transport.Reader;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 import com.glavsoft.transport.Writer;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 import com.glavsoft.viewer.ConnectionManager;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 import com.glavsoft.viewer.Viewer;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 import com.glavsoft.viewer.cli.Parser;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 import com.glavsoft.viewer.swing.ClipboardControllerImpl;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 import com.glavsoft.viewer.swing.ParametersHandler;
16
e654b2e4de64 add TreeTask.java
one
parents: 15
diff changeset
30 import com.glavsoft.viewer.swing.Surface;
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 import com.glavsoft.viewer.swing.UiSettings;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 import com.glavsoft.viewer.swing.ParametersHandler.ConnectionParams;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
34 public class VncProxyService extends Viewer implements Runnable,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
35 IRfbSessionListener, IChangeSettingsListener {
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 /**
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 *
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 */
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 private static final long serialVersionUID = 1L;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
12
12c3a73be47f rename package
one
parents: 11
diff changeset
42 public MyRfbProtoProxy rfb;
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
43 private ConnectionManager connectionManager;
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
44 private ConnectionParams connectionParams;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
45
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
46 boolean isClient = false;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
47 public static final int DEFAULT_PORT = 5900;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
48 public static Logger logger = Logger.getLogger("com.glavsoft");
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
49 private boolean forceReconnection;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
50 private String reconnectionReason;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
51 private final ProtocolSettings settings;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
52 private final UiSettings uiSettings;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
53 private AcceptThread acceptThread;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
54 private GetBroadCastProxy getCast;
40
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
55 public AcceptClient aClient;
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
56 public int opendPort;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
57
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
58 private VncProxyService prevVps;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
59 static VncProxyService currentVps;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
60
13
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
61 // public AcceptClient acc;
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
62
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
63 private void initProxy(Parser parser) {
40
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
64 aClient = new AcceptClient();
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
65 ParametersHandler.completeSettingsFromCLI(parser, connectionParams,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
66 settings, uiSettings);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 showControls = ParametersHandler.showControls;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 logger.info("TightVNC Viewer version " + ver());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 isApplet = false;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
72
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 public VncProxyService() {
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
74 connectionManager = new ConnectionManager(this, isApplet);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 connectionParams = new ParametersHandler.ConnectionParams();
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 settings = ProtocolSettings.getDefaultSettings();
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 uiSettings = super.uiSettings;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
78 connectionParams.hostName = "localhost";
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
80
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
81
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
82 public VncProxyService(VncProxyService vps, String hostName) {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
83 this();
f3b775d3592a create newVps.
one
parents: 46
diff changeset
84 connectionParams.hostName = hostName;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
85 rfb = vps.rfb;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
86 isClient = vps.isClient;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
87 forceReconnection = vps.forceReconnection;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
88 reconnectionReason = vps.reconnectionReason;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
89 acceptThread = vps.acceptThread;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
90 getCast = vps.getCast;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
91 aClient = vps.aClient;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
92 opendPort = vps.opendPort;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
93 prevVps = vps;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
94 }
f3b775d3592a create newVps.
one
parents: 46
diff changeset
95
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 public static void main(String[] argv) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 String[] mainArgs = argv;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 System.out.println(mainArgs.length);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 // input into arguments Decision
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 Parser parser = new Parser();
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 ParametersHandler.completeParserOptions(parser);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 parser.parse(argv);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 if (parser.isSet(ParametersHandler.ARG_HELP)) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 printUsage(parser.optionsUsage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 System.exit(0);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 }
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
109 VncProxyService vps = new VncProxyService();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
110 vps.initProxy1(argv, mainArgs, parser);
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
111 }
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
112
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
113 private void initProxy1(String[] argv, String[] mainArgs,
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
114 Parser parser) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
115 initProxy(parser);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 if (mainArgs.length != 0) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 for (int i = 0; i < argv.length; i++) {
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
118 setArguments(mainArgs);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 // write later
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 } else {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
122 // getHostData();
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 }
48
6ebe870da138 this version resolve change host problem.
one
parents: 47
diff changeset
124 run1();
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
125 createConnectionAndStart();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
126 getChangeScreenRequest(); // Should be used Client Socket.
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
127 try {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
128 threadSetAndStart();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
129 } catch (UnknownHostException e) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
130
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
131 } catch (IOException e) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
132
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
133 }
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
135
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 private void setArguments(String[] mainArgs) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 }
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
138
f3b775d3592a create newVps.
one
parents: 46
diff changeset
139
f3b775d3592a create newVps.
one
parents: 46
diff changeset
140 public boolean run1() {
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141
40
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
142 rfb = new MyRfbProtoProxy();
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
143 // getHostData();
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 if (forceReconnection) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
145 connectionManager.showReconnectDialog("Connection lost",
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
146 reconnectionReason);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 forceReconnection = false;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 tryAgain = true;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 while (tryAgain) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
151 // connectionParams.hostName = arguments[0];
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
152 // workingSocket =
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
153 // connectionManager.connectToTreeHost(connectionParams, settings);
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
154 workingSocket = connectionManager.connectToHost(connectionParams,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
155 settings, rfb);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 if (null == workingSocket) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 closeApp();
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 break;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 logger.info("Connected");
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 try {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 workingSocket.setTcpNoDelay(true); // disable Nagle algorithm
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 Reader reader = new Reader(workingSocket.getInputStream());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 Writer writer = new Writer(workingSocket.getOutputStream());
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
165 // rfb.setStream(reader,writer);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 workingProtocol = new Protocol(reader, writer,
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
167 new PasswordChooser(passwordFromParams,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
168 connectionParams, containerFrame, this),
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 settings);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 workingProtocol.handshake();
27
85958cba5d15 Create new constructor in TreeTask
one
parents: 23
diff changeset
171 rfb.setProtocolContext(workingProtocol);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 // input into change parents
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
173 ClipboardControllerImpl clipboardController = new ClipboardControllerImpl(
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
174 workingProtocol, settings.getRemoteCharsetName());
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
175 clipboardController.setEnabled(settings
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
176 .isAllowClipboardTransfer());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 settings.addListener(clipboardController);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
178 surface = new Surface(workingProtocol, this,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
179 uiSettings.getScaleFactor()); // this method
19
ea83f4be0cc9 remove is and os
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
180 settings.addListener(this);
ea83f4be0cc9 remove is and os
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
181 uiSettings.addListener(surface);
ea83f4be0cc9 remove is and os
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
182 containerFrame = createContainer();
ea83f4be0cc9 remove is and os
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
183 connectionManager.setContainerFrame(containerFrame);
ea83f4be0cc9 remove is and os
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
184 updateFrameTitle();
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
185 containerFrame.dispose();
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
186 containerFrame = null;
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
187 if (prevVps != null) {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
188 prevVps.cleanUpSession();
f3b775d3592a create newVps.
one
parents: 46
diff changeset
189 prevVps = null;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
190 }
f3b775d3592a create newVps.
one
parents: 46
diff changeset
191 currentVps = this;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
192 workingProtocol.startNormalHandling(this, surface,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
193 clipboardController, rfb);
20
98519d16a8c3 getInitData from ProtocolContext
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 19
diff changeset
194 // rfb.setInitData(workingProtocol.getInitData()); too early
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
195 // workingProtocol.startNormalHandling(this, surface,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
196 // clipboardController);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 tryAgain = false;
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 } catch (UnsupportedProtocolVersionException e) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
199 connectionManager.showReconnectDialog(
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
200 "Unsupported Protocol Version", e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 } catch (UnsupportedSecurityTypeException e) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
203 connectionManager.showReconnectDialog(
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
204 "Unsupported Security Type", e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 } catch (AuthenticationFailedException e) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 passwordFromParams = null;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
208 connectionManager.showReconnectDialog("Authentication Failed",
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
209 e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 } catch (TransportException e) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
212 connectionManager.showReconnectDialog("Connection Error",
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
213 "Connection Error" + ": " + e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 } catch (IOException e) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
216 connectionManager.showReconnectDialog("Connection Error",
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
217 "Connection Error" + ": " + e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 } catch (FatalException e) {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
220 connectionManager.showReconnectDialog("Connection Error",
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
221 "Connection Error" + ": " + e.getMessage());
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 logger.severe(e.getMessage());
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 }
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
225 return !tryAgain;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
226 }
f3b775d3592a create newVps.
one
parents: 46
diff changeset
227
f3b775d3592a create newVps.
one
parents: 46
diff changeset
228 private void cleanUpSession() {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
229 if (prevVps != null) {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
230 prevVps.cleanUpSession();
f3b775d3592a create newVps.
one
parents: 46
diff changeset
231 prevVps = null;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
232 }
f3b775d3592a create newVps.
one
parents: 46
diff changeset
233 workingProtocol.cleanUpSession();
13
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
234 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
235
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
236 public void createConnectionAndStart() {
40
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
237 Thread thread;
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
238 opendPort = rfb.selectPort(5999);
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
239 acceptThread = new AcceptThread(rfb, opendPort);
3c072f2f39bb add Screen change function.
one
parents: 38
diff changeset
240 thread = new Thread(acceptThread);
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
241 thread.start();
13
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
242 getCast = new GetBroadCastProxy(this,
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
243 workingProtocol.getRemoteDesktopName(),
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
244 this.connectionParams.hostName);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
245 thread = new Thread(getCast);
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
246 thread.start();
13
406fa09ae645 modify VncProxyService.java
one
parents: 12
diff changeset
247 }
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
249 public void proxyStart(String[] argv) {
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
250 String[] mainArgs = argv;
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
251 System.out.println(mainArgs.length);
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
252 // input into arguments Decision
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
254 Parser parser = new Parser();
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
255 ParametersHandler.completeParserOptions(parser);
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
257 parser.parse(argv);
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
258 if (parser.isSet(ParametersHandler.ARG_HELP)) {
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
259 printUsage(parser.optionsUsage());
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
260 System.exit(0);
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
261 }
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
262 initProxy(parser);
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
263 if (mainArgs.length != 0) {
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
264 for (int i = 0; i < argv.length; i++) {
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
265 setArguments(mainArgs);
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
266 // write later
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
267 }
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
268 } else {
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
269 // getHostData();
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
270 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
271 // SwingUtilities.invokeLater(myClient);
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
272 run();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
273 createConnectionAndStart();
34
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
274 }
f70008073a03 add TreeViewer.java
one
parents: 31
diff changeset
275
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 @Override
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 public void destroy() {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 @Override
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 public void windowClosing(WindowEvent e) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 if (e != null && e.getComponent() != null) {
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 e.getWindow().setVisible(false);
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 }
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 closeApp();
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
288
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
289 private void threadSetAndStart() throws UnknownHostException, IOException {
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
290 CreateThread createThread = new CreateThread(aClient);
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
291 Thread thread = new Thread(createThread);
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
292 thread.start();
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
293 Thread thread2 = new Thread(new ChangeHost(this, forceReconnection));
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
294 thread2.start();
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
295 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
296
37
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
297 public void setConnectionManager(ConnectionManager _connectionManager) {
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
298 connectionManager = _connectionManager;
1454d6fe96c1 add Changehost.java
one
parents: 35
diff changeset
299 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
300
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
301 private void getChangeScreenRequest() {
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
302 Thread th = new Thread(new Runnable() {
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
303 @Override
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
304 public void run() {
46
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
305 while (true) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
306 try {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
307 Socket clientSocket = null;
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
308 ServerSocket echoServer = new ServerSocket(10001);
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
309 while (true) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
310 clientSocket = echoServer.accept();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
311 BufferedReader is = new BufferedReader(
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
312 new InputStreamReader(
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
313 clientSocket.getInputStream()));
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
314 String newHostName = is.readLine();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
315 // String screenSize = is.readLine();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
316 changeVNCServer(newHostName);
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
317 System.out.println("----------success----------");
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
318 clientSocket.close();
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
319 }
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
320 } catch (IOException e) {
d2741b80399e extract method and delete tempWorkingProtocol.
one
parents: 45
diff changeset
321 continue; // log
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
322 }
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
323 }
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
324 }
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
325 });
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
326 th.start();
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
327 }
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
328
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
329 protected void socketClose() {
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
330 try {
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
331 workingSocket.close();
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
332 acceptThread.flag = true;
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
333 getCast.setStopFlag(true);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
334 // createThread.setStopFlag(true);
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
335 } catch (IOException e) {/* nop */
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
336 }
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
337 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
338
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
339 @Override
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
340 public void rfbSessionStopped(final String reason) {
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
341 if (workingSocket != null && workingSocket.isConnected()) {
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
342 try {
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
343 workingSocket.close();
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
344 } catch (IOException e) { /* nop */
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
345 }
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
346 }
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
347 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
348
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
349 private void createSocketAndSend(LinkedList<String> clientList, String port)
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
350 throws UnknownHostException, IOException {
42
fe38611c4b2b change the location of the call cleanUpSession().
one
parents: 40
diff changeset
351 boolean passFlag = false;
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
352 for (String client : clientList) {
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
353 if (passFlag) {
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
354 Socket echoSocket;
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
355 echoSocket = new Socket(client, 10001);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
356 DataOutputStream os = new DataOutputStream(
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
357 echoSocket.getOutputStream());
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
358 os.writeBytes("reconnection\n");
48
6ebe870da138 this version resolve change host problem.
one
parents: 47
diff changeset
359 System.out.println("port ==== " + port);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
360 os.writeBytes(port + "\n");
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
361 os.close();
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
362 }
42
fe38611c4b2b change the location of the call cleanUpSession().
one
parents: 40
diff changeset
363 passFlag = true;
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
364 }
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
365 }
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
366
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
367 public void changeVNCServer(String hostName) throws UnknownHostException,
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
368 IOException {
42
fe38611c4b2b change the location of the call cleanUpSession().
one
parents: 40
diff changeset
369 // sender and reader stop
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
370 VncProxyService newVps = new VncProxyService(this,hostName);
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
371 // run call and change workingProtocol
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
372 newVps.connectionParams.hostName = hostName;
f3b775d3592a create newVps.
one
parents: 46
diff changeset
373 if (newVps.run1()) {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
374 newVps.createConnectionAndStart();
48
6ebe870da138 this version resolve change host problem.
one
parents: 47
diff changeset
375 newVps.createSocketAndSend(aClient.getList(), String.valueOf(newVps.opendPort));
47
f3b775d3592a create newVps.
one
parents: 46
diff changeset
376 } else {
f3b775d3592a create newVps.
one
parents: 46
diff changeset
377 newVps.cleanUpSession();
f3b775d3592a create newVps.
one
parents: 46
diff changeset
378 }
38
c2f0b6907448 add doc directory
one
parents: 37
diff changeset
379 }
45
20326a4b9d88 create new change button for client.
one
parents: 43
diff changeset
380
11
57ae9fbb1245 add files
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 }