Top Banner
Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice President Engineering
29

Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Apr 03, 2018

Download

Documents

volien
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Liferay ArchitectureUnderstanding the inside of Liferay

Jorge FerrerVice President

Engineering

Page 2: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Table of Contents● Architecture Overview

● Services● Transactions● Indexing● Workflow● Cache● Frameworks

● Secret Ingredients

Page 3: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Architecture Overview

Page 4: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice
Page 5: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

● Local: Business logic & Persistance

● Remote: Security & Remote Access

Services (and persistence)

WOA

SOA

Page 6: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Services Patterns● Service per model entity● Always return void, <Entity> o List<Entity>● Grouped as:

● Portal services ● Per “Portlet” services

● Encapsulate all access to Persistence and Finders

● Security must be in remote layer

Page 7: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Service Builder● Takes care of all the plumbing and heavy lifting:

● Persistence (Hibernate and custom SQL)● Caching (Persistence layer)● Services and remote protocols● Spring wiring

● Define your models and services in service.xml● See DTD to find out about all options

● Code generated via Freemarker Templates

Page 8: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Caching

✔ SB Finder Cache & Entity CacheSB Finder Cache & Entity Cache

✔ Hibernate Caching (L1 y L2)Hibernate Caching (L1 y L2)

✔ SB Finder Cache & Entity CacheSB Finder Cache & Entity Cache

✔ Hibernate Caching (L1 y L2)Hibernate Caching (L1 y L2)

✔ MultiVMPool (Cluster Aware)MultiVMPool (Cluster Aware)

✔ SingleVMPoolSingleVMPool

✔ MultiVMPool (Cluster Aware)MultiVMPool (Cluster Aware)

✔ SingleVMPoolSingleVMPool

✔ Page HTML cache (CacheFilter)Page HTML cache (CacheFilter)✔ Portlet caching (UI and resources)Portlet caching (UI and resources)✔ CSS & JS cache: Minified & BundledCSS & JS cache: Minified & Bundled

✔ Page HTML cache (CacheFilter)Page HTML cache (CacheFilter)✔ Portlet caching (UI and resources)Portlet caching (UI and resources)✔ CSS & JS cache: Minified & BundledCSS & JS cache: Minified & Bundled

Page 9: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Cache Distribution● One to one

● RMI (Default <6.1)

● Multicast (Default 6.1+)

● Centralized● Terracota (Terracota

Edition)

● Memcache

Invalidation

Page 10: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Transactions● Definition: Executing operations atomically● Service methods happen within a transaction (Based on

Spring)● ServiceBuilder generates annotations:

– add*, check*, clear*, delete*, set*, and update*: require propagation, read-write

– All others: supported, read-only● How about transactionality in plugins that invoke the portal?

● Automatic support for “distributed” transactions across plugins by reusing Hibernate's connection

Page 11: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

● Modular architecture● Out of the box support for:

● Lucene (Clustering with ClusterLink via jGroups)● SOLR

● Asynchronous indexation (Message bus via AOP)

Indexing

Page 12: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

● Unified API for Services● Modular architecture● Out of the box support for:

● Liferay Kaleo● JBPM 3

Workflow Framework

Page 13: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Frameworks● Permissions: role based, resource oriented● Asset Framework: common functionality for all content:

tags, categories, counts, ...● Message Bus: Used mainly for Asynchronous

Invocations● Used for: indexing, metadata extraction, notifications, ...

● Scripting: ● Supports: JavaScript, Ruby, Python, …

● Forbidden classes

● Audit: auditing user actions● Expando: allows dynamic relational storage● More...

Page 14: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

The secret ingredients

Page 15: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Consistency● Never reinvent the wheel

● See if it's already coded somewhere else

● Always follow existing patterns & standards● Use Copy & Paste intelligently when needed

● Reuse and code to allow reusing

Enforced through Peer Reviews and a code Gatekeeper: Brian

Page 16: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Facilitate maintainability● Use modern de-facto standard libraries:

spring, hibernate, lucene, …● But use them only for what is really needed

● Always find the best place for your code● (Even) If it's not broken don't fix it change it

● Never leave legacy behind

Enforced through Peer Reviews and a code Gatekeeper: Brian

Page 17: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Contributions● Great ideas come from advanced

developers using the product● Some examples:

● Service Builder Freemarker templates● Auto Deploy● Clp

Quality guaranteed through Peer Reviews and a code Gatekeeper: Brian

Page 18: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Coming next● Module Framework (OSGi)● Application Resiliency● More hook-ability to facilitate combination

of hooks

Page 19: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Thanks!

Bonus content in the downloadable slides:● Request Handling● Plugin Architecture

● Deployment● Class loading

Page 20: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Request Handling

Page 21: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Request Cycle – Portal URL

Page 22: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Request Cycle – Portlet URL

Page 23: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Plugin Architecture

Page 24: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Application Containers● Portlet Container: included in the core● OpenSocial Container● Other frontend integration solutions:

● PortletBridge: Integrated in Liferay as a portlet, WebProxy.

● Iframe Portlet: Smart resizing and tracking● WSRP: Provided through a plugin

Page 25: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Running!

Plugin Deployment

Page 26: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Class Loading Hierarchy

Classes should be no higher in the hierarchy than they are supposed to exist

Page 27: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Class Loading ProcessClassloaders delegate the requests to load that class to their parent classloaders

Page 28: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Class Loading Manipulation1. Interface-based

Dependency Injection● Invocation of services

● Invocation of PortalImpl and other utils

2. Explicit class loader invocation

● CLP: inter-portlet invocation

● PortalClassLoader

Page 29: Liferay Architecture - MPDLMediaWikicolab.mpdl.mpg.de/.../3/34/TrackB-Wed-1020-Liferay-Architecture.pdf · Liferay Architecture Understanding the inside of Liferay Jorge Ferrer Vice

Class Loading for Ext, Hook,Web1.Ext

1. All code executes in Portal context

2.Hook1. Java classes execute in plugin context

2. JSPs execute in Portal context

3.Web1. All code executes in plugin context