SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
Google App
Engine for Java
       Java




 shin1ogawa@
• Platform
    •
    •

•
•
• Datastore
    •
    •
•
Platform
Platform

•


    •    Disk

•
    •   AppEngine



• Google Apps       Apps
Platform

• Google


• Google
•
Platform

•
    •
                    JVM        …

•                   Platform
    •

•


    •   AppEngine
Platform

•                               WebContainer
• static                   FrontEnd
•
    •   DatastoreService
    •   MailService
    •   URLFetchService
    •   ImageService...
Platform

•



     /            , CPU
         , DISK
    , API         ,
                      ...
Platform
“                        ”
• 1
                                         1
    •                        ”release”
            ”snapshot”       …
        •   http://myappid.appspot.com/ ...
        •   http://snapthot.latest.myappid.appspot.com/ ...

•


        •   datastore
        •                           python         java
Platform
Web
• JVM           JDK1.6      Hotspot Client VM
• Jetty


    •   Jetty       JEE           App Engine


    •   Jetty   Comet       (30                stream   )

•                       =           JVM


    •              static
Platform

•
    • Disk
•
• API
• Java




     : http://code.google.com/intl/ja/appengine/docs/quotas.html
Platform
Java
•
• Thread
• Socket
• JDK                  class
    •   white-list                class              -> http://
        code.google.com/intl/ja/appengine/docs/java/jrewhitelist.html
•               GC
• ...
1
•          : Google
•
    •   Best practices for writing scalable applications
    •

• Google Group
    •   Google App Engine for Java
    •   Google App Engine
    •   Google-App-Engine-Japan
• Google Code
    •   googleappengine
• Google I/O
2
• Google App Engine Blog
• AppEngine Cookbook
• appengine java night (                              ?)
    •
    •                             tips
    •
    •
    •   shin1ogawa

•             1,     3        IRC                   Office Hour
    •   irc://irc.freenode.net/#appengine
    •   Google Calendar: delevepoer-calendar@google.com
3




• http://tech.topgate.co.jp/

       : AppEngineSDK
                    Hackathon   Googler
• Google Plugins for Eclipse(SDK                                     )
 •                                                   Eclipse
 •   AppEngine              !                        (       )

• Ant(SDK                               )
 •   dev_appserver
 •   app_cfg         AppEngine

• Python          SDK(JavaSDK                                                )
 •   index   vacuum(Index       Error                            )
 •   bulkloader(Datastore                   Export/Import)

• NetBeans         IntelliJ IDEA                    plugin               …
•
• SDK
                                     local_db.bin(
                )    SDK
    •                 local_db.bin    AppID
              local_db.bin             k

• Maven
    •   mvnsearch             appengine
    •   shin1ogawa   Maven   SDK           plugin
•


•                     java.util.logging


    •   war/WEB-INF/appengine-web.xml      logging.properties



•
                           ...shin1ogawa
appengine
• war/WEB-INF/
  • appengine-web.xml
   ...appengine

  • datastore-indexes.xml              ...   index

  • cron.xml      ...cron

  • queue.xml      ...taskqueue

  • appegnine-generated/
    • datastore-indexes-auto.xml
     ...             index

   • local_db.bin           ...Datastore
appengine-web.xml
•              on/off
• https    on/off       ...1.2.6      on

•                            static


•


• logging.properties
•          web.xml
Datastore
Datastore

• Kind...RDB
• Entity...RDB
• Property...RDB
• Index...RDB
• Key...Entity
• Filter...SQL     Where
 • equality filter...          ”=”    Filter
  • inequality filter...”>”, “>=”, “<=”, “<“
• Entity Group...                 Entity
Datastore

• BigTable
 • ...

• RDB
 •    (     =         key                   )
     • [0]id=1, name=”Hoge”
     • [1]id=2, height=170.5, weight=65.5
     • [2]id=3, tag=[“Apple”, “Java”]
 •
Datastore

