Nuxeo Enterprise Platform - Version 5.1

The Reference guide

Julien Anguenot, Eric Barroca, Benoit Delbosc, Thierry Delprat, Damien Dupraz, Laurent Doguin, Alain Escaffre, Stefane Fermigier, Laurent Godard, Olivier Grisel, Florent Guillaume, Solen Guitter, Jean-Marc Orliaguet, Narcis Paslaru, Georges Racinet, Thibault Soulcié, Bogdan Stefanescu, Anahide Tchertchian, Quentin Lamerand, M.-A. Darche, Julien Carsique

5.1

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2; with Invariant Section “Commercial Support”, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at the URL: http://www.gnu.org/copyleft/fdl.html


Table of Contents

I. Introduction
1. Preface
1.1. What this Book Covers
1.2. What this book doesn't cover
1.3. Target Audience
1.4. About Nuxeo
1.5. About Open Source
2. Introduction
2.1. Enterprise Content Management
2.1.1. Why ECM?
2.2. The Nuxeo ECM platform
2.3. Introduction FAQ
2.3.1. What are Nuxeo EP 5, Nuxeo EP and Nuxeo RCP?
2.4. Intended audience
2.5. What this book covers
3. Getting Started
3.1. Introduction
3.2. Prerequisites
3.3. Starting a new project
3.3.1. About Maven
3.3.2. Generate a new project with the nuxeo-archetype-start archetype
3.3.3. Ant settings
3.3.4. "Eclipsize" your project
3.3.5. Running your custom project
3.3.6. Refresh xhtml pages without restarting jboss
3.3.7. Learning from the nuxeo sample project
3.4. Using Documentation
3.5. Advanced tools and tips
3.5.1. Useful plugins when developing on top of Nuxeo with Eclipse
3.5.2. Remote debugging in Eclipse
3.5.3. Browsing a JCR repository
3.6. Other IDEs: IntelliJ IDEA and NetBeans
3.6.1. IDEA
3.6.2. NetBeans
4. General Overview
4.1. Introduction
4.1.1. Architecture Goals
4.1.2. Main concepts and design
4.2. Nuxeo Runtime: the Nuxeo EP component model
4.2.1. The motivations for the runtime layer
4.2.2. Extensible component model
4.2.3. Flexible deployment system
4.2.4. Extension points and Nuxeo 5
4.3. Nuxeo EP layered architecture
4.3.1. Layers in Nuxeo EP
4.3.2. API and Packaging impacts
4.3.3. Illustration of the layered architecture
4.4. Core Layer overview
4.4.1. Features of Nuxeo Core
4.4.2. Nuxeo Core main modules
4.4.3. Schemas and document types
4.4.4. Life cycle associated to documents
4.4.5. Security model
4.4.6. Core events system
4.4.7. Query system
4.4.8. Versioning system
4.4.9. Repository and SPI Model
4.4.10. DocumentModel
4.4.11. Proxies
4.4.12. Core API
4.5. Service Layer overview
4.5.1. Role of services in Nuxeo EP architecture
4.5.2. Services implementation patterns
4.5.3. Platform API
4.5.4. Adapters
4.5.5. Some examples of Nuxeo EP services
4.6. Web presentation layer overview
4.6.1. Technology choices
4.6.2. Componentized web application
5. Schemas and Documents
5.1. Introduction
5.1.1. Concepts
5.2. Schemas
5.3. Core Document Types
5.4. ECM Document Types
5.4.1. Label and Icon
5.4.2. Default view
5.4.3. Layout
5.4.4. Containment rules
5.4.5. Summary
II. Platform Services
6. Actions, Views and JSF tags
6.1. Introduction
6.2. Actions
6.2.1. Concepts
6.2.2. Manage actions
6.3. Views
6.3.1. UI Views
6.3.2. Manage views
6.4. Nuxeo JSF tags
7. Layouts
7.1. Introduction
7.1.1. Layouts
7.1.2. Widgets
7.1.3. Widget types
7.1.4. Modes
7.2. Manage layouts
7.2.1. Layout registration
7.2.2. Layout definition
7.2.3. Widget definition
7.2.4. EL expressions in layouts and widgets
7.3. Document layouts
7.4. Layout display
7.5. Standard widget types
7.5.1. text
7.5.2. int
7.5.3. secret
7.5.4. textarea
7.5.5. datetime
7.5.6. template
7.5.7. file
7.5.8. htmltext
7.5.9. selectOneDirectory
7.5.10. selectManyDirectory
7.5.11. list
7.5.12. checkbox
7.6. Custom templates
7.6.1. Custom layout template
7.6.2. Custom widget template
7.6.3. Builtin templates to handle complex properties
7.7. Custom widget types
7.8. Generic layout usage
8. Event Listeners and Scheduling
8.1. Introduction
8.2. Concepts
8.3. Adding an event listener
8.4. Upgrading an event listener
8.5. Adding an event
8.6. From CoreEvents to JMS Messages
8.7. Adding a JMS message listener
8.8. Scheduling
9. User Notification Service
9.1. Introduction
9.2. Notification concept
9.3. Notification channels
9.4. E-mail notifications
10. Indexing & Searching
10.1. Introduction
10.2. Configuration
10.2.1. Concepts
10.2.2. The indexableDocType extension point
10.2.3. The resource extension point
10.2.4. Field configuration
10.2.5. Text fields and analyzers
10.2.6. Boolean attributes
10.2.7. Schema resources and fields without configuration
10.2.8. Schema resources
10.2.9. Automatic fields configuration
10.3. Programmatic Searching
10.3.1. Fields and literals
10.3.2. WHERE statements
10.4. The Compass plugin
10.4.1. Configuring Compass
10.4.2. Global configuration
10.4.3. Mappings for Nuxeo
10.4.4. Text fields behavior
10.5. Building a search UI with QueryModel
11. Look and feel
11.1. Introduction
11.2. Principle
11.3. Mechanism
11.3.1. The Elements
11.3.2. The format
11.3.3. The negotiation
11.3.4. The engine
11.3.5. Resource management
11.3.6. Application
11.4. Customizing the theme
11.4.1. Modifying the current theme using theme-default.xml
11.4.2. Modifying the current theme
11.4.3. Adding a new theme and its pages
12. Authentication, Users & Groups Management
12.1. Introduction
12.2. Users and Groups configuration
12.2.1. Schemas
12.2.2. Directories
12.2.3. UserManager
12.2.4. User Management Interface
12.3. Authentication
12.3.1. Authentication Framework Overview
12.3.2. Pluggable JAAS Login Module
12.3.3. Pluggable Web Authentication Filter
13. Security Policy Service
13.1. Introduction
13.2. Architecture
13.3. Policy contributions
13.3.1. Core policy contribution
13.3.2. Search policy contribution
14. Workflow & BPM
14.1. Introduction
14.2. Architecture
14.2.1. Big picture
14.2.2. Nuxeo Core Workflow
14.2.3. Nuxeo Workflow Document API and services
14.3. Deploying process definitions
14.3.1. Using extension points
14.3.2. Using the workflow POJO service
14.3.3. Using EJB remoting
14.4. Nuxeo Core document integration
14.4.1. Security policy
14.4.2. Application level rules and filters
14.5. Document Versioning
14.5.1. Setting the version of a document
14.5.2. Modifying automatically the version of a document
14.5.3. Accessing document from previous version
14.5.4. The versioning service implementation
14.6. jBPM integration
14.6.1. Process definition deployment
14.6.2. Business handlers and Nuxeo Core integration
14.7. Nuxeo Workflow Web Client
14.8. Auditing workflow related events
14.9. Notification on workflow related events
14.10. Example of a document review process
15. Logging and Audit Service
15.1. Introduction
15.2. Features
15.3. The nuxeo-platform-audit-web-access addon
15.4. Architecture
15.5. Extending the audit service
15.5.1. Register new events to log
15.5.2. Customize audit entries schema
16. Directories and Vocabularies
16.1. Introduction
16.2. Directory with a Relational Database Management System (SQL) server as backend
16.3. Directory with an LDAP server as backend
16.4. Handling references between directory entries
16.4.1. References defined by a many-to-many SQL table
16.4.2. Static reference as a dn-valued LDAP attribute
16.4.3. Dynamic reference as a ldapUrl-valued LDAP attribute
16.4.4. Defining inverse references
16.5. Combining multiple directories into a single virtual directory
16.5.1. Multi-directory sources
16.5.2. Sub-directories
16.6. The Directory API
16.7. Building custom option lists in forms with vocabularies
17. Mimetype detection
17.1. Introduction
17.2. MimetypeRegistry
17.3. Mimetype sniffing
17.4. Invoking the mimetype detection
18. Content Transformation
18.1. Introduction
18.2. Plugins module
18.2.1. Creating a plugin
18.2.2. Declaring a plugin module
18.2.3. Using a transform plugin
18.3. Available transforms
18.3.1. Document conversion
18.3.2. Pdfbox
18.3.3. OLE objects extraction
18.3.4. Office files merger
18.3.5. XSL Transformation
19. Relations
19.1. Introduction
19.2. Concepts
19.3. Configuration
19.3.1. Graph instances
19.3.2. Resource adapters
19.4. Manage relations
19.5. Display relations
19.6. Architecture overview
20. Placeful Configuration
20.1. Introduction
20.2. Using Placeful Configuration
20.3. Contributing a placeful configuration
20.4. Available storage
20.4.1. In memory storage
20.4.2. Directory storage
20.5. Exemple of extension definition
21. Virtual Navigation
21.1. Virtual Navigation
21.1.1. Virtual Navigation presentation
21.1.2. Virtual Navigation configuration
22. Metadata Extraction Service
22.1. Introduction
22.2. Metadata extraction module
22.2.1. Defining a contribution for metadata extraction
22.2.2. Specifying input parameters
22.2.3. Chaining extractions
22.2.4. Creating a plugin for metadata extraction
22.2.5. Using a metadata extraction plugin
23. Unicity Service
23.1. How does it works ?
23.2. What you need:
23.3. Configuration
23.4. Snippets
24. Nuxeo Mail Service
24.1. Presentation
24.2. Basic Use
24.2.1. Configuration
24.3. Advanced Use
25. Imaging
25.1. Introduction
25.2. Imaging API
25.3. Imaging transform
25.4. Imaging web
25.5. Imaging core
26. Nuxeo Preview Addon
26.1. Overview
26.2. Installing the Preview Addon
26.2.1. Deploy the Addon
26.2.2. Configure Transformers
26.3. Extensions and Pluggability
26.3.1. Pluggable Adapters
26.3.2. Pluggable HTML Transformers
26.4. Previews and URLs
III. Core Services
27. Nuxeo Runtime
27.1. Overview
27.1.1. Main Goals
27.1.2. Main Features
27.2. What is OSGi?
27.3. OSGi Support
27.3.1. Supported Features
27.3.2. Unsupported Features
27.3.3. Planned Features
27.4. Component Model
27.4.1. What are components?
27.4.2. Main Features
27.4.3. Planned Features
27.4.4. Adaptable Components
27.4.5. Flexible Model
27.4.6. Component Life Cycle
27.4.7. Component Extensibility
27.5. Supported Host Platforms
27.5.1. JBoss Integration
27.5.2. Eclipse Integration
27.6. Using Nuxeo Runtime
27.6.1. Creating Components
27.6.2. Using components
27.6.3. XML Component Descriptors
27.7. Integration tests for Nuxeo Runtime applications
27.7.1. The NXRuntimeTestCase base class
27.7.2. Frequent patterns
27.8. Detailed Architecture
27.9. References
28. Nuxeo Core Documentation
28.1. TODO: BS
28.2. Overview
28.2.1. Main goals
28.2.2. Nuxeo Core Components
28.3. Nuxeo Core Architecture
28.3.1. Model Layer (or Internal API)
28.3.2. Implementation Layer
28.3.3. Facade Layer (or Public API)
28.3.4. Deployment
28.3.5. Client Session
28.4. The Repository Model
28.4.1. Document and Schemas
28.4.2. Document Facets
28.4.3. Document Annotations
28.4.4. Document Access Control
28.4.5. Life Cycle
28.4.6. Query Engine
28.4.7. The Public API
28.4.8. Integration with Applications Servers
28.5. Extension Points
28.5.1. Session Factories
28.5.2. LifeCycle Managers
29. Nuxeo Core Import / Export API
29.1. Export Format
29.1.1. document.xml format
29.1.2. Inlining Blobs
29.2. Document Pipe
29.3. Document Reader
29.4. Document Writer
29.5. Document Transformer
29.6. API Examples
29.6.1. Exporting data from a Nuxeo repository to a Zip archive
29.6.2. Importing data from a Zip archive to a Nuxeo repository
29.6.3. Export a single document as an XML with blobs inlined.
30. Experimental Topics
30.1. Introduction
30.2. Runtime Support for Scripting Languages
30.2.1. Introduction
30.2.2. Supported languages
30.2.3. Running a Script
IV. SOA, Web Services and various integration solutions
31. The Nuxeo Restlet API
31.1. Restlet Integration
31.1.1. Restlet types in Nuxeo 5
31.1.2. Restlet URL and parameters mapping
31.1.3. Contributing a new restlet
31.2. Nuxeo default restlets
31.2.1. Browse restlet
31.2.2. Export restlet
31.2.3. Lock restlet
31.2.4. Plugin upload restlet
31.3. Nuxeo RestPack
31.3.1. Installing the RestPack
31.3.2. Restlets included in the RestPack
32. Nuxeo HTTP client
32.1. HTTP Client Library
32.2. HTTP client authentication
33. Web services
33.1. Audit web service
33.2. Remoting web service
33.3. Indexing gateway service
34. Nuxeo JSR 168 Integration
34.1. Overview
34.2. Testing Nuxeo Portlets
34.2.1. Prerequisites
34.2.2. Generate a sample project with nuxeo-archetype-portlet archetype
34.2.3. Test the newly created portlet
34.3. Developping Nuxeo Portlets
34.3.1. NuxeoPortlet class
34.3.2. Project from nuxeo-archetype-portlet archetype
34.3.3. portlet.xml
34.3.4. Restlets
34.4. Available portlets
34.4.1. Nuxeo Search Portlet
35. Desktop integration tools
35.1. Drag and drop browser extensions
35.1.1. Server side import service: the FileManagerService
35.1.2. Microsoft Internet Explorer plugin
35.1.3. Mozilla Firefox plugin
35.2. Online document editing with LiveEdit
35.2.1. Functional overview
35.2.2. Functional use cases
35.2.3. Architectural overview
35.2.4. The Web Service component
35.2.5. More on editor launch
35.2.6. More on pre- and post-editing actions
36. Nuxeo WebDAV interface
36.1. WebDAV clients
36.1.1. Path vs displayName
36.1.2. Filesystem resource vs Nuxeo DocumentModel artifact
36.1.3. MS Web Folder client
36.2. Fooling WebDAV clients
36.2.1. Available hacks
36.2.2. Configuring Nuxeo WebDAV connector for each client.
36.3. Nuxeo EP WebDAV implementation
36.3.1. Nuxeo EP WebDAV-specific features
36.3.2. Known limitations
36.4. Using the Nuxeo WebDAV connector
36.4.1. Installing the WebDAV connector
36.4.2. Connecting a client to Nuxeo WebDAV connector
37. Reporting: Eclipse BIRT Driver
37.1. Overview
37.2. How to use it
37.3. Tomcat integration HOWTO
V. Administration
38. Administration
38.1. SMTP Server configuration
38.2. RDBMS Storage and Database Configuration
38.2.1. Storages in Nuxeo EP
38.2.2. Install the JDBC driver
38.2.3. Configure Nuxeo Core storage
38.2.4. Configure Storage for other Nuxeo Services
38.2.5. Setting up a new repository configuration
38.3. LDAP Integration
38.3.1. For users/groups storage backend
38.4. OpenOffice.org server installation
38.5. Run Nuxeo EP with a specific IP binding
38.6. Virtual Hosting
38.6.1. Motivations for virtual hosting
38.6.2. Virtual hosting configuration for Apache 2.x
38.7. The Nuxeo Shell
38.7.1. Overview
38.7.2. User Manual
38.7.3. Extending the shell
VI. Core developer guide
39. Coding and Design Guidelines
39.1. Introduction
39.2. External Coding Standards
39.3. Some points that need attention
39.3.1. Java code formating
39.3.2. XML code formatting
39.3.3. Design
39.3.4. Unit tests
39.3.5. Security
39.3.6. Naming convention
39.3.7. Information hiding
39.3.8. Use modern Java features
39.3.9. Logging
39.3.10. Documentation: Comments and Javadoc
39.3.11. Deprecation
39.4. Methodology tips
39.4.1. Use the power of your IDE (and its plugins)
39.4.2. Refactor
39.5. Important references
40. Development Tools and Process
40.1. Code Quality with Eclipse Plugins
40.1.1. Using Checkstyle
40.1.2. Using TPTP
40.1.3. Using FindBugs
40.2. Profiling with NetBeans Profiler
40.3. NXPointDoc Documentation tool
40.3.1. Documenting a component
40.3.2. Creating the NxPointDoc site
40.3.3. Browsing NxPointDoc
41. Release Management
41.1. Introduction
41.2. Let's release!
41.2.1. Remove all dependencies on SNAPSHOT versions
41.2.2. Checkout the code and clean your repository
41.2.3. Test the release
41.2.4. Perform the release
41.2.5. You're done
VII. Annexes
A. FAQs
A.1. Deployment and Operations
B. Detailed Development Software Installation Instructions
B.1. Installing Java 5
B.1.1. Using the Sun Java Development Kit (Windows and linux)
B.1.2. Using a package management systems (Linux)
B.1.3. Manual installation (Linux)
B.1.4. Setting up JAVA_HOME (Windows, Linux, Mac OS)
B.2. Installing Ant
B.3. Installing Maven
B.3.1. What is Maven?
B.3.2. Installing Maven
B.4. Installing JBoss AS
B.4.1. JBoss AS listening ports customization
B.4.2. Affected JBoss services
B.5. Installing a Subversion client
B.5.1. Generic subversion clients with linux
B.5.2. Windows
B.6. Chapter Key Point
C. Commercial Support
C.1. About Us
C.2. Contact information
C.2.1. General
C.2.2. France
C.2.3. UK

