diff options
author | unknown | 2014-05-08 12:46:57 +0200 |
---|---|---|
committer | unknown | 2014-05-08 12:46:57 +0200 |
commit | c6b8f14dd17839b78c753999f2f73b7dfdc8d745 (patch) | |
tree | 60eca56f67a56aa901638ccaccd11b43a453a554 /Dozentenmodul | |
parent | Minimale Änderungen für Move-Vorgang (diff) | |
download | tutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.tar.gz tutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.tar.xz tutor-module-c6b8f14dd17839b78c753999f2f73b7dfdc8d745.zip |
-Kopieren von Temp zu Prod inkl. änderung des Pfades in SQL-DB
-Dateigröße zur DB hinzugefügt
Diffstat (limited to 'Dozentenmodul')
21 files changed, 30 insertions, 85 deletions
diff --git a/Dozentenmodul/bin/Models/Image.class b/Dozentenmodul/bin/Models/Image.class Binary files differindex 92835598..59b34fab 100644 --- a/Dozentenmodul/bin/Models/Image.class +++ b/Dozentenmodul/bin/Models/Image.class diff --git a/Dozentenmodul/bin/ftp/FTPUtility.class b/Dozentenmodul/bin/ftp/FTPUtility.class Binary files differindex 8484d422..95655233 100644 --- a/Dozentenmodul/bin/ftp/FTPUtility.class +++ b/Dozentenmodul/bin/ftp/FTPUtility.class diff --git a/Dozentenmodul/bin/ftp/UploadTask.class b/Dozentenmodul/bin/ftp/UploadTask.class Binary files differindex 32bd6720..2b62ba67 100644 --- a/Dozentenmodul/bin/ftp/UploadTask.class +++ b/Dozentenmodul/bin/ftp/UploadTask.class diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class Binary files differindex 7cf9cff2..8c258693 100644 --- a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class +++ b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$6.class diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class Binary files differindex be81b8f2..e1337eb4 100644 --- a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class +++ b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$7.class diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class Binary files differdeleted file mode 100644 index ac3c1459..00000000 --- a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI$8.class +++ /dev/null diff --git a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class Binary files differindex 3844526a..d188a795 100644 --- a/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class +++ b/Dozentenmodul/bin/gui/image/FTPCreateUploader_GUI.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$1.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$1.class Binary files differindex a25d7157..5df62ad7 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$1.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$1.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$2.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$2.class Binary files differindex 55d72ee9..4a933e6e 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$2.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$2.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$3.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$3.class Binary files differindex 23f71ee1..b790203f 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$3.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$3.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$4.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$4.class Binary files differindex dfb69143..44bbface 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$4.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$4.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$5.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$5.class Binary files differindex 87c0067c..cadf961a 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$5.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$5.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$6.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$6.class Binary files differindex 563e41cb..9977588b 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$6.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI$6.class diff --git a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class Binary files differindex 5f49649b..2d0dc8a7 100644 --- a/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class +++ b/Dozentenmodul/bin/gui/image/FTPEditUploader_GUI.class diff --git a/Dozentenmodul/bin/models/Image.class b/Dozentenmodul/bin/models/Image.class Binary files differindex 92835598..59b34fab 100644 --- a/Dozentenmodul/bin/models/Image.class +++ b/Dozentenmodul/bin/models/Image.class diff --git a/Dozentenmodul/src/Models/Image.java b/Dozentenmodul/src/Models/Image.java index 33a9a558..0b3c936e 100644 --- a/Dozentenmodul/src/Models/Image.java +++ b/Dozentenmodul/src/Models/Image.java @@ -11,6 +11,7 @@ public class Image { private boolean internet; private int ram; private int cpu; + private long filesize; public static Image image =new Image(); @@ -69,4 +70,11 @@ public class Image { public void setVersion(String version) { this.version = version; } + public long getFilesize() { + return filesize; + } + public void setFilesize(long filesize) { + this.filesize = filesize; + } + } diff --git a/Dozentenmodul/src/ftp/FTPUtility.java b/Dozentenmodul/src/ftp/FTPUtility.java index b4543349..f2c51dfc 100644 --- a/Dozentenmodul/src/ftp/FTPUtility.java +++ b/Dozentenmodul/src/ftp/FTPUtility.java @@ -196,44 +196,6 @@ public class FTPUtility { return outputStream; } - public String[] getAllRohling(String SearchString) throws SocketException - { - //FTPClient ftp=new FTPClient(); - - String[] filenamelist; - - - try { - - - ftpClient.changeWorkingDirectory("/home/openslx/images"); - filenamelist=ftpClient.listNames(); - - String[] search=new String[filenamelist.length]; - for(int i=0;i<filenamelist.length;i++) - { - /*if(filenamelist[i].startsWith(SearchString)==true) - { - search[i]=filenamelist[i]; - }*/ - - if(filenamelist[i].contains(SearchString)==true) - { - search[i]=filenamelist[i]; - } - } - return search; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - JOptionPane.showMessageDialog(null, - e.getCause()+"\n"+e.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - - - - return null; - } + }
\ No newline at end of file diff --git a/Dozentenmodul/src/ftp/UploadTask.java b/Dozentenmodul/src/ftp/UploadTask.java index 788acad6..2dbeff8d 100644 --- a/Dozentenmodul/src/ftp/UploadTask.java +++ b/Dozentenmodul/src/ftp/UploadTask.java @@ -5,6 +5,8 @@ import java.io.FileInputStream; import javax.swing.JOptionPane; import javax.swing.SwingWorker; + +import models.Image; /** * Executes the file upload in a background thread and updates progress to @@ -50,6 +52,7 @@ public class UploadTask extends SwingWorker<Void, Void> { long totalBytesRead = 0; int percentCompleted = 0; long fileSize = uploadFile.length(); + Image.image.setFilesize(fileSize); long start=System.nanoTime(); final double NANOS_PER_SECOND = 1000000000.0; final double BYTES_PER_MIB = 1024*1024; diff --git a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java index 5ebc5766..2b432c96 100644 --- a/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPCreateUploader_GUI.java @@ -295,28 +295,6 @@ public class FTPCreateUploader_GUI extends JFrame implements separator_1.setBounds(0, 627, 597, 2); contentPanel.add(separator_1); - JButton btnCopyFileTo = new JButton("Copy File to Prod"); - btnCopyFileTo.setEnabled(false); - btnCopyFileTo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - try { - System.out.println("Copying file to " + user.path + "/" - + uploadFile.getName()); - client.startFileCopy(user.path + "/" + uploadFile.getName()); - } catch (TException e1) { - // TODO Auto-generated catch block - System.out.println("Failed to copy to: " + user.path + "/" - + uploadFile.getName()); - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - }); - btnCopyFileTo.setBounds(102, 375, 173, 23); - contentPanel.add(btnCopyFileTo); - JLabel lblSchritt_1 = new JLabel("Schritt 1:"); lblSchritt_1.setBounds(24, 128, 57, 14); contentPanel.add(lblSchritt_1); @@ -416,7 +394,7 @@ public class FTPCreateUploader_GUI extends JFrame implements + person.verantwortlicher.getUsername() + "_" + Image.image.getImagename() + ".vmdk"); task = new UploadTask(host, port, user.userName, user.password, - user.path, uploadFile); + user.path+"temp/", uploadFile); task.addPropertyChangeListener(this); task.execute(); @@ -442,8 +420,10 @@ public class FTPCreateUploader_GUI extends JFrame implements // Fertigstellen erlauben wenn upload abgeschlossen if (progress == 100) { finishButton.setEnabled(true); + } else { finishButton.setEnabled(false); + } } @@ -489,7 +469,7 @@ public class FTPCreateUploader_GUI extends JFrame implements public boolean writeData() { try { - + client.writeVLdata(Image.image.getImagename(), person.verantwortlicher.getUsername(), person.verantwortlicher.getVorname(), @@ -500,7 +480,8 @@ public class FTPCreateUploader_GUI extends JFrame implements person.verantwortlicher.getFakultät(), Image.image.isLicensed(), Image.image.isInternet(), Image.image.getRam(), Image.image.getCpu(), - "/srv/openslx/nfs/temp/" + Image.image.getNewName()); + "temp/" + Image.image.getNewName(),false,Image.image.getFilesize()); + client.startFileCopy(Image.image.getNewName()); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java b/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java index ebeec090..639ca554 100644 --- a/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java +++ b/Dozentenmodul/src/gui/image/FTPEditUploader_GUI.java @@ -71,7 +71,6 @@ public class FTPEditUploader_GUI extends JFrame implements Client client = thrift.getThriftConnection(); JButton btnUploadStarten = new JButton("Upload auf Server starten"); JButton btnSpeicherortAuswhlen = new JButton("Image ausw\u00E4hlen"); - JButton btnCopyFileTo = new JButton("Copy File to Prod"); JButton finishButton = new JButton("Fertigstellen"); JButton btnZurck = new JButton("Zur\u00FCck"); @@ -285,23 +284,6 @@ public class FTPEditUploader_GUI extends JFrame implements separator_1.setBounds(0, 627, 597, 2); contentPanel.add(separator_1); - btnCopyFileTo.setEnabled(false); - btnCopyFileTo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - try { - client.startFileCopy(user.path + "/" + uploadFile.getName()); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getMessage(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); - } - } - }); - btnCopyFileTo.setBounds(102, 375, 173, 23); - contentPanel.add(btnCopyFileTo); - JLabel lblSchritt_1 = new JLabel("Schritt 1:"); lblSchritt_1.setBounds(24, 128, 57, 14); contentPanel.add(lblSchritt_1); @@ -398,7 +380,7 @@ public class FTPEditUploader_GUI extends JFrame implements + person.verantwortlicher.getUsername() + "_" + Image.image.getImagename()+ ".vmdk"); task = new UploadTask(host, port, user.userName, user.password, - user.path, uploadFile); + user.path+"temp/", uploadFile); task.addPropertyChangeListener(this); task.execute(); @@ -472,10 +454,11 @@ public class FTPEditUploader_GUI extends JFrame implements System.out.println("NewName="+Image.image.getNewName()); System.out.println("OldName="+Image.image.getImagename()); client.updateImageData(Image.image.getImagename(), - Image.image.getImagename(),"/srv/openslx/nfs/temp/" + Image.image.getNewName(), Image.image.isLicensed(), + Image.image.getImagename(),"temp/" + Image.image.getNewName(), Image.image.isLicensed(), Image.image.isInternet(), Image.image.getRam(), Image.image.getCpu(), Image.image.getImageId(), - Image.image.getVersion()); + Image.image.getVersion(), false,Image.image.getFilesize()); + client.startFileCopy(Image.image.getNewName()); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/Dozentenmodul/src/models/Image.java b/Dozentenmodul/src/models/Image.java index 33a9a558..0b3c936e 100644 --- a/Dozentenmodul/src/models/Image.java +++ b/Dozentenmodul/src/models/Image.java @@ -11,6 +11,7 @@ public class Image { private boolean internet; private int ram; private int cpu; + private long filesize; public static Image image =new Image(); @@ -69,4 +70,11 @@ public class Image { public void setVersion(String version) { this.version = version; } + public long getFilesize() { + return filesize; + } + public void setFilesize(long filesize) { + this.filesize = filesize; + } + } |