• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
What's New In Apache Lenya 1.4
 

What's New In Apache Lenya 1.4

on

  • 2,593 views

 

Statistics

Views

Total Views
2,593
Views on SlideShare
2,593
Embed Views
0

Actions

Likes
0
Downloads
43
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    What's New In Apache Lenya 1.4 What's New In Apache Lenya 1.4 Presentation Transcript

    • What‘s
new
in Apache
Lenya
1.4? 
Andreas
Hartmann BeCompany
GmbH 1
    • Agenda Modularization UUIDs
for
internal
links Repository
API
changes Configurable
Meta
Data Publication
Templating Usecase
Framework Notification
and
Inboxes 2
    • Modularization 3
    • Goals
of
Modularization • Improve
Separation
of
Concerns • Reuse
functionality • Loose
coupling
of
functional
areas • Better
maintainability • Reduce
learning
curve • Easier
extensibility 4
    • Modularization Module Module Editor X ... Resource Type A Integration Code Foo Service API Module Module Alternative ... Foo Impl Default Foo Impl API Core Impl 5
    • Module
Deployment cocoon.xconf modules.root.dirs=src/modules: src/webapp/lenya/pubs/default/modules: /home/john/lenya/modules modules.copy=false 6
    • Directory
Structure mymodule/ config/ configuration files module.xml module descriptor cocoon-xconf/ patches for cocoon.xconf services.xconf sitemap/ patches for main Lenya sitemap transformers.xconf usecases/ myusecase.jx usecase view resources/ images/ image files css/ CSS files schemas/ XML schemas (RNG, XSD, ...) samples/ Samples (in case of resource type modules) java/ src/ Java source files test/ Java test classes lib/ Java libraries xslt/ XSLT stylesheets sitemap.xmap main module sitemap 7
    • Modularization Descriptor
of
the
access
control
module <module xmlns=quot;http://apache.org/lenya/module/1.0quot;> <id>org.apache.lenya.modules.ac</id> <export package=quot;org.apache.lenya.ac.filequot;/> <depends module=quot;org.apache.lenya.modules.cachequot;/> <package>org.apache.lenya.modules</package> <version>0.1-dev</version> <name>Access control</name> <lenya-version>@lenya.version@</lenya-version> <description>Access control</description> </module> 8
    • Module
API Stable org.project.foo.* Foo Service API Module org.project.foo.impl.* Default Foo Impl org.project.foo.util.* org.otherproject.* Subject
to
 Change <module> ... <export package=quot;org.project.fooquot;/> ... </module> 9
    • Module
