diff options
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/server/ApiServer.java')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/server/ApiServer.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java index 237789d..d4ccb08 100644 --- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java +++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java @@ -83,40 +83,6 @@ public class ApiServer return new UserInfo( session.getUserId(), session.getFirstName(), session.getLastName(), session.getEMail() ); } -// TODO: Remove old code that's not needed anymore - that's what a vcs is for... -// /** -// * Request ftp credentials to upload a new image to the masterserver. -// * -// * @param imageDescription MetaData of the new image -// * @param serverSessionData the session data of the authenticated uni/hs server -// * @return the genereated ftp credentials -// * @throws AuthorizationException if the uni/hs server has no valid session -// * @throws TException -// */ -// public static FtpCredentials submitImage( String serverSessionId, -// ImageData imageDescription ) throws AuthorizationException, ImageDataException -// { -// if ( ServerSessionManager.getSession( serverSessionId ) == null ) { -// throw new AuthorizationException( AuthorizationError.NOT_AUTHENTICATED, "No valid serverSessionData" ); -// } -// -// // create new user -// FtpCredentials ftpCredentials = App.ftpServer.addUser( serverSessionId , MasterFtpServer.Mode.UPLOADING, ""); -// -// if ( ftpCredentials == null ) { -// log.error( "Could not create ftp credentials" ); -// return null; -// } -// -// try { -// ImageProcessor.addImageDataToProcess( imageDescription, ftpCredentials.username, ftpCredentials.password ); -// } catch (ImageDataException e) { -// App.ftpServer.removeUser( serverSessionId ); -// throw new ImageDataException( ImageDataError.INVALID_DATA, e.getMessage() ); -// } -// -// return ftpCredentials; -// } public static UploadInfos submitImage( String serverSessionId, ImageData imageDescription, List<Integer> crcSums ) throws AuthorizationException, ImageDataException, UploadException { @@ -189,79 +155,4 @@ public class ApiServer final ServerSession session = new ServerSession( serverUser ); return ServerSessionManager.addSession( session ); } - -// /** -// * Tell the masterserver that the image upload finished. -// * -// * @param ftpUser the user that was used to upload -// * @param imageDescription the description of the uploaded image -// * @return if nothing went wrong -// * @throws ImageDataException if image was not submitted before -// * @throws AuthorizationException if no valid session exists -// */ -// public static boolean finishedUpload( String ftpUser, ImageData imageDescription ) throws ImageDataException -// { -// // check if user is valid -// synchronized ( App.ftpServer.users ) { -// if (!App.ftpServer.users.containsKey( ftpUser )) { -// throw new ImageDataException( ImageDataError.UNKNOWN_IMAGE, "Image with this data was not submitted before." ); -// } else { -// if ( App.ftpServer.users.get( ftpUser ).getMode() == MasterFtpServer.Mode.DOWNLOADING ) { -// throw new ImageDataException( ImageDataError.UNKNOWN_IMAGE, "Your were downloading and not uploading." ); -// } -// } -// } -// -// // process the image -// File userDirectory = new File( Globals.getPropertyString( Globals.PropString.FTPBASEDIR ) + "/" + ftpUser ); -// File[] list = userDirectory.listFiles(); -// -// if ( list == null || list.length != 1 ) { -// // user uploaded too many files -// return false; -// } -// -// log.info( ftpUser + " is done with upload" ); -// -// ImageProcessor.processImageAfterUpload( ftpUser, list[0].getName() ); -// -// // remove user that is not needed anymore -// App.ftpServer.removeUser( ftpUser ); -// log.info( "Removed user: " + ftpUser ); -// -// return true; -// } - -// public static FtpCredentials getImage( String uuid, String serverSessionId ) throws AuthorizationException, ImageDataException -// { -// if ( ServerSessionManager.getSession( serverSessionId ) == null ) { -// throw new AuthorizationException( AuthorizationError.NOT_AUTHENTICATED, "No valid serverSessionData" ); -// } -// -// // check if image exists -// DbImage image = DbImage.getImageByUUID( uuid ); -// -// if (image == null) throw new ImageDataException( ImageDataError.UNKNOWN_IMAGE, "No image found with uuid '" + uuid + "'"); -// -// FtpCredentials ftpCredentials = App.ftpServer.addUser( serverSessionId, MasterFtpServer.Mode.DOWNLOADING, new File(image.imagePath).getName() ); -// -// // TODO: what is happening here? -// if (ftpCredentials == null) return null; -// -// return ftpCredentials; -// } - -// public static boolean finishedDownload( String ftpUser ) -// { -// if ( !App.ftpServer.users.containsKey( ftpUser )) -// return false; -// -// log.info( "User: '" + ftpUser + "' finished download and gets deleted." ); -// -// // download is done, user can be removed now -// App.ftpServer.removeUser( ftpUser ); -// -// return true; -// } - } |