SlideShare a Scribd company logo
1 of 23
Download to read offline
appengine
java night #2
  Low-Level API ~   ~

 shin1ogawa@
...shin1ogawa
Google, Java, AppEngine, Eclipse,
Wicket, Maven, Hudson,        ...
•               OSS

    •   [SF.jp]Jiemamy...

    •   [SF.jp]gae-j-samples...GAE/J          GAE/J/Maven

    •   [SF.jp]gaejtools...GAE/J

    •   [SF.jp]asclipse...Amateras AIR GEAR   AS3

    •   java-ja, wicket-ja,

                              (http://www.topgate.co.jp)
         GoogleAppEngine           GoogleApps
Low-Level API
  #1
) Key
• Key          EntityGroup
    • Entity          EntityGroup      …


• Key
    • ApplicationID
    • Entity Key,            Kind
    • name       or             long
•
) KeyFactory

•         createKey()         Key


• keyToString()         Key


• stringToKey()
          Key
) Entity
• setProperty(“           ”, Object          )
• Object getProperty(“            ”)
• boolean hasProperty(“            ”)
    • <missing>
•


    • HashSet       Collection   ArrayList
    • int   Long…
) DatastoreService
•
    • Key put(Entity)
    • List<Key> put(Iterable<Entity>)
•
    • void delete(Key... keys)
    • void delete(Iterable<Key>)
•
    Transaction
) DatastoreService
•
    • Entity get(Key key)
     •           Key
         EntityNotFoundException

    • Map<Key, Entity> get(
        Iterable<Key> key)
     •           Key
         Map
) DatastoreService
• Transaction    ,
  • beginTransaction()
  • getCurrentTransaction()
  • ...
 • Transaction
  • commit()
  • rollback()
  • isActive()
) DatastoreService
• 1.2.5        Key
 Entity                   Key
           1.2.5
     Key
  • KeyRange allocalteIds(
      [ Key], Kind,             )
 • KeyRange
   • getStart(), getEnd(), iterator()
Datastore Service
                 (Entity           )
KeyRange parentKeys =
  service.allocateIds("Parent", 1);
Key parentKey =
  parentKeys.getStart();
KeyRange childKeys =
  service.allocateIds(parentKey, "Child", 2);
Iterator<Key> childKeysIterator =
  childKeys.iterator();
Entity parent = new Entity(parentKey);
Entity child1 = new Entity(childKeys.next());
Entity child2 = new Entity(childKeys.next());
Datastore Service
                (      )

Transaction tx = service.beginTransaction();
try {
  List<Entity> entities =
    Arrays.asList(parent, child1, child2
  service.put(tx, entities);
  tx.commit();
} finally {
  if (tx.isActive()) { tx.rollback(); }
}
Low-Level API
      #2
Datastore Service
Query
• new Query(String kind)
  • JDO
• new Query(String kind, Key ancestorKey)
  •       Kind


• new Query(Key ancestorKey)
  •                                         Kind


   •
Datastore Service
Query
•
    • Query addFilter(String propertyName,
        FilterOperator operator, Object value)
•
    • Query addSort(String propertyName,
        SortDirection direction)
•
    • Query setKeysOnly()
      • Key

                      Entity.KEY_RESERVED_PROPERTY
Datastore Service
PreparedQuery
• DatastoreService#prepare()       Query
                  PreaparedQuery
•
    • int countEntities()
•
    • Entity asSingleResult()
      •                            null
     •       Entity
         TooManyResultsException
Datastore Service
PreparedQuery
•
    • List<Entity> asList(FetchOptions)
      •
    • Iterator<Entity> asIterator([FetchOptions])
      •
    • Iterable<Entity> asIterable([FetchOptions])
      • iterator()             Datastore
                     asIterator()
• FetchOptions
  •                          offset, limit
Datastore Service
Query
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).limit(100));
Datastore Service
Query              : EntityGroup
Iterator<Entity> entityGroup =
  service.prepare(new Query(rootKey)
   .addSort(“__key__”)).asIterator(
  FetchOptions.Builder.withOffset(0).limit(100));
