Google Data APIs Client Library (1.41.1)



com.google.gdata.client
Class GoogleService

java.lang.Object
  extended by com.google.gdata.client.Service
      extended by com.google.gdata.client.GoogleService
All Implemented Interfaces:
AuthTokenFactory.TokenListener
Direct Known Subclasses:
AnalyticsService, AppsForYourDomainService, BloggerService, BooksService, CalendarService, CodeSearchService, ContactsService, FinanceService, H9Service, HealthService, MediaService, ProjectHostingService, SidewikiService, SpreadsheetService, WebmasterToolsService

public class GoogleService
extends Service
implements AuthTokenFactory.TokenListener

The GoogleService class extends the basic GData Service abstraction to add support for authentication and cookies.


Nested Class Summary
static class GoogleService.AccountDeletedException
          Authentication failed, account has been deleted.
static class GoogleService.AccountDisabledException
          Authentication failed, account has been disabled.
static class GoogleService.CaptchaRequiredException
          Authentication failed, CAPTCHA requires answering.
static class GoogleService.InvalidCredentialsException
          Authentication failed, invalid credentials presented to server.
static class GoogleService.NotVerifiedException
          Authentication failed, account has not been verified.
static class GoogleService.ServiceUnavailableException
          Authentication failed, authentication service not available.
static class GoogleService.SessionExpiredException
          Authentication failed, the token's session has expired.
static class GoogleService.TermsNotAgreedException
          Authentication failed, user did not agree to the terms of service.
 
Nested classes/interfaces inherited from class com.google.gdata.client.Service
Service.ClientInputProperties, Service.ClientOutputProperties, Service.ClientStreamProperties, Service.GDataRequest, Service.GDataRequestFactory, Service.Versions
 
Field Summary
 
Fields inherited from class com.google.gdata.client.Service
connectTimeout, extProfile, metadataRegistry, requestFactory
 
Constructor Summary
GoogleService(java.lang.String applicationName, Service.GDataRequestFactory requestFactory, AuthTokenFactory authTokenFactory)
          Constructs a GoogleService instance connecting to the service for an application with the name applicationName.
GoogleService(java.lang.String serviceName, java.lang.String applicationName)
          Constructs a GoogleService instance connecting to the service with name serviceName for an application with the name applicationName.