Part I. Introduction

Chapter 1. Preface

1.1. What this Book Covers

The primary focus of this book it the presentation of Nuxeo EP, from the perspective of its configuration and its architecture.

1.2. What this book doesn't cover

This book is not an end-user manual for Nuxeo. If you are interested in such a document, we recommend that you get it from http://doc.nuxeo.org/.

1.3. Target Audience

As a reference book for the Nuxeo platform, this book has several intended audiences:

  • System integrators, who need to understand how to configure and adapt the Nuxeo platform to their customers needs.

  • Third-party application developers, who will typically need both to customize the behavior of some components and to write new components to extend the functionalities of the platform.

  • System administrators, who need to understand how to configure the platform for the specific needs of their hosting environment.

  • Core developers, who work on the platform and need a reference documentation.

We fully understand that these different people with different concerns, and we plan to create, thanks to the modular structure of this document, more targeted books for these different people.

Readers of this book are presumed familiar with the Java 5 language and with the Java EE and XML technologies.

1.4. About Nuxeo

Founded in 2000, Nuxeo SAS is part of the "second wave" of open source companies, and focusses on developing and supporting applications, instead of system software or development tools.

By entering the ECM field early in 2002, Nuxeo has established itself as the leader of open source ECM, with customers for critical projects in the Government, Energy and Finance sectors. Nuxeo currently has 40 employees, about half of them developers.

