Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit d27fa0c

Browse files
author
Matthias Linder
committed
[Issue 520] Update command-line + AppEngine samples for 1.10
http://codereview.appspot.com/6297067/
1 parent ceaccc8 commit d27fa0c

File tree

66 files changed

+578
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+578
-560
lines changed

adexchangebuyer-cmdline-sample/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-adexchangebuyer</artifactId>
129-
<version>v1-rev5-1.6.0-beta</version>
129+
<version>v1-rev6-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

adexchangebuyer-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangebuyer/cmdline/AdExchangeBuyerSample.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
6262
Arrays.asList(AdexchangebuyerScopes.ADEXCHANGE_BUYER));
6363

6464
// Set up API client.
65-
Adexchangebuyer client = Adexchangebuyer.builder(HTTP_TRANSPORT, JSON_FACTORY)
66-
.setApplicationName("Google-AdExchangeBuyerSample/1.0")
67-
.setHttpRequestInitializer(credential).build();
65+
Adexchangebuyer client = new Adexchangebuyer.Builder(
66+
HTTP_TRANSPORT, JSON_FACTORY, credential).setApplicationName(
67+
"Google-AdExchangeBuyerSample/1.0").build();
6868

6969
return client;
7070
}

adexchangebuyer-cmdline-sample/src/main/java/com/google/api/services/samples/adexchangebuyer/cmdline/GetAllAccounts.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public String getDescription() {
6161
public void execute(Adexchangebuyer client) throws IOException {
6262
List<Account> allAccounts = client.accounts().list().execute().getItems();
6363

64-
if (allAccounts.size() > 0) {
64+
if (allAccounts != null && allAccounts.size() > 0) {
6565
System.out.printf("========================================\n");
6666
System.out.printf("Listing of user associated accounts\n");
6767
System.out.printf("========================================\n");

adsense-cmdline-sample/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-adsense</artifactId>
129-
<version>v1.1-rev13-1.6.0-beta</version>
129+
<version>v1.1-rev17-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

adsense-cmdline-sample/src/main/java/com/google/api/services/samples/adsense/cmdline/AdSenseSample.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
7272
Arrays.asList(AdsenseScopes.ADSENSE_READONLY));
7373

7474
// Set up AdSense Management API client.
75-
Adsense adsense = Adsense.builder(new NetHttpTransport(), new JacksonFactory())
76-
.setApplicationName("Google-AdSenseSample/1.1")
77-
.setHttpRequestInitializer(credential)
78-
.build();
75+
Adsense adsense = new Adsense.Builder(
76+
new NetHttpTransport(), new JacksonFactory(), credential).setApplicationName(
77+
"Google-AdSenseSample/1.1").build();
7978

8079
return adsense;
8180
}

analytics-cmdline-sample/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@
126126
<dependency>
127127
<groupId>com.google.apis</groupId>
128128
<artifactId>google-api-services-analytics</artifactId>
129-
<version>v3-rev7-1.6.0-beta</version>
129+
<version>v3-rev9-1.7.0-beta</version>
130130
</dependency>
131131
<dependency>
132132
<groupId>com.google.apis-samples</groupId>
133133
<artifactId>shared-sample-cmdline</artifactId>
134-
<version>1.2.0</version>
134+
<version>1.3.0</version>
135135
</dependency>
136136
</dependencies>
137137
<properties>

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/CoreReportingApiReferenceSample.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
101101
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
102102

103103
// Set up and return Google Analytics API client.
104-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
104+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
105105
.setApplicationName("Google-Analytics-Core-Reporting-API-Sample")
106-
.setHttpRequestInitializer(credential)
107106
.build();
108107
}
109108

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/HelloAnalyticsApiSample.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
9696
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
9797

9898
// Set up and return Google Analytics API client.
99-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
99+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
100100
.setApplicationName("Google-Analytics-Hello-Analytics-API-Sample")
101-
.setHttpRequestInitializer(credential)
102101
.build();
103102
}
104103

analytics-cmdline-sample/src/main/java/com/google/api/services/samples/analytics/cmdline/ManagementApiReferenceSample.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ HTTP_TRANSPORT, JSON_FACTORY, new LocalServerReceiver(),
9292
Arrays.asList(AnalyticsScopes.ANALYTICS_READONLY));
9393

9494
// Set up and return Google Analytics API client.
95-
return Analytics.builder(HTTP_TRANSPORT, JSON_FACTORY)
95+
return new Analytics.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
9696
.setApplicationName("Google-Analytics-Management-API-Sample")
9797
.setHttpRequestInitializer(credential)
9898
.build();
@@ -143,7 +143,7 @@ private static void printManagementEntities(Analytics analytics) throws IOExcept
143143
Goals goals = analytics.management().goals()
144144
.list(firstAccountId, firstWebpropertyId, firstProfileId).execute();
145145