•
    •         Entity     80ms/1
    • RDB     Index
•               Entity


•
    • Query
                           (      )
    •
Datastore

•
    •         Entity     80ms/1
    • RDB     Index
•               Entity


•
    • Query
                           (      )
    •
Datastore
Entity Group
•                               Entity
    • RDB               Relation
    • Java
    •       )
        •           Kind:Entity:id=1
            •         Kind:Entity:id=2
                •       Kind:Entity:id=3
        •           Kind:Entity:id=4
            •         Kind:Entity:id=5
Datastore
Key
• Entity                          Property
 • Long    (id)    String    (name)   Key    Id


• EntityGroup                                     Entity   Key
       Entity
 •    Entity: Kind=Parent, id=1
 •    Entity: Kind=Child, name=“hoge@fuga.com”
 •                Entity    Key
     • Parent(1)/Child(“hoge@fuga.com”)
Datastore
Property
• Entity
• java.lang
 • String          500
• Text
 • 500            String
• Blob
 •
• List Property
 •
Datastore
Index
• Property
• Kind Index
 • Kind Key                        Index
• Single Property Index
 •        Property                Index
• Composite Index
 •      Property                 Index
• Text     Blob       Index

             (index explosion)             Composite
Property          Index
Datastore
Transaction
•                   ACID
    •
        • JDO
        •
•               Transaction   EntityGroup
        Entity
    •
Datastore
Query
•                   ’<‘, ‘<=’, ‘==’, ‘>=’, ‘>’
• Like                     (startsWith())
•            And
• Java      ‘IN’, ‘!=’
•        Property
    inequality filter                       Property
• max()     min()
• Join
Datastore
Query
• Index
                                 ! Index


 • Kind Index, Single Property Index
            Datastore


 • Composite Index   datastore-indexes.xml
Datastore
NG
•
    •
        ID
    •                            1,2,3,1001,1002...

•
    •                  1000
        •    JDO          1000



        Google                                        tips
                   ”      ”
Datastore

•
    •
    •
•                             Kind
•           EntityGroup       (
    Transaction           )
    •   Transaction
•
Datastore

• JDO, JPA, Low-level API          3
 •               JPA
 • JDO                                     ORM


     •                 Datastore
 •                                     Low-level API
     • JDO             Low-level API
 •         JDO         Low-level API
     JEE                                               ...


                                       Low-level API
Datastore
JDO/Entity
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Entity {
  @Persistent
  @PrimaryKey(valueStrategy = IdGeneratorStrategy.IDENTITY)
  Key id;

    @Persistent String value;
    @Persistent(defaultFetchGroup = “true”) Text text;

    @Persistent(defaultFetchGroup = “true”) List<Child> children;
    @Persistent Key otherEntity;
}

                     Fetch            Fetch
    Entity    List           Owned
     Entity                      Unowned
Datastore
JDO/
PersistentManager pm = ... // PersistentManager        ;
Parent parent = new Parent();
parent.set......
List<Child> children = new ArrayList<Child>();
children.add(child1);
parent.setChildren(children);

try {
  Transaction transaction = pm.currentTransaction();
  transaction.begin();
  pm.makePersistent(parent);
  transaction.commit();
} finally {
  if (transaction.isActive())
    transaction.rollback();
}
Datastore
JDO/
PersistentManager pm = ... // PersistentManager             ;
Query query = pm.newQuery(Entity.class);
query.setFilter(“name == param”);
query.declareParameters(“java.lang.String param”);
query.setOrdering(“name asc, key desc”);
@SuppressWarnings("unchecked")
List<Entity> list = (List<Entity>) query.execute(“hoge”);
...

Key key = KeyFactory.createKey(“Entity”, “keyName”);
Entity entity = pm.getObjectById(Entity.class, key);

Key key = entity.getOtherEntityKey();
OtherEntity otherEntity = pm.getObjectById(OtherEntity.class, key);
Datastore
JDO/
•
    • transient, hollow, persistent/detached
    • JDOHelper#getObjectState()