Nuxeo has customers and partners in Europe, in Northern and Southern America, in Africa and in India.

1.5. About Open Source

Simply put, Open source is a better way to develop and support software.

Nuxeo fully embraces the open source vision, by fostering collaboration with a community of external contributors.

Introduction

This chapter will give you an overview of ECM and the motivation for using the Nuxeo platform in your next ECM project.

2.1. Enterprise Content Management

According to the AIIM, the Association for Information and Image Management, ECM is defined as "the technologies used to capture, manage, store, preserve, and deliver content and documents related to organizational processes".

2.1.1. Why ECM?

A March 2005 white paper on “The Hidden Costs of Information Work” by the IDC in the United States found that the average office employee spent approximately one day per week organizing and filing documents that they used. This can equate to a considerable amount of cost and inefficiency. A further twelve hours was spent on managing document approval, managing document routing and publishing to other channels. Nine hours was spent searching for documents.

2.2. The Nuxeo ECM platform

2.3. Introduction FAQ

2.3.1. What are Nuxeo EP 5, Nuxeo EP and Nuxeo RCP?

Nuxeo EP 5 is the 5th version of the open source platforms developed by Nuxeo (the four previous ones where known as "CPS").

Nuxeo EP or "Enterprise Platform" is the server part of Nuxeo EP 5. It is a Java EE application intended to run in a standard Java EE 5 application server like JBoss. It can be accessed by end users from a web browser, from office productivity suites like MS-Office or OpenOffice.org, or from rich client developed using the Nuxeo RCP technology (see below).

