SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Implementing a
JSR-283 Content Repository
          in PHP

                 Karsten Dambekalns
                 karsten@typo3.org
Introduction to JCR




                      Inspiring people to
                      share
What is a Content Repository
  A Content Repository (CR) allows the storage and retrieval of
  arbitrary content as nodes and properties in a tree structure

  The node types as well as the tree structure can be freely defined
  by the user of the CR

  Binary content can stored and queried as effectively as textual
  content

  The API for using a CR is standardized in the JSR-170 and JSR-283
  specifications

  The API abstracts the actual data storage used (RDBMS, ODBMS,
  files, ...)
                                            Inspiring people to
                                            share
Nodes and Properties




                  Inspiring people to
                  share
Reasons for using a CR
  Flexible and extensible data structure

  Object based storage and retrieval

  Combines advantages of navigational and relational databases

  Security can be enforced on a higher level

  Cleaner and easier to use for the developer

  No vendor lock-in

  Powerful data storage for a truckload of applications

                                           Inspiring people to
                                           share
Existing implementations
  Jackrabbit is the reference implementation, available as open
  source from the Apache Foundation

  Day CRX is the commercial CR implementation from the quot;inventorquot;
  of JSR-170, Day Software

  Other implementations are eXo JCR and Jeceira, the latter also
  being dead, and others

  JSR-170 connectors exist for Alfresco, BEA Portal Server, IBM
  Domino and others




                                            Inspiring people to
                                            share
PHP ports of the JSR-170 API
  Travis Swicegood ported the API to PHP in 2005 - project seems
  dead

  There is a port of the API available in the Jackrabbit sources,
  added 2005 - no relevant changes since then

  •   This could be a sign of a well-done port of the API, but it
      rather seems to be a lack of usage and feedback

  No JSR-283 port of the API today

  •   Well, since the specification isn’t final yet, this may not come
      as a surprise...


                                              Inspiring people to
                                              share
TYPO3 Content Repository
  No standalone PHP implementation of a Content Repository exists
  as of now

  Our goal is a pure PHP implementation of JSR-283, but
  functionality needed for the TYPO3 CMS has priority

  Will take advantage of the TYPO3 Framework, but not be tied to
  the TYPO3 CMS.

  Could eventually become the standard CR for the PHP
  community?!

  •   This depends also on you, the PHP developers out there...


                                            Inspiring people to
                                            share
Summary
 A Content Repository (CR) promises to solve a lot of the problems
 (not only) vendors of CMS currently have

 A stable standard with a fresh version in the making

 Various implementations exist, mostly in Java

 No standalone PHP implementation of a Content Repository exists



 We want to change that!



                                          Inspiring people to
                                          share
Development environment




                 Inspiring people to
                 share
TYPO3 Framework
  Provides a robust and advanced programming framework with
  features like Dependency Injection, Aspect Oriented Programming,
  MVC, Component and Package Management, enhanced Reflection
  and more

  Inspired by the most popular frameworks and toolkits from
  Smalltalk, Python, Ruby and Java available today, picking the
  best concepts, skipping the annoyances

  Has already come a long way, check out the session by Robert
  Lemke today at 17:30 in Rhein-Main I!

  Not tied to TYPO3 CMS, can be used for any PHP6-based project

                                           Inspiring people to
                                           share
PHP 6
  PHP 6 will be used for development of all projects around TYPO3
  5.0

  Currently unclear when PHP 6 will be released

  PHP 5.3 = PHP 6 - Unicode?

 •   This could mean our code runs on PHP 5.3...

 •   ... but will lack Unicode support

  Still needs to be investigated



                                           Inspiring people to
                                           share
Development model
  A few acronyms for your reading pleasure:

 •   DDD – Domain Driven Design

 •   TDD – Test Driven Development

 •   CI – Continuous Integration

 •   AOP – Aspect Oriented Programming

  We follow these principles and use those paradigms not because
  they sound good – but because they improve design and code

  Open Source, see http://typo3.org/gimmefive/ for more

                                          Inspiring people to
                                          share
Summary
 The TYPO3 Framework serves as a solid base for development

 PHP 6 will be a prerequisite for using the TYPO3 CR

 •   Following PHP roadmap changes we will evaluate possible
     escape routes

 Using state-of-the-art development principles




                                           Inspiring people to
                                           share
