summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/thrift/server/ImageServerHandler.java
blob: ad3a57dd85ce9980dc65421d81d0a648f5a92d18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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<Integer> crcSums ) throws AuthorizationException, ImageDataException, UploadException, TException
	{
		return ApiServer.submitImage( serverSessionId, imageDescription, crcSums );
	}

	@Override
	public DownloadInfos getImage( String uuid, String serverSessionId, List<Integer> requestedBlocks ) throws AuthorizationException, ImageDataException, TException
	{
		return ApiServer.getImage( uuid, serverSessionId, requestedBlocks );
	}

	@Override
	public boolean isServerAuthenticated( String serverSessionId ) throws TException
	{
		return ApiServer.isServerAuthenticated( serverSessionId );
	}
}