SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Downloaden Sie, um offline zu lesen
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@

Weitere ähnliche Inhalte

Was ist angesagt?

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 .
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Kürzlich hochgeladen (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

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 ” ” ” ”