TYPO3 Content Repository




                  Inspiring people to
                  share
Porting the JSR-283 API
  The API needs to be ported before writing the code

  Interfaces will not be ported up-front, but as we need them

  Facing typing issues, some Java types simply do not exist in PHP

  Binary data will probably be Resource Manager handles instead of
  streams

  •   Alternatively simple stream handlers, still needs research

  Features prioritized according to the needs of the TYPO3 CMS
  project


                                             Inspiring people to
                                             share
Actual data storage
  The underlying storage of the TYPO3CR will be a RDBMS for the
  start

  Currently only SQLite through PDO is used

  •   Easy to use for development and unit testing

  •   The use of PDO already enables any PDO-supported database

  Specialized DB connectors will follow, using optimized queries,
  stored procedures, ...

  •   This also opens the door for implementing other connectors,
      like to LDAP or object databases or ...

                                              Inspiring people to
                                              share
Data storage techniques
  Basically we need to store a simple tree

  Read access must be fast, as the majority of requests are read
  requests, write access should be fast

  Traditional approach as used – not only – in TYPO3 today is to
  store a triplet (uid, pid, sorting)

  Alternative & faster method: Pre/Post Plane Encoding




                                             Inspiring people to
                                             share
Pre/Post Plane Encoding
  Stores number determined by pre-order and post-order tree
  traversal

  Allows to partition the nodes into
  four regions, as shown for node ƒ

  Very fast read access, e.g. a single
  SELECT to query all ancestors to
  a node ƒ

   SELECT * FROM table WHERE
   pre < ƒ.pre AND post > ƒ.post


                                         Inspiring people to
                                         share
Performance considerations
  Nodes can already be fetched very fast

  •   But attributes must be stored seperately, to keep node table
      sizes inside sensible limits

  •   Binary data will be stored in the underlying database for
      easier replication – a transparent cache to the filesystem will
      be added

  Write access can be sped up by various approaches like spacing
  and variable length indices for the pre/post numbers or by
  partitioning the data over more tables



                                             Inspiring people to
                                             share
Querying the TYPO3 CR
  Using getRootNode() and friends from the API

  Using XPath queries

  Using SQL queries




                                          Inspiring people to
                                          share
API usage for querying
 $repository = $this->componentManager->getComponent
                                  ('T3_phpCR_RepositoryInterface');
 $session = $repository->login();

 $newsEntries = $session->getNodeByUUID
         ('96bca35d-1ef5-4a47-8b0c-0bfc79507d08')->getNodes();

 foreach($newsEntries as $newsEntry) {
        $title = $newsEntry->getProperty('title');
        $text = $newsEntry->getProperty('text');
        // more code here...
 }
                                              Inspiring people to
                                              share
XPath support for TYPO3R
  To enable XPath we need

  •   a XPath parser

  •   an efficient way to transform a XPath query into SQL for the
      used low-level data structure

  The latter is a lot easier when storing the tree pre/post plane
  encoded




                                             Inspiring people to
                                             share
SQL support for TYPO3R
  Using SQL we need

  •   a (simple) SQL parser

  •   an efficient way to transform that SQL into equivalent SQL for
      the used low-level data structure

  This still needs to be investigated, possible approaches include
  storing a reference to the parent node or even using the pre/post
  plane only as a cache for XPath read queries, optimizing the
  native storage for SQL read queries




                                            Inspiring people to
                                            share
Extensions to JSR-283
  A vendor may choose to offer additional features in his CR
  implementation

  The TYPO3CR will offer support for

  •   Data persistency through code annotations

  •   Automatic node type generation based on class members

  •   Rules for setting up virtual root nodes based on node types




                                            Inspiring people to
                                            share
Current status
  Currently the code supports a subset of the required features of
  levels 1 & 2 and the optional parts of the JSR-283 specification

  •   Basic read & write access

  •   Namespace registration

  •   Node type discovery and registration

  Data storage uses the naive approach known from TYPO3 4.x




                                             Inspiring people to
                                             share
Future plans
  Implementing missing required and optional features according
  to the JSR-283 specification

  •   Workspaces and versioning will require special attention, as
      they are key features for the CMS as well!

  Implement native RDBMS connectors making use of specifically
  tuned queries and product-specific features

  Performance tests and tuning as needed




                                             Inspiring people to
                                             share