GoogleService(java.lang.String serviceName, java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
          Constructs a GoogleService instance connecting to the service with name serviceName for an application with the name applicationName.
 
Method Summary
 void addCookie(GoogleGDataRequest.GoogleCookie cookie)
          Adds a new GoogleCookie instance to the cache.
<F extends IFeed>
F
batch(java.net.URL feedUrl, F inputFeed)
          Executes several operations (insert, update or delete) on the entries that are part of the input IFeed.
protected  Service.GDataRequest createRequest(Query query, ContentType contentType)
          Creates a new GDataRequest for querying the service.
 Service.GDataRequest createRequest(Service.GDataRequest.RequestType type, java.net.URL requestUrl, ContentType contentType)
          Creates a new GDataRequest for use by the service.
 void delete(java.net.URL entryUrl)
          Deletes an existing entry (and associated media content, if any) using the specified edit URL.
 void delete(java.net.URL entryUrl, java.lang.String etag)
          Deletes an existing entry (and associated media content, if any) using the specified edit URL.
 java.lang.String getAuthToken(java.lang.String username, java.lang.String password, java.lang.String captchaToken, java.lang.String captchaAnswer, java.lang.String serviceName, java.lang.String applicationName)
          Retrieves the authentication token for the provided set of credentials.
 AuthTokenFactory getAuthTokenFactory()
          Returns the AuthTokenFactory currently associated with the service.
 CookieManager getCookieManager()
          Returns the CookieManager currently associated with the service.
 java.util.Set<GoogleGDataRequest.GoogleCookie> getCookies()
          Returns the set of associated cookies returned by previous requests.
<E extends IEntry>
E
getEntry(java.net.URL entryUrl, java.lang.Class<E> entryClass, DateTime ifModifiedSince)
          Returns an Atom entry instance, given the URL of the entry and an if-modified-since date.
<E extends IEntry>
E
getEntry(java.net.URL entryUrl, java.lang.Class<E> entryClass, java.lang.String etag)
          Returns an Atom entry instance given the URL of the entry, if its current entity tag is different than the provided value.
<F extends IFeed>
F
getFeed(Query query, java.lang.Class<F> feedClass, DateTime ifModifiedSince)
          Returns the Feed resulting from executing a query, if it's been modified since the specified date.
<F extends IFeed>
F
getFeed(Query query, java.lang.Class<F> feedClass, java.lang.String etag)
          Returns the Feed resulting from query execution, if if the entity tag associated with it has changed.
<F extends IFeed>
F
getFeed(java.net.URL feedUrl, java.lang.Class<F> feedClass, DateTime ifModifiedSince)
          Returns the Feed associated with a particular feed URL, if it's been modified since the specified date.
<F extends IFeed>
F
getFeed(java.net.URL feedUrl, java.lang.Class<F> feedClass, java.lang.String etag)
          Returns the Feed associated with a particular feed URL if the entity tag associated with it has changed.
protected  java.net.URL handleRedirectException(RedirectRequiredException redirect)
          Handles a redirect exception by generating the new URL to use for the redirect.
 boolean handlesCookies()
          Returns true if the GoogleService is handling cookies.
protected  void handleSessionExpiredException(GoogleService.SessionExpiredException e)
          Delegates session expired exception to AuthTokenFactory.
<E extends IEntry>
E
insert(java.net.URL feedUrl, E entry)
          Inserts a new IEntry into a feed associated with the target service.
static java.lang.String makePostRequest(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> parameters)
          Makes a HTTP POST request to the provided url given the provided parameters.
 void setAuthSubToken(java.lang.String token)
          Sets the AuthSub token to be used to authenticate a user.
 void setAuthSubToken(java.lang.String token, java.security.PrivateKey key)
          Sets the AuthSub token to be used to authenticate a user.
 void setAuthTokenFactory(AuthTokenFactory authTokenFactory)
          Sets the AuthTokenFactory currently associated with the service.
 void setCookieManager(CookieManager cookieManager)
          Sets the CookieManager currently associated with the service.
 void setHandlesCookies(boolean handlesCookies)
          Enables or disables cookie handling.
 void setOAuthCredentials(OAuthParameters parameters, OAuthSigner signer)
          Sets the OAuth credentials used to generate the authorization header.
 void setUserCredentials(java.lang.String username, java.lang.String password)
          Sets the credentials of the user to authenticate requests to the server.
 void setUserCredentials(java.lang.String username, java.lang.String password, ClientLoginAccountType accountType)
          Sets the credentials of the user to authenticate requests to the server.
 void setUserCredentials(java.lang.String username, java.lang.String password, java.lang.String captchaToken, java.lang.String captchaAnswer)
          Sets the credentials of the user to authenticate requests to the server.
 void setUserCredentials(java.lang.String username, java.lang.String password, java.lang.String captchaToken, java.lang.String captchaAnswer, ClientLoginAccountType accountType)
          Sets the credentials of the user to authenticate requests to the server.
 void setUserToken(java.lang.String token)
          Sets the AuthToken that should be used to authenticate requests to the server.
 void tokenChanged(AuthTokenFactory.AuthToken newToken)
           
<E extends IEntry>
E
update(java.net.URL entryUrl, E entry)
          Updates an existing IEntry by writing it to the specified entry edit URL.
 
Methods inherited from class com.google.gdata.client.Service
classOf, createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, endVersionScope, getAltRegistry, getContentType, getDefaultAltRegistry, getEntry, getExtensionProfile, getFeed, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getVersion, initServiceVersion, introspect, parseResponseData, parseResponseData, patch, patch, query, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setTimeouts, startVersionScope, update, useSsl, writeRequestData, writeRequestData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoogleService

public GoogleService(java.lang.String serviceName,
                     java.lang.String applicationName)
Constructs a GoogleService instance connecting to the service with name serviceName for an application with the name applicationName. The default domain (www.google.com) and the default Google authentication methods will be used to authenticate. A simple cookie manager is used.

Parameters:
serviceName - the name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger)
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.

GoogleService

public GoogleService(java.lang.String serviceName,
                     java.lang.String applicationName,
                     java.lang.String protocol,
                     java.lang.String domainName)
