package org.openslx.imagemaster.thrift.server; import java.nio.ByteBuffer; import java.util.List; import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.imagemaster.server.ApiServer; import org.openslx.imagemaster.thrift.iface.AuthenticationException; import org.openslx.imagemaster.thrift.iface.AuthorizationException; import org.openslx.imagemaster.thrift.iface.DownloadInfos; import org.openslx.imagemaster.thrift.iface.ImageData; import org.openslx.imagemaster.thrift.iface.ImageDataException; import org.openslx.imagemaster.thrift.iface.ImageServer; import org.openslx.imagemaster.thrift.iface.InvalidTokenException; import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException; import org.openslx.imagemaster.thrift.iface.ServerSessionData; 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; public class ImageServerHandler implements ImageServer.Iface { private static Logger log = Logger.getLogger( ImageServerHandler.class ); @Override public boolean ping() throws TException { log.debug( "Ping..." ); // Return false if service unavailable but running return true; } @Override public SessionData authenticate( String username, String password ) throws AuthenticationException { return ApiServer.authenticate( username, password ); } @Override public UserInfo getUserFromToken( String token ) throws InvalidTokenException { return ApiServer.getUserFromToken( token ); } @Override public String startServerAuthentication( String organization ) throws ServerAuthenticationException { return ApiServer.startServerAuthentication( organization ); } @Override public ServerSessionData serverAuthenticate( String organization, ByteBuffer challengeResponse ) throws AuthenticationException, TException { return ApiServer.serverAuthenticate( organization, challengeResponse ); } @Override public UploadInfos submitImage( String serverSessionId, ImageData imageDescription, List crcSums ) throws AuthorizationException, ImageDataException, UploadException, TException { return ApiServer.submitImage( serverSessionId, imageDescription, crcSums ); } @Override public DownloadInfos getImage( String uuid, String serverSessionId, List requestedBlocks ) throws AuthorizationException, ImageDataException, TException { return ApiServer.getImage( uuid, serverSessionId, requestedBlocks ); } @Override public boolean isServerAuthenticated( String serverSessionId ) throws TException { return ApiServer.isServerAuthenticated( serverSessionId ); } }