Tutorials

How to Override a Seam Component

Updated: March 16, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

This how-to considers you master the creation of the Java plug-in, and you know where to create a Java class. Otherwise please refer to the page How to create an empty bundle or use Nuxeo CLI.

The main steps to override a Seam component are:

  1. Look for the name of the Seam component you want to override. The name is the value of the annotation @name.
  2. Add an empty file named seam.properties under the folder src/main/resources of your plug-in.
  3. Create a Java class in your plug-in. It's recommended to use a custom name for your own classes, to avoid having duplicated files in your IDE for instance. But it's not mandatory providing the package containing your class is different from the default one.
  4. Overriding the default Seam component now implies three actions:

    • Reuse the same name you found in the @name annotation,
    • Reuse the same scope, unless you know what you are doing,
    • Indicate that your component will be loaded after the default one: this is done with the annotation @Install and the value Install.DEPLOYMENT (because the default component should have no value for this annotation, or value Install.FRAMEWORK).

    You should get a class structured like below:

    package org.nuxeo.sample.howto;
    
    import org.jboss.seam.annotations.Install;
    import org.jboss.seam.annotations.Name;
    import org.nuxeo.ecm.core.api.ClientException;
    import org.nuxeo.ecm.webapp.helpers.StartupHelper;
    
    @Name("startupHelper")
    @Scope(SESSION)
    @Install(precedence = Install.DEPLOYMENT)
    public class MyStartupHelper extends StartupHelper {
        private static final long serialVersionUID = 1L;
        @Override
        public String initServerAndFindStartupPage() throws ClientException {
            return super.initServerAndFindStartupPage();
        }
    }
    

In this example, we overrode the startupHelper component to write our own version of the method initServerAndFindStartupPage.


Related How-Tos
Related Documentation
8 days ago Solen Guitter Update Nuxeo CLI links and remove *the* Nuxeo CLI
24 days ago Arnaud Kervern NXDOC-1116: Add missing renames
3 months ago Anne Jubert review pages
3 months ago Solen Guitter NXDOC-962: Remove mentions of Nuxeo IDE from NXDOC
4 months ago Andrew Goodricke Add content-review-lts2016 to labels
4 months ago Kevin Leturc NXP-19481: Update MarkLogic page to detail how to configure range element indexes
a year ago Anahide Tchertchian 9
2 years ago Gildas Lefevre 8
3 years ago Manon Lumeau 7
3 years ago Manon Lumeau 6
3 years ago Manon Lumeau 5
3 years ago Solen Guitter 4
3 years ago Solen Guitter 3
3 years ago Thierry Martins 2
3 years ago Thierry Martins 1
History: Created by Thierry Martins