Constructs a GoogleService instance connecting to the service with name serviceName for an application with the name applicationName. The service will authenticate at the provided domainName. The default Google authentication methods will be used to authenticate. A simple cookie manager is used.

Parameters:
serviceName - the name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger)
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.
protocol - name of protocol to use for authentication ("http"/"https")
domainName - the name of the domain hosting the login handler

GoogleService

public GoogleService(java.lang.String applicationName,
                     Service.GDataRequestFactory requestFactory,
                     AuthTokenFactory authTokenFactory)
Constructs a GoogleService instance connecting to the service for an application with the name applicationName. The provided GDataRequestFactory will create requests, and the given AuthTokenFactory will be used to generate auth tokens. A simple cookie manager is used.

Parameters:
applicationName - the name of the client application accessing the service. Application names should preferably have the format [company-id]-[app-name]-[app-version]. The name will be used by the Google servers to monitor the source of authentication.
requestFactory - the request factory that generates gdata requests
authTokenFactory - the auth token factory that generates auth tokens
Method Detail

getAuthTokenFactory

public AuthTokenFactory getAuthTokenFactory()
Returns the AuthTokenFactory currently associated with the service.


setAuthTokenFactory

public void setAuthTokenFactory(AuthTokenFactory authTokenFactory)
Sets the AuthTokenFactory currently associated with the service.

Parameters:
authTokenFactory - Authentication factory

getCookieManager

public CookieManager getCookieManager()
Returns the CookieManager currently associated with the service.


setCookieManager

public void setCookieManager(CookieManager cookieManager)
Sets the CookieManager currently associated with the service.

Parameters:
cookieManager - Cookie manager

tokenChanged

public void tokenChanged(AuthTokenFactory.AuthToken newToken)
Specified by:
tokenChanged in interface AuthTokenFactory.TokenListener

setUserCredentials

public void setUserCredentials(java.lang.String username,
                               java.lang.String password)
                        throws AuthenticationException
Sets the credentials of the user to authenticate requests to the server.

Parameters:
username - the name of the user (an email address)
password - the password of the user
Throws:
AuthenticationException - if authentication failed.

setUserCredentials

public void setUserCredentials(java.lang.String username,
                               java.lang.String password,
                               ClientLoginAccountType accountType)
                        throws AuthenticationException
Sets the credentials of the user to authenticate requests to the server.

Parameters:
username - the name of the user (an email address)
password - the password of the user
accountType - the account type: HOSTED, GOOGLE, or HOSTED_OR_GOOGLE
Throws:
AuthenticationException - if authentication failed.

setUserCredentials

public void setUserCredentials(java.lang.String username,
                               java.lang.String password,
                               java.lang.String captchaToken,
                               java.lang.String captchaAnswer)
                        throws AuthenticationException
Sets the credentials of the user to authenticate requests to the server. A CAPTCHA token and a CAPTCHA answer can also be optionally provided to authenticate when the authentication server requires that a CAPTCHA be answered.

Parameters:
username - the name of the user (an email id)
password - the password of the user
captchaToken - the CAPTCHA token issued by the server
captchaAnswer - the answer to the respective CAPTCHA token
Throws:
AuthenticationException - if authentication failed

setUserCredentials

public void setUserCredentials(java.lang.String username,
                               java.lang.String password,
                               java.lang.String captchaToken,
                               java.lang.String captchaAnswer,
                               ClientLoginAccountType accountType)
                        throws AuthenticationException
Sets the credentials of the user to authenticate requests to the server. A CAPTCHA token and a CAPTCHA answer can also be optionally provided to authenticate when the authentication server requires that a CAPTCHA be answered.

Parameters:
username - the name of the user (an email id)
password - the password of the user
captchaToken - the CAPTCHA token issued by the server
captchaAnswer - the answer to the respective CAPTCHA token
accountType - the account type: HOSTED, GOOGLE, or HOSTED_OR_GOOGLE
Throws:
AuthenticationException - if authentication failed

setUserToken

public void setUserToken(java.lang.String token)
Sets the AuthToken that should be used to authenticate requests to the server. This is useful if the caller has some other way of accessing the AuthToken, versus calling getAuthToken with credentials to request the AuthToken using ClientLogin.

Parameters:
token - the AuthToken in ascii form

