public class

GoogleBaseService

extends MediaService
java.lang.Object
   ↳ com.google.gdata.client.Service
     ↳ com.google.gdata.client.GoogleService
       ↳ com.google.gdata.client.media.MediaService
         ↳ com.google.api.gbase.client.GoogleBaseService

Class Overview

Creates a Google data service with extensions specific to Google Base. The methods returning Atom feeds and entries in this class default to returning instances of GoogleBaseFeed and GoogleBaseEntry.

Usage example

 GoogleBaseService service = new GoogleBaseService("mycompany-myapp-1.0");
 service.setUserCredentials(username, password);
 GoogleBaseQuery query = new GoogleBaseQuery(...);
 query.setGoogleBaseQuery(...);
 GoogleBaseFeed feed = service.query(query);
 

Summary

Nested Classes
class GoogleBaseService.Versions The Versions class contains all released versions of the Google Base API  
Constants
String GOOGLE_BASE_SERVICE The official name of the service.
[Expand]
Inherited Constants
From class com.google.gdata.client.media.MediaService
Fields
public static final Version DEFAULT_VERSION Version 1 is the current default version for GoogleBaseService.
public static final String GOOGLE_BASE_SERVICE_VERSION Version of this service.
protected String application Name of the application passed to the constructor.
[Expand]
Inherited Fields
From class com.google.gdata.client.media.MediaService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
Public Constructors
GoogleBaseService(String applicationName)
Creates a GoogleBaseService connecting to the default authentication domain (www.google.com) using the HTTPS.
GoogleBaseService(String applicationName, String developerKey)
Creates a GoogleBaseService connecting to the default authentication domain (www.google.com) using the HTTPS.
GoogleBaseService(String applicationName, String protocol, String domainName)
Creates a GoogleBaseService connecting to a specific authentication domain using a specific protocol.
GoogleBaseService(String applicationName, String developerKey, String protocol, String domainName)
Creates a GoogleBaseService connecting to a specific authentication domain using a specific protocol.
Public Methods
<F extends IFeed> F batch(URL url, F f)
Executes several operations (insert, update or delete) on the entries that are part of the input IFeed.
GoogleBaseEntry getEntry(URL entryUrl)
Returns an Google Base entry instance, given the URL of the entry.
GoogleBaseEntry getEntry(URL entryUrl, DateTime ifModifiedSince)
Returns an Google Base entry instance, given the URL of the entry and an if-modified-since date.
GoogleBaseFeed getFeed(URL feedUrl)
Returns the Google base feed associated with a particular feed URL.
GoogleBaseFeed getFeed(URL feedUrl, DateTime ifModifiedSince)
Returns the Google Base feed associated with a particular feed URL, if it's been modified since the specified date.
GoogleBaseMediaEntry getMediaEntry(URL entryUrl, DateTime ifModifiedSince)
Returns the media entry referenced by the entryUrl, if it's been modified since the specified date.
GoogleBaseMediaEntry getMediaEntry(URL entryUrl)
Returns the media entry referenced by the entryUrl.
GoogleBaseMediaFeed getMediaFeed(URL feedUrl, DateTime ifModifiedSince)
Returns the Google Base media feed associated with a particular feed URL, if it's been modified since the specified date.
GoogleBaseMediaFeed getMediaFeed(URL feedUrl)
Returns the Google base media feed associated with the specified feed URL.
String getServiceVersion()
Returns the google base service version followed by the gdata service version.
<E extends IEntry> E insert(URL url, E e)
Inserts a new Entry into a feed associated with the target service.
GoogleBaseFeed query(Query query)
Executes a GData query against the target service and returns the Feed containing entries that match the query result.
GoogleBaseFeed query(Query query, DateTime ifModifiedSince)
Executes a GData query against the target service and returns the GoogleBaseFeed containing entries that match the query result, if it's been modified since the specified date.
<E extends IEntry> E update(URL url, E e)
Updates an existing entry metadata by writing it to the specified edit URL.
[Expand]
Inherited Methods
From class com.google.gdata.client.media.MediaService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
From class java.lang.Object
From interface com.google.gdata.client.AuthTokenFactory.TokenListener

Constants

public static final String GOOGLE_BASE_SERVICE

The official name of the service.

Constant Value: "gbase"

Fields

public static final Version DEFAULT_VERSION

Version 1 is the current default version for GoogleBaseService.

public static final String GOOGLE_BASE_SERVICE_VERSION

Version of this service.

protected String application

Name of the application passed to the constructor.

Public Constructors

public GoogleBaseService (String applicationName)

Creates a GoogleBaseService connecting to the default authentication domain (www.google.com) using the HTTPS.

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.

public GoogleBaseService (String applicationName, String developerKey)

Creates a GoogleBaseService connecting to the default authentication domain (www.google.com) using the HTTPS.

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.
developerKey Developer key (ignored)

public GoogleBaseService (String applicationName, String protocol, String domainName)

Creates a GoogleBaseService connecting to a specific authentication domain using a specific protocol.

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.
protocol Name of protocol to use for authentication ("http"/"https")
domainName The name of the domain hosting the login handler

public GoogleBaseService (String applicationName, String developerKey, String protocol, String domainName)