• PersistenceManager
    InstanceLifecycleListener
• PersistenceManager#execute()       List
    serialize
• PersistenceManager#retrieve[All]()           Property
           fetch
Datastore
Low-level API/
Entity entity = new Entity(“Kind”); // Low-level API   Entity
entity.setProperty(“name”, “hoge”);
entity.setProperty(“height”, 170.5);

DatastoreService service =
  DatastoreServiceFactory.getDatastoreService();
service.put(entity);

Entity[] entities = ....
service.put(entities);


                     Entity
Datastore
Low-level API/
Query query = new Query(“Entity”);
query
  .addFilter(“name”, FilterOperator.GREATER_THAN_OR_EQUAL, “hoge”)
  .addSort("name", SortDirection.ASCENDING)
  .addSort("__key__", SortDirection.ASCENDING);

DatastoreService service =
  DatastoreServiceFactory.getDatastoreService();
List<Entity> entities = service.prepare(query).asList(
  FetchOptions.Builder.withOffset(0));

Key key = KeyFactory.createKey(“Entity”, “keyName”);
Entity entity = service.get(key);


             property   ”__key__”
MemcacheService
•
    •           (                  )
    •

• cache
•            JCache(javax.cache), Low-level API      2


    MemcacheService service =
      MemcacheServiceFactory.getMemcacheService();
    service.put("key", list);
    Object cachedObject = service.get("key");
    service.delete("key");
cron
•
    •                URL                     Servlet
•
•
    cron.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <cronentries>
      <cron>
        <url>/cron/fetch?name=jiemamy-sf</url>
        <description>fetch the jiemamy SF.jp timeline.</description>
        <schedule>every 1 minutes</schedule>
      </cron>
    </cronentries>
TaskQueue
•        (task)


    •                URL                     Servlet
•
    queue.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <queue-entries>
      <queue>
        <name>default</name>
        <rate>1/s</rate>
        <bucket-size>3</bucket-size>
      </queue>
    </queue-entries>
• MailService
 •           (        Servlet        )

• XMPPService
 •                    (         Servlet       )

• URLFetchService
• ImageService
• UserService
 •   Google Account
 •           Google
                          appengine-java ML
UI


•         UI                            …
                                …


•


    Google App Engine   ”   ”       ”
     ”
shin1ogawa@

Más contenido relacionado

La actualidad más candente

Effiziente persistierung
Effiziente persistierungEffiziente persistierung
Effiziente persistierungThorben Janssen
 
Killing Shark-Riding Dinosaurs with ORM
Killing Shark-Riding Dinosaurs with ORMKilling Shark-Riding Dinosaurs with ORM
Killing Shark-Riding Dinosaurs with ORMOrtus Solutions, Corp
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
ITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormOrtus Solutions, Corp
 
Omnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsOmnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsJustin Edelson
 
Sigfox API Documentation
Sigfox API DocumentationSigfox API Documentation
Sigfox API DocumentationRod Hemphill
 
State of search | drupalcon dublin
State of search | drupalcon dublinState of search | drupalcon dublin
State of search | drupalcon dublinJoris Vercammen
 
ERRest - The Next Steps
ERRest - The Next StepsERRest - The Next Steps
ERRest - The Next StepsWO Community
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesWerner Keil
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"George Stathis
 
Slides python elixir
Slides python elixirSlides python elixir
Slides python elixirAdel Totott
 
Scala ActiveRecord
Scala ActiveRecordScala ActiveRecord
Scala ActiveRecordscalaconfjp
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java AppenginePatrick Chanezon
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOSjimmyatmedium
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineYared Ayalew
 
Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007Rabble .
 

La actualidad más candente (20)

Effiziente persistierung
Effiziente persistierungEffiziente persistierung
Effiziente persistierung
 