setOAuthCredentials

public void setOAuthCredentials(OAuthParameters parameters,
                                OAuthSigner signer)
                         throws OAuthException
Sets the OAuth credentials used to generate the authorization header. This header needs to be set per request, as it depends on the request url. The following OAuth parameters are required:

Parameters:
parameters - the OAuth parameters to use to generated the header
signer - the signing method to use for signing the header
Throws:
OAuthException

setAuthSubToken

public void setAuthSubToken(java.lang.String token)
Sets the AuthSub token to be used to authenticate a user.

Parameters:
token - the AuthSub token retrieved from Google

setAuthSubToken

public void setAuthSubToken(java.lang.String token,
                            java.security.PrivateKey key)
Sets the AuthSub token to be used to authenticate a user. The token will be used in secure-mode, and the provided private key will be used to sign all requests.

Parameters:
token - the AuthSub token retrieved from Google
key - the private key to be used to sign all requests

getAuthToken

public java.lang.String getAuthToken(java.lang.String username,
                                     java.lang.String password,
                                     java.lang.String captchaToken,
                                     java.lang.String captchaAnswer,
                                     java.lang.String serviceName,
                                     java.lang.String applicationName)
                              throws AuthenticationException
Retrieves the authentication token for the provided set of credentials.

Parameters:
username - the name of the user (an email address)
password - the password of the user
captchaToken - the CAPTCHA token if CAPTCHA is required (Optional)
captchaAnswer - the respective answer of the CAPTCHA token (Optional)
serviceName - the name of the service to which a token is required
applicationName - the application requesting the token
Returns:
the token
Throws:
AuthenticationException - if authentication failed

makePostRequest

public static java.lang.String makePostRequest(java.net.URL url,
                                               java.util.Map<java.lang.String,java.lang.String> parameters)
                                        throws java.io.IOException
Makes a HTTP POST request to the provided url given the provided parameters. It returns the output from the POST handler as a String object.

Parameters:
url - the URL to post the request
parameters - the parameters to post to the handler
Returns:
the output from the handler
Throws:
java.io.IOException - if an I/O exception occurs while creating, writing, or reading the request

setHandlesCookies

public void setHandlesCookies(boolean handlesCookies)
Enables or disables cookie handling.


handlesCookies

public boolean handlesCookies()
Returns true if the GoogleService is handling cookies.


addCookie

public void addCookie(GoogleGDataRequest.GoogleCookie cookie)
Adds a new GoogleCookie instance to the cache.


getCookies

public java.util.Set<GoogleGDataRequest.GoogleCookie> getCookies()
Returns the set of associated cookies returned by previous requests.


createRequest

public Service.GDataRequest createRequest(Service.GDataRequest.RequestType type,
                                          java.net.URL requestUrl,
                                          ContentType contentType)
                                   throws java.io.IOException,
                                          ServiceException
Description copied from class: Service
Creates a new GDataRequest for use by the service.

Clients should be sure to call Service.GDataRequest.end() on the returned request once they have finished using it.

Overrides:
createRequest in class Service
Throws:
java.io.IOException
ServiceException

createRequest

protected Service.GDataRequest createRequest(Query query,
                                             ContentType contentType)
                                      throws java.io.IOException,
                                             ServiceException
Description copied from class: Service
Creates a new GDataRequest for querying the service.

Clients should be sure to call Service.GDataRequest.end() on the returned request once they have finished using it.

Overrides:
createRequest in class Service
Throws:
java.io.IOException
ServiceException

getEntry

public <E extends IEntry> E getEntry(java.net.URL entryUrl,
                                     java.lang.Class<E> entryClass,
                                     DateTime ifModifiedSince)
                          throws java.io.IOException,
                                 ServiceException
Description copied from class: Service
Returns an Atom entry instance, given the URL of the entry and an if-modified-since date.

Overrides:
getEntry in class Service
Parameters:
entryUrl - resource URL for the entry.
entryClass - class used to represent service entries, not null.
ifModifiedSince - used to set a precondition date that indicates the entry should be returned only if it has been modified after the specified date. A value of null indicates no precondition.
Returns:
the entry referenced by the URL parameter.
Throws:
java.io.IOException - error communicating with the GData service.
NotModifiedException - if the entry resource has not been modified after the specified precondition date.
ParseException - error parsing the returned entry.
ResourceNotFoundException - if the entry URL is not valid.
ServiceForbiddenException - if the GData service cannot get the entry resource due to access constraints.
ServiceException - if a system error occurred when retrieving the entry.

