public class GoogleBaseService extends MediaService
GoogleBaseFeed
and
GoogleBaseEntry
.
GoogleBaseService service = new GoogleBaseService("mycompany-myapp-1.0"); service.setUserCredentials(username, password); GoogleBaseQuery query = new GoogleBaseQuery(...); query.setGoogleBaseQuery(...); GoogleBaseFeed feed = service.query(query);
Modifier and Type | Class and Description |
---|---|
static class |
GoogleBaseService.Versions
The Versions class contains all released versions of the Google Base API
|
GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
Service.ClientOutputProperties, Service.GDataRequest, Service.GDataRequestFactory
Modifier and Type | Field and Description |
---|---|
static Version |
DEFAULT_VERSION
Version 1 is the current default version for GoogleBaseService.
|
static java.lang.String |
GOOGLE_BASE_SERVICE
The official name of the service.
|
static java.lang.String |
GOOGLE_BASE_SERVICE_VERSION
Version of this service.
|
DEFAULT_CHUNKED_BUFFER_SIZE, NO_CHUNKED_MEDIA_REQUEST
Constructor and Description |
---|
GoogleBaseService(java.lang.String applicationName)
Creates a GoogleBaseService connecting to the default
authentication domain (www.google.com) using the HTTPS.
|
GoogleBaseService(java.lang.String applicationName,
java.lang.String developerKey)
Creates a GoogleBaseService connecting to the default
authentication domain (www.google.com) using the HTTPS.
|
GoogleBaseService(java.lang.String applicationName,
java.lang.String protocol,
java.lang.String domainName)
Creates a GoogleBaseService connecting to a specific
authentication domain using a specific protocol.
|
GoogleBaseService(java.lang.String applicationName,
java.lang.String developerKey,
java.lang.String protocol,
java.lang.String domainName)
Creates a GoogleBaseService connecting to a specific
authentication domain using a specific protocol.
|
Modifier and Type | Method and Description |
---|---|
<F extends IFeed> |
batch(java.net.URL url,
F f)
Executes several operations (insert, update or delete) on the entries that
are part of the input
IFeed . |
GoogleBaseEntry |
getEntry(java.net.URL entryUrl)
Returns an Google Base entry instance, given the URL of the entry.
|
GoogleBaseEntry |
getEntry(java.net.URL entryUrl,
DateTime ifModifiedSince)
Returns an Google Base entry instance, given the URL of the entry and an
if-modified-since date.
|
GoogleBaseFeed |
getFeed(java.net.URL feedUrl)
Returns the Google base feed associated with a particular feed URL.
|
GoogleBaseFeed |
getFeed(java.net.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(java.net.URL entryUrl)
Returns the media entry referenced by the entryUrl.
|
GoogleBaseMediaEntry |
getMediaEntry(java.net.URL entryUrl,
DateTime ifModifiedSince)
Returns the media entry referenced by the entryUrl, if it's been modified
since the specified date.
|
GoogleBaseMediaFeed |
getMediaFeed(java.net.URL feedUrl)
Returns the Google base media feed associated with the specified feed URL.
|
GoogleBaseMediaFeed |
getMediaFeed(java.net.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.
|
java.lang.String |
getServiceVersion()
Returns the google base service version followed by the gdata
service version.
|
<E extends IEntry> |
insert(java.net.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> |
update(java.net.URL url,
E e)
Updates an existing entry metadata by writing it to the specified edit
URL.
|
getDefaultAltRegistry, getMedia, getMedia, insert, setChunkedMediaUpload, updateMedia, updateMedia
addCookie, createRequest, delete, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getEntry, getFeed, getFeed, getFeed, getFeed, handlesCookies, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, getAltRegistry, getContentType, getEntry, getExtensionProfile, getFeed, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getStreamFromLink, getStrictValidation, getVersion, introspect, parseResponseData, patch, patch, query, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setStrictValidation, setTimeouts, update, useSsl, writeRequestData
public static final java.lang.String GOOGLE_BASE_SERVICE
public static final java.lang.String GOOGLE_BASE_SERVICE_VERSION
getServiceVersion()
public static final Version DEFAULT_VERSION
public GoogleBaseService(java.lang.String applicationName)
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(java.lang.String applicationName, java.lang.String developerKey)
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(java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
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 handlerpublic GoogleBaseService(java.lang.String applicationName, java.lang.String developerKey, java.lang.String protocol, java.lang.String domainName)
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 handlerpublic GoogleBaseFeed getFeed(java.net.URL feedUrl, DateTime ifModifiedSince) throws java.io.IOException, ServiceException
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.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.GoogleService.getFeed(java.net.URL, Class, com.google.gdata.data.DateTime)
public GoogleBaseFeed getFeed(java.net.URL feedUrl) throws java.io.IOException, ServiceException
feedUrl
- the URL associated with a feed. This URL can include
GData query parameters.java.io.IOException
- error sending request or reading the feed.ParseException
- error parsing the returned
feed data.ResourceNotFoundException
- invalid feed URL.ServiceException
- system error retrieving feed.Service.getFeed(java.net.URL, Class)
public GoogleBaseMediaFeed getMediaFeed(java.net.URL feedUrl) throws java.io.IOException, ServiceException
FeedLink
extension with the
media
relation.java.io.IOException
- error sending request or reading the feed.ParseException
- error parsing the returned
feed data.ResourceNotFoundException
- invalid feed URL.ServiceException
- system error retrieving feed.GoogleService.getFeed(java.net.URL, Class, com.google.gdata.data.DateTime)
public GoogleBaseMediaFeed getMediaFeed(java.net.URL feedUrl, DateTime ifModifiedSince) throws java.io.IOException, ServiceException
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.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.GoogleService.getFeed(java.net.URL, Class, com.google.gdata.data.DateTime)
public GoogleBaseEntry getEntry(java.net.URL entryUrl, DateTime ifModifiedSince) throws java.io.IOException, ServiceException
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.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.GoogleService.getEntry(java.net.URL, Class, DateTime)
public GoogleBaseEntry getEntry(java.net.URL entryUrl) throws java.io.IOException, ServiceException
entryUrl
- resource URL for the entry.java.io.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.Service.getEntry(java.net.URL, Class)
public GoogleBaseMediaEntry getMediaEntry(java.net.URL entryUrl) throws java.io.IOException, ServiceException
entryUrl
- the url to the media entry.java.io.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
entrypublic GoogleBaseMediaEntry getMediaEntry(java.net.URL entryUrl, DateTime ifModifiedSince) throws java.io.IOException, ServiceException
entryUrl
- the url to the media entry.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
entrypublic GoogleBaseFeed query(Query query, DateTime ifModifiedSince) throws java.io.IOException, ServiceException
GoogleBaseFeed
containing entries that match the query result, if
it's been modified since the specified date.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.java.io.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.Service.query(com.google.gdata.client.Query, Class, DateTime)
public GoogleBaseFeed query(Query query) throws java.io.IOException, ServiceException
Feed
containing entries that match the
query result.query
- Query instance defining target feed and query parameters,
usually a GoogleBaseQuery
java.io.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 extends IEntry> E update(java.net.URL url, E e) throws java.io.IOException, ServiceException
MediaService
MediaService.updateMedia(URL, IEntry)
.
To update media only, use MediaService.updateMedia(URL, Class, MediaSource)
.update
in class MediaService
url
- the media edit URL associated with the resource.e
- the updated entry to be written to the server.java.io.IOException
- error communicating with the GData service.ParseException
- error parsing the updated
entry data.ServiceException
- update request failed due to system error.IEntry.getMediaEditLink()
public <E extends IEntry> E insert(java.net.URL url, E e) throws java.io.IOException, ServiceException
MediaService
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
IMediaEntry.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 (DataSource.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
MediaService.insert(URL, Class, MediaSource)
.
insert
in class MediaService
url
- the POST URI associated with the target feed.e
- the new entry to insert into the feed.java.io.IOException
- error communicating with the GData service.ParseException
- error parsing the return
entry data.ServiceException
- insert request failed due to system error.IFeed.getEntryPostLink()
public <F extends IFeed> F batch(java.net.URL url, F f) throws java.io.IOException, ServiceException, BatchInterruptedException
GoogleService
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.)batch
in class GoogleService
url
- the POST URI associated with the target feed.f
- a description of the operations to execute, described
using tags in the batch: namespacejava.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()
.IFeed.getEntryPostLink()
public java.lang.String getServiceVersion()
getServiceVersion
in class Service
GOOGLE_BASE_SERVICE_VERSION