• Like
  • Save
Alphageeks IL #2 Google App Engine
Upcoming SlideShare
Loading in...5
×
 

Alphageeks IL #2 Google App Engine

on

  • 1,725 views

Second Alphageeks IL meetup:

Second Alphageeks IL meetup:
Liran Zelka talks on Google App-Engine and cloud computing in general.

Check us out for more events:
http://alphageeks.blogli.co.il/

Statistics

Views

Total Views
1,725
Views on SlideShare
1,722
Embed Views
3

Actions

Likes
0
Downloads
10
Comments
0

2 Embeds 3

http://www.techgig.com 2
http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Alphageeks IL #2 Google App Engine Alphageeks IL #2 Google App Engine Presentation Transcript

    • Google App Engine
      לירן זילכה
      מנכ"ל משותף
      Liran.zelkha@alunasoft.com
    • Aluna
      Israel’s leading Java/JavaEE and SOA consulting company
      Customers:
    • Installing The SDK
      Java 5 & 6 are supported
      Download google eclipse plugin from
      Or just download and install the SDK
      http://dl.google.com/eclipse/plugin/3.4
      http://code.google.com/appengine/downloads.html
    • App Engine Project
      A standard JavaEE WAR file
    • The Servlet
      package guestbook;
      import java.io.IOException;
      import javax.servlet.http.*;
      public class GuestbookServlet extends HttpServlet {
      public void doGet(HttpServletRequestreq, HttpServletResponseresp)
      throws IOException {
      resp.setContentType("text/plain");
      resp.getWriter().println("Hello, world");
      }
      }
    • Web.xml
      <?xml version="1.0" encoding="utf-8"?>
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
      <servlet>
      <servlet-name>guestbook</servlet-name>
      <servlet-class>guestbook.GuestbookServlet</servlet-class>
      </servlet>
      <servlet-mapping>
      <servlet-name>guestbook</servlet-name>
      <url-pattern>/guestbook</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
      <welcome-file>/index.html</welcome-file>
      </welcome-file-list>
      </web-app>
    • Appengine-web.xml
      <?xml version="1.0" encoding="utf-8"?>
      <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
      <application></application>
      <version>1</version>
      </appengine-web-app>
    • Run/Debug
      Web server runtime comes with the plugins
    • Users service
      package guestbook;
      public class GuestbookServlet extends HttpServlet {
      public void doGet(HttpServletRequestreq, HttpServletResponseresp)
      throws IOException {
      UserServiceuserService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();
      if (user != null) {
      resp.setContentType("text/plain");
      resp.getWriter().println("Hello, " + user.getNickname());
      } else {
      resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
      }
      }
      }
    • Other Services
      Datastore
      Database with JDO and JPA access
      Memcache
      Implements Jcache
      URL Fetch
      Or just use java.net.URLConnection
      Images
      Image editing capabilities
      Jobs
      Google Accounts
    • Using JPA
      <?xml version="1.0" encoding="UTF-8" ?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
      <persistence-unit name="transactions-optional">
      <provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider>
      <properties>
      <property name="datanucleus.NontransactionalRead" value="true"/>
      <property name="datanucleus.NontransactionalWrite" value="true"/>
      <property name="datanucleus.ConnectionURL" value="appengine"/>
      </properties>
      </persistence-unit>
      </persistence>
    • Getting EntityManager
      import javax.persistence.EntityManagerFactory;
      import javax.persistence.Persistence;
      public final class EMF {
      private static final EntityManagerFactoryemfInstance =
      Persistence.createEntityManagerFactory("transactions-optional");
      private EMF() {}
      public static EntityManagerFactory get() {
      return emfInstance;
      }
      }
    • Uploading
      Register at https://appengine.google.com/
      Deploy from your eclipse environment
      Access at http://application-id.appspot.com/
    • App Engine Sandbox
      An App Engine application cannot:
      write to the filesystem. Applications must use the App Engine datastore for storing persistent data. Reading from the filesystem is allowed, and all application files uploaded with the application are available.
      open a socket or access another host directly. An application can use the App Engine URL fetch service to make HTTP and HTTPS requests to other hosts on ports 80 and 443, respectively.
      spawn a sub-process or thread. A web request to an application must be handled in a single process within a few seconds. Processes that take a very long time to respond are terminated to avoid overloading the web server.
      make other kinds of system calls.