Nuxeo RCP or "Rich Client Platform" is a platform for building rich client applications, that usually connect to a Nuxeo EP server.

Nuxeo EP and Nuxeo RCP run on top of a common runtime, "Nuxeo Runtime", and share a common set of core components, called "Nuxeo Core".

2.4. Intended audience

2.5. What this book covers

Part 1: Introduction

Part 2:

Part 3:

Part 4:

Getting Started

3.1. Introduction

This chapter describes how to setup a development environment for working on Nuxeo EP. It currently deals with an Eclipse environment and will be completed soon with Netbeans and IDEA.

You will see how to easily start a new project. If you encounter a problem don't forget you can share your experience on the ecm mailing list.

3.2. Prerequisites

We assume from now on that on your computer, you have the following ready-to-use environment:

  • Java Development Kit (JDK) 1.5.x (Nuxeo EP is known to work now with Java 6 or OpenJDK, but this is currently not supported)

  • Apache Ant 1.7.0 (or later), from http://ant.apache.org/.

  • Maven 2.0.8 (or later, not Maven 2.0.7), from http://maven.apache.org/.

  • Eclipse 3.3

  • A Nuxeo EP installation from the last release (download the installation wizard). You can also download a nightly build installer from http://www.nuxeo.org/static/snapshots/ but keep in mind that this one may be broken, so don't erase your working setup with a nightly build: the result is not guaranteed.

Note : The Nuxeo EP installer also installs and sets up the right version of JBoss on your computer, so you don't need to install it by your own.

If some of these software are not already set up on your computer, please refer to Appendix B, Detailed Development Software Installation Instructions, where you will find useful help.

3.3. Starting a new project

3.3.1. About Maven

Before starting, if for you mvn sounds like an other more boring acronym to learn, you should read these few lines, otherwise, you can skip it and go to the next step.

Maven is an IT project helper, that structures the development process in many ways:

  • it helps you using always the same code organization, so that everybody in the company works the same way

  • it allows you to apply in an easy and standard way many tools to your application and your application source: tools for testing, quality, deployment, documentation site generation, etc.

  • it simplifies a lot the way you manage dependencies in your projects by using the pattern of public / local repository.

Depending on how deep you will go with Nuxeo, you may use part or all of the aforementioned items. But for now, we will have special attention for repositories, pom and dependencies. When you start a project under eclipse, you usually begin by downloading then adding all the libraries you will need, and put them all in a subdirectory of the project. You may have some libraries copied many times, like JUnit. And after some time you may end up with many versions of the same libraries in different places of your projects. Maven is really useful for that. When you start a project, you create a pom.xml which will contains all the information Maven needs to act. Especially, it will contain the dependencies of your project. The dependencies are the libraries you usually add with the "add external jar" command under Eclipse. In Maven terminology, it is called an artifact. So you specify in pom.xml which artifacts you need and which version. At compilation time (of course with Maven) it will automatically find the jar corresponding to the artifacts specified, so that there are no "no class found" error.

How does Maven know where to find it?

Maven uses repositories of artifacts (libraries) One of the goals of Maven is to gather all of the code production in the same place, in company or public scoped repositories, so that everybody shares the same libraries and knows where to find them. There are the official an public Maven repositories, automatically inspected when using Maven, but you can also set up private repository like Nuxeo's. You declare the repositories you want your Maven installation to look up into in $HOME/.m2/settings.xml. Maven will download the needed dependencies from those specified repositories into the $HOME/.m2/repository directory, that acts as a "cache".

Then, suppose you want to compile your project with Maven. Maven will read the POM, see that it needs, for instance the JUnit library. It will check if this library is present in the local Maven repository $HOME/.m2 and if not, it will check in a remote one. For sure, it will look into Maven repository, and maybe some private remote repositories you might have set up in your $HOME/.m2/settings.xml file. At compilation time, if your code uses a JUnit TestCase class, it will know it has to go to the repository to download the dependency.

If you manage all your projects with Maven, you will save a lot of time at the beginning of the project, and your deployment procedure will be more reliable. So Nuxeo is developed through a full Maven process. And we encourage people who wants to develop over Nuxeo to also use Maven.

To achieve this, when you start a new project with Nuxeo, you will have to create your own pom.xml that will reference Nuxeo libraries, for document manipulation, etc. A POM represents a project, a resource, and has three main characteristics: its name, its domain and its version. Then it has a lot of XML to specify everything you want. For a Nuxeo project, you have to reference Nuxeo artifacts. So starting a new project with all this structure is tedious and always the same.

To avoid doing the Maven packaging by hand, we prepared for Nuxeo platform users a Maven archetype, that acts as a template system: we defined the typical structure and POM of a Nuxeo Customization project and then, typing a command as short as mvn archetype and a few parameters, Maven will auto-generate the structure of your project, and you are sure it will be Nuxeo compliant.

You can also read the Wikipedia entry for Maven and the Maven archetype introduction for more information about archetypes.

3.3.2. Generate a new project with the nuxeo-archetype-start archetype

The goal of the nuxeo-archetype-start template is to setup a development environment to work on a Nuxeo EP plugin.

The default code provides: a maven layout for sources, tests and dependencies, a Ant target for deployment. It also customizes the web application a litte bit.

To create a project named my-project in the com.company.sandbox.myproject package:

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
    -DartifactId=my-project \
    -DgroupId=com.company.sandbox.myproject  \
    -DarchetypeArtifactId=nuxeo-archetype-start   \
    -DarchetypeGroupId=org.nuxeo.archetypes   \
    -DarchetypeVersion=5.1.4 \
    -DremoteRepositories=http://archiva.nuxeo.org/archiva/repository/nuxeo_release