Summary
 Implementing the specification is not an easy task, but doable

 For the various parts a lot of research has already been done in
 the past

 The repository is a major improvement over the current way of
 storing data

 The whole PHP community could^Wcan^Wwill benefit!




                                           Inspiring people to
                                           share
Thanks for listening
Karsten Dambekalns <karsten@typo3.org>




                                 Inspiring people to
                                 share
Implementing a JSR-283 Content Repository in PHP

Weitere ähnliche Inhalte

Was ist angesagt?

RDMA on ARM
RDMA on ARMRDMA on ARM
RDMA on ARM
inside-BigData.com
 
The HPE Machine and Gen-Z - BUD17-503
The HPE Machine and Gen-Z - BUD17-503The HPE Machine and Gen-Z - BUD17-503
The HPE Machine and Gen-Z - BUD17-503
Linaro
 
Facebook keynote-nicolas-qcon
Facebook keynote-nicolas-qconFacebook keynote-nicolas-qcon
Facebook keynote-nicolas-qcon
Yiwei Ma
 

Was ist angesagt? (17)

Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
 
RDMA on ARM
RDMA on ARMRDMA on ARM
RDMA on ARM
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
dbaas-clone
dbaas-clonedbaas-clone
dbaas-clone
 
Introduction to column oriented databases in PHP
Introduction to column oriented databases in PHPIntroduction to column oriented databases in PHP
Introduction to column oriented databases in PHP
 
CouchDB, PHPillow & PHP
CouchDB, PHPillow & PHPCouchDB, PHPillow & PHP
CouchDB, PHPillow & PHP
 
The HPE Machine and Gen-Z - BUD17-503
The HPE Machine and Gen-Z - BUD17-503The HPE Machine and Gen-Z - BUD17-503
The HPE Machine and Gen-Z - BUD17-503
 
Practical Kerberos with Apache HBase
Practical Kerberos with Apache HBasePractical Kerberos with Apache HBase
Practical Kerberos with Apache HBase
 
Content delivery Plone Symposium East 2010
Content delivery Plone Symposium East 2010Content delivery Plone Symposium East 2010
Content delivery Plone Symposium East 2010
 
Facebook keynote-nicolas-qcon
Facebook keynote-nicolas-qconFacebook keynote-nicolas-qcon
Facebook keynote-nicolas-qcon
 
Right Availability in RAC environment. Playing with Oracle clusterware infras...
Right Availability in RAC environment. Playing with Oracle clusterware infras...Right Availability in RAC environment. Playing with Oracle clusterware infras...
Right Availability in RAC environment. Playing with Oracle clusterware infras...
 
Apache - Mod-Rewrite
Apache - Mod-RewriteApache - Mod-Rewrite
Apache - Mod-Rewrite
 
My DIaries
My DIariesMy DIaries
My DIaries
 
Open Source Backup Conference 2014: Bakup to and of the cloud, by Marco van W...
Open Source Backup Conference 2014: Bakup to and of the cloud, by Marco van W...Open Source Backup Conference 2014: Bakup to and of the cloud, by Marco van W...
Open Source Backup Conference 2014: Bakup to and of the cloud, by Marco van W...
 
Under the Armor of Knights Corner: Intel MIC Architecture at Hotchips 2012
Under the Armor of Knights Corner: Intel MIC Architecture at Hotchips 2012Under the Armor of Knights Corner: Intel MIC Architecture at Hotchips 2012
Under the Armor of Knights Corner: Intel MIC Architecture at Hotchips 2012
 
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
Augmenting Flow Operations and Feedback on the Model Driven MD_SAL Approach i...
 
System to generate speech to text in real time
System to generate speech to text in real timeSystem to generate speech to text in real time
System to generate speech to text in real time
 

Andere mochten auch

11 may 2015 the evolution of the public research organisations and traditio...
11 may 2015   the evolution of the public research organisations and traditio...11 may 2015   the evolution of the public research organisations and traditio...
11 may 2015 the evolution of the public research organisations and traditio...
Mohamed Larbi BEN YOUNES
 
April 19 social marketing & yr business
April 19 social marketing & yr businessApril 19 social marketing & yr business
April 19 social marketing & yr business
Hack the Hood
 
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 PhoenixContent Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
Karsten Dambekalns
 
