diff options
| author | unknown | 2013-11-29 13:27:16 +0100 |
|---|---|---|
| committer | unknown | 2013-11-29 13:27:16 +0100 |
| commit | 4c58fa14232b53d214b2bfa8e81756c21072dd4b (patch) | |
| tree | bfa4992b9587ec5bd01fae7ecee40a63a868b954 | |
| parent | Upload mit dynamischen User möglich, welcher nach dem Upload bzw. beenden wie... (diff) | |
| download | tutor-module-4c58fa14232b53d214b2bfa8e81756c21072dd4b.tar.gz tutor-module-4c58fa14232b53d214b2bfa8e81756c21072dd4b.tar.xz tutor-module-4c58fa14232b53d214b2bfa8e81756c21072dd4b.zip | |
Upload mit dynamischen User, welcher nach dem Upload wieder gelöscht wird
23 files changed, 54 insertions, 32 deletions
diff --git a/Dozentenmodul/.classpath b/Dozentenmodul/.classpath index a5e66f2d..966848f9 100644 --- a/Dozentenmodul/.classpath +++ b/Dozentenmodul/.classpath @@ -15,8 +15,6 @@ <classpathentry kind="lib" path="lib/swing2swt.jar"/>
<classpathentry kind="lib" path="lib/swt.jar"/>
<classpathentry kind="lib" path="lib/wizard-0.998.1.jar"/>
- <classpathentry kind="lib" path="C:/Users/tspitzer/workspace/Dozentenmodulserver/WebContent/WEB-INF/lib/jaxrpc.jar"/>
- <classpathentry kind="lib" path="C:/Users/tspitzer/workspace/Dozentenmodulserver/WebContent/WEB-INF/lib/axis.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Dozentenmodulserver"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/Dozentenmodul/bin/GUI/FTPDownloader$4.class b/Dozentenmodul/bin/GUI/FTPDownloader$4.class Binary files differindex e8db635a..5075949c 100644 --- a/Dozentenmodul/bin/GUI/FTPDownloader$4.class +++ b/Dozentenmodul/bin/GUI/FTPDownloader$4.class diff --git a/Dozentenmodul/bin/GUI/FTPDownloader$5.class b/Dozentenmodul/bin/GUI/FTPDownloader$5.class Binary files differdeleted file mode 100644 index 058a9c05..00000000 --- a/Dozentenmodul/bin/GUI/FTPDownloader$5.class +++ /dev/null diff --git a/Dozentenmodul/bin/GUI/FTPDownloader.class b/Dozentenmodul/bin/GUI/FTPDownloader.class Binary files differindex c4cc112b..f5ff4747 100644 --- a/Dozentenmodul/bin/GUI/FTPDownloader.class +++ b/Dozentenmodul/bin/GUI/FTPDownloader.class diff --git a/Dozentenmodul/bin/GUI/FTPUploader$1.class b/Dozentenmodul/bin/GUI/FTPUploader$1.class Binary files differindex 174c7a3a..1a8e9bb5 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 88e7b1ba..8717e356 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 00942505..f6b38268 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 af9d1150..15de2d50 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 c7d6217b..42709412 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 9e25ac40..97f544cf 100644 --- a/Dozentenmodul/bin/GUI/FTPUploader.class +++ b/Dozentenmodul/bin/GUI/FTPUploader.class diff --git a/Dozentenmodul/bin/GUI/LoginWindow$3.class b/Dozentenmodul/bin/GUI/LoginWindow$3.class Binary files differindex d212b8f3..b0313839 100644 --- a/Dozentenmodul/bin/GUI/LoginWindow$3.class +++ b/Dozentenmodul/bin/GUI/LoginWindow$3.class diff --git a/Dozentenmodul/bin/GUI/LoginWindow.class b/Dozentenmodul/bin/GUI/LoginWindow.class Binary files differindex e44cb46a..c998765b 100644 --- a/Dozentenmodul/bin/GUI/LoginWindow.class +++ b/Dozentenmodul/bin/GUI/LoginWindow.class diff --git a/Dozentenmodul/bin/rmi/RmiClientMethods.class b/Dozentenmodul/bin/rmi/RmiClientMethods.class Binary files differnew file mode 100644 index 00000000..451fa5a2 --- /dev/null +++ b/Dozentenmodul/bin/rmi/RmiClientMethods.class 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 Binary files differindex f6afba55..88815161 100644 --- a/Dozentenmodulserver/bin/Models/User.class +++ b/Dozentenmodulserver/bin/Models/User.class diff --git a/Dozentenmodulserver/bin/server/ServerInterface.class b/Dozentenmodulserver/bin/server/ServerInterface.class Binary files differindex 22136657..ca7f3971 100644 --- a/Dozentenmodulserver/bin/server/ServerInterface.class +++ b/Dozentenmodulserver/bin/server/ServerInterface.class diff --git a/Dozentenmodulserver/bin/server/ServerMethod.class b/Dozentenmodulserver/bin/server/ServerMethod.class Binary files differindex f1d32ede..aaa674af 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 121d6070..8b05dc1f 100644 --- a/Dozentenmodulserver/bin/sql/SQL.class +++ b/Dozentenmodulserver/bin/sql/SQL.class 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;
+ }
}
|