You can see that you need to supply six arguments:

  • artifactId: the name of your project, usually with '-' to separate the words if there are many.

  • groupId: the domain name of your project. Usually it is the package parent name of your classes, you should use '.' to separate the words ('-' is not supported here).

  • archetypeArtifactId: the maven archetype artifact id. To generate a new project, Nuxeo provides you with nuxeo-archetype-start

  • archetypeGroupId: unique for all nuxeo maven archetypes : org.nuxeo.archetypes

  • archetypeVersion: the version of the archetype which is equivalent to the version of Nuxeo EP without the GA or RC part. (5.1.4, ...).

  • remoteRepositories: the repository location to download the archetype.

Note

The warnings you see when creating your project are expected. If you see BUILD SUCCESSFUL at the end, your project was created successfully.

You should have the following source layout:

my-project
|-- README.txt
|-- build.properties.sample
|-- build.xml
|-- pom.xml
`-- src
    |-- main
    |   |-- java
    |   |   `-- com
    |   |       `-- company
    |   |           `-- sandbox
    |   |               `-- myproject
    |   |                   `-- DocEventListener.java
    |   `-- resources
    |       |-- META-INF
    |       |   |-- MANIFEST.MF
    |       |   `-- ejb-jar.xml
    |       |-- OSGI-INF
    |       |   |-- deployment-fragment.xml
    |       |   |-- event-listener-contrib.xml
    |       |   |-- l10n
    |       |   |   |-- messages.properties
    |       |   |   |-- messages_en.properties
    |       |   |   `-- messages_fr.properties
    |       |   `-- theme-contrib.xml
    |       |-- nuxeo.war
    |       |   `-- img
    |       |       |-- default_logo.gif
    |       |       `-- login
    |       |           `-- login_01.jpg
    |       |-- seam.properties
    |       `-- themes
    |           |-- nxfonts.properties
    |           `-- theme-sample.xml
    `-- test
        |-- java
        |   `-- com
        |       `-- company
        |           `-- sandbox
        |               `-- myproject
        |                   `-- TestDocEventListener.java
        `-- resources
            |-- META-INF
            |   `-- MANIFEST.MF
            `-- log4j.properties
      

3.3.3. Ant settings

You should create a build.properties file on the base of the build.properties.sample so that jboss.dir points to your jboss path. This build.properties file will be used by Ant to send the packaged file in the good directory at deployment time. Note that when using the Nuxeo EP installer, the JBOSS home directory is the same as the Nuxeo EP home directory.

3.3.4. "Eclipsize" your project

If you try to import your project into Eclipse right now, you will see many errors in the source. This is because Eclipse is unaware of the classpath. Indeed when you (used to ;-) ) do the "add library" operation from Eclipse, it creates into the project directory a .classpath file. So Maven (thanks to a plugin it will auto install) generates this file for you, providing that you execute the following commands, at the root of your newly created project:

mvn install
mvn -Declipse.workspace=/the/full/path/to/your/workspace eclipse:add-maven-repo
mvn eclipse:eclipse

Note

The mvn eclipse:eclipse can be quite long as it download all available package sources, this can be configured with the downloadSources property in the pom.xml file.

Now you can run Eclipse, and import the project from the file system as you are used to:

Then go back to the Java perspective and import the projects you have previously checked out as eclipse projects:

File > Import > General > Existing Projects Into Workspace

You can see on the left the Nuxeo project structure (directly inspired from Maven project structure) and you can browse the classes without errors.

You can navigate in the whole Nuxeo EP sources if you have keep the downloadSources option.

Note: if you still have errors, it might be that the M2_REPO variable has not been set up correctly. This variable should point to your home Maven repository, generally here : $HOME/.m2/repository. To check, create or update this variable in Eclipse, right-click on your project, choose "properties". Then in the "Java Build Path" entry, click on "Add variable" (see here for detailed instructions).

3.3.5. Running your custom project

Now that you have created your new custom project, you would want to see what your (not so tough) work produced? As easy as one line of command!

On your project root folder (provided you created the right build.properties, as mentioned earlier):

ant deploy

This will run Maven, install the needed dependencies if needed, compile the code, do the packaging and copy it onto the server directory.

Run your server (.../NUXEO_HOME/bin/run.sh or .bat), go to http://jboss_host:8080/nuxeo/

Try to log with Admin signature (Administrator/Administrator) and to create a new document: if your project was correctly deployed, you should now see a "Book" document type.

Do you still find mvn as a boring command? :-)

3.3.6. Refresh xhtml pages without restarting jboss

The xhtml pages refresh period is controled by facelets and set by default to -1 (no refresh) for performance reasons. When developing, you will find it useful not to have to restart jboss when performing changes in xhtml pages. Since releases 5.1.5 and 5.2-M2, you can add the line "facelets.REFRESH_PERIOD=2" to the nuxeo.properties file in the nuxeo.ear/config folder: pages will be refreshed within 2 seconds.

The nxthemes framework has its own caching, so do not forget to hit the "refresh" button in the themes management page for changes to be taken into account outside of the "main" themes fragment at the center of a nxtheme page.

3.3.7. Learning from the nuxeo sample project

Nuxeo provides a sample project that you can find at org.nuxeo.project.sample. This sample project implements more customizations: a new document type, a new action, a new event listener, etc. Play with this example to start learning Nuxeo.

3.4. Using Documentation

  • This Nuxeo Book is getting to be the most complete source of information around Nuxeo EP, both for beginners and advanced developer. It is a good start.

  • The extension point documentation is also very useful: although you may find it rough, it is the best way to evaluate the Nuxeo extensibility potential, and one should always start with a quick look around all the extension points, to "think Nuxeo" before starting a new project, and not reinventing the wheel.

  • The wiki: we try to reference all the documentation from the wiki welcome page, and you will find tricks, howtos, etc. If you want to have a writer account to help update the content, ask on the Nuxeo's mailing list.

3.5. Advanced tools and tips

3.5.1. Useful plugins when developing on top of Nuxeo with Eclipse

3.5.1.1. The JBoss IDE plugins

Note

The JBoss IDE has been morphed into the JBoss Tools (aka Exadel Studio, aka Red Hat Developer Studio). We're going to evaluate this new offering to understand how it can fit into the Nuxeo development process.

The JBoss IDE offers many useful features when dealing with JEE 5 projects, for creating EJB, managing Hibernate, etc. Especially, the JBoss IDE packaging contains JBPM Designer. You would want to use JBPM designer for writing new workflow procedures to leverage the default embedded JBPM implementation of Nuxeo EP workflow abstraction layer.

