diff options
| author | unknown | 2013-12-06 11:24:49 +0100 |
|---|---|---|
| committer | unknown | 2013-12-06 11:24:49 +0100 |
| commit | b5d94da9e8b28a828afce600ba40c673c977b1b5 (patch) | |
| tree | da2fb962c5d235a74f63bcb52ac4f0d2feadee2c | |
| parent | Upload mit dynamischen User, welcher nach dem Upload wieder gelöscht wird (diff) | |
| download | tutor-module-b5d94da9e8b28a828afce600ba40c673c977b1b5.tar.gz tutor-module-b5d94da9e8b28a828afce600ba40c673c977b1b5.tar.xz tutor-module-b5d94da9e8b28a828afce600ba40c673c977b1b5.zip | |
Aktionsauswahl neu
22 files changed, 60 insertions, 49 deletions
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$2.class b/Dozentenmodul/bin/GUI/ActionChooser$2.class Binary files differindex ed820280..986d5e43 100644 --- a/Dozentenmodul/bin/GUI/ActionChooser$2.class +++ b/Dozentenmodul/bin/GUI/ActionChooser$2.class diff --git a/Dozentenmodul/bin/GUI/ActionChooser.class b/Dozentenmodul/bin/GUI/ActionChooser.class Binary files differindex bc07f519..3c9d4d89 100644 --- a/Dozentenmodul/bin/GUI/ActionChooser.class +++ b/Dozentenmodul/bin/GUI/ActionChooser.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$1.class b/Dozentenmodul/bin/GUI/FTPUploader$1.class Binary files differindex 1a8e9bb5..663a8846 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader$1.class +++ b/Dozentenmodul/bin/GUI/FTPUploader$1.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$2.class b/Dozentenmodul/bin/GUI/FTPUploader$2.class Binary files differindex 8717e356..efbfd432 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader$2.class +++ b/Dozentenmodul/bin/GUI/FTPUploader$2.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$3.class b/Dozentenmodul/bin/GUI/FTPUploader$3.class Binary files differindex f6b38268..b00dc547 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader$3.class +++ b/Dozentenmodul/bin/GUI/FTPUploader$3.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$4.class b/Dozentenmodul/bin/GUI/FTPUploader$4.class Binary files differindex 15de2d50..1f329752 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader$4.class +++ b/Dozentenmodul/bin/GUI/FTPUploader$4.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$5.class b/Dozentenmodul/bin/GUI/FTPUploader$5.class Binary files differindex 42709412..1e96a33d 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader$5.class +++ b/Dozentenmodul/bin/GUI/FTPUploader$5.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader.class b/Dozentenmodul/bin/GUI/FTPUploader.class Binary files differindex 97f544cf..0f80542b 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader.class +++ b/Dozentenmodul/bin/GUI/FTPUploader.class diff --git a/Dozentenmodul/bin/GUI/searchRohling$1.class b/Dozentenmodul/bin/GUI/searchRohling$1.class Binary files differdeleted file mode 100644 index f0fce10c..00000000 --- a/Dozentenmodul/bin/GUI/searchRohling$1.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/searchRohling$2.class b/Dozentenmodul/bin/GUI/searchRohling$2.class Binary files differdeleted file mode 100644 index 1776ca17..00000000 --- a/Dozentenmodul/bin/GUI/searchRohling$2.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/searchRohling$3.class b/Dozentenmodul/bin/GUI/searchRohling$3.class Binary files differdeleted file mode 100644 index a55f65bc..00000000 --- a/Dozentenmodul/bin/GUI/searchRohling$3.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/searchRohling$4.class b/Dozentenmodul/bin/GUI/searchRohling$4.class Binary files differdeleted file mode 100644 index 18adf54f..00000000 --- a/Dozentenmodul/bin/GUI/searchRohling$4.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/searchRohling$5.class b/Dozentenmodul/bin/GUI/searchRohling$5.class Binary files differdeleted file mode 100644 index 140b79cd..00000000 --- a/Dozentenmodul/bin/GUI/searchRohling$5.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/searchRohling.class b/Dozentenmodul/bin/GUI/searchRohling.class Binary files differindex f0a85396..ed1f0a79 100644 --- a/Dozentenmodul/bin/GUI/searchRohling.class +++ b/Dozentenmodul/bin/GUI/searchRohling.class diff --git a/Dozentenmodul/bin/downloader/FTPUtility.class b/Dozentenmodul/bin/downloader/FTPUtility.class Binary files differindex 84c083d6..f5a5dd90 100644 --- a/Dozentenmodul/bin/downloader/FTPUtility.class +++ b/Dozentenmodul/bin/downloader/FTPUtility.class diff --git a/Dozentenmodul/src/GUI/ActionChooser.java b/Dozentenmodul/src/GUI/ActionChooser.java index 631686bd..f469878d 100644 --- a/Dozentenmodul/src/GUI/ActionChooser.java +++ b/Dozentenmodul/src/GUI/ActionChooser.java @@ -32,8 +32,8 @@ public class ActionChooser extends JFrame { private final JPanel contentPanel = new JPanel();
String[] result;
- JRadioButton radioButton_1;
- JRadioButton radioButton;
+ JRadioButton rdbtnLaborvorlageHerunterladen;
+ JRadioButton rdbtnVerfgbaresLaborHerunterladen;
private final ButtonGroup buttonGroup = new ButtonGroup();
/**
* Launch the application.
@@ -97,43 +97,43 @@ public class ActionChooser extends JFrame { getContentPane().add(contentPanel);
contentPanel.setLayout(null);
- radioButton = new JRadioButton("Erstellen einer neuen VL");
- radioButton.setEnabled(false);
- buttonGroup.add(radioButton);
- radioButton.setHorizontalAlignment(SwingConstants.CENTER);
- radioButton.setBackground(Color.WHITE);
- radioButton.setBounds(6, 30, 141, 23);
- contentPanel.add(radioButton);
+ rdbtnVerfgbaresLaborHerunterladen = new JRadioButton("Verf\u00FCgbares Labor herunterladen");
+ rdbtnVerfgbaresLaborHerunterladen.setEnabled(false);
+ buttonGroup.add(rdbtnVerfgbaresLaborHerunterladen);
+ rdbtnVerfgbaresLaborHerunterladen.setHorizontalAlignment(SwingConstants.CENTER);
+ rdbtnVerfgbaresLaborHerunterladen.setBackground(Color.WHITE);
+ rdbtnVerfgbaresLaborHerunterladen.setBounds(6, 30, 185, 23);
+ contentPanel.add(rdbtnVerfgbaresLaborHerunterladen);
- radioButton_1 = new JRadioButton("Erstellen einer neuen VL auf Basis einer VL Rohling");
- radioButton_1.setSelected(true);
- buttonGroup.add(radioButton_1);
- radioButton_1.setBackground(Color.WHITE);
- radioButton_1.setBounds(6, 7, 265, 23);
- contentPanel.add(radioButton_1);
+ rdbtnLaborvorlageHerunterladen = new JRadioButton("Laborvorlage herunterladen");
+ rdbtnLaborvorlageHerunterladen.setSelected(true);
+ buttonGroup.add(rdbtnLaborvorlageHerunterladen);
+ rdbtnLaborvorlageHerunterladen.setBackground(Color.WHITE);
+ rdbtnLaborvorlageHerunterladen.setBounds(6, 7, 265, 23);
+ contentPanel.add(rdbtnLaborvorlageHerunterladen);
- JRadioButton rdbtnEigenschaftenEinerVl = new JRadioButton("Eigenschaften einer VL \u00E4ndern");
+ JRadioButton rdbtnEigenschaftenEinerVl = new JRadioButton("Fertiges Labor hochladen");
rdbtnEigenschaftenEinerVl.setEnabled(false);
buttonGroup.add(rdbtnEigenschaftenEinerVl);
rdbtnEigenschaftenEinerVl.setBackground(Color.WHITE);
rdbtnEigenschaftenEinerVl.setBounds(6, 53, 185, 23);
contentPanel.add(rdbtnEigenschaftenEinerVl);
- JRadioButton radioButton_3 = new JRadioButton("Kopieren einer bestehenden VL");
- radioButton_3.setEnabled(false);
- buttonGroup.add(radioButton_3);
- radioButton_3.setBackground(Color.WHITE);
- radioButton_3.setBounds(6, 105, 175, 23);
- contentPanel.add(radioButton_3);
+ JRadioButton rdbtnLinkAufEin = new JRadioButton("Link auf ein bestehendes Labor erzeugen");
+ rdbtnLinkAufEin.setEnabled(false);
+ buttonGroup.add(rdbtnLinkAufEin);
+ rdbtnLinkAufEin.setBackground(Color.WHITE);
+ rdbtnLinkAufEin.setBounds(6, 105, 230, 23);
+ contentPanel.add(rdbtnLinkAufEin);
- JRadioButton radioButton_4 = new JRadioButton("Verlinken einer bestehenden VL");
- radioButton_4.setEnabled(false);
- buttonGroup.add(radioButton_4);
- radioButton_4.setBackground(Color.WHITE);
- radioButton_4.setBounds(6, 131, 175, 23);
- contentPanel.add(radioButton_4);
+ JRadioButton rdbtnLaborLschen = new JRadioButton("Labor l\u00F6schen");
+ rdbtnLaborLschen.setEnabled(false);
+ buttonGroup.add(rdbtnLaborLschen);
+ rdbtnLaborLschen.setBackground(Color.WHITE);
+ rdbtnLaborLschen.setBounds(6, 131, 175, 23);
+ contentPanel.add(rdbtnLaborLschen);
- JRadioButton rdbtnInhaltEinerVl = new JRadioButton("Inhalt einer VL \u00E4ndern");
+ JRadioButton rdbtnInhaltEinerVl = new JRadioButton("Laboreigenschaften \u00E4ndern");
rdbtnInhaltEinerVl.setEnabled(false);
rdbtnInhaltEinerVl.setBackground(Color.WHITE);
rdbtnInhaltEinerVl.setBounds(6, 79, 185, 23);
@@ -149,12 +149,12 @@ public class ActionChooser extends JFrame { cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- if(radioButton_1.isSelected()==true)
+ if(rdbtnLaborvorlageHerunterladen.isSelected()==true)
{
searchRohling sr=new searchRohling();
sr.setVisible(true);
dispose();
- }else if(radioButton.isSelected()==true)
+ }else if(rdbtnVerfgbaresLaborHerunterladen.isSelected()==true)
{
EingabeAllgemein ea = new EingabeAllgemein();
ea.setVisible(true);
diff --git a/Dozentenmodul/src/GUI/FTPUploader.java b/Dozentenmodul/src/GUI/FTPUploader.java index 73a4bc5b..f1552be4 100644 --- a/Dozentenmodul/src/GUI/FTPUploader.java +++ b/Dozentenmodul/src/GUI/FTPUploader.java @@ -60,8 +60,6 @@ public class FTPUploader extends JFrame implements PropertyChangeListener { JLabel labelfilesize;
JLabel labelZeit;
JLabel labelverbleibend;
- JLabel labeluser;
- JLabel labelpass;
long filesize;
double speed;
long bytesread;
@@ -211,14 +209,6 @@ public class FTPUploader extends JFrame implements PropertyChangeListener { labelverbleibend = new JLabel("");
labelverbleibend.setBounds(434, 114, 108, 14);
contentPanel.add(labelverbleibend);
-
- labeluser = new JLabel("");
- labeluser.setBounds(196, 159, 117, 14);
- contentPanel.add(labeluser);
-
- labelpass = new JLabel("");
- labelpass.setBounds(337, 155, 134, 14);
- contentPanel.add(labelpass);
{
JPanel buttonPane = new JPanel();
buttonPane.setBackground(UIManager.getColor("Button.background"));
@@ -277,9 +267,7 @@ public class FTPUploader extends JFrame implements PropertyChangeListener { // TODO Auto-generated catch block
e.printStackTrace();
}
- System.out.println("username: "+user.getUsername());
- labeluser.setText(user.getUsername());
- labelpass.setText(user.getPass());
+
task=new UploadTask(host,port,user.getUsername(),user.getPass(),user.getPath(), uploadFile);
task.addPropertyChangeListener(this);
task.execute();
diff --git a/Dozentenmodul/src/downloader/FTPUtility.java b/Dozentenmodul/src/downloader/FTPUtility.java index 72d74cbc..14b30aeb 100644 --- a/Dozentenmodul/src/downloader/FTPUtility.java +++ b/Dozentenmodul/src/downloader/FTPUtility.java @@ -4,11 +4,16 @@ import java.io.File; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.math.BigInteger;
import java.net.SocketException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;
+import org.apache.commons.net.ftp.FTPSClient;
/**
@@ -26,7 +31,7 @@ public class FTPUtility { private String username;
private String password;
- private FTPClient ftpClient = new FTPClient();
+ private FTPSClient ftpClient = new FTPSClient();
private int replyCode;
private InputStream inputStream;
@@ -43,18 +48,21 @@ public class FTPUtility { * Connect and login to the server.
*
* @throws FTPException
+ * @throws NoSuchAlgorithmException
*/
- public void connect() throws FTPException {
+ public void connect() throws FTPException, NoSuchAlgorithmException {
try {
ftpClient.connect(host, port);
replyCode = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(replyCode)) {
throw new FTPException("FTP serve refused connection.");
}
-
+
+
boolean logged = ftpClient.login(username, password);
if (!logged) {
// failed to login
+ ftpClient.execPROT("P");
ftpClient.disconnect();
throw new FTPException("Could not login to the server.");
}
@@ -222,4 +230,5 @@ public class FTPUtility { return null;
}
+
}
\ No newline at end of file diff --git a/Dozentenmodulserver/bin/server/ServerMethod.class b/Dozentenmodulserver/bin/server/ServerMethod.class Binary files differindex aaa674af..e08f8a11 100644 --- a/Dozentenmodulserver/bin/server/ServerMethod.class +++ b/Dozentenmodulserver/bin/server/ServerMethod.class diff --git a/Dozentenmodulserver/bin/sql/SQL.class b/Dozentenmodulserver/bin/sql/SQL.class Binary files differindex 8b05dc1f..49415869 100644 --- a/Dozentenmodulserver/bin/sql/SQL.class +++ b/Dozentenmodulserver/bin/sql/SQL.class diff --git a/Dozentenmodulserver/src/server/ServerMethod.java b/Dozentenmodulserver/src/server/ServerMethod.java index a3a2db65..a401c7b9 100644 --- a/Dozentenmodulserver/src/server/ServerMethod.java +++ b/Dozentenmodulserver/src/server/ServerMethod.java @@ -1,7 +1,10 @@ package server;
+import java.math.BigInteger;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.server.UnicastRemoteObject;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.util.UUID;
import Models.*;
@@ -44,7 +47,7 @@ public class ServerMethod extends UnicastRemoteObject implements ServerInterface public User getFtpUser() throws RemoteException {
User user=new User();
user.setUsername(UUID.randomUUID().toString().substring(0, 8));
- user.setPass(UUID.randomUUID().toString().substring(0, 8));
+ user.setPass(getEncodedSha1Sum(UUID.randomUUID().toString().substring(0, 8)));
user.setPath("/srv/openslx/nfs/temp");
SQL sql=new SQL();
Connection con=sql.getConnection();
@@ -62,6 +65,17 @@ public class ServerMethod extends UnicastRemoteObject implements ServerInterface return ret;
}
+ public String getEncodedSha1Sum(String key) {
+ try {
+ MessageDigest md = MessageDigest.getInstance( "SHA1" );
+ md.update( key.getBytes() );
+ return new BigInteger(1, md.digest()).toString(16);
+ }
+ catch (NoSuchAlgorithmException e) {
+ // handle error case to taste
+ }
+ return null;
+ }
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java index 84e8cd11..8a25491b 100644 --- a/Dozentenmodulserver/src/sql/SQL.java +++ b/Dozentenmodulserver/src/sql/SQL.java @@ -34,7 +34,7 @@ public class SQL { try {
stm=con.createStatement();
- int ret=stm.executeUpdate("INSERT INTO `bwLehrpool`.`FtpUsers`(`User`,`Password`,`Uid`,`Gid`,`Dir`)VALUES('"+user+"','"+pass+"','10001','12345','/srv/openslx/nfs/temp');");
+ int ret=stm.executeUpdate("INSERT INTO `bwLehrpool`.`FtpUsers`(`User`,`Password`,`Uid`,`Gid`,`Dir`)VALUES('"+user+"',SHA1('"+pass+"'),'10001','12345','/srv/openslx/nfs/temp');");
con.commit();
return ret;
} catch (SQLException e) {
|