Killing Shark-Riding Dinosaurs with ORM
Killing Shark-Riding Dinosaurs with ORMKilling Shark-Riding Dinosaurs with ORM
Killing Shark-Riding Dinosaurs with ORM
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
ITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cbormITB2017 - Slaying the ORM dragons with cborm
ITB2017 - Slaying the ORM dragons with cborm
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Omnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the ThingsOmnisearch in AEM 6.2 - Search All the Things
Omnisearch in AEM 6.2 - Search All the Things
 
Sigfox API Documentation
Sigfox API DocumentationSigfox API Documentation
Sigfox API Documentation
 
State of search | drupalcon dublin
State of search | drupalcon dublinState of search | drupalcon dublin
State of search | drupalcon dublin
 
ERRest - The Next Steps
ERRest - The Next StepsERRest - The Next Steps
ERRest - The Next Steps
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"
 
ORM Pink Unicorns
ORM Pink UnicornsORM Pink Unicorns
ORM Pink Unicorns
 
Slides python elixir
Slides python elixirSlides python elixir
Slides python elixir
 
Scala ActiveRecord
Scala ActiveRecordScala ActiveRecord
Scala ActiveRecord
 
Jquery
JqueryJquery
Jquery
 
Google Developer Days Brazil 2009 - Java Appengine
Google Developer Days Brazil 2009 -  Java AppengineGoogle Developer Days Brazil 2009 -  Java Appengine
Google Developer Days Brazil 2009 - Java Appengine
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
ERRest
ERRestERRest
ERRest
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007Introduction to Active Record - Silicon Valley Ruby Conference 2007
Introduction to Active Record - Silicon Valley Ruby Conference 2007
 

Destacado

2011 12-07 ragtech2011
2011 12-07 ragtech20112011 12-07 ragtech2011
2011 12-07 ragtech2011Shinichi Ogawa
 
Appengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btAppengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btShinichi Ogawa
 
Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Shinichi Ogawa
 
Appengine Java Night #2 LT
Appengine Java Night #2 LTAppengine Java Night #2 LT
Appengine Java Night #2 LTShinichi Ogawa
 
Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 LtShinichi Ogawa
 
Devlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaDevlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaShinichi Ogawa
 
Appengine Java Night #2b
Appengine Java Night #2bAppengine Java Night #2b
Appengine Java Night #2bShinichi Ogawa
 
Java cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaJava cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaShinichi Ogawa
 
Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Shinichi Ogawa
 
Appengine ja-night#13bt
Appengine ja-night#13btAppengine ja-night#13bt
Appengine ja-night#13btShinichi Ogawa
 
Appengine Java Night #2a
Appengine Java Night #2aAppengine Java Night #2a
Appengine Java Night #2aShinichi Ogawa
 
2011 01 16 NIS Training (Chcuk Generic)
2011 01 16 NIS Training (Chcuk Generic)2011 01 16 NIS Training (Chcuk Generic)
2011 01 16 NIS Training (Chcuk Generic)Stuart McCully
 
GCP Refresher Training (Chcuk) V2
GCP Refresher Training (Chcuk) V2GCP Refresher Training (Chcuk) V2
GCP Refresher Training (Chcuk) V2Stuart McCully
 
Using Facebook to Help Your Business
Using Facebook to Help Your BusinessUsing Facebook to Help Your Business
Using Facebook to Help Your BusinessDaniel Laird
 

Destacado (15)

2011 12-07 ragtech2011
2011 12-07 ragtech20112011 12-07 ragtech2011
2011 12-07 ragtech2011
 
Appengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 btAppengine ja-night-sapporo#1 bt
Appengine ja-night-sapporo#1 bt
 
Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1
 
Appengine Java Night #2 LT
Appengine Java Night #2 LTAppengine Java Night #2 LT
Appengine Java Night #2 LT
 
Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
 
Devlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaDevlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawa
 
Appengine Java Night #2b
Appengine Java Night #2bAppengine Java Night #2b
Appengine Java Night #2b
 
Java cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaJava cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawa
 
Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010
 