Parent parent = null;
while (entityGroup.hasNext) {
 Entity entity = entityGroup.next();
 if (entity.getKind().equals(“Parent”))
  parent = EntityUtil.toBean(entity,Parent.class);
 else if (entity.getKind().equals(“Child”))
  parent.getChidren().add(
   EntityUtil.toBean(entity, Child.class);
 ...
Datastore Service
          JDO
JDO

class MyEntity {
  List<Child> children1;
  List<Child> children2;
}
myEntity.getChildren1().addAll(childA, childB);
myEntity.getChildren2().addAll(childC, childD);
manager.makePersistent(myEntity);

                     List
Datastore Service
            JDO
MyEntity myEntity =
  manager.getObjectById(MyEntity.class, key);
List<Child> children1 =
  myEntity.getChildren1();
List<Child> children2 =
  myEntity.getChildren2();

         children1   childA   childB
childC    childD              children2   null
Datastore Service
       JDO

MyEntiy(1)                    Child
                      (A-D)
MyEntiy(1)/Child(A)

MyEntiy(1)/Child(B)

MyEntiy(1)/Child(C)

MyEntiy(1)/Child(D)
shin1ogawa@

More Related Content

What's hot

ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っているTakahiro Kobaru
 
WaveEngine 2D components
WaveEngine 2D componentsWaveEngine 2D components
WaveEngine 2D componentswaveengineteam
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testingVincent Pradeilles
 
WaveEngine 3D components
WaveEngine 3D componentsWaveEngine 3D components
WaveEngine 3D componentswaveengineteam
 
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!Donny Wals
 
Source Code for Dpilot
Source Code for Dpilot Source Code for Dpilot
Source Code for Dpilot Nidhi Chauhan
 
Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots DeepAnshu Sharma
 
Python in the database
Python in the databasePython in the database
Python in the databasepybcn
 
Taming the beast - how to tame React & GraphQL, one error at a time
Taming the beast - how to tame React & GraphQL, one error at a timeTaming the beast - how to tame React & GraphQL, one error at a time
Taming the beast - how to tame React & GraphQL, one error at a timeSusanna Wong
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionBruce McPherson
 
What's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementWhat's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementKenichiro Nakamura
 
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesA (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesDavid Wengier
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...SPTechCon
 
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019David Wengier
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Mike Nakhimovich
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210Mahmoud Samir Fayed
 
Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Tsuyoshi Yamamoto
 

What's hot (20)

ReactでGraphQLを使っている
ReactでGraphQLを使っているReactでGraphQLを使っている
ReactでGraphQLを使っている
 
WaveEngine 2D components
WaveEngine 2D componentsWaveEngine 2D components
WaveEngine 2D components
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testing
 
WaveEngine 3D components
WaveEngine 3D componentsWaveEngine 3D components
WaveEngine 3D components
 
Nativescript angular
Nativescript angularNativescript angular
Nativescript angular
 
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!
 
Python database interfaces
Python database  interfacesPython database  interfaces
Python database interfaces
 
Source Code for Dpilot
Source Code for Dpilot Source Code for Dpilot
Source Code for Dpilot
 
Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots Dpilot Source Code With ScreenShots
Dpilot Source Code With ScreenShots
 
Python in the database
Python in the databasePython in the database
Python in the database
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
 
Taming the beast - how to tame React & GraphQL, one error at a time
Taming the beast - how to tame React & GraphQL, one error at a timeTaming the beast - how to tame React & GraphQL, one error at a time
Taming the beast - how to tame React & GraphQL, one error at a time
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstraction
 
What's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancementWhat's new for developers in Dynamics 365 v9: Client API enhancement
What's new for developers in Dynamics 365 v9: Client API enhancement
 
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesA (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
 
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
 
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
 
The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210The Ring programming language version 1.9 book - Part 54 of 210
The Ring programming language version 1.9 book - Part 54 of 210
 
Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察Jggug 2010 330 Grails 1.3 観察
Jggug 2010 330 Grails 1.3 観察
 

Viewers also liked

Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 LtShinichi Ogawa
 
Java cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaJava cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaShinichi Ogawa
 
2011 12-07 ragtech2011
2011 12-07 ragtech20112011 12-07 ragtech2011
2011 12-07 ragtech2011Shinichi Ogawa
 
Appengine Java Night #2 LT
Appengine Java Night #2 LTAppengine Java Night #2 LT
Appengine Java Night #2 LTShinichi Ogawa
 
Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Shinichi Ogawa
 
Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Shinichi Ogawa
 
Devlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaDevlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaShinichi Ogawa
 
Appengine ja-night#13bt
Appengine ja-night#13btAppengine ja-night#13bt
Appengine ja-night#13btShinichi Ogawa
 
初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料Shinichi 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
 
App Engine と いまどきのPHP
App Engine と いまどきのPHPApp Engine と いまどきのPHP
App Engine と いまどきのPHPsokamo1975
 
appengine java night #1
appengine java night #1appengine java night #1
appengine java night #1Shinichi Ogawa
 
Using Facebook to Help Your Business
Using Facebook to Help Your BusinessUsing Facebook to Help Your Business
Using Facebook to Help Your BusinessDaniel Laird
 

Viewers also liked (16)

Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
 
Java cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawaJava cloud-meeting-2010tokyo-shin1ogawa
Java cloud-meeting-2010tokyo-shin1ogawa
 
2011 12-07 ragtech2011
2011 12-07 ragtech20112011 12-07 ragtech2011
2011 12-07 ragtech2011
 
Appengine Java Night #2 LT
Appengine Java Night #2 LTAppengine Java Night #2 LT
Appengine Java Night #2 LT
 
Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1Appengine ja-night-sapporo#1
Appengine ja-night-sapporo#1
 
Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010Java Cloud Meeting Fukuoka 2010
Java Cloud Meeting Fukuoka 2010
 
Devlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawaDevlove hangar flight-wintersortie-shin1ogawa
Devlove hangar flight-wintersortie-shin1ogawa
 
Appengine ja-night#13bt
Appengine ja-night#13btAppengine ja-night#13bt
Appengine ja-night#13bt
 
初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料初心者向けGAE/Java説明資料
初心者向けGAE/Java説明資料
 
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
 
App Engine と いまどきのPHP
App Engine と いまどきのPHPApp Engine と いまどきのPHP
App Engine と いまどきのPHP
 
Gaej For Beginners
Gaej For BeginnersGaej For Beginners
Gaej For Beginners
 
appengine java night #1
appengine java night #1appengine java night #1
appengine java night #1
 
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 to Appengine Java Night #2a

jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
PHP security audits
PHP security auditsPHP security audits
PHP security auditsDamien Seguy
 
Introducing CakeEntity
Introducing CakeEntityIntroducing CakeEntity
Introducing CakeEntityBasuke Suzuki
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Kenji HASUNUMA
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Kenji HASUNUMA
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Rob Windsor
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 
レガシーコード改善ガイド
レガシーコード改善ガイドレガシーコード改善ガイド
レガシーコード改善ガイドMaki Toshio
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL StandardOtávio Santana
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL StandardOtavio Santana
 
Phoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるPhoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるTakahiro Kobaru
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldChristian Melchior
 
How to write easy-to-test JavaScript
How to write easy-to-test JavaScriptHow to write easy-to-test JavaScript
How to write easy-to-test JavaScriptYnon Perek
 

Similar to Appengine Java Night #2a (20)

jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
PHP security audits
PHP security auditsPHP security audits
PHP security audits
 
Introducing CakeEntity
Introducing CakeEntityIntroducing CakeEntity
Introducing CakeEntity
 
Requery overview
Requery overviewRequery overview
Requery overview
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
ERRest in Depth
ERRest in DepthERRest in Depth
ERRest in Depth
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
レガシーコード改善ガイド
レガシーコード改善ガイドレガシーコード改善ガイド
レガシーコード改善ガイド
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
 
Let's talk about NoSQL Standard
Let's talk about NoSQL StandardLet's talk about NoSQL Standard
Let's talk about NoSQL Standard
 
Phoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってるPhoenix + Reactで 社内システムを 密かに作ってる
Phoenix + Reactで 社内システムを 密かに作ってる
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Painless Persistence in a Disconnected World
Painless Persistence in a Disconnected WorldPainless Persistence in a Disconnected World
Painless Persistence in a Disconnected World
 
How to write easy-to-test JavaScript
How to write easy-to-test JavaScriptHow to write easy-to-test JavaScript
How to write easy-to-test JavaScript
 

Recently uploaded

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

Appengine Java Night #2a

  • 1. appengine java night #2 Low-Level API ~ ~ shin1ogawa@
  • 2. ...shin1ogawa Google, Java, AppEngine, Eclipse, Wicket, Maven, Hudson, ... • OSS • [SF.jp]Jiemamy... • [SF.jp]gae-j-samples...GAE/J GAE/J/Maven • [SF.jp]gaejtools...GAE/J • [SF.jp]asclipse...Amateras AIR GEAR AS3 • java-ja, wicket-ja, (http://www.topgate.co.jp) GoogleAppEngine GoogleApps
  • 4. ) Key • Key EntityGroup • Entity EntityGroup … • Key • ApplicationID • Entity Key, Kind • name or long •
  • 5. ) KeyFactory • createKey() Key • keyToString() Key • stringToKey() Key
  • 6. ) Entity • setProperty(“ ”, Object ) • Object getProperty(“ ”) • boolean hasProperty(“ ”) • <missing> • • HashSet Collection ArrayList • int Long…
  • 7. ) DatastoreService • • Key put(Entity) • List<Key> put(Iterable<Entity>) • • void delete(Key... keys) • void delete(Iterable<Key>) • Transaction
  • 8. ) DatastoreService • • Entity get(Key key) • Key EntityNotFoundException • Map<Key, Entity> get( Iterable<Key> key) • Key Map
  • 9. ) DatastoreService • Transaction , • beginTransaction() • getCurrentTransaction() • ... • Transaction • commit() • rollback() • isActive()
  • 10. ) DatastoreService • 1.2.5 Key Entity Key 1.2.5 Key • KeyRange allocalteIds( [ Key], Kind, ) • KeyRange • getStart(), getEnd(), iterator()
  • 11. Datastore Service (Entity ) KeyRange parentKeys = service.allocateIds("Parent", 1); Key parentKey = parentKeys.getStart(); KeyRange childKeys = service.allocateIds(parentKey, "Child", 2); Iterator<Key> childKeysIterator = childKeys.iterator(); Entity parent = new Entity(parentKey); Entity child1 = new Entity(childKeys.next()); Entity child2 = new Entity(childKeys.next());
  • 12. Datastore Service ( ) Transaction tx = service.beginTransaction(); try { List<Entity> entities = Arrays.asList(parent, child1, child2 service.put(tx, entities); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } }
  • 14. Datastore Service Query • new Query(String kind) • JDO • new Query(String kind, Key ancestorKey) • Kind • new Query(Key ancestorKey) • Kind •
  • 15. Datastore Service Query • • Query addFilter(String propertyName, FilterOperator operator, Object value) • • Query addSort(String propertyName, SortDirection direction) • • Query setKeysOnly() • Key Entity.KEY_RESERVED_PROPERTY
  • 16. Datastore Service PreparedQuery • DatastoreService#prepare() Query PreaparedQuery • • int countEntities() • • Entity asSingleResult() • null • Entity TooManyResultsException
  • 17. Datastore Service PreparedQuery • • List<Entity> asList(FetchOptions) • • Iterator<Entity> asIterator([FetchOptions]) • • Iterable<Entity> asIterable([FetchOptions]) • iterator() Datastore asIterator() • FetchOptions • offset, limit
  • 18. Datastore Service Query 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).limit(100));
  • 19. Datastore Service Query : EntityGroup Iterator<Entity> entityGroup = service.prepare(new Query(rootKey) .addSort(“__key__”)).asIterator( FetchOptions.Builder.withOffset(0).limit(100)); Parent parent = null; while (entityGroup.hasNext) { Entity entity = entityGroup.next(); if (entity.getKind().equals(“Parent”)) parent = EntityUtil.toBean(entity,Parent.class); else if (entity.getKind().equals(“Child”)) parent.getChidren().add( EntityUtil.toBean(entity, Child.class); ...
  • 20. Datastore Service JDO JDO class MyEntity { List<Child> children1; List<Child> children2; } myEntity.getChildren1().addAll(childA, childB); myEntity.getChildren2().addAll(childC, childD); manager.makePersistent(myEntity); List
  • 21. Datastore Service JDO MyEntity myEntity = manager.getObjectById(MyEntity.class, key); List<Child> children1 = myEntity.getChildren1(); List<Child> children2 = myEntity.getChildren2(); children1 childA childB childC childD children2 null
  • 22. Datastore Service JDO MyEntiy(1) Child (A-D) MyEntiy(1)/Child(A) MyEntiy(1)/Child(B) MyEntiy(1)/Child(C) MyEntiy(1)/Child(D)