Skip to content

Some basics about extension points

Roland Praml edited this page May 2, 2014 · 2 revisions


Every plugin can define its own extension points (a schema.xsd can be created that specify the extension point properties). Other plugins can contribute an extension to an extension point.

To get an extension point, you must query the extension registry.

IExtensionRegistry registry= Platform.getExtensionRegistry();  
IConfigurationElement[] arr= 

Now you have an array of IConfigurationElements. The element contains the XML data that are defined in the plugin.xml (in a format specified by a schema.xsd of the extension point). See here for more details.
Reading data from the registry does not yet activate the plugin.

The most important extension points in XPages are and They are handled by the class.

Extension point:

This extension point is similar to java.util.ServiceLoader. Each service has to specify a type and a class. Compared to the ServiceLoader, the type corresponds to the file name in "META-INF/services" and the classname to the content of this file. A plugin will get activated, if it defines a service-type that was queried from the extension manager.

Extension point:

This extension point defines a bundle of estensions. It has to specify a class, that implements This Interface has one method (getBundle) and must return the current bundle. If the extension manager was queried for a service-type, the classes are then loaded by using "META-INF/services" files in the plugin.

Compared to the point, this extension point must activate the plugin, otherwise the files in META-INF/services are not accessible for the class loader. This could be also used as "AutoStart" for a plugin :) and maybe fix the issue described here:

The ExtensionManager

The has two different modes. If it runs inside an OSGI environment, it tries to locate services definde by the the two extension points.
As fallback it uses the definitons in the "META-INF/services" files that are visible by the current class loader. (This could be also a META-INF-file stored in the current NSF-file if findApplicationService was used.)

There are two different ways to load a service:


Does NOT load services specified in the NSF. This is for services that should only be extended by plugins and not in an NSF.

Some service-types that are loaded with findServices:

  • => has to implement IPlatformFactory and creates a new platform (makes no sense to override)
  • => has to implement IServiceFactory and can create own HTTP-service handlers for example. (This service is loaded at server start)
  • => has to implement ResourceFactoryProvider / TODO
  • => has to implement OAuthService / TODO
  • => TODO
  • => TODO
  • => TODO
  • => has to implement IDefaultPropertyProvider and can override default properties on the server
  • => has to implement DojoLibraryFactory, can add dojo components
  • => a XPage-Lib (selectable in NSF)
  • => a XspContributor. Can control certain factories, like "" (could be useful)
  • => a ResourceLoader (for minified css/js resources)
  • => a Factory for ViewNavigators (already uses in the openntf-plugin)
  • => has to implement DojoModulePathResource / TODO
  • => TODO
  • => adapter to extend FacesUtil. Used for example to serialize Notes DateTimes.
  • => implements FacesResourceServlet. Global resources, accessable via /xsp/.ibmxspres/
  • => same, but per NSF


First look in the NSF for a "META-INF/services" file (if correct ModuleClassLoader was specified), then do the same as findServices

This should NOT be called directly, better use findServices in the Application-class. e.g: ((ApplicationEx)ctx.getApplication()).findServices(serviceType)

Some service-types that are loaded with findApplicationServices:

  • => has to implenent ApplicationListener/ApplicationListener2, will be notified about applicationCreated / Destroyed / Refreshed
  • => has to implenent SessionListener, will be notified about sessionCreated / Destroyed (could be useful to log the open HTTP sessions)
  • => has to implenent RequestCustomizerFactory, may filter RequestParameters
You can’t perform that action at this time.