Platform Explorer / Nuxeo Platform LTS 2017 9.10

Component org.nuxeo.ecm.core.api.DocumentAdapterService


Javadoc: org.nuxeo.ecm.core.api.adapter.DocumentAdapterService


Extension points


XML source

<?xml version="1.0"?>

<component name="org.nuxeo.ecm.core.api.DocumentAdapterService" version="1.0.0">
    Service providing a dynamic adapter mechanism to adapt documents to random interfaces.
    @author Bogdan Stefanescu (

  <implementation class="org.nuxeo.ecm.core.api.adapter.DocumentAdapterService"/>


  <extension-point name="adapters">

      Extension Point for registering new document adapters
      XML extensions may contain any number of 'adapter' elements of the form:
      <adapter facet="Versionable"
      This means any document having the facet 'facet' can be adapted to a 'class' object using the factory 'factory'
      The facet attribute is optional and serve to restrict the applicability of the adapter.
      If no facet is specified the adapter will be applicable on any document.

    <object class="org.nuxeo.ecm.core.api.adapter.DocumentAdapterDescriptor"/>




Service providing a dynamic adapter mechanism to adapt documents to random interfaces.

  • 5.3.1

This service is provided to manage the adpaters contributions. This is a direct access to the underlying component and this is not the standard way to access adpaters. Use DocumentModel.getAdapter for that.

The main Data Object used inside Nuxeo is a DocumenModel.

Thanks to XSD schemas and Document Types you can use DocumentModel to represent almost everything :

  • a personne (meta-data and a picture)
  • an invoice (meta-data and a PDF file)
  • a contract (meta-data and a file)
  • a part of a car (meta-data and a CAD file)

DocumentModel API is flexible enough to allow you to access any complexe properties you may want to store in your objects.

Nevertheless, you may want to be able to define your own Domain Model objects :

  • to have a simpler and type safe API ( standard getter/setter with strong typing)
  • to encapsulate some business logic (ex: when this field is modified I want to compute another one)
  • to hide the storage details (ex: Business dev does not have to know the schema used to store a given attribute)

Nuxeo provides a way to define your own Domain Model object on top of the DocumentModels.

This allows you to benefit from both world :

  • you have all advantages of having your own Domain Model objects
  • you have the benefit of DocumentModels
  • you can do powerful queries
  • you can manage security, life cycles and workflows
  • you can manage relations
  • you can change the storage

This mixed model if provided in Nuxeo by DocumentModelAdpaters. The idea is simple :

  • you can register DocumentModelAdpaterFactory on a DocumentType or on a Facet
  • you can call DocumentModel.getAdapter(<MyDomainModelObject>) to get the Domain Model representation of a DocumentModel

Adapters objects are created only when needed and are automatically cached inside the DocumentModel so that your adapter has the same life-cycle as the DocumentModel.

The DocumentAdapterService component provides extension points to register new adapters factories and a service interface to manipulate contributions.