SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Practical AtomPub Servers

                   takemaru
Outline
     What’s AtomPub?
 
          Data model
      
          Five Operations: List + CRUD
      
          Role of AtomPub servers
      


     Better choose AtomPub for your Web service?
 
          What’s the difference in RESTful services
      
          Compared with Amazon S3 (Simple Storage Service)
      
          Positioning AtomPub in RESTful services
      


     Catalyst::Controller::Atompub
 
          Makes you forcus on your task
      
          Sample Codes
      


     Summary
 
What’s AtomPub?
  What’s AtomPub?
       Defined in RFC5023
   
       One of REST instances
   
       Web API for publishing and editing Web resources
   
       Based on HTTP transfer of Atom-formatted representations
   


  Services   using AtomPub
       Google: GData, Blogger, OpenSocial
   
       Microsoft: Live Platform
   
       IBM: Lotus Connector
   
       Mixi: mixi station API
   
Data Model
                                                     Workspaces
     Members                                     
 
                                                          Group of Collections
          Web Resources in usual sense                
      
          Entry Resources or Media
      
          Resources
     Collections
 
          Sets of Members                       Members and Collections have their own URIs
      
          Retrieved in whole or in part
      


                         Collection


                                                                                 Member




                                   Workspace
Resources and Representations
                                             Examples:
                       Feed
                                              -  rticles which are
                                               A
                     Document
                                              referred to a category
                      (XML)
  Collection
                                 - mages of an event
                                               I
                     in which there are
                     several Entries


                       Entry
                                             Examples:
                     Document
                                              -  n article in a blog
                                               A
                      (XML)
                                              -  n image
                                               A
    Member              metadata
(Entry or Media)

                         substantial data

   AtomPub          Atom Format                Web Resources
  (RFC5023)
         (RFC4287)
Operations
       Five operations: List + CRUD
   
            Determined by target (URI) and HTTP method
        
                    POST: Creates a new member
                    (Member URI is assigned by the server)




                                               PUT:
                                                                        DELETE:
                                               Updates a member
                                                                        Deletes a member




                                                           GET: Retrieves a member
GET: Lists members in the collection
                                                       Operations against Members
             Operations against Collections
Operations in depth
– Entry and Media Resources
  Entry   and Media Resources
       Two sides of the same coin
   

 POST: Creates a new Member (substantial data)
                                                             PUT: Updates the Member




                                 Entry
                                          link


                                                                 Metadata MUST be updated
               Metadata:                                                   at the same time
               -  escribes attributes of the data: date, author, etc.
                D
               -  as a link to the data
                H
               -  utomatically generated as an Entry by the server
                A
Role of AtomPub Servers
     List + CRUD operations
 
          Supports publishing and editing Web resources
      
          Assigns Member URIs when they are POSTed
      



     Maintenance of metadata
 
          Generates corresponding Entries when POSTed
      
          Updates attributes when the corresponding data is PUTed or DELETEd
      



     Others
 
          Service description in Service Documents (not discussed in my talk)
      
          HTTP processings: Authentication, cache, version control, and error handling
      


      Compared with simple RESTful APIs, AtomPub servers have strong authority
Better choose AtomPub for your Web
service?
  Myths    of AtomPub
     AtomPub is a protocol just for blogging
   
    AtomPub is the best one to publish ANY type of Web
     resources


  Which    service is suited for AtomPub?
       Text-orientd services, such as blogging and SNS?
   
       File management systems including binary data?
   
       Something else?
   
AtomPub is one of REST instances
     AtomPub is one of the REST instances
 
          Don’t choose AtomPub if your service is NOT RESTful
      
          Compare AtomPub with other RESTful APIs if your service is RESTful
      



     Common features of RESTful services (in my talk)
 
          Addresses resources by URIs
      
          CRUD resources by HTTP methods: GET, POST, PUT, and DELETE
      
          Resource type is not an issue: plain-text, XML, images, videos, …
      
          Data model of dataset including several items (see figure)
      


                                                     Set
                                                                        Item
What’s the difference in RESTful APIs? 

     Metadata
 
           Which kinds of metadata are needed?
      
           Where are metadata placed?
      

     URIs
 
           Who determines resource URIs?
      

     Other options
 
           Search queries, representations, etc.
      



      Comparing AtomPub with a contrasting API, Amazon S3

                                 Matrix of metadata and URIs
          URIs  Metadata
 Simple and with data
 Rich and separated from data
          By servers
                                AtomPub
          By clients
         Amazon S3
