Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

Commit e732909

Browse files
Migrating wiki contents from Google Code
0 parents  commit e732909

8 files changed

+502
-0
lines changed

Dependencies.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Introduction #
2+
3+
GData Java Client package depends on several third party libraries. This page lists all the dependency packages.
4+
5+
# Dependency Packages #
6+
## Required ##
7+
* Java Development Kit version 5.0 or greater. Latest version of JDK is available for download from http://java.sun.com.
8+
* [Google Collections](http://code.google.com/p/google-collections/) version 1.0 or higher. This is included in the release package under "java/deps/google-collect-1.0-rc2.jar".
9+
* [Apache ANT](http://ant.apache.org) version 1.7.0 or higher. This is required only if you are rebuilding the Core API libraries.
10+
11+
## Optional ##
12+
* mail.jar in Sun's [Java Mail API](http://java.sun.com/products/javamail) (version 1.4 or greater). Package javax.mail is contained in mail.jar. This is required only for APIs dependent on Media capabilities which include [Base Data API](http://code.google.com/apis/base/), [Document List Data API](http://code.google.com/apis/documents/overview.html), [Maps Data API](http://code.google.com/apis/maps), [Picasa Web Album API](http://code.google.com/apis/picasaweb/overview.html) and [YouTube Data API](http://code.google.com/apis/youtube/overview.html).
13+
* activation.jar in Sun's [Java Beans Activation Framework](http://java.sun.com/products/javabeans/jaf). The package javax.activation is contained in activation.jar. This is required only if using JDK version 1.5 or less and for Data APIs dependent on Media capabilities which include [Base Data API](http://code.google.com/apis/base/), [Document List Data API](http://code.google.com/apis/documents/overview.html), [Maps Data API](http://code.google.com/apis/maps), [Picasa Web Album API](http://code.google.com/apis/picasaweb/overview.html) and [YouTube Data API](http://code.google.com/apis/youtube/overview.html).
14+
* servlet.jar in Sun's [Servlet API](http://java.sun.com/products/servlet) (version 2.4 or greater). This is required only for code samples 'sample.authsub' and 'sample.gbase.recipe' packages.

EclipsePlugin.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Introduction #
2+
3+
Didn't you ever want some kind of tool to create new Google Data projects in seconds? Google Data Java Client Eclipse Plug-in is now available for use.
4+
5+
Using this plug-in you can create a new Java project to interact with any Google Data API of your choice. Now, you don't need to worry about setting up the dependencies for your Google Data project. This plug-in handles all the dependencies and also provides you with an option to download the external dependencies. It also creates a boiler plate code to interact with the API that you are interested in. This will give a quick start to all the newbies.
6+
7+
# Project Home #
8+
9+
To know more about it click [here](http://code.google.com/p/gdata-java-client-eclipse-plugin/)
10+
11+
# Installation #
12+
13+
For installation details click [here](http://code.google.com/p/gdata-java-client-eclipse-plugin/wiki/Installation)
14+
15+
# Template Demo #
16+
17+
To know how to use the plug-in click [here](http://code.google.com/p/gdata-java-client-eclipse-plugin/wiki/TemplateDemo)

FAQ.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
# How to handle com.google.gdata.util.RedirectRequiredException #
4+
This means your request to Google Data APIs server is redirected more than once by a http proxy. If the redirection is valid, you can choose to follow the redirected url as follows:
5+
```
6+
CalendarFeed feed;
7+
try {
8+
feed = calendarService.getFeed(feedUrl, CalendarFeed.class)
9+
} catch (RedirectRequiredException e) {
10+
feedUrl = new URL(re.getRedirectLocation());
11+
feed = cs.getFeed(feedUrl, CalendarFeed.class);
12+
}
13+
```
14+
Caution: You may want to evaluate the redirected url, before retrying to the new url.
15+
16+
17+
# Process hangs when retrieving a Feed or Entry using Service#getFeed or Service#getEntry in JDK 1.5 in MacOS #
18+
This is a known JDK bug. You can workaround this problem by running in interpreted mode, using JVM option "-Xint".

FeatureRequests.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Introduction #
2+
3+
List of feature requests for GData Java client library
4+
5+
6+
# Features #
7+
* Maven support for build and dependency management
8+
* Eliminate external dependencies
9+
* Simplified package structure and enable API specific libraries.

MigratingToGoogleApiJavaClient.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
This document describes how to migrate existing code from the Google Data Java client library (gdata-java-client) to the Google APIs Client Library for Java (google-api-java-client).
2+
3+
Contents:
4+
5+
# Migrating away from GData #
6+
7+
Older Google Data (GData) APIs use XML as their underlying format, but most Google APIs have released newer versions of their APIs based on JSON. You should migrate your code to use the new API infrastructure that is based on JSON, where we can provide a much better experience.
8+
9+
To do this, visit the documentation for the API that you are using to find out what is available for that API, or check the [current GData status](https://code.google.com/p/gdata-java-client/) table. If the GData version of the API still exists but there is an alternative built on the new Google API infrastructure, we recommend that you switch to the new version of the API.
10+
11+
Samples based on the Google APIs Client Library for Java are available for [various Google APIs](https://developers.google.com/api-client-library/java/apis/). If you need a sample for a different API, ask on the [google-api-java-client Google group](https://groups.google.com/forum/?fromgroups#!forum/google-api-java-client) whether anyone has sample code they are willing to share.
12+
13+
Likewise, if you have an existing application that uses the GData Java client library, you need to update your code to use the [Google APIs Client Library for Java](https://code.google.com/p/google-api-java-client/), as described in this document.
14+
15+
## Not all code has to migrate ##
16+
17+
You do not need to migrate away from the GData Java client library if you are using the [Google Sites API](https://developers.google.com/google-apps/sites/), the [Google Spreadsheets API](https://developers.google.com/google-apps/spreadsheets/), or the [Picasa Web Albums Data API](https://developers.google.com/picasa-web/). For these Google APIs, keep using the GData Java client library for now.
18+
19+
## Some benefits of migrating ##
20+
21+
Unlike the GData Java client library, the [Google APIs Client Library for Java](https://code.google.com/p/google-api-java-client/) supports Android, JSON, Maven, OAuth 2.0, and efficient partial-response.
22+
23+
The GData library needed updates whenever our APIs added XML elements and attributes, and our releases were too infrequent to keep up. The Google APIs Client Library for Java has a completely different model, in which classes represent the data format of our API responses. You control these classes, and you don't depend on our release process to provide you with them.
24+
25+
26+
# Migrating to the Google APIs Client Library for Java #
27+
28+
Start by reading about the [Google APIs Client Library for Java](http://code.google.com/p/google-api-java-client/) and viewing the [samples](http://code.google.com/p/google-api-java-client/source/browse?repo=samples). Join the [google-api-java-client Google group](https://groups.google.com/forum/?fromgroups#!forum/google-api-java-client) to keep up to date with the latest discussions and announcements, or ask questions or provide feedback.
29+
30+
Since gdata-java-client and google-api-java-client are independent projects, it is completely safe to include both in your Java classpath. The easiest way to get started is to write new code using google-api-java-client, and migrate existing code from gdata-java-client to google-api-java-client over time as you gain confidence using google-api-java-client.
31+
32+
## Architectural overview ##
33+
34+
The architecture of a typical application based on google-api-java-client uses a Model-View-Controller style.
35+
* Model: Write a custom XML data model for the Google Data API based on the fields your application needs. See the [JavaDoc](http://javadoc.google-api-java-client.googlecode.com/hg/latest/com/google/api/client/googleapis/xml/atom/package-summary.html) for more information on writing a custom data model.
36+
* Controller: Write the request execution methods. The [JavaDoc](http://javadoc.google-api-java-client.googlecode.com/hg/latest/com/google/api/client/googleapis/xml/atom/package-summary.html) also explains how to do that.
37+
* View: Write the user interface, including authentication and authorization. The recommended approach is to use [OAuth 2.0](https://code.google.com/p/google-api-java-client/wiki/OAuth2), or for Android, the [AccountManager](http://developer.android.com/reference/android/accounts/AccountManager.html).
38+
39+
40+
## Migrate your code ##
41+
42+
First, you need to invest in writing a custom data model that lets your application access the Google API fields it needs. See the [JavaDoc for the new XML data model](http://javadoc.google-api-java-client.googlecode.com/hg/latest/com/google/api/client/googleapis/xml/atom/package-summary.html) in google-api-java-client.
43+
44+
If there is already a sample for the API you are using, you have a great starting point. You can copy the data model classes it uses directly into your application. Of course, since it is just a sample, it shows only the data classes and fields that the sample needs, so you'll probably need to add more data classes and fields. It's easy to do this, or even to use google-api-java-client with an API that doesn't yet have a sample, by applying the same techniques demonstrated in the existing samples.
45+
46+
There are three other key differences between how you set up the API using the new library and the old one:
47+
48+
First, there is a much different calling style with google-api-java-client. Instead of calling a service by name, you start with the generic HttpTransport class and set the application name in its headers. So, in the case of YouTube, you previously you might have written code like this:
49+
50+
```
51+
YouTubeService service = new YouTubeService("google-youtubesample-1.0");
52+
```
53+
54+
With google-api-client, it's a few more lines of code:
55+
56+
```
57+
HttpTransport transport = GoogleTransport.create();
58+
GoogleHeaders headers = (GoogleHeaders) transport.defaultHeaders;
59+
headers.setApplicationName("google-youtubesample-1.0");
60+
headers.gdataVersion = "2";
61+
```
62+
63+
Second, authentication is different in gdata-java-client and google-api-java-client. For example, if you are using ClientLogin, you used to do something like the following:
64+
65+
```
66+
service.setUserCredentials(username, password);
67+
```
68+
69+
But with the new library, you write code like this:
70+
71+
```
72+
ClientLogin authenticator = new ClientLogin();
73+
authenticator.authTokenType = "youtube";
74+
authenticator.username = username;
75+
authenticator.password = password;
76+
authenticator.authenticate().setAuthorizationHeader(transport);
77+
```
78+
79+
If you are migrating to the new client library and are still using ClientLogin, your application still needs to ask your end users for their username and password, which is insecure. We strongly recommend that you migrate to [OAuth 2.0](https://developers.google.com/accounts/docs/OAuth2).
80+
81+
Third, you write your own API-specific class that extends `GoogleUrl` and adds the query parameters you want to use; there is no `YouTubeQuery` to help you construct a URL with google-api-java-client. Here is an example for YouTube:
82+
83+
```
84+
public static class YouTubeUrl extends GoogleUrl {
85+
@Key public String orderby;
86+
@Key public String q;
87+
@Key public String safeSearch;
88+
public YouTubeUrl(String encodedUrl) {
89+
super(encodedUrl);
90+
}
91+
}
92+
```
93+
94+
Once you've set up the basics of the API, you're ready to use it in your application. Previously, the code you wrote when you used gdata-java-client looked something like this:
95+
```
96+
public static void printPuppyVideos(YouTubeService service) {
97+
YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos"));
98+
// order results by the number of views (most viewed first)
99+
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
100+
101+
// search for puppies and include restricted content in the search results
102+
query.setFullTextQuery("puppy");
103+
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
104+
105+
VideoFeed videoFeed = service.query(query, VideoFeed.class);
106+
for (VideoEntry videoEntry : videoFeed.getEntries()) {
107+
System.out.println("Title: " + videoEntry.getTitle().getPlainText());
108+
}
109+
}
110+
```
111+
112+
Now, with the google-api-java-client, the code you write looks more like this:
113+
114+
```
115+
public static void printPuppyVideos(HttpTransport transport) {
116+
YouTubeUrl url = new YouTubeUrl("http://gdata.youtube.com/feeds/api/videos");
117+
// order results by the number of views (most viewed first)
118+
url.orderBy = "viewCount";
119+
120+
// search for puppies and include restricted content in the search results
121+
url.q = "puppy";
122+
url.safeSearch = "none";
123+
124+
HttpRequest request = transport.buildGetRequest();
125+
request.url = url;
126+
VideoFeed videoFeed = request.execute().parseAs(VideoFeed.class);
127+
for (VideoEntry videoEntry : videoFeed.videos) {
128+
System.out.println("Title: " + videoEntry.title);
129+
}
130+
}
131+
```
132+
133+
There are other differences as well. For example, how you handle XML namespaces and the way you insert new items into a feed is different.

ProjectHome.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Older Google Data (GData) APIs use XML as their underlying format, but most Google APIs have released newer versions of their APIs based on JSON. You should migrate your code to use the new API infrastructure that is based on JSON. Likewise, if you have an existing application that uses the GData Java client library, you need to update your code to use the [Google APIs Client Library for Java](https://code.google.com/p/google-api-java-client/), as described on the [migration](https://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient) page.
2+
3+
We have stopped actively developing the GData Java client library, and the following table shows the GData status of relevant Google APIs:
4+
5+
| **API** | **GData Status** | **See Also** |
6+
|:--------|:-----------------|:-------------|
7+
| Google Analytics Data Export API | Shut down. Replaced by [Google Analytics Core Reporting API](https://developers.google.com/analytics/devguides/reporting/core/v3/) (starting at version 2.4). | [Migration Guide: Moving from v2.3 APIs to v2.4 & v3.0](https://developers.google.com/analytics/devguides/reporting/core/v2/migration-guide) |
8+
| Google Apps Provisioning API | Deprecated as of May 2013, but continues to work as per [deprecation policy](https://developers.google.com/google-apps/admin-api-terms). Replaced by the [Admin SDK Directory API](https://developers.google.com/admin-sdk/directory/). | [Google Apps Provisioning API (Deprecated)](https://developers.google.com/google-apps/provisioning/) |
9+
| Google Base Data API | Not available since June 1, 2011. Replaced by Shopping APIs. | [New Shopping APIs and Deprecation of the Base API](http://googlemerchantblog.blogspot.com/2010/12/new-shopping-apis-and-deprecation-of.html) |
10+
| Blogger Data API | Replaced by the [latest Blogger API](https://developers.google.com/blogger/). | |
11+
| Google Book Search API | Shut down. Replaced by [Google Books API Family](https://developers.google.com/books/). | [Google books API searching by ISBN](http://stackoverflow.com/questions/7908954/google-books-api-searching-by-isbn) (on Stack Overflow) |
12+
| Google Calendar API | Deprecated. Replaced by [Google Calendar API](https://developers.google.com/google-apps/calendar/). | |
13+
| Google Code Search Data API | Shut down in Jan 15, 2012. No replacement API. | [A fall sweep](http://googleblog.blogspot.com/2011/10/fall-sweep.html) (Google blog post) |
14+
| Google Contacts API | Deprecated as of April 20, 2012, but continues to work as per [deprecation policy](https://developers.google.com/google-apps/contacts/v3/terms). Replaced by the [latest Google Contacts API](https://developers.google.com/google-apps/contacts/). | [Google Contacts API v2 Developer's Guide - Java](https://developers.google.com/google-apps/contacts/v2/developers_guide_java) |
15+
| Google Documents List Data API |Deprecated as of Sep 14, 2012, but continues to work as per [deprecation policy](https://developers.google.com/google-apps/documents-list/terms). Replaced by [Google Drive API](https://developers.google.com/drive/). | [Google Documents List API version 3.0](https://developers.google.com/google-apps/documents-list/) |
16+
| Google Finance Portfolio Data API | Deprecated as of June 3, 2011, but no scheduled shutdown date. No replacement API. | [Spring cleaning for some of our APIs](http://googlecode.blogspot.com/2011/05/spring-cleaning-for-some-of-our-apis.html) (Google blog post) |
17+
| Google Health Data API | The product was [discontinued](https://www.google.com/intl/en_us/health/about/) as of January 1, 2013. No replacement API. | [An update on Google Health and Google PowerMeter](http://googleblog.blogspot.com/2011/06/update-on-google-health-and-google.html) |
18+
| Google Maps Data API | Deprecated. Replaced by [Google Maps API Web Services](https://developers.google.com/maps/documentation/webservices/). | |
19+
| Picasa Web Albums Data API | GData version is still live. No replacement API. | [Client Libraries and Sample Code](https://developers.google.com/picasa-web/code) for Picasa Web Albums Data API |
20+
| Google Project Hosting Issue Tracker API | Shut down on June 14, 2013. No replacement API. | [Winter cleaning](http://googleblog.blogspot.com/2012/12/winter-cleaning.html) (Google blog post) |
21+
| Google Sidewiki Data API | Product discontinued. No replacement API. | [A fall spring-clean](http://googleblog.blogspot.com/2011/09/fall-spring-clean.html) (Google blog post) |
22+
| Google Sites Data API | GData version is still live. No replacement API. | [What is the Google Sites API?](https://developers.google.com/google-apps/sites/) |
23+
| Google Spreadsheets Data API | GData version is still live. No replacement API. | [Google Sheets API](https://developers.google.com/google-apps/spreadsheets/) |
24+
| Google Translator Toolkit Data API | The API is now [restricted](https://developers.google.com/translator-toolkit/), but you can request access to the documentation. | [Google Translate API](https://cloud.google.com/translate/docs) |
25+
| Google Webmaster Tools Data API | Not updated. Replaced by the [latest Webmaster Tools API](https://developers.google.com/webmaster-tools/). | [Quickstart: Run a Webmaster Tools App in Java](https://developers.google.com/webmaster-tools/v3/quickstart/quickstart-java) |
26+
| YouTube Data API | Deprecated in March 4, 2014, but continues to work as per [deprecation policy](https://developers.google.com/youtube/terms#deprecation). Replaced by [YouTube Data API (v3)](https://developers.google.com/youtube/v3/). | [YouTube Data API Migration Guide](https://developers.google.com/youtube/2.0/migration) |
27+
28+
**Android support:**
29+
If you are developing for Android and the Google API you want to use is included in the [Google Play Services library](https://developer.android.com/google/play-services/index.html), you should use that library for the best performance and experience. If the Google API you want to use with Android is not part of the Google Play Services library, you can use the [Google APIs Client Library for Java](https://code.google.com/p/google-api-java-client/), which supports Android 1.5 (or higher) and provides other features such as OAuth 2.0 and Maven.

0 commit comments

Comments
 (0)