If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial, and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
Window > Preferences... (or on Mac, Eclipse >
+ Preferences...)
+
Select Maven
+
+
check on "Download Artifact Sources"
+
check on "Download Artifact JavaDoc"
+
+
+
+
+
Import adexchangeseller-cmdline-sample project
+
+
File > Import...
+
Select "General > Existing Project into Workspace" and click
+ "Next"
+
Click "Browse" next to "Select root directory", find
+ [someDirectory]/google-api-java-client-samples/adexchangeseller-cmdline-sample
+ and click "Next"
+
+
Click "Finish"
+
+
+
Run
+
+
Right-click on project adexchangeseller-cmdline-sample
+
Run As > Java Application
+
If asked, type "AdExchangeSellerSample" and click OK
+
+
+
+
+
+
diff --git a/adexchangeseller-cmdline-sample/logging.properties b/adexchangeseller-cmdline-sample/logging.properties
new file mode 100644
index 00000000..4e59fe89
--- /dev/null
+++ b/adexchangeseller-cmdline-sample/logging.properties
@@ -0,0 +1,10 @@
+# Properties file which configures the operation of the JDK logging facility.
+# The system will look for this config file to be specified as a system property:
+# -Djava.util.logging.config.file=${project_loc:adexchangeseller-cmdline-sample}/logging.properties
+
+# Set up the console handler (uncomment "level" to show more fine-grained messages)
+handlers = java.util.logging.ConsoleHandler
+#java.util.logging.ConsoleHandler.level = CONFIG
+
+# Set up logging of HTTP requests and responses (uncomment "level" to show)
+#com.google.api.client.http.level = CONFIG
diff --git a/adexchangeseller-cmdline-sample/pom.xml b/adexchangeseller-cmdline-sample/pom.xml
new file mode 100644
index 00000000..e8894782
--- /dev/null
+++ b/adexchangeseller-cmdline-sample/pom.xml
@@ -0,0 +1,135 @@
+
+ 4.0.0
+
+ com.google
+ google
+ 5
+
+ com.google.apis-samples
+ adexchangeseller-cmdline-sample
+ 1.1.0
+ Example for the Ad Exchange Seller REST API v1.1 using JSON.
+
+ http://code.google.com/p/google-api-java-client/
+
+
+ code.google.com
+ http://code.google.com/p/google-api-java-client/issues/list
+
+
+ 2011
+
+
+ 2.0.9
+
+
+
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
+
+
+
+
+ sgomes
+ Sergio Gomes
+ sgomes@google.com
+ Google
+ http://www.google.com
+
+ owner
+ developer
+
+ 0
+
+
+
+
+
+
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.1
+
+
+
+ java
+
+
+
+
+ com.google.api.services.samples.adexchangeseller.cmdline.AdExchangeSellerSample
+
+
+ java.util.logging.config.file
+ logging.properties
+
+
+
+
+
+ maven-checkstyle-plugin
+ 2.6
+
+ ../checkstyle.xml
+ true
+ false
+
+
+
+
+ check
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 2.3.2
+
+ false
+
+
+
+
+ check
+
+
+
+
+
+ ${project.artifactId}-${project.version}
+
+
+
+ com.google.apis
+ google-api-services-adexchangeseller
+ v1.1-rev21-1.19.0
+
+
+ com.google.http-client
+ google-http-client-jackson2
+ ${project.http.version}
+
+
+ com.google.oauth-client
+ google-oauth-client-jetty
+ ${project.oauth.version}
+
+
+
+ 1.19.0
+ 1.19.0
+ UTF-8
+
+
diff --git a/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/AdExchangeSellerSample.java b/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/AdExchangeSellerSample.java
new file mode 100644
index 00000000..1b2bc0ae
--- /dev/null
+++ b/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/AdExchangeSellerSample.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.adexchangeseller.cmdline;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.http.javanet.NetHttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.DataStoreFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.adexchangeseller.AdExchangeSeller;
+import com.google.api.services.adexchangeseller.AdExchangeSellerScopes;
+import com.google.api.services.adexchangeseller.model.AdClients;
+import com.google.api.services.adexchangeseller.model.AdUnits;
+import com.google.api.services.adexchangeseller.model.CustomChannels;
+import com.google.api.services.adexchangeseller.model.SavedReports;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+
+/**
+ * A sample application that runs multiple requests against the Ad Exchange Seller REST API.
+ * These include:
+ *
+ *
Listing all ad clients for the account
+ *
Listing all ad units for an ad client
+ *
Listing all custom channels for an ad unit
+ *
Listing all custom channels for an ad client
+ *
Listing all ad units for a custom channel
+ *
Listing all URL channels for an ad client
+ *
Running a report for an ad client, for the past 7 days
+ *
Running a paginated report for an ad client, for the past 7 days
+ *
Listing all saved reports for the account
+ *
Running a saved report for the account
+ *
Listing all dimensions for the account
+ *
Listing all metrics for the account
+ *
Listing all alerts for the account
+ *
+ */
+public class AdExchangeSellerSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ /** Directory to store user credentials. */
+ private static final java.io.File DATA_STORE_DIR =
+ new java.io.File(System.getProperty("user.home"), ".store/adexchangeseller_sample");
+
+ /**
+ * Global instance of the {@link DataStoreFactory}. The best practice is to make it a single
+ * globally shared instance across your application.
+ */
+ private static FileDataStoreFactory dataStoreFactory;
+
+ /** Global instance of the JSON factory. */
+ private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
+
+ // Request parameters.
+ private static final int MAX_LIST_PAGE_SIZE = 50;
+ private static final int MAX_REPORT_PAGE_SIZE = 50;
+
+ /** Global instance of the HTTP transport. */
+ private static HttpTransport httpTransport;
+
+ /** Authorizes the installed application to access user's protected data. */
+ private static Credential authorize() throws Exception {
+ // load client secrets
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY,
+ new InputStreamReader(
+ AdExchangeSellerSample.class.getResourceAsStream("/client_secrets.json")));
+ if (clientSecrets.getDetails().getClientId().startsWith("Enter")
+ || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
+ System.out.println("Enter Client ID and Secret from "
+ + "https://code.google.com/apis/console/?api=adexchangeseller into "
+ + "adexchangeseller-cmdline-sample/src/main/resources/client_secrets.json");
+ System.exit(1);
+ }
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ httpTransport, JSON_FACTORY, clientSecrets,
+ Collections.singleton(AdExchangeSellerScopes.ADEXCHANGE_SELLER_READONLY))
+ .setDataStoreFactory(dataStoreFactory).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+ /**
+ * Performs all necessary setup steps for running requests against the API.
+ *
+ * @return An initialized AdExchangeSeller service object.
+ * @throws Exception
+ */
+ private static AdExchangeSeller initializeAdExchangeSeller() throws Exception {
+ // Authorization.
+ Credential credential = authorize();
+
+ // Set up Ad Exchange Seller REST API client.
+ AdExchangeSeller adExchangeSeller = new AdExchangeSeller.Builder(
+ new NetHttpTransport(), JSON_FACTORY, credential).setApplicationName(APPLICATION_NAME)
+ .build();
+
+ return adExchangeSeller;
+ }
+
+ /**
+ * Runs all the Ad Exchange Seller REST API samples.
+ *
+ * @param args command-line arguments.
+ */
+ public static void main(String[] args) {
+ try {
+ httpTransport = GoogleNetHttpTransport.newTrustedTransport();
+ dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
+ AdExchangeSeller adExchangeSeller = initializeAdExchangeSeller();
+
+ AdClients adClients = GetAllAdClients.run(adExchangeSeller, MAX_LIST_PAGE_SIZE);
+ if ((adClients.getItems() != null) && !adClients.getItems().isEmpty()) {
+ // Get an ad client ID, so we can run the rest of the samples.
+ String exampleAdClientId = adClients.getItems().get(0).getId();
+
+ AdUnits units = GetAllAdUnits.run(adExchangeSeller, exampleAdClientId, MAX_LIST_PAGE_SIZE);
+ if ((units.getItems() != null) && !units.getItems().isEmpty()) {
+ // Get an example ad unit ID, so we can run the following sample.
+ String exampleAdUnitId = units.getItems().get(0).getId();
+ GetAllCustomChannelsForAdUnit.run(
+ adExchangeSeller, exampleAdClientId, exampleAdUnitId, MAX_LIST_PAGE_SIZE);
+ }
+
+ CustomChannels channels =
+ GetAllCustomChannels.run(adExchangeSeller, exampleAdClientId, MAX_LIST_PAGE_SIZE);
+ if ((channels.getItems() != null) && !channels.getItems().isEmpty()) {
+ // Get an example custom channel ID, so we can run the following sample.
+ String exampleCustomChannelId = channels.getItems().get(0).getId();
+ GetAllAdUnitsForCustomChannel.run(
+ adExchangeSeller, exampleAdClientId, exampleCustomChannelId, MAX_LIST_PAGE_SIZE);
+ }
+
+ GetAllUrlChannels.run(adExchangeSeller, exampleAdClientId, MAX_LIST_PAGE_SIZE);
+ GenerateReport.run(adExchangeSeller, exampleAdClientId);
+ GenerateReportWithPaging.run(adExchangeSeller, exampleAdClientId, MAX_REPORT_PAGE_SIZE);
+ } else {
+ System.out.println("No ad clients found, unable to run remaining methods.");
+ }
+
+ SavedReports savedReports = GetAllSavedReports.run(adExchangeSeller, MAX_REPORT_PAGE_SIZE);
+ if ((savedReports.getItems() != null) && !savedReports.getItems().isEmpty()) {
+ // Get a saved report ID, so we can generate its report.
+ String exampleSavedReportId = savedReports.getItems().get(0).getId();
+ GenerateSavedReport.run(adExchangeSeller, exampleSavedReportId);
+ } else {
+ System.out.println("No saved report found.");
+ }
+
+ GetAllDimensions.run(adExchangeSeller);
+ GetAllMetrics.run(adExchangeSeller);
+
+ GetAllAlerts.run(adExchangeSeller);
+
+ GetAllPreferredDeals.run(adExchangeSeller);
+
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/GenerateReport.java b/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/GenerateReport.java
new file mode 100644
index 00000000..10f47bc3
--- /dev/null
+++ b/adexchangeseller-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangeseller/cmdline/GenerateReport.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.adexchangeseller.cmdline;
+
+import com.google.api.services.adexchangeseller.AdExchangeSeller;
+import com.google.api.services.adexchangeseller.AdExchangeSeller.Reports.Generate;
+import com.google.api.services.adexchangeseller.model.Report;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * This example retrieves a report, using a filter for a specified ad client.
+ *
+ *
Please only use pagination if your application requires it due to memory or storage
+ * constraints. If you need to retrieve more than 5000 rows, please check GenerateReport.java, as
+ * due to current limitations you will not be able to use paging for large reports.
+ *
+ *
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial, and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial, and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
+
+
+cd [someDirectory]
+hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
+cd google-api-java-client-samples/adsensehost-cmdline-sample
+[editor] src/main/resources/client_secrets.json
+[editor] src/main/java/com/google/api/services/samples/adsensehost/cmdline/AdSenseHostSample.java
+(Set PUB_ACCOUNT_ID to your publisher account ID if you want the
+publisher samples to run)
+mvn compile
+mvn -q exec:java
+
+
+
Setup Project in Eclipse
+
+
To enable logging of HTTP requests and responses (highly recommended
+ when developing), please take a look at logging.properties.
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial, and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
Window > Preferences... (or on Mac, Eclipse >
+ Preferences...)
+
Select Maven
+
+
check on "Download Artifact Sources"
+
check on "Download Artifact JavaDoc"
+
+
+
+
+
Import analytics-cmdline-sample project
+
+
File > Import...
+
Select "General > Existing Project into Workspace" and click
+ "Next"
+
Click "Browse" next to "Select root directory", find
+ [someDirectory]/google-api-java-client-samples/analytics-cmdline-sample
+ and click "Next"
+
+
Click "Finish"
+
+
+
Run
+
+
Right-click on project analytics-cmdline-sample
+
Run As > Java Application
+
If asked, type "HelloAnalyticsApiSample" and click OK
+
+
+
+
+ Note: The default for this project is to run the
+ HelloAnalyticsApiSample application. You can run the other samples by
+ updating the
+ pom.xml
+ mainClass
+ attribute for Maven or Right clicking the appropriate file in Eclipse.
+
+
+
diff --git a/analytics-cmdline-sample/logging.properties b/analytics-cmdline-sample/logging.properties
new file mode 100644
index 00000000..d5064366
--- /dev/null
+++ b/analytics-cmdline-sample/logging.properties
@@ -0,0 +1,10 @@
+# Properties file which configures the operation of the JDK logging facility.
+# The system will look for this config file to be specified as a system property:
+# -Djava.util.logging.config.file=${project_loc}/logging.properties
+
+# Set up the console handler (uncomment "level" to show more fine-grained messages)
+handlers = java.util.logging.ConsoleHandler
+#java.util.logging.ConsoleHandler.level = CONFIG
+
+# Set up logging of HTTP requests and responses (uncomment "level" to show)
+#com.google.api.client.http.level = CONFIG
diff --git a/analytics-cmdline-sample/pom.xml b/analytics-cmdline-sample/pom.xml
new file mode 100644
index 00000000..ad7ce928
--- /dev/null
+++ b/analytics-cmdline-sample/pom.xml
@@ -0,0 +1,135 @@
+
+ 4.0.0
+
+ com.google
+ google
+ 5
+
+ com.google.apis-samples
+ analytics-cmdline-sample
+ 1
+ Example for the Analytics API v3 using JSON.
+
+ http://code.google.com/p/google-api-java-client/
+
+
+ code.google.com
+ http://code.google.com/p/google-api-java-client/issues/list
+
+
+ 2012
+
+
+ 2.0.9
+
+
+
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
+
+
+
+
+ api.nickm
+ Nick Mihailovski
+ api.nickm@gmail.com
+ Google
+ http://www.google.com
+
+ owner
+ developer
+
+ 0
+
+
+
+
+
+
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.1
+
+
+
+ java
+
+
+
+
+ com.google.api.services.samples.analytics.cmdline.HelloAnalyticsApiSample
+
+
+ java.util.logging.config.file
+ logging.properties
+
+
+
+
+
+ maven-checkstyle-plugin
+ 2.6
+
+ ../checkstyle.xml
+ true
+ false
+
+
+
+
+ check
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 2.3.2
+
+ false
+
+
+
+
+ check
+
+
+
+
+
+ ${project.artifactId}-${project.version}
+
+
+
+ com.google.apis
+ google-api-services-analytics
+ v3-rev98-1.19.0
+
+
+ com.google.http-client
+ google-http-client-jackson2
+ ${project.http.version}
+
+
+ com.google.oauth-client
+ google-oauth-client-jetty
+ ${project.oauth.version}
+
+
+
+ 1.19.0
+ 1.19.0
+ UTF-8
+
+
diff --git a/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/CoreReportingApiReferenceSample.java b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/CoreReportingApiReferenceSample.java
new file mode 100644
index 00000000..613736c0
--- /dev/null
+++ b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/CoreReportingApiReferenceSample.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.api.services.samples.analytics.cmdline;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.DataStoreFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.analytics.Analytics;
+import com.google.api.services.analytics.AnalyticsScopes;
+import com.google.api.services.analytics.model.GaData;
+import com.google.api.services.analytics.model.GaData.ColumnHeaders;
+import com.google.api.services.analytics.model.GaData.ProfileInfo;
+import com.google.api.services.analytics.model.GaData.Query;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This application demonstrates how to use the Google Analytics Java client library to access all
+ * the pieces of data returned by the Google Analytics Core Reporting API v3.
+ *
+ *
+ * To run this, you must supply your Google Analytics TABLE ID. Read the Core Reporting API
+ * developer guide to learn how to get this value.
+ *
+ *
+ * @author api.nickm@gmail.com
+ */
+public class CoreReportingApiReferenceSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ /**
+ * Used to identify from which reporting profile to retrieve data. Format is ga:xxx where xxx is
+ * your profile ID.
+ */
+ private static final String TABLE_ID = "INSERT_YOUR_TABLE_ID";
+
+ /** Directory to store user credentials. */
+ private static final java.io.File DATA_STORE_DIR =
+ new java.io.File(System.getProperty("user.home"), ".store/analytics_sample");
+
+ /**
+ * Global instance of the {@link DataStoreFactory}. The best practice is to make it a single
+ * globally shared instance across your application.
+ */
+ private static FileDataStoreFactory DATA_STORE_FACTORY;
+
+ /** Global instance of the HTTP transport. */
+ private static HttpTransport HTTP_TRANSPORT;
+
+ /** Global instance of the JSON factory. */
+ private static final JsonFactory JSON_FACTORY = new JacksonFactory();
+
+ /**
+ * Main demo. This first initializes an Analytics service object. It then queries for the top 25
+ * organic search keywords and traffic sources by visits. Finally each important part of the
+ * response is printed to the screen.
+ *
+ * @param args command line args.
+ */
+ public static void main(String[] args) {
+ try {
+ HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
+ DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
+ Analytics analytics = initializeAnalytics();
+ GaData gaData = executeDataQuery(analytics, TABLE_ID);
+
+ printReportInfo(gaData);
+ printProfileInfo(gaData);
+ printQueryInfo(gaData);
+ printPaginationInfo(gaData);
+ printTotalsForAllResults(gaData);
+ printColumnHeaders(gaData);
+ printDataTable(gaData);
+
+ } catch (GoogleJsonResponseException e) {
+ System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
+ + e.getDetails().getMessage());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /** Authorizes the installed application to access user's protected data. */
+ private static Credential authorize() throws Exception {
+ // load client secrets
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
+ JSON_FACTORY, new InputStreamReader(
+ HelloAnalyticsApiSample.class.getResourceAsStream("/client_secrets.json")));
+ if (clientSecrets.getDetails().getClientId().startsWith("Enter")
+ || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
+ System.out.println(
+ "Enter Client ID and Secret from https://code.google.com/apis/console/?api=analytics "
+ + "into analytics-cmdline-sample/src/main/resources/client_secrets.json");
+ System.exit(1);
+ }
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ HTTP_TRANSPORT, JSON_FACTORY, clientSecrets,
+ Collections.singleton(AnalyticsScopes.ANALYTICS_READONLY)).setDataStoreFactory(
+ DATA_STORE_FACTORY).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+ /**
+ * Performs all necessary setup steps for running requests against the API.
+ *
+ * @return an initialized Analytics service object.
+ *
+ * @throws Exception if an issue occurs with OAuth2Native authorize.
+ */
+ private static Analytics initializeAnalytics() throws Exception {
+ // Authorization.
+ Credential credential = authorize();
+
+ // Set up and return Google Analytics API client.
+ return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(
+ APPLICATION_NAME).build();
+ }
+
+ /**
+ * Returns the top 25 organic search keywords and traffic sources by visits. The Core Reporting
+ * API is used to retrieve this data.
+ *
+ * @param analytics the Analytics service object used to access the API.
+ * @param tableId the table ID from which to retrieve data.
+ * @return the response from the API.
+ * @throws IOException if an API error occured.
+ */
+ private static GaData executeDataQuery(Analytics analytics, String tableId) throws IOException {
+ return analytics.data().ga().get(tableId, // Table Id.
+ "2012-01-01", // Start date.
+ "2012-01-14", // End date.
+ "ga:visits") // Metrics.
+ .setDimensions("ga:source,ga:keyword")
+ .setSort("-ga:visits,ga:source")
+ .setFilters("ga:medium==organic")
+ .setMaxResults(25)
+ .execute();
+ }
+
+ /**
+ * Prints general information about this report.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printReportInfo(GaData gaData) {
+ System.out.println();
+ System.out.println("Response:");
+ System.out.println("ID:" + gaData.getId());
+ System.out.println("Self link: " + gaData.getSelfLink());
+ System.out.println("Kind: " + gaData.getKind());
+ System.out.println("Contains Sampled Data: " + gaData.getContainsSampledData());
+ }
+
+ /**
+ * Prints general information about the profile from which this report was accessed.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printProfileInfo(GaData gaData) {
+ ProfileInfo profileInfo = gaData.getProfileInfo();
+
+ System.out.println("Profile Info");
+ System.out.println("Account ID: " + profileInfo.getAccountId());
+ System.out.println("Web Property ID: " + profileInfo.getWebPropertyId());
+ System.out.println("Internal Web Property ID: " + profileInfo.getInternalWebPropertyId());
+ System.out.println("Profile ID: " + profileInfo.getProfileId());
+ System.out.println("Profile Name: " + profileInfo.getProfileName());
+ System.out.println("Table ID: " + profileInfo.getTableId());
+ }
+
+ /**
+ * Prints the values of all the parameters that were used to query the API.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printQueryInfo(GaData gaData) {
+ Query query = gaData.getQuery();
+
+ System.out.println("Query Info:");
+ System.out.println("Ids: " + query.getIds());
+ System.out.println("Start Date: " + query.getStartDate());
+ System.out.println("End Date: " + query.getEndDate());
+ System.out.println("Metrics: " + query.getMetrics()); // List
+ System.out.println("Dimensions: " + query.getDimensions()); // List
+ System.out.println("Sort: " + query.getSort()); // List
+ System.out.println("Segment: " + query.getSegment());
+ System.out.println("Filters: " + query.getFilters());
+ System.out.println("Start Index: " + query.getStartIndex());
+ System.out.println("Max Results: " + query.getMaxResults());
+ }
+
+ /**
+ * Prints common pagination information.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printPaginationInfo(GaData gaData) {
+ System.out.println("Pagination Info:");
+ System.out.println("Previous Link: " + gaData.getPreviousLink());
+ System.out.println("Next Link: " + gaData.getNextLink());
+ System.out.println("Items Per Page: " + gaData.getItemsPerPage());
+ System.out.println("Total Results: " + gaData.getTotalResults());
+ }
+
+ /**
+ * Prints the total metric value for all rows the query matched.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printTotalsForAllResults(GaData gaData) {
+ System.out.println("Metric totals over all results:");
+ Map totalsMap = gaData.getTotalsForAllResults();
+ for (Map.Entry entry : totalsMap.entrySet()) {
+ System.out.println(entry.getKey() + " : " + entry.getValue());
+ }
+ }
+
+ /**
+ * Prints the information for each column. The reporting data from the API is returned as rows of
+ * data. The column headers describe the names and types of each column in rows.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printColumnHeaders(GaData gaData) {
+ System.out.println("Column Headers:");
+
+ for (ColumnHeaders header : gaData.getColumnHeaders()) {
+ System.out.println("Column Name: " + header.getName());
+ System.out.println("Column Type: " + header.getColumnType());
+ System.out.println("Column Data Type: " + header.getDataType());
+ }
+ }
+
+ /**
+ * Prints all the rows of data returned by the API.
+ *
+ * @param gaData the data returned from the API.
+ */
+ private static void printDataTable(GaData gaData) {
+ if (gaData.getTotalResults() > 0) {
+ System.out.println("Data Table:");
+
+ // Print the column names.
+ for (ColumnHeaders header : gaData.getColumnHeaders()) {
+ System.out.format("%-32s", header.getName());
+ }
+ System.out.println();
+
+ // Print the rows of data.
+ for (List rowValues : gaData.getRows()) {
+ for (String value : rowValues) {
+ System.out.format("%-32s", value);
+ }
+ System.out.println();
+ }
+ } else {
+ System.out.println("No data");
+ }
+ }
+}
diff --git a/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/HelloAnalyticsApiSample.java b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/HelloAnalyticsApiSample.java
new file mode 100644
index 00000000..3d3a979d
--- /dev/null
+++ b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/HelloAnalyticsApiSample.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.analytics.cmdline;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.DataStoreFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.analytics.Analytics;
+import com.google.api.services.analytics.AnalyticsScopes;
+import com.google.api.services.analytics.model.Accounts;
+import com.google.api.services.analytics.model.GaData;
+import com.google.api.services.analytics.model.GaData.ColumnHeaders;
+import com.google.api.services.analytics.model.Profiles;
+import com.google.api.services.analytics.model.Webproperties;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.List;
+
+
+/**
+ * This is a basic hello world sample for the Google Analytics API. It is designed to run from the
+ * command line and will prompt a user to grant access to their data. Once complete, the sample will
+ * traverse the Management API hierarchy by going through the authorized user's first account, first
+ * web property, and finally the first profile and retrieve the first profile id. This ID is then
+ * used with the Core Reporting API to retrieve the top 25 organic search terms.
+ *
+ * @author api.nickm@gmail.com
+ */
+public class HelloAnalyticsApiSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ /** Directory to store user credentials. */
+ private static final java.io.File DATA_STORE_DIR =
+ new java.io.File(System.getProperty("user.home"), ".store/analytics_sample");
+
+ /**
+ * Global instance of the {@link DataStoreFactory}. The best practice is to make it a single
+ * globally shared instance across your application.
+ */
+ private static FileDataStoreFactory dataStoreFactory;
+
+ /** Global instance of the HTTP transport. */
+ private static HttpTransport httpTransport;
+
+ /** Global instance of the JSON factory. */
+ private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
+
+ /**
+ * Main demo. This first initializes an analytics service object. It then uses the Google
+ * Analytics Management API to get the first profile ID for the authorized user. It then uses the
+ * Core Reporting API to retrieve the top 25 organic search terms. Finally the results are printed
+ * to the screen. If an API error occurs, it is printed here.
+ *
+ * @param args command line args.
+ */
+ public static void main(String[] args) {
+ try {
+ httpTransport = GoogleNetHttpTransport.newTrustedTransport();
+ dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);
+ Analytics analytics = initializeAnalytics();
+ String profileId = getFirstProfileId(analytics);
+ if (profileId == null) {
+ System.err.println("No profiles found.");
+ } else {
+ GaData gaData = executeDataQuery(analytics, profileId);
+ printGaData(gaData);
+ }
+ } catch (GoogleJsonResponseException e) {
+ System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
+ + e.getDetails().getMessage());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /** Authorizes the installed application to access user's protected data. */
+ private static Credential authorize() throws Exception {
+ // load client secrets
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
+ JSON_FACTORY, new InputStreamReader(
+ HelloAnalyticsApiSample.class.getResourceAsStream("/client_secrets.json")));
+ if (clientSecrets.getDetails().getClientId().startsWith("Enter")
+ || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
+ System.out.println(
+ "Enter Client ID and Secret from https://code.google.com/apis/console/?api=analytics "
+ + "into analytics-cmdline-sample/src/main/resources/client_secrets.json");
+ System.exit(1);
+ }
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ httpTransport, JSON_FACTORY, clientSecrets,
+ Collections.singleton(AnalyticsScopes.ANALYTICS_READONLY)).setDataStoreFactory(
+ dataStoreFactory).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+ /**
+ * Performs all necessary setup steps for running requests against the API.
+ *
+ * @return An initialized Analytics service object.
+ *
+ * @throws Exception if an issue occurs with OAuth2Native authorize.
+ */
+ private static Analytics initializeAnalytics() throws Exception {
+ // Authorization.
+ Credential credential = authorize();
+
+ // Set up and return Google Analytics API client.
+ return new Analytics.Builder(httpTransport, JSON_FACTORY, credential).setApplicationName(
+ APPLICATION_NAME).build();
+ }
+
+ /**
+ * Returns the first profile id by traversing the Google Analytics Management API. This makes 3
+ * queries, first to the accounts collection, then to the web properties collection, and finally
+ * to the profiles collection. In each request the first ID of the first entity is retrieved and
+ * used in the query for the next collection in the hierarchy.
+ *
+ * @param analytics the analytics service object used to access the API.
+ * @return the profile ID of the user's first account, web property, and profile.
+ * @throws IOException if the API encounters an error.
+ */
+ private static String getFirstProfileId(Analytics analytics) throws IOException {
+ String profileId = null;
+
+ // Query accounts collection.
+ Accounts accounts = analytics.management().accounts().list().execute();
+
+ if (accounts.getItems().isEmpty()) {
+ System.err.println("No accounts found");
+ } else {
+ String firstAccountId = accounts.getItems().get(0).getId();
+
+ // Query webproperties collection.
+ Webproperties webproperties =
+ analytics.management().webproperties().list(firstAccountId).execute();
+
+ if (webproperties.getItems().isEmpty()) {
+ System.err.println("No Webproperties found");
+ } else {
+ String firstWebpropertyId = webproperties.getItems().get(0).getId();
+
+ // Query profiles collection.
+ Profiles profiles =
+ analytics.management().profiles().list(firstAccountId, firstWebpropertyId).execute();
+
+ if (profiles.getItems().isEmpty()) {
+ System.err.println("No profiles found");
+ } else {
+ profileId = profiles.getItems().get(0).getId();
+ }
+ }
+ }
+ return profileId;
+ }
+
+ /**
+ * Returns the top 25 organic search keywords and traffic source by visits. The Core Reporting API
+ * is used to retrieve this data.
+ *
+ * @param analytics the analytics service object used to access the API.
+ * @param profileId the profile ID from which to retrieve data.
+ * @return the response from the API.
+ * @throws IOException tf an API error occured.
+ */
+ private static GaData executeDataQuery(Analytics analytics, String profileId) throws IOException {
+ return analytics.data().ga().get("ga:" + profileId, // Table Id. ga: + profile id.
+ "2012-01-01", // Start date.
+ "2012-01-14", // End date.
+ "ga:visits") // Metrics.
+ .setDimensions("ga:source,ga:keyword")
+ .setSort("-ga:visits,ga:source")
+ .setFilters("ga:medium==organic")
+ .setMaxResults(25)
+ .execute();
+ }
+
+ /**
+ * Prints the output from the Core Reporting API. The profile name is printed along with each
+ * column name and all the data in the rows.
+ *
+ * @param results data returned from the Core Reporting API.
+ */
+ private static void printGaData(GaData results) {
+ System.out.println(
+ "printing results for profile: " + results.getProfileInfo().getProfileName());
+
+ if (results.getRows() == null || results.getRows().isEmpty()) {
+ System.out.println("No results Found.");
+ } else {
+
+ // Print column headers.
+ for (ColumnHeaders header : results.getColumnHeaders()) {
+ System.out.printf("%30s", header.getName());
+ }
+ System.out.println();
+
+ // Print actual data.
+ for (List row : results.getRows()) {
+ for (String column : row) {
+ System.out.printf("%30s", column);
+ }
+ System.out.println();
+ }
+
+ System.out.println();
+ }
+ }
+}
diff --git a/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/ManagementApiReferenceSample.java b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/ManagementApiReferenceSample.java
new file mode 100644
index 00000000..4a7f66cd
--- /dev/null
+++ b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/ManagementApiReferenceSample.java
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.api.services.samples.analytics.cmdline;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.DataStoreFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.analytics.Analytics;
+import com.google.api.services.analytics.AnalyticsScopes;
+import com.google.api.services.analytics.model.Account;
+import com.google.api.services.analytics.model.Accounts;
+import com.google.api.services.analytics.model.Goal;
+import com.google.api.services.analytics.model.Goal.EventDetails;
+import com.google.api.services.analytics.model.Goal.EventDetails.EventConditions;
+import com.google.api.services.analytics.model.Goal.UrlDestinationDetails;
+import com.google.api.services.analytics.model.Goal.UrlDestinationDetails.Steps;
+import com.google.api.services.analytics.model.Goal.VisitNumPagesDetails;
+import com.google.api.services.analytics.model.Goal.VisitTimeOnSiteDetails;
+import com.google.api.services.analytics.model.Goals;
+import com.google.api.services.analytics.model.Profile;
+import com.google.api.services.analytics.model.Profiles;
+import com.google.api.services.analytics.model.Segment;
+import com.google.api.services.analytics.model.Segments;
+import com.google.api.services.analytics.model.Webproperties;
+import com.google.api.services.analytics.model.Webproperty;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+
+/**
+ * This sample application demonstrates how to traverse the Management API. At each level, all the
+ * important information about each entity is printed to the screen.
+ *
+ * @author api.nickm@gmail.com
+ */
+public class ManagementApiReferenceSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ /** Directory to store user credentials. */
+ private static final java.io.File DATA_STORE_DIR =
+ new java.io.File(System.getProperty("user.home"), ".store/analytics_sample");
+
+ /**
+ * Global instance of the {@link DataStoreFactory}. The best practice is to make it a single
+ * globally shared instance across your application.
+ */
+ private static FileDataStoreFactory DATA_STORE_FACTORY;
+
+ /** Global instance of the HTTP transport. */
+ private static HttpTransport HTTP_TRANSPORT;
+
+ /** Global instance of the JSON factory. */
+ private static final JsonFactory JSON_FACTORY = new JacksonFactory();
+
+ /**
+ * Main demo. An Analytics service object is instantiated and then it is used to traverse and
+ * print all the Management API entities. If any exceptions occur, they are caught and printed.
+ *
+ * @param args command line args.
+ */
+ public static void main(String args[]) {
+ try {
+ HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
+ DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
+ Analytics analytics = initializeAnalytics();
+ printManagementEntities(analytics);
+
+ } catch (GoogleJsonResponseException e) {
+ System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
+ + e.getDetails().getMessage());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /** Authorizes the installed application to access user's protected data. */
+ private static Credential authorize() throws Exception {
+ // load client secrets
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
+ JSON_FACTORY, new InputStreamReader(
+ HelloAnalyticsApiSample.class.getResourceAsStream("/client_secrets.json")));
+ if (clientSecrets.getDetails().getClientId().startsWith("Enter")
+ || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
+ System.out.println(
+ "Enter Client ID and Secret from https://code.google.com/apis/console/?api=analytics "
+ + "into analytics-cmdline-sample/src/main/resources/client_secrets.json");
+ System.exit(1);
+ }
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ HTTP_TRANSPORT, JSON_FACTORY, clientSecrets,
+ Collections.singleton(AnalyticsScopes.ANALYTICS_READONLY)).setDataStoreFactory(
+ DATA_STORE_FACTORY).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+ /**
+ * Performs all necessary setup steps for running requests against the API.
+ *
+ * @return An initialized Analytics service object.
+ *
+ * @throws Exception if an issue occurs with OAuth2Native authorize.
+ */
+ private static Analytics initializeAnalytics() throws Exception {
+ // Authorization.
+ Credential credential = authorize();
+
+ // Set up and return Google Analytics API client.
+ return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(
+ APPLICATION_NAME).setHttpRequestInitializer(credential).build();
+ }
+
+ /**
+ * Traverses through the Management API hiearchy and prints each entity. This retrieves and prints
+ * the authorized user's accounts. It then retrieves and prints all the web properties for the
+ * first account, retrieves and prints all the profiles for the first web property, and retrieves
+ * and prints all the goals for the first profile. Finally all the user's segments are prtined.
+ *
+ * @param analytics an initialized Analytics service object.
+ * @throws IOException if any network errors occured.
+ */
+ private static void printManagementEntities(Analytics analytics) throws IOException {
+
+ // Query accounts collection.
+ Accounts accounts = analytics.management().accounts().list().execute();
+
+ if (accounts.getItems().isEmpty()) {
+ System.err.println("No accounts found");
+ } else {
+ printAccounts(accounts);
+ String firstAccountId = accounts.getItems().get(0).getId();
+
+ // Query webproperties collection.
+ Webproperties webproperties =
+ analytics.management().webproperties().list(firstAccountId).execute();
+
+ if (webproperties.getItems().isEmpty()) {
+ System.err.println("No webproperties found");
+ } else {
+ printWebProperties(webproperties);
+ String firstWebpropertyId = webproperties.getItems().get(0).getId();
+
+ // Query profiles collection.
+ Profiles profiles =
+ analytics.management().profiles().list(firstAccountId, firstWebpropertyId).execute();
+
+ if (profiles.getItems().isEmpty()) {
+ System.err.println("No profiles found");
+ } else {
+ printProfiles(profiles);
+ String firstProfileId = profiles.getItems().get(0).getId();
+
+ // Query goals collection.
+ Goals goals = analytics.management()
+ .goals().list(firstAccountId, firstWebpropertyId, firstProfileId).execute();
+
+ if (goals.getItems() == null || goals.getItems().isEmpty()) {
+ System.err.println("No goals found");
+ } else {
+ printGoals(goals);
+ }
+ }
+ }
+ }
+ Segments segments = analytics.management().segments().list().execute();
+ printSegments(segments);
+ }
+
+ /**
+ * Prints all the account information from the accounts collection.
+ *
+ * @param accounts the results from the accounts collection.
+ */
+ private static void printAccounts(Accounts accounts) {
+ System.out.println("\n----- Accounts Collection -----\n");
+
+ for (Account account : accounts.getItems()) {
+ System.out.println("Account ID: " + account.getId());
+ System.out.println("Account Name: " + account.getName());
+ System.out.println("Account Created: " + account.getCreated());
+ System.out.println("Account Updated: " + account.getUpdated());
+ }
+ }
+
+ /**
+ * Prints all the webproperty information from the webproperties collection.
+ *
+ * @param webproperties the results from the webproperties collection.
+ */
+ private static void printWebProperties(Webproperties webproperties) {
+ System.out.println("\n----- Webproperties Collection -----\n");
+
+ for (Webproperty webproperty : webproperties.getItems()) {
+ System.out.println("Account ID: " + webproperty.getAccountId());
+ System.out.println("Web Property ID: " + webproperty.getId());
+ System.out.println("Web Property Name: " + webproperty.getName());
+ System.out.println("Web Property Internal Id: " + webproperty.getInternalWebPropertyId());
+ System.out.println("Web Property Website URL: " + webproperty.getWebsiteUrl());
+ System.out.println("Web Property Created: " + webproperty.getCreated());
+ System.out.println("Web Property Updated: " + webproperty.getUpdated());
+ }
+ }
+
+ /**
+ * Prints all the profile information from the profiles collection.
+ *
+ * @param profiles the results from the profiles collection.
+ */
+ private static void printProfiles(Profiles profiles) {
+ System.out.println("\n----- Profiles Collection -----\n");
+
+ for (Profile profile : profiles.getItems()) {
+ System.out.println("Account ID: " + profile.getAccountId());
+ System.out.println("Web Property ID: " + profile.getWebPropertyId());
+ System.out.println("Web Property Internal ID: " + profile.getInternalWebPropertyId());
+ System.out.println("Profile ID: " + profile.getId());
+ System.out.println("Profile Name: " + profile.getName());
+
+ System.out.println("Profile defaultPage: " + profile.getDefaultPage());
+ System.out.println(
+ "Profile Exclude Query Parameters: " + profile.getExcludeQueryParameters());
+ System.out.println(
+ "Profile Site Search Query Parameters: " + profile.getSiteSearchQueryParameters());
+ System.out.println(
+ "Profile Site Search Category Parameters: " + profile.getSiteSearchCategoryParameters());
+
+ System.out.println("Profile Currency: " + profile.getCurrency());
+ System.out.println("Profile Timezone: " + profile.getTimezone());
+ System.out.println("Profile Created: " + profile.getCreated());
+ System.out.println("Profile Updated: " + profile.getUpdated());
+ }
+ }
+
+ /**
+ * Prints all the goal information from the goals collection. A goal can be one of 4 types.
+ * Depending on the goal type, the appropriate goal data is printed.
+ *
+ * @param goals the results from the goals collection.
+ */
+ private static void printGoals(Goals goals) {
+ System.out.println("\n----- Goals Collection -----\n");
+
+ for (Goal goal : goals.getItems()) {
+ System.out.println("Account ID: " + goal.getAccountId());
+ System.out.println("Web Property ID: " + goal.getWebPropertyId());
+ System.out.println("Web Property Internal Id: " + goal.getInternalWebPropertyId());
+ System.out.println("Profile ID: " + goal.getId());
+
+ System.out.println("Goal Number: " + goal.getId());
+ System.out.println("Goal Name: " + goal.getName());
+ System.out.println("Is Goal Active: " + goal.getActive());
+ System.out.println("Goal Value: " + goal.getValue());
+ System.out.println("Goal Type: " + goal.getType());
+ System.out.println("Goal Created: " + goal.getCreated());
+ System.out.println("Goal Updated: " + goal.getUpdated());
+
+ if (goal.getType().equals("URL_DESTINATION")) {
+ printUrlDestinationDetails(goal.getUrlDestinationDetails());
+
+ } else if (goal.getType().equals("VISIT_TIME_ON_SITE")) {
+ printVisitTimeOnSiteDetails(goal.getVisitTimeOnSiteDetails());
+
+ } else if (goal.getType().equals("VISIT_NUM_PAGES")) {
+ printVisitNumPagesDetails(goal.getVisitNumPagesDetails());
+
+ } else if (goal.getType().equals("EVENT")) {
+ printGoalEventDetails(goal.getEventDetails());
+ }
+ }
+ }
+
+ /**
+ * Prints details for URL_DESTINATION type goals. Each of these goals might have one or more goal
+ * steps configured. If any are present, they are printed.
+ *
+ * @param destinationDetails the details of a DESTINATION type goal.
+ */
+ private static void printUrlDestinationDetails(UrlDestinationDetails destinationDetails) {
+ System.out.println("Goal Url: " + destinationDetails.getUrl());
+ System.out.println("Case Sensitive: " + destinationDetails.getCaseSensitive());
+ System.out.println("Match Type: " + destinationDetails.getMatchType());
+ System.out.println("First Step Required: " + destinationDetails.getFirstStepRequired());
+
+ if (destinationDetails.getSteps() != null) {
+ System.out.println("Goal Steps: ");
+ for (Steps step : destinationDetails.getSteps()) {
+ System.out.println("Step Number: " + step.getNumber());
+ System.out.println("Name: " + step.getName());
+ System.out.println("URL: " + step.getUrl());
+ }
+ } else {
+ System.out.println("No Steps Configured");
+ }
+ }
+
+ /**
+ * Prints details for VISIT_TIME_ON_SITE type goals.
+ *
+ * @param visitTimeOnSiteDetails the details of a VISIT_TIME_ON_SITE goal.
+ */
+ private static void printVisitTimeOnSiteDetails(VisitTimeOnSiteDetails visitTimeOnSiteDetails) {
+
+ System.out.println("Goal Type: VISIT_TIME_ON_SITE");
+ System.out.println(
+ "VISIT_TIME_ON_SITE - Comparison Type: " + visitTimeOnSiteDetails.getComparisonType());
+ System.out.println(
+ "VISIT_TIME_ON_SITE - Comparison Value: " + visitTimeOnSiteDetails.getComparisonValue());
+ }
+
+ /**
+ * Prints details for VISIT_NUM_PAGES type goals.
+ *
+ * @param visitNumPagesDetails the details of a VISIT_NUM_PAGES goal.
+ */
+ private static void printVisitNumPagesDetails(VisitNumPagesDetails visitNumPagesDetails) {
+ System.out.println("Goal Type: VISIT_NUM_PAGES");
+ System.out.println(
+ "VISIT_NUM_PAGES - Comparison Type: " + visitNumPagesDetails.getComparisonType());
+ System.out.println(
+ "VISIT_NUM_PAGES - Comparison Value: " + visitNumPagesDetails.getComparisonValue());
+ }
+
+ /**
+ * Prints details for EVENT type goals.
+ *
+ * @param eventDetails the details of an EVENT type goal.
+ */
+ private static void printGoalEventDetails(EventDetails eventDetails) {
+ System.out.println("Goal Type: EVENT");
+ System.out.println("EVENT - Use Event Value: " + eventDetails.getUseEventValue());
+
+ if (eventDetails.getEventConditions() != null) {
+ System.out.println("Goal Conditions: ");
+ for (EventConditions conditions : eventDetails.getEventConditions()) {
+ System.out.println("Type: " + conditions.getType());
+
+ if (conditions.getType().equals("VALUE")) {
+ System.out.println("Comparison Type: " + conditions.getComparisonType());
+ System.out.println("Comparison Value: " + conditions.getComparisonValue());
+ } else {
+ System.out.println("matchType: " + conditions.getMatchType());
+ System.out.println("expression: " + conditions.getExpression());
+ }
+ }
+ }
+ }
+
+ /**
+ * Prints all the segment infromation from the segements collection.
+ *
+ * @param segments the results from the segments collection.
+ */
+ private static void printSegments(Segments segments) {
+ System.out.println("\n----- Segments Collection -----\n");
+
+ for (Segment segment : segments.getItems()) {
+ System.out.println("Advanced Segment ID: " + segment.getId());
+ System.out.println("Advanced Segment Name: " + segment.getName());
+ System.out.println("Advanced Segment Definition: " + segment.getDefinition());
+
+ // These fields are only set for custom segments and not default segments.
+ if (segment.getCreated() != null) {
+ System.out.println("Advanced Segment Created: " + segment.getCreated());
+ System.out.println("Advanced Segment Updated: " + segment.getUpdated());
+ }
+ }
+ }
+}
diff --git a/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/McfReportingApiReferenceSample.java b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/McfReportingApiReferenceSample.java
new file mode 100644
index 00000000..ededed80
--- /dev/null
+++ b/analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/McfReportingApiReferenceSample.java
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.api.services.samples.analytics.cmdline;
+
+import com.google.api.client.auth.oauth2.Credential;
+import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
+import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
+import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
+import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.client.util.store.DataStoreFactory;
+import com.google.api.client.util.store.FileDataStoreFactory;
+import com.google.api.services.analytics.Analytics;
+import com.google.api.services.analytics.AnalyticsScopes;
+import com.google.api.services.analytics.model.McfData;
+import com.google.api.services.analytics.model.McfData.ColumnHeaders;
+import com.google.api.services.analytics.model.McfData.ProfileInfo;
+import com.google.api.services.analytics.model.McfData.Query;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This application demonstrates how to use the Google Analytics Java client library to access all
+ * the pieces of data returned by the Google Analytics Multi-Channel Funnels API v3.
+ *
+ * To run this, you must supply your profile ID. Read the Core Reporting API developer guide to
+ * learn how to get this value.
+ *
+ * @author nafi@google.com
+ * @author api.nickm@gmail.com
+ */
+public class McfReportingApiReferenceSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ /** Directory to store user credentials. */
+ private static final java.io.File DATA_STORE_DIR =
+ new java.io.File(System.getProperty("user.home"), ".store/analytics_sample");
+
+ /**
+ * Global instance of the {@link DataStoreFactory}. The best practice is to make it a single
+ * globally shared instance across your application.
+ */
+ private static FileDataStoreFactory DATA_STORE_FACTORY;
+
+ /** Global instance of the HTTP transport. */
+ private static HttpTransport HTTP_TRANSPORT;
+
+ /** Global instance of the JSON factory. */
+ private static final JsonFactory JSON_FACTORY = new JacksonFactory();
+
+ /**
+ * TABLE ID of the format 'ga:xxx' where 'xxx' is your profile ID.
+ */
+ private static final String TABLE_ID = "_your_table_id_";
+
+ private static final String MCF_SEQUENCE_TYPE = "MCF_SEQUENCE";
+ private static final String INTEGER_TYPE = "INTEGER";
+
+ /**
+ * Main demo. This first initializes an analytics service object. It then uses the MCF API to
+ * retrieve the top 25 source paths with most total conversions. It will also retrieve the top 25
+ * organic sources with most total conversions. Finally the results are printed to the screen. If
+ * an API error occurs, it is printed here.
+ *
+ * @param args command line args.
+ */
+ public static void main(String[] args) {
+ try {
+ HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
+ DATA_STORE_FACTORY = new FileDataStoreFactory(DATA_STORE_DIR);
+ Analytics analytics = initializeAnalytics();
+
+ McfData mcfPathData = executePathQuery(analytics, TABLE_ID);
+ printAllInfo(mcfPathData);
+
+ McfData mcfInteractionData = executeInteractionQuery(analytics, TABLE_ID);
+ printAllInfo(mcfInteractionData);
+
+ } catch (GoogleJsonResponseException e) {
+ System.err.println("There was a service error: " + e.getDetails().getCode() + " : "
+ + e.getDetails().getMessage());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ /**
+ * Print all data returned from the API.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ public static void printAllInfo(McfData mcfData) {
+ printReportInfo(mcfData);
+ printProfileInfo(mcfData);
+ printQueryInfo(mcfData);
+ printPaginationInfo(mcfData);
+ printTotalsForAllResults(mcfData);
+ printColumnHeaders(mcfData);
+ printDataTable(mcfData);
+ System.out.println();
+ System.out.println();
+ }
+
+ /** Authorizes the installed application to access user's protected data. */
+ private static Credential authorize() throws Exception {
+ // load client secrets
+ GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(
+ JSON_FACTORY, new InputStreamReader(
+ HelloAnalyticsApiSample.class.getResourceAsStream("/client_secrets.json")));
+ if (clientSecrets.getDetails().getClientId().startsWith("Enter")
+ || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {
+ System.out.println(
+ "Enter Client ID and Secret from https://code.google.com/apis/console/?api=analytics "
+ + "into analytics-cmdline-sample/src/main/resources/client_secrets.json");
+ System.exit(1);
+ }
+ // set up authorization code flow
+ GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
+ HTTP_TRANSPORT, JSON_FACTORY, clientSecrets,
+ Collections.singleton(AnalyticsScopes.ANALYTICS_READONLY)).setDataStoreFactory(
+ DATA_STORE_FACTORY).build();
+ // authorize
+ return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
+ }
+
+ /**
+ * Performs all necessary setup steps for running requests against the API.
+ *
+ * @return an initialized Analytics service object.
+ *
+ * @throws Exception if an issue occurs with OAuth2Native authorize.
+ */
+ private static Analytics initializeAnalytics() throws Exception {
+ // Authorization.
+ Credential credential = authorize();
+
+ // Set up and return Google Analytics API client.
+ return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(
+ APPLICATION_NAME).build();
+ }
+
+ /**
+ * Returns the top 25 source paths with most total conversions. The MCF API is used to retrieve
+ * this data.
+ *
+ * @param analytics The analytics service object used to access the API.
+ * @param tableId The table ID from which to retrieve data.
+ * @return The response from the API.
+ * @throws IOException If an API error occurred.
+ */
+ private static McfData executePathQuery(Analytics analytics, String tableId) throws IOException {
+ return analytics.data().mcf().get(tableId, "2012-01-01", // Start date.
+ "2012-03-31", // End date.
+ "mcf:totalConversions") // Metrics.
+ .setDimensions("mcf:sourcePath")
+ .setSort("-mcf:totalConversions")
+ .setMaxResults(25)
+ .execute();
+ }
+
+ /**
+ * Returns the top 25 organic sources with most total conversions. The MCF API is used to retrieve
+ * this data.
+ *
+ * @param analytics The analytics service object used to access the API.
+ * @param tableId The table ID from which to retrieve data.
+ * @return The response from the API.
+ * @throws IOException If an API error occurred.
+ */
+ private static McfData executeInteractionQuery(Analytics analytics, String tableId)
+ throws IOException {
+ return analytics.data().mcf().get(tableId, "2012-01-01", // Start date.
+ "2012-03-31", // End date.
+ "mcf:totalConversions") // Metrics.
+ .setDimensions("mcf:source")
+ .setSort("-mcf:totalConversions")
+ .setFilters("mcf:medium==organic")
+ .setMaxResults(25)
+ .execute();
+ }
+
+ /**
+ * Prints general information about this report.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printReportInfo(McfData mcfData) {
+ System.out.println();
+ System.out.println("Report Info:");
+ System.out.println("ID:" + mcfData.getId());
+ System.out.println("Self link: " + mcfData.getSelfLink());
+ System.out.println("Kind: " + mcfData.getKind());
+ System.out.println("Contains Sampled Data: " + mcfData.getContainsSampledData());
+ System.out.println();
+ }
+
+ /**
+ * Prints general information about the profile from which this report was accessed.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printProfileInfo(McfData mcfData) {
+ ProfileInfo profileInfo = mcfData.getProfileInfo();
+
+ System.out.println("Profile Info:");
+ System.out.println("Account ID: " + profileInfo.getAccountId());
+ System.out.println("Web Property ID: " + profileInfo.getWebPropertyId());
+ System.out.println("Internal Web Property ID: " + profileInfo.getInternalWebPropertyId());
+ System.out.println("Profile ID: " + profileInfo.getProfileId());
+ System.out.println("Profile Name: " + profileInfo.getProfileName());
+ System.out.println("Table ID: " + profileInfo.getTableId());
+ System.out.println();
+ }
+
+ /**
+ * Prints the values of all the parameters that were used to query the API.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printQueryInfo(McfData mcfData) {
+ Query query = mcfData.getQuery();
+
+ System.out.println("Query Info:");
+ System.out.println("Ids: " + query.getIds());
+ System.out.println("Start Date: " + query.getStartDate());
+ System.out.println("End Date: " + query.getEndDate());
+ System.out.println("Metrics: " + query.getMetrics()); // List
+ System.out.println("Dimensions: " + query.getDimensions()); // List
+ System.out.println("Sort: " + query.getSort()); // List
+ System.out.println("Segment: " + query.getSegment());
+ System.out.println("Filters: " + query.getFilters());
+ System.out.println("Start Index: " + query.getStartIndex());
+ System.out.println("Max Results: " + query.getMaxResults());
+ System.out.println();
+ }
+
+ /**
+ * Prints common pagination information.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printPaginationInfo(McfData mcfData) {
+ System.out.println("Pagination Info:");
+ System.out.println("Previous Link: " + mcfData.getPreviousLink());
+ System.out.println("Next Link: " + mcfData.getNextLink());
+ System.out.println("Items Per Page: " + mcfData.getItemsPerPage());
+ System.out.println("Total Results: " + mcfData.getTotalResults());
+ System.out.println();
+ }
+
+ /**
+ * Prints the total metric value for all rows the query matched.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printTotalsForAllResults(McfData mcfData) {
+ System.out.println("Metric totals over all results:");
+ Map totalsMap = mcfData.getTotalsForAllResults();
+ for (Map.Entry entry : totalsMap.entrySet()) {
+ System.out.println(entry.getKey() + " : " + entry.getValue());
+ }
+ System.out.println();
+ }
+
+ /**
+ * Prints the information for each column. The reporting data from the API is returned as rows of
+ * data. The column headers describe the names and types of each column in rows.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printColumnHeaders(McfData mcfData) {
+ System.out.println("Column Headers:");
+
+ for (ColumnHeaders header : mcfData.getColumnHeaders()) {
+ System.out.println("Column Name: " + header.getName());
+ System.out.println("Column Type: " + header.getColumnType());
+ System.out.println("Column Data Type: " + header.getDataType());
+ }
+ System.out.println();
+ }
+
+ /**
+ * Prints all the rows of data returned by the API.
+ *
+ * @param mcfData the data returned from the API.
+ */
+ private static void printDataTable(McfData mcfData) {
+ System.out.println("Data Table:");
+ if (mcfData.getTotalResults() > 0) {
+ // Print the column names.
+ List headers = mcfData.getColumnHeaders();
+ for (ColumnHeaders header : headers) {
+ if (header.getDataType().equals(MCF_SEQUENCE_TYPE)) {
+ System.out.printf("%-50s", header.getName());
+ } else {
+ System.out.printf("%25s", header.getName());
+ }
+ }
+ System.out.println();
+
+ // Print the rows of data.
+ for (List row : mcfData.getRows()) {
+ for (int columnIndex = 0; columnIndex < row.size(); ++columnIndex) {
+ ColumnHeaders header = headers.get(columnIndex);
+ McfData.Rows cell = row.get(columnIndex);
+ if (header.getDataType().equals(MCF_SEQUENCE_TYPE)) {
+ System.out.printf(
+ "%-50s", getStringFromMcfSequence(cell.getConversionPathValue(), " > "));
+ } else if (header.getDataType().equals(INTEGER_TYPE)) {
+ System.out.printf("%25d", Long.parseLong(cell.getPrimitiveValue()));
+ } else {
+ System.out.printf("%25s", cell.getPrimitiveValue());
+ }
+ }
+ System.out.println();
+ }
+ } else {
+ System.out.println("No rows found");
+ }
+ System.out.println();
+ }
+
+ /**
+ * Builds and gets a string to represent the path data contained in a list of
+ * McfData.Rows.ConversionPathValue objects.
+ *
+ * @param path List of MCF path elements.
+ * @param delimiter The string that will be used while joining all path elements.
+ */
+ private static String getStringFromMcfSequence(
+ List path, String delimiter) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (McfData.Rows.ConversionPathValue pathElement : path) {
+ if (stringBuilder.length() > 0) stringBuilder.append(delimiter);
+ stringBuilder.append(pathElement.getNodeValue());
+ }
+ return stringBuilder.toString();
+ }
+}
diff --git a/analytics-cmdline-sample/src/main/resources/client_secrets.json b/analytics-cmdline-sample/src/main/resources/client_secrets.json
new file mode 100644
index 00000000..e448bab9
--- /dev/null
+++ b/analytics-cmdline-sample/src/main/resources/client_secrets.json
@@ -0,0 +1,6 @@
+{
+ "installed": {
+ "client_id": "Enter Client ID",
+ "client_secret": "Enter Client Secret"
+ }
+}
diff --git a/bigquery-appengine-sample/.checkstyle b/bigquery-appengine-sample/.checkstyle
new file mode 100644
index 00000000..c302f857
--- /dev/null
+++ b/bigquery-appengine-sample/.checkstyle
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/bigquery-appengine-sample/.classpath b/bigquery-appengine-sample/.classpath
new file mode 100644
index 00000000..0f7cd608
--- /dev/null
+++ b/bigquery-appengine-sample/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/bigquery-appengine-sample/.project b/bigquery-appengine-sample/.project
new file mode 100644
index 00000000..fc490aea
--- /dev/null
+++ b/bigquery-appengine-sample/.project
@@ -0,0 +1,39 @@
+
+
+ bigquery-appengine-sample
+
+
+
+
+
+ com.google.appengine.eclipse.core.projectValidator
+
+
+
+
+ com.google.gdt.eclipse.core.webAppProjectValidator
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+ com.google.appengine.eclipse.core.enhancerbuilder
+
+
+
+
+
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.jdt.core.javanature
+ com.google.appengine.eclipse.core.gaeNature
+
+
diff --git a/bigquery-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs b/bigquery-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs
new file mode 100644
index 00000000..e73342c6
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.8.2.jar|appengine-api-labs.jar|appengine-endpoints.jar|appengine-jsr107cache-1.8.2.jar|datanucleus-appengine-1.0.10.final.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar|jsr107cache-1.1.jar
+gaeDeployDialogSettings=
diff --git a/bigquery-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs b/bigquery-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs
new file mode 100644
index 00000000..416f1aad
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs
@@ -0,0 +1,5 @@
+#Fri Nov 04 10:12:20 PDT 2011
+eclipse.preferences.version=1
+jarsExcludedFromWebInfLib=
+warSrcDir=target/war
+warSrcDirIsOutput=true
diff --git a/bigquery-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs b/bigquery-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs
new file mode 100644
index 00000000..265a336e
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs
@@ -0,0 +1,4 @@
+#Wed Nov 09 11:40:20 PST 2011
+eclipse.preferences.version=1
+entryPointModules=
+filesCopiedToWebInfLib=
diff --git a/bigquery-appengine-sample/.settings/org.eclipse.core.resources.prefs b/bigquery-appengine-sample/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..dd5aeb3b
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+#Fri Nov 11 13:26:55 PST 2011
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
diff --git a/bigquery-appengine-sample/.settings/org.eclipse.jdt.core.prefs b/bigquery-appengine-sample/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..faf086f4
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,380 @@
+#Fri Nov 04 10:10:38 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
+org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
+org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=false
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false
+org.eclipse.jdt.core.formatter.sort_member_annotations=false
+org.eclipse.jdt.core.formatter.sort_package_annotations=false
+org.eclipse.jdt.core.formatter.sort_parameter_annotations=false
+org.eclipse.jdt.core.formatter.sort_type_annotations=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
diff --git a/bigquery-appengine-sample/.settings/org.eclipse.jdt.ui.prefs b/bigquery-appengine-sample/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..96ded168
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,118 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_google-api-java-client
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_google-api-java-client 100
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=exception
+org.eclipse.jdt.ui.gettersetter.use.is=false
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com;org;;java;javax;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=999
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=999
+org.eclipse.jdt.ui.text.custom_code_templates=/*\n * Copyright (c) 2011 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\n * in compliance with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the License\n * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n * or implied. See the License for the specific language governing permissions and limitations under\n * the License.\n */\n/**\n * @author ${user}@google.com (Your Name Here)\n *\n * ${tags}\n *//**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * @author Yaniv Inbar\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-JSDoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/bigquery-appengine-sample/.settings/org.eclipse.ltk.core.refactoring.prefs b/bigquery-appengine-sample/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 00000000..daf4a5fa
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,3 @@
+#Wed Nov 09 11:44:08 PST 2011
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/bigquery-appengine-sample/.settings/org.eclipse.m2e.core.prefs b/bigquery-appengine-sample/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000..939fa436
--- /dev/null
+++ b/bigquery-appengine-sample/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
+#Fri Nov 11 13:26:41 PST 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/bigquery-appengine-sample/instructions.html b/bigquery-appengine-sample/instructions.html
new file mode 100644
index 00000000..ad05c8ef
--- /dev/null
+++ b/bigquery-appengine-sample/instructions.html
@@ -0,0 +1,144 @@
+
+Google Bigquery App Engine Dashboard Sample
+
+
Instructions for the Google Bigquery App Engine Dashboard Sample
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select the "Web Application" platform, and click Register.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
Within "OAuth 2.0 Client ID", in the "Redirect URI" field enter some
+ redirect URIs, for example
+ "https://yourappname.appspot.com/oauth2callback" and
+ "http://localhost:8888/oauth2callback".
+
Edit src/main/webapp/WEB-INF/appengine-web.xml, and enter the unique application identifier (you chose it in the prior step)
+ between the <application> tags.
+
+
+
If you've done the above, you can deploy at any time:
+
+mvn appengine:update
+
+
+
If this is the first time you have run "update" on the project, a browser window will open prompting you to log in.
+ Log in with the same Google account the app is registered with.
+
Window > Preferences... (or on Mac, Eclipse >
+ Preferences...)
+
Select Maven
+
+
check on "Download Artifact Sources"
+
check on "Download Artifact JavaDoc"
+
+
+
+
+
Import bigquery-appengine-sample project
+
+
File > Import...
+
Select "General > Existing Project into Workspace" and click
+ "Next"
+
Click "Browse" next to "Select root directory", find
+ [someDirectory]/google-api-java-client-samples/bigquery-appengine-sample
+ and click "Next"
+
+
Click "Finish"
+
NOTE: please ignore the "The App Engine SDK JAR * is missing in
+ the WEB-INF/lib directory" error messages.
+
+
+
Run
+
+
Right-click on project bigquery-appengine-sample
+
Run As > Web Application
+
+
+
+
+
FAQ
+
+
I get a 403 Forbidden when trying to run my query. What causes
+ this? The user who is trying to run the query has to be added as a
+ team member to the project in the API console in order to access the data
+ associated with the project.
+
+
I get a 404 when I run my query. What could be wrong? Make
+ sure you've added your API Console project ID to the appengine-web.xml.
+
Prerequisites: install Java 6, Mercurial and Maven. You may need to set
-your JAVA_HOME.
-
-
Important: after checking out the project, and before compiling
-and running it, you need to edit ClientLoginCredentials.java
-to enter a username and password that has access to BigQuery. Otherwise, you
-will get a 403 Forbidden exception.
Window > Preferences... (or on Mac, Eclipse > Preferences...)
-
Select Maven
-
-
check on "Download Artifact Sources"
-
check on "Download Artifact JavaDoc"
-
-
-
-
-
Import bigquery-json-clientlogin-sample project
-
-
File > Import...
-
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/bigquery-json-clientlogin-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project bigquery-json-clientlogin-sample
-
Run As > Java Application
-
-
-
-
-
-
diff --git a/bigquery-json-clientlogin-sample/pom.xml b/bigquery-json-clientlogin-sample/pom.xml
deleted file mode 100644
index 0b5e49bd..00000000
--- a/bigquery-json-clientlogin-sample/pom.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
- 4.0.0
-
- com.google
- google
- 5
-
- com.google.api.client
- bigquery-json-clientlogin-sample
- 1.0.2
- bigquery-json-clientlogin-sample
-
- Example for BigQuery using JSON and Client Login.
-
-
- http://code.google.com/p/google-api-java-client/
-
-
- code.google.com
- http://code.google.com/p/google-api-java-client/issues/list
-
-
- 2010
-
-
- 2.0.9
-
-
-
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
-
-
-
-
- yanivi
- Yaniv Inbar
- yanivi@google.com
- Google
- http://www.google.com
-
- owner
- developer
-
- -5
-
-
-
-
-
- maven-compiler-plugin
-
- 1.6
- 1.6
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.1
-
-
-
- java
-
-
-
-
- com.google.api.client.sample.bigquery.BigQuerySample
-
-
-
- ${project.artifactId}-${project.version}
- src
- tests_disabled
-
-
-
- com.google.api.client
- google-api-client
- 1.0.10-alpha
-
-
- org.codehaus.jackson
- jackson-core-asl
- 1.5.3
-
-
-
- UTF-8
-
-
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/BigQuerySample.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/BigQuerySample.java
deleted file mode 100644
index b5abd744..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/BigQuerySample.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery;
-
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.googleapis.auth.clientlogin.ClientLogin;
-import com.google.api.client.googleapis.json.JsonCParser;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.bigquery.model.BigQueryUrl;
-import com.google.api.client.sample.bigquery.model.Debug;
-import com.google.api.client.sample.bigquery.model.QueryData;
-import com.google.api.client.sample.bigquery.model.QueryRow;
-import com.google.api.client.sample.bigquery.model.QueryValue;
-import com.google.api.client.sample.bigquery.model.SchemaData;
-import com.google.api.client.sample.bigquery.model.SchemaField;
-
-import java.io.IOException;
-
-/**
- * @author Yaniv Inbar
- */
-public class BigQuerySample {
-
- public static void main(String[] args) {
- Debug.enableLogging();
- HttpTransport transport = GoogleTransport.create();
- transport.addParser(new JsonCParser());
- try {
- try {
- authenticateWithClientLogin(transport);
- executeSchema(transport, "bigquery/samples/shakespeare");
- executeQuery(
- transport, "select count(*) from [bigquery/samples/shakespeare];");
- executeQuery(
- transport,
- "select corpus, word, word_count from [bigquery/samples/shakespeare] where word_count > 600 order by word_count desc;");
- } catch (HttpResponseException e) {
- System.err.println(e.response.parseAsString());
- throw e;
- }
- } catch (Throwable t) {
- t.printStackTrace();
- System.exit(1);
- }
- }
-
- public static void authenticateWithClientLogin(HttpTransport transport)
- throws IOException {
- ClientLogin authenticator = new ClientLogin();
- authenticator.authTokenType = "ndev";
- authenticator.username = ClientLoginCredentials.ENTER_USERNAME;
- authenticator.password = ClientLoginCredentials.ENTER_PASSWORD;
- authenticator.authenticate().setAuthorizationHeader(transport);
- }
-
- static QueryData executeQuery(HttpTransport transport, String query)
- throws IOException {
- header("Query: " + query);
- HttpRequest request = transport.buildGetRequest();
- BigQueryUrl url = BigQueryUrl.fromRelativePath("query");
- url.q = query;
- request.url = url;
- QueryData result = request.execute().parseAs(QueryData.class);
- if (result.fields == null) {
- System.out.println("No fields");
- } else {
- for (SchemaField field : result.fields) {
- System.out.print(field.id + "\t");
- }
- System.out.println();
- for (QueryRow row : result.rows) {
- for (QueryValue value : row.f) {
- System.out.print(value.value + "\t");
- }
- System.out.println();
- }
- }
- return result;
- }
-
- static SchemaData executeSchema(HttpTransport transport, String tableName)
- throws IOException {
- header("Schema: " + tableName);
- HttpRequest request = transport.buildGetRequest();
- BigQueryUrl url = BigQueryUrl.fromRelativePath("tables");
- url.pathParts.add(tableName);
- request.url = url;
- SchemaData result = request.execute().parseAs(SchemaData.class);
- if (result.fields == null) {
- System.out.println("No fields");
- } else {
- System.out.println(result.fields.size() + " fields:");
- for (SchemaField field : result.fields) {
- System.out.println(field.type + " " + field.id);
- }
- }
- return result;
- }
-
- private static void header(String name) {
- System.out.println();
- System.out.println("============== " + name + " ==============");
- System.out.println();
- }
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/ClientLoginCredentials.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/ClientLoginCredentials.java
deleted file mode 100644
index fad9da83..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/ClientLoginCredentials.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery;
-
-/**
- * @author Yaniv Inbar
- */
-public class ClientLoginCredentials {
-
- static final String ENTER_USERNAME = "enter_username";
- static final String ENTER_PASSWORD = "enter_password";
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/BigQueryUrl.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/BigQueryUrl.java
deleted file mode 100644
index 7fe368ce..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/BigQueryUrl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.util.Key;
-
-/**
- * BigQuery URL builder.
- *
- * @author Yaniv Inbar
- */
-public final class BigQueryUrl extends GoogleUrl {
-
- private static final String ROOT_URL =
- "https://www.googleapis.com/bigquery/v1/";
-
- @Key
- public String q;
-
- /** Constructs a new BigQuery URL from the given encoded URL. */
- public BigQueryUrl(String encodedUrl) {
- super(encodedUrl);
- if (Debug.ENABLED) {
- prettyprint = true;
- }
- }
-
- /**
- * Constructs a new BigQuery URL based on the given relative path.
- *
- * @param relativePath encoded path relative to the {@link #ROOT_URL}
- * @return new BigQuery URL
- */
- public static BigQueryUrl fromRelativePath(String relativePath) {
- return new BigQueryUrl(ROOT_URL + relativePath);
- }
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/Debug.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/Debug.java
deleted file mode 100644
index f35fd657..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/Debug.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-/**
- * @author Yaniv Inbar
- */
-public class Debug {
- public static final boolean ENABLED = false;
-
- public static void enableLogging() {
- if (ENABLED) {
- Logger logger = Logger.getLogger("com.google.api.client");
- logger.setLevel(Level.CONFIG);
- logger.addHandler(new Handler() {
-
- @Override
- public void close() throws SecurityException {
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void publish(LogRecord record) {
- // default ConsoleHandler will take care of >= INFO
- if (record.getLevel().intValue() < Level.INFO.intValue()) {
- System.out.println(record.getMessage());
- }
- }
- });
- }
- }
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryData.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryData.java
deleted file mode 100644
index 549cc2a1..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryData.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class QueryData {
-
- @Key
- public List fields;
-
- @Key
- public List rows;
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryRow.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryRow.java
deleted file mode 100644
index b62b0de5..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryRow.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class QueryRow {
-
- @Key
- public List f;
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryValue.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryValue.java
deleted file mode 100644
index f47a13e7..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/QueryValue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class QueryValue {
-
- @Key("v")
- public String value;
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaData.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaData.java
deleted file mode 100644
index 225f471d..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaData.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class SchemaData {
-
- @Key
- public List fields;
-}
diff --git a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaField.java b/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaField.java
deleted file mode 100644
index db17b77b..00000000
--- a/bigquery-json-clientlogin-sample/src/com/google/api/client/sample/bigquery/model/SchemaField.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.bigquery.model;
-
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class SchemaField {
-
- @Key
- public String id;
-
- @Key
- public String type;
-}
diff --git a/books-cmdline-sample/.classpath b/books-cmdline-sample/.classpath
new file mode 100644
index 00000000..753b6eda
--- /dev/null
+++ b/books-cmdline-sample/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/books-cmdline-sample/.project b/books-cmdline-sample/.project
new file mode 100644
index 00000000..98ced74f
--- /dev/null
+++ b/books-cmdline-sample/.project
@@ -0,0 +1,23 @@
+
+
+ books-cmdline-sample
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/books-cmdline-sample/.settings/org.eclipse.jdt.core.prefs b/books-cmdline-sample/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..faf086f4
--- /dev/null
+++ b/books-cmdline-sample/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,380 @@
+#Fri Nov 04 10:10:38 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
+org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
+org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=false
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false
+org.eclipse.jdt.core.formatter.sort_member_annotations=false
+org.eclipse.jdt.core.formatter.sort_package_annotations=false
+org.eclipse.jdt.core.formatter.sort_parameter_annotations=false
+org.eclipse.jdt.core.formatter.sort_type_annotations=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
diff --git a/books-cmdline-sample/.settings/org.eclipse.jdt.ui.prefs b/books-cmdline-sample/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..2413e100
--- /dev/null
+++ b/books-cmdline-sample/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,119 @@
+#Fri Nov 04 10:06:25 EDT 2011
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_google-api-java-client
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=false
+formatter_profile=_google-api-java-client 100
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=exception
+org.eclipse.jdt.ui.gettersetter.use.is=false
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com;org;;java;javax;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=999
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=999
+org.eclipse.jdt.ui.text.custom_code_templates=/*\n * Copyright (c) 2011 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\n * in compliance with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the License\n * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n * or implied. See the License for the specific language governing permissions and limitations under\n * the License.\n */\n/**\n * @author ${user}@google.com (Your Name Here)\n *\n * ${tags}\n *//**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * @author Yaniv Inbar\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-JSDoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/books-cmdline-sample/BooksSample.launch b/books-cmdline-sample/BooksSample.launch
new file mode 100644
index 00000000..ab377173
--- /dev/null
+++ b/books-cmdline-sample/BooksSample.launch
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/books-cmdline-sample/instructions.html b/books-cmdline-sample/instructions.html
new file mode 100644
index 00000000..0f952c01
--- /dev/null
+++ b/books-cmdline-sample/instructions.html
@@ -0,0 +1,113 @@
+
+books-cmdline-sample
+
+
Instructions for the Google Books V1 JSON Command-Line Sample
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
Window > Preferences... (or on Mac, Eclipse >
+ Preferences...)
+
Select Maven
+
+
check on "Download Artifact Sources"
+
check on "Download Artifact JavaDoc"
+
+
+
+
+
Import books-cmdline-sample project
+
+
File > Import...
+
Select "General > Existing Project into Workspace" and click
+ "Next"
+
Click "Browse" next to "Select root directory", find
+ [someDirectory]/google-api-java-client-samples/books-cmdline-sample
+ and click "Next"
+
+
Click "Finish"
+
+
+
Run
+
+
Right-click on project books-cmdline-sample
+
Run As > Java Application
+
If asked, type "BooksSample" and click OK
+
To run:
+
+
Run > Run Configurations...
+
Click on "Java Application > BooksSample"
+
Click on "Arguments" tab
+
Program arguments: "Mark Twain"
+
See comments in BooksSample.java
+ for full command line arguments.
+
VM arguments: -Djava.util.logging.config.file=${project_loc}/logging.properties
+
Click "Run"
+
+
+
+
+
+
+
+
diff --git a/books-cmdline-sample/logging.properties b/books-cmdline-sample/logging.properties
new file mode 100644
index 00000000..5d8d54f0
--- /dev/null
+++ b/books-cmdline-sample/logging.properties
@@ -0,0 +1,10 @@
+# Properties file which configures the operation of the JDK logging facility.
+# The system will look for this config file to be specified as a system property:
+# -Djava.util.logging.config.file=${project_loc:books-cmdline-sample}/logging.properties
+
+# Set up the console handler (uncomment "level" to show more fine-grained messages)
+handlers = java.util.logging.ConsoleHandler
+#java.util.logging.ConsoleHandler.level = CONFIG
+
+# Set up logging of HTTP requests and responses (uncomment "level" to show)
+#com.google.api.client.http.level = CONFIG
diff --git a/books-cmdline-sample/pom.xml b/books-cmdline-sample/pom.xml
new file mode 100644
index 00000000..cd675f9a
--- /dev/null
+++ b/books-cmdline-sample/pom.xml
@@ -0,0 +1,130 @@
+
+ 4.0.0
+
+ com.google
+ google
+ 5
+
+ com.google.apis-samples
+ books-cmdline-sample
+ 1.2.1
+ Example for the Google Books API v1 using JSON.
+
+ http://code.google.com/p/google-api-java-client/
+
+
+ code.google.com
+ http://code.google.com/p/google-api-java-client/issues/list
+
+
+ 2011
+
+
+ 2.0.9
+
+
+
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
+
+
+
+
+ dlu
+ David Lu
+ dlu@google.com
+ Google
+ http://www.google.com
+
+ owner
+ developer
+
+ -8
+
+
+
+
+
+
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.1
+
+
+
+ java
+
+
+
+
+ com.google.api.services.samples.books.cmdline.BooksSample
+
+
+ java.util.logging.config.file
+ logging.properties
+
+
+
+
+
+ maven-checkstyle-plugin
+ 2.6
+
+ ../checkstyle.xml
+ true
+ false
+
+
+
+
+ check
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 2.3.2
+
+ false
+
+
+
+
+ check
+
+
+
+
+
+ ${project.artifactId}-${project.version}
+
+
+
+ com.google.apis
+ google-api-services-books
+ v1-rev57-1.19.0
+
+
+ com.google.http-client
+ google-http-client-jackson2
+ ${project.http.version}
+
+
+
+ 1.19.0
+ 1.19.0
+ UTF-8
+
+
diff --git a/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/BooksSample.java b/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/BooksSample.java
new file mode 100644
index 00000000..8bb4dce9
--- /dev/null
+++ b/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/BooksSample.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.books.cmdline;
+
+import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.jackson2.JacksonFactory;
+import com.google.api.services.books.Books;
+import com.google.api.services.books.BooksRequestInitializer;
+import com.google.api.services.books.Books.Volumes.List;
+import com.google.api.services.books.model.Volume;
+import com.google.api.services.books.model.Volumes;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.NumberFormat;
+
+/**
+ * A sample application that demonstrates how Google Books Client Library for
+ * Java can be used to query Google Books. It accepts queries in the command
+ * line, and prints the results to the console.
+ *
+ * $ java com.google.sample.books.BooksSample [--author|--isbn|--title] ""
+ *
+ * Please start by reviewing the Google Books API documentation at:
+ * http://code.google.com/apis/books/docs/getting_started.html
+ */
+public class BooksSample {
+
+ /**
+ * Be sure to specify the name of your application. If the application name is {@code null} or
+ * blank, the application will log a warning. Suggested format is "MyCompany-ProductName/1.0".
+ */
+ private static final String APPLICATION_NAME = "";
+
+ private static final NumberFormat CURRENCY_FORMATTER = NumberFormat.getCurrencyInstance();
+ private static final NumberFormat PERCENT_FORMATTER = NumberFormat.getPercentInstance();
+
+ private static void queryGoogleBooks(JsonFactory jsonFactory, String query) throws Exception {
+ ClientCredentials.errorIfNotSpecified();
+
+ // Set up Books client.
+ final Books books = new Books.Builder(GoogleNetHttpTransport.newTrustedTransport(), jsonFactory, null)
+ .setApplicationName(APPLICATION_NAME)
+ .setGoogleClientRequestInitializer(new BooksRequestInitializer(ClientCredentials.API_KEY))
+ .build();
+ // Set query string and filter only Google eBooks.
+ System.out.println("Query: [" + query + "]");
+ List volumesList = books.volumes().list(query);
+ volumesList.setFilter("ebooks");
+
+ // Execute the query.
+ Volumes volumes = volumesList.execute();
+ if (volumes.getTotalItems() == 0 || volumes.getItems() == null) {
+ System.out.println("No matches found.");
+ return;
+ }
+
+ // Output results.
+ for (Volume volume : volumes.getItems()) {
+ Volume.VolumeInfo volumeInfo = volume.getVolumeInfo();
+ Volume.SaleInfo saleInfo = volume.getSaleInfo();
+ System.out.println("==========");
+ // Title.
+ System.out.println("Title: " + volumeInfo.getTitle());
+ // Author(s).
+ java.util.List authors = volumeInfo.getAuthors();
+ if (authors != null && !authors.isEmpty()) {
+ System.out.print("Author(s): ");
+ for (int i = 0; i < authors.size(); ++i) {
+ System.out.print(authors.get(i));
+ if (i < authors.size() - 1) {
+ System.out.print(", ");
+ }
+ }
+ System.out.println();
+ }
+ // Description (if any).
+ if (volumeInfo.getDescription() != null && volumeInfo.getDescription().length() > 0) {
+ System.out.println("Description: " + volumeInfo.getDescription());
+ }
+ // Ratings (if any).
+ if (volumeInfo.getRatingsCount() != null && volumeInfo.getRatingsCount() > 0) {
+ int fullRating = (int) Math.round(volumeInfo.getAverageRating().doubleValue());
+ System.out.print("User Rating: ");
+ for (int i = 0; i < fullRating; ++i) {
+ System.out.print("*");
+ }
+ System.out.println(" (" + volumeInfo.getRatingsCount() + " rating(s))");
+ }
+ // Price (if any).
+ if (saleInfo != null && "FOR_SALE".equals(saleInfo.getSaleability())) {
+ double save = saleInfo.getListPrice().getAmount() - saleInfo.getRetailPrice().getAmount();
+ if (save > 0.0) {
+ System.out.print("List: " + CURRENCY_FORMATTER.format(saleInfo.getListPrice().getAmount())
+ + " ");
+ }
+ System.out.print("Google eBooks Price: "
+ + CURRENCY_FORMATTER.format(saleInfo.getRetailPrice().getAmount()));
+ if (save > 0.0) {
+ System.out.print(" You Save: " + CURRENCY_FORMATTER.format(save) + " ("
+ + PERCENT_FORMATTER.format(save / saleInfo.getListPrice().getAmount()) + ")");
+ }
+ System.out.println();
+ }
+ // Access status.
+ String accessViewStatus = volume.getAccessInfo().getAccessViewStatus();
+ String message = "Additional information about this book is available from Google eBooks at:";
+ if ("FULL_PUBLIC_DOMAIN".equals(accessViewStatus)) {
+ message = "This public domain book is available for free from Google eBooks at:";
+ } else if ("SAMPLE".equals(accessViewStatus)) {
+ message = "A preview of this book is available from Google eBooks at:";
+ }
+ System.out.println(message);
+ // Link to Google eBooks.
+ System.out.println(volumeInfo.getInfoLink());
+ }
+ System.out.println("==========");
+ System.out.println(
+ volumes.getTotalItems() + " total results at http://books.google.com/ebooks?q="
+ + URLEncoder.encode(query, "UTF-8"));
+ }
+
+ public static void main(String[] args) {
+ JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
+ try {
+ // Verify command line parameters.
+ if (args.length == 0) {
+ System.err.println("Usage: BooksSample [--author|--isbn|--title] \"\"");
+ System.exit(1);
+ }
+ // Parse command line parameters into a query.
+ // Query format: "[:]"
+ String prefix = null;
+ String query = "";
+ for (String arg : args) {
+ if ("--author".equals(arg)) {
+ prefix = "inauthor:";
+ } else if ("--isbn".equals(arg)) {
+ prefix = "isbn:";
+ } else if ("--title".equals(arg)) {
+ prefix = "intitle:";
+ } else if (arg.startsWith("--")) {
+ System.err.println("Unknown argument: " + arg);
+ System.exit(1);
+ } else {
+ query = arg;
+ }
+ }
+ if (prefix != null) {
+ query = prefix + query;
+ }
+ try {
+ queryGoogleBooks(jsonFactory, query);
+ // Success!
+ return;
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ System.exit(0);
+ }
+}
diff --git a/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/ClientCredentials.java b/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/ClientCredentials.java
new file mode 100644
index 00000000..5449d7b0
--- /dev/null
+++ b/books-cmdline-sample/src/main/java/com/google/api/services/samples/books/cmdline/ClientCredentials.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.books.cmdline;
+
+
+/**
+ * API key found in the Google apis
+ * console.
+ *
+ *
+ * Once at the Google apis console, click on "Add project...". If you've already set up a project,
+ * you may use that one instead, or create a new one by clicking on the arrow next to the project
+ * name and click on "Create..." under "Other projects". Finally, click on "API Access". Look for
+ * the section at the bottom called "Simple API Access".
+ *
Window > Preferences... (or on Mac, Eclipse > Preferences...)
-
Select Maven
-
-
check on "Download Artifact Sources"
-
check on "Download Artifact JavaDoc"
-
-
-
-
-
Import buzz-json-oauth-sample project
-
-
File > Import...
-
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/buzz-json-oauth-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project buzz-json-oauth-sample
-
Run As > Java Application
-
If asked, type "BuzzSample" and click OK
-
-
-
-
-
-
diff --git a/buzz-json-oauth-sample/pom.xml b/buzz-json-oauth-sample/pom.xml
deleted file mode 100644
index 81e773fb..00000000
--- a/buzz-json-oauth-sample/pom.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-
- 4.0.0
-
- com.google
- google
- 5
-
- com.google.api.client
- buzz-json-oauth-sample
- 1.0.0
- buzz-json-oauth-sample
-
- Example for the Buzz API using JSON and OAuth.
-
-
- http://code.google.com/p/google-api-java-client/
-
-
- code.google.com
- http://code.google.com/p/google-api-java-client/issues/list
-
-
- 2010
-
-
- 2.0.9
-
-
-
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
-
-
-
-
- yanivi
- Yaniv Inbar
- yanivi@google.com
- Google
- http://www.google.com
-
- owner
- developer
-
- -5
-
-
-
-
-
- maven-compiler-plugin
-
- 1.6
- 1.6
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.1
-
-
-
- java
-
-
-
-
- com.google.api.client.sample.buzz.BuzzSample
-
-
-
- ${project.artifactId}-${project.version}
- src
- tests_disabled
-
-
-
- com.google.api.client
- google-api-client
- 1.0.10-alpha
-
-
- org.codehaus.jackson
- jackson-core-asl
- 1.5.3
-
-
- org.mortbay.jetty
- jetty-embedded
- 6.1.24
- compile
-
-
-
- UTF-8
-
-
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/Auth.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/Auth.java
deleted file mode 100644
index 227dbec8..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/Auth.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz;
-
-import com.google.api.client.auth.oauth.OAuthAuthorizeTemporaryTokenUrl;
-import com.google.api.client.auth.oauth.OAuthCredentialsResponse;
-import com.google.api.client.auth.oauth.OAuthHmacSigner;
-import com.google.api.client.auth.oauth.OAuthParameters;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetAccessToken;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetTemporaryToken;
-import com.google.api.client.http.HttpTransport;
-
-import java.awt.Desktop;
-import java.awt.Desktop.Action;
-import java.net.URI;
-
-/**
- * Implements OAuth authentication.
- *
- * @author Yaniv Inbar
- */
-public class Auth {
-
- static final String APP_NAME = "Buzz API Java Client Sample";
-
- private static OAuthHmacSigner signer;
-
- private static OAuthCredentialsResponse credentials;
-
- static void authorize(HttpTransport transport) throws Exception {
- // callback server
- LoginCallbackServer callbackServer = null;
- String verifier = null;
- String tempToken = null;
- try {
- callbackServer = new LoginCallbackServer();
- callbackServer.start();
- // temporary token
- GoogleOAuthGetTemporaryToken temporaryToken =
- new GoogleOAuthGetTemporaryToken();
- signer = new OAuthHmacSigner();
- signer.clientSharedSecret = "anonymous";
- temporaryToken.signer = signer;
- temporaryToken.consumerKey = "anonymous";
- temporaryToken.scope = "https://www.googleapis.com/auth/buzz";
- temporaryToken.displayName = APP_NAME;
- temporaryToken.callback = callbackServer.getCallbackUrl();
- OAuthCredentialsResponse tempCredentials = temporaryToken.execute();
- signer.tokenSharedSecret = tempCredentials.tokenSecret;
- // authorization URL
- OAuthAuthorizeTemporaryTokenUrl authorizeUrl =
- new OAuthAuthorizeTemporaryTokenUrl(
- "https://www.google.com/buzz/api/auth/OAuthAuthorizeToken");
- authorizeUrl.set("scope", temporaryToken.scope);
- authorizeUrl.set("domain", "anonymous");
- authorizeUrl.set("xoauth_displayname", APP_NAME);
- authorizeUrl.temporaryToken = tempToken = tempCredentials.token;
- String authorizationUrl = authorizeUrl.build();
- // launch in browser
- boolean browsed = false;
- if (Desktop.isDesktopSupported()) {
- Desktop desktop = Desktop.getDesktop();
- if (desktop.isSupported(Action.BROWSE)) {
- desktop.browse(URI.create(authorizationUrl));
- browsed = true;
- }
- }
- if (!browsed) {
- String browser = "google-chrome";
- Runtime.getRuntime().exec(new String[] {browser, authorizationUrl});
- }
- verifier = callbackServer.waitForVerifier(tempToken);
- } finally {
- if (callbackServer != null) {
- callbackServer.stop();
- }
- }
- GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken();
- accessToken.temporaryToken = tempToken;
- accessToken.signer = signer;
- accessToken.consumerKey = "anonymous";
- accessToken.verifier = verifier;
- credentials = accessToken.execute();
- signer.tokenSharedSecret = credentials.tokenSecret;
- createOAuthParameters().signRequestsUsingAuthorizationHeader(transport);
- }
-
- static void revoke() {
- if (credentials != null) {
- try {
- GoogleOAuthGetAccessToken.revokeAccessToken(createOAuthParameters());
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
- }
-
- private static OAuthParameters createOAuthParameters() {
- OAuthParameters authorizer = new OAuthParameters();
- authorizer.consumerKey = "anonymous";
- authorizer.signer = signer;
- authorizer.token = credentials.token;
- return authorizer;
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/BuzzSample.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/BuzzSample.java
deleted file mode 100644
index b5a5d12b..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/BuzzSample.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz;
-
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.googleapis.json.JsonCParser;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.buzz.model.BuzzActivity;
-import com.google.api.client.sample.buzz.model.BuzzActivityFeed;
-import com.google.api.client.sample.buzz.model.BuzzObject;
-import com.google.api.client.sample.buzz.model.Debug;
-
-import java.io.IOException;
-
-/**
- * @author Yaniv Inbar
- */
-public class BuzzSample {
-
- private final HttpTransport transport;
-
- public BuzzSample(HttpTransport transport) {
- super();
- this.transport = transport;
- }
-
- public static void main(String[] args) {
- Debug.enableLogging();
- HttpTransport transport = GoogleTransport.create();
- transport.addParser(new JsonCParser());
- BuzzSample sample = new BuzzSample(transport);
- try {
- try {
- sample.authorize();
- sample.showActivities();
- BuzzActivity activity = sample.insertActivity();
- activity = sample.updateActivity(activity);
- sample.deleteActivity(activity);
- Auth.revoke();
- } catch (HttpResponseException e) {
- System.err.println(e.response.parseAsString());
- throw e;
- }
- } catch (Throwable t) {
- t.printStackTrace();
- Auth.revoke();
- System.exit(1);
- }
- }
-
- private void authorize() throws Exception {
- Auth.authorize(transport);
- }
-
- private void showActivities() throws IOException {
- header("Show Buzz Activities");
- BuzzActivityFeed feed = BuzzActivityFeed.list(transport);
- if (feed.activities != null) {
- int size = feed.activities.size();
- for (int i = 0; i < size; i++) {
- BuzzActivity activity = feed.activities.get(i);
- show(activity);
- }
- }
- }
-
- private BuzzActivity insertActivity() throws IOException {
- header("Insert Buzz Activity");
- BuzzActivity activity = new BuzzActivity();
- activity.object = new BuzzObject();
- activity.object.content = "Posting using " + Auth.APP_NAME;
- BuzzActivity result = activity.post(transport);
- show(result);
- return result;
- }
-
- private BuzzActivity updateActivity(BuzzActivity activity)
- throws IOException {
- header("Update Buzz Activity");
- activity.object.content += " (http://bit.ly/9WbLmb)";
- BuzzActivity result = activity.update(transport);
- show(result);
- return result;
- }
-
- private void deleteActivity(BuzzActivity activity) throws IOException {
- header("Delete Buzz Activity");
- activity.delete(transport);
- System.out.println("Deleted.");
- }
-
- private static void header(String name) {
- System.out.println();
- System.out.println("============== " + name + " ==============");
- System.out.println();
- }
-
- private static void show(BuzzActivity activity) {
- System.out.println(activity.object.content);
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/LoginCallbackServer.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/LoginCallbackServer.java
deleted file mode 100644
index 9e02082f..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/LoginCallbackServer.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz;
-
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Class that runs a Jetty server on a free port, waiting for OAuth to redirect
- * to it with the one-time authorization token.
- *
- * Mostly copied from oacurl by phopkins@google.com.
- *
- * @author Yaniv Inbar
- */
-public class LoginCallbackServer {
- private static final String CALLBACK_PATH = "/OAuthCallback";
-
- private int port;
- private Server server;
-
- private Map verifierMap = new HashMap();
-
- public void start() {
- if (server != null) {
- throw new IllegalStateException("Server is already started");
- }
-
- try {
- port = getUnusedPort();
- server = new Server(port);
-
- for (Connector c : server.getConnectors()) {
- c.setHost("localhost");
- }
-
- server.addHandler(new CallbackHandler());
-
- server.start();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void stop() throws Exception {
- if (server != null) {
- server.stop();
- server = null;
- }
- }
-
- public String getCallbackUrl() {
- Preconditions.checkArgument(port != 0, "Server is not yet started");
- return "http://localhost:" + port + CALLBACK_PATH;
- }
-
- private static int getUnusedPort() throws IOException {
- Socket s = new Socket();
- s.bind(null);
-
- try {
- return s.getLocalPort();
- } finally {
- s.close();
- }
- }
-
- /**
- * Call that blocks until the OAuth provider redirects back here with the
- * verifier token.
- *
- * @param requestToken request token
- * @return The verifier token, or null if there was a timeout.
- */
- public String waitForVerifier(String requestToken) {
- synchronized (verifierMap) {
- while (!verifierMap.containsKey(requestToken)) {
- try {
- verifierMap.wait(3000);
- } catch (InterruptedException e) {
- return null;
- }
- }
-
- return verifierMap.remove(requestToken);
- }
- }
-
- /**
- * Jetty handler that takes the verifier token passed over from the OAuth
- * provider and stashes it where {@link LoginCallbackServer#waitForVerifier}
- * will find it.
- */
- public class CallbackHandler extends AbstractHandler {
- public void handle(String target, HttpServletRequest request,
- HttpServletResponse response, int dispatch) throws IOException {
- if (!CALLBACK_PATH.equals(target)) {
- return;
- }
-
- writeLandingHtml(response);
- response.flushBuffer();
- ((Request) request).setHandled(true);
-
- String requestToken = request.getParameter("oauth_token");
- String verifier = request.getParameter("oauth_verifier");
-
- synchronized (verifierMap) {
- verifierMap.put(requestToken, verifier);
- verifierMap.notifyAll();
- }
- }
-
- private void writeLandingHtml(HttpServletResponse response)
- throws IOException {
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType("text/html");
-
- PrintWriter doc = response.getWriter();
- doc.println("");
- doc.println(
- "OAuth Authentication Token Recieved");
- doc.println("");
- doc.println("Received verifier token. Closing...");
- doc.println("");
- doc.println("");
- doc.println("");
- doc.flush();
- }
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivity.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivity.java
deleted file mode 100755
index 82c63ca3..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivity.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz.model;
-
-import com.google.api.client.googleapis.json.JsonCContent;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.json.GenericJson;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-
-/**
- * Buzz activity, such as a Buzz post.
- *
- *
- * The JSON of a typical activity looks like this:
- *
- *
- * {
- * id: "tag:google.com,2010:buzz:z12puk22ajfyzsz",
- * object: {
- * content: "Hey, this is my first Buzz Post!",
- * ...
- * },
- * ...
- * }
- *
- *
- * @author Yaniv Inbar
- */
-public final class BuzzActivity extends GenericJson {
-
- /** Activity identifier. */
- @Key
- public String id;
-
- /** Buzz Object. */
- @Key
- public BuzzObject object;
-
- /**
- * Post this Buzz Activity.
- *
- * @param transport Google transport
- * @return posted Buzz Activity response from the Buzz server
- * @throws IOException any I/O exception
- */
- public BuzzActivity post(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildPostRequest();
- request.url = BuzzUrl.forMyActivityFeed();
- request.content = toContent();
- return request.execute().parseAs(BuzzActivity.class);
- }
-
- /**
- * Update this Buzz Activity.
- *
- * @param transport Google transport
- * @return updated Buzz Activity response from the Buzz server
- * @throws IOException any I/O exception
- */
- public BuzzActivity update(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildPutRequest();
- request.url = BuzzUrl.forMyActivity(this.id);
- request.content = toContent();
- return request.execute().parseAs(BuzzActivity.class);
- }
-
- /**
- * Post this Buzz Activity.
- *
- * @param transport Google transport
- * @throws IOException any I/O exception
- */
- public void delete(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildDeleteRequest();
- request.url = BuzzUrl.forMyActivity(this.id);
- request.execute().ignore();
- }
-
- /** Returns a new JSON-C content serializer for this Buzz activity. */
- private JsonCContent toContent() {
- JsonCContent result = new JsonCContent();
- result.data = this;
- return result;
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivityFeed.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivityFeed.java
deleted file mode 100755
index a93f2308..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzActivityFeed.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz.model;
-
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Buzz activity feed.
- *
- *
- * The JSON of a typical activity feed looks like this:
- *
- *
- *
- * @author Yaniv Inbar
- */
-public final class BuzzActivityFeed {
-
- /** List of activities. */
- // specify the field name because it doesn't match the name used in the JSON
- @Key("items")
- public List activities;
-
- /**
- * List the user's Buzz activities.
- *
- * @param transport Google transport
- * @return Buzz activities feed response from the Buzz server
- * @throws IOException any I/O exception
- */
- public static BuzzActivityFeed list(HttpTransport transport)
- throws IOException {
- HttpRequest request = transport.buildGetRequest();
- request.url = BuzzUrl.forMyActivityFeed();
- return request.execute().parseAs(BuzzActivityFeed.class);
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzObject.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzObject.java
deleted file mode 100755
index e1ec4859..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzObject.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz.model;
-
-import com.google.api.client.json.GenericJson;
-import com.google.api.client.util.Key;
-
-/**
- * Buzz Object.
- *
- *
- * The JSON of a typical Buzz object looks like this:
- *
- *
- * {
- * content: "Hey, this is my first Buzz Post!",
- * ...
- * }
- *
- *
- * @author Yaniv Inbar
- */
-public class BuzzObject extends GenericJson {
-
- /** HTML content. */
- @Key
- public String content;
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzUrl.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzUrl.java
deleted file mode 100644
index 922aeab4..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/BuzzUrl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-
-/**
- * Buzz URL builder.
- *
- * @author Yaniv Inbar
- */
-public final class BuzzUrl extends GoogleUrl {
-
- /** Constructs a new Buzz URL from the given encoded URI. */
- public BuzzUrl(String encodedUrl) {
- super(encodedUrl);
- alt = "json";
- if (Debug.ENABLED) {
- prettyprint = true;
- }
- }
-
- public static BuzzUrl forMyActivityFeed() {
- return new BuzzUrl(
- "https://www.googleapis.com/buzz/v1/activities/@me/@self");
- }
-
- public static BuzzUrl forMyActivity(String activityId) {
- BuzzUrl result = forMyActivityFeed();
- result.pathParts.add(activityId);
- return result;
- }
-}
diff --git a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/Debug.java b/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/Debug.java
deleted file mode 100644
index 47b49496..00000000
--- a/buzz-json-oauth-sample/src/com/google/api/client/sample/buzz/model/Debug.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.buzz.model;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-/**
- * @author Yaniv Inbar
- */
-public class Debug {
- public static final boolean ENABLED = false;
-
- public static void enableLogging() {
- if (ENABLED) {
- Logger logger = Logger.getLogger("com.google.api.client");
- logger.setLevel(Level.CONFIG);
- logger.addHandler(new Handler() {
-
- @Override
- public void close() throws SecurityException {
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void publish(LogRecord record) {
- // default ConsoleHandler will take care of >= INFO
- if (record.getLevel().intValue() < Level.INFO.intValue()) {
- System.out.println(record.getMessage());
- }
- }
- });
- }
- }
-}
diff --git a/calendar-android-sample/AndroidManifest.xml b/calendar-android-sample/AndroidManifest.xml
new file mode 100644
index 00000000..b1ceb84a
--- /dev/null
+++ b/calendar-android-sample/AndroidManifest.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar-android-sample/build.gradle b/calendar-android-sample/build.gradle
new file mode 100644
index 00000000..8d8feae2
--- /dev/null
+++ b/calendar-android-sample/build.gradle
@@ -0,0 +1,40 @@
+apply plugin: 'android'
+
+repositories {
+ mavenCentral()
+ mavenLocal() // For google-play-services is not on Maven Central.
+}
+
+dependencies {
+ compile 'com.google.apis:google-api-services-calendar:v3-rev87-1.19.0' exclude module: 'httpclient'
+ compile 'com.google.api-client:google-api-client-android:1.19.0' exclude module: 'httpclient'
+ compile 'com.google.http-client:google-http-client-gson:1.19.0' exclude module: 'httpclient'
+ compile 'com.google.android.gms:play-services-identity:7.3.0'
+}
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion "22.0.1"
+
+ defaultConfig {
+ minSdkVersion 11
+ targetSdkVersion 22
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'AndroidManifest.xml'
+ res.srcDirs = ['res']
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled true
+ proguardFile 'proguard-google-api-client.txt'
+ proguardFile getDefaultProguardFile('proguard-android.txt')
+ }
+ }
+
+}
+
diff --git a/calendar-android-sample/instructions.html b/calendar-android-sample/instructions.html
new file mode 100644
index 00000000..36f3ce99
--- /dev/null
+++ b/calendar-android-sample/instructions.html
@@ -0,0 +1,179 @@
+
+calendar-android-sample
+
+
+
Instructions for the Calendar V3 Android Sample
+
+
Warning
+
+This sample is for illustrative purposes. Please consider using the native
+Calendar
+ Provider API.
+
+
Install either Android
+ Studio (which bundles the Android SDK) or just Android SDK if you don't want to
+ use Android Studio. Set your
+ ANDROID_HOME to the Android SDK installation directory, which for Android Studio is in the
+ "sdk" subdirectory.
+
If necessary, sign in to your Google Account, select or create a
+ project, and agree to the terms of service. Click Continue.
+
+
For Platform select "Android".
+
+
For "Package name" you should make up a unique name that has never been used before
+ by anyone, e.g. using your name and date like
+ "org.example.calendar.janedoe20130911".
+
+
Note: Make
+ sure to pick a legal Java package name since we will be using it in the
+ Android
+ project source code. The full package name must have at least two parts, so
+ for example "janedoe20130911" will not work.
+
+
Note: If you try
+ to register a package name that has already been registered, you may get an
+ error reading "An
+ unexpected error has occurred." In particular,
+ "com.google.api.services.samples.calendar.android" has already been
+ registered, so you must change the package name.
+
+
+
+
For "SHA1 fingerprint", use the value that is output when running this command in a
+ Terminal:
+
Under "Tools", check on "Android SDK Build-tools" revision 22.0.1.
+
Under "Android 5.1.1 (API 22)", check on "SDK Platform" and "Google APIs".
+
Under "Extras", check on "Android Support Repository", "Android Support Library",
+ and "Google Repository".
+
+
Click on "Install X packages..."
+
+
+
Start Android Studio by running this command in a terminal:
+
android-studio/bin/studio.sh
+
+
Import calendar-android-sample project
+
+
Select "Import Project..." or File > Import Project...
+
Select
+ [someDirectory]/google-api-java-client-samples/build.gradle
+ and click OK.
+
+
Note: it will not work if you try to import
+ [someDirectory]/google-api-java-client-samples/calendar-android-sample/build.gradle
+ .
+
+
+
+
Select "Use local gradle distribution" with "Gradle home" of
+ [someDirectory]/gradle-2.2.1 and click OK.
+
+
+
+
Open AndroidManifest.xml and change the package attribute of the manifest, initially
+ "com.google.api.services.samples.calendar.android", to match the name you registered in the
+ Google Cloud Console, e.g. "org.example.calendar.janedoe20130911".
+
+
Rename the Java package: right-click on src/main/java, click New, click Package, and then
+ enter the name you registered in the
+ Google Cloud Console, e.g. "org.example.calendar.janedoe20130911". Next, select the Java
+ classes in
+ the package "com.google.api.services.samples.calendar.android", drag them into the new
+ package
+ you just created, and then click Refactor.
+
+
Note: If you get a compile error for "R", try right-clicking on the Java
+ package and then clicking "Optimize Imports" to remove unused imports containing the
+ "R". Another possibility is that the
+ "package" in the AndroidManifest.xml file doesn't match the Java package name.
+
+
+
+
+
Run > Run 'calendar-android-sample'
+
+
Note: you must use a physical device for developing and testing
+ because Google Play services cannot be installed on an emulator.
+
+ Read this page for more information on how to set up a device.
+
+
To enable logging of HTTP requests and responses (highly recommended
+ when developing):
+
+ and then change CalendarSampleActivity.LOGGING_LEVEL to Level.CONFIG.
+
+
Note: If get "[Error] Access Not Configured" it usually means the Android app
+ registration didn't work or doesn't match your app's package name and SHA1
+ fingerprint. It may also be because "Calendar API" isn't enabled for your project
+ in the Google Cloud Console (see instructions above).
+
+
+
+
+
+
+
diff --git a/calendar-android-sample/proguard-google-api-client.txt b/calendar-android-sample/proguard-google-api-client.txt
new file mode 100644
index 00000000..41161cd0
--- /dev/null
+++ b/calendar-android-sample/proguard-google-api-client.txt
@@ -0,0 +1,34 @@
+# ProGuard Configuration file
+#
+# See http://proguard.sourceforge.net/index.html#manual/usage.html
+
+# Needed to keep generic types and @Key annotations accessed via reflection
+
+-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
+
+-keepclassmembers class * {
+ @com.google.api.client.util.Key ;
+}
+
+# Needed by google-http-client-android when linking against an older platform version
+
+-dontwarn com.google.api.client.extensions.android.**
+
+# Needed by google-api-client-android when linking against an older platform version
+
+-dontwarn com.google.api.client.googleapis.extensions.android.**
+
+# Needed by google-play-services when linking against an older platform version
+
+-dontwarn com.google.android.gms.**
+-dontnote com.google.android.gms.**
+
+# com.google.client.util.IOUtils references java.nio.file.Files when on Java 7+
+-dontnote java.nio.file.Files, java.nio.file.Path
+
+# Suppress notes on LicensingServices
+-dontnote **.ILicensingService
+
+# Suppress warnings on sun.misc.Unsafe
+-dontnote sun.misc.Unsafe
+-dontwarn sun.misc.Unsafe
diff --git a/calendar-android-sample/res/drawable-hdpi/btn_bg_pressed.9.png b/calendar-android-sample/res/drawable-hdpi/btn_bg_pressed.9.png
new file mode 100644
index 00000000..b1afd4b6
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/btn_bg_pressed.9.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/btn_bg_selected.9.png b/calendar-android-sample/res/drawable-hdpi/btn_bg_selected.9.png
new file mode 100644
index 00000000..331f96f4
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/btn_bg_selected.9.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/ic_launcher.png b/calendar-android-sample/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 00000000..96a442e5
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/ic_launcher.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/ic_mailboxes_accounts.png b/calendar-android-sample/res/drawable-hdpi/ic_mailboxes_accounts.png
new file mode 100644
index 00000000..8425ac72
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/ic_mailboxes_accounts.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/ic_menu_refresh.png b/calendar-android-sample/res/drawable-hdpi/ic_menu_refresh.png
new file mode 100644
index 00000000..9b4f7562
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/ic_menu_refresh.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/ic_title_add_alt.png b/calendar-android-sample/res/drawable-hdpi/ic_title_add_alt.png
new file mode 100644
index 00000000..e597aea5
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/ic_title_add_alt.png differ
diff --git a/calendar-android-sample/res/drawable-hdpi/ic_title_add_default.png b/calendar-android-sample/res/drawable-hdpi/ic_title_add_default.png
new file mode 100644
index 00000000..e0305089
Binary files /dev/null and b/calendar-android-sample/res/drawable-hdpi/ic_title_add_default.png differ
diff --git a/calendar-android-sample/res/drawable-ldpi/ic_launcher.png b/calendar-android-sample/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 00000000..99238729
Binary files /dev/null and b/calendar-android-sample/res/drawable-ldpi/ic_launcher.png differ
diff --git a/calendar-android-sample/res/drawable-ldpi/ic_menu_refresh.png b/calendar-android-sample/res/drawable-ldpi/ic_menu_refresh.png
new file mode 100644
index 00000000..e214e82d
Binary files /dev/null and b/calendar-android-sample/res/drawable-ldpi/ic_menu_refresh.png differ
diff --git a/calendar-android-sample/res/drawable-mdpi/ic_launcher.png b/calendar-android-sample/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 00000000..359047df
Binary files /dev/null and b/calendar-android-sample/res/drawable-mdpi/ic_launcher.png differ
diff --git a/calendar-android-sample/res/drawable-mdpi/ic_mailboxes_accounts.png b/calendar-android-sample/res/drawable-mdpi/ic_mailboxes_accounts.png
new file mode 100644
index 00000000..a1a494f7
Binary files /dev/null and b/calendar-android-sample/res/drawable-mdpi/ic_mailboxes_accounts.png differ
diff --git a/calendar-android-sample/res/drawable-mdpi/ic_menu_refresh.png b/calendar-android-sample/res/drawable-mdpi/ic_menu_refresh.png
new file mode 100644
index 00000000..83ac7ae4
Binary files /dev/null and b/calendar-android-sample/res/drawable-mdpi/ic_menu_refresh.png differ
diff --git a/calendar-android-sample/res/drawable-xhdpi/ic_launcher.png b/calendar-android-sample/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..71c6d760
Binary files /dev/null and b/calendar-android-sample/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/calendar-android-sample/res/drawable-xhdpi/ic_menu_refresh.png b/calendar-android-sample/res/drawable-xhdpi/ic_menu_refresh.png
new file mode 100644
index 00000000..e4c7a4c1
Binary files /dev/null and b/calendar-android-sample/res/drawable-xhdpi/ic_menu_refresh.png differ
diff --git a/calendar-android-sample/res/drawable/ic_title_add.xml b/calendar-android-sample/res/drawable/ic_title_add.xml
new file mode 100644
index 00000000..a7265d2d
--- /dev/null
+++ b/calendar-android-sample/res/drawable/ic_title_add.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/calendar-android-sample/res/drawable/ic_title_add_light.xml b/calendar-android-sample/res/drawable/ic_title_add_light.xml
new file mode 100644
index 00000000..12963c10
--- /dev/null
+++ b/calendar-android-sample/res/drawable/ic_title_add_light.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/calendar-android-sample/res/drawable/title_button.xml b/calendar-android-sample/res/drawable/title_button.xml
new file mode 100644
index 00000000..94139e9b
--- /dev/null
+++ b/calendar-android-sample/res/drawable/title_button.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
diff --git a/calendar-android-sample/res/layout/addcalendar.xml b/calendar-android-sample/res/layout/addcalendar.xml
new file mode 100644
index 00000000..f4a4a6cb
--- /dev/null
+++ b/calendar-android-sample/res/layout/addcalendar.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar-android-sample/res/layout/calendarlist.xml b/calendar-android-sample/res/layout/calendarlist.xml
new file mode 100644
index 00000000..86eefa9e
--- /dev/null
+++ b/calendar-android-sample/res/layout/calendarlist.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar-android-sample/res/menu/main_menu.xml b/calendar-android-sample/res/menu/main_menu.xml
new file mode 100644
index 00000000..3fa2c4a7
--- /dev/null
+++ b/calendar-android-sample/res/menu/main_menu.xml
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/calendar-android-sample/res/values/colors.xml b/calendar-android-sample/res/values/colors.xml
new file mode 100644
index 00000000..0d2eefaf
--- /dev/null
+++ b/calendar-android-sample/res/values/colors.xml
@@ -0,0 +1,21 @@
+
+
+
+ #ff355689
+ #ffffffff
+ #40ffffff
+
diff --git a/calendar-android-sample/res/values/dimens.xml b/calendar-android-sample/res/values/dimens.xml
new file mode 100644
index 00000000..fcbf4d89
--- /dev/null
+++ b/calendar-android-sample/res/values/dimens.xml
@@ -0,0 +1,21 @@
+
+
+
+ 45dip
+ 14sp
+ 18sp
+
diff --git a/calendar-android-sample/res/values/strings.xml b/calendar-android-sample/res/values/strings.xml
new file mode 100644
index 00000000..6d6f36e5
--- /dev/null
+++ b/calendar-android-sample/res/values/strings.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ Google Calendar Sample
+ Accounts
+ Add Calendar
+ Title
+ Enter the calendar title
+ Cancel
+ Save
+ Application icon
+ Title separator
+ Refresh
+ Copy Calendar x3 (Batch)
+ Edit Calendar
+ Delete Calendar
+ Delete Calendar?
+ Yes
+ No
+ Error
+ [Error] %s
+
+
diff --git a/calendar-android-sample/res/values/styles.xml b/calendar-android-sample/res/values/styles.xml
new file mode 100644
index 00000000..40bd5df0
--- /dev/null
+++ b/calendar-android-sample/res/values/styles.xml
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AddOrEditCalendarActivity.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AddOrEditCalendarActivity.java
new file mode 100644
index 00000000..cc032a5e
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AddOrEditCalendarActivity.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.api.services.samples.calendar.android;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.TextView;
+
+/**
+ * Activity to add or edit a calendar.
+ *
+ * @author Yaniv Inbar
+ */
+public class AddOrEditCalendarActivity extends Activity {
+
+ private EditText summaryEditText;
+ private String id;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.addcalendar);
+ summaryEditText = (EditText) findViewById(R.id.summaryText);
+ TextView titleTextView = (TextView) findViewById(R.id.textViewTitle);
+ id = getIntent().getStringExtra("id");
+ if (id != null) {
+ titleTextView.setText(R.string.edit);
+ summaryEditText.setText(getIntent().getStringExtra("summary"));
+ } else {
+ titleTextView.setText(R.string.description_add);
+ }
+ }
+
+ public void onSave(View view) {
+ String summary = summaryEditText.getText().toString();
+ if (summary.length() > 0) {
+ Intent t = new Intent();
+ if (id != null) {
+ t.putExtra("id", id);
+ }
+ t.putExtra("summary", summary);
+ setResult(Activity.RESULT_OK, t);
+ } else {
+ setResult(Activity.RESULT_CANCELED);
+ }
+ finish();
+ }
+
+ public void onCancel(View view) {
+ setResult(Activity.RESULT_CANCELED);
+ finish();
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncBatchInsertCalendars.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncBatchInsertCalendars.java
new file mode 100644
index 00000000..e56b5378
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncBatchInsertCalendars.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.client.googleapis.batch.BatchRequest;
+import com.google.api.client.googleapis.batch.json.JsonBatchCallback;
+import com.google.api.client.googleapis.json.GoogleJsonError;
+import com.google.api.client.http.HttpHeaders;
+import com.google.api.services.calendar.model.Calendar;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Asynchronously insert a new calendar.
+ *
+ * @author Yaniv Inbar
+ */
+class AsyncBatchInsertCalendars extends CalendarAsyncTask {
+
+ private final List calendars;
+
+ AsyncBatchInsertCalendars(CalendarSampleActivity calendarSample, List calendars) {
+ super(calendarSample);
+ this.calendars = calendars;
+ }
+
+ @Override
+ protected void doInBackground() throws IOException {
+ BatchRequest batch = client.batch();
+ for (Calendar calendar : calendars) {
+ client.calendars().insert(calendar).setFields(CalendarInfo.FIELDS)
+ .queue(batch, new JsonBatchCallback() {
+
+ public void onSuccess(Calendar calendar, HttpHeaders headers) {
+ model.add(calendar);
+ }
+
+ @Override
+ public void onFailure(GoogleJsonError err, HttpHeaders headers) throws IOException {
+ Utils.logAndShowError(activity, CalendarSampleActivity.TAG, err.getMessage());
+ }
+ });
+ }
+ batch.execute();
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncDeleteCalendar.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncDeleteCalendar.java
new file mode 100644
index 00000000..f384c2a0
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncDeleteCalendar.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+
+import java.io.IOException;
+
+/**
+ * Asynchronously delete a calendar.
+ *
+ * @author Yaniv Inbar
+ */
+class AsyncDeleteCalendar extends CalendarAsyncTask {
+
+ private final String calendarId;
+
+ AsyncDeleteCalendar(CalendarSampleActivity calendarSample, CalendarInfo calendarInfo) {
+ super(calendarSample);
+ calendarId = calendarInfo.id;
+ }
+
+ @Override
+ protected void doInBackground() throws IOException {
+ try {
+ client.calendars().delete(calendarId).execute();
+ } catch (GoogleJsonResponseException e) {
+ // 404 Not Found would happen if user tries to delete an already deleted calendar
+ if (e.getStatusCode() != 404) {
+ throw e;
+ }
+ }
+ model.remove(calendarId);
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncInsertCalendar.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncInsertCalendar.java
new file mode 100644
index 00000000..bf72c5e7
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncInsertCalendar.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.services.calendar.model.Calendar;
+
+import java.io.IOException;
+
+/**
+ * Asynchronously insert a new calendar.
+ *
+ * @author Yaniv Inbar
+ */
+class AsyncInsertCalendar extends CalendarAsyncTask {
+
+ private final Calendar entry;
+
+ AsyncInsertCalendar(CalendarSampleActivity calendarSample, Calendar entry) {
+ super(calendarSample);
+ this.entry = entry;
+ }
+
+ @Override
+ protected void doInBackground() throws IOException {
+ Calendar calendar = client.calendars().insert(entry).setFields(CalendarInfo.FIELDS).execute();
+ model.add(calendar);
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncLoadCalendars.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncLoadCalendars.java
new file mode 100644
index 00000000..baadcafd
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncLoadCalendars.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.services.calendar.model.CalendarList;
+
+import java.io.IOException;
+
+/**
+ * Asynchronously load the calendars.
+ *
+ * @author Yaniv Inbar
+ */
+class AsyncLoadCalendars extends CalendarAsyncTask {
+
+ AsyncLoadCalendars(CalendarSampleActivity calendarSample) {
+ super(calendarSample);
+ }
+
+ @Override
+ protected void doInBackground() throws IOException {
+ CalendarList feed = client.calendarList().list().setFields(CalendarInfo.FEED_FIELDS).execute();
+ model.reset(feed.getItems());
+ }
+
+ static void run(CalendarSampleActivity calendarSample) {
+ new AsyncLoadCalendars(calendarSample).execute();
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncUpdateCalendar.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncUpdateCalendar.java
new file mode 100644
index 00000000..ac3077a5
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/AsyncUpdateCalendar.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.client.googleapis.json.GoogleJsonResponseException;
+import com.google.api.services.calendar.model.Calendar;
+
+import java.io.IOException;
+
+/**
+ * Asynchronously updates a calendar with a progress dialog.
+ *
+ * @author Yaniv Inbar
+ */
+class AsyncUpdateCalendar extends CalendarAsyncTask {
+
+ private final String calendarId;
+ private final Calendar entry;
+
+ AsyncUpdateCalendar(CalendarSampleActivity calendarSample, String calendarId, Calendar entry) {
+ super(calendarSample);
+ this.calendarId = calendarId;
+ this.entry = entry;
+ }
+
+ @Override
+ protected void doInBackground() throws IOException {
+ try {
+ Calendar updatedCalendar =
+ client.calendars().patch(calendarId, entry).setFields(CalendarInfo.FIELDS).execute();
+ model.add(updatedCalendar);
+ } catch (GoogleJsonResponseException e) {
+ // 404 Not Found would happen if user tries to delete an already deleted calendar
+ if (e.getStatusCode() != 404) {
+ throw e;
+ }
+ model.remove(calendarId);
+ }
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarAsyncTask.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarAsyncTask.java
new file mode 100644
index 00000000..918a3e4a
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarAsyncTask.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException;
+import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
+
+import android.os.AsyncTask;
+import android.view.View;
+
+import java.io.IOException;
+
+/**
+ * Asynchronous task that also takes care of common needs, such as displaying progress,
+ * authorization, exception handling, and notifying UI when operation succeeded.
+ *
+ * @author Yaniv Inbar
+ */
+abstract class CalendarAsyncTask extends AsyncTask {
+
+ final CalendarSampleActivity activity;
+ final CalendarModel model;
+ final com.google.api.services.calendar.Calendar client;
+ private final View progressBar;
+
+ CalendarAsyncTask(CalendarSampleActivity activity) {
+ this.activity = activity;
+ model = activity.model;
+ client = activity.client;
+ progressBar = activity.findViewById(R.id.title_refresh_progress);
+ }
+
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ activity.numAsyncTasks++;
+ progressBar.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ protected final Boolean doInBackground(Void... ignored) {
+ try {
+ doInBackground();
+ return true;
+ } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
+ activity.showGooglePlayServicesAvailabilityErrorDialog(
+ availabilityException.getConnectionStatusCode());
+ } catch (UserRecoverableAuthIOException userRecoverableException) {
+ activity.startActivityForResult(
+ userRecoverableException.getIntent(), CalendarSampleActivity.REQUEST_AUTHORIZATION);
+ } catch (IOException e) {
+ Utils.logAndShow(activity, CalendarSampleActivity.TAG, e);
+ }
+ return false;
+ }
+
+ @Override
+ protected final void onPostExecute(Boolean success) {
+ super.onPostExecute(success);
+ if (0 == --activity.numAsyncTasks) {
+ progressBar.setVisibility(View.GONE);
+ }
+ if (success) {
+ activity.refreshView();
+ }
+ }
+
+ abstract protected void doInBackground() throws IOException;
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarInfo.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarInfo.java
new file mode 100644
index 00000000..f8658a42
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarInfo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.client.util.Objects;
+import com.google.api.services.calendar.model.Calendar;
+import com.google.api.services.calendar.model.CalendarListEntry;
+
+/**
+ * Class that holds information about a calendar.
+ *
+ * @author Yaniv Inbar
+ */
+class CalendarInfo implements Comparable, Cloneable {
+
+ static final String FIELDS = "id,summary";
+ static final String FEED_FIELDS = "items(" + FIELDS + ")";
+
+ String id;
+ String summary;
+
+ CalendarInfo(String id, String summary) {
+ this.id = id;
+ this.summary = summary;
+ }
+
+ CalendarInfo(Calendar calendar) {
+ update(calendar);
+ }
+
+ CalendarInfo(CalendarListEntry calendar) {
+ update(calendar);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(CalendarInfo.class).add("id", id).add("summary", summary)
+ .toString();
+ }
+
+ public int compareTo(CalendarInfo other) {
+ return summary.compareTo(other.summary);
+ }
+
+ @Override
+ public CalendarInfo clone() {
+ try {
+ return (CalendarInfo) super.clone();
+ } catch (CloneNotSupportedException exception) {
+ // should not happen
+ throw new RuntimeException(exception);
+ }
+ }
+
+ void update(Calendar calendar) {
+ id = calendar.getId();
+ summary = calendar.getSummary();
+ }
+
+ void update(CalendarListEntry calendar) {
+ id = calendar.getId();
+ summary = calendar.getSummary();
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarModel.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarModel.java
new file mode 100644
index 00000000..825448e6
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarModel.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.api.services.calendar.model.Calendar;
+import com.google.api.services.calendar.model.CalendarListEntry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Thread-safe model for the Google calendars.
+ *
+ * @author Yaniv Inbar
+ */
+class CalendarModel {
+
+ private final Map calendars = new HashMap();
+
+ int size() {
+ synchronized (calendars) {
+ return calendars.size();
+ }
+ }
+
+ void remove(String id) {
+ synchronized (calendars) {
+ calendars.remove(id);
+ }
+ }
+
+ CalendarInfo get(String id) {
+ synchronized (calendars) {
+ return calendars.get(id);
+ }
+ }
+
+ void add(Calendar calendarToAdd) {
+ synchronized (calendars) {
+ CalendarInfo found = get(calendarToAdd.getId());
+ if (found == null) {
+ calendars.put(calendarToAdd.getId(), new CalendarInfo(calendarToAdd));
+ } else {
+ found.update(calendarToAdd);
+ }
+ }
+ }
+
+ void add(CalendarListEntry calendarToAdd) {
+ synchronized (calendars) {
+ CalendarInfo found = get(calendarToAdd.getId());
+ if (found == null) {
+ calendars.put(calendarToAdd.getId(), new CalendarInfo(calendarToAdd));
+ } else {
+ found.update(calendarToAdd);
+ }
+ }
+ }
+
+ void reset(List calendarsToAdd) {
+ synchronized (calendars) {
+ calendars.clear();
+ for (CalendarListEntry calendarToAdd : calendarsToAdd) {
+ add(calendarToAdd);
+ }
+ }
+ }
+
+ public CalendarInfo[] toSortedArray() {
+ synchronized (calendars) {
+ List result = new ArrayList();
+ for (CalendarInfo calendar : calendars.values()) {
+ result.add(calendar.clone());
+ }
+ Collections.sort(result);
+ return result.toArray(new CalendarInfo[0]);
+ }
+ }
+}
diff --git a/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSampleActivity.java b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSampleActivity.java
new file mode 100644
index 00000000..73e34777
--- /dev/null
+++ b/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSampleActivity.java
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.android;
+
+import com.google.android.gms.common.GooglePlayServicesUtil;
+import com.google.api.client.extensions.android.http.AndroidHttp;
+import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
+import com.google.api.client.http.HttpTransport;
+import com.google.api.client.json.JsonFactory;
+import com.google.api.client.json.gson.GsonFactory;
+import com.google.api.services.calendar.CalendarScopes;
+import com.google.api.services.calendar.model.Calendar;
+
+import android.accounts.AccountManager;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Sample activity for Google Calendar API v3. It demonstrates how to use authorization to list
+ * calendars, add a new calendar, and edit or delete an existing calendar with the user's
+ * permission.
+ *
+ *
+ * Warning: this sample is for illustrative purposes only. Please instead use the native
+ * Calendar APIs like the Calendar
+ * Provider API.
+ *
+ *
+ * @author Yaniv Inbar
+ */
+public final class CalendarSampleActivity extends Activity {
+
+ /**
+ * Logging level for HTTP requests/responses.
+ *
+ *
+ * To turn on, set to {@link Level#CONFIG} or {@link Level#ALL} and run this from command line:
+ *
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select the "Web Application" platform, and click Register.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
Within "OAuth 2.0 Client ID", in the "Redirect URI" field enter some
+ redirect URIs, for example
+ "https://yourappname.appspot.com/oauth2callback" and
+ "http://localhost:8888/oauth2callback".
+
Edit src/main/webapp/WEB-INF/appengine-web.xml, and enter the unique application identifier (you chose it in the prior step)
+ between the <application> tags.
+
+
+
If you've done the above, you can deploy at any time:
+
+mvn appengine:update
+
+
+
If this is the first time you have run "update" on the project, a browser window will open prompting you to log in.
+ Log in with the same Google account the app is registered with.
+
Window > Preferences... (or on Mac, Eclipse >
+ Preferences...)
+
Select Maven
+
+
check on "Download Artifact Sources"
+
check on "Download Artifact JavaDoc"
+
+
+
+
+
Import calendar-appengine-sample project
+
+
File > Import...
+
Select "General > Existing Project into Workspace" and click
+ "Next"
+
Click "Browse" next to "Select root directory", find
+ [someDirectory]/google-api-java-client-samples/calendar-appengine-sample
+ and click "Next"
+
+
Click "Finish"
+
NOTE: please ignore the "The App Engine SDK JAR * is missing in
+ the WEB-INF/lib directory" error messages.
+
+
+
Run
+
+
Right-click on project calendar-appengine-sample
+
Run As > Web Application
+
+
+
+
+
+
diff --git a/calendar-appengine-sample/pom.xml b/calendar-appengine-sample/pom.xml
new file mode 100644
index 00000000..5e96ed0b
--- /dev/null
+++ b/calendar-appengine-sample/pom.xml
@@ -0,0 +1,303 @@
+
+
+ 4.0.0
+
+ com.google
+ google
+ 5
+
+ com.google.apis-samples
+ calendar-appengine-sample
+ 1
+ Example for the Google Calendar Data API v3 using OAuth 2 on Google App Engine.
+ war
+
+ http://code.google.com/p/google-api-java-client/
+
+
+ code.google.com
+ http://code.google.com/p/google-api-java-client/issues/list
+
+
+ 2011
+
+
+ 2.0.9
+
+
+
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
+ http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
+
+
+
+
+ DataNucleus_2
+ http://www.datanucleus.org/downloads/maven2/
+ DataNucleus
+
+
+
+
+
+ DataNucleus_2
+ http://www.datanucleus.org/downloads/maven2/
+
+
+
+
+ 1.1.5
+ 2.4.0
+ 1.19.0
+ 1.8.3
+ ${project.build.directory}/${project.build.finalName}
+
+ UTF-8
+
+
+
+
+ yanivi
+ Yaniv Inbar
+ yanivi@google.com
+ Google
+ http://www.google.com
+
+ owner
+ developer
+
+ -5
+
+
+
+
+ war
+ ${webappDirectory}/WEB-INF/classes
+
+
+
+ maven-compiler-plugin
+ 2.3.2
+
+ 1.6
+ 1.6
+
+
+
+
+ com.google.appengine
+ appengine-maven-plugin
+ ${project.appengine.version}
+
+ 8888
+
+
+
+
+ org.codehaus.mojo
+ gwt-maven-plugin
+ 2.4.0
+
+
+
+ compile
+
+
+
+
+ com.google.api.services.samples.calendar.appengine.Calendar
+
+ ${webappDirectory}
+
+
+
+
+ org.datanucleus
+ maven-datanucleus-plugin
+ 1.1.4
+
+ false
+ ${basedir}/src/main/resources/log4j.properties
+ **/server/*.class
+ true
+ ASM
+ JPA
+
+
+
+
+ compile
+
+ enhance
+
+
+
+
+
+ org.datanucleus
+ datanucleus-core
+ ${datanucleus.version}
+
+
+ javax.transaction
+ transaction-api
+
+
+
+
+ org.datanucleus
+ datanucleus-rdbms
+ ${datanucleus.version}
+
+
+ org.datanucleus
+ datanucleus-enhancer
+ 1.1.4
+
+
+
+ javax.jdo
+ jdo2-api
+ 2.3-ec
+ runtime
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 2.1.1
+
+
+ compile
+
+ exploded
+
+
+
+
+ ${webappDirectory}
+
+
+
+ maven-checkstyle-plugin
+ 2.6
+
+ ../checkstyle.xml
+ true
+ false
+
+
+
+
+ check
+
+
+
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 2.3.2
+
+ false
+
+
+
+
+ check
+
+
+
+
+
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ [2.1.1,)
+
+ exploded
+
+
+
+
+
+
+
+
+ org.datanucleus
+ maven-datanucleus-plugin
+ [1.1.4,)
+
+ enhance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.google.appengine
+ appengine-api-1.0-sdk
+ ${project.appengine.version}
+
+
+ com.google.apis
+ google-api-services-calendar
+ v3-rev87-1.19.0
+
+
+ com.google.api-client
+ google-api-client-appengine
+ ${google-api-client.version}
+
+
+ com.google.api-client
+ google-api-client-jackson2
+ ${google-api-client.version}
+
+
+ com.google.gwt
+ gwt-user
+ ${gwt.version}
+
+
+ com.google.gwt
+ gwt-servlet
+ ${gwt.version}
+
+
+ net.sf.jsr107cache
+ jsr107cache
+ 1.1
+
+
+ javax.jdo
+ jdo2-api
+ 2.3-eb
+
+
+
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/Calendar.gwt.xml b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/Calendar.gwt.xml
similarity index 81%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/Calendar.gwt.xml
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/Calendar.gwt.xml
index 623cccaa..3ae72143 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/Calendar.gwt.xml
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/Calendar.gwt.xml
@@ -3,7 +3,7 @@
+ class='com.google.api.services.samples.calendar.appengine.client.CalendarGwtSample' />
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarButtons.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarButtons.java
similarity index 94%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarButtons.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarButtons.java
index 1b69bf3e..01394ad7 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarButtons.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarButtons.java
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
@@ -27,7 +27,7 @@
/**
* Buttons for a calendar.
- *
+ *
* @author Yaniv Inbar
*/
public class CalendarButtons extends Composite {
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarButtons.ui.xml b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarButtons.ui.xml
similarity index 100%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarButtons.ui.xml
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarButtons.ui.xml
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarGwtSample.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarGwtSample.java
similarity index 87%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarGwtSample.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarGwtSample.java
index e151bb80..5de9735d 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarGwtSample.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarGwtSample.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.AuthenticationException;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.AuthenticationException;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
@@ -27,7 +27,7 @@
/**
* Main entry-point for the Calendar GWT sample.
- *
+ *
* @author Yaniv Inbar
*/
public class CalendarGwtSample implements EntryPoint {
@@ -37,6 +37,7 @@ public class CalendarGwtSample implements EntryPoint {
static final CalendarServiceAsync SERVICE = GWT.create(CalendarService.class);
+ @Override
public void onModuleLoad() {
calendarsFrame = new CalendarsFrame(this);
RootPanel.get("main").add(calendarsFrame);
@@ -65,14 +66,11 @@ void refreshTable() {
FlexTable calendarsTable = calendarsFrame.calendarsTable;
calendarsTable.removeAllRows();
calendarsTable.setText(0, 1, "Calendar Title");
- calendarsTable.setText(0, 2, "Updated");
calendarsTable.getCellFormatter().addStyleName(0, 1, "methodsHeaderRow");
- calendarsTable.getCellFormatter().addStyleName(0, 2, "methodsHeaderRow");
for (int i = 0; i < calendars.size(); i++) {
GwtCalendar calendar = calendars.get(i);
calendarsTable.setWidget(i + 1, 0, new CalendarButtons(this, calendar, i));
calendarsTable.setText(i + 1, 1, calendar.title);
- calendarsTable.setText(i + 1, 2, calendar.updated);
}
}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarService.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarService.java
similarity index 83%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarService.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarService.java
index 0fae1bb2..c4311151 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarService.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarService.java
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@@ -23,7 +23,7 @@
/**
* GWT RPC service for calendars.
- *
+ *
* @author Yaniv Inbar
*/
@RemoteServiceRelativePath("calendarService")
@@ -35,5 +35,5 @@ public interface CalendarService extends RemoteService {
GwtCalendar insert(GwtCalendar calendar) throws IOException;
- GwtCalendar update(GwtCalendar original, GwtCalendar updated) throws IOException;
+ GwtCalendar update(GwtCalendar updated) throws IOException;
}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarServiceAsync.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarServiceAsync.java
similarity index 81%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarServiceAsync.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarServiceAsync.java
index 0858e5b4..e1e5b85f 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarServiceAsync.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarServiceAsync.java
@@ -1,27 +1,27 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.user.client.rpc.AsyncCallback;
import java.util.List;
/**
* Async interface for GWT RPC service for calendars.
- *
+ *
* @author Yaniv Inbar
*/
public interface CalendarServiceAsync {
@@ -31,5 +31,5 @@ public interface CalendarServiceAsync {
void insert(GwtCalendar calendar, AsyncCallback callback);
- void update(GwtCalendar original, GwtCalendar updated, AsyncCallback callback);
+ void update(GwtCalendar updated, AsyncCallback callback);
}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarsFrame.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarsFrame.java
similarity index 93%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarsFrame.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarsFrame.java
index cbf190db..72c64f85 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarsFrame.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarsFrame.java
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
@@ -29,7 +29,7 @@
/**
* Main calendars UI frame.
- *
+ *
* @author Yaniv Inbar
*/
public class CalendarsFrame extends Composite {
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarsFrame.ui.xml b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarsFrame.ui.xml
similarity index 100%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/CalendarsFrame.ui.xml
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/CalendarsFrame.ui.xml
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/DeleteDialogContent.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/DeleteDialogContent.java
similarity index 87%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/DeleteDialogContent.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/DeleteDialogContent.java
index a92f14c6..200ec6ab 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/DeleteDialogContent.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/DeleteDialogContent.java
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
@@ -28,7 +28,7 @@
/**
* Delete dialog content.
- *
+ *
* @author Yaniv Inbar
*/
public class DeleteDialogContent extends Composite {
@@ -51,8 +51,8 @@ interface MyUiBinder extends UiBinder {
final int calendarIndex;
- DeleteDialogContent(
- CalendarGwtSample main, DialogBox dialogBox, GwtCalendar calendar, int calendarIndex) {
+ DeleteDialogContent(CalendarGwtSample main, DialogBox dialogBox, GwtCalendar calendar,
+ int calendarIndex) {
this.main = main;
this.dialogBox = dialogBox;
this.calendar = calendar;
@@ -64,7 +64,7 @@ interface MyUiBinder extends UiBinder {
@UiHandler("deleteButton")
void handleDelete(ClickEvent e) {
dialogBox.hide();
- CalendarGwtSample.SERVICE.delete(calendar, new AsyncCallback() {
+ CalendarGwtSample.SERVICE.delete(calendar, new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
@@ -72,7 +72,7 @@ public void onFailure(Throwable caught) {
}
@Override
- public void onSuccess(Object result) {
+ public void onSuccess(Void result) {
main.calendars.remove(calendarIndex);
main.refreshTable();
}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/DeleteDialogContent.ui.xml b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/DeleteDialogContent.ui.xml
similarity index 100%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/DeleteDialogContent.ui.xml
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/DeleteDialogContent.ui.xml
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/UpdateDialogContent.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/UpdateDialogContent.java
similarity index 84%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/UpdateDialogContent.java
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/UpdateDialogContent.java
index 475a64c7..fbbb1a32 100644
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/UpdateDialogContent.java
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/UpdateDialogContent.java
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package com.google.api.client.sample.calendar.v2.appengine.client;
+package com.google.api.services.samples.calendar.appengine.client;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
+import com.google.api.services.samples.calendar.appengine.shared.GwtCalendar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
@@ -29,7 +29,7 @@
/**
* Update dialog content.
- *
+ *
* @author Yaniv Inbar
*/
public class UpdateDialogContent extends Composite {
@@ -55,8 +55,8 @@ interface MyUiBinder extends UiBinder {
final int calendarIndex;
- UpdateDialogContent(
- CalendarGwtSample main, DialogBox dialogBox, GwtCalendar calendar, int calendarIndex) {
+ UpdateDialogContent(CalendarGwtSample main, DialogBox dialogBox, GwtCalendar calendar,
+ int calendarIndex) {
this.main = main;
this.dialogBox = dialogBox;
this.calendar = calendar;
@@ -70,10 +70,9 @@ interface MyUiBinder extends UiBinder {
void handleUpdate(ClickEvent e) {
dialogBox.hide();
GwtCalendar updated = new GwtCalendar();
- updated.editLink = calendar.editLink;
+ updated.id = calendar.id;
updated.title = textBox.getText();
- updated.updated = calendar.updated;
- CalendarGwtSample.SERVICE.update(calendar, updated, new AsyncCallback() {
+ CalendarGwtSample.SERVICE.update(updated, new AsyncCallback() {
@Override
public void onFailure(Throwable caught) {
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/UpdateDialogContent.ui.xml b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/UpdateDialogContent.ui.xml
similarity index 100%
rename from calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/client/UpdateDialogContent.ui.xml
rename to calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/client/UpdateDialogContent.ui.xml
diff --git a/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/server/CalendarAppEngineSample.java b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/server/CalendarAppEngineSample.java
new file mode 100644
index 00000000..d04acef5
--- /dev/null
+++ b/calendar-appengine-sample/src/main/java/com/google/api/services/samples/calendar/appengine/server/CalendarAppEngineSample.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.google.api.services.samples.calendar.appengine.server;
+
+import com.google.api.client.auth.oauth2.AuthorizationCodeFlow;
+import com.google.api.client.extensions.appengine.auth.oauth2.AbstractAppEngineAuthorizationCodeServlet;
+import com.google.appengine.api.users.UserService;
+import com.google.appengine.api.users.UserServiceFactory;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Google Calendar Data API App Engine sample.
+ *
+ * @author Yaniv Inbar
+ */
+public class CalendarAppEngineSample extends AbstractAppEngineAuthorizationCodeServlet {
+
+ static final String APP_NAME = "Google Calendar Data API Sample Web Client";
+
+ static final String GWT_MODULE_NAME = "calendar";
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ response.setContentType("text/html");
+ response.setCharacterEncoding("UTF-8");
+ PrintWriter writer = response.getWriter();
+ writer.println("");
+ writer.println("");
+ writer.println("" + APP_NAME + "");
+ writer.println(
+ "");
+ writer.println("");
+ writer.println("");
+ UserService userService = UserServiceFactory.getUserService();
+ writer.println("
If necessary, sign in to your Google Account, select or create a project,
+ and agree to the terms of service. Click Continue.
+
Select "Installed application" and choose type "Other" under the Installed Application type.
+
Within "OAuth 2.0 Client ID", click on "Download JSON". Later on, after you check
+ out the sample project, you will copy this downloaded file (e.g.
+ ~/Downloads/client_secrets.json) to
+ src/main/resources/client_secrets.json.
+ If you skip this step, when trying to run the sample you will get a 400
+ INVALID_CLIENT error in the browser.
+
+
+
+
Checkout Instructions
+
+
+ Prerequisites: install Java 6, Mercurial, and Maven. You may need to
+ set your
+ JAVA_HOME
+ .
+
Follow instructions to install Package "Google API's by Google
- Inc., Android API 8"
-
Follow instructions to create a new Android Virtual Device based on
- target "Google API's (Google Inc.) - API Level 8"
-
Click "Start..." (wait a while...)
-
On home screen in emulator, click Menu button, Settings
-
Click on "Accounts and Sync"
-
Click on "Add Account"
-
Click "Google" and follow instructions
-
-
-
Import calendar-v2-atom-android-sample project
-
-
File > Import...
-
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/calendar-v2-atom-android-sample
- and click "Next"
-
Click "Finish"
-
-
-
Clean Project (if compile error about missing gen directory)
-
-
Select calendar-v2-atom-android-sample project
-
Project > Clean...
-
Select "Clean projects selected below"
-
Click on "OK"
-
-
-
Run
-
-
Right-click on project calendar-v2-atom-android-sample
-
Run As > Android Application
-
-
-
-
-
-
diff --git a/calendar-v2-atom-android-sample/pom.xml b/calendar-v2-atom-android-sample/pom.xml
deleted file mode 100644
index 16dc008e..00000000
--- a/calendar-v2-atom-android-sample/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-
- 4.0.0
-
- com.google
- google
- 5
-
- com.google.api.client
- calendar-v2-atom-android-sample
- 1.0.0
- calendar-v2-atom-android-sample
-
- Example for the Google Calendar Data API Atom XML for Android
-
-
- UTF-8
- 1.2.0-alpha-SNAPSHOT
-
-
- http://code.google.com/p/google-api-java-client/
-
-
- code.google.com
- http://code.google.com/p/google-api-java-client/issues/list
-
-
- 2010
-
-
- 2.0.9
-
-
-
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
-
-
-
-
- yanivi
- Yaniv Inbar
- yanivi@google.com
- Google
- http://www.google.com
-
- owner
- developer
-
- -5
-
-
-
-
-
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- ${project.artifactId}-${project.version}
- src
- tests_disabled
-
-
-
- com.google.api.client
- google-api-client-apache
- ${libVersion}
-
-
- com.google.api.client
- google-api-client-googleapis
- ${libVersion}
-
-
- com.google.api.client
- google-api-client-googleapis-xml-atom
- ${libVersion}
-
-
-
diff --git a/calendar-v2-atom-android-sample/res/drawable-hdpi/icon.png b/calendar-v2-atom-android-sample/res/drawable-hdpi/icon.png
deleted file mode 100644
index 8074c4c5..00000000
Binary files a/calendar-v2-atom-android-sample/res/drawable-hdpi/icon.png and /dev/null differ
diff --git a/calendar-v2-atom-android-sample/res/drawable-ldpi/icon.png b/calendar-v2-atom-android-sample/res/drawable-ldpi/icon.png
deleted file mode 100644
index 1095584e..00000000
Binary files a/calendar-v2-atom-android-sample/res/drawable-ldpi/icon.png and /dev/null differ
diff --git a/calendar-v2-atom-android-sample/res/drawable-mdpi/icon.png b/calendar-v2-atom-android-sample/res/drawable-mdpi/icon.png
deleted file mode 100644
index a07c69fa..00000000
Binary files a/calendar-v2-atom-android-sample/res/drawable-mdpi/icon.png and /dev/null differ
diff --git a/calendar-v2-atom-android-sample/res/values/strings.xml b/calendar-v2-atom-android-sample/res/values/strings.xml
deleted file mode 100644
index a0f2886b..00000000
--- a/calendar-v2-atom-android-sample/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Calendar V2 Atom Android Sample
-
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/CalendarAndroidSample.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/CalendarAndroidSample.java
deleted file mode 100644
index 43790fec..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/CalendarAndroidSample.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android;
-
-import com.google.api.client.googleapis.GoogleHeaders;
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.android.model.CalendarEntry;
-import com.google.api.client.sample.calendar.android.model.CalendarFeed;
-import com.google.api.client.sample.calendar.android.model.CalendarUrl;
-import com.google.api.client.sample.calendar.android.model.Namespace;
-import com.google.api.client.util.DateTime;
-import com.google.api.client.xml.atom.AtomParser;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ListActivity;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView.AdapterContextMenuInfo;
-import android.widget.ArrayAdapter;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Sample for Google Calendar Data API using the Atom wire format. It shows how
- * to authenticate, get calendars, add a new calendar, update it, and delete it.
- *
- * To enable logging of HTTP requests/responses, run this command: {@code adb
- * shell setprop log.tag.HttpTransport DEBUG}. Then press-and-hold a calendar,
- * and enable "Logging".
- *
- *
- * @author Yaniv Inbar
- */
-public final class CalendarAndroidSample extends ListActivity {
-
- private static final String AUTH_TOKEN_TYPE = "cl";
-
- private static final String TAG = "CalendarSample";
-
- private static final int MENU_ADD = 0;
-
- private static final int MENU_ACCOUNTS = 1;
-
- private static final int CONTEXT_EDIT = 0;
-
- private static final int CONTEXT_DELETE = 1;
-
- private static final int CONTEXT_LOGGING = 2;
-
- private static final int REQUEST_AUTHENTICATE = 0;
-
- private static final String PREF = "MyPrefs";
-
- private static final int DIALOG_ACCOUNTS = 0;
-
- private static HttpTransport transport;
-
- private String authToken;
-
- private final List calendars = new ArrayList();
-
- public CalendarAndroidSample() {
- transport = GoogleTransport.create();
- GoogleHeaders headers = (GoogleHeaders) transport.defaultHeaders;
- headers.setApplicationName("google-calendarandroidsample-1.0");
- headers.gdataVersion = "2";
- AtomParser parser = new AtomParser();
- parser.namespaceDictionary = Namespace.DICTIONARY;
- transport.addParser(parser);
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- setLogging(settings.getBoolean("logging", false));
- getListView().setTextFilterEnabled(true);
- registerForContextMenu(getListView());
- Intent intent = getIntent();
- gotAccount(false);
- }
-
- @Override
- protected Dialog onCreateDialog(int id) {
- switch (id) {
- case DIALOG_ACCOUNTS:
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle("Select a Google account");
- final AccountManager manager = AccountManager.get(this);
- final Account[] accounts = manager.getAccountsByType("com.google");
- final int size = accounts.length;
- String[] names = new String[size];
- for (int i = 0; i < size; i++) {
- names[i] = accounts[i].name;
- }
- builder.setItems(names, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- gotAccount(manager, accounts[which]);
- }
- });
- return builder.create();
- }
- return null;
- }
-
- private void gotAccount(boolean tokenExpired) {
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- String accountName = settings.getString("accountName", null);
- if (accountName != null) {
- AccountManager manager = AccountManager.get(this);
- Account[] accounts = manager.getAccountsByType("com.google");
- int size = accounts.length;
- for (int i = 0; i < size; i++) {
- Account account = accounts[i];
- if (accountName.equals(account.name)) {
- if (tokenExpired) {
- manager.invalidateAuthToken("com.google", this.authToken);
- }
- gotAccount(manager, account);
- return;
- }
- }
- }
- showDialog(DIALOG_ACCOUNTS);
- }
-
- private void gotAccount(final AccountManager manager, final Account account) {
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- SharedPreferences.Editor editor = settings.edit();
- editor.putString("accountName", account.name);
- editor.commit();
- new Thread() {
-
- @Override
- public void run() {
- try {
- final Bundle bundle =
- manager.getAuthToken(account, AUTH_TOKEN_TYPE, true, null, null)
- .getResult();
- runOnUiThread(new Runnable() {
-
- public void run() {
- try {
- if (bundle.containsKey(AccountManager.KEY_INTENT)) {
- Intent intent =
- bundle.getParcelable(AccountManager.KEY_INTENT);
- int flags = intent.getFlags();
- flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
- intent.setFlags(flags);
- startActivityForResult(intent, REQUEST_AUTHENTICATE);
- } else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
- authenticatedClientLogin(
- bundle.getString(AccountManager.KEY_AUTHTOKEN));
- }
- } catch (Exception e) {
- handleException(e);
- }
- }
- });
- } catch (Exception e) {
- handleException(e);
- }
- }
- }.start();
- }
-
- @Override
- protected void onActivityResult(
- int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- switch (requestCode) {
- case REQUEST_AUTHENTICATE:
- if (resultCode == RESULT_OK) {
- gotAccount(false);
- } else {
- showDialog(DIALOG_ACCOUNTS);
- }
- break;
- }
- }
-
- private void authenticatedClientLogin(String authToken) {
- this.authToken = authToken;
- ((GoogleHeaders) transport.defaultHeaders).setGoogleLogin(authToken);
- authenticated();
- }
-
- private void authenticated() {
- executeRefreshCalendars();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- menu.add(0, MENU_ADD, 0, "New calendar");
- menu.add(0, MENU_ACCOUNTS, 0, "Switch Account");
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case MENU_ADD:
- CalendarUrl url = CalendarUrl.forOwnCalendarsFeed();
- CalendarEntry calendar = new CalendarEntry();
- calendar.title = "Calendar " + new DateTime(new Date());
- try {
- CalendarEntry result = calendar.executeInsert(transport, url);
- } catch (IOException e) {
- handleException(e);
- }
- executeRefreshCalendars();
- return true;
- case MENU_ACCOUNTS:
- showDialog(DIALOG_ACCOUNTS);
- return true;
- }
- return false;
- }
-
- @Override
- public void onCreateContextMenu(
- ContextMenu menu, View v, ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
- menu.add(0, CONTEXT_EDIT, 0, "Update Title");
- menu.add(0, CONTEXT_DELETE, 0, "Delete");
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- boolean logging = settings.getBoolean("logging", false);
- menu.add(0, CONTEXT_LOGGING, 0, "Logging").setCheckable(true).setChecked(
- logging);
- }
-
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
- CalendarEntry calendar = calendars.get((int) info.id);
- try {
- switch (item.getItemId()) {
- case CONTEXT_EDIT:
- CalendarEntry patchedCalendar = calendar.clone();
- patchedCalendar.title =
- calendar.title + " UPDATED " + new DateTime(new Date());
- patchedCalendar.executePatchRelativeToOriginal(transport, calendar);
- executeRefreshCalendars();
- return true;
- case CONTEXT_DELETE:
- calendar.executeDelete(transport);
- executeRefreshCalendars();
- return true;
- case CONTEXT_LOGGING:
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- boolean logging = settings.getBoolean("logging", false);
- setLogging(!logging);
- return true;
- default:
- return super.onContextItemSelected(item);
- }
- } catch (IOException e) {
- handleException(e);
- }
- return false;
- }
-
- private void executeRefreshCalendars() {
- String[] calendarNames;
- List calendars = this.calendars;
- calendars.clear();
- try {
- CalendarUrl url = CalendarUrl.forAllCalendarsFeed();
- // page through results
- while (true) {
- CalendarFeed feed = CalendarFeed.executeGet(transport, url);
- if (feed.calendars != null) {
- calendars.addAll(feed.calendars);
- }
- String nextLink = feed.getNextLink();
- if (nextLink == null) {
- break;
- }
- }
- int numCalendars = calendars.size();
- calendarNames = new String[numCalendars];
- for (int i = 0; i < numCalendars; i++) {
- calendarNames[i] = calendars.get(i).title;
- }
- } catch (IOException e) {
- handleException(e);
- calendarNames = new String[] {e.getMessage()};
- calendars.clear();
- }
- setListAdapter(new ArrayAdapter(
- this, android.R.layout.simple_list_item_1, calendarNames));
- }
-
- private void setLogging(boolean logging) {
- Logger.getLogger("com.google.api.client").setLevel(
- logging ? Level.CONFIG : Level.OFF);
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- boolean currentSetting = settings.getBoolean("logging", false);
- if (currentSetting != logging) {
- SharedPreferences.Editor editor = settings.edit();
- editor.putBoolean("logging", logging);
- editor.commit();
- }
- }
-
- private void handleException(Exception e) {
- e.printStackTrace();
- SharedPreferences settings = getSharedPreferences(PREF, 0);
- boolean log = settings.getBoolean("logging", false);
- if (e instanceof HttpResponseException) {
- HttpResponse response = ((HttpResponseException) e).response;
- int statusCode = response.statusCode;
- try {
- response.ignore();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- if (statusCode == 401 || statusCode == 403) {
- gotAccount(true);
- return;
- }
- if (log) {
- try {
- Log.e(TAG, response.parseAsString());
- } catch (IOException parseException) {
- parseException.printStackTrace();
- }
- }
- }
- if (log) {
- Log.e(TAG, e.getMessage(), e);
- }
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarEntry.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarEntry.java
deleted file mode 100644
index 40e1b7cd..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarEntry.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.http.HttpTransport;
-
-import java.io.IOException;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarEntry extends Entry {
-
- public String getEventFeedLink() {
- return Link.find(links, "http://schemas.google.com/gCal/2005#eventFeed");
- }
-
- @Override
- public CalendarEntry clone() {
- return (CalendarEntry) super.clone();
- }
-
- @Override
- public CalendarEntry executeInsert(HttpTransport transport, CalendarUrl url)
- throws IOException {
- return (CalendarEntry) super.executeInsert(transport, url);
- }
-
- public CalendarEntry executePatchRelativeToOriginal(
- HttpTransport transport, CalendarEntry original) throws IOException {
- return (CalendarEntry) super.executePatchRelativeToOriginal(
- transport, original);
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarFeed.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarFeed.java
deleted file mode 100644
index d25d76eb..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarFeed.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarFeed extends Feed {
-
- @Key("entry")
- public List calendars = new ArrayList();
-
- public static CalendarFeed executeGet(
- HttpTransport transport, CalendarUrl url) throws IOException {
- return (CalendarFeed) Feed.executeGet(transport, url, CalendarFeed.class);
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarUrl.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarUrl.java
deleted file mode 100644
index 9eb38901..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/CalendarUrl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarUrl extends GoogleUrl {
-
- public static final String ROOT_URL = "https://www.google.com/calendar/feeds";
-
- @Key("max-results")
- public Integer maxResults;
-
- public CalendarUrl(String url) {
- super(url);
- if (Debug.ENABLED) {
- this.prettyprint = true;
- }
- }
-
- private static CalendarUrl forRoot() {
- return new CalendarUrl(ROOT_URL);
- }
-
- public static CalendarUrl forCalendarMetafeed() {
- CalendarUrl result = forRoot();
- result.pathParts.add("default");
- return result;
- }
-
- public static CalendarUrl forAllCalendarsFeed() {
- CalendarUrl result = forCalendarMetafeed();
- result.pathParts.add("allcalendars");
- result.pathParts.add("full");
- return result;
- }
-
- public static CalendarUrl forOwnCalendarsFeed() {
- CalendarUrl result = forCalendarMetafeed();
- result.pathParts.add("owncalendars");
- result.pathParts.add("full");
- return result;
- }
-
- public static CalendarUrl forEventFeed(
- String userId, String visibility, String projection) {
- CalendarUrl result = forRoot();
- result.pathParts.add(userId);
- result.pathParts.add(visibility);
- result.pathParts.add(projection);
- return result;
- }
-
- public static CalendarUrl forDefaultPrivateFullEventFeed() {
- return forEventFeed("default", "private", "full");
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Debug.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Debug.java
deleted file mode 100644
index 5d5ed675..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Debug.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-/**
- * @author Yaniv Inbar
- */
-public class Debug {
- public static final boolean ENABLED = false;
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Entry.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Entry.java
deleted file mode 100644
index 443e280c..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Entry.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.googleapis.xml.atom.AtomPatchRelativeToOriginalContent;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.DataUtil;
-import com.google.api.client.util.Key;
-import com.google.api.client.xml.atom.AtomContent;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class Entry implements Cloneable {
-
- @Key
- public String summary;
-
- @Key
- public String title;
-
- @Key
- public String updated;
-
- @Key("link")
- public List links;
-
- @Override
- protected Entry clone() {
- return DataUtil.clone(this);
- }
-
- public void executeDelete(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildDeleteRequest();
- request.setUrl(getEditLink());
- RedirectHandler.execute(request).ignore();
- }
-
- Entry executeInsert(HttpTransport transport, CalendarUrl url)
- throws IOException {
- HttpRequest request = transport.buildPostRequest();
- request.url = url;
- AtomContent content = new AtomContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.entry = this;
- request.content = content;
- return RedirectHandler.execute(request).parseAs(getClass());
- }
-
- Entry executePatchRelativeToOriginal(HttpTransport transport, Entry original)
- throws IOException {
- HttpRequest request = transport.buildPatchRequest();
- request.setUrl(getEditLink());
- AtomPatchRelativeToOriginalContent content =
- new AtomPatchRelativeToOriginalContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.originalEntry = original;
- content.patchedEntry = this;
- request.content = content;
- return RedirectHandler.execute(request).parseAs(getClass());
- }
-
- private String getEditLink() {
- return Link.find(links, "edit");
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Feed.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Feed.java
deleted file mode 100644
index 9a73b7df..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Feed.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.googleapis.xml.atom.GData;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class Feed {
-
- @Key("link")
- public List links;
-
- public String getNextLink() {
- return Link.find(links, "next");
- }
-
- public String getBatchLink() {
- return Link.find(links, "http://schemas.google.com/g/2005#batch");
- }
-
- static Feed executeGet(
- HttpTransport transport, CalendarUrl url, Class extends Feed> feedClass)
- throws IOException {
- url.fields = GData.getFieldsFor(feedClass);
- HttpRequest request = transport.buildGetRequest();
- request.url = url;
- return RedirectHandler.execute(request).parseAs(feedClass);
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Link.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Link.java
deleted file mode 100644
index 233a25ef..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Link.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class Link {
-
- @Key("@href")
- public String href;
-
- @Key("@rel")
- public String rel;
-
- public static String find(List links, String rel) {
- if (links != null) {
- for (Link link : links) {
- if (rel.equals(link.rel)) {
- return link.href;
- }
- }
- }
- return null;
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Namespace.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Namespace.java
deleted file mode 100644
index 92b4140e..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/Namespace.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.xml.XmlNamespaceDictionary;
-
-import java.util.Map;
-
-/**
- * @author Yaniv Inbar
- */
-public class Namespace {
-
- public static final XmlNamespaceDictionary DICTIONARY =
- new XmlNamespaceDictionary();
- static {
- Map map = DICTIONARY.namespaceAliasToUriMap;
- map.put("", "http://www.w3.org/2005/Atom");
- map.put("atom", "http://www.w3.org/2005/Atom");
- map.put("batch", "http://schemas.google.com/gdata/batch");
- map.put("gAcl", "http://schemas.google.com/acl/2007");
- map.put("gCal", "http://schemas.google.com/gCal/2005");
- map.put("gd", "http://schemas.google.com/g/2005");
- map.put("georss", "http://www.georss.org/georss");
- map.put("gml", "http://www.opengis.net/gml");
- map.put("openSearch", "http://a9.com/-/spec/opensearch/1.1/");
- map.put("xml", "http://www.w3.org/XML/1998/namespace");
- }
-}
diff --git a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/RedirectHandler.java b/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/RedirectHandler.java
deleted file mode 100644
index 19f2500e..00000000
--- a/calendar-v2-atom-android-sample/src/com/google/api/client/sample/calendar/android/model/RedirectHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.android.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.http.HttpExecuteIntercepter;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-
-import java.io.IOException;
-
-/**
- * @author Yaniv Inbar
- */
-public class RedirectHandler {
-
- /**
- * See How
- * do I handle redirects...?.
- */
- private static class SessionIntercepter implements HttpExecuteIntercepter {
-
- private String gsessionid;
-
- private SessionIntercepter(HttpTransport transport, GoogleUrl locationUrl) {
- this.gsessionid = (String) locationUrl.getFirst("gsessionid");
- transport.removeIntercepters(SessionIntercepter.class);
- transport.intercepters.add(0, this); // must be first
- }
-
- public void intercept(HttpRequest request) {
- request.url.set("gsessionid", this.gsessionid);
- }
- }
-
- static HttpResponse execute(HttpRequest request) throws IOException {
- try {
- return request.execute();
- } catch (HttpResponseException e) {
- if (e.response.statusCode == 302) {
- GoogleUrl url = new GoogleUrl(e.response.headers.location);
- request.url = url;
- new SessionIntercepter(request.transport, url);
- e.response.ignore(); // force the connection to close
- return request.execute();
- } else {
- throw e;
- }
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/.classpath b/calendar-v2-atom-oauth-appengine-sample/.classpath
deleted file mode 100644
index 3f317fa1..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/calendar-v2-atom-oauth-appengine-sample/.project b/calendar-v2-atom-oauth-appengine-sample/.project
deleted file mode 100644
index 1f006b87..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- calendar-v2-atom-oauth-appengine-sample
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- com.google.gdt.eclipse.core.webAppProjectValidator
-
-
-
-
- com.google.gwt.eclipse.core.gwtProjectValidator
-
-
-
-
- com.google.appengine.eclipse.core.enhancerbuilder
-
-
-
-
- com.google.appengine.eclipse.core.projectValidator
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- com.google.appengine.eclipse.core.gaeNature
- com.google.gwt.eclipse.core.gwtNature
-
-
diff --git a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs b/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs
deleted file mode 100644
index c01d1640..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.appengine.eclipse.core.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Sep 15 14:28:40 EDT 2010
-eclipse.preferences.version=1
-filesCopiedToWebInfLib=appengine-api-labs-1.3.7.jar|jsr107cache-1.1.jar|datanucleus-jpa-1.1.5.jar|geronimo-jta_1.1_spec-1.1.1.jar|datanucleus-appengine-1.0.7.final.jar|datanucleus-core-1.1.5.jar|jdo2-api-2.3-eb.jar|geronimo-jpa_3.0_spec-1.1.1.jar|appengine-jsr107cache-1.3.7.jar|appengine-api-1.0-sdk-1.3.7.jar
diff --git a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs b/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs
deleted file mode 100644
index ce0019d4..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gdt.eclipse.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Wed Sep 15 14:28:40 EDT 2010
-eclipse.preferences.version=1
-warSrcDir=war
-warSrcDirIsOutput=true
diff --git a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs b/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs
deleted file mode 100644
index 91cea40d..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.settings/com.google.gwt.eclipse.core.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Oct 06 11:37:44 EDT 2010
-eclipse.preferences.version=1
-gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48L2d3dC1jb21waWxlLXNldHRpbmdzPg\=\=
diff --git a/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.core.prefs b/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 381a13a7..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,364 +0,0 @@
-#Tue Oct 05 10:47:43 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569
-org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569
-org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569
-org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24
-org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16|4|80
-org.eclipse.jdt.core.formatter.alignment_for_assignment=16
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
-org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
-org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16|4|48
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=true
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=false
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=100
-org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=100
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false
-org.eclipse.jdt.core.formatter.sort_member_annotations=false
-org.eclipse.jdt.core.formatter.sort_package_annotations=false
-org.eclipse.jdt.core.formatter.sort_parameter_annotations=false
-org.eclipse.jdt.core.formatter.sort_type_annotations=false
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
-org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
-org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
-org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
-org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
-org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
-org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
diff --git a/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.ui.prefs b/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 535b9cd0..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,66 +0,0 @@
-#Tue Oct 05 10:47:40 EDT 2010
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_serial_version_id=true
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=true
-cleanup.use_this_for_non_static_field_access=true
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=true
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_google-api-java-client
-cleanup_settings_version=2
-eclipse.preferences.version=1
-formatter_profile=_google-api-java-client 100
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=exception
-org.eclipse.jdt.ui.gettersetter.use.is=false
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=com;org;;java;javax;
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=999
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=999
-org.eclipse.jdt.ui.text.custom_code_templates=/*\n * Copyright (c) 2010 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\n * in compliance with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the License\n * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n * or implied. See the License for the specific language governing permissions and limitations under\n * the License.\n */\n/**\n * @author ${user}@google.com (Your Name Here)\n *\n * ${tags}\n *//**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * @author Yaniv Inbar\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-JSDoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
diff --git a/calendar-v2-atom-oauth-appengine-sample/google-api-client-1.2.0-alpha-SNAPSHOT-sources.jar b/calendar-v2-atom-oauth-appengine-sample/google-api-client-1.2.0-alpha-SNAPSHOT-sources.jar
deleted file mode 100644
index bee033c2..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/google-api-client-1.2.0-alpha-SNAPSHOT-sources.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/instructions.html b/calendar-v2-atom-oauth-appengine-sample/instructions.html
deleted file mode 100644
index 0a410970..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/instructions.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-Google Calendar Data API App Engine Sample
-
-
Instructions for the Google Calendar Data API App Engine Sample
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/calendar-v2-atom-oauth-appengine-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project calendar-v2-atom-oauth-appengine-sample
-
Run As > Web Application
-
-
-
-
-
-
diff --git a/calendar-v2-atom-oauth-appengine-sample/kxml2-2.3.0-sources.jar b/calendar-v2-atom-oauth-appengine-sample/kxml2-2.3.0-sources.jar
deleted file mode 100644
index 18784909..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/kxml2-2.3.0-sources.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/AccessGrantedServlet.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/AccessGrantedServlet.java
deleted file mode 100644
index be2c3c8c..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/AccessGrantedServlet.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.auth.oauth.OAuthCallbackUrl;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetAccessToken;
-import com.google.api.client.http.HttpResponseException;
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * HTTP servlet to process access granted from user.
- *
- * @author Yaniv Inbar
- */
-@SuppressWarnings("serial")
-public class AccessGrantedServlet extends HttpServlet {
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- try {
- OAuthCallbackUrl url = new OAuthCallbackUrl(Auth.getFullURL(request));
- UserCredentials temporaryCredentials = UserCredentials.forCurrentUser();
- if (!url.token.equals(temporaryCredentials.token)) {
- // OAuth token belongs to a different user from the logged-in user
- String fullUrl = Auth.getFullURL(request);
- UserService userService = UserServiceFactory.getUserService();
- response.sendRedirect(userService.createLogoutURL(fullUrl));
- return;
- }
- // gets an access OAuth token upgraded from a temporary token
- GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken();
- accessToken.signer = Auth.createSigner(temporaryCredentials);
- accessToken.consumerKey = Constants.ENTER_DOMAIN;
- accessToken.temporaryToken = temporaryCredentials.token;
- accessToken.verifier = url.verifier;
- Auth.executeGetToken(accessToken, temporaryCredentials);
- // redirect back to application, but clear token and verifier query parameters
- url.setRawPath("/");
- url.verifier = null;
- url.token = null;
- response.sendRedirect(url.build());
- } catch (HttpResponseException e) {
- Auth.newIOException(e);
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Auth.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Auth.java
deleted file mode 100644
index 20b7b905..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Auth.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.auth.RsaSha;
-import com.google.api.client.auth.oauth.AbstractOAuthGetToken;
-import com.google.api.client.auth.oauth.OAuthCredentialsResponse;
-import com.google.api.client.auth.oauth.OAuthHmacSigner;
-import com.google.api.client.auth.oauth.OAuthParameters;
-import com.google.api.client.auth.oauth.OAuthRsaSigner;
-import com.google.api.client.auth.oauth.OAuthSigner;
-import com.google.api.client.googleapis.GoogleHeaders;
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.http.HttpExecuteIntercepter;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.v2.appengine.server.Constants.ConstantsForHMAC;
-import com.google.api.client.sample.calendar.v2.appengine.server.Constants.ConstantsForRSA;
-import com.google.api.client.sample.calendar.v2.appengine.server.Constants.SignatureMethod;
-import com.google.api.client.sample.calendar.v2.appengine.shared.AuthenticationException;
-import com.google.api.client.xml.atom.AtomParser;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.security.PrivateKey;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Manages OAuth authentication.
- *
- * @author Yaniv Inbar
- */
-class Auth {
-
- private static PrivateKey privateKey;
-
- /** Sets up the HTTP transport. */
- static HttpTransport setUpTransport() throws IOException {
- HttpTransport result = GoogleTransport.create();
- GoogleHeaders headers = (GoogleHeaders) result.defaultHeaders;
- headers.setApplicationName("Google-CalendarAppEngineSample/1.0");
- headers.gdataVersion = "2";
- AtomParser parser = new AtomParser();
- parser.namespaceDictionary = Namespace.DICTIONARY;
- result.addParser(parser);
- OAuthParameters parameters = new OAuthParameters();
- parameters.consumerKey = Constants.ENTER_DOMAIN;
- UserCredentials userCredentials = UserCredentials.forCurrentUser();
- parameters.signer = createSigner(userCredentials);
- parameters.token = userCredentials.token;
- parameters.signRequestsUsingAuthorizationHeader(result);
- return result;
- }
-
- static OAuthSigner createSigner(UserCredentials cred) throws IOException {
- if (Constants.SIGNATURE_METHOD == SignatureMethod.RSA) {
- OAuthRsaSigner result = new OAuthRsaSigner();
- result.privateKey = getPrivateKey();
- return result;
- }
- OAuthHmacSigner result = new OAuthHmacSigner();
- result.clientSharedSecret = ConstantsForHMAC.ENTER_CLIENT_SHARED_SECRET;
- if (cred != null) {
- result.tokenSharedSecret = cred.tokenSecret;
- }
- return result;
- }
-
- private static PrivateKey getPrivateKey() throws IOException {
- if (privateKey == null) {
- try {
- privateKey =
- RsaSha.getPrivateKeyFromKeystore(
- new FileInputStream(ConstantsForRSA.ENTER_PATH_TO_KEY_STORE_FILE),
- ConstantsForRSA.ENTER_KEY_STORE_PASSWORD,
- ConstantsForRSA.ENTER_ALIAS_FOR_PRIVATE_KEY,
- ConstantsForRSA.ENTER_PRIVATE_KEY_PASSWORD);
- } catch (GeneralSecurityException e) {
- throw new IOException(e);
- }
- }
- return privateKey;
- }
-
- /**
- * Returns the full URL of the request including the query parameters.
- */
- static String getFullURL(HttpServletRequest request) {
- StringBuffer buf = request.getRequestURL();
- if (request.getQueryString() != null) {
- buf.append('?').append(request.getQueryString());
- }
- return buf.toString();
- }
-
- static UserCredentials executeGetToken(
- AbstractOAuthGetToken request, UserCredentials currentCredentials) throws IOException {
- OAuthCredentialsResponse response = request.execute();
- UserCredentials result = currentCredentials;
- if (result == null) {
- result = new UserCredentials();
- result.userId = UserCredentials.getCurrentUserId();
- }
- result.token = response.token;
- result.tokenSecret = response.tokenSecret;
- result.temporary = response.callbackConfirmed != null;
- return result.makePersistent();
- }
-
- static HttpResponse execute(HttpRequest request) throws IOException {
- try {
- return request.execute();
- } catch (HttpResponseException e) {
- switch (e.response.statusCode) {
- case 302:
- // redirect
- CalendarUrl locationUrl = new CalendarUrl(e.response.headers.location);
- UserCredentials credentials = UserCredentials.forCurrentUser();
- credentials.gsessionid = locationUrl.gsessionid;
- credentials.makePersistent();
- request.url = locationUrl;
- new SessionIntercepter(request.transport, locationUrl.gsessionid);
- e.response.ignore(); // force the connection to close
- return request.execute();
- case 401:
- // check for an authentication error (e.g. if user revoked token)
- if (e.response.headers.authenticate != null) {
- UserCredentials.deleteCurrentUserFromStore();
- throw new AuthenticationException();
- }
- }
- throw e;
- }
- }
-
- /**
- * See How do I handle
- * redirects...?.
- */
- static class SessionIntercepter implements HttpExecuteIntercepter {
-
- private String gsessionid;
-
- SessionIntercepter(HttpTransport transport, String gsessionid) {
- this.gsessionid = gsessionid;
- transport.removeIntercepters(SessionIntercepter.class);
- transport.intercepters.add(0, this); // must be first
- }
-
- public void intercept(HttpRequest request) {
- request.url.set("gsessionid", gsessionid);
- }
- }
-
- static IOException newIOException(HttpResponseException e) throws IOException {
- return new IOException(e.response.parseAsString());
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarAppEngineSample.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarAppEngineSample.java
deleted file mode 100644
index 1985ac9d..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarAppEngineSample.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthAuthorizeTemporaryTokenUrl;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetTemporaryToken;
-import com.google.api.client.http.GenericUrl;
-import com.google.api.client.http.HttpResponseException;
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Google Calendar Data API App Engine sample.
- *
- * @author Yaniv Inbar
- */
-@SuppressWarnings("serial")
-public class CalendarAppEngineSample extends HttpServlet {
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws IOException {
- try {
- String fullUrl = Auth.getFullURL(request);
- // check if we have user credentials
- UserCredentials userCredentials = UserCredentials.forCurrentUser();
- if (userCredentials == null) {
- // get the temporary OAuth token
- GoogleOAuthGetTemporaryToken requestToken = new GoogleOAuthGetTemporaryToken();
- requestToken.displayName = Constants.APP_NAME;
- requestToken.signer = Auth.createSigner(null);
- requestToken.consumerKey = Constants.ENTER_DOMAIN;
- requestToken.scope = CalendarUrl.ROOT_URL;
- GenericUrl url = new GenericUrl(fullUrl);
- url.setRawPath("/access_granted");
- requestToken.callback = url.build();
- userCredentials = Auth.executeGetToken(requestToken, null);
- }
- // have a temporary token?
- if (userCredentials.temporary) {
- // redirect to grant access UI
- GoogleOAuthAuthorizeTemporaryTokenUrl url = new GoogleOAuthAuthorizeTemporaryTokenUrl();
- url.temporaryToken = userCredentials.token;
- response.sendRedirect(url.build());
- return;
- }
- writeHtmlContent(request, response, fullUrl);
- } catch (HttpResponseException e) {
- throw Auth.newIOException(e);
- }
- }
-
- /**
- * Write GWT HTML hosted content.
- */
- private static void writeHtmlContent(
- HttpServletRequest request, HttpServletResponse response, String fullUrl) throws IOException {
- response.setContentType("text/html");
- response.setCharacterEncoding("UTF-8");
- PrintWriter writer = response.getWriter();
- writer.println("");
- writer.println("");
- writer.println("" + Constants.APP_NAME + "");
- writer.println("");
- writer.println("");
- writer.println("");
- UserService userService = UserServiceFactory.getUserService();
- writer.println("
");
- writer.println("");
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarEntry.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarEntry.java
deleted file mode 100644
index 4f9d4660..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarEntry.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * Calendar entry.
- *
- * @author Yaniv Inbar
- */
-public class CalendarEntry extends Entry {
-
- public CalendarEntry() {
- }
-
- CalendarEntry(GwtCalendar calendar) {
- Preconditions.checkNotNull(calendar);
- links = new ArrayList();
- links.add(Link.editLink(calendar.editLink));
- title = calendar.title;
- updated = calendar.updated;
- }
-
- GwtCalendar toCalendar() {
- GwtCalendar result = new GwtCalendar();
- result.editLink = getEditLink();
- result.title = title;
- result.updated = updated;
- return result;
- }
-
- String getEventFeedLink() {
- return Link.find(links, "http://schemas.google.com/gCal/2005#eventFeed");
- }
-
- @Override
- protected CalendarEntry clone() {
- return (CalendarEntry) super.clone();
- }
-
- @Override
- CalendarEntry executeInsert(HttpTransport transport, CalendarUrl url) throws IOException {
- return (CalendarEntry) super.executeInsert(transport, url);
- }
-
- CalendarEntry executePatchRelativeToOriginal(HttpTransport transport, CalendarEntry original)
- throws IOException {
- return (CalendarEntry) super.executePatchRelativeToOriginal(transport, original);
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarFeed.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarFeed.java
deleted file mode 100644
index c21632f6..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarFeed.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Calendar feed.
- *
- * @author Yaniv Inbar
- */
-public class CalendarFeed extends Feed {
-
- @Key("entry")
- List calendars = new ArrayList();
-
- void appendCalendars(List result) {
- for (CalendarEntry entry : calendars) {
- result.add(entry.toCalendar());
- }
- }
-
- static CalendarFeed executeGet(HttpTransport transport, CalendarUrl url) throws IOException {
- return (CalendarFeed) Feed.executeGet(transport, url, CalendarFeed.class);
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarGwtRpcSample.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarGwtRpcSample.java
deleted file mode 100644
index 2de480a9..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarGwtRpcSample.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.v2.appengine.client.CalendarService;
-import com.google.api.client.sample.calendar.v2.appengine.shared.GwtCalendar;
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Calendar GWT RPC service implementation.
- *
- * @author Yaniv Inbar
- */
-@SuppressWarnings("serial")
-public class CalendarGwtRpcSample extends RemoteServiceServlet implements CalendarService {
-
- @Override
- public List getCalendars() throws IOException {
- try {
- HttpTransport transport = Auth.setUpTransport();
- CalendarUrl url = CalendarUrl.forOwnCalendarsFeed();
- ArrayList result = new ArrayList();
- // iterate through all pages via next links
- CalendarFeed feed = CalendarFeed.executeGet(transport, url);
- feed.appendCalendars(result);
- while (feed.getNextLink() != null) {
- feed = CalendarFeed.executeGet(transport, new CalendarUrl(feed.getNextLink()));
- feed.appendCalendars(result);
- }
- return result;
- } catch (HttpResponseException e) {
- throw Auth.newIOException(e);
- }
- }
-
- @Override
- public void delete(GwtCalendar calendar) throws IOException {
- try {
- HttpTransport transport = Auth.setUpTransport();
- CalendarEntry entry = new CalendarEntry(calendar);
- entry.executeDelete(transport);
- } catch (HttpResponseException e) {
- throw Auth.newIOException(e);
- }
- }
-
- @Override
- public GwtCalendar insert(GwtCalendar calendar) throws IOException {
- try {
- HttpTransport transport = Auth.setUpTransport();
- CalendarEntry entry = new CalendarEntry(calendar);
- CalendarUrl url = CalendarUrl.forOwnCalendarsFeed();
- CalendarEntry responseEntry = entry.executeInsert(transport, url);
- return responseEntry.toCalendar();
- } catch (HttpResponseException e) {
- throw Auth.newIOException(e);
- }
- }
-
- @Override
- public GwtCalendar update(GwtCalendar original, GwtCalendar updated) throws IOException {
- try {
- HttpTransport transport = Auth.setUpTransport();
- CalendarEntry originalEntry = new CalendarEntry(original);
- CalendarEntry updatedEntry = new CalendarEntry(updated);
- CalendarEntry responseEntry =
- updatedEntry.executePatchRelativeToOriginal(transport, originalEntry);
- return responseEntry.toCalendar();
- } catch (HttpResponseException e) {
- throw Auth.newIOException(e);
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarUrl.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarUrl.java
deleted file mode 100644
index 24e5c296..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/CalendarUrl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.util.Key;
-
-/**
- * Calendar URL.
- *
- * @author Yaniv Inbar
- */
-public class CalendarUrl extends GoogleUrl {
-
- static final String ROOT_URL = "https://www.google.com/calendar/feeds";
-
- @Key
- String gsessionid;
-
- CalendarUrl(String url) {
- super(url);
- // set to true only if you want pretty-printed JSON result for debugging
- prettyprint = true;
- }
-
- static CalendarUrl forOwnCalendarsFeed() {
- CalendarUrl result = new CalendarUrl(ROOT_URL);
- result.pathParts.add("default");
- result.pathParts.add("owncalendars");
- result.pathParts.add("full");
- return result;
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Constants.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Constants.java
deleted file mode 100644
index 934f24f1..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Constants.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-/**
- * Constants.
- *
- * @author Yaniv Inbar
- */
-class Constants {
-
- /**
- * OAuth signature method.
- *
- * A real deployed application normally uses only one of them. However, anonymous HMAC is the only
- * option when debugging on a local server.
- *
- */
- enum SignatureMethod {
-
- /** Sign requests using {@code "RSA-SHA1"}. */
- RSA,
-
- /** Sign requests using {@code "HMAC-SHA1"}. */
- HMAC,
- }
-
- static final SignatureMethod SIGNATURE_METHOD = SignatureMethod.HMAC;
-
- static final String ENTER_DOMAIN = "anonymous";
-
- static class ConstantsForHMAC {
- static final String ENTER_CLIENT_SHARED_SECRET = "anonymous";
- }
-
- static class ConstantsForRSA {
- static final String ENTER_PATH_TO_KEY_STORE_FILE = "WEB-INF/calendar.jks";
- static final String ENTER_KEY_STORE_PASSWORD = "calendar2store";
- static final String ENTER_ALIAS_FOR_PRIVATE_KEY = "calendar";
- static final String ENTER_PRIVATE_KEY_PASSWORD = "calendar2key";
- }
-
- static final String APP_NAME = "Google Calendar Data API Sample Web Client";
-
- static final String GWT_MODULE_NAME = "calendar";
-
- private Constants() {
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Entry.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Entry.java
deleted file mode 100644
index 6be4b259..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Entry.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.googleapis.xml.atom.AtomPatchRelativeToOriginalContent;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.DataUtil;
-import com.google.api.client.util.Key;
-import com.google.api.client.xml.atom.AtomContent;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Generic Atom Entry.
- *
- * @author Yaniv Inbar
- */
-public class Entry implements Cloneable {
-
- @Key
- String summary;
-
- @Key
- String title;
-
- @Key
- String updated;
-
- @Key("link")
- List links;
-
-
- @Override
- protected Entry clone() {
- return DataUtil.clone(this);
- }
-
- void executeDelete(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildDeleteRequest();
- request.setUrl(getEditLink());
- Auth.execute(request).ignore();
- }
-
- Entry executeInsert(HttpTransport transport, CalendarUrl url) throws IOException {
- HttpRequest request = transport.buildPostRequest();
- request.url = url;
- AtomContent content = new AtomContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.entry = this;
- request.content = content;
- return Auth.execute(request).parseAs(getClass());
- }
-
- Entry executePatchRelativeToOriginal(HttpTransport transport, Entry original) throws IOException {
- HttpRequest request = transport.buildPatchRequest();
- request.setUrl(getEditLink());
- AtomPatchRelativeToOriginalContent content = new AtomPatchRelativeToOriginalContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.originalEntry = original;
- content.patchedEntry = this;
- request.content = content;
- return Auth.execute(request).parseAs(getClass());
- }
-
- String getEditLink() {
- return Link.find(links, "edit");
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Feed.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Feed.java
deleted file mode 100644
index 87e4480d..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Feed.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.googleapis.xml.atom.GData;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Generic Atom Feed.
- *
- * @author Yaniv Inbar
- */
-public class Feed {
-
- @Key("link")
- List links;
-
- String getNextLink() {
- return Link.find(links, "next");
- }
-
- String getBatchLink() {
- return Link.find(links, "http://schemas.google.com/g/2005#batch");
- }
-
- static Feed executeGet(HttpTransport transport, CalendarUrl url, Class extends Feed> feedClass)
- throws IOException {
- url.fields = GData.getFieldsFor(feedClass);
- HttpRequest request = transport.buildGetRequest();
- request.url = url;
- return Auth.execute(request).parseAs(feedClass);
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Link.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Link.java
deleted file mode 100644
index 89f0a76d..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Link.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * Generic Atom link.
- *
- * @author Yaniv Inbar
- */
-public class Link {
-
- @Key("@href")
- String href;
-
- @Key("@rel")
- String rel;
-
- static Link editLink(String href) {
- Link link = new Link();
- link.rel = "edit";
- link.href = href;
- return link;
- }
-
- static String find(List links, String rel) {
- if (links != null) {
- for (Link link : links) {
- if (rel.equals(link.rel)) {
- return link.href;
- }
- }
- }
- return null;
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Namespace.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Namespace.java
deleted file mode 100644
index 8db82adb..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/Namespace.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.api.client.xml.XmlNamespaceDictionary;
-
-import java.util.Map;
-
-/**
- * Namespaces used by the Google Calendar Data API, mapped from XML namespace alias to XML namespace
- * URI.
- *
- * @author Yaniv Inbar
- */
-class Namespace {
-
- static final XmlNamespaceDictionary DICTIONARY = new XmlNamespaceDictionary();
- static {
- Map map = DICTIONARY.namespaceAliasToUriMap;
- map.put("", "http://www.w3.org/2005/Atom");
- map.put("atom", "http://www.w3.org/2005/Atom");
- map.put("batch", "http://schemas.google.com/gdata/batch");
- map.put("gAcl", "http://schemas.google.com/acl/2007");
- map.put("gCal", "http://schemas.google.com/gCal/2005");
- map.put("gd", "http://schemas.google.com/g/2005");
- map.put("georss", "http://www.georss.org/georss");
- map.put("gml", "http://www.opengis.net/gml");
- map.put("openSearch", "http://a9.com/-/spec/opensearch/1.1/");
- map.put("xml", "http://www.w3.org/XML/1998/namespace");
- }
-
- private Namespace() {
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/PersistenceUtil.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/PersistenceUtil.java
deleted file mode 100644
index 1956feac..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/PersistenceUtil.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import javax.jdo.JDOHelper;
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-
-/**
- * Utility class for JDO persistence.
- *
- * @author Yaniv Inbar
- */
-class PersistenceUtil {
-
- /** Persistence manager factory instance. */
- private static final PersistenceManagerFactory FACTORY =
- JDOHelper.getPersistenceManagerFactory("transactions-optional");
-
- static PersistenceManager getPersistenceManager() {
- return FACTORY.getPersistenceManager();
- }
-
- static T makePersistent(T object) {
- PersistenceManager manager = getPersistenceManager();
- try {
- return manager.makePersistent(object);
- } finally {
- manager.close();
- }
- }
-
- private PersistenceUtil() {
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/UserCredentials.java b/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/UserCredentials.java
deleted file mode 100644
index 35b990eb..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/src/com/google/api/client/sample/calendar/v2/appengine/server/UserCredentials.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.appengine.server;
-
-import com.google.appengine.api.users.UserServiceFactory;
-
-import java.util.List;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.PersistenceCapable;
-import javax.jdo.annotations.Persistent;
-import javax.jdo.annotations.PrimaryKey;
-
-/**
- * OAuth per-user credentials store.
- *
- * @author Yaniv Inbar
- */
-@PersistenceCapable
-public final class UserCredentials {
- @PrimaryKey
- @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
- String userId;
-
- @Persistent
- String gsessionid;
-
- @Persistent
- boolean temporary;
-
- @Persistent
- String token;
-
- @Persistent
- String tokenSecret;
-
- UserCredentials makePersistent() {
- return PersistenceUtil.makePersistent(this);
- }
-
- static String getCurrentUserId() {
- return UserServiceFactory.getUserService().getCurrentUser().getUserId();
- }
-
- static UserCredentials forCurrentUser() {
- PersistenceManager manager = PersistenceUtil.getPersistenceManager();
- try {
- return forCurrentUser(manager);
- } finally {
- manager.close();
- }
- }
-
- static void deleteCurrentUserFromStore() {
- PersistenceManager manager = PersistenceUtil.getPersistenceManager();
- try {
- UserCredentials cred = forCurrentUser(manager);
- if (cred != null) {
- manager.deletePersistent(cred);
- }
- } finally {
- manager.close();
- }
- }
-
- private static UserCredentials forCurrentUser(PersistenceManager manager) {
- @SuppressWarnings("unchecked")
- List creds = (List) manager.newQuery(
- UserCredentials.class, "userId == '" + getCurrentUserId() + "'").execute();
- return creds.isEmpty() ? null : creds.get(0);
- }
-}
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/appengine-web.xml b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/appengine-web.xml
deleted file mode 100644
index 77cca25a..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/appengine-web.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
- calendar-v2-atom-sample
- 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-1.0-sdk-1.3.7.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-1.0-sdk-1.3.7.jar
deleted file mode 100644
index ac8f0b59..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-1.0-sdk-1.3.7.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-labs-1.3.7.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-labs-1.3.7.jar
deleted file mode 100644
index fe72b05d..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-api-labs-1.3.7.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-jsr107cache-1.3.7.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-jsr107cache-1.3.7.jar
deleted file mode 100644
index 688256a9..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/appengine-jsr107cache-1.3.7.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-appengine-1.0.7.final.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-appengine-1.0.7.final.jar
deleted file mode 100644
index 738246ac..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-appengine-1.0.7.final.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-core-1.1.5.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-core-1.1.5.jar
deleted file mode 100644
index c450ab94..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-core-1.1.5.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-jpa-1.1.5.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-jpa-1.1.5.jar
deleted file mode 100644
index c326e0bc..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/datanucleus-jpa-1.1.5.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/google-api-client-1.2.0-alpha-SNAPSHOT.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/google-api-client-1.2.0-alpha-SNAPSHOT.jar
deleted file mode 100644
index f514fa07..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/google-api-client-1.2.0-alpha-SNAPSHOT.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/gwt-servlet.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/gwt-servlet.jar
deleted file mode 100644
index 7403d781..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/gwt-servlet.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/jdo2-api-2.3-eb.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/jdo2-api-2.3-eb.jar
deleted file mode 100644
index 2547a0b0..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/jdo2-api-2.3-eb.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/kxml2-2.3.0.jar b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/kxml2-2.3.0.jar
deleted file mode 100644
index 64709522..00000000
Binary files a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/lib/kxml2-2.3.0.jar and /dev/null differ
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/logging.properties b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/logging.properties
deleted file mode 100644
index f958d32f..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/logging.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# A default java.util.logging configuration.
-# (All App Engine logging is through java.util.logging by default).
-#
-# To use this configuration, copy it into your application's WEB-INF
-# folder and add the following to your appengine-web.xml:
-#
-#
-#
-#
-#
-
-# Set the default logging level for all loggers to WARNING
-.level = WARNING
-# TODO: CONFIG
-com.google.api.client.level = ALL
\ No newline at end of file
diff --git a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/web.xml b/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/web.xml
deleted file mode 100644
index f748bd1b..00000000
--- a/calendar-v2-atom-oauth-appengine-sample/war/WEB-INF/web.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
- calendarServiceServlet
- com.google.api.client.sample.calendar.v2.appengine.server.CalendarGwtRpcSample
-
-
-
- sample
- com.google.api.client.sample.calendar.v2.appengine.server.CalendarAppEngineSample
-
-
-
- access_granted
- com.google.api.client.sample.calendar.v2.appengine.server.AccessGrantedServlet
-
-
-
- calendarServiceServlet
- /calendar/calendarService
-
-
-
- sample
- /
-
-
-
- access_granted
- /access_granted
-
-
-
-
- any
- /*
-
-
- *
-
-
-
-
diff --git a/calendar-v2-atom-oauth-sample/.classpath b/calendar-v2-atom-oauth-sample/.classpath
deleted file mode 100644
index de5a9e91..00000000
--- a/calendar-v2-atom-oauth-sample/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/calendar-v2-atom-oauth-sample/.project b/calendar-v2-atom-oauth-sample/.project
deleted file mode 100644
index eebbbe7b..00000000
--- a/calendar-v2-atom-oauth-sample/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- calendar-v2-atom-oauth-sample
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.maven.ide.eclipse.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.maven.ide.eclipse.maven2Nature
-
-
diff --git a/calendar-v2-atom-oauth-sample/.settings/org.eclipse.jdt.core.prefs b/calendar-v2-atom-oauth-sample/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index bde57268..00000000
--- a/calendar-v2-atom-oauth-sample/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Mon Jul 19 13:11:44 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/calendar-v2-atom-oauth-sample/instructions.html b/calendar-v2-atom-oauth-sample/instructions.html
deleted file mode 100644
index c3f5ad5d..00000000
--- a/calendar-v2-atom-oauth-sample/instructions.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-Google Calendar Data API Atom OAuth Sample
-
-
Instructions for the Google Calendar Data API Atom OAuth Sample
Window > Preferences... (or on Mac, Eclipse > Preferences...)
-
Select Maven
-
-
check on "Download Artifact Sources"
-
check on "Download Artifact JavaDoc"
-
-
-
-
-
Import calendar-v2-atom-oauth-sample project
-
-
File > Import...
-
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/calendar-v2-atom-oauth-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project calendar-v2-atom-oauth-sample
-
Run As > Java Application
-
If asked, type "CalendarSample" and click OK
-
-
-
-
-
-
diff --git a/calendar-v2-atom-oauth-sample/pom.xml b/calendar-v2-atom-oauth-sample/pom.xml
deleted file mode 100644
index 30bd7156..00000000
--- a/calendar-v2-atom-oauth-sample/pom.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-
- 4.0.0
-
- com.google
- google
- 5
-
- com.google.api.client
- calendar-v2-atom-oauth-sample
- 1.0.1
- calendar-v2-atom-oauth-sample
-
- Example for the Google Calendar Data API version 2 using Atom and OAuth.
-
-
- http://code.google.com/p/google-api-java-client/
-
-
- code.google.com
- http://code.google.com/p/google-api-java-client/issues/list
-
-
- 2010
-
-
- 2.0.9
-
-
-
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
-
-
-
-
- yanivi
- Yaniv Inbar
- yanivi@google.com
- Google
- http://www.google.com
-
- owner
- developer
-
- -5
-
-
-
-
-
- maven-compiler-plugin
-
- 1.6
- 1.6
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.1
-
-
-
- java
-
-
-
-
- com.google.api.client.sample.calendar.v2.CalendarSample
-
-
-
- ${project.artifactId}-${project.version}
- src
- tests_disabled
-
-
-
- com.google.api.client
- google-api-client
- 1.2.0-alpha-SNAPSHOT
-
-
- org.mortbay.jetty
- jetty-embedded
- 6.1.24
-
-
-
- UTF-8
-
-
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/Auth.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/Auth.java
deleted file mode 100644
index 6fc5ec75..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/Auth.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2;
-
-import com.google.api.client.auth.oauth.OAuthCredentialsResponse;
-import com.google.api.client.auth.oauth.OAuthHmacSigner;
-import com.google.api.client.auth.oauth.OAuthParameters;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthAuthorizeTemporaryTokenUrl;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetAccessToken;
-import com.google.api.client.googleapis.auth.oauth.GoogleOAuthGetTemporaryToken;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.v2.model.CalendarUrl;
-
-import java.awt.Desktop;
-import java.awt.Desktop.Action;
-import java.net.URI;
-
-/**
- * Implements OAuth authentication.
- *
- * @author Yaniv Inbar
- */
-public class Auth {
-
- private static final String APP_NAME =
- "Google Calendar Data API Java Client Sample";
-
- private static OAuthHmacSigner signer;
-
- private static OAuthCredentialsResponse credentials;
-
- static void authorize(HttpTransport transport) throws Exception {
- // callback server
- LoginCallbackServer callbackServer = null;
- String verifier = null;
- String tempToken = null;
- try {
- callbackServer = new LoginCallbackServer();
- callbackServer.start();
- // temporary token
- GoogleOAuthGetTemporaryToken temporaryToken =
- new GoogleOAuthGetTemporaryToken();
- signer = new OAuthHmacSigner();
- signer.clientSharedSecret = ClientCredentials.ENTER_CLIENT_SHARED_SECRET;
- temporaryToken.signer = signer;
- temporaryToken.consumerKey = ClientCredentials.ENTER_DOMAIN;
- temporaryToken.scope = CalendarUrl.ROOT_URL;
- temporaryToken.displayName = APP_NAME;
- temporaryToken.callback = callbackServer.getCallbackUrl();
- OAuthCredentialsResponse tempCredentials = temporaryToken.execute();
- signer.tokenSharedSecret = tempCredentials.tokenSecret;
- // authorization URL
- GoogleOAuthAuthorizeTemporaryTokenUrl authorizeUrl =
- new GoogleOAuthAuthorizeTemporaryTokenUrl();
- authorizeUrl.temporaryToken = tempToken = tempCredentials.token;
- String authorizationUrl = authorizeUrl.build();
- // launch in browser
- boolean browsed = false;
- if (Desktop.isDesktopSupported()) {
- Desktop desktop = Desktop.getDesktop();
- if (desktop.isSupported(Action.BROWSE)) {
- desktop.browse(URI.create(authorizationUrl));
- browsed = true;
- }
- }
- if (!browsed) {
- String browser = "google-chrome";
- Runtime.getRuntime().exec(new String[] {browser, authorizationUrl});
- }
- verifier = callbackServer.waitForVerifier(tempToken);
- } finally {
- if (callbackServer != null) {
- callbackServer.stop();
- }
- }
- GoogleOAuthGetAccessToken accessToken = new GoogleOAuthGetAccessToken();
- accessToken.temporaryToken = tempToken;
- accessToken.signer = signer;
- accessToken.consumerKey = "anonymous";
- accessToken.verifier = verifier;
- credentials = accessToken.execute();
- signer.tokenSharedSecret = credentials.tokenSecret;
- createOAuthParameters().signRequestsUsingAuthorizationHeader(transport);
- }
-
- static void revoke() {
- if (credentials != null) {
- try {
- GoogleOAuthGetAccessToken.revokeAccessToken(createOAuthParameters());
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
- }
-
- private static OAuthParameters createOAuthParameters() {
- OAuthParameters authorizer = new OAuthParameters();
- authorizer.consumerKey = "anonymous";
- authorizer.signer = signer;
- authorizer.token = credentials.token;
- return authorizer;
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/CalendarSample.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/CalendarSample.java
deleted file mode 100644
index 1902e479..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/CalendarSample.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2;
-
-import com.google.api.client.googleapis.GoogleHeaders;
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.sample.calendar.v2.model.BatchOperation;
-import com.google.api.client.sample.calendar.v2.model.BatchStatus;
-import com.google.api.client.sample.calendar.v2.model.CalendarEntry;
-import com.google.api.client.sample.calendar.v2.model.CalendarFeed;
-import com.google.api.client.sample.calendar.v2.model.CalendarUrl;
-import com.google.api.client.sample.calendar.v2.model.Debug;
-import com.google.api.client.sample.calendar.v2.model.EventEntry;
-import com.google.api.client.sample.calendar.v2.model.EventFeed;
-import com.google.api.client.sample.calendar.v2.model.Namespace;
-import com.google.api.client.sample.calendar.v2.model.When;
-import com.google.api.client.util.DateTime;
-import com.google.api.client.xml.atom.AtomParser;
-
-import java.io.IOException;
-import java.util.Date;
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarSample {
-
- public static void main(String[] args) {
- Debug.enableLogging();
- try {
- try {
- HttpTransport transport = setUpTransport();
- Auth.authorize(transport);
- showCalendars(transport);
- CalendarEntry calendar = addCalendar(transport);
- calendar = updateCalendar(transport, calendar);
- addEvent(transport, calendar);
- batchAddEvents(transport, calendar);
- showEvents(transport, calendar);
- deleteCalendar(transport, calendar);
- Auth.revoke();
- } catch (HttpResponseException e) {
- System.err.println(e.response.parseAsString());
- throw e;
- }
- } catch (Throwable t) {
- t.printStackTrace();
- Auth.revoke();
- System.exit(1);
- }
- }
-
- private static HttpTransport setUpTransport() {
- HttpTransport transport = GoogleTransport.create();
- GoogleHeaders headers = (GoogleHeaders) transport.defaultHeaders;
- headers.setApplicationName("google-calendarsample-1.0");
- headers.gdataVersion = "2";
- AtomParser parser = new AtomParser();
- parser.namespaceDictionary = Namespace.DICTIONARY;
- transport.addParser(parser);
- return transport;
- }
-
- private static void showCalendars(HttpTransport transport)
- throws IOException {
- View.header("Show Calendars");
- CalendarUrl url = CalendarUrl.forAllCalendarsFeed();
- CalendarFeed feed = CalendarFeed.executeGet(transport, url);
- View.display(feed);
- }
-
- private static CalendarEntry addCalendar(HttpTransport transport)
- throws IOException {
- View.header("Add Calendar");
- CalendarUrl url = CalendarUrl.forOwnCalendarsFeed();
- CalendarEntry entry = new CalendarEntry();
- entry.title = "Calendar for Testing";
- CalendarEntry result = entry.executeInsert(transport, url);
- View.display(result);
- return result;
- }
-
- public static CalendarEntry updateCalendar(
- HttpTransport transport, CalendarEntry calendar) throws IOException {
- View.header("Update Calendar");
- CalendarEntry original = calendar.clone();
- calendar.title = "Updated Calendar for Testing";
- CalendarEntry result =
- calendar.executePatchRelativeToOriginal(transport, original);
- View.display(result);
- return result;
- }
-
- private static void addEvent(HttpTransport transport, CalendarEntry calendar)
- throws IOException {
- View.header("Add Event");
- CalendarUrl url = new CalendarUrl(calendar.getEventFeedLink());
- EventEntry event = newEvent();
- EventEntry result = event.executeInsert(transport, url);
- View.display(result);
- }
-
- private static EventEntry newEvent() {
- EventEntry event = new EventEntry();
- event.title = "New Event";
- When when = new When();
- when.startTime = new DateTime(new Date());
- event.when = when;
- return event;
- }
-
- private static void batchAddEvents(
- HttpTransport transport, CalendarEntry calendar) throws IOException {
- View.header("Batch Add Events");
- EventFeed feed = new EventFeed();
- for (int i = 0; i < 3; i++) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- EventEntry event = newEvent();
- event.batchId = Integer.toString(i);
- event.batchOperation = BatchOperation.INSERT;
- feed.events.add(event);
- }
- EventFeed result = feed.executeBatch(transport, calendar);
- for (EventEntry event : result.events) {
- BatchStatus batchStatus = event.batchStatus;
- if (batchStatus != null
- && !HttpResponse.isSuccessStatusCode(batchStatus.code)) {
- System.err.println("Error posting event: " + batchStatus.reason);
- }
- }
- View.display(result);
- }
-
- private static void showEvents(
- HttpTransport transport, CalendarEntry calendar) throws IOException {
- View.header("Show Events");
- CalendarUrl url = new CalendarUrl(calendar.getEventFeedLink());
- EventFeed feed = EventFeed.executeGet(transport, url);
- View.display(feed);
- }
-
- public static void deleteCalendar(
- HttpTransport transport, CalendarEntry calendar) throws IOException {
- View.header("Delete Calendar");
- calendar.executeDelete(transport);
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/ClientCredentials.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/ClientCredentials.java
deleted file mode 100644
index c3a6d2e6..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/ClientCredentials.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2;
-
-/**
- * @author Yaniv Inbar
- */
-public class ClientCredentials {
- static final String ENTER_DOMAIN = "anonymous";
- static final String ENTER_CLIENT_SHARED_SECRET = "anonymous";
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/LoginCallbackServer.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/LoginCallbackServer.java
deleted file mode 100644
index a2541f54..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/LoginCallbackServer.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2;
-
-import com.google.api.client.repackaged.com.google.common.base.Preconditions;
-
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Class that runs a Jetty server on a free port, waiting for OAuth to redirect
- * to it with the one-time authorization token.
- *
- * Mostly copied from oacurl by phopkins@google.com.
- *
- * @author Yaniv Inbar
- */
-public class LoginCallbackServer {
- private static final String CALLBACK_PATH = "/OAuthCallback";
-
- private int port;
- private Server server;
-
- private Map verifierMap = new HashMap();
-
- public void start() {
- if (server != null) {
- throw new IllegalStateException("Server is already started");
- }
-
- try {
- port = getUnusedPort();
- server = new Server(port);
-
- for (Connector c : server.getConnectors()) {
- c.setHost("localhost");
- }
-
- server.addHandler(new CallbackHandler());
-
- server.start();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void stop() throws Exception {
- if (server != null) {
- server.stop();
- server = null;
- }
- }
-
- public String getCallbackUrl() {
- Preconditions.checkArgument(port != 0, "Server is not yet started");
- return "http://localhost:" + port + CALLBACK_PATH;
- }
-
- private static int getUnusedPort() throws IOException {
- Socket s = new Socket();
- s.bind(null);
-
- try {
- return s.getLocalPort();
- } finally {
- s.close();
- }
- }
-
- /**
- * Call that blocks until the OAuth provider redirects back here with the
- * verifier token.
- *
- * @param requestToken request token
- * @return The verifier token, or null if there was a timeout.
- */
- public String waitForVerifier(String requestToken) {
- synchronized (verifierMap) {
- while (!verifierMap.containsKey(requestToken)) {
- try {
- verifierMap.wait(3000);
- } catch (InterruptedException e) {
- return null;
- }
- }
-
- return verifierMap.remove(requestToken);
- }
- }
-
- /**
- * Jetty handler that takes the verifier token passed over from the OAuth
- * provider and stashes it where {@link LoginCallbackServer#waitForVerifier}
- * will find it.
- */
- public class CallbackHandler extends AbstractHandler {
- public void handle(String target, HttpServletRequest request,
- HttpServletResponse response, int dispatch) throws IOException {
- if (!CALLBACK_PATH.equals(target)) {
- return;
- }
-
- writeLandingHtml(response);
- response.flushBuffer();
- ((Request) request).setHandled(true);
-
- String requestToken = request.getParameter("oauth_token");
- String verifier = request.getParameter("oauth_verifier");
-
- synchronized (verifierMap) {
- verifierMap.put(requestToken, verifier);
- verifierMap.notifyAll();
- }
- }
-
- private void writeLandingHtml(HttpServletResponse response)
- throws IOException {
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType("text/html");
-
- PrintWriter doc = response.getWriter();
- doc.println("");
- doc.println(
- "OAuth Authentication Token Recieved");
- doc.println("");
- doc.println("Received verifier token. Closing...");
- doc.println("");
- doc.println("");
- doc.println("");
- doc.flush();
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/View.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/View.java
deleted file mode 100644
index 0e27198f..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/View.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2;
-
-import com.google.api.client.sample.calendar.v2.model.Entry;
-import com.google.api.client.sample.calendar.v2.model.EventEntry;
-import com.google.api.client.sample.calendar.v2.model.Feed;
-
-/**
- * @author Yaniv Inbar
- */
-public class View {
-
- static void header(String name) {
- System.out.println();
- System.out.println("============== " + name + " ==============");
- System.out.println();
- }
-
- static void display(Feed feed) {
- for (Entry entry : feed.getEntries()) {
- System.out.println();
- System.out.println("-----------------------------------------------");
- display(entry);
- }
- }
-
- static void display(Entry entry) {
- System.out.println("Title: " + entry.title);
- System.out.println("Updated: " + entry.updated);
- if (entry.summary != null) {
- System.out.println("Summary: " + entry.summary);
- }
- if (entry instanceof EventEntry) {
- EventEntry event = (EventEntry) entry;
- if (event.when != null) {
- if (event.when.startTime != null) {
- System.out.println("Start Time: " + event.when.startTime);
- }
- if (event.when.endTime != null) {
- System.out.println("End Time: " + event.when.startTime);
- }
- }
- }
- }
-
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchOperation.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchOperation.java
deleted file mode 100644
index 496e000a..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchOperation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class BatchOperation {
-
- public static final BatchOperation INSERT = BatchOperation.of("insert");
- public static final BatchOperation QUERY = BatchOperation.of("query");
- public static final BatchOperation UPDATE = BatchOperation.of("update");
- public static final BatchOperation DELETE = BatchOperation.of("delete");
-
- @Key("@type")
- public String type;
-
- public BatchOperation() {
- }
-
- public static BatchOperation of(String type) {
- BatchOperation result = new BatchOperation();
- result.type = type;
- return result;
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchStatus.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchStatus.java
deleted file mode 100644
index f6a31bfe..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/BatchStatus.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class BatchStatus {
-
- @Key("@code")
- public int code;
-
- @Key("text()")
- public String content;
-
- @Key("@content-type")
- public String contentType;
-
- @Key("@reason")
- public String reason;
-
- public BatchStatus() {
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarEntry.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarEntry.java
deleted file mode 100644
index 43cf8f4c..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarEntry.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.http.HttpTransport;
-
-import java.io.IOException;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarEntry extends Entry {
-
- public String getEventFeedLink() {
- return Link.find(links, "http://schemas.google.com/gCal/2005#eventFeed");
- }
-
- @Override
- public CalendarEntry clone() {
- return (CalendarEntry) super.clone();
- }
-
- @Override
- public CalendarEntry executeInsert(HttpTransport transport, CalendarUrl url)
- throws IOException {
- return (CalendarEntry) super.executeInsert(transport, url);
- }
-
- public CalendarEntry executePatchRelativeToOriginal(
- HttpTransport transport, CalendarEntry original) throws IOException {
- return (CalendarEntry) super.executePatchRelativeToOriginal(
- transport, original);
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarFeed.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarFeed.java
deleted file mode 100644
index 054d13da..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarFeed.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarFeed extends Feed {
-
- @Key("entry")
- public List calendars = new ArrayList();
-
- public static CalendarFeed executeGet(
- HttpTransport transport, CalendarUrl url) throws IOException {
- return (CalendarFeed) Feed.executeGet(transport, url, CalendarFeed.class);
- }
-
- @Override
- public List getEntries() {
- return calendars;
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarUrl.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarUrl.java
deleted file mode 100644
index b44625c9..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/CalendarUrl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class CalendarUrl extends GoogleUrl {
-
- public static final String ROOT_URL = "https://www.google.com/calendar/feeds";
-
- @Key("max-results")
- public Integer maxResults;
-
- public CalendarUrl(String url) {
- super(url);
- if (Debug.ENABLED) {
- this.prettyprint = true;
- }
- }
-
- private static CalendarUrl forRoot() {
- return new CalendarUrl(ROOT_URL);
- }
-
- public static CalendarUrl forCalendarMetafeed() {
- CalendarUrl result = forRoot();
- result.pathParts.add("default");
- return result;
- }
-
- public static CalendarUrl forAllCalendarsFeed() {
- CalendarUrl result = forCalendarMetafeed();
- result.pathParts.add("allcalendars");
- result.pathParts.add("full");
- return result;
- }
-
- public static CalendarUrl forOwnCalendarsFeed() {
- CalendarUrl result = forCalendarMetafeed();
- result.pathParts.add("owncalendars");
- result.pathParts.add("full");
- return result;
- }
-
- public static CalendarUrl forEventFeed(
- String userId, String visibility, String projection) {
- CalendarUrl result = forRoot();
- result.pathParts.add(userId);
- result.pathParts.add(visibility);
- result.pathParts.add(projection);
- return result;
- }
-
- public static CalendarUrl forDefaultPrivateFullEventFeed() {
- return forEventFeed("default", "private", "full");
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Debug.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Debug.java
deleted file mode 100644
index 0dd28ca1..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Debug.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-/**
- * @author Yaniv Inbar
- */
-public class Debug {
- public static final boolean ENABLED = false;
-
- public static void enableLogging() {
- if (ENABLED) {
- Logger logger = Logger.getLogger("com.google.api.client");
- logger.setLevel(Level.CONFIG);
- logger.addHandler(new Handler() {
-
- @Override
- public void close() throws SecurityException {
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void publish(LogRecord record) {
- // default ConsoleHandler will take care of >= INFO
- if (record.getLevel().intValue() < Level.INFO.intValue()) {
- System.out.println(record.getMessage());
- }
- }
- });
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Entry.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Entry.java
deleted file mode 100644
index 08bad938..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Entry.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.googleapis.xml.atom.AtomPatchRelativeToOriginalContent;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.DataUtil;
-import com.google.api.client.util.Key;
-import com.google.api.client.xml.atom.AtomContent;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class Entry implements Cloneable {
-
- @Key
- public String summary;
-
- @Key
- public String title;
-
- @Key
- public String updated;
-
- @Key("link")
- public List links;
-
- @Override
- protected Entry clone() {
- return DataUtil.clone(this);
- }
-
- public void executeDelete(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildDeleteRequest();
- request.setUrl(getEditLink());
- RedirectHandler.execute(request).ignore();
- }
-
- Entry executeInsert(HttpTransport transport, CalendarUrl url)
- throws IOException {
- HttpRequest request = transport.buildPostRequest();
- request.url = url;
- AtomContent content = new AtomContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.entry = this;
- request.content = content;
- return RedirectHandler.execute(request).parseAs(getClass());
- }
-
- Entry executePatchRelativeToOriginal(HttpTransport transport, Entry original)
- throws IOException {
- HttpRequest request = transport.buildPatchRequest();
- request.setUrl(getEditLink());
- AtomPatchRelativeToOriginalContent content =
- new AtomPatchRelativeToOriginalContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.originalEntry = original;
- content.patchedEntry = this;
- request.content = content;
- return RedirectHandler.execute(request).parseAs(getClass());
- }
-
- private String getEditLink() {
- return Link.find(links, "edit");
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventEntry.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventEntry.java
deleted file mode 100644
index 8891b40a..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventEntry.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class EventEntry extends Entry {
-
- @Key("gd:when")
- public When when;
-
- @Key("batch:id")
- public String batchId;
-
- @Key("batch:status")
- public BatchStatus batchStatus;
-
- @Key("batch:operation")
- public BatchOperation batchOperation;
-
- @Override
- public EventEntry clone() {
- return (EventEntry) super.clone();
- }
-
- @Override
- public EventEntry executeInsert(HttpTransport transport, CalendarUrl url)
- throws IOException {
- return (EventEntry) super.executeInsert(transport, url);
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventFeed.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventFeed.java
deleted file mode 100644
index 9a5dfa56..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/EventFeed.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-import com.google.api.client.xml.atom.AtomFeedContent;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * @author Yaniv Inbar
- */
-public class EventFeed extends Feed {
-
- @Key("entry")
- public List events = new ArrayList();
-
- public static EventFeed executeGet(HttpTransport transport, CalendarUrl url)
- throws IOException {
- return (EventFeed) Feed.executeGet(transport, url, EventFeed.class);
- }
-
- public EventFeed executeBatch(HttpTransport transport, CalendarEntry calendar)
- throws IOException {
- // batch link
- CalendarUrl eventFeedUrl = new CalendarUrl(calendar.getEventFeedLink());
- eventFeedUrl.maxResults = 0;
- EventFeed eventFeed = EventFeed.executeGet(transport, eventFeedUrl);
- CalendarUrl url = new CalendarUrl(eventFeed.getBatchLink());
- // execute request
- HttpRequest request = transport.buildPostRequest();
- request.url = url;
- AtomFeedContent content = new AtomFeedContent();
- content.namespaceDictionary = Namespace.DICTIONARY;
- content.feed = this;
- request.content = content;
- return RedirectHandler.execute(request).parseAs(getClass());
- }
-
- @Override
- public List getEntries() {
- return events;
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Feed.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Feed.java
deleted file mode 100644
index c7d25a3d..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Feed.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.googleapis.xml.atom.GData;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.util.Key;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public abstract class Feed {
-
- @Key("link")
- public List links;
-
- public String getBatchLink() {
- return Link.find(links, "http://schemas.google.com/g/2005#batch");
- }
-
- public abstract List extends Entry> getEntries();
-
- static Feed executeGet(
- HttpTransport transport, CalendarUrl url, Class extends Feed> feedClass)
- throws IOException {
- url.fields = GData.getFieldsFor(feedClass);
- HttpRequest request = transport.buildGetRequest();
- request.url = url;
- return RedirectHandler.execute(request).parseAs(feedClass);
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Link.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Link.java
deleted file mode 100644
index a912971e..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Link.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.util.Key;
-
-import java.util.List;
-
-/**
- * @author Yaniv Inbar
- */
-public class Link {
-
- @Key("@href")
- public String href;
-
- @Key("@rel")
- public String rel;
-
- public static String find(List links, String rel) {
- if (links != null) {
- for (Link link : links) {
- if (rel.equals(link.rel)) {
- return link.href;
- }
- }
- }
- return null;
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Namespace.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Namespace.java
deleted file mode 100644
index 029aeb4b..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/Namespace.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.xml.XmlNamespaceDictionary;
-
-import java.util.Map;
-
-/**
- * @author Yaniv Inbar
- */
-public class Namespace {
-
- public static final XmlNamespaceDictionary DICTIONARY =
- new XmlNamespaceDictionary();
- static {
- Map map = DICTIONARY.namespaceAliasToUriMap;
- map.put("", "http://www.w3.org/2005/Atom");
- map.put("atom", "http://www.w3.org/2005/Atom");
- map.put("batch", "http://schemas.google.com/gdata/batch");
- map.put("gAcl", "http://schemas.google.com/acl/2007");
- map.put("gCal", "http://schemas.google.com/gCal/2005");
- map.put("gd", "http://schemas.google.com/g/2005");
- map.put("georss", "http://www.georss.org/georss");
- map.put("gml", "http://www.opengis.net/gml");
- map.put("openSearch", "http://a9.com/-/spec/opensearch/1.1/");
- map.put("xml", "http://www.w3.org/XML/1998/namespace");
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/RedirectHandler.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/RedirectHandler.java
deleted file mode 100644
index 48de6726..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/RedirectHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-import com.google.api.client.http.HttpExecuteIntercepter;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpResponse;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-
-import java.io.IOException;
-
-/**
- * @author Yaniv Inbar
- */
-public class RedirectHandler {
-
- /**
- * See How
- * do I handle redirects...?.
- */
- private static class SessionIntercepter implements HttpExecuteIntercepter {
-
- private String gsessionid;
-
- private SessionIntercepter(HttpTransport transport, GoogleUrl locationUrl) {
- this.gsessionid = (String) locationUrl.getFirst("gsessionid");
- transport.removeIntercepters(SessionIntercepter.class);
- transport.intercepters.add(0, this); // must be first
- }
-
- @Override
- public void intercept(HttpRequest request) {
- request.url.set("gsessionid", this.gsessionid);
- }
- }
-
- static HttpResponse execute(HttpRequest request) throws IOException {
- try {
- return request.execute();
- } catch (HttpResponseException e) {
- if (e.response.statusCode == 302) {
- GoogleUrl url = new GoogleUrl(e.response.headers.location);
- request.url = url;
- new SessionIntercepter(request.transport, url);
- e.response.ignore(); // force the connection to close
- return request.execute();
- } else {
- throw e;
- }
- }
- }
-}
diff --git a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/When.java b/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/When.java
deleted file mode 100644
index a7619c87..00000000
--- a/calendar-v2-atom-oauth-sample/src/com/google/api/client/sample/calendar/v2/model/When.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.calendar.v2.model;
-
-import com.google.api.client.util.DateTime;
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class When {
-
- @Key("@startTime")
- public DateTime startTime;
-
- @Key("@endTime")
- public DateTime endTime;
-}
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 00000000..66cd0c95
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,336 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome-licensing-json-oauth-sample/.classpath b/chrome-licensing-json-oauth-sample/.classpath
deleted file mode 100644
index f0f3949d..00000000
--- a/chrome-licensing-json-oauth-sample/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/chrome-licensing-json-oauth-sample/.project b/chrome-licensing-json-oauth-sample/.project
deleted file mode 100644
index 7783d92c..00000000
--- a/chrome-licensing-json-oauth-sample/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- calendar-v2-atom-oauth-sample
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.maven.ide.eclipse.maven2Builder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.maven.ide.eclipse.maven2Nature
-
-
diff --git a/chrome-licensing-json-oauth-sample/.settings/org.eclipse.jdt.core.prefs b/chrome-licensing-json-oauth-sample/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index bde57268..00000000
--- a/chrome-licensing-json-oauth-sample/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,12 +0,0 @@
-#Mon Jul 19 13:11:44 EDT 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/chrome-licensing-json-oauth-sample/instructions.html b/chrome-licensing-json-oauth-sample/instructions.html
deleted file mode 100644
index 5da84426..00000000
--- a/chrome-licensing-json-oauth-sample/instructions.html
+++ /dev/null
@@ -1,75 +0,0 @@
-
-Chrome Web Store Licensing API JSON OAuth Sample
-
-
Instructions for the Chrome Web Store Licensing API JSON OAuth Sample
Prerequisites: install Java 6, Mercurial and Maven. You may need to set
-your JAVA_HOME.
-
-
Important: after checking out the project, and before compiling
-and running it, you need to edit ClientCredentials.java
-to enter the App ID, oauth_token, and oauth_token_secret from Step 3 of the Getting
-Started Tutorial. Otherwise, you will get a 401 Unauthorized
-exception with the message Token invalid - Invalid AuthSub token.
Select "General > Existing Project into Workspace" and click
- "Next"
-
Click "Browse" next to "Select root directory", find [someDirectory]/google-api-java-client-samples/chrome-licensing-json-oauth-sample
- and click "Next"
-
Click "Finish"
-
-
-
Run
-
-
Right-click on project chrome-licensing-json-oauth-sample
-
Run As > Java Application
-
-
-
-
-
-
diff --git a/chrome-licensing-json-oauth-sample/pom.xml b/chrome-licensing-json-oauth-sample/pom.xml
deleted file mode 100644
index 52e827b4..00000000
--- a/chrome-licensing-json-oauth-sample/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
- 4.0.0
-
- com.google
- google
- 5
-
- com.google.api.client
- chrome-licensing-json-oauth-sample
- 1.0.0
- chrome-licensing-json-oauth-sample
-
- Example for the Chrome Web Store Licensing API using JSON and OAuth.
-
-
- http://code.google.com/p/google-api-java-client/
-
-
- code.google.com
- http://code.google.com/p/google-api-java-client/issues/list
-
-
- 2010
-
-
- 2.0.9
-
-
-
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- scm:hg:https://samples.google-api-java-client.googlecode.com/hg/
- http://code.google.com/p/google-api-java-client/source/browse/?repo=samples
-
-
-
-
- yanivi
- Yaniv Inbar
- yanivi@google.com
- Google
- http://www.google.com
-
- owner
- developer
-
- -5
-
-
-
-
-
- maven-compiler-plugin
-
- 1.6
- 1.6
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.1
-
-
-
- java
-
-
-
-
- com.google.api.client.sample.chrome.licensing.ChromeLicensingSample
-
-
-
- ${project.artifactId}-${project.version}
- src
- tests_disabled
-
-
-
- com.google.api.client
- google-api-client
- 1.1.0-alpha
-
-
-
- UTF-8
-
-
diff --git a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/ChromeLicensingSample.java b/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/ChromeLicensingSample.java
deleted file mode 100644
index cbd3ccba..00000000
--- a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/ChromeLicensingSample.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.chrome.licensing;
-
-import com.google.api.client.auth.oauth.OAuthHmacSigner;
-import com.google.api.client.auth.oauth.OAuthParameters;
-import com.google.api.client.googleapis.GoogleHeaders;
-import com.google.api.client.googleapis.GoogleTransport;
-import com.google.api.client.http.HttpRequest;
-import com.google.api.client.http.HttpResponseException;
-import com.google.api.client.http.HttpTransport;
-import com.google.api.client.json.JsonHttpParser;
-import com.google.api.client.sample.chrome.licensing.model.ChromeLicensingUrl;
-import com.google.api.client.sample.chrome.licensing.model.ClientCredentials;
-import com.google.api.client.sample.chrome.licensing.model.Debug;
-import com.google.api.client.sample.chrome.licensing.model.License;
-
-import java.io.IOException;
-import java.util.Scanner;
-
-/**
- * @author Yaniv Inbar
- */
-public class ChromeLicensingSample {
-
- public static void main(String[] args) {
- Debug.enableLogging();
- try {
- try {
- HttpTransport transport = setUpTransport();
- authorize(transport);
- showLicense(transport);
- } catch (HttpResponseException e) {
- System.err.println(e.response.parseAsString());
- throw e;
- }
- } catch (Throwable t) {
- t.printStackTrace();
- System.exit(1);
- }
- }
-
- private static HttpTransport setUpTransport() {
- HttpTransport transport = GoogleTransport.create();
- GoogleHeaders headers = (GoogleHeaders) transport.defaultHeaders;
- headers.setApplicationName("google-chromelicensingsample-1.0");
- transport.addParser(new JsonHttpParser());
- return transport;
- }
-
- private static void authorize(HttpTransport transport) {
- OAuthParameters authorizer = new OAuthParameters();
- authorizer.consumerKey = ClientCredentials.ENTER_DOMAIN;
- authorizer.token = ClientCredentials.ENTER_OAUTH_TOKEN;
- OAuthHmacSigner signer = new OAuthHmacSigner();
- signer.clientSharedSecret = ClientCredentials.ENTER_CLIENT_SHARED_SECRET;
- signer.tokenSharedSecret = ClientCredentials.ENTER_OAUTH_TOKEN_SECRET;
- authorizer.signer = signer;
- authorizer.signRequestsUsingAuthorizationHeader(transport);
- }
-
- private static void showLicense(HttpTransport transport) throws IOException {
- HttpRequest request = transport.buildGetRequest();
- request.url = ChromeLicensingUrl.forUser(inputUsername());
- License license = request.execute().parseAs(License.class);
- System.out.print("YES".equals(license.result)
- ? "FULL".equals(license.accessLevel) ? "Full" : "Free" : "No");
- System.out.println(" License.");
- }
-
- private static String inputUsername() {
- System.out.print("Username to check license for: ");
- Scanner scanner = new Scanner(System.in);
- return scanner.next();
- }
-}
diff --git a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ChromeLicensingUrl.java b/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ChromeLicensingUrl.java
deleted file mode 100644
index baf66826..00000000
--- a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ChromeLicensingUrl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.chrome.licensing.model;
-
-import com.google.api.client.googleapis.GoogleUrl;
-
-/**
- * @author Yaniv Inbar
- */
-public class ChromeLicensingUrl extends GoogleUrl {
-
- public ChromeLicensingUrl(String url) {
- super(url);
- if (Debug.ENABLED) {
- this.prettyprint = true;
- }
- }
-
- public static ChromeLicensingUrl forUser(String userId) {
- ChromeLicensingUrl result = new ChromeLicensingUrl(
- "https://www.googleapis.com/chromewebstore/v1/licenses");
- result.pathParts.add(ClientCredentials.ENTER_APP_ID);
- result.pathParts.add(userId);
- return result;
- }
-}
diff --git a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ClientCredentials.java b/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ClientCredentials.java
deleted file mode 100644
index a2695ad7..00000000
--- a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/ClientCredentials.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.chrome.licensing.model;
-
-/**
- * See the instructions at Tutorial:
- * Getting Started.
- *
- * @author Yaniv Inbar
- */
-public class ClientCredentials {
- public static final String ENTER_APP_ID = "enter_app_id";
- public static final String ENTER_OAUTH_TOKEN = "enter_oauth_token";
- public static final String ENTER_OAUTH_TOKEN_SECRET =
- "enter_oauth_token_secret";
- public static final String ENTER_DOMAIN = "anonymous";
- public static final String ENTER_CLIENT_SHARED_SECRET = "anonymous";
-}
diff --git a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/Debug.java b/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/Debug.java
deleted file mode 100644
index 3ec845d4..00000000
--- a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/Debug.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.chrome.licensing.model;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-/**
- * @author Yaniv Inbar
- */
-public class Debug {
- public static final boolean ENABLED = false;
-
- public static void enableLogging() {
- if (ENABLED) {
- Logger logger = Logger.getLogger("com.google.api.client");
- logger.setLevel(Level.CONFIG);
- logger.addHandler(new Handler() {
-
- @Override
- public void close() throws SecurityException {
- }
-
- @Override
- public void flush() {
- }
-
- @Override
- public void publish(LogRecord record) {
- // default ConsoleHandler will take care of >= INFO
- if (record.getLevel().intValue() < Level.INFO.intValue()) {
- System.out.println(record.getMessage());
- }
- }
- });
- }
- }
-}
diff --git a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/License.java b/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/License.java
deleted file mode 100644
index b2ac196c..00000000
--- a/chrome-licensing-json-oauth-sample/src/com/google/api/client/sample/chrome/licensing/model/License.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.api.client.sample.chrome.licensing.model;
-
-import com.google.api.client.util.Key;
-
-/**
- * @author Yaniv Inbar
- */
-public class License {
-
- @Key
- public String result;
-
- @Key
- public String accessLevel;
-}
diff --git a/cloudnotes-preview-android-sample-AppEngine/.classpath b/cloudnotes-preview-android-sample-AppEngine/.classpath
new file mode 100644
index 00000000..97a7f6c4
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/cloudnotes-preview-android-sample-AppEngine/.project b/cloudnotes-preview-android-sample-AppEngine/.project
new file mode 100644
index 00000000..b420264b
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.project
@@ -0,0 +1,44 @@
+
+
+ cloudnotes-preview-android-sample-AppEngine
+
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ com.google.gdt.eclipse.core.webAppProjectValidator
+
+
+
+
+ com.google.appengine.eclipse.core.enhancerbuilder
+
+
+
+
+ com.google.appengine.eclipse.core.gaeProjectChangeNotifier
+
+
+
+
+ com.google.appengine.eclipse.core.projectValidator
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.wst.common.project.facet.core.nature
+ com.google.appengine.eclipse.core.gaeNature
+
+
diff --git a/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.appengine.eclipse.core.prefs b/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.appengine.eclipse.core.prefs
new file mode 100644
index 00000000..bd4dc6e4
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.appengine.eclipse.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+filesCopiedToWebInfLib=appengine-api-labs.jar|appengine-endpoints.jar|appengine-jsr107cache-1.7.0.jar|jsr107cache-1.1.jar|appengine-api-1.0-sdk-1.7.0.jar|datanucleus-appengine-1.0.10.final.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar
+gaeDatanucleusVersion=v1
+gaeHrdEnabled=true
+gaeIsEclipseDefaultInstPath=true
+googleCloudSqlEnabled=false
+localDevMySqlEnabled=true
diff --git a/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.gdt.eclipse.core.prefs b/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.gdt.eclipse.core.prefs
new file mode 100644
index 00000000..cc6cb357
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.settings/com.google.gdt.eclipse.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+warSrcDir=war
+warSrcDirIsOutput=true
diff --git a/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.core.prefs b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..faf086f4
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,380 @@
+#Fri Nov 04 10:10:38 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_member=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=24
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type_declaration=569
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16|5|48
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
+org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
+org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16|4|49
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16|4|48
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=false
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.sort_local_variable_annotations=false
+org.eclipse.jdt.core.formatter.sort_member_annotations=false
+org.eclipse.jdt.core.formatter.sort_package_annotations=false
+org.eclipse.jdt.core.formatter.sort_parameter_annotations=false
+org.eclipse.jdt.core.formatter.sort_type_annotations=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
diff --git a/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.ui.prefs b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..220a62a3
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,119 @@
+#Thu May 10 09:43:54 EDT 2012
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_google-api-java-client
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_google-api-java-client 100
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=exception
+org.eclipse.jdt.ui.gettersetter.use.is=false
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com;org;;java;javax;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=999
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=999
+org.eclipse.jdt.ui.text.custom_code_templates=/*\n * Copyright (c) 2011 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\n * in compliance with the License. You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the License\n * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n * or implied. See the License for the specific language governing permissions and limitations under\n * the License.\n */\n/**\n * @author ${user}@google.com (Your Name Here)\n *\n * ${tags}\n *//**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//**\n * \n *//**\n * @author Yaniv Inbar\n *\n * ${tags}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-JSDoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}\n// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\n${body_statement}${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.wst.common.project.facet.core.xml b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100644
index 00000000..bcfc3250
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/discovery-appengine-sample/src/META-INF/jdoconfig.xml b/cloudnotes-preview-android-sample-AppEngine/src/META-INF/jdoconfig.xml
similarity index 100%
rename from discovery-appengine-sample/src/META-INF/jdoconfig.xml
rename to cloudnotes-preview-android-sample-AppEngine/src/META-INF/jdoconfig.xml
diff --git a/cloudnotes-preview-android-sample-AppEngine/src/META-INF/persistence.xml b/cloudnotes-preview-android-sample-AppEngine/src/META-INF/persistence.xml
new file mode 100644
index 00000000..f8d8c103
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/src/META-INF/persistence.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfo.java b/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfo.java
new file mode 100644
index 00000000..f4267be7
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfo.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.samples.cloudnotes;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * @author Sriram Saroop
+ */
+@Entity
+public class DeviceInfo {
+ @Id
+ private String deviceRegistrationID;
+
+ public String getDeviceRegistrationID() {
+ return deviceRegistrationID;
+ }
+
+ public void setDeviceRegistrationID(String deviceRegistrationID) {
+ this.deviceRegistrationID = deviceRegistrationID;
+ }
+
+}
diff --git a/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfoEndpoint.java b/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfoEndpoint.java
new file mode 100644
index 00000000..903ec79d
--- /dev/null
+++ b/cloudnotes-preview-android-sample-AppEngine/src/com/google/samples/cloudnotes/DeviceInfoEndpoint.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.samples.cloudnotes;
+
+import com.google.api.server.spi.config.Api;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+/**
+ * @author Sriram Saroop
+ */
+@Api(name = "deviceinfoendpoint")
+public class DeviceInfoEndpoint {
+
+ /**
+ * This method lists all the entities inserted in datastore. It uses HTTP GET method.
+ *
+ * @return List of all entities persisted.
+ */
+ @SuppressWarnings({"cast", "unchecked"})
+ public List listDeviceInfo() {
+ EntityManager mgr = getEntityManager();
+ List result = new ArrayList();
+ try {
+ Query query = mgr.createQuery("select from DeviceInfo");
+ for (Object obj : (List