Amazon S3 (Simple Storage Service)
     Metadata
 
                                                        /yapc.asia
          Placed in HTTP headers
      
                                                                      yapc2008.png
          Line-by-line syntax
      
          Always along with data in HTTP body
      

     URIs
 
          Determined by clients
      
          PUT is requested with a URI to create a resource
      

                                                 URI

                              PUT /yapc.asia/yapc2008.png HTTP/1.1
                              Content-Type: image/png
                 Metadata
    Date: Tue, 15 May 2008 01:23:45 GMT
                              X-Amz-Metadata: …

                     Data

                             Example of HTTP request
AtomPub
     Metadata
 
          Has its own URI and independent from data
                                                                     12345678.atom
          Written in Atom entry
      
                                                                            12345678.png
                                                  /images
     URIs
 
                                                             Entry
          Determined by servers
      




          <?xml version=“1.0” encoding=“utf-8”?>
          <entry xmlns=“http://www.w3.org/2005/Atom”>
           <link rel=“edit” 
                 href=“/images/12345678.atom”/>
           <link rel=“edit-media” 
                 href=“/images/12345678.png”/>
           <content src=“/images/12345678.png” 
                    type=“image/png”/>
           …
          </entry>

                  Metadata: /images/123456578.atom
          Data: /images/12345678.png
Embedded AtomPub
– Actually, this is AtomPub in usual sense
     Metadata
 
          Has it own URI and independent from data
      
                                                                            first_entry.atom
          Written in Atom entry
      
          Text/XML data can be embedded in metadata
      
                eg. atom:content element
            
                                                                       Entry
     URIs
 
                                                        /blog
          Determined by servers
      
          Suggested by requests with Slug header
      

                                POST /blog HTTP/1.1
          URI suggestion
       Slug: first_entry

                                <?xml version=“1.0” encoding=“utf-8”?>
                                <entry xmlns=“http://www.w3.org/2005/Atom”>
                                 <updated>2008-05-15T01:23:45Z</updated>
                 Metadata
       <author><name>yapc</name></author>
                                 …
                     Data
       <content type=“text”>This is my first entry</content>
                                </entry>
                                                                 Example of HTTP request
Positioning AtomPub in RESTful services
     Characteristics of AtomPub
 
           With rich metadata and mainly controlled by servers
      
           Can be changed by embedded content and Slug header options
      


                                 12345678.atom
                          first_entry.atom
                                       12345678.png
                        Entry
                                                                     Entry


                    AtomPub with Media resources
        Amazon S3 and embedded AtomPub
                                 Matrix of metadata and URIs
          URIs  Metadata
 Simple and with data
 Rich and separated from data
                                        embedded
          By servers
                                AtomPub
                                                          Slug header
          By clients
        Amazon S3
Better choose AtomPub for your Web
service?
  Services, which        are suited for AtomPub
       Metadata is represented in XML, especially in Atom Entries
   
          Atom standard elements are required: author, category, copyright, …
        
         Linked to other resources: eg. a blog entry including pictures
         XML vocabularies are used in the metadata: OpenSearch, RDF, …
         Complicated data model is acceptable, or don’t use media resources



       URIs are determined by servers
   
            Or determined based on clients’ suggestions
        



  I
   f you choose AtomPub, go for Catalyst::Controller::Atompub
Catalyst::Controller::Atompub
     A Catalyst controller class for processing AtomPub
 
          Why controller?
      
               AtomPub defines CONTROL flow for publishing and editing Web resources
           


          Tested in AtomPub Interop
      
               July 2007 at Tokyo
           
               Nov 2007 on the Internet
           
               Feb 2008 at Tokyo
           



          Download from CPAN
      
Catalyst::Controller::Atompub
     Makes      you focus on your task (eg. Model implementation)

           Dispatches requests based on URI and HTTP method
       
           Check cache or version of the requested resources (optional)
       
           Validates requested Entry if exists
       
           Determines a new member URI when POST
                                                         by C::C::Atompub


           Stores resources to, or retrieves them from databases
       
           Modifies the resources (optional)
                                                                  Your turn

                                                           by C::C::Atompub
           Constructs HTTP response and sends it to client
       