Here are the references for the Eclipse Update Manager:

Name: EMF Update Manager Site
URL: http://download.eclipse.org/modeling/emf/updates
Name: JBoss
IDE URL: http://download.jboss.org/jbosside/updates/development
        

The second site has dependencies on the first one: use the "Select required" to check EMF automatically when selecting JBossIDE.

3.5.2. Remote debugging in Eclipse

Use case: suppose you just deployed Nuxeo EP on your JBoss server and run into a new crash or any unexpected behavior. Instead of stopping the server and rerunning inside Eclipse to reproduce the bug in the debugger, you can setup a new remote debugging profile for Eclipse.

  • Linux: edit /opt/jboss/bin/run.conf, add the following line at the end of the file and restart JBoss.

    JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
  • Windows: edit JBOSS/bin/run.bat, modify the line:

    rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%

    by erasing the remark ('rem'), and disabling the suspend ('suspend=n'). You should have:

    set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%

    Restart JBoss.

Then from Eclipse create a new debugger profile in menu Run > Debug create a new Remote Java Application profile and set the source to the filesystem directory that host your complete Eclipse workspace and set the port to 8787.

Then edit the offending source code file and set breakpoints and run your new remote debug profile. From your web browser, refresh the page that was crashing and look back into Eclipse: the debug perspective should open automatically at your fist breakpoint.

3.5.3. Browsing a JCR repository

