What's New In Apache Lenya 1.4

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Group

    What's New In Apache Lenya 1.4 - Presentation Transcript

    1. What‘s
new
in Apache
Lenya
1.4? 
Andreas
Hartmann BeCompany
GmbH 1
    2. Agenda Modularization UUIDs
for
internal
links Repository
API
changes Configurable
Meta
Data Publication
Templating Usecase
Framework Notification
and
Inboxes 2
    3. Modularization 3
    4. Goals
of
Modularization • Improve
Separation
of
Concerns • Reuse
functionality • Loose
coupling
of
functional
areas • Better
maintainability • Reduce
learning
curve • Easier
extensibility 4
    5. 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
    6. Module
Deployment cocoon.xconf modules.root.dirs=src/modules: \\ src/webapp/lenya/pubs/default/modules: \\ /home/john/lenya/modules modules.copy=false 6
    7. 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
    8. Modularization Descriptor
of
the
access
control
module <module xmlns=\"http://apache.org/lenya/module/1.0\"> <id>org.apache.lenya.modules.ac</id> <export package=\"org.apache.lenya.ac.file\"/> <depends module=\"org.apache.lenya.modules.cache\"/> <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
    9. 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=\"org.project.foo\"/> ... </module> 9
    10. Module
Dependencies Foo <module> <id>org.project.modules.foo</id> <export package=\"org.project.foo\"/> </module> Bar <module> <id>com.company.modules.bar</id> <depends module=\"org.project.modules.foo\"/> </module> package com.company.bar; import org.project.foo.*; import org.project.foo.impl.*; class SomeService { ... 10
    11. Requests
to
Module
Sitemaps • cocoon://modules/foo/... • http://.../index.html?lenya.module=foo • http://.../modules/foo/... • http://.../mypub/modules/foo/... 11
    12. Next
Steps • Requirements • Easy
installation • Hot-deploying
modules • Versioning
of
modules • Approaches • Maven • OSGi 12
    13. UUIDs
for
internal
links 13
    14. 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
    15. 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
    16. 
 <<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
    17. Link
Transformers • UuidToUrlTransformer • urls
=
absolute
|
relative • ProxyTransformer • IncomingProxyTransformer • UrlToUuidTransformer 17
    18. Next
Steps • More
efficient
LinkManager
implementations • Based
on
meta
data? 18
    19. Repository
API
Changes 19
    20. Content
Handling
Layers Modules CollectionWrapper AddNewsMessage Lenya Core Publication Area SiteStructure Document Link SiteNode Repository Session Node History MetaData 20
    21. 
 <<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
    22. <<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
    23. 
 <<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
    24. Next
Steps • Queryable
meta
data String xPath = “*[@media:width &gt; 100]“; Query query = new XPathQuery(xPath); Document[] docs = area.getDocuments(query); 24
    25. 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
    26. Configurable
Meta
Data 26
    27. 
 <<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
    28. Meta-Data
Code
Example <meta-data> ... <component-instance name=\"http://apache.org/lenya/metadata/media/1.0\" class=\"org.apache.lenya.cms.metadata.ConfigurableElementSet\"> <element name=\"filename\" multiple=\"false\"/> <element name=\"width\" multiple=\"false\"/> <element name=\"height\" multiple=\"false\"/> </component-instance> ... </meta-data> String mediaNamespace = \"http://apache.org/lenya/metadata/media/1.0\"; MetaData metaData = document.getMetaData(mediaNamespace); String width = metaData.getFirstValue(\"width\"); 28
    29. Publication
Templating 29
    30. Chemistry Math Science Physics Biology 

 University English French Spanish Languages Italian 30
    31. 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
    32. 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
    33. 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
    34. Usecase
Framework 34
    35. 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
    36. 
 continuation Form Form ! ! Template Template View Sitemap + Flowscript Controller ! Usecase Handler vali- dation Documents, ... Documents, ... Model 36
    37. Declaring
a
Usecase <component-instance name=\"site.create\" class=\"o.a.lenya.cms.site.usecases.CreateDocument\"> <view template=\"modules/.../usecases/site/create.jx\"> <parameter name=“...“ value=“...“/> </view> <parameter name=“...“ value=“...“/> <parameter name=“...“ value=“...“/> <transaction policy=“pessimistic“/> <exit usecase=“...“> <parameter name=“...“ value=“...“/> </exit> </component-instance> 37
    38. 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
    39. Notification
and
 Inboxes 39
    40. 
 <<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
    41. Creating
a
Message User recipient = userManager.getUser(userId); Identifiable[] recipients = { recipient }; String subject = \"publish-notification\"; String[] subjectParams = {}; String body = \"document-was-published\" String[] bodyParams = { DublinCoreHelper.getTitle(document) }; Message message = new Message(subject, subjectParams, body, bodyParams, sender, recipients); 41
    42. 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
    43. 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
    44. Configuring
Notification cocoon.xconf Lenya
Inbox: <component logger=\"lenya.notification\" role=\"org.apache.lenya.notification.Notifier\" class=\"org.apache.lenya.inbox.InboxNotifier\"/> E-Mail: <component logger=\"lenya.notification\" role=\"org.apache.lenya.notification.Notifier\" class=\"org.apache.lenya.notification.EmailNotifier\"> <smtp host=\"localhost\" username=\"john\" password=\"...\"/> </component> 44
    45. Questions
and
 Discussion 45

    + nobbynobby, 3 years ago

    custom

    1225 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1225
      • 1225 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 33
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events