Can overwrite default behavior
Sample code – Creating resources
  # Attribute :Atompub(create) is required
  sub create_entry :Atompub(create) {
      my($self, $c) = @_;

      # URI of the new Entry, which was determined by C::C::Atompub
      my $uri = $self->entry_resource->uri;

      # datetime, which was assigned by C::C::Atompub
      my $edited = $self->edited;

      # POSTed Entry, an XML::Atom::Entry objcet
      my $entry = $self->entry_resource->body;

      # Creates the new Entry
      $c->model('DBIC::Entries')->create({
          uri    => $uri,
          edited => $edited->epoch,
          xml    => $entry->as_xml,
      });

      # Returns true on success
      return 1;
  }
Sample code – Listing resources
    # Attribute :Atompub(list) is required
    sub get_feed :Atompub(list) {
        my($self, $c) = @_;

         # Skeleton of the Feed, an XML::Atom::Feed objcet,
         # was prepared by C::C::Atompub
         my $feed = $self->collection_resource->body;

         # Retrieve Entries sorted in descending order
         my $rs = $c->model('DBIC::Entries')
                    ->search({}, { order_by => 'edited desc' });

         # Adds Entries to the Feed
         while (my $member = $rs->next) {
             my $entry = XML::Atom::Entry->new($member->xml);
             $feed->add_entry($entry);
         }

         # Returns true on success
         return 1;
    }
Sample code – Changing default URIs
eg. /collection/20080515-012345-123456.atom -> /collection/joe/birthday.atom

 # Changes Edit URIs, that is URIs for Member resources
 sub make_edit_uri {
     my($self, $c, @args) = @_;

      # Default URIs for Entry (and Media) resources
      my($edit_uri, $edit_media_uri) = $self−>NEXT::make_edit_uri($c, @args);

      # Modify the URIs as you like...

      # Returns modified URIs
      return ($edit_uri, $edit_media_uri);
 }

 # Changes Collection URI
 sub make_collection_uri {
     my($self, $c) = @_;

      # Constructing the new Collection URI as you like...

      # Returns the Collection URI
      return $new_uri;
 }
More…
     Many sample applications are found in samples/ directory
 
          MyAtom: Most simple AtomPub server
      
          MyBlog: Complicated server with Media resources
      
          OurBlogs: Single Collection class provides multiple Collections
      


     gihyo.jp gives detailed articles
 
          Search “gihyo.jp atompub server”
      
          Sorry, written in Japanese
      
Summary
     What’s AtomPub?
 
          Data model
      
          Five Operations: List + CRUD
      
          Role of AtomPub servers
      


     Better choose AtomPub for your Web service?
 
          What’s the difference in RESTful services
      
          Compared with Amazon S3 (Simple Storage Service)
      
          Positioning AtomPub in RESTful services
      


     Catalyst::Controller::Atompub
 
          Makes you forcus on your task
      
          Sample Codes
      


     Summary
 

Weitere ähnliche Inhalte

Was ist angesagt?

The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
nobby
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
Carol McDonald
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
Arun Gupta
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
b_kathir
 
Understanding
Understanding Understanding
Understanding
Arun Gupta
 
Thu 1100 duncan_john_color
Thu 1100 duncan_john_colorThu 1100 duncan_john_color
Thu 1100 duncan_john_color
DATAVERSITY
 
Architecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentationArchitecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentation
Vlad Ponomarev
 

Was ist angesagt? (20)

JAX-RS 2.0: RESTful Web Services
JAX-RS 2.0: RESTful Web ServicesJAX-RS 2.0: RESTful Web Services
JAX-RS 2.0: RESTful Web Services
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
10 jdbc
10 jdbc10 jdbc
10 jdbc
 
Configure Your Projects with Apache Tamaya
Configure Your Projects with Apache TamayaConfigure Your Projects with Apache Tamaya
Configure Your Projects with Apache Tamaya
 
04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop04.egovFrame Runtime Environment Workshop
04.egovFrame Runtime Environment Workshop
 
So various polymorphism in Scala
So various polymorphism in ScalaSo various polymorphism in Scala
So various polymorphism in Scala
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
A first Draft to Java Configuration
A first Draft to Java ConfigurationA first Draft to Java Configuration
A first Draft to Java Configuration
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0Cloudera Impala, updated for v1.0
Cloudera Impala, updated for v1.0
 
Understanding
Understanding Understanding
Understanding
 
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
Introduction to JAX-RS @ SIlicon Valley Code Camp 2010
 