Many Eclipse plugins allow you to browse JCR compliant repositories (the very back-end of Nuxeo uses, as a default storage system, the JackRabbit JCR reference implementation repository.

JCR Browser is available here: http://sourceforge.net/projects/jcrbrowser/

3.6. Other IDEs: IntelliJ IDEA and NetBeans

3.6.1. IDEA

IntelliJ IDEA from Jetbrains is a very lovable IDE for Java that has many fans in the Java developers community. It is unfortunately not open source.

To start using IDEA for coding on the Nuxeo project, you just need to type mvn idea:idea from your top-level source directory: Maven will download all the dependencies, then generate the configuration files needed by IDEA and you will be able open nuxeo-ecm.ipr from IDEA.

Note

At the time of this writing, IDEA will report some (spurious) compilation failures and you won't be able to compile the whole application from IDEA. You can still use IDEA with the current configuration to write Java code ("with pleasure"), and use Ant and/or Maven to build/deploy the application.

3.6.2. NetBeans

NetBeans is an open source IDE from Sun.

If you're using NetBeans 6 or later, you will be able to download a Maven 2 support plugin from NetBean's "Update Center", and with it, start coding on Nuxeo EP very quickly.

More detailed instructions will be written soon.

General Overview

4.1. Introduction

4.1.1. Architecture Goals

When we started building Nuxeo EP, we defined several goals to achieve. Because these goals have a structural impact on Nuxeo EP platform it is important to understand them: it helps understanding the logic behind the platform.

4.1.1.1. Flexible deployment on multiple targets

An ECM platform like Nuxeo EP can be used in a lot of different cases.

The deployment of Nuxeo EP must be adapted to all these different cases:

  • Standard ECM web application

    This is the most standard use case. The web browser is used to navigate in content repositories.

    • All services are deployed on an Application server

    • In order to be easily hostable, the platform need to be compatible with several application servers

  • Complex edition or rich media manipulation

    In this case having a rich client that seamlessly communicates with other desktop applications and offers a rich GUI is more comfortable than a simple web browser.

    • Interface is deployed on a rich client on the user desktop

    • Services and storage are handled on the server

  • Offline usage

    In some cases, it is useful to be able to manipulate and contribute content without needing a network connection.

    • GUI and some services (like a local repository) need to be deployed on the client side

    • Server hosts the collaborative services (like the workflow) and the central repository

  • Distributed architecture

    In order to be able to address the needs of large decentralized organizations, Nuxeo EP must provide a way to be deployed on several servers on several locations

    • Scale out on several servers

    • Dedicate servers to some specific services

    • Have one unique Web application accessing several decentralized repositories

  • Use Nuxeo EP components from another application

    When building an business application, it can be useful to integrate services from Nuxeo EP in order to address all content oriented needs of the application.

    • Provide web service API to access generic ECM services (including repository)

    • Provide EJB3 remoting API to access generic ECM services (including repository)

    • Provide POJO API to generic ECM services

There are certainly a lot of other use cases, but mainly the constraints are:

  • Be able to choose the deployment platform: POJO vs Java EE

    As first deployment targets we choose

    • Eclipse RCP: a rich client solution that uses a POJO (OSGi) component model

    • JBoss Application Server: a Java EE 5 compliant application server

  • Be able to choose the deployment location of each component: client side vs server side

    The idea is to be able to deploy a component on the server side or on the client side without having to change its code or its packaging

4.1.1.2. Leverage CPS experience

Before building Nuxeo EP we worked during several years on the Zope platform with the CPS solution. CPS was deployed for a lot different use cases and we learned a lot of good practices and design patterns. Even if Nuxeo EP is a full rewrite of our ECM platform, we want to keep as much as possible of CPS good concepts.

  • Concept of schemas and documents

    Inside CPS most of the data manipulated was represented by a document object with a structure based on schemas.

    This concept is very interesting:

    • Schemas enforce structure constraints and data integrity but also permit some flexibility.

      When defining a schema you can specify what fields are compulsory, what are their data type, but you can also define some flexible part of the schema.

    • Share API and UI components for Documents, Users, Records ...

      Because the Document/Schema model is very flexible it can be used to manipulate different types of data: like Users, Records and standards documents.

      From the developer's perspective this permit using the same API and be able to reuse some UI components

      From the user's perspective it give the application some consistency: because the same features and GUI can be used for all the data he manipulates.

  • Actions and Views

    Because CPS was very pluggable, it was possible to easily define different views for each document type and also to let additional components contribute new actions or views on existing documents.

    Nuxeo EP has a similar concept of views and actions, even if technically speaking the technologies are different.

  • Lazy fetching and caching

    Because ECM applications make a very intensive use of the repository and often need to fetch a lot of different documents to construct each page, the way the document retrieval is handled if very important to have a scalable application.

    With CPS we worked a lot on caching and lazy fetching.

    With Nuxeo EP we incorporated this requirement from the beginning:

    • Distributed caching

    • Lazy fetching on schemas and fields

4.1.1.3. Extensible platform based on components

CPS was constructed as a set of pluggable components relying on a common platform. This modularity has been maintained in the new platform. Deploying a new feature or component on the new platform is as simple as it was on the old one.

This requirement as a huge impact on the platform because the Java packaging model and the Java EE constraints are not directly compatible with it.

Adding a new component should be as simple as dropping a file or an archive in some directory without having to rebuild nor repackage the application.

This is important from the administrator point of view: be able to easily deploy new features.

This is also very important from the support point of view: be able to deploy customized components without taking the risk of forking the platform and maintain the possibility to upgrade the standards components.

4.1.1.4. Easily accessible development framework

The CPS framework was powerful but we know it was very complex to use. Not only because of the unusual CMF/Zope/Python programming model, but also because there was a lot of different concepts and you had to understand them all to be able to leverage the platform when building a new application on top of it.

Nuxeo EP aims at simplifying the task of the developer

  • Clearly separate each layer

    The idea is to clearly separate presentation, processing and storage so that developers can concentrate on their task.

  • Offer plugin API and SPI

    Nuxeo EP is constructed as a set of plugins so you can modify the behavior of the application by just contributing a new plugin. This is simpler because for common tasks we will offer a simple plugin API and the developer just has to implement the given interface without having to understand each part of the platform.

  • Rely on JAVA standards

    We try to follow as much as possible all the Java standards when they are applicable. This will allow experienced Java developers to quickly contribute to the Nuxeo EP platform.

4.1.1.5. Leverage Java open source community

We know what it's like to have to build and maintain an entire framework starting from the application server. With the switch to the Java technology, we will use as much as possible existing open source components and focus on integrating them seamlessly in the ECM platform. Nuxeo EP is a complete integrated solution for building an ECM application, but Nuxeo won't write all infrastructure components. This approach will also make the platform more standards compliant.

Thus developers can optimize their Java/JEE and open source experience to use Nuxeo EP.

4.1.1.6. Make the platform ready for SI integration

Because ECM applications often need to be deeply integrated into the existing SI, Nuxeo EP will be easily integrable

  • API for each reusable service or component

    Depending on the components, this API could be POJO, EJB3, or WebService, and in most cases it will be available in the three formats.

  • Pluggable hooks into Nuxeo EP

    This mainly means synchronous or asynchronous events listener that are a great place to handle communication and synchronization between applications.

4.1.1.7. Future-proof design

The Nuxeo EP platform was rewritten from the ground with the switch to Java. But we don't plan to do this kind of work every couple of years, it wont be efficient neither for us, nor for the users of the platform. For that reason, we choose innovative Java technologies like OSGi, EJB3, JSF, Seam ....

4.1.2. Main concepts and design

All the design goals explained just before have a huge impact on the Nuxeo EP architecture. Before going into more details, here are the main concepts of Nuxeo EP architecture.

4.1.2.1. Layered architecture

Nuxeo EP is built of several layers, following at least the 3 tiers standard architecture

  • Presentation layer

    Handles GUI interactions (in HTML, SWT ...)

  • Service layer

    Service stack that offers all generic ECM services like workflow, relations, annotations, record management...

  • Storage layer

    Handles all storage-oriented services like document storage, versioning, life cycle ....

Depending on the components, their complexity and the needed pluggability, there can be more that 3 layers.

This layering of all the components brings Nuxeo EP the following advantages

  • Choose the deployment target for each part of a component

    By separating clearly the different parts of a feature, you can choose what part to deploy on the client and what part to deploy on a server.

  • Clear API separation

    Each layer will provide its own API stack

  • Components are easier to reuse

    Because the service and storage layers are not bound to a GUI, they are more generic and then more reusable

Thanks to this separation in component families you can easily extract from Nuxeo EP the components you need for your application.

If you need to include Document storage facilities into your application you can just use Nuxeo EP Core: It will offer you all the needed feature to store, version and retrieve documents (or any structured but flexible dataset). If you also need process management and workflow you can also use Nuxeo EP Workflow service. And finally, if you want to have a Web application to browse and manage your data, you can reuse the Nuxeo EP Web layer.

4.1.2.2. Deployment services

The targeted platform do not provide the same mechanism to handle all the deployment tasks:

  • Packaging (Java EE vs OSGi)

  • Dependency management

  • Extension management

Because of these differences, Nuxeo EP provides a unified deployment service that hides the specificity of the target platform. This is also a way to add a pluggable component deployment system to some platform that don't handle this (like Java EE).

This is one of the motivation for the Nuxeo Runtime that will be quickly introduce later in this document.

4.1.2.3. Extensible component model

In Nuxeo EP, an ECM application is seen as an assembly of components.

This assembly will include:

  • Existing generic Nuxeo EP Components

  • Extensions or configurations contributing to generic Nuxeo EP components

  • Specific components and configuration

Inside Nuxeo EP each feature is implemented by a one or several reusable components and services. A feature may be implemented completely at storage level, or may require a dedicated service and a dedicated GUI.

Nuxeo EP Web application is a default distribution of a set of ECM components. This can be used "as is" or can be the base for making a business ECM application.

  • If you need to remove a feature

    Just remove the component or deploy a configuration for disabling it.

  • If you need to change the default behavior of one component

    You can deploy a new configuration for the component .

    • Declare a new Schema or define a document type

    • Configure the versioning policy

    • Deploy new workflow

    • ...

    This configuration may use an extension point to contribute the new behavior.

    • Contribute a new security policy

    • Contribute a new event handler

    • Deploy a new View on a document

    • ...

  • If you need to add a completely new feature you can make your own component.

    First check that there is no generic Nuxeo EP component available that could help you in your task (all components are not deployed in the default webapp).

4.1.2.4. Use of innovative Java EE technology

Here is a quick list of the Java technology we use inside Nuxeo EP platform:

  • Java 5

  • Java EE 5: JSF and EJB3

  • OSGi component model

  • A lot a innovative open source projects

    • JBoss Seam, Trinidad and Ajax4JSF on the web layer

    • jBPM for the default workflow engine implementation

    • Lucene for the default search engine implementation

    • Jackrabbit JSR-170 repository for the default storage back end implementation

    • JenaRDF for the relation framework

    • ...

4.2. Nuxeo Runtime: the Nuxeo EP component model

4.2.1. The motivations for the runtime layer

Building the Nuxeo Runtime was one of the first task we started. This is one of the main infrastructure component or Nuxeo EP architecture.

This paragraph will give you a quick overview of the Nuxeo Runtime, a more detailed technical presentation can be found in an other chapter of this book.

4.2.1.1. Host platform transparency

Because most of Nuxeo EP components are shared by Nuxeo RCP (OSGI/RCP) and Nuxeo EP (Java EE), an abstraction layer is required so the components can use transparently the components services independently from the underlying infrastructure.

Nuxeo Runtime provides an abstraction layer on top of the target host platform. Depending on the target host platform, this Runtime layer may be very thin.

Nuxeo Runtime already supports Equinox (Eclipse RCP OSGi layer) and JBoss 4.x (JMX). The port of Nuxeo Runtime to other Java EE application server is in progress, we already have a part of Nuxeo EP components that can be deployed on top of SUN Glassfish application server. Technically speaking, the port of Nuxeo Runtime could be done on any JEE5 compliant platform and will be almost straightforward for any platform that supports natively the OSGi component model.

4.2.1.2. Overcome Java EE model limitations

Java EE is a great standard, but it was not designed for a component based framework: it is not modular at all.

  • Java EE deployment model limitations

    • Most Java EE deployment descriptors are monolithic

      For example, the web.xml descriptor is a unique XML file. If you want to deploy an additional component that needs to declare a new Java module you are stuck. You have to make one version of the web.xml for your custom configuration. For Nuxeo EP platform, this constraint is not possible:

      • Components don't know each other

        Because there are a lot of optional components, we can't have a fixed configuration that fits all.

      • We can make a version of the web.xml for each possible distribution

        There are too many optional components to build one static web.xml for each possible combination.

      This problem with the web.xml is of course also true for a lot of standard descriptors (application.xml, faces-config.xml, persistence.xml, ejb-jar.xml ....)

    • One archive for one web application

      We have here the exact same problem than with the web.xml. additional components can contribute new web pages, new web components ... We can have a monolithic web archive.

    • No dependency declaration

      Inside Java EE there is no standard way to declare the dependency between components.

      Because Nuxeo EP is extensible and has a plugin model, we need that feature. A contribution is dependent on the component it contribute to:

      • Contribution is only activated if/when the target component is activated

      • The contribution must be deployed after the target component as it may override some configuration

  • Java EE component model limitations

    • Unable to deploy a new component without rebuilding the whole package

      If you take a .ear archive and want to add a new component, you have to rebuild a new ear.

    • No support for versionned components

Nuxeo Runtime provides an extensible component model that supports all these feature. It also handles the deployment of these components on the target host platform.

4.2.2. Extensible component model

Nuxeo Runtime provides the component model for the platform.

This component model is heavily based on OSGi and provides the following features:

  • Platform agnostic component model

    Can be deployed on POJO and Java EE platforms

  • Supports dependencies management

    Components explicitly declare their requirements and are deployed and activated by respecting the inferred dependency chain.

  • Includes a plugin model

    To let you easily configure and contribute to deployed components

  • A POJO test environment

    Nuxeo Runtime components can be unit tested using JUnit without the need of a specific container.

4.2.2.1. The OSGi component model

OSGi ( Open Services Gateway initiative ) is a great standard for components based Java architecture.

OSGi provides out of the box the following features:

  • Dependencies declaration and management

    A component gets activated only when the needed requirements are fulfilled

  • Modular deployment system

    • Manage bundles

    • Manage fragments (sub parts of a master bundle)

    • an OSGi bundle can define one or several services

  • A system to identify and lookup for a component

For Nuxeo EP, OSGi standard provides a lot of the needed features. This is the reason why Nuxeo Runtime is based on OSGi, in fact Nuxeo Runtime component model is a subset of OSGi specification.

To ensure platform transparency, Nuxeo Runtime provides adapters for each target platform to help it support OSGi components.

  • This adopter layer is very thin on Equinox (Eclipse RCP) since the underlying platform is already OSGi compliant.

  • This adapter may be more complex for platform that are not aware of OSGi (JBoss 4.x or Glassfish)

    In this case, the runtime adapter will handle all OSGi logic and deploy the components as native platform components. For examples, on JBoss 4.x, Runtime components are deployed as JMX MBeans.

4.2.2.2. Extension points

OSGi does not define a plugin model, but the Eclipse implementation (Equinox) does provide an extension point system.

Because we used a lot the Eclipse Extension Point system and we liked it, Nuxeo Runtime also includes an Extension Point system.

Basically every Nuxeo Component can:

  • declare its dependencies

    The component will also be activated after all needed components

  • declare exposed extension points

    Each components can define extension points that other components can use to contribute configuration or code.

  • declare contribution to other components

These declarations are handled by the OSGi deployment descriptor (MANIFEST.MF)

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nuxeo ECM Core
Bundle-SymbolicName: org.nuxeo.ecm.core;singleton:=true
Bundle-Version: 1.0.0
Bundle-Vendor: Nuxeo
Bundle-Localization: bundle
Bundle-Activator: org.nuxeo.ecm.core.NXCoreActivator
Bundle-ClassPath: ., lib/xsom.jar,
  lib/connector-api.jar,
  lib/java-cup-v11a.jar
Export-Package: org.nuxeo.ecm.core,
  org.nuxeo.ecm.core.api,
  org.nuxeo.ecm.core.api.local,
  org.nuxeo.ecm.core.jca,
  org.nuxeo.ecm.core.lifecycle,
  org.nuxeo.ecm.core.model
Require-Bundle: org.nuxeo.ecm.core.api,
  org.nuxeo.runtime
Nuxeo-Component: OSGI-INF/CoreService.xml,
  OSGI-INF/TypeService.xml,
  OSGI-INF/RepositoryService.xml,
  OSGI-INF/CoreExtensions.xml,
  OSGI-INF/SecurityService.xml

For example, this descriptor defines that

  • this bundle depends on org.nuxeo.ecm.core.api

  • this bundles contains Nuxeo components like CoreServices.xml

    The XML descriptor will be used to define new extension points or contribute to existing one.

An extension point is a way to declare that your component can be customized from the outside:

  • Contribute configuration

    Activate or deactivate a component. Define resources for a given service.

  • Contribute code and behavior

    Extension points also give you the possibility to register plugins

Extension points and contribution to extension points are defined using a XML descriptor that has to be referenced in the MANIFEST.MF.

Here is a simple descriptor example:

<component name="org.nuxeo.ecm.core.listener.CoreEventListenerService">
  <require>org.nuxeo.ecm.core.repository.RepositoryService</require>
  <implementation class="org.nuxeo.ecm.core.listener.impl.CoreEventListenerServiceImpl"/>

  <extension-point name="listener">
    <object class="org.nuxeo.ecm.core.listener.extensions.CoreEventListenerDescriptor"/>
  </extension-point>
  <extension target="org.nuxeo.ecm.core.listener.CoreEventListenerService" point="listener">
    <listener name="nxruntimelistener" class="org.nuxeo.ecm.core.listener.impl.NXRuntimeEventListener" />
  </extension>
  <extension target="org.nuxeo.ecm.core.listener.CoreEventListenerService" point="listener">
    <listener name="lifecyclelistener" class="org.nuxeo.ecm.core.lifecycle.impl.LifeCycleListener" />
  </extension>
</component>

  • This fragment depends on the Repository Service

    This fragment won't be loaded until a Nuxeo Repository is setup

  • This fragment declares an extension point named listener

    This extension point let register plugins that will be invoked when a core event occurs.

    This extension point use CoreEventListenerDescriptor for