From 4c58fa14232b53d214b2bfa8e81756c21072dd4b Mon Sep 17 00:00:00 2001
From: unknown
Date: Fri, 29 Nov 2013 13:27:16 +0100
Subject: Upload mit dynamischen User, welcher nach dem Upload wieder gelöscht
wird
---
Dozentenmodul/.classpath | 2 --
Dozentenmodul/bin/GUI/FTPDownloader$4.class | Bin 695 -> 871 bytes
Dozentenmodul/bin/GUI/FTPDownloader$5.class | Bin 871 -> 0 bytes
Dozentenmodul/bin/GUI/FTPDownloader.class | Bin 7383 -> 7114 bytes
Dozentenmodul/bin/GUI/FTPUploader$1.class | Bin 718 -> 718 bytes
Dozentenmodul/bin/GUI/FTPUploader$2.class | Bin 771 -> 1148 bytes
Dozentenmodul/bin/GUI/FTPUploader$3.class | Bin 1288 -> 1288 bytes
Dozentenmodul/bin/GUI/FTPUploader$4.class | Bin 707 -> 707 bytes
Dozentenmodul/bin/GUI/FTPUploader$5.class | Bin 654 -> 1203 bytes
Dozentenmodul/bin/GUI/FTPUploader.class | Bin 10570 -> 7960 bytes
Dozentenmodul/bin/GUI/LoginWindow$3.class | Bin 1011 -> 1011 bytes
Dozentenmodul/bin/GUI/LoginWindow.class | Bin 3942 -> 3942 bytes
Dozentenmodul/bin/rmi/RmiClientMethods.class | Bin 0 -> 1314 bytes
Dozentenmodul/src/GUI/FTPDownloader.java | 13 +-------
Dozentenmodul/src/GUI/FTPUploader.java | 35 +++++++++++----------
Dozentenmodulserver/bin/Models/User.class | Bin 723 -> 905 bytes
.../bin/server/ServerInterface.class | Bin 233 -> 291 bytes
Dozentenmodulserver/bin/server/ServerMethod.class | Bin 2208 -> 2525 bytes
Dozentenmodulserver/bin/sql/SQL.class | Bin 1989 -> 2366 bytes
Dozentenmodulserver/src/Models/User.java | 7 +++++
.../src/server/ServerInterface.java | 1 +
Dozentenmodulserver/src/server/ServerMethod.java | 11 +++++++
Dozentenmodulserver/src/sql/SQL.java | 17 +++++++++-
23 files changed, 54 insertions(+), 32 deletions(-)
delete mode 100644 Dozentenmodul/bin/GUI/FTPDownloader$5.class
create mode 100644 Dozentenmodul/bin/rmi/RmiClientMethods.class
diff --git a/Dozentenmodul/.classpath b/Dozentenmodul/.classpath
index a5e66f2d..966848f9 100644
--- a/Dozentenmodul/.classpath
+++ b/Dozentenmodul/.classpath
@@ -15,8 +15,6 @@
-
-
diff --git a/Dozentenmodul/bin/GUI/FTPDownloader$4.class b/Dozentenmodul/bin/GUI/FTPDownloader$4.class
index e8db635a..5075949c 100644
Binary files a/Dozentenmodul/bin/GUI/FTPDownloader$4.class and b/Dozentenmodul/bin/GUI/FTPDownloader$4.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPDownloader$5.class b/Dozentenmodul/bin/GUI/FTPDownloader$5.class
deleted file mode 100644
index 058a9c05..00000000
Binary files a/Dozentenmodul/bin/GUI/FTPDownloader$5.class and /dev/null differ
diff --git a/Dozentenmodul/bin/GUI/FTPDownloader.class b/Dozentenmodul/bin/GUI/FTPDownloader.class
index c4cc112b..f5ff4747 100644
Binary files a/Dozentenmodul/bin/GUI/FTPDownloader.class and b/Dozentenmodul/bin/GUI/FTPDownloader.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader$1.class b/Dozentenmodul/bin/GUI/FTPUploader$1.class
index 174c7a3a..1a8e9bb5 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader$1.class and b/Dozentenmodul/bin/GUI/FTPUploader$1.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader$2.class b/Dozentenmodul/bin/GUI/FTPUploader$2.class
index 88e7b1ba..8717e356 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader$2.class and b/Dozentenmodul/bin/GUI/FTPUploader$2.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader$3.class b/Dozentenmodul/bin/GUI/FTPUploader$3.class
index 00942505..f6b38268 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader$3.class and b/Dozentenmodul/bin/GUI/FTPUploader$3.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader$4.class b/Dozentenmodul/bin/GUI/FTPUploader$4.class
index af9d1150..15de2d50 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader$4.class and b/Dozentenmodul/bin/GUI/FTPUploader$4.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader$5.class b/Dozentenmodul/bin/GUI/FTPUploader$5.class
index c7d6217b..42709412 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader$5.class and b/Dozentenmodul/bin/GUI/FTPUploader$5.class differ
diff --git a/Dozentenmodul/bin/GUI/FTPUploader.class b/Dozentenmodul/bin/GUI/FTPUploader.class
index 9e25ac40..97f544cf 100644
Binary files a/Dozentenmodul/bin/GUI/FTPUploader.class and b/Dozentenmodul/bin/GUI/FTPUploader.class differ
diff --git a/Dozentenmodul/bin/GUI/LoginWindow$3.class b/Dozentenmodul/bin/GUI/LoginWindow$3.class
index d212b8f3..b0313839 100644
Binary files a/Dozentenmodul/bin/GUI/LoginWindow$3.class and b/Dozentenmodul/bin/GUI/LoginWindow$3.class differ
diff --git a/Dozentenmodul/bin/GUI/LoginWindow.class b/Dozentenmodul/bin/GUI/LoginWindow.class
index e44cb46a..c998765b 100644
Binary files a/Dozentenmodul/bin/GUI/LoginWindow.class and b/Dozentenmodul/bin/GUI/LoginWindow.class differ
diff --git a/Dozentenmodul/bin/rmi/RmiClientMethods.class b/Dozentenmodul/bin/rmi/RmiClientMethods.class
new file mode 100644
index 00000000..451fa5a2
Binary files /dev/null and b/Dozentenmodul/bin/rmi/RmiClientMethods.class differ
diff --git a/Dozentenmodul/src/GUI/FTPDownloader.java b/Dozentenmodul/src/GUI/FTPDownloader.java
index 5d7ec8da..a8ed8785 100644
--- a/Dozentenmodul/src/GUI/FTPDownloader.java
+++ b/Dozentenmodul/src/GUI/FTPDownloader.java
@@ -190,18 +190,7 @@ public class FTPDownloader extends JFrame implements PropertyChangeListener {
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
- JButton okButton = new JButton("OK");
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- dispose();
- }
- });
- okButton.setActionCommand("OK");
- buttonPane.add(okButton);
- getRootPane().setDefaultButton(okButton);
- }
- {
- JButton cancelButton = new JButton("Zur\u00FCck");
+ JButton cancelButton = new JButton("Schlie\u00DFen");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(taskrun==true)
diff --git a/Dozentenmodul/src/GUI/FTPUploader.java b/Dozentenmodul/src/GUI/FTPUploader.java
index d4908914..73a4bc5b 100644
--- a/Dozentenmodul/src/GUI/FTPUploader.java
+++ b/Dozentenmodul/src/GUI/FTPUploader.java
@@ -51,7 +51,6 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
String host="141.79.128.121";
int port=21;
User user;
- String uploadPath="/";
String filename="";
File uploadFile;
static String arg="";
@@ -67,6 +66,8 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
double speed;
long bytesread;
boolean taskrun=false;
+ RmiClientMethods rmi=new RmiClientMethods();
+ ServerInterface sint=rmi.getInterface();
/**
* Launch the application.
*/
@@ -92,6 +93,12 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
public void windowClosing(WindowEvent arg0) {
if(taskrun==true)
{
+ try {
+ sint.DeleteFtpUser(user.getUsername());
+ } catch (RemoteException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
task.cancel(true);
}
}
@@ -108,7 +115,7 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+
//filename=name;
setBackground(Color.WHITE);
setTitle("Dozentenmodul *Prototyp*");
@@ -218,23 +225,18 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
- JButton okButton = new JButton("OK");
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- dispose();
- }
- });
- okButton.setActionCommand("OK");
- buttonPane.add(okButton);
- getRootPane().setDefaultButton(okButton);
- }
- {
- JButton cancelButton = new JButton("Zur\u00FCck");
+ JButton cancelButton = new JButton("Schlie\u00DFen");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
if(taskrun==true)
{
+ try {
+ sint.DeleteFtpUser(user.getUsername());
+ } catch (RemoteException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
task.cancel(true);
}
@@ -268,8 +270,7 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
//System.out.println("OK");
//}
progressBar.setValue(0);
- RmiClientMethods rmi=new RmiClientMethods();
- ServerInterface sint=rmi.getInterface();
+
try {
user=sint.getFtpUser();
} catch (RemoteException e) {
@@ -279,7 +280,7 @@ public class FTPUploader extends JFrame implements PropertyChangeListener {
System.out.println("username: "+user.getUsername());
labeluser.setText(user.getUsername());
labelpass.setText(user.getPass());
- task=new UploadTask(host,port,user.getUsername(),user.getPass(),uploadPath, uploadFile);
+ task=new UploadTask(host,port,user.getUsername(),user.getPass(),user.getPath(), uploadFile);
task.addPropertyChangeListener(this);
task.execute();
taskrun=true;
diff --git a/Dozentenmodulserver/bin/Models/User.class b/Dozentenmodulserver/bin/Models/User.class
index f6afba55..88815161 100644
Binary files a/Dozentenmodulserver/bin/Models/User.class and b/Dozentenmodulserver/bin/Models/User.class differ
diff --git a/Dozentenmodulserver/bin/server/ServerInterface.class b/Dozentenmodulserver/bin/server/ServerInterface.class
index 22136657..ca7f3971 100644
Binary files a/Dozentenmodulserver/bin/server/ServerInterface.class and b/Dozentenmodulserver/bin/server/ServerInterface.class differ
diff --git a/Dozentenmodulserver/bin/server/ServerMethod.class b/Dozentenmodulserver/bin/server/ServerMethod.class
index f1d32ede..aaa674af 100644
Binary files a/Dozentenmodulserver/bin/server/ServerMethod.class and b/Dozentenmodulserver/bin/server/ServerMethod.class differ
diff --git a/Dozentenmodulserver/bin/sql/SQL.class b/Dozentenmodulserver/bin/sql/SQL.class
index 121d6070..8b05dc1f 100644
Binary files a/Dozentenmodulserver/bin/sql/SQL.class and b/Dozentenmodulserver/bin/sql/SQL.class differ
diff --git a/Dozentenmodulserver/src/Models/User.java b/Dozentenmodulserver/src/Models/User.java
index c946cd70..c533d6fa 100644
--- a/Dozentenmodulserver/src/Models/User.java
+++ b/Dozentenmodulserver/src/Models/User.java
@@ -7,6 +7,13 @@ public class User implements Serializable {
private String username;
private String pass;
+ private String path;
+ public String getPath() {
+ return path;
+ }
+ public void setPath(String path) {
+ this.path = path;
+ }
public String getUsername() {
return username;
}
diff --git a/Dozentenmodulserver/src/server/ServerInterface.java b/Dozentenmodulserver/src/server/ServerInterface.java
index 783321be..6ae6e529 100644
--- a/Dozentenmodulserver/src/server/ServerInterface.java
+++ b/Dozentenmodulserver/src/server/ServerInterface.java
@@ -6,6 +6,7 @@ import Models.User;
public interface ServerInterface extends Remote
{
public User getFtpUser() throws RemoteException;
+ public int DeleteFtpUser(String user) throws RemoteException;
}
diff --git a/Dozentenmodulserver/src/server/ServerMethod.java b/Dozentenmodulserver/src/server/ServerMethod.java
index 73ce26b3..a3a2db65 100644
--- a/Dozentenmodulserver/src/server/ServerMethod.java
+++ b/Dozentenmodulserver/src/server/ServerMethod.java
@@ -45,6 +45,7 @@ public class ServerMethod extends UnicastRemoteObject implements ServerInterface
User user=new User();
user.setUsername(UUID.randomUUID().toString().substring(0, 8));
user.setPass(UUID.randomUUID().toString().substring(0, 8));
+ user.setPath("/srv/openslx/nfs/temp");
SQL sql=new SQL();
Connection con=sql.getConnection();
sql.writeFTPUser(con, user.getUsername(), user.getPass());
@@ -53,5 +54,15 @@ public class ServerMethod extends UnicastRemoteObject implements ServerInterface
+ @Override
+ public int DeleteFtpUser(String user) throws RemoteException {
+ SQL sql=new SQL();
+ Connection con=sql.getConnection();
+ int ret = sql.DeleteUser(con, user);
+ return ret;
+ }
+
+
+
}
\ No newline at end of file
diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java
index c3582527..84e8cd11 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`,`Dir`)VALUES('"+user+"','"+pass+"','/');");
+ int ret=stm.executeUpdate("INSERT INTO `bwLehrpool`.`FtpUsers`(`User`,`Password`,`Uid`,`Gid`,`Dir`)VALUES('"+user+"','"+pass+"','10001','12345','/srv/openslx/nfs/temp');");
con.commit();
return ret;
} catch (SQLException e) {
@@ -44,6 +44,21 @@ public class SQL {
return -1;
}
+ public int DeleteUser(Connection con, String user)
+ {
+ Statement stm;
+ try {
+ stm=con.createStatement();
+
+ int ret=stm.executeUpdate("DELETE FROM `bwLehrpool`.`FtpUsers` where User like '"+user+"';");
+ con.commit();
+ return ret;
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return -1;
+ }
}
--
cgit v1.2.3-55-g7522