Thu 1100 duncan_john_color
Thu 1100 duncan_john_colorThu 1100 duncan_john_color
Thu 1100 duncan_john_color
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX LondonJAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
JAX-RS 2.0: New and Noteworthy in RESTful Web services API at JAX London
 
Big data: current technology scope.
Big data: current technology scope.Big data: current technology scope.
Big data: current technology scope.
 
PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012PaaSing a Java EE 6 Application at Geecon 2012
PaaSing a Java EE 6 Application at Geecon 2012
 
Architecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentationArchitecting virtualized infrastructure for big data presentation
Architecting virtualized infrastructure for big data presentation
 

Andere mochten auch

AP1000 Reactor
AP1000 ReactorAP1000 Reactor
AP1000 Reactor
myatom
 
JANTI Fukushima report part 3
JANTI Fukushima report part 3JANTI Fukushima report part 3
JANTI Fukushima report part 3
myatom
 
Janti fukushima report_at
Janti fukushima report_atJanti fukushima report_at
Janti fukushima report_at
myatom
 
Temelin power uprate
Temelin power uprateTemelin power uprate
Temelin power uprate
myatom
 
Updated plant costs 2010
Updated plant costs 2010Updated plant costs 2010
Updated plant costs 2010
myatom
 
JANTI Fukushima report part 1 2
JANTI Fukushima report part 1 2JANTI Fukushima report part 1 2
JANTI Fukushima report part 1 2
myatom
 
JANTI Fukushima report part 4 5 6
JANTI Fukushima report part 4 5 6JANTI Fukushima report part 4 5 6
JANTI Fukushima report part 4 5 6
myatom
 

Andere mochten auch (7)

AP1000 Reactor
AP1000 ReactorAP1000 Reactor
AP1000 Reactor
 
JANTI Fukushima report part 3
JANTI Fukushima report part 3JANTI Fukushima report part 3
JANTI Fukushima report part 3
 
Janti fukushima report_at
Janti fukushima report_atJanti fukushima report_at
Janti fukushima report_at
 
Temelin power uprate
Temelin power uprateTemelin power uprate
Temelin power uprate
 
Updated plant costs 2010
Updated plant costs 2010Updated plant costs 2010
Updated plant costs 2010
 
JANTI Fukushima report part 1 2
JANTI Fukushima report part 1 2JANTI Fukushima report part 1 2
JANTI Fukushima report part 1 2
 
JANTI Fukushima report part 4 5 6
JANTI Fukushima report part 4 5 6JANTI Fukushima report part 4 5 6
JANTI Fukushima report part 4 5 6
 

Ähnlich wie Practical AtomPub Servers @ YAPC::Asia 2008

