From ea9f9848a6e7a68dc90decc2e38bd3e1081ebf8a Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 2 Mar 2015 13:22:44 +0100 Subject: ThriftManager class: use getSatClient() and getMasterClient() to get the singleton instances of the thrift clients to satellite and master servers DO NOT CREATE NEW THRIFT OBJECTS!!! --- .../java/gui/image/FTPSearchDownloader_GUI.java | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java') diff --git a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java index 823d8894..0cb63429 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPSearchDownloader_GUI.java @@ -42,10 +42,9 @@ import models.person; import org.apache.log4j.Logger; import org.apache.thrift.TException; -import org.openslx.sat.thrift.iface.Server.Client; import org.openslx.sat.thrift.iface.User; -import thrift.ThriftConnection; +import thrift.ThriftManager; import util.OpenLinks; import config.Config; import ftp.DownloadTask; @@ -81,8 +80,6 @@ public class FTPSearchDownloader_GUI extends JFrame implements long bytesread; JLabel lblZeit; boolean taskrun = false; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); JButton btnZurck = new JButton("Zurück"); JButton btnDownloadStarten = new JButton("Download starten"); JButton btnMainMenu = new JButton("Hauptmenü"); @@ -122,16 +119,15 @@ public class FTPSearchDownloader_GUI extends JFrame implements if (choice == 0) { try { - client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); + ThriftManager.getSatClient().DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); try { - client.setSessionInvalid(SessionData.session.getAuthToken()); + ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken()); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } - con.closeThriftConnection(); try { - client.setSessionInvalid(SessionData.session.getAuthToken()); + ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken()); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -147,7 +143,7 @@ public class FTPSearchDownloader_GUI extends JFrame implements } else { // no download running, close window try { - client.setSessionInvalid(SessionData.session.getAuthToken()); + ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken()); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -432,7 +428,7 @@ public class FTPSearchDownloader_GUI extends JFrame implements isAborted = true; // set flag try { - client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); + ThriftManager.getSatClient().DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); LOGGER.info("Deleted FTP user."); } catch (TException e1) { // TODO Auto-generated catch block @@ -472,7 +468,7 @@ public class FTPSearchDownloader_GUI extends JFrame implements if (choice == 0) { task.cancel(true); try { - client.DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); + ThriftManager.getSatClient().DeleteFtpUser(user.userName,SessionData.session.getAuthToken()); } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); @@ -534,11 +530,11 @@ public class FTPSearchDownloader_GUI extends JFrame implements // Klick btnDownloadStarten.setText("Bitte warten"); try { - user = client.getFtpUser(SessionData.session.getAuthToken()); + user = ThriftManager.getSatClient().getFtpUser(SessionData.session.getAuthToken()); downloadFile = user.path + "/" - + client.getPathOfImage(Image.image.getImageId(), + + ThriftManager.getSatClient().getPathOfImage(Image.image.getImageId(), Image.image.getVersion(),SessionData.session.getAuthToken()); } catch (TException e) { -- cgit v1.2.3-55-g7522