Visual studio tools 4 SharePoint SharePoint Saturday Arabia
Visual studio tools 4 SharePoint SharePoint Saturday ArabiaVisual studio tools 4 SharePoint SharePoint Saturday Arabia
Visual studio tools 4 SharePoint SharePoint Saturday Arabia
Marwan Tarek
 
Безопасность электронного обучения
Безопасность электронного обученияБезопасность электронного обучения
Безопасность электронного обучения
Vladimir Zuev
 

Andere mochten auch (20)

Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)Transparent Object Persistence (within FLOW3)
Transparent Object Persistence (within FLOW3)
 
11 may 2015 the evolution of the public research organisations and traditio...
11 may 2015   the evolution of the public research organisations and traditio...11 may 2015   the evolution of the public research organisations and traditio...
11 may 2015 the evolution of the public research organisations and traditio...
 
Poev And Birthday Experience Slides
Poev And Birthday Experience SlidesPoev And Birthday Experience Slides
Poev And Birthday Experience Slides
 
Storyboard
StoryboardStoryboard
Storyboard
 
April 19 social marketing & yr business
April 19 social marketing & yr businessApril 19 social marketing & yr business
April 19 social marketing & yr business
 
Image Sensors 2009 - Shri Sundaram
Image Sensors 2009 - Shri SundaramImage Sensors 2009 - Shri Sundaram
Image Sensors 2009 - Shri Sundaram
 
Web 2.0 in the Learning Environment
Web 2.0 in the Learning EnvironmentWeb 2.0 in the Learning Environment
Web 2.0 in the Learning Environment
 
Doctrine in FLOW3
Doctrine in FLOW3Doctrine in FLOW3
Doctrine in FLOW3
 
i18n and L10n in TYPO3 Flow
i18n and L10n in TYPO3 Flowi18n and L10n in TYPO3 Flow
i18n and L10n in TYPO3 Flow
 
How To Web Keynote
How To Web KeynoteHow To Web Keynote
How To Web Keynote
 
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 PhoenixContent Repository, Versioning and Workspaces in TYPO3 Phoenix
Content Repository, Versioning and Workspaces in TYPO3 Phoenix
 
06 - Proposition d’Adoption de la Stratégie de Spécialisation Intelligente en...
06 - Proposition d’Adoption de la Stratégie de Spécialisation Intelligente en...06 - Proposition d’Adoption de la Stratégie de Spécialisation Intelligente en...
06 - Proposition d’Adoption de la Stratégie de Spécialisation Intelligente en...
 
Sept 15 2012 bxb show me the numbers
Sept 15 2012  bxb show me the numbersSept 15 2012  bxb show me the numbers
Sept 15 2012 bxb show me the numbers
 
Visual studio tools 4 SharePoint SharePoint Saturday Arabia
Visual studio tools 4 SharePoint SharePoint Saturday ArabiaVisual studio tools 4 SharePoint SharePoint Saturday Arabia
Visual studio tools 4 SharePoint SharePoint Saturday Arabia
 
Marten
Marten Marten
Marten
 
Trendy I Przestrzen
Trendy I PrzestrzenTrendy I Przestrzen
Trendy I Przestrzen
 
Virussen Pp De Goeie
Virussen Pp De GoeieVirussen Pp De Goeie
Virussen Pp De Goeie
 
Безопасность электронного обучения
Безопасность электронного обученияБезопасность электронного обучения
Безопасность электронного обучения
 
Connect NE - NETA 2009
Connect NE - NETA 2009Connect NE - NETA 2009
Connect NE - NETA 2009
 
01 - Défis pour les Régions à Faible Innovation
01 - Défis pour les Régions à Faible Innovation01 - Défis pour les Régions à Faible Innovation
01 - Défis pour les Régions à Faible Innovation
 

Ähnlich wie Implementing a JSR-283 Content Repository in PHP

Ähnlich wie Implementing a JSR-283 Content Repository in PHP (20)

Implementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHPImplementing a JSR-283 Content Repository in PHP
Implementing a JSR-283 Content Repository in PHP
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
High Performance Enterprise Data Processing with Apache Spark with Sandeep Va...
High Performance Enterprise Data Processing with Apache Spark with Sandeep Va...High Performance Enterprise Data Processing with Apache Spark with Sandeep Va...
High Performance Enterprise Data Processing with Apache Spark with Sandeep Va...
 
Headless approach for offloading heavy tasks in Magento
Headless approach for offloading heavy tasks in MagentoHeadless approach for offloading heavy tasks in Magento
Headless approach for offloading heavy tasks in Magento
 
Meetup Oracle Database: 3 Analizar, Aconsejar, Automatizar… las nuevas funcio...
Meetup Oracle Database: 3 Analizar, Aconsejar, Automatizar… las nuevas funcio...Meetup Oracle Database: 3 Analizar, Aconsejar, Automatizar… las nuevas funcio...
Meetup Oracle Database: 3 Analizar, Aconsejar, Automatizar… las nuevas funcio...
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Red Hat Storage Roadmap
Red Hat Storage RoadmapRed Hat Storage Roadmap
Red Hat Storage Roadmap
 
Red Hat Storage Roadmap
Red Hat Storage RoadmapRed Hat Storage Roadmap
Red Hat Storage Roadmap
 
ACM TechTalks : Apache Arrow and the Future of Data Frames
ACM TechTalks : Apache Arrow and the Future of Data FramesACM TechTalks : Apache Arrow and the Future of Data Frames
ACM TechTalks : Apache Arrow and the Future of Data Frames
 
Normalizing x pages web development
Normalizing x pages web development Normalizing x pages web development
Normalizing x pages web development
 
Petapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated SystemsPetapath HP Cast 12 - Programming for High Performance Accelerated Systems
Petapath HP Cast 12 - Programming for High Performance Accelerated Systems
 
Java One 2017: Open Source Big Data in the Cloud: Hadoop, M/R, Hive, Spark an...
Java One 2017: Open Source Big Data in the Cloud: Hadoop, M/R, Hive, Spark an...Java One 2017: Open Source Big Data in the Cloud: Hadoop, M/R, Hive, Spark an...
Java One 2017: Open Source Big Data in the Cloud: Hadoop, M/R, Hive, Spark an...
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
 
Ceph
CephCeph
Ceph
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
 
Preparing for SRE Interviews
Preparing for SRE InterviewsPreparing for SRE Interviews
Preparing for SRE Interviews
 
ARM CoAP Tutorial
ARM CoAP TutorialARM CoAP Tutorial
ARM CoAP Tutorial
 
Ceph - High Performance Without High Costs
Ceph - High Performance Without High CostsCeph - High Performance Without High Costs
Ceph - High Performance Without High Costs
 

Mehr von Karsten Dambekalns

The agile future of a ponderous project
The agile future of a ponderous projectThe agile future of a ponderous project
The agile future of a ponderous project
Karsten Dambekalns
 
How Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the futureHow Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the future
Karsten Dambekalns
 

Mehr von Karsten Dambekalns (19)

The Perfect Neos Project Setup
The Perfect Neos Project SetupThe Perfect Neos Project Setup
The Perfect Neos Project Setup
 
Sawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with NeosSawubona! Content Dimensions with Neos
Sawubona! Content Dimensions with Neos
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using Surf
 
Profiling TYPO3 Flow Applications
Profiling TYPO3 Flow ApplicationsProfiling TYPO3 Flow Applications
Profiling TYPO3 Flow Applications
 
Using Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 FlowUsing Document Databases with TYPO3 Flow
Using Document Databases with TYPO3 Flow
 
FLOW3-Workshop F3X12
FLOW3-Workshop F3X12FLOW3-Workshop F3X12
FLOW3-Workshop F3X12
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
The agile future of a ponderous project
The agile future of a ponderous projectThe agile future of a ponderous project
The agile future of a ponderous project
 
How Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the futureHow Domain-Driven Design helps you to migrate into the future
How Domain-Driven Design helps you to migrate into the future
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
TDD (with FLOW3)
TDD (with FLOW3)TDD (with FLOW3)
TDD (with FLOW3)
 
Knowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 CommunityKnowledge Management in der TYPO3 Community
Knowledge Management in der TYPO3 Community
 
Unicode & PHP6
Unicode & PHP6Unicode & PHP6
Unicode & PHP6
 
Introduction to Source Code Management
Introduction to Source Code ManagementIntroduction to Source Code Management
Introduction to Source Code Management
 
It Works! Presenting DBAL use in real life
It Works! Presenting DBAL use in real lifeIt Works! Presenting DBAL use in real life
It Works! Presenting DBAL use in real life
 
DB API Usage - How to write DBAL compliant code
DB API Usage - How to write DBAL compliant codeDB API Usage - How to write DBAL compliant code
DB API Usage - How to write DBAL compliant code
 
Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3Transparent Object Persistence with FLOW3
Transparent Object Persistence with FLOW3
 
Test-Driven Development with FLOW3
Test-Driven Development with FLOW3Test-Driven Development with FLOW3
Test-Driven Development with FLOW3
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Implementing a JSR-283 Content Repository in PHP

  • 1. Implementing a JSR-283 Content Repository in PHP Karsten Dambekalns karsten@typo3.org
  • 2. Introduction to JCR Inspiring people to share
  • 3. What is a Content Repository A Content Repository (CR) allows the storage and retrieval of arbitrary content as nodes and properties in a tree structure The node types as well as the tree structure can be freely defined by the user of the CR Binary content can stored and queried as effectively as textual content The API for using a CR is standardized in the JSR-170 and JSR-283 specifications The API abstracts the actual data storage used (RDBMS, ODBMS, files, ...) Inspiring people to share
  • 4. Nodes and Properties Inspiring people to share
  • 5. Reasons for using a CR Flexible and extensible data structure Object based storage and retrieval Combines advantages of navigational and relational databases Security can be enforced on a higher level Cleaner and easier to use for the developer No vendor lock-in Powerful data storage for a truckload of applications Inspiring people to share
  • 6. Existing implementations Jackrabbit is the reference implementation, available as open source from the Apache Foundation Day CRX is the commercial CR implementation from the quot;inventorquot; of JSR-170, Day Software Other implementations are eXo JCR and Jeceira, the latter also being dead, and others JSR-170 connectors exist for Alfresco, BEA Portal Server, IBM Domino and others Inspiring people to share
  • 7. PHP ports of the JSR-170 API Travis Swicegood ported the API to PHP in 2005 - project seems dead There is a port of the API available in the Jackrabbit sources, added 2005 - no relevant changes since then • This could be a sign of a well-done port of the API, but it rather seems to be a lack of usage and feedback No JSR-283 port of the API today • Well, since the specification isn’t final yet, this may not come as a surprise... Inspiring people to share
  • 8. TYPO3 Content Repository No standalone PHP implementation of a Content Repository exists as of now Our goal is a pure PHP implementation of JSR-283, but functionality needed for the TYPO3 CMS has priority Will take advantage of the TYPO3 Framework, but not be tied to the TYPO3 CMS. Could eventually become the standard CR for the PHP community?! • This depends also on you, the PHP developers out there... Inspiring people to share
  • 9. Summary A Content Repository (CR) promises to solve a lot of the problems (not only) vendors of CMS currently have A stable standard with a fresh version in the making Various implementations exist, mostly in Java No standalone PHP implementation of a Content Repository exists We want to change that! Inspiring people to share
  • 10. Development environment Inspiring people to share
  • 11. TYPO3 Framework Provides a robust and advanced programming framework with features like Dependency Injection, Aspect Oriented Programming, MVC, Component and Package Management, enhanced Reflection and more Inspired by the most popular frameworks and toolkits from Smalltalk, Python, Ruby and Java available today, picking the best concepts, skipping the annoyances Has already come a long way, check out the session by Robert Lemke today at 17:30 in Rhein-Main I! Not tied to TYPO3 CMS, can be used for any PHP6-based project Inspiring people to share
  • 12. PHP 6 PHP 6 will be used for development of all projects around TYPO3 5.0 Currently unclear when PHP 6 will be released PHP 5.3 = PHP 6 - Unicode? • This could mean our code runs on PHP 5.3... • ... but will lack Unicode support Still needs to be investigated Inspiring people to share
  • 13. Development model A few acronyms for your reading pleasure: • DDD – Domain Driven Design • TDD – Test Driven Development • CI – Continuous Integration • AOP – Aspect Oriented Programming We follow these principles and use those paradigms not because they sound good – but because they improve design and code Open Source, see http://typo3.org/gimmefive/ for more Inspiring people to share
  • 14. Summary The TYPO3 Framework serves as a solid base for development PHP 6 will be a prerequisite for using the TYPO3 CR • Following PHP roadmap changes we will evaluate possible escape routes Using state-of-the-art development principles Inspiring people to share
  • 15. TYPO3 Content Repository Inspiring people to share
  • 16. Porting the JSR-283 API The API needs to be ported before writing the code Interfaces will not be ported up-front, but as we need them Facing typing issues, some Java types simply do not exist in PHP Binary data will probably be Resource Manager handles instead of streams • Alternatively simple stream handlers, still needs research Features prioritized according to the needs of the TYPO3 CMS project Inspiring people to share
  • 17. Actual data storage The underlying storage of the TYPO3CR will be a RDBMS for the start Currently only SQLite through PDO is used • Easy to use for development and unit testing • The use of PDO already enables any PDO-supported database Specialized DB connectors will follow, using optimized queries, stored procedures, ... • This also opens the door for implementing other connectors, like to LDAP or object databases or ... Inspiring people to share
  • 18. Data storage techniques Basically we need to store a simple tree Read access must be fast, as the majority of requests are read requests, write access should be fast Traditional approach as used – not only – in TYPO3 today is to store a triplet (uid, pid, sorting) Alternative & faster method: Pre/Post Plane Encoding Inspiring people to share
  • 19. Pre/Post Plane Encoding Stores number determined by pre-order and post-order tree traversal Allows to partition the nodes into four regions, as shown for node ƒ Very fast read access, e.g. a single SELECT to query all ancestors to a node ƒ SELECT * FROM table WHERE pre < ƒ.pre AND post > ƒ.post Inspiring people to share
  • 20. Performance considerations Nodes can already be fetched very fast • But attributes must be stored seperately, to keep node table sizes inside sensible limits • Binary data will be stored in the underlying database for easier replication – a transparent cache to the filesystem will be added Write access can be sped up by various approaches like spacing and variable length indices for the pre/post numbers or by partitioning the data over more tables Inspiring people to share
  • 21. Querying the TYPO3 CR Using getRootNode() and friends from the API Using XPath queries Using SQL queries Inspiring people to share
  • 22. API usage for querying $repository = $this->componentManager->getComponent ('T3_phpCR_RepositoryInterface'); $session = $repository->login(); $newsEntries = $session->getNodeByUUID ('96bca35d-1ef5-4a47-8b0c-0bfc79507d08')->getNodes(); foreach($newsEntries as $newsEntry) { $title = $newsEntry->getProperty('title'); $text = $newsEntry->getProperty('text'); // more code here... } Inspiring people to share
  • 23. XPath support for TYPO3R To enable XPath we need • a XPath parser • an efficient way to transform a XPath query into SQL for the used low-level data structure The latter is a lot easier when storing the tree pre/post plane encoded Inspiring people to share
  • 24. SQL support for TYPO3R Using SQL we need • a (simple) SQL parser • an efficient way to transform that SQL into equivalent SQL for the used low-level data structure This still needs to be investigated, possible approaches include storing a reference to the parent node or even using the pre/post plane only as a cache for XPath read queries, optimizing the native storage for SQL read queries Inspiring people to share
  • 25. Extensions to JSR-283 A vendor may choose to offer additional features in his CR implementation The TYPO3CR will offer support for • Data persistency through code annotations • Automatic node type generation based on class members • Rules for setting up virtual root nodes based on node types Inspiring people to share
  • 26. Current status Currently the code supports a subset of the required features of levels 1 & 2 and the optional parts of the JSR-283 specification • Basic read & write access • Namespace registration • Node type discovery and registration Data storage uses the naive approach known from TYPO3 4.x Inspiring people to share
  • 27. Future plans Implementing missing required and optional features according to the JSR-283 specification • Workspaces and versioning will require special attention, as they are key features for the CMS as well! Implement native RDBMS connectors making use of specifically tuned queries and product-specific features Performance tests and tuning as needed Inspiring people to share
  • 28. Summary Implementing the specification is not an easy task, but doable For the various parts a lot of research has already been done in the past The repository is a major improvement over the current way of storing data The whole PHP community could^Wcan^Wwill benefit! Inspiring people to share
  • 29. Thanks for listening Karsten Dambekalns <karsten@typo3.org> Inspiring people to share