getEntry

public <E extends IEntry> E getEntry(java.net.URL entryUrl,
                                     java.lang.Class<E> entryClass,
                                     java.lang.String etag)
                          throws java.io.IOException,
                                 ServiceException
Description copied from class: Service
Returns an Atom entry instance given the URL of the entry, if its current entity tag is different than the provided value.

Overrides:
getEntry in class Service
Parameters:
entryUrl - resource URL for the entry.
entryClass - class used to represent service entries, not null.
etag - used to provide an entity tag that indicates the entry should be returned only if the entity tag of the current representation is different from the provided value. A value of null indicates unconditional return.
Throws:
java.io.IOException - error communicating with the GData service.
NotModifiedException - if the entry resource entity tag matches the provided value.
ParseException - error parsing the returned entry.
ResourceNotFoundException - if the entry URL is not valid.
ServiceForbiddenException - if the GData service cannot get the entry resource due to access constraints.
ServiceException - if a system error occurred when retrieving the entry.

update

public <E extends IEntry> E update(java.net.URL entryUrl,
                                   E entry)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Updates an existing IEntry by writing it to the specified entry edit URL. The resulting Entry (after update) will be returned.

Overrides:
update in class Service
Parameters:
entryUrl - the edit URL associated with the entry.
entry - the modified Entry to be written to the server.
Returns:
the updated Entry returned by the service.
Throws:
java.io.IOException - error communicating with the GData service.
ParseException - error parsing the updated entry data.
ServiceException - update request failed due to system error.
See Also:
IEntry.getEditLink()

insert

public <E extends IEntry> E insert(java.net.URL feedUrl,
                                   E entry)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Inserts a new IEntry into a feed associated with the target service. It will return the inserted entry, including any additional attributes or extensions set by the GData server.

Overrides:
insert in class Service
Parameters:
feedUrl - the POST URI associated with the target feed.
entry - the new entry to insert into the feed.
Returns:
the newly inserted Entry returned by the service.
Throws:
java.io.IOException - error communicating with the GData service.
ParseException - error parsing the return entry data.
ServiceForbiddenException - the inserted Entry has associated media content and can only be inserted using a media service.
ServiceException - insert request failed due to system error.
See Also:
IFeed.getEntryPostLink()

getFeed

public <F extends IFeed> F getFeed(java.net.URL feedUrl,
                                   java.lang.Class<F> feedClass,
                                   DateTime ifModifiedSince)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Returns the Feed associated with a particular feed URL, if it's been modified since the specified date.

Overrides:
getFeed in class Service
Parameters:
feedUrl - the URL associated with a feed. This URL can include GData query parameters.
feedClass - the class used to represent a service Feed.
ifModifiedSince - used to set a precondition date that indicates the feed should be returned only if it has been modified after the specified date. A value of null indicates no precondition.
Returns:
Feed resource referenced by the input URL.
Throws:
java.io.IOException - error sending request or reading the feed.
NotModifiedException - if the feed resource has not been modified since the specified precondition date.
ParseException - error parsing the returned feed data.
ResourceNotFoundException - invalid feed URL.
ServiceException - system error retrieving feed.

getFeed

public <F extends IFeed> F getFeed(java.net.URL feedUrl,
                                   java.lang.Class<F> feedClass,
                                   java.lang.String etag)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Returns the Feed associated with a particular feed URL if the entity tag associated with it has changed.

Overrides:
getFeed in class Service
Parameters:
feedUrl - the URL associated with a feed. This URL can include GData query parameters.
feedClass - the class used to represent a service Feed.
etag - used to provide an entity tag that indicates the feed should be returned only if the entity tag of the current representation is different from the provided value. A value of null indicates unconditional return.
Throws:
java.io.IOException - error sending request or reading the feed.
NotModifiedException - if the feed resource entity tag matches the provided value.
ParseException - error parsing the returned feed data.
ResourceNotFoundException - invalid feed URL.
ServiceException - system error retrieving feed.

