Your SlideShare is downloading. ×
0
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Alphageeks IL #2 Google App Engine
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Alphageeks IL #2 Google App Engine

1,112

Published on

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/

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,112
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Google App Engine
    לירן זילכה
    מנכ"ל משותף
    Liran.zelkha@alunasoft.com
  • 2. Aluna
    Israel’s leading Java/JavaEE and SOA consulting company
    Customers:
  • 3. 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
  • 4. App Engine Project
    A standard JavaEE WAR file
  • 5. 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");
    }
    }
  • 6. 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>
  • 7. 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>
  • 8. Run/Debug
    Web server runtime comes with the plugins
  • 9. 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()));
    }
    }
    }
  • 10. 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
  • 11. 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>
  • 12. 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;
    }
    }
  • 13. Uploading
    Register at https://appengine.google.com/
    Deploy from your eclipse environment
    Access at http://application-id.appspot.com/
  • 14. 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.

×