146-
if (goals.getItems().isEmpty()) {
146+
if (goals.getItems() == null || goals.getItems().isEmpty()) {
147147
System.err.println("No goals found");
148148
} else {
149149
printGoals(goals);
@@ -313,7 +313,7 @@ private static void printVisitNumPagesDetails(VisitNumPagesDetails visitNumPages
313313
/**
314314
* Prints details for EVENT type goals.
315315
*
316-
* @param goalEventDetails the details of an EVENT type goal.
316+
* @param eventDetails the details of an EVENT type goal.
317317
*/
318318
private static void printGoalEventDetails(EventDetails eventDetails) {
319319
System.out.println("Goal Type: EVENT");

bigquery-appengine-sample/instructions.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h3>Settings</h3>
2929
<ul>
3030
<li>Add the client ID and client secret of your project to <code>shared/shared-sample-appengine/src/main/resources/client_secrets.json</code>. You can find your client id and secret on your <a href="https://code.google.com/apis/console">API console</a> for your Bigquery project under API Access</li>
3131
<li>Run <code>mvn source:jar install</code> in <code>shared/shared-sample-appengine/</code></li>
32-
<li>Add your Bigquery project ID as a system property to <code>bigquery-appengine-sample/src/main/webapp/WEB-INF/appengine-web.xml</code>. If deploying to App Engine, also add your App Engine application ID at the top of the file.</li>
32+
<li>Add your API console project ID as a system property to <code>bigquery-appengine-sample/src/main/webapp/WEB-INF/appengine-web.xml</code>. If deploying to App Engine, also add your App Engine application ID at the top of the file.</li>
3333
<li>Run <code>mvn clean package</code> in <code>bigquery-appengine-sample/</code></li>
3434
</ul>
3535

@@ -61,7 +61,8 @@ <h3>Setup project in Eclipse 3.7</h3>
6161
<h3>FAQ</h3>
6262
<ul>
6363
<li>I keep getting redirected to /denied! What do I do?<br/>Make sure your client secret/ID are correctly set and that you re-installed samples/shared-sample-appengine.</li>
64-
<li>I get a 404 when I run my query. What could be wrong?<br/>Make sure you've added your </li>
64+
<li>I get a 403 Forbidden when trying to run my query. What causes this?<br/>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.</li>
65+
<li>I get a 404 when I run my query. What could be wrong?<br/>Make sure you've added your API Console project ID to the appengine-web.xml.</li>
6566
</ul>
6667

6768
</body>

bigquery-appengine-sample/pom.xml

+148-7
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
</pluginRepositories>
3030

3131
<properties>
32-
<bigquery.version>v2-1.3.1-beta</bigquery.version>
33-
<gae.version>1.5.4</gae.version>
34-
<google-api-client.version>1.6.0-beta</google-api-client.version>
32+
<bigquery.version>v2-rev17-1.7.0-beta</bigquery.version>
33+
<datanucleus.version>1.1.5</datanucleus.version>
34+
<gae.version>1.6.4</gae.version>
35+
<google-api-client.version>1.10.1-beta</google-api-client.version>
3536
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
3637
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3738
</properties>
@@ -45,11 +46,77 @@
4546
<artifactId>maven-compiler-plugin</artifactId>
4647
<version>2.3.2</version>
4748
<configuration>
48-
<source>1.5</source>
49-
<target>1.5</target>
49+
<source>1.6</source>
50+
<target>1.6</target>
5051
</configuration>
5152
</plugin>
5253

54+
<plugin>
55+
<groupId>net.kindleit</groupId>
56+
<artifactId>maven-gae-plugin</artifactId>
57+
<version>0.9.2</version>
58+
<dependencies>
59+
<dependency>
60+
<groupId>net.kindleit</groupId>
61+
<artifactId>gae-runtime</artifactId>
62+
<version>${gae.version}</version>
63+
<type>pom</type>
64+
</dependency>
65+
</dependencies>
66+
</plugin>
67+
<plugin>
68+
<groupId>org.datanucleus</groupId>
69+
<artifactId>maven-datanucleus-plugin</artifactId>
70+
<version>1.1.4</version>
71+
<configuration>
72+
<fork>false</fork>
73+
<log4jConfiguration>${basedir}/src/main/resources/log4j.properties</log4jConfiguration>
74+
<mappingIncludes>**/server/*.class</mappingIncludes>
75+
<verbose>true</verbose>
76+
<enhancerName>ASM</enhancerName>
77+
<api>JPA</api>
78+
</configuration>
79+
<executions>
80+
<execution>
81+
<id />
82+
<phase>compile</phase>
83+
<goals>
84+
<goal>enhance</goal>
85+
</goals>
86+
</execution>
87+
</executions>
88+
<dependencies>
89+
<dependency>
90+
<groupId>org.datanucleus</groupId>
91+
<artifactId>datanucleus-core</artifactId>
92+
<version>${datanucleus.version}</version>
93+
<exclusions>
94+
<exclusion>
95+
<groupId>javax.transaction</groupId>
96+
<artifactId>transaction-api</artifactId>
97+
</exclusion>
98+
</exclusions>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.datanucleus</groupId>
102+
<artifactId>datanucleus-rdbms</artifactId>
103+
<version>${datanucleus.version}</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>org.datanucleus</groupId>
107+
<artifactId>datanucleus-enhancer</artifactId>
108+
<version>1.1.4</version>
109+
</dependency>
110+
<!-- Dependency added as workaround to GWT Issue 5947 for details see http://code.google.com/p/google-web-toolkit/issues/detail?id=5497 -->
111+
<dependency>
112+
<groupId>javax.jdo</groupId>
113+
<artifactId>jdo2-api</artifactId>
114+
<version>2.3-ec</version>
115+
<scope>runtime</scope>
116+
</dependency>
117+
</dependencies>
118+
</plugin>
119+
53120
<plugin>
54121
<groupId>org.apache.maven.plugins</groupId>
55122
<artifactId>maven-war-plugin</artifactId>
@@ -66,7 +133,81 @@
66133
<webappDirectory>${webappDirectory}</webappDirectory>
67134
</configuration>
68135
</plugin>
136+
<plugin>
137+
<artifactId>maven-checkstyle-plugin</artifactId>
138+
<version>2.6</version>
139+
<configuration>
140+
<configLocation>../checkstyle.xml</configLocation>
141+
<consoleOutput>true</consoleOutput>
142+
<failOnViolation>false</failOnViolation>
143+
</configuration>
144+
<executions>
145+
<execution>
146+
<goals>
147+
<goal>check</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
</plugin>
152+
<plugin>
153+
<groupId>org.codehaus.mojo</groupId>
154+
<artifactId>findbugs-maven-plugin</artifactId>
155+
<version>2.3.2</version>
156+
<configuration>
157+
<failOnError>false</failOnError>
158+
</configuration>
159+
<executions>
160+
<execution>
161+
<goals>
162+
<goal>check</goal>
163+
</goals>
164+
</execution>
165+
</executions>
166+
</plugin>
69167
</plugins>
168+
<pluginManagement>
169+
<plugins>
170+
<!--This plugin's configuration is used to store Eclipse m2e settings only.
171+
It has no influence on the Maven build itself. -->
172+
<plugin>
173+
<groupId>org.eclipse.m2e</groupId>
174+
<artifactId>lifecycle-mapping</artifactId>
175+
<version>1.0.0</version>
176+
<configuration>
177+
<lifecycleMappingMetadata>
178+
<pluginExecutions>
179+
<pluginExecution>
180+
<pluginExecutionFilter>
181+
<groupId>org.apache.maven.plugins</groupId>
182+
<artifactId>maven-war-plugin</artifactId>
183+
<versionRange>[2.1.1,)</versionRange>
184+
<goals>
185+
<goal>exploded</goal>
186+
</goals>
187+
</pluginExecutionFilter>
188+
<action>
189+
<ignore></ignore>
190+
</action>
191+
</pluginExecution>
192+
<pluginExecution>
193+
<pluginExecutionFilter>
194+
<groupId>org.datanucleus</groupId>
195+
<artifactId>maven-datanucleus-plugin</artifactId>
196+
<versionRange>[1.1.4,)</versionRange>
197+
<goals>
198+
<goal>enhance</goal>
199+
</goals>
200+
</pluginExecutionFilter>
201+
<action>
202+
<ignore></ignore>
203+
</action>
204+
</pluginExecution>
205+
</pluginExecutions>
206+
</lifecycleMappingMetadata>
207+
</configuration>
208+
</plugin>
209+
</plugins>
210+
</pluginManagement>
70211
</build>
71212

72213
<dependencies>
@@ -79,7 +220,7 @@
79220
<dependency>
80221
<groupId>com.google.apis-samples</groupId>
81222
<artifactId>shared-sample-appengine</artifactId>
82-
<version>1.1.0</version>
223+
<version>1.3.0</version>
83224
</dependency>
84225
<dependency>
85226
<groupId>com.google.api-client</groupId>
@@ -88,7 +229,7 @@
88229
</dependency>
89230
<dependency>
90231
<groupId>com.google.api-client</groupId>
91-
<artifactId>google-api-client-extensions</artifactId>
232+
<artifactId>google-api-client-appengine</artifactId>
92233
<version>${google-api-client.version}</version>
93234
</dependency>
94235
<dependency>

bigquery-appengine-sample/src/main/java/com/google/api/client/sample/bigquery/appengine/dashboard/AuthServlet.java

-55
This file was deleted.

0 commit comments

Comments
 (0)