summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNils Schwabe2014-06-16 18:01:17 +0200
committerNils Schwabe2014-06-16 18:01:17 +0200
commitabe4422f8db9f3f762f9505d67765d2ffe4f7ad5 (patch)
tree52492ec8d628687323f88f4cb9e8c33afb2b5fd8 /src
parentAdd FtpUsers are now in sync with DB (diff)
downloadmasterserver-abe4422f8db9f3f762f9505d67765d2ffe4f7ad5.tar.gz
masterserver-abe4422f8db9f3f762f9505d67765d2ffe4f7ad5.tar.xz
masterserver-abe4422f8db9f3f762f9505d67765d2ffe4f7ad5.zip
Implement downloading functionality
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openslx/imagemaster/ftp/MasterFtpServer.java8
-rw-r--r--src/main/java/org/openslx/imagemaster/server/ApiServer.java11
-rw-r--r--src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java3
3 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/imagemaster/ftp/MasterFtpServer.java b/src/main/java/org/openslx/imagemaster/ftp/MasterFtpServer.java
index 8ed64d6..3da37a0 100644
--- a/src/main/java/org/openslx/imagemaster/ftp/MasterFtpServer.java
+++ b/src/main/java/org/openslx/imagemaster/ftp/MasterFtpServer.java
@@ -260,8 +260,12 @@ public class MasterFtpServer implements Runnable
DbFtpUser.removeUserByName( username );
}
// remove his home dir
- File dir = new File( Globals.getPropertyString( Globals.PropString.FTPBASEDIR ) + "/" + username );
- Util.deleteFolder( dir );
+ try {
+ File dir = new File( Globals.getPropertyString( Globals.PropString.FTPBASEDIR ) + "/" + username );
+ Util.deleteFolder( dir );
+ } catch (Exception e) {
+ // don't care because it could be a downloading user
+ }
return true;
} catch ( FtpException e ) {
return false;
diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
index ab1b88a..a36f201 100644
--- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java
+++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java
@@ -226,4 +226,15 @@ public class ApiServer
return ftpCredentials;
}
+ public static boolean finishedDownload( String ftpUser )
+ {
+ if ( !App.ftpServer.users.containsKey( ftpUser ))
+ return false;
+
+ // download is done, user can be removed now
+ App.ftpServer.removeUser( ftpUser );
+
+ return true;
+ }
+
}
diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java b/src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java
index 9ad1fcb..446fae3 100644
--- a/src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java
+++ b/src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java
@@ -80,8 +80,7 @@ public class ImageServerHandler implements ImageServer.Iface
@Override
public boolean finishedDownload( String ftpUser ) throws TException
{
- // TODO Auto-generated method stub
- return false;
+ return ApiServer.finishedDownload( ftpUser );
}
}