mirror of https://github.com/apache/cloudstack.git
Console proxy refactoring incremental check-in - new VNC protocol implementation
This commit is contained in:
parent
1926df31e5
commit
cd13762e44
|
|
@ -3,5 +3,9 @@
|
|||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/console"/>
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
|
||||
package com.cloud.consoleproxy.util;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,12 +11,15 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
<<<<<<< HEAD
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
|
@ -24,12 +28,19 @@ import java.util.List;
|
|||
|
||||
import com.cloud.consoleproxy.util.ImageHelper;
|
||||
import com.cloud.consoleproxy.util.TileInfo;
|
||||
=======
|
||||
import java.awt.image.BufferedImage;
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
/**
|
||||
* A <code>BuffereImageCanvas</code> component represents frame buffer image on the
|
||||
* screen. It also notifies its subscribers when screen is repainted.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
||||
=======
|
||||
public class BufferedImageCanvas extends Canvas {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Offline screen buffer
|
||||
|
|
@ -71,9 +82,14 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||
public void paint(Graphics g) {
|
||||
// Only part of image, requested with repaint(Rectangle), will be
|
||||
// painted on screen.
|
||||
<<<<<<< HEAD
|
||||
synchronized(offlineImage) {
|
||||
g.drawImage(offlineImage, 0, 0, this);
|
||||
}
|
||||
=======
|
||||
g.drawImage(offlineImage, 0, 0, this);
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
// Notify server that update is painted on screen
|
||||
listener.imagePaintedOnScreen();
|
||||
}
|
||||
|
|
@ -85,6 +101,7 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||
public Graphics2D getOfflineGraphics() {
|
||||
return graphics;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void copyTile(Graphics2D g, int x, int y, Rectangle rc) {
|
||||
synchronized(offlineImage) {
|
||||
|
|
@ -147,4 +164,7 @@ public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
|||
}
|
||||
return imgBits;
|
||||
}
|
||||
=======
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public interface FrameBufferUpdateListener {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public interface PaintNotificationListener {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public class SimpleLogger {
|
||||
|
||||
public static void log(String message) {
|
||||
System.out.println(getPrefix(1) + " LOG: " + message);
|
||||
}
|
||||
|
||||
public static void log(int skipFrames, String message) {
|
||||
System.out.println(getPrefix(1+skipFrames) + " LOG: " + message);
|
||||
}
|
||||
|
||||
public static void debug(String message) {
|
||||
System.out.println(getPrefix(1) + " DEBUG: " + message);
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
System.out.println(getPrefix(1) + " INFO: " + message);
|
||||
}
|
||||
|
||||
public static void warn(String message) {
|
||||
System.err.println(getPrefix(1) + " WARN: " + message);
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
System.err.println(getPrefix(1) + " ERROR: " + message);
|
||||
}
|
||||
|
||||
private static String getPrefix(int skipFrames) {
|
||||
StackTraceElement frame;
|
||||
try {
|
||||
throw new RuntimeException();
|
||||
} catch (Exception e) {
|
||||
frame = e.getStackTrace()[1+skipFrames];
|
||||
}
|
||||
|
||||
return "(" + frame.getFileName() + ":" + frame.getLineNumber() + ") " + frame.getMethodName() + "()";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
|
@ -28,6 +31,7 @@ import javax.crypto.SecretKey;
|
|||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
import com.cloud.consoleproxy.util.Logger;
|
||||
import com.cloud.consoleproxy.util.RawHTTP;
|
||||
|
|
@ -36,6 +40,9 @@ import com.cloud.consoleproxy.vnc.packet.client.MouseEventPacket;
|
|||
|
||||
public class VncClient {
|
||||
private static final Logger s_logger = Logger.getLogger(VncClient.class);
|
||||
=======
|
||||
public class VncClient {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
private Socket socket;
|
||||
private DataInputStream is;
|
||||
|
|
@ -45,9 +52,12 @@ public class VncClient {
|
|||
|
||||
private VncClientPacketSender sender;
|
||||
private VncServerPacketReceiver receiver;
|
||||
<<<<<<< HEAD
|
||||
|
||||
private boolean noUI = false;
|
||||
private ConsoleProxyClientListener clientListener = null;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (args.length < 3) {
|
||||
|
|
@ -60,6 +70,7 @@ public class VncClient {
|
|||
String password = args[2];
|
||||
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
new VncClient(host, Integer.parseInt(port), password, false, null);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.error("Incorrect VNC server port number: " + port + ".");
|
||||
|
|
@ -73,11 +84,27 @@ public class VncClient {
|
|||
} catch (Throwable e) {
|
||||
s_logger.error("An error happened: " + e.getMessage());
|
||||
System.exit(1);
|
||||
=======
|
||||
new VncClient(host, Integer.parseInt(port), password);
|
||||
} catch (NumberFormatException e) {
|
||||
SimpleLogger.error("Incorrect VNC server port number: " + port + ".");
|
||||
System.exit(1);
|
||||
} catch (UnknownHostException e) {
|
||||
SimpleLogger.error("Incorrect VNC server host name: " + host + ".");
|
||||
System.exit(1);
|
||||
} catch (IOException e) {
|
||||
SimpleLogger.error("Cannot communicate with VNC server: " + e.getMessage());
|
||||
System.exit(1);
|
||||
} catch (Throwable e) {
|
||||
SimpleLogger.error("An error happened: " + e.getMessage());
|
||||
System.exit(1);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void printHelpMessage() {
|
||||
<<<<<<< HEAD
|
||||
/* LOG */s_logger.info("Usage: HOST PORT PASSWORD.");
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +174,44 @@ public class VncClient {
|
|||
}
|
||||
|
||||
private void doConnect(String password) throws IOException {
|
||||
=======
|
||||
/* LOG */SimpleLogger.info("Usage: HOST PORT PASSWORD.");
|
||||
}
|
||||
|
||||
public VncClient(String host, int port, String password) throws UnknownHostException, IOException {
|
||||
connectTo(host, port, password);
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
sender.closeConnection();
|
||||
receiver.closeConnection();
|
||||
|
||||
try {
|
||||
is.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
try {
|
||||
os.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void connectTo(String host, int port, String password) throws UnknownHostException, IOException {
|
||||
// If port number is too small, then interpret it as display number.
|
||||
if (port < 100)
|
||||
port += 5900;
|
||||
|
||||
// Connect to server
|
||||
SimpleLogger.info("Connecting to VNC server " + host + ":" + port + "...");
|
||||
this.socket = new Socket(host, port);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
is = new DataInputStream(socket.getInputStream());
|
||||
os = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
|
|
@ -166,13 +231,18 @@ public class VncClient {
|
|||
canvas.addMouseMotionListener(sender);
|
||||
canvas.addKeyListener(sender);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Frame frame = null;
|
||||
if(!noUI)
|
||||
frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
||||
=======
|
||||
Frame frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
new Thread(sender).start();
|
||||
|
||||
// Run server-to-client packet receiver
|
||||
<<<<<<< HEAD
|
||||
receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender, clientListener);
|
||||
try {
|
||||
receiver.run();
|
||||
|
|
@ -183,6 +253,17 @@ public class VncClient {
|
|||
}
|
||||
this.shutdown();
|
||||
}
|
||||
=======
|
||||
receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender);
|
||||
try {
|
||||
receiver.run();
|
||||
} finally {
|
||||
frame.setVisible(false);
|
||||
frame.dispose();
|
||||
this.shutdown();
|
||||
}
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
|
||||
|
|
@ -371,8 +452,11 @@ public class VncClient {
|
|||
int framebufferWidth = is.readUnsignedShort();
|
||||
int framebufferHeight = is.readUnsignedShort();
|
||||
screen.setFramebufferSize(framebufferWidth, framebufferHeight);
|
||||
<<<<<<< HEAD
|
||||
if(clientListener != null)
|
||||
clientListener.onFramebufferSizeChange(framebufferWidth, framebufferHeight);
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
// Read pixel format
|
||||
|
|
@ -406,6 +490,7 @@ public class VncClient {
|
|||
screen.setDesktopName(desktopName);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public FrameBufferCanvas getFrameBufferCanvas() {
|
||||
if(receiver != null)
|
||||
|
|
@ -432,4 +517,7 @@ public class VncClient {
|
|||
public boolean isHostConnected() {
|
||||
return receiver != null && receiver.isConnectionAlive();
|
||||
}
|
||||
=======
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
|
@ -52,10 +55,13 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
|
|||
sendSetEncodings();
|
||||
requestFullScreenUpdate();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void sendClientPacket(ClientPacket packet) {
|
||||
queue.add(packet);
|
||||
}
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -10,6 +11,8 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
|
|
@ -17,13 +20,19 @@ import java.awt.datatransfer.StringSelection;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
import com.cloud.consoleproxy.util.Logger;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
import com.cloud.consoleproxy.vnc.packet.server.FramebufferUpdatePacket;
|
||||
import com.cloud.consoleproxy.vnc.packet.server.ServerCutText;
|
||||
|
||||
public class VncServerPacketReceiver implements Runnable {
|
||||
<<<<<<< HEAD
|
||||
private static final Logger s_logger = Logger.getLogger(VncServerPacketReceiver.class);
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
private final VncScreenDescription screen;
|
||||
private BufferedImageCanvas canvas;
|
||||
|
|
@ -32,20 +41,29 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
private boolean connectionAlive = true;
|
||||
private VncClient vncConnection;
|
||||
private final FrameBufferUpdateListener fburListener;
|
||||
<<<<<<< HEAD
|
||||
private final ConsoleProxyClientListener clientListener;
|
||||
|
||||
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
|
||||
FrameBufferUpdateListener fburListener, ConsoleProxyClientListener clientListener) {
|
||||
=======
|
||||
|
||||
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
|
||||
FrameBufferUpdateListener fburListener) {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
this.screen = screen;
|
||||
this.canvas = canvas;
|
||||
this.is = is;
|
||||
this.vncConnection = vncConnection;
|
||||
this.fburListener = fburListener;
|
||||
<<<<<<< HEAD
|
||||
this.clientListener = clientListener;
|
||||
}
|
||||
|
||||
public BufferedImageCanvas getCanvas() {
|
||||
return canvas;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -64,7 +82,11 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
// so it can send another frame buffer update request
|
||||
fburListener.frameBufferPacketReceived();
|
||||
// Handle frame buffer update
|
||||
<<<<<<< HEAD
|
||||
new FramebufferUpdatePacket(canvas, screen, is, clientListener);
|
||||
=======
|
||||
new FramebufferUpdatePacket(canvas, screen, is);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -81,9 +103,15 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
default:
|
||||
throw new RuntimeException("Unknown server packet type: " + messageType + ".");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
=======
|
||||
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
if (connectionAlive) {
|
||||
closeConnection();
|
||||
vncConnection.shutdown();
|
||||
|
|
@ -94,10 +122,13 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
public void closeConnection() {
|
||||
connectionAlive = false;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public boolean isConnectionAlive() {
|
||||
return connectionAlive;
|
||||
}
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
/**
|
||||
* Handle server bell packet.
|
||||
|
|
@ -114,6 +145,10 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
StringSelection contents = new StringSelection(clipboardContent.getContent());
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
|
||||
|
||||
<<<<<<< HEAD
|
||||
s_logger.info("Server clipboard buffer: "+clipboardContent.getContent());
|
||||
=======
|
||||
SimpleLogger.info("Server clipboard buffer: "+clipboardContent.getContent());
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ package com.cloud.consoleproxy.vnc.packet.server;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
import com.cloud.consoleproxy.vnc.BufferedImageCanvas;
|
||||
import com.cloud.consoleproxy.vnc.RfbConstants;
|
||||
import com.cloud.consoleproxy.vnc.VncScreenDescription;
|
||||
|
|
|
|||
|
|
@ -653,35 +653,6 @@ public class Upgrade2214to30 implements DbUpgrade {
|
|||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
int numRows = 0;
|
||||
pstmt = conn.prepareStatement("select count(id) from `cloud`.`vm_instance` where removed is null");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next()){
|
||||
numRows = rs.getInt(1);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
int offset = 0;
|
||||
while(offset < numRows){
|
||||
pstmt = conn.prepareStatement("select id, vnc_password from `cloud`.`vm_instance` where removed is null limit "+offset+", 500");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
long id = rs.getLong(1);
|
||||
String value = rs.getString(2);
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
String encryptedValue = DBEncryptionUtil.encrypt(value);
|
||||
pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vnc_password=? where id=?");
|
||||
pstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
|
||||
pstmt.setLong(2, id);
|
||||
pstmt.executeUpdate();
|
||||
pstmt.close();
|
||||
}
|
||||
rs.close();
|
||||
offset+=500;
|
||||
=======
|
||||
pstmt = conn.prepareStatement("select id, vnc_password from `cloud`.`vm_instance`");
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
|
|
@ -695,7 +666,6 @@ public class Upgrade2214to30 implements DbUpgrade {
|
|||
pstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
|
||||
pstmt.setLong(2, id);
|
||||
pstmt.executeUpdate();
|
||||
>>>>>>> 2eaefc4... Fixed unittest and some issues with 2.2.14-3.0 upgrade
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Unable encrypt vm_instance vnc_password ", e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue