diff options
author | Simon Rettberg | 2015-06-11 18:40:49 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-06-11 18:40:49 +0200 |
commit | e0005ceecfd9281230c4add7575b18ee88307774 (patch) | |
tree | a73bbcfc213df478c701aac120ae2b7c6e52bb1b /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | |
parent | [server] db stuff, new interface, ... (diff) | |
download | tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.tar.gz tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.tar.xz tutor-module-e0005ceecfd9281230c4add7575b18ee88307774.zip |
[server] On mah way (lots of restructuring, some early db classes, sql dump of current schema)
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java | 214 |
1 files changed, 214 insertions, 0 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java new file mode 100644 index 00000000..cf26b510 --- /dev/null +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/ServerHandler.java @@ -0,0 +1,214 @@ +package org.openslx.bwlp.sat.thrift; + +import java.nio.ByteBuffer; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.apache.thrift.TException; +import org.openslx.bwlp.sat.database.mappers.DbImage; +import org.openslx.bwlp.sat.fileserv.ActiveUpload; +import org.openslx.bwlp.sat.fileserv.FileServer; +import org.openslx.bwlp.sat.thrift.cache.OperatingSystemList; +import org.openslx.bwlp.thrift.iface.ImageBaseWrite; +import org.openslx.bwlp.thrift.iface.ImageDetailsRead; +import org.openslx.bwlp.thrift.iface.ImagePermissions; +import org.openslx.bwlp.thrift.iface.ImageSummaryRead; +import org.openslx.bwlp.thrift.iface.ImageVersionWrite; +import org.openslx.bwlp.thrift.iface.LecturePermissions; +import org.openslx.bwlp.thrift.iface.LectureRead; +import org.openslx.bwlp.thrift.iface.LectureSummary; +import org.openslx.bwlp.thrift.iface.LectureWrite; +import org.openslx.bwlp.thrift.iface.OperatingSystem; +import org.openslx.bwlp.thrift.iface.Organization; +import org.openslx.bwlp.thrift.iface.SatelliteServer; +import org.openslx.bwlp.thrift.iface.TAuthorizationException; +import org.openslx.bwlp.thrift.iface.TInvalidTokenException; +import org.openslx.bwlp.thrift.iface.TNotFoundException; +import org.openslx.bwlp.thrift.iface.TTransferRejectedException; +import org.openslx.bwlp.thrift.iface.TransferInformation; +import org.openslx.bwlp.thrift.iface.UploadStatus; +import org.openslx.bwlp.thrift.iface.UserInfo; +import org.openslx.bwlp.thrift.iface.Virtualizer; +import org.openslx.sat.thrift.version.Version; + +public class ServerHandler implements SatelliteServer.Iface { + + private static final Logger log = Logger.getLogger(ServerHandler.class); + + private static final FileServer fileServer = FileServer.instance(); + + @Override + public long getVersion() throws TException { + return Version.VERSION; + } + + @Override + public TransferInformation requestImageVersionUpload(String userToken, String imageBaseId, long fileSize, + List<ByteBuffer> blockHashes) throws TTransferRejectedException, TAuthorizationException, + TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void cancelUpload(String uploadToken) throws TException { + ActiveUpload upload = fileServer.getUploadByToken(uploadToken); + if (upload != null) + upload.cancel(); + + } + + @Override + public UploadStatus queryUploadStatus(String uploadToken) throws TInvalidTokenException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public TransferInformation requestDownload(String userToken, String imageVersionId) + throws TAuthorizationException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void cancelDownload(String downloadToken) throws TException { + // TODO Auto-generated method stub + + } + + @Override + public boolean isAuthenticated(String userToken) throws TException { + return SessionManager.get(userToken) != null; + } + + @Override + public void invalidateSession(String userToken) throws TException { + SessionManager.remove(userToken); + } + + @Override + public List<OperatingSystem> getOperatingSystems() throws TException { + return OperatingSystemList.get(); + } + + @Override + public List<Virtualizer> getVirtualizers() throws TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public List<Organization> getAllOrganizations() throws TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public List<ImageSummaryRead> getImageList(String userToken, List<String> tagSearch) + throws TAuthorizationException, TException { + UserInfo user = SessionManager.getOrFail(userToken); + return DbImage.getAllVisible(user, tagSearch); + } + + @Override + public ImageDetailsRead getImageDetails(String userToken, String imageBaseId) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean updateImageBase(String userToken, String imageBaseId, ImageBaseWrite image) + throws TAuthorizationException, TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updateImageVersion(String userToken, String imageVersionId, ImageVersionWrite image) + throws TAuthorizationException, TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deleteImageVersion(String userToken, String imageVersionId) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean writeImagePermissions(String userToken, String imageId, + Map<String, ImagePermissions> permissions) throws TAuthorizationException, TNotFoundException, + TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map<String, ImagePermissions> getImagePermissions(String userToken, String imageBaseId) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String createLecture(String userToken, LectureWrite lecture) throws TAuthorizationException, + TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean updateLecture(String userToken, String lectureId, LectureWrite lecture) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public List<LectureSummary> getLectureList(String userToken) throws TAuthorizationException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public LectureRead getLectureDetails(String userToken, String lectureId) throws TAuthorizationException, + TNotFoundException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public List<LectureSummary> getLecturesByImageVersion(String userToken, String imageVersionId) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean deleteLecture(String userToken, String lectureId) throws TAuthorizationException, + TNotFoundException, TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean writeLecturePermissions(String userToken, String lectureId, + Map<String, LecturePermissions> permissions) throws TAuthorizationException, TNotFoundException, + TException { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map<String, LecturePermissions> getLecturePermissions(String userToken, String lectureId) + throws TAuthorizationException, TNotFoundException, TException { + // TODO Auto-generated method stub + return null; + } + +}// end class |