Dependencies Foo <module> <id>org.project.modules.foo</id> <export package=quot;org.project.fooquot;/> </module> Bar <module> <id>com.company.modules.bar</id> <depends module=quot;org.project.modules.fooquot;/> </module> package com.company.bar; import org.project.foo.*; import org.project.foo.impl.*; class SomeService { ... 10
    • Requests
to
Module
Sitemaps • cocoon://modules/foo/... • http://.../index.html?lenya.module=foo • http://.../modules/foo/... • http://.../mypub/modules/foo/... 11
    • Next
Steps • Requirements • Easy
installation • Hot-deploying
modules • Versioning
of
modules • Approaches • Maven • OSGi 12
    • UUIDs
for
internal
links 13
    • What
is
a
UUID? • Universally
Unique
Identifier • Standardized
by
the
Open
Software
Foundation • Canonical
form:
32
hexadecimal
digits 550e8400-e29b-41d4-a716-446655440000 • Neglectable
risk
of
duplicates:
UUID-based
 collections
can
be
combined
without
problems 14
    • Advantages
of
UUIDs
 • Separation
of
Concerns:
No
duplication
of
URL
 information
(sitetree
and
document
path) • No
need
to
copy/move
files
when
URLs
change • No
need
for
link
rewriting
when
URLs
change • Multiple
views
(URL
spaces)
for
document
space • Document
collections
can
be
combined
(import) 15
    • 
 <<interface>> LinkResolver Link MODE_DEFAULT_LANGUAGE getUri() : String MODE_FAIL getPubId() : String getArea() : String resolve(sourceDocument, uri) : LinkTarget getUuid() : String getFallbackMode() : int getLanguage() : String setFallbackMode(int) <<interface>> LinkManager LinkTarget getLinksFrom(sourceDocument) : Link[] exists() : boolean getReferencingDocuments(targetDoc) : Document[] getDocument() : document isRevisionSpecified() : boolean getRevisionNumber() : int ContentLinkManager UuidToUrlRewriter <<interface>> OutgoingLinkRewriter LinkRewriter IncomingLinkRewriter matches(url) : boolean rewrite(url) : String UrlToUuidRewriter 16
    • Link
Transformers • UuidToUrlTransformer • urls
=
absolute
|
relative • ProxyTransformer • IncomingProxyTransformer • UrlToUuidTransformer 17
    • Next
Steps • More
efficient
LinkManager
implementations • Based
on
meta
data? 18
    • Repository
API
Changes 19
    • Content
Handling
Layers Modules CollectionWrapper AddNewsMessage Lenya Core Publication Area SiteStructure Document Link SiteNode Repository Session Node History MetaData 20
    • 
 <<interface>> <<interface>> MetaDataOwner Session commit() rollback() <<interface>> ContentHolder exists() : boolean * getContentLength() : long <<interface>> getInputStream() : InputStream RepositoryItem getlastModified() : long getMimeType() : String getSourceURI() : String <<interface>> Node checkin(), checkout() SourceNode lock(), unlock() exists() : boolean delete() getChildren() : Collection JCRSourceNode getHistory() : History 21
    • <<interface>> SiteStructure <<interface>> getNodes() : SiteNode[] Publication getNode(path) : SiteNode getAreaNames() : String[] getByUuid(uuid, language) : Link getArea(String) : Area contains(path) : boolean contains(path, language) : boolean containsByUuid(uuid, language) : booelan * add(path) : SiteNode add(path, Document) : Link <<interface>> Area getDocuments() : Document[] * getDocument(uuid, language) : Document <<interface>> SiteNode contains(uuid, language) : boolean getUuid() : String getSite() : SiteStructure getChildren() : SiteNode[] hasLink(language) : boolean getLink(language) : Link * isVisible() : boolean <<interface>> setVisible(boolean) Document * getUUID() : String <<interface>> Link getLanguages() : String[] getTranslation(String) : Document getLanguage() : String getRepositoryNode() : Node getLabel() : String 0..1 getInputStream() : InputStream setLabel(String) getOutputStream() : OutputStream getDocument() : Document 22
    • 
 <<interface>> Collection getDocuments() : Document[] add(Document) remove(Document) clear() contains(Document) : boolean CollectionWrapper <<interface>> checkin(), checkout() Document lock(), unlock() exists() : boolean getInputStream() delete() <<interface>> Usecase getOutputStream() getChildren() : Collection getHistory() : History execute() NewsWrapper AddNewsMessage addNewsMessage(NewsMessage) execute() 23
    • Next
Steps • Queryable
meta
data String xPath = “*[@media:width &gt; 100]“; Query query = new XPathQuery(xPath); Document[] docs = area.getDocuments(query); 24
    • Code
Example public void addNewsDocument(String newsPath, String uuid, String language) { Session session = RepositoryUtil.getSession(this.manager, this.request); DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, this.request); String webappUrl = ServletHelper.getWebappUrl(this.request); URLInformation info = new URLInformation(webappUrl); Publication pub = factory.getPublication(info.getPublicationId()); Area authoring = pub.getArea(„authoring“); Document[] docs = authoring.getDocuments(); Document messageDoc = authoring.getDocument(uuid, language); SiteStructure site = authoring.getSite(); SiteNode node = site.getNode(newsPath); String[] languages = node.getLanguages(); Link link = node.getLink(language); Document newsDoc = link.getDocument(); NewsWrapper newsWrapper = new NewsWrapper(newsDoc, getLogger()); wrapper.add(0, messageDoc); } 25
    • Configurable
Meta
Data 26
    • 
 <<interface>> <<interface>> MetaDataRegistry MetaDataOwner getElementSet(namespaceUri) : ElementSet getMetaData(namespaceUri) : MetaData getNamespaceUris() : String[] getMetaDataNamespaceUris() : String[] register(namespaceUri, elementSet) isRegistered(namespaceUri) : boolean * * <<interface>> <<interface>> ElementSet MetaData getNamespaceUri() : String getAvailableKeys() getElements() : Element[] addValue(key, value) getElement(name) : element setValue(key, value) containsElement(name) : boolean getValues(key) * <<interface>> Element ONCOPY_COPY ONCOPY_DELETE ONCOPY_IGNORE getName() : String isEditable() : String isMultiple() : String getActionOnCopy() : int 27
    • Meta-Data
Code
Example <meta-data> ... <component-instance name=quot;http://apache.org/lenya/metadata/media/1.0quot; class=quot;org.apache.lenya.cms.metadata.ConfigurableElementSetquot;> <element name=quot;filenamequot; multiple=quot;falsequot;/> <element name=quot;widthquot; multiple=quot;falsequot;/> <element name=quot;heightquot; multiple=quot;falsequot;/> </component-instance> ... </meta-data> String mediaNamespace = quot;http://apache.org/lenya/metadata/media/1.0quot;; MetaData metaData = document.getMetaData(mediaNamespace); String width = metaData.getFirstValue(quot;widthquot;); 28
    • Publication
Templating 29
    • Chemistry Math Science Physics Biology 

 University English French Spanish Languages Italian 30
    • Overriding
Resources @import ... University XSLT A XSLT B main.css head.css Science XSLT A XSLT B' main.css head.css Physics XSLT A XSLT B'' main.css head.css <xsl:import> 31
    • Templating
API <<interface>> <<interface>> Instantiator PublicationTemplateManager instantiate(templatePub, id, name) visit(publication, publicationVisitor) visit(publication, path, sourceVisitor) <<interface>> <<interface>> <<interface>> SourceVisitor VisitingSourceResolver PublicationVisitor visit(resolver, sourceUri) getSource() : Source visit(publication) ExistingSourceResolver AllExistingSourceResolver getUris() : String[] ExistingAncestorSourceResolver 32
    • Publication
and
Source
Visitors • Bottom-up
traversal
of
publication
tree • PublicationVisitor General
purpose • ExistingSourceResolver
-
fallback:// Find
first
existing
source • ExistingAncestorSourceResolver
-
template-fallback:// Find
second
existing
source
(works
only
for
leaf
source!) • AllExistingSourceResolver
-
aggregate-fallback:// Find
all
existing
sources 33
    • Usecase
Framework 34
    • Usecases • User
interaction • Typically
form-based • Edit
and
manage
content • Interact
with
other
applications
(newsletter) • Functionality
for
website
visitors
(contact
form) • ... • Triggered
using
a
request
parameter
(lenya.usecase) • Full
screen
or
document-based 35
    • 
 continuation Form Form ! ! Template Template View Sitemap + Flowscript Controller ! Usecase Handler vali- dation Documents, ... Documents, ... Model 36
    • Declaring
a
Usecase <component-instance name=quot;site.createquot; class=quot;o.a.lenya.cms.site.usecases.CreateDocumentquot;> <view template=quot;modules/.../usecases/site/create.jxquot;> <parameter name=“...“ value=“...“/> </view> <parameter name=“...“ value=“...“/> <parameter name=“...“ value=“...“/> <transaction policy=“pessimistic“/> <exit usecase=“...“> <parameter name=“...“ value=“...“/> </exit> </component-instance> 37
    • Example
Usecase: <<interface>> Usecase Contact
Form initParameters() checkPreconditions() advance() checkExecutionConditions() execute() <<interface>> checkPostconditions() UserManager getUser(userId) : User AbstractUsecase <<interface>> Notifier notify(recipients, sender, message) ContactForm MailNotifier SmsNotifier InboxNotifier 38
    • Notification
and
 Inboxes 39
    • 
 <<interface>> <<interface>> RepositoryEvent Notifier RepositoryListener getDescriptor() : Object notify(message) eventFired(RepositoryEvent) Object AbstractNotifier NotificationListener notify(message) NotificationEventDescriptor notify(user, translatedMessage) translateMessage(locale, message) getMessage() : Message Message getSender() : Identifiable EmailNotifier getSubject() : String getSubjectParameters() : String[] InboxNotifier getBody() : String getBodyParameters() : String[] getTime() : Date 40
    • Creating
a
Message User recipient = userManager.getUser(userId); Identifiable[] recipients = { recipient }; String subject = quot;publish-notificationquot;; String[] subjectParams = {}; String body = quot;document-was-publishedquot; String[] bodyParams = { DublinCoreHelper.getTitle(document) }; Message message = new Message(subject, subjectParams, body, bodyParams, sender, recipients); 41
    • Sending
Notification
Messages a)
Directly • Immediate
notification NotificationUtil.notify(this.manager, message); b)
Via
repository
observation • Notification
when
(if)
session
is
committed NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message); RepositoryEvent event = RepositoryEventFactory .createEvent(this.manager, authoringDocument, getLogger(), descriptor); getSession().enqueueEvent(event); 42
    • Inbox
API <<interface>> InboxManager getInbox(User) : Inbox <<interface>> Inbox getMessages() : InboxMessage[] getMessage(id) : InboxMessage add(message) remove(message) * Message <<interface>> InboxMessage getSender() : Identifiable getSubject() : String getId() : String getSubjectParameters() : String[] getMessage() : Message getBody() : String isMarkedAsRead() : boolean getBodyParameters() : String[] markAsRead(boolean) getTime() : Date 43
    • Configuring
Notification cocoon.xconf Lenya
Inbox: <component logger=quot;lenya.notificationquot; role=quot;org.apache.lenya.notification.Notifierquot; class=quot;org.apache.lenya.inbox.InboxNotifierquot;/> E-Mail: <component logger=quot;lenya.notificationquot; role=quot;org.apache.lenya.notification.Notifierquot; class=quot;org.apache.lenya.notification.EmailNotifierquot;> <smtp host=quot;localhostquot; username=quot;johnquot; password=quot;...quot;/> </component> 44
    • Questions
and
 Discussion 45