Appengine ja-night#13bt
Appengine ja-night#13btAppengine ja-night#13bt
Appengine ja-night#13bt
 
Appengine Java Night #2a
Appengine Java Night #2aAppengine Java Night #2a
Appengine Java Night #2a
 
2011 01 16 NIS Training (Chcuk Generic)
2011 01 16 NIS Training (Chcuk Generic)2011 01 16 NIS Training (Chcuk Generic)
2011 01 16 NIS Training (Chcuk Generic)
 
GCP Refresher Training (Chcuk) V2
GCP Refresher Training (Chcuk) V2GCP Refresher Training (Chcuk) V2
GCP Refresher Training (Chcuk) V2
 
Using Facebook to Help Your Business
Using Facebook to Help Your BusinessUsing Facebook to Help Your Business
Using Facebook to Help Your Business
 
Liferay
LiferayLiferay
Liferay
 

Similar a Gaej For Beginners

Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitationsTomáš Holas
 
Client-side MVC with Backbone.js
Client-side MVC with Backbone.js Client-side MVC with Backbone.js
Client-side MVC with Backbone.js iloveigloo
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門潤一 加藤
 
Django Overview
Django OverviewDjango Overview
Django OverviewBrian Tol
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without InterferenceTony Tam
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache UsergridDavid M. Johnson
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)Doris Chen
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaArun Gupta
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in schoolMichael Galpin
 
Python - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguagePython - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguageTsungWei Hu
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery EssentialsMark Rackley
 
Cross platform Mobile development on Titanium
Cross platform Mobile development on TitaniumCross platform Mobile development on Titanium
Cross platform Mobile development on TitaniumYiguang Hu
 

Similar a Gaej For Beginners (20)

Google App Engine - exploiting limitations
Google App Engine - exploiting limitationsGoogle App Engine - exploiting limitations
Google App Engine - exploiting limitations
 
Client-side MVC with Backbone.js
Client-side MVC with Backbone.js Client-side MVC with Backbone.js
Client-side MVC with Backbone.js
 
コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門コードで学ぶドメイン駆動設計入門
コードで学ぶドメイン駆動設計入門
 
Django Overview
Django OverviewDjango Overview
Django Overview
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
How to Contribute to Apache Usergrid
How to Contribute to Apache UsergridHow to Contribute to Apache Usergrid
How to Contribute to Apache Usergrid
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 IndiaUsing the latest Java Persistence API 2 Features - Tech Days 2010 India
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in school
 
Extjs + Gears
Extjs + GearsExtjs + Gears
Extjs + Gears
 
