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

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro 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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

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)