Gaej For Beginners

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Gaej For Beginners - Presentation Transcript

    1. Google App Engine for Java Java shin1ogawa@
    2. • Platform • • • • • Datastore • • •
    3. Platform
    4. Platform • • Disk • • AppEngine • Google Apps Apps
    5. Platform • Google • Google •
    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. 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
    14. 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
    15. 3 • http://tech.topgate.co.jp/ : AppEngineSDK Hackathon Googler
    16. • 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 …
    17. • • SDK local_db.bin( ) SDK • local_db.bin AppID local_db.bin k • Maven • mvnsearch appengine • shin1ogawa Maven SDK plugin
    18. • • java.util.logging • war/WEB-INF/appengine-web.xml logging.properties • ...shin1ogawa
    19. 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
    20. appengine-web.xml • on/off • https on/off ...1.2.6 on • static • • logging.properties • web.xml
    21. Datastore
    22. Datastore • Kind...RDB • Entity...RDB • Property...RDB • Index...RDB • Key...Entity • Filter...SQL Where • equality filter... ”=” Filter • inequality filter...”>”, “>=”, “<=”, “<“ • Entity Group... Entity
    23. Datastore • BigTable • ... • RDB • ( = key ) • [0]id=1, name=”Hoge” • [1]id=2, height=170.5, weight=65.5 • [2]id=3, tag=[“Apple”, “Java”] •
    24. Datastore • • Entity 80ms/1 • RDB Index • Entity • • Query ( ) •
    25. Datastore • • Entity 80ms/1 • RDB Index • Entity • • Query ( ) •
    26. 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
    27. 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”)
    28. Datastore Property • Entity • java.lang • String 500 • Text • 500 String • Blob • • List Property •
    29. 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
    30. Datastore Transaction • ACID • • JDO • • Transaction EntityGroup Entity •
    31. Datastore Query • ’<‘, ‘<=’, ‘==’, ‘>=’, ‘>’ • Like (startsWith()) • And • Java ‘IN’, ‘!=’ • Property inequality filter Property • max() min() • Join
    32. Datastore Query • Index ! Index • Kind Index, Single Property Index Datastore • Composite Index datastore-indexes.xml
    33. Datastore NG • • ID • 1,2,3,1001,1002... • • 1000 • JDO 1000 Google tips ” ”
    34. Datastore • • • • Kind • EntityGroup ( Transaction ) • Transaction •
    35. 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
    36. 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
    37. 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(); }
    38. 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);
    39. Datastore JDO/ • • transient, hollow, persistent/detached • JDOHelper#getObjectState() • PersistenceManager InstanceLifecycleListener • PersistenceManager#execute() List serialize • PersistenceManager#retrieve[All]() Property fetch
    40. 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
    41. 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__”
    42. 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");
    43. 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>
    44. 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>
    45. • MailService • ( Servlet ) • XMPPService • ( Servlet ) • URLFetchService • ImageService • UserService • Google Account • Google appengine-java ML
    46. UI • UI … … • Google App Engine ” ” ” ”
    47. shin1ogawa@
    SlideShare Zeitgeist 2009

    + Shinichi OgawaShinichi Ogawa Nominate

    custom

    352 views, 0 favs, 2 embeds more stats

    1時間コースの入門編の資料です。

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 352
      • 247 on SlideShare
      • 105 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 4
    Most viewed embeds
    • 65 views on https://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com
    • 40 views on http://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com

    more

    All embeds
    • 65 views on https://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com
    • 40 views on http://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories