Contenu connexe
Similaire à CRX Best practices
Similaire à CRX Best practices (20)
CRX Best practices
- 1. CRX and Sling Best Practices for Web Apps
Tools, Resources & Scripts
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 2011-Mar-30
Wednesday, 30 March 2011
- 2. Outline
CRX Overview
Resource Addressing
Components / Modularization
Component Inheritance
Side track: GFX Rendering
Using File Vault Command Line Tool
Updating Content
Q&A
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 2
Wednesday, 30 March 2011
- 3. CRX Terminology
§ CRX Platform
§ CRX JCR Repository
§ CRX Quickstart
§ CRX Welcome Screen
§ CRX Admin Console (legacy)
§ CRX Explorer
§ CRX Package Manager & Package Share
§ OSGi Console (Apache Felix)
§ CQSE Admin (Communique Servlet Engine)
§ CRXDE Lite (vs CRXDE Eclipse)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 3
Wednesday, 30 March 2011
- 4. CRX Open Core Architecture
Application Runtime
Web Framework: Apache Sling Web/Eclipse IDE Repository Admin
OSGi Runtime: Apache Felix Vault & SVN Tools
JCR Repository
JCR: Apache Jackrabbit Search Extensions Virtual Repository
Search: Lucene GFX Rendering CIFS/SMB Access
Content Extraction: TAR-based Shared-nothing
POI, Tika, PDFBox Node-store Cluster
CRX Platform
4
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential.
Wednesday, 30 March 2011
- 5. CRX Open Core Architecture
Application Runtime
Web Framework: Apache Sling Web/Eclipse IDE Repository Admin
OSGi Runtime: Apache Felix Vault & SVN Tools
JCR Repository
JCR: Apache Jackrabbit Search Extensions Virtual Repository
Search: Lucene GFX Rendering CIFS/SMB Access
Content Extraction: TAR-based Shared-nothing
POI, Tika, PDFBox Node-store Cluster
...CRX is the
CRX Platform commercial
version of
Jackrabbit + Sling
4
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential.
Wednesday, 30 March 2011
- 6. Coding - Let’s Begin
§ Reuse old OOP example: Shapes
§ Content goes here: /content
§ Scripts go here: /apps/shapes/components
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 5
Wednesday, 30 March 2011
- 7. Resource Addressing
Old School Static HTML
§ h p://xyz.com/products/12345.html
e Script Hype (jsp, .net, cgi-bin, ...)
§ h p://xyz.com/products.jsp?id=12345
§ Script centric
RESTful / Sling
§ h p://xyz.com/products/12345.html
§ Resource centric
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 6
Wednesday, 30 March 2011
- 8. Resources & Resource Types
§ Resource hierarchy
§ Each resource has a type
§ Scripts (and Servlets) are resources, too
§ URLs are mapped to resources
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 7
Wednesday, 30 March 2011
- 9. URL Decomposition
selector suffix
GET /content/shape.head.html/markup?simple=true HTTP/1.1
path extension query parameters
1. Content resolution: “/content/shape”
2. Resource type: “sling:resourceType = /apps/shapes/shape”
3. Script resolution look in /apps/shapes/shape:
1. “head.html.jsp” or “head.jsp”
2. “html.jsp” or “shape.jsp”
3. “GET.jsp”
for more info google: “sling script resolution”
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 8
Wednesday, 30 March 2011
- 10. Coding - Modularize
§ Identifysemantical / reusable blocks
§ use the <sling:include/> tag
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 9
Wednesday, 30 March 2011
- 11. Script Resource Inheritance
§ sling:resourceSuperType
§ Scriptresolution traverses the inheritance chain
§ Components = Script resources
§ CQ Components = Script resources++
§ Fallback: DefaultGetServlet / SlingPostServlet
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 10
Wednesday, 30 March 2011
- 12. Coding - Create sub types
§ Create new types for rectangle and triangle shapes
§ Only “implement” scripts that differ
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 11
Wednesday, 30 March 2011
- 13. Script Like Java Servlets (Java Scriptlets?)
§ Normal Java classes extend H pServlet
§ Naming follows normal script resolution rules
e.g: “text.java”, “png.java”, etc.
§ Compiled on demand
§ Example: GFX Rendering
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 12
Wednesday, 30 March 2011
- 14. Coding - Let’s add Images
Graphic Rendering
§ day-commons-gfx bundle (CQ, but not in CRX 2.2, yet)
§ Simple tools to generate png, jpeg and gif images
§ Multiple layers with alpha blending support
§ Text rendering with in-repository font support
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 13
Wednesday, 30 March 2011
- 15. Coding - Let’s use a real IDE
Using the File Vault command line tool
§ Source control like synchronization with JCR repository
§ check-out les
§ view changes / differences
§ check-in les
§ Same format as CRX Content Packages
§ Setup your IDE to use offline content + libs
§ Code completion and be er syntax highlighting
§ Hybrid variant allows tight integration with SCM and
automated build systems.
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 14
Wednesday, 30 March 2011
- 16. Updating Content
Sling Post Servlet
§ POST requests to the resources
§ AJAX friendly responses
§ Mapping for CREATE / DELETE / MOVE operations
§ h p://sling.apache.org/site/manipulating-content-the-
slingpostservlet-servletspost.html
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 15
Wednesday, 30 March 2011
- 17. More Information
Official Sites
§ h p://sling.apache.org/
§ h p://felix.apache.org/
§ h p://dev.day.com/docs/en/crx/current.html
§ h p://jackrabbit.apache.org/
CRX / Jackrabbit Source Code
§ h p://svn.day.com/repos/crx/branches/2.2/
§ h p://svn.apache.org/repos/asf/jackrabbit/branches/2.2/
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 16
Wednesday, 30 March 2011
- 18. More Information
Visit this sessions wiki page
§ h ps://zerowing.corp.adobe.com/display/~tripod/
CRXBestPractices
§ Slidesand recording available
§ Feedback welcome!
§ Vote for future topics
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 17
Wednesday, 30 March 2011
- 19. ank you.
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Con dential. 18
Wednesday, 30 March 2011