diff options
author | Nils Schwabe | 2014-07-04 12:50:59 +0200 |
---|---|---|
committer | Nils Schwabe | 2014-07-04 12:50:59 +0200 |
commit | d1ab55e39b392e62ca1f1e41e3c70cf48d676885 (patch) | |
tree | 2fcf410f3a7ff4a3acae9ad5502fc933f8887e2c /src/main/java/org/openslx/imagemaster/server/ApiServer.java | |
parent | Fix that Globals are initialized before servers are starting up (diff) | |
download | masterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.tar.gz masterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.tar.xz masterserver-d1ab55e39b392e62ca1f1e41e3c70cf48d676885.zip |
Change handling of connections and add support for download
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/server/ApiServer.java')
-rw-r--r-- | src/main/java/org/openslx/imagemaster/server/ApiServer.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java index 8f8753d..2d50160 100644 --- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java +++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java @@ -1,8 +1,8 @@ package org.openslx.imagemaster.server; import java.nio.ByteBuffer; +import java.util.List; -import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.imagemaster.db.DbImage; import org.openslx.imagemaster.db.DbSatellite; @@ -31,7 +31,6 @@ import org.openslx.imagemaster.thrift.iface.SessionData; import org.openslx.imagemaster.thrift.iface.UploadException; import org.openslx.imagemaster.thrift.iface.UploadInfos; import org.openslx.imagemaster.thrift.iface.UserInfo; -import org.openslx.imagemaster.util.RandomString; /** * API Server This is where all the requests from the outside arrive. We don't @@ -129,7 +128,7 @@ public class ApiServer return ImageProcessor.getUploadInfos(serverSessionId, imageDescription); } - public static DownloadInfos getImage( String uuid, String serverSessionId ) throws AuthorizationException, ImageDataException + public static DownloadInfos getImage( String uuid, String serverSessionId, List<Integer> requestedBlocks ) throws AuthorizationException, ImageDataException { // first check session of server if ( ServerSessionManager.getSession( serverSessionId ) == null ) { @@ -140,10 +139,8 @@ public class ApiServer throw new ImageDataException( ImageDataError.UNKNOWN_IMAGE, "UUID is not known by this server." ); } - String path = DbImage.getImageByUUID( uuid ).imagePath; - - // TODO: init the updownloader class - return new DownloadInfos( RandomString.generate( 100, false ) ); + // then let the image processor decide what to do + return ImageProcessor.getDownloadInfos( serverSessionId, uuid, requestedBlocks ); } /** |