Creates a GoogleBaseService connecting to a specific authentication domain using a specific protocol.

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.
developerKey Developer key (ignored)
protocol Name of protocol to use for authentication ("http"/"https")
domainName The name of the domain hosting the login handler

Public Methods

public F batch (URL url, F f)

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.)

Parameters
url The POST URI associated with the target feed.
f 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

public GoogleBaseEntry getEntry (URL entryUrl)

Returns an Google Base entry instance, given the URL of the entry.

Parameters
entryUrl Resource URL for the entry.
Returns
  • the entry referenced by the URL parameter.
Throws
IOException error communicating with the GData service.
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.

public GoogleBaseEntry getEntry (URL entryUrl, DateTime ifModifiedSince)

Returns an Google Base entry instance, given the URL of the entry and an if-modified-since date.

Parameters
entryUrl Resource URL for the entry.
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
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.

public GoogleBaseFeed getFeed (URL feedUrl)

Returns the Google base feed associated with a particular feed URL.

Parameters
feedUrl The URL associated with a feed. This URL can include GData query parameters.
Returns
  • Feed resource referenced by the input URL.
Throws
IOException error sending request or reading the feed.
ParseException error parsing the returned feed data.
ResourceNotFoundException invalid feed URL.
ServiceException system error retrieving feed.

public GoogleBaseFeed getFeed (URL feedUrl, DateTime ifModifiedSince)

Returns the Google Base feed associated with a particular feed URL, if it's been modified since the specified date.

Parameters
feedUrl The URL associated with a feed. This URL can include GData query parameters.
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
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.

public GoogleBaseMediaEntry getMediaEntry (URL entryUrl, DateTime ifModifiedSince)

Returns the media entry referenced by the entryUrl, if it's been modified since the specified date.

Parameters
entryUrl The url to the media entry.
ifModifiedSince
Returns
  • a media entry object representing the meta-data for the referenced media object (item image or attachment).
Throws
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

public GoogleBaseMediaEntry getMediaEntry (URL entryUrl)

Returns the media entry referenced by the entryUrl. If the URL is not pointing to a media entry, an exception will be thrown.

Parameters
entryUrl The url to the media entry.
Returns
  • a media entry object representing the meta-data for the referenced media object (item image or attachment).
Throws
IOException error communicating with the GData service.
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

public GoogleBaseMediaFeed getMediaFeed (URL feedUrl, DateTime ifModifiedSince)

Returns the Google Base media feed associated with a particular feed URL, if it's been modified since the specified date.

Parameters
feedUrl The URL associated with a media feed for one particular item.
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
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.

public GoogleBaseMediaFeed getMediaFeed (URL feedUrl)

Returns the Google base media feed associated with the specified feed URL. For the call to be valid, the user must be authenticated and own the item. The Google Base item has the link to its media feed registered as a FeedLink extension with the media relation.

Parameters
feedUrl
Throws
IOException error sending request or reading the feed.
ParseException error parsing the returned feed data.
ResourceNotFoundException invalid feed URL.
ServiceException system error retrieving feed.

public String getServiceVersion ()

Returns the google base service version followed by the gdata service version.

Returns
  • both versions, separated by a space

public E insert (URL url, E e)

Inserts a new Entry 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. If the Entry has been associated with a MediaSource through the setMediaSource(MediaSource) method then both the entry and the media resource will be inserted into the media feed associated with the target service. If the media source has a name (getName() that is non-null), the name will be provided as a Slug header that is sent along with request and may be used as a hint when determining the ID, url, and/or title of the inserted resource.

To insert only media content, use insert(URL, Class, MediaSource).

Parameters
url The POST URI associated with the target feed.
e The new entry to insert into the feed.
Returns
  • the newly inserted Entry returned by the service.
Throws
IOException
ServiceException

public GoogleBaseFeed query (Query query)

Executes a GData query against the target service and returns the Feed containing entries that match the query result.

Parameters
query Query instance defining target feed and query parameters, usually a GoogleBaseQuery
Throws
IOException error communicating with the GData service.
NotModifiedException if the query resource does not contain entries modified since the specified precondition date.
ServiceForbiddenException feed does not support the query.
ParseException error parsing the returned feed data.
ServiceException query request failed.

public GoogleBaseFeed query (Query query, DateTime ifModifiedSince)

Executes a GData query against the target service and returns the GoogleBaseFeed containing entries that match the query result, if it's been modified since the specified date.

Parameters
query Query instance defining target feed and query parameters, usually a GoogleBaseQuery
ifModifiedSince Used to set a precondition date that indicates the query result feed should be returned only if contains entries that have been modified after the specified date. A value of null indicates no precondition.
Throws
IOException error communicating with the GData service.
NotModifiedException if the query resource does not contain entries modified since the specified precondition date.
ServiceForbiddenException feed does not support the query.
ParseException error parsing the returned feed data.
ServiceException query request failed.

public E update (URL url, E e)

Updates an existing entry metadata by writing it to the specified edit URL. The resulting entry (after update) will be returned. If the entry has media resource, the media part will not be updated. To update both metadata and media, use updateMedia(URL, IEntry). To update media only, use updateMedia(URL, Class, MediaSource).

Parameters
url The media edit URL associated with the resource.
e The updated entry to be written to the server.
Returns
  • the updated entry returned by the service.
Throws
IOException
ServiceException