[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
Carles Farré
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
deimos
 
Nuxeo JavaOne 2007
Nuxeo JavaOne 2007Nuxeo JavaOne 2007
Nuxeo JavaOne 2007
Stefane Fermigier
 
3. Sql Services 概览
3. Sql Services 概览3. Sql Services 概览
3. Sql Services 概览
GaryYoung
 
Admin High Availability
Admin High AvailabilityAdmin High Availability
Admin High Availability
rsnarayanan
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
elliando dias
 

Ähnlich wie Practical AtomPub Servers @ YAPC::Asia 2008 (20)

RESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services FrameworkRESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services Framework
 
20080611accel
20080611accel20080611accel
20080611accel
 
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
[DSBW Spring 2009] Unit 02: Web Technologies (1/2)
 
Web 2.0 101
Web 2.0 101Web 2.0 101
Web 2.0 101
 
Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 
Orcale Presentation
Orcale PresentationOrcale Presentation
Orcale Presentation
 
Data Integration with server side Mashups
Data Integration with server side MashupsData Integration with server side Mashups
Data Integration with server side Mashups
 
Frank Mantek Google G Data
Frank Mantek Google G DataFrank Mantek Google G Data
Frank Mantek Google G Data
 
20080528dublinpt1
20080528dublinpt120080528dublinpt1
20080528dublinpt1
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Nuxeo JavaOne 2007
Nuxeo JavaOne 2007Nuxeo JavaOne 2007
Nuxeo JavaOne 2007
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Introduction of e-Journal Local Hosting and Services - Dr. Kwang Young Kim
Introduction of e-Journal Local Hosting and Services - Dr. Kwang Young KimIntroduction of e-Journal Local Hosting and Services - Dr. Kwang Young Kim
Introduction of e-Journal Local Hosting and Services - Dr. Kwang Young Kim
 
3. Sql Services 概览
3. Sql Services 概览3. Sql Services 概览
3. Sql Services 概览
 
Admin High Availability
Admin High AvailabilityAdmin High Availability
Admin High Availability
 
REST and AJAX Reconciled
REST and AJAX ReconciledREST and AJAX Reconciled
REST and AJAX Reconciled
 
Applications of the REST Principle
Applications of the REST PrincipleApplications of the REST Principle
Applications of the REST Principle
 
Introduction to Hadoop
Introduction to HadoopIntroduction to Hadoop
Introduction to Hadoop
 

Mehr von Takeru INOUE

分散ストレージに使えるかもしれないアルゴリズム
分散ストレージに使えるかもしれないアルゴリズム分散ストレージに使えるかもしれないアルゴリズム
分散ストレージに使えるかもしれないアルゴリズム
Takeru INOUE
 
Rewind the last half year for Erlang
Rewind the last half year for ErlangRewind the last half year for Erlang
Rewind the last half year for Erlang
Takeru INOUE
 
Kai = (Dynamo + memcache API) / Erlang
Kai = (Dynamo + memcache API) / ErlangKai = (Dynamo + memcache API) / Erlang
Kai = (Dynamo + memcache API) / Erlang
Takeru INOUE
 
Process Design and Polymorphism: Lessons Learnt from Development of Kai
Process Design and Polymorphism: Lessons Learnt from Development of KaiProcess Design and Polymorphism: Lessons Learnt from Development of Kai
Process Design and Polymorphism: Lessons Learnt from Development of Kai
Takeru INOUE
 
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
Takeru INOUE
 
Kai – An Open Source Implementation of Amazon’s Dynamo
Kai – An Open Source Implementation of Amazon’s DynamoKai – An Open Source Implementation of Amazon’s Dynamo
Kai – An Open Source Implementation of Amazon’s Dynamo
Takeru INOUE
 
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LTAmazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
Takeru INOUE
 

Mehr von Takeru INOUE (7)

分散ストレージに使えるかもしれないアルゴリズム
分散ストレージに使えるかもしれないアルゴリズム分散ストレージに使えるかもしれないアルゴリズム
分散ストレージに使えるかもしれないアルゴリズム
 
Rewind the last half year for Erlang
Rewind the last half year for ErlangRewind the last half year for Erlang
Rewind the last half year for Erlang
 
Kai = (Dynamo + memcache API) / Erlang
Kai = (Dynamo + memcache API) / ErlangKai = (Dynamo + memcache API) / Erlang
Kai = (Dynamo + memcache API) / Erlang
 
Process Design and Polymorphism: Lessons Learnt from Development of Kai
Process Design and Polymorphism: Lessons Learnt from Development of KaiProcess Design and Polymorphism: Lessons Learnt from Development of Kai
Process Design and Polymorphism: Lessons Learnt from Development of Kai
 
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
Kai – An Open Source Implementation of Amazon’s Dynamo (in Japanese)
 
Kai – An Open Source Implementation of Amazon’s Dynamo
Kai – An Open Source Implementation of Amazon’s DynamoKai – An Open Source Implementation of Amazon’s Dynamo
Kai – An Open Source Implementation of Amazon’s Dynamo
 
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LTAmazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
Amazon's Dynamo in POE and Erlang @ YAPC::Asia 2008 LT
 

Kürzlich hochgeladen

Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
lizamodels9
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Sheetaleventcompany
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
 
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
dlhescort
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 

Kürzlich hochgeladen (20)

Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLJAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
Call Girls In Majnu Ka Tilla 959961~3876 Shot 2000 Night 8000
 
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
(Anamika) VIP Call Girls Napur Call Now 8617697112 Napur Escorts 24x7
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 

Practical AtomPub Servers @ YAPC::Asia 2008

  • 2. Outline What’s AtomPub?   Data model   Five Operations: List + CRUD   Role of AtomPub servers   Better choose AtomPub for your Web service?   What’s the difference in RESTful services   Compared with Amazon S3 (Simple Storage Service)   Positioning AtomPub in RESTful services   Catalyst::Controller::Atompub   Makes you forcus on your task   Sample Codes   Summary  
  • 3. What’s AtomPub?   What’s AtomPub? Defined in RFC5023   One of REST instances   Web API for publishing and editing Web resources   Based on HTTP transfer of Atom-formatted representations     Services using AtomPub Google: GData, Blogger, OpenSocial   Microsoft: Live Platform   IBM: Lotus Connector   Mixi: mixi station API  
  • 4. Data Model Workspaces Members     Group of Collections Web Resources in usual sense     Entry Resources or Media   Resources Collections   Sets of Members Members and Collections have their own URIs   Retrieved in whole or in part   Collection Member Workspace
  • 5. Resources and Representations Examples: Feed -  rticles which are A Document referred to a category (XML) Collection - mages of an event I in which there are several Entries Entry Examples: Document -  n article in a blog A (XML) -  n image A Member metadata (Entry or Media) substantial data AtomPub Atom Format Web Resources (RFC5023) (RFC4287)
  • 6. Operations Five operations: List + CRUD   Determined by target (URI) and HTTP method   POST: Creates a new member (Member URI is assigned by the server) PUT: DELETE: Updates a member Deletes a member GET: Retrieves a member GET: Lists members in the collection Operations against Members Operations against Collections
  • 7. Operations in depth – Entry and Media Resources   Entry and Media Resources Two sides of the same coin   POST: Creates a new Member (substantial data) PUT: Updates the Member Entry link Metadata MUST be updated Metadata: at the same time -  escribes attributes of the data: date, author, etc. D -  as a link to the data H -  utomatically generated as an Entry by the server A
  • 8. Role of AtomPub Servers List + CRUD operations   Supports publishing and editing Web resources   Assigns Member URIs when they are POSTed   Maintenance of metadata   Generates corresponding Entries when POSTed   Updates attributes when the corresponding data is PUTed or DELETEd   Others   Service description in Service Documents (not discussed in my talk)   HTTP processings: Authentication, cache, version control, and error handling    Compared with simple RESTful APIs, AtomPub servers have strong authority
  • 9. Better choose AtomPub for your Web service?   Myths of AtomPub AtomPub is a protocol just for blogging     AtomPub is the best one to publish ANY type of Web resources   Which service is suited for AtomPub? Text-orientd services, such as blogging and SNS?   File management systems including binary data?   Something else?  
  • 10. AtomPub is one of REST instances AtomPub is one of the REST instances   Don’t choose AtomPub if your service is NOT RESTful   Compare AtomPub with other RESTful APIs if your service is RESTful   Common features of RESTful services (in my talk)   Addresses resources by URIs   CRUD resources by HTTP methods: GET, POST, PUT, and DELETE   Resource type is not an issue: plain-text, XML, images, videos, …   Data model of dataset including several items (see figure)   Set Item
  • 11. What’s the difference in RESTful APIs? 
 Metadata   Which kinds of metadata are needed?   Where are metadata placed?   URIs   Who determines resource URIs?   Other options   Search queries, representations, etc.    Comparing AtomPub with a contrasting API, Amazon S3 Matrix of metadata and URIs URIs Metadata Simple and with data Rich and separated from data By servers AtomPub By clients Amazon S3
  • 12. Amazon S3 (Simple Storage Service) Metadata   /yapc.asia Placed in HTTP headers   yapc2008.png Line-by-line syntax   Always along with data in HTTP body   URIs   Determined by clients   PUT is requested with a URI to create a resource   URI PUT /yapc.asia/yapc2008.png HTTP/1.1 Content-Type: image/png Metadata Date: Tue, 15 May 2008 01:23:45 GMT X-Amz-Metadata: … Data Example of HTTP request
  • 13. AtomPub Metadata   Has its own URI and independent from data   12345678.atom Written in Atom entry   12345678.png /images URIs   Entry Determined by servers   <?xml version=“1.0” encoding=“utf-8”?> <entry xmlns=“http://www.w3.org/2005/Atom”> <link rel=“edit” href=“/images/12345678.atom”/> <link rel=“edit-media” href=“/images/12345678.png”/> <content src=“/images/12345678.png” type=“image/png”/> … </entry> Metadata: /images/123456578.atom Data: /images/12345678.png
  • 14. Embedded AtomPub – Actually, this is AtomPub in usual sense Metadata   Has it own URI and independent from data   first_entry.atom Written in Atom entry   Text/XML data can be embedded in metadata   eg. atom:content element   Entry URIs   /blog Determined by servers   Suggested by requests with Slug header   POST /blog HTTP/1.1 URI suggestion Slug: first_entry <?xml version=“1.0” encoding=“utf-8”?> <entry xmlns=“http://www.w3.org/2005/Atom”> <updated>2008-05-15T01:23:45Z</updated> Metadata <author><name>yapc</name></author> … Data <content type=“text”>This is my first entry</content> </entry> Example of HTTP request
  • 15. Positioning AtomPub in RESTful services Characteristics of AtomPub   With rich metadata and mainly controlled by servers   Can be changed by embedded content and Slug header options   12345678.atom first_entry.atom 12345678.png Entry Entry AtomPub with Media resources Amazon S3 and embedded AtomPub Matrix of metadata and URIs URIs Metadata Simple and with data Rich and separated from data embedded By servers AtomPub Slug header By clients Amazon S3
  • 16. Better choose AtomPub for your Web service?   Services, which are suited for AtomPub Metadata is represented in XML, especially in Atom Entries   Atom standard elements are required: author, category, copyright, …     Linked to other resources: eg. a blog entry including pictures   XML vocabularies are used in the metadata: OpenSearch, RDF, …   Complicated data model is acceptable, or don’t use media resources URIs are determined by servers   Or determined based on clients’ suggestions   I  f you choose AtomPub, go for Catalyst::Controller::Atompub
  • 17. Catalyst::Controller::Atompub A Catalyst controller class for processing AtomPub   Why controller?   AtomPub defines CONTROL flow for publishing and editing Web resources   Tested in AtomPub Interop   July 2007 at Tokyo   Nov 2007 on the Internet   Feb 2008 at Tokyo   Download from CPAN  
  • 18. Catalyst::Controller::Atompub   Makes you focus on your task (eg. Model implementation) Dispatches requests based on URI and HTTP method   Check cache or version of the requested resources (optional)   Validates requested Entry if exists   Determines a new member URI when POST   by C::C::Atompub Stores resources to, or retrieves them from databases   Modifies the resources (optional)   Your turn by C::C::Atompub Constructs HTTP response and sends it to client   Can overwrite default behavior
  • 19. Sample code – Creating resources # Attribute :Atompub(create) is required sub create_entry :Atompub(create) { my($self, $c) = @_; # URI of the new Entry, which was determined by C::C::Atompub my $uri = $self->entry_resource->uri; # datetime, which was assigned by C::C::Atompub my $edited = $self->edited; # POSTed Entry, an XML::Atom::Entry objcet my $entry = $self->entry_resource->body; # Creates the new Entry $c->model('DBIC::Entries')->create({ uri => $uri, edited => $edited->epoch, xml => $entry->as_xml, }); # Returns true on success return 1; }
  • 20. Sample code – Listing resources # Attribute :Atompub(list) is required sub get_feed :Atompub(list) { my($self, $c) = @_; # Skeleton of the Feed, an XML::Atom::Feed objcet, # was prepared by C::C::Atompub my $feed = $self->collection_resource->body; # Retrieve Entries sorted in descending order my $rs = $c->model('DBIC::Entries') ->search({}, { order_by => 'edited desc' }); # Adds Entries to the Feed while (my $member = $rs->next) { my $entry = XML::Atom::Entry->new($member->xml); $feed->add_entry($entry); } # Returns true on success return 1; }
  • 21. Sample code – Changing default URIs eg. /collection/20080515-012345-123456.atom -> /collection/joe/birthday.atom # Changes Edit URIs, that is URIs for Member resources sub make_edit_uri { my($self, $c, @args) = @_; # Default URIs for Entry (and Media) resources my($edit_uri, $edit_media_uri) = $self−>NEXT::make_edit_uri($c, @args); # Modify the URIs as you like... # Returns modified URIs return ($edit_uri, $edit_media_uri); } # Changes Collection URI sub make_collection_uri { my($self, $c) = @_; # Constructing the new Collection URI as you like... # Returns the Collection URI return $new_uri; }
  • 22. More… Many sample applications are found in samples/ directory   MyAtom: Most simple AtomPub server   MyBlog: Complicated server with Media resources   OurBlogs: Single Collection class provides multiple Collections   gihyo.jp gives detailed articles   Search “gihyo.jp atompub server”   Sorry, written in Japanese  
  • 23. Summary What’s AtomPub?   Data model   Five Operations: List + CRUD   Role of AtomPub servers   Better choose AtomPub for your Web service?   What’s the difference in RESTful services   Compared with Amazon S3 (Simple Storage Service)   Positioning AtomPub in RESTful services   Catalyst::Controller::Atompub   Makes you forcus on your task   Sample Codes   Summary 