View
2.935
Download
0
Category
Preview:
DESCRIPTION
Implementation and architecture notes for the Mindquarry Collaboration Server. Presented at the 7th Cocoon GetTogether in Rome.
Citation preview
Mindquarry
Mindquarry for Cocoon Users
Lars Trieloff, Mindquarry
1
Mindquarry
What is Mindquarry 2
Mindquarry
What is Mindquarry 2
Mindquarry
What is Mindquarry 2
Mindquarry
What is Mindquarry 2
Mindquarry
What is Mindquarry 2
Mindquarry
Short Demo 3Mindquarry Collaboration Server:
Teams, Files, Tasks and TalkMindquarry Desktop Client:
File Synchronization, Task ManagementLive Sites:
http://www.mindquarry.org
Mindquarry
Mindquarry InternalsServer based on
Apache Cocoon 2.2Apache JackrabbitApache Lucene SolrSubversionApache Web Servermod_perlSubethaSMTPJRuby
Client based onJava 5SWTSvnkit
4
Mindquarry
Architecture 5Jetty Web App Container
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
Team Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
Apache Jackrabbit
Team Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
DForms Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
DForms Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Files Block
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Files Block
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Talk Block
Files Block
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Talk Block
Files Block
SubethaSMTP
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Talk Block
Files Block
SubethaSMTP
Mail Parser
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Talk Block
Files Block
SubethaSMTP
Mail Parser
REST Client
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Talk Block
Files Block
SubethaSMTP
Mail Parser
REST Client
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Search Block
Talk Block
Files Block
SubethaSMTP
Mail Parser
REST Client
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Search Block
Talk Block
Solr Servlet
Files Block
SubethaSMTP
Mail Parser
REST Client
SVN Repo
Mindquarry
Architecture 5Jetty Web App Container
Apache Cocoon 2.2
PostgreSQL
Apache Jackrabbit
Team Block
Wiki Block
Tasks Block
DForms Block
Search Block
Talk Block
Solr Servlet
Files Block
SubethaSMTP
Mail Parser
REST Client
SVN Repo
Lucene Index
Mindquarry
Lessons learned 6
1. Integrating Jackrabbit and Cocoon2.Using the Servlet Services Architecture3. Integrating Solr-based search with Cocoon4.Tuning AJAX Performance5.Neat REST Tricks in Mindquarry
Code and Libraries available at www.mindquarry.org
Mindquarry
Jackrabbit and CocoonJackrabbit: JCR/JSR-173 Container
Versioned, Typed, Queryable Node StoreIdeal for document-centric applications
Mindquarry's Enhancementscom.mindquarry.jcr.xml.source.JCRNodeSource
an JCR-to-XML mappingcom.mindquarry.jcr.jackrabbit.xpath.JaxenQueryHandler
a XPath 1.0 Query handler for Jackrabbit based on Jaxen Mindquarry's most popular Pitfalls
Having many small nodes in JCR affects performanceMapping Business objects to JCR is no good ideaThere is no easy way to limit the result size of queries
7
Mindquarry
Mapping XML to JCR 8/
rep:root
users
nt:folder
images
nt:folder
alex.saar
nt:file
xt:element
nt:unstructured
*
photo154
nt:file
jcr:content
nt:resource
BINARY jcr:data
STRING jcr:mimeType
nt:resource
xt:versionableresource
mix:versionable
namext:element
jcr:content
xt:document
<user>
<name>Alexander Saar</name>
<email type="business">alex@mq.com</name>
</user>
XML
Binary Data
xt:text
STRING xt:characters
textxt:text
STRING xt:characters = Alexander Saar
textxt:text
STRING xt:characters = alex@mq.com
xt:element: child nodes of
type xt:element (XML
elements)xt:element: child
properties of type
STRING (XML attribute)
emailxt:element
STRING type = business
DATE jcr:lastModified
Later
user
xt:element
xt:document
nt:unstructured
Mindquarry
Using Servlet ServicesServlet Services allow running and interacting with arbitrary servlets in the Cocoon "Container"What works great
Shielding: Conflicting dependencies are no problemInheritance: Define a parent block that handles all requests that the child cannot handle
What needs more handworkInheritance of resources, e.g. having a common styling resource for all blocksPassing complex requests (e.g. including authentication) between blocksPolymorphy: e.g. a parent block passing sub-requests back to the child
9
Mindquarry
Mindquarry's Servlet Services 10
Team Block
Wiki Block Tasks Block
DForms Block
Search Block
Talk Block
Solr Servlet
Files Block
Resources Block Usage
Inheritance
Mindquarry
Integrating Solr and Cocoon
Solr is a REST-based search engine based on LuceneImplemented as a Servlet, easy to embed in Cocoon
11
Solr Servlet
Lucene Index
SolrPostSerializer
AJAX Client
HTTP POST XML
HTTPGETJSON
XSLTTextFilterGenerator
Document
When using with Jackrabbit, Shielding is neccessarycom.mindquarry.cocoon.TextFilterGenerator
MindquarryTuning AJAX Performance
Cocoon uses Dojo, which is very powerfulAnd up to 500 kb big, which need to be
downloadedparsed
for every page reloadbetter use cachingand better do not reload
Mindquarry uses following solutionspecial AJAX representation of every resourcecustomization stylesheet (html2lightbox.xsl)Client side: Dojo widget AjaxLink
replaces every (internal) link with an AJAX call
12
Mindquarry
REST in MindquarryWhat means REST?
Everything is a resource and has an URIDifferent representations of a resource possible
HTML, XML, RSS, JSON, Atom...Interaction via GET, PUT, POST, DELETE
13
HTTP Authentication
HTTPAccept-Headers
Session-lessweb applications
Mindquarry
Specify what content the client can processmost often HTML, images, but also XML, JSON, etc.
Definition:
14HTTP
Accept-Headers
<selector name="REST" src="org.apache.cocoon.selection.RegexpHeaderSelector"> <header-name>accept</header-name> <pattern name="html">application/xhtml\+xml|text/html|\*/\*</pattern> <pattern name="xml">text/xml</pattern> <pattern name="atom">application/atom.xml</pattern> <pattern name="pdf">application/pdf</pattern> <pattern name="opml">text/x-opml</pattern> <pattern name="ical">text/calendar</pattern> <pattern name="json">(text|application)/json</pattern></selector>
Mindquarry
Usage Example:
15HTTP
Accept-Headers
<select type="REST"> <when test="json"> <transform src="xslt/json/log2jsonXML.xsl"> <parameter name="baselink" value="/tasks/{1}/{2}" /> </transform> <transform type="i18n"> <parameter name="locale" value="{request-attr:locale}" /> <parameter name="default-catalogue-id" value="mindquarry" /> </transform> <serialize type="json" /> </when> <otherwise> <serialize type="xml" /> </otherwise></select>
Mindquarry
What to do if my client does not support Accept-Headers?
16HTTP
Accept-Headers
<filter> <filter-name>HttpHeaderSpoofingFilter</filter-name> <display-name>HTTP Header Spoofing Filter</display-name> <filter-class> com.mindquarry.webapp.servlet.HttpHeaderSpoofingFilter </filter-class></filter>
Turns http-*-header request parameters into actual HTTP headers
Example usagehttp://localhost:8888/changes?http-accept-header=application/json
Mindquarry
HTTP-Basic or HTTP-Digest Authenticationcross client support (even non-interactive)no Cookies neededno Sessions neededBut: ugly login window
17HTTP
Authentication
Mindquarry
Mindquarry's solution combinesa servlet filtera Dojo (AJAX) widget
18HTTP
Authentication
<filter> <filter-name>MindquarryAuthenticationFilter</filter-name> <display-name> Mindquarry Authentication filter </display-name> <filter-class> com.mindquarry.user.webapp.AuthenticationFilter </filter-class> <init-param> <param-name>realm</param-name> <param-value>Mindquarry Server</param-value> </init-param></filter>
Mindquarry
Mindquarry needs no sessionsREST architectureHTTP AuthenticationEasy to cluster
But Mindquarry uses CForms, which uses Continuations, which is very close to sessionsA better solution:
AJAX-based formsconstruct XML document from form valuessend PUT, POST or DELETE afterwards
But not yet implemented
19Session-less
web applications
Mindquarry
Thank You
20
www.mindquarry.comlars.trieloff@mindquarry.com
Recommended