Skip to content

Commit

Permalink
Merge branch 'master' into guice-gradle-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyn authored Nov 8, 2017
2 parents 8113899 + 42766d3 commit b3bac62
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion appengine-java8/endpoints-v2-guice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To build the project:

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

mvn endpoints-framework:openApiDoc
mvn endpoints-framework:openApiDocs

### Deploying the sample API to App Engine

Expand Down
5 changes: 5 additions & 0 deletions appengine-java8/endpoints-v2-guice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ apply plugin: 'com.google.cloud.tools.appengine'

dependencies {
compile 'com.google.endpoints:endpoints-framework:2.0.9'
// [START guice_dependency]
compile 'com.google.endpoints:endpoints-framework-guice:2.0.9'
// [END guice_dependency]

compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.5'
compile 'com.google.endpoints:endpoints-framework-auth:1.0.5'
}

// [START endpoints_plugin_configuration]
endpointsServer {
// Endpoints Framework Plugin server-side configuration
hostname = "${projectId}.appspot.com"
serviceClasses = ['com.example.echo.Echo']
}
// [END endpoints_plugin_configuration]

appengine { // App Engine tasks configuration
deploy { // deploy configuration
Expand Down
11 changes: 4 additions & 7 deletions appengine-java8/endpoints-v2-guice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
</dependency>
<!-- [START guice_dependency] -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework-guice</artifactId>
<version>2.0.9</version>
</dependency>
<!-- [END guice_dependency] -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
Expand Down Expand Up @@ -102,6 +104,7 @@
<!-- deploy configuration -->
</configuration>
</plugin>
<!-- [START endpoints_plugin] -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>endpoints-framework-maven-plugin</artifactId>
Expand All @@ -113,14 +116,8 @@
<serviceClass>com.example.echo.Echo</serviceClass>
</serviceClasses>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>
</plugin>
<!-- [START endpoints_plugin] -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.example.echo;

//import com.google.api.server.spi.guice.GuiceServletContextListener;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<runtime>java8</runtime>
<threadsafe>true</threadsafe>

<basic-scaling>
<max-instances>2</max-instances>
</basic-scaling>

<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<!-- Wrap the backend with Endpoints Frameworks v2. -->
<!-- Route API method requests to the backend using Guice. -->
<!-- [START guice_configuration] -->
<filter>
<filter-name>guiceFilter</filter-name>
<filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
Expand All @@ -35,9 +36,6 @@
<listener>
<listener-class>com.example.echo.EchoGuiceListener</listener-class>
</listener>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- [END guice_configuration] -->

</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<threadsafe>true</threadsafe>

<basic-scaling>
<max-instances>2</max-instances>
</basic-scaling>

<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@
<listener-class>com.example.echo.EchoGuiceListener</listener-class>
</listener>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,19 @@ static void addIndex(DatabaseAdminClient adminClient, DatabaseId dbId) {
// "CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle)".
// [START query_index]
static void queryUsingIndex(DatabaseClient dbClient) {
ResultSet resultSet =
dbClient
.singleUse()
.executeQuery(
// We use FORCE_INDEX hint to specify which index to use. For more details see
// https://cloud.google.com/spanner/docs/query-syntax#from-clause
Statement.of(
"SELECT AlbumId, AlbumTitle, MarketingBudget\n"
+ "FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle}\n"
+ "WHERE AlbumTitle >= 'Aardvark' AND AlbumTitle < 'Goo'"));
Statement statement = Statement
// We use FORCE_INDEX hint to specify which index to use. For more details see
// https://cloud.google.com/spanner/docs/query-syntax#from-clause
.newBuilder("SELECT AlbumId, AlbumTitle, MarketingBudget\n"
+ "FROM Albums@{FORCE_INDEX=AlbumsByAlbumTitle}\n"
+ "WHERE AlbumTitle >= @StartTitle AND AlbumTitle < @EndTitle")
// We use @BoundParameters to help speed up frequently executed queries.
// For more details see https://cloud.google.com/spanner/docs/sql-best-practices
.bind("StartTitle").to("Aardvark")
.bind("EndTitle").to("Goo")
.build();

ResultSet resultSet = dbClient.singleUse().executeQuery(statement);
while (resultSet.next()) {
System.out.printf(
"%d %s %s\n",
Expand Down

0 comments on commit b3bac62

Please sign in to comment.