cz.geek.gdata.client
Class ServiceFactory

java.lang.Object
  extended by cz.geek.gdata.client.ServiceFactory

public class ServiceFactory
extends Object

Cache and auth factory

Author:
martin

Constructor Summary
ServiceFactory()
           
 
Method Summary
static
<T extends com.google.gdata.client.Service>
T
getService(T service, cz.geek.cache.Cache<String,CachedResponse> cache)
          Decorate given Service with caching
static
<T extends com.google.gdata.client.GoogleService>
T
getService(T service, cz.geek.cache.Cache<String,CachedResponse> cache, String authSubToken)
          Set session token and decorate with cache in one shot
static
<T extends com.google.gdata.client.GoogleService>
T
getService(T service, cz.geek.cache.Cache<String,CachedResponse> cache, String username, String password)
          Set auth info and decorate with cache in one shot
static
<T extends com.google.gdata.client.GoogleService>
T
getService(T service, String authSubToken)
          Set session token for given GoogleService
static
<T extends com.google.gdata.client.GoogleService>
T
getService(T service, String username, String password)
          Set authentication info for given GoogleService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceFactory

public ServiceFactory()
Method Detail

getService

public static <T extends com.google.gdata.client.GoogleService> T getService(T service,
                                                                             String username,
                                                                             String password)
                                                                  throws com.google.gdata.util.AuthenticationException
Set authentication info for given GoogleService

Type Parameters:
T - extends GoogleService
Parameters:
service - ordinary service
username - user name
password - user password
Returns:
authenticated service or original service if no auth info was specified
Throws:
com.google.gdata.util.AuthenticationException
See Also:
GoogleService.setUserCredentials(String, String)

getService

public static <T extends com.google.gdata.client.GoogleService> T getService(T service,
                                                                             String authSubToken)
                                                                  throws com.google.gdata.util.AuthenticationException
Set session token for given GoogleService

Type Parameters:
T - extends GoogleService
Parameters:
service - ordinary service
authSubToken - session token
Returns:
authenticated service
Throws:
com.google.gdata.util.AuthenticationException
See Also:
GoogleService.setAuthSubToken(String)

getService

public static <T extends com.google.gdata.client.Service> T getService(T service,
                                                                       cz.geek.cache.Cache<String,CachedResponse> cache)
Decorate given Service with caching

Type Parameters:
T - extends Service
Parameters:
service - ordinary service
cache - desired cache
Returns:
decorated cached service

getService

public static <T extends com.google.gdata.client.GoogleService> T getService(T service,
                                                                             cz.geek.cache.Cache<String,CachedResponse> cache,
                                                                             String username,
                                                                             String password)
                                                                  throws com.google.gdata.util.AuthenticationException
Set auth info and decorate with cache in one shot

Type Parameters:
T -
Parameters:
service - ordinary service
cache - desired cache
username - user name
password - user password
Returns:
decorated cached and authenticated service
Throws:
com.google.gdata.util.AuthenticationException
See Also:
getService(Service, Cache), getService(GoogleService, String, String)

getService

public static <T extends com.google.gdata.client.GoogleService> T getService(T service,
                                                                             cz.geek.cache.Cache<String,CachedResponse> cache,
                                                                             String authSubToken)
                                                                  throws com.google.gdata.util.AuthenticationException
Set session token and decorate with cache in one shot

Type Parameters:
T -
Parameters:
service - ordinary service
cache - desired cache
authSubToken - session token
Returns:
decorated cached and authenticated service
Throws:
com.google.gdata.util.AuthenticationException
See Also:
getService(Service, Cache), getService(GoogleService, String, String)


Copyright © 2010. All Rights Reserved.