Python - A Comprehensive Programming Language
Python - A Comprehensive Programming LanguagePython - A Comprehensive Programming Language
Python - A Comprehensive Programming Language
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
Cross platform Mobile development on Titanium
Cross platform Mobile development on TitaniumCross platform Mobile development on Titanium
Cross platform Mobile development on Titanium
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Gaej For Beginners

  • 1. Google App Engine for Java Java shin1ogawa@
  • 2. • Platform • • • • • Datastore • • •
  • 4. Platform • • Disk • • AppEngine • Google Apps Apps
  • 6. Platform • • JVM … • Platform • • • AppEngine
  • 7. Platform • WebContainer • static FrontEnd • • DatastoreService • MailService • URLFetchService • ImageService...
  • 8. Platform • / , CPU , DISK , API , ...
  • 9. Platform “ ” • 1 1 • ”release” ”snapshot” … • http://myappid.appspot.com/ ... • http://snapthot.latest.myappid.appspot.com/ ... • • datastore • python java
  • 10. Platform Web • JVM JDK1.6 Hotspot Client VM • Jetty • Jetty JEE App Engine • Jetty Comet (30 stream ) • = JVM • static
  • 11. Platform • • Disk • • API • Java : http://code.google.com/intl/ja/appengine/docs/quotas.html
  • 12. Platform Java • • Thread • Socket • JDK class • white-list class -> http:// code.google.com/intl/ja/appengine/docs/java/jrewhitelist.html • GC • ...
  • 13.
  • 14. 1 • : Google • • Best practices for writing scalable applications • • Google Group • Google App Engine for Java • Google App Engine • Google-App-Engine-Japan • Google Code • googleappengine • Google I/O
  • 15. 2 • Google App Engine Blog • AppEngine Cookbook • appengine java night ( ?) • • tips • • • shin1ogawa • 1, 3 IRC Office Hour • irc://irc.freenode.net/#appengine • Google Calendar: delevepoer-calendar@google.com
  • 16. 3 • http://tech.topgate.co.jp/ : AppEngineSDK Hackathon Googler
  • 17.
  • 18. • Google Plugins for Eclipse(SDK ) • Eclipse • AppEngine ! ( ) • Ant(SDK ) • dev_appserver • app_cfg AppEngine • Python SDK(JavaSDK ) • index vacuum(Index Error ) • bulkloader(Datastore Export/Import) • NetBeans IntelliJ IDEA plugin …
  • 19. • • SDK local_db.bin( ) SDK • local_db.bin AppID local_db.bin k • Maven • mvnsearch appengine • shin1ogawa Maven SDK plugin
  • 20. • • java.util.logging • war/WEB-INF/appengine-web.xml logging.properties • ...shin1ogawa
  • 21. appengine • war/WEB-INF/ • appengine-web.xml ...appengine • datastore-indexes.xml ... index • cron.xml ...cron • queue.xml ...taskqueue • appegnine-generated/ • datastore-indexes-auto.xml ... index • local_db.bin ...Datastore
  • 22. appengine-web.xml • on/off • https on/off ...1.2.6 on • static • • logging.properties • web.xml
  • 24. Datastore • Kind...RDB • Entity...RDB • Property...RDB • Index...RDB • Key...Entity • Filter...SQL Where • equality filter... ”=” Filter • inequality filter...”>”, “>=”, “<=”, “<“ • Entity Group... Entity
  • 25. Datastore • BigTable • ... • RDB • ( = key ) • [0]id=1, name=”Hoge” • [1]id=2, height=170.5, weight=65.5 • [2]id=3, tag=[“Apple”, “Java”] •
  • 26. Datastore • • Entity 80ms/1 • RDB Index • Entity • • Query ( ) •
  • 27. Datastore • • Entity 80ms/1 • RDB Index • Entity • • Query ( ) •
  • 28. Datastore Entity Group • Entity • RDB Relation • Java • ) • Kind:Entity:id=1 • Kind:Entity:id=2 • Kind:Entity:id=3 • Kind:Entity:id=4 • Kind:Entity:id=5
  • 29. Datastore Key • Entity Property • Long (id) String (name) Key Id • EntityGroup Entity Key Entity • Entity: Kind=Parent, id=1 • Entity: Kind=Child, name=“hoge@fuga.com” • Entity Key • Parent(1)/Child(“hoge@fuga.com”)
  • 30. Datastore Property • Entity • java.lang • String 500 • Text • 500 String • Blob • • List Property •
  • 31. Datastore Index • Property • Kind Index • Kind Key Index • Single Property Index • Property Index • Composite Index • Property Index • Text Blob Index (index explosion) Composite Property Index
  • 32. Datastore Transaction • ACID • • JDO • • Transaction EntityGroup Entity •
  • 33. Datastore Query • ’<‘, ‘<=’, ‘==’, ‘>=’, ‘>’ • Like (startsWith()) • And • Java ‘IN’, ‘!=’ • Property inequality filter Property • max() min() • Join
  • 34. Datastore Query • Index ! Index • Kind Index, Single Property Index Datastore • Composite Index datastore-indexes.xml
  • 35. Datastore NG • • ID • 1,2,3,1001,1002... • • 1000 • JDO 1000 Google tips ” ”
  • 36. Datastore • • • • Kind • EntityGroup ( Transaction ) • Transaction •
  • 37. Datastore • JDO, JPA, Low-level API 3 • JPA • JDO ORM • Datastore • Low-level API • JDO Low-level API • JDO Low-level API JEE ... Low-level API
  • 38. Datastore JDO/Entity @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Entity { @Persistent @PrimaryKey(valueStrategy = IdGeneratorStrategy.IDENTITY) Key id; @Persistent String value; @Persistent(defaultFetchGroup = “true”) Text text; @Persistent(defaultFetchGroup = “true”) List<Child> children; @Persistent Key otherEntity; } Fetch Fetch Entity List Owned Entity Unowned
  • 39. Datastore JDO/ PersistentManager pm = ... // PersistentManager ; Parent parent = new Parent(); parent.set...... List<Child> children = new ArrayList<Child>(); children.add(child1); parent.setChildren(children); try { Transaction transaction = pm.currentTransaction(); transaction.begin(); pm.makePersistent(parent); transaction.commit(); } finally { if (transaction.isActive()) transaction.rollback(); }
  • 40. Datastore JDO/ PersistentManager pm = ... // PersistentManager ; Query query = pm.newQuery(Entity.class); query.setFilter(“name == param”); query.declareParameters(“java.lang.String param”); query.setOrdering(“name asc, key desc”); @SuppressWarnings("unchecked") List<Entity> list = (List<Entity>) query.execute(“hoge”); ... Key key = KeyFactory.createKey(“Entity”, “keyName”); Entity entity = pm.getObjectById(Entity.class, key); Key key = entity.getOtherEntityKey(); OtherEntity otherEntity = pm.getObjectById(OtherEntity.class, key);
  • 41. Datastore JDO/ • • transient, hollow, persistent/detached • JDOHelper#getObjectState() • PersistenceManager InstanceLifecycleListener • PersistenceManager#execute() List serialize • PersistenceManager#retrieve[All]() Property fetch
  • 42. Datastore Low-level API/ Entity entity = new Entity(“Kind”); // Low-level API Entity entity.setProperty(“name”, “hoge”); entity.setProperty(“height”, 170.5); DatastoreService service = DatastoreServiceFactory.getDatastoreService(); service.put(entity); Entity[] entities = .... service.put(entities); Entity
  • 43. Datastore Low-level API/ Query query = new Query(“Entity”); query .addFilter(“name”, FilterOperator.GREATER_THAN_OR_EQUAL, “hoge”) .addSort("name", SortDirection.ASCENDING) .addSort("__key__", SortDirection.ASCENDING); DatastoreService service = DatastoreServiceFactory.getDatastoreService(); List<Entity> entities = service.prepare(query).asList( FetchOptions.Builder.withOffset(0)); Key key = KeyFactory.createKey(“Entity”, “keyName”); Entity entity = service.get(key); property ”__key__”
  • 44.
  • 45. MemcacheService • • ( ) • • cache • JCache(javax.cache), Low-level API 2 MemcacheService service = MemcacheServiceFactory.getMemcacheService(); service.put("key", list); Object cachedObject = service.get("key"); service.delete("key");
  • 46. cron • • URL Servlet • • cron.xml <?xml version="1.0" encoding="UTF-8"?> <cronentries> <cron> <url>/cron/fetch?name=jiemamy-sf</url> <description>fetch the jiemamy SF.jp timeline.</description> <schedule>every 1 minutes</schedule> </cron> </cronentries>
  • 47. TaskQueue • (task) • URL Servlet • queue.xml <?xml version="1.0" encoding="UTF-8"?> <queue-entries> <queue> <name>default</name> <rate>1/s</rate> <bucket-size>3</bucket-size> </queue> </queue-entries>
  • 48. • MailService • ( Servlet ) • XMPPService • ( Servlet ) • URLFetchService • ImageService • UserService • Google Account • Google appengine-java ML
  • 49. UI • UI … … • Google App Engine ” ” ” ”