getFeed

public <F extends IFeed> F getFeed(Query query,
                                   java.lang.Class<F> feedClass,
                                   DateTime ifModifiedSince)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Returns the Feed resulting from executing a query, if it's been modified since the specified date.

Overrides:
getFeed in class Service
Parameters:
query - feed query.
feedClass - the class used to represent a service Feed.
ifModifiedSince - used to set a precondition date that indicates the feed should be returned only if it has been modified after the specified date. A value of null indicates no precondition.
Returns:
Feed resource referenced by the input URL.
Throws:
java.io.IOException - error sending request or reading the feed.
ServiceException - system error retrieving feed.

getFeed

public <F extends IFeed> F getFeed(Query query,
                                   java.lang.Class<F> feedClass,
                                   java.lang.String etag)
                        throws java.io.IOException,
                               ServiceException
Description copied from class: Service
Returns the Feed resulting from query execution, if if the entity tag associated with it has changed.

Overrides:
getFeed in class Service
Parameters:
query - feed query.
feedClass - the class used to represent query results.
etag - used to provide an entity tag that indicates the feed should be returned only if the entity tag of the current representation is different from the provided value. A value of null indicates unconditional return.
Throws:
java.io.IOException - error sending request or reading the feed.
NotModifiedException - if the feed resource entity tag matches the provided value.
ParseException - error parsing the returned feed data.
ResourceNotFoundException - invalid feed URL.
ServiceException - system error retrieving feed.

delete

public void delete(java.net.URL entryUrl)
            throws java.io.IOException,
                   ServiceException
Description copied from class: Service
Deletes an existing entry (and associated media content, if any) using the specified edit URL.

Overrides:
delete in class Service
Parameters:
entryUrl - the edit or medit edit url associated with the resource.
Throws:
java.io.IOException - error communicating with the GData service.
ResourceNotFoundException - invalid entry URL.
ServiceException - delete request failed due to system error.

delete

public void delete(java.net.URL entryUrl,
                   java.lang.String etag)
            throws java.io.IOException,
                   ServiceException
Description copied from class: Service
Deletes an existing entry (and associated media content, if any) using the specified edit URL. This delete is conditional upon the provided tag matching the current entity tag for the entry. If (and only if) they match, the deletion will be performed.

Overrides:
delete in class Service
Parameters:
entryUrl - the edit or medit edit url associated with the resource.
etag - the entity tag value that is the expected value for the target resource. A value of null will not set an etag precondition and a value of "*" will perform an unconditional delete.
Throws:
java.io.IOException - error communicating with the GData service.
ResourceNotFoundException - invalid entry URL.
ServiceException - delete request failed due to system error.

handleRedirectException

protected java.net.URL handleRedirectException(RedirectRequiredException redirect)
                                        throws ServiceException
Handles a redirect exception by generating the new URL to use for the redirect.

Throws:
ServiceException

handleSessionExpiredException

protected void handleSessionExpiredException(GoogleService.SessionExpiredException e)
                                      throws ServiceException
Delegates session expired exception to AuthTokenFactory.

Throws:
ServiceException

batch

public <F extends IFeed> F batch(java.net.URL feedUrl,
                                 F inputFeed)
                      throws java.io.IOException,
                             ServiceException,
                             BatchInterruptedException
Executes several operations (insert, update or delete) on the entries that are part of the input IFeed. It will return another feed that describes what was done while executing these operations. It is possible for one batch operation to fail even though other operations have worked, so this method won't throw a ServiceException unless something really wrong is going on. You need to check the entries in the returned feed to know which operations succeeded and which operations failed (see BatchStatus and BatchInterrupted extensions.)

Overrides:
batch in class Service
Parameters:
feedUrl - the POST URI associated with the target feed.
inputFeed - a description of the operations to execute, described using tags in the batch: namespace
Returns:
a feed with the result of each operation in a separate entry
Throws:
java.io.IOException - error communicating with the GData service.
ParseException - error parsing the return entry data.
ServiceException - insert request failed due to system error.
BatchInterruptedException - if something really wrong was detected by the server while parsing the request, like invalid XML data. Some operations might have succeeded when this exception is thrown. Check BatchInterruptedException.getIFeed().
See Also:
IFeed.getEntryPostLink()