Skip to content

Commit b3bac62

Browse files
authored
Merge branch 'master' into guice-gradle-fix
2 parents 8113899 + 42766d3 commit b3bac62

File tree

9 files changed

+25
-35
lines changed

9 files changed

+25
-35
lines changed

appengine-java8/endpoints-v2-guice/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To build the project:
3434

3535
To generate the required configuration file `openapi.json`:
3636

37-
mvn endpoints-framework:openApiDoc
37+
mvn endpoints-framework:openApiDocs
3838

3939
### Deploying the sample API to App Engine
4040

appengine-java8/endpoints-v2-guice/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,21 @@ apply plugin: 'com.google.cloud.tools.appengine'
4444

4545
dependencies {
4646
compile 'com.google.endpoints:endpoints-framework:2.0.9'
47+
// [START guice_dependency]
4748
compile 'com.google.endpoints:endpoints-framework-guice:2.0.9'
49+
// [END guice_dependency]
50+
4851
compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.5'
4952
compile 'com.google.endpoints:endpoints-framework-auth:1.0.5'
5053
}
5154

55+
// [START endpoints_plugin_configuration]
5256
endpointsServer {
5357
// Endpoints Framework Plugin server-side configuration
5458
hostname = "${projectId}.appspot.com"
5559
serviceClasses = ['com.example.echo.Echo']
5660
}
61+
// [END endpoints_plugin_configuration]
5762

5863
appengine { // App Engine tasks configuration
5964
deploy { // deploy configuration

appengine-java8/endpoints-v2-guice/pom.xml

+4-7
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@
4747
<artifactId>endpoints-framework</artifactId>
4848
<version>${endpoints.framework.version}</version>
4949
</dependency>
50+
<!-- [START guice_dependency] -->
5051
<dependency>
5152
<groupId>com.google.endpoints</groupId>
5253
<artifactId>endpoints-framework-guice</artifactId>
5354
<version>2.0.9</version>
5455
</dependency>
56+
<!-- [END guice_dependency] -->
5557
<dependency>
5658
<groupId>com.google.endpoints</groupId>
5759
<artifactId>endpoints-management-control-appengine-all</artifactId>
@@ -102,6 +104,7 @@
102104
<!-- deploy configuration -->
103105
</configuration>
104106
</plugin>
107+
<!-- [START endpoints_plugin] -->
105108
<plugin>
106109
<groupId>com.google.cloud.tools</groupId>
107110
<artifactId>endpoints-framework-maven-plugin</artifactId>
@@ -113,14 +116,8 @@
113116
<serviceClass>com.example.echo.Echo</serviceClass>
114117
</serviceClasses>
115118
</configuration>
116-
<dependencies>
117-
<dependency>
118-
<groupId>com.google.endpoints</groupId>
119-
<artifactId>endpoints-management-control-appengine-all</artifactId>
120-
<version>1.0.5</version>
121-
</dependency>
122-
</dependencies>
123119
</plugin>
120+
<!-- [START endpoints_plugin] -->
124121
<plugin>
125122
<groupId>org.codehaus.mojo</groupId>
126123
<artifactId>versions-maven-plugin</artifactId>

appengine-java8/endpoints-v2-guice/src/main/java/com/example/echo/EchoGuiceListener.java

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.example.echo;
1818

19-
//import com.google.api.server.spi.guice.GuiceServletContextListener;
2019
import com.google.inject.Guice;
2120
import com.google.inject.Injector;
2221
import com.google.inject.servlet.GuiceServletContextListener;

appengine-java8/endpoints-v2-guice/src/main/webapp/WEB-INF/appengine-web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
<runtime>java8</runtime>
1919
<threadsafe>true</threadsafe>
2020

21-
<basic-scaling>
22-
<max-instances>2</max-instances>
23-
</basic-scaling>
24-
2521
<system-properties>
2622
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
2723
</system-properties>

appengine-java8/endpoints-v2-guice/src/main/webapp/WEB-INF/web.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
1818
<!-- Wrap the backend with Endpoints Frameworks v2. -->
1919
<!-- Route API method requests to the backend using Guice. -->
20+
<!-- [START guice_configuration] -->
2021
<filter>
2122
<filter-name>guiceFilter</filter-name>
2223
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
@@ -35,9 +36,6 @@
3536
<listener>
3637
<listener-class>com.example.echo.EchoGuiceListener</listener-class>
3738
</listener>
38-
39-
<welcome-file-list>
40-
<welcome-file>index.html</welcome-file>
41-
</welcome-file-list>
39+
<!-- [END guice_configuration] -->
4240

4341
</web-app>

appengine/endpoints-frameworks-v2/guice-example/src/main/webapp/WEB-INF/appengine-web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
1818
<threadsafe>true</threadsafe>
1919

20-
<basic-scaling>
21-
<max-instances>2</max-instances>
22-
</basic-scaling>
23-
2420
<system-properties>
2521
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
2622
</system-properties>

appengine/endpoints-frameworks-v2/guice-example/src/main/webapp/WEB-INF/web.xml

-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,4 @@
3636
<listener-class>com.example.echo.EchoGuiceListener</listener-class>
3737
</listener>
3838

39-
<welcome-file-list>
40-
<welcome-file>index.html</welcome-file>
41-
</welcome-file-list>
42-
4339
</web-app>

spanner/cloud-client/src/main/java/com/example/spanner/SpannerSample.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,19 @@ static void addIndex(DatabaseAdminClient adminClient, DatabaseId dbId) {
306306
// "CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)".
307307
// [START query_index]
308308
static void queryUsingIndex(DatabaseClient dbClient) {
309-
ResultSet resultSet =
310-
dbClient
311-
.singleUse()
312-
.executeQuery(
313-
// We use FORCE_INDEX hint to specify which index to use. For more details see
314-
// https://cloud.google.com/spanner/docs/query-syntax#from-clause
315-
Statement.of(
316-
"SELECT AlbumId, AlbumTitle, MarketingBudget\n"
317-
+ "FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle}\n"
318-
+ "WHERE AlbumTitle >= 'Aardvark' AND AlbumTitle < 'Goo'"));
309+
Statement statement = Statement
310+
// We use FORCE_INDEX hint to specify which index to use. For more details see
311+
// https://cloud.google.com/spanner/docs/query-syntax#from-clause
312+
.newBuilder("SELECT AlbumId, AlbumTitle, MarketingBudget\n"
313+
+ "FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle}\n"
314+
+ "WHERE AlbumTitle >= @StartTitle AND AlbumTitle < @EndTitle")
315+
// We use @BoundParameters to help speed up frequently executed queries.
316+
// For more details see https://cloud.google.com/spanner/docs/sql-best-practices
317+
.bind("StartTitle").to("Aardvark")
318+
.bind("EndTitle").to("Goo")
319+
.build();
320+
321+
ResultSet resultSet = dbClient.singleUse().executeQuery(statement);
319322
while (resultSet.next()) {
320323
System.out.printf(
321324
"%d %s %s\n",

0 commit comments

Comments
 (0)