Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to java8 #69

Merged
merged 3 commits into from
Jan 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions managed_vms/analytics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.92.v20160118</version>
<configuration>
<promote>true</promote>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -37,16 +45,8 @@
<version>3.3</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.90.v20151210</version>
<configuration>
<promote>true</promote>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -63,6 +63,11 @@
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
</plugins>
</build>
</project>
7 changes: 7 additions & 0 deletions managed_vms/analytics/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runtime: java
vm: true

# [START env_variables]
env_variables:
GA_TRACKING_ID: YOUR-GA-TRACKING-ID
# [END env_variables]
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// [START example]
@SuppressWarnings("serial")
@WebServlet(name = "analytics", value = "/*")
@WebServlet(name = "analytics", value = "")
public class AnalyticsServlet extends HttpServlet {

@Override
Expand Down
12 changes: 0 additions & 12 deletions managed_vms/analytics/src/main/webapp/WEB-INF/appengine-web.xml

This file was deleted.

25 changes: 15 additions & 10 deletions managed_vms/cloudsql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.92.v20160118</version>
<configuration>
<promote>true</promote>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -39,16 +47,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.90.v20151210</version>
<configuration>
<promote>true</promote>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -65,6 +65,11 @@
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
</plugins>
</build>
</project>
7 changes: 7 additions & 0 deletions managed_vms/cloudsql/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runtime: java
vm: true

# [START env_variables]
env_variables:
SQL_DATABASE_URL: jdbc:mysql://HOST-IP:3306/YOUR-DB-NAME?user=USERNAME&password=PASSWORD
# [END env_variables]
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

// [START example]
@SuppressWarnings("serial")
@WebServlet(name = "cloudsql", value = "/*")
@WebServlet(name = "cloudsql", value = "")
public class CloudSqlServlet extends HttpServlet {

@Override
Expand Down
12 changes: 0 additions & 12 deletions managed_vms/cloudsql/src/main/webapp/WEB-INF/appengine-web.xml

This file was deleted.

27 changes: 16 additions & 11 deletions managed_vms/cloudstorage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@
<dependency>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java-storage</artifactId>
<version>0.1.1</version>
<version>0.1.3</version>
</dependency>
<!-- [END dependencies] -->
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.92.v20160118</version>
<configuration>
<promote>true</promote>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -39,16 +47,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.90.v20151210</version>
<configuration>
<promote>true</promote>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -65,6 +65,11 @@
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
</plugins>
</build>
</project>
7 changes: 7 additions & 0 deletions managed_vms/cloudstorage/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
runtime: java
vm: true

# [START env_variables]
env_variables:
BUCKET_NAME: YOUR-BUCKET-NAME
# [END env_variables]
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@

package com.example.managedvms.cloudstorage;

import com.google.common.io.ByteStreams;
import com.google.gcloud.storage.Acl;
import com.google.gcloud.storage.BlobInfo;
import com.google.gcloud.storage.BlobWriteChannel;
import com.google.gcloud.storage.Storage;
import com.google.gcloud.storage.StorageOptions;

import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.Channels;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
Expand Down Expand Up @@ -53,11 +52,13 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
ServletException {
final Part filePart = req.getPart("file");
final String fileName = filePart.getSubmittedFileName();
BlobInfo blobInfo = BlobInfo.builder(BUCKET_NAME, fileName).build();
InputStream filecontent = filePart.getInputStream();
BlobWriteChannel blobWriter = storage.writer(blobInfo);
ByteStreams.copy(filecontent, Channels.newOutputStream(blobWriter));
blobWriter.close();
List<Acl> acls = new ArrayList<>();
acls.add(Acl.of(Acl.User.ofAllUsers(), Acl.Role.READER));
// the inputstream is closed by default, so we don't need to close it here
BlobInfo blobInfo =
storage.create(
BlobInfo.builder(BUCKET_NAME, fileName).acl(acls).build(),
filePart.getInputStream());
blobInfo = storage.get(BUCKET_NAME, fileName);
resp.getWriter().print(blobInfo.mediaLink());
}
Expand Down
12 changes: 0 additions & 12 deletions managed_vms/cloudstorage/src/main/webapp/WEB-INF/appengine-web.xml

This file was deleted.

27 changes: 16 additions & 11 deletions managed_vms/datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@
<dependency>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java-datastore</artifactId>
<version>0.1.1</version>
<version>0.1.3</version>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.92.v20160118</version>
<configuration>
<promote>true</promote>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -37,16 +45,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.90.v20151210</version>
<configuration>
<promote>true</promote>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -63,6 +63,11 @@
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions managed_vms/datastore/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
runtime: java
vm: true

Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@

// [START example]
@SuppressWarnings("serial")
@WebServlet(name = "datastore", value = "/*")
@WebServlet(name = "datastore", value = "")
public class DatastoreServlet extends HttpServlet {

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException,
ServletException {
Datastore datastore = DatastoreOptions
.builder()
.projectId(System.getenv("PROJECT_ID"))
.build()
.service();
Datastore datastore = DatastoreOptions.defaultInstance().service();
KeyFactory keyFactory = datastore.newKeyFactory().kind("visit");
IncompleteKey key = keyFactory.kind("visit").newKey();
// Record a visit to the datastore, storing the IP and timestamp.
Expand Down
12 changes: 0 additions & 12 deletions managed_vms/datastore/src/main/webapp/WEB-INF/appengine-web.xml

This file was deleted.

19 changes: 12 additions & 7 deletions managed_vms/disk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.92.v20160118</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand All @@ -32,15 +37,10 @@
<version>3.3</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.90.v20151210</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand All @@ -55,6 +55,11 @@
<execution><goals><goal>check</goal></goals></execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.7.v20160115</version>
</plugin>
</plugins>
</build>
</project>
Loading