Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.webengine.app.extensions
Class ResourceContribution

java.lang.Object
  extended by org.nuxeo.ecm.webengine.app.extensions.ResourceContribution

public abstract class ResourceContribution
extends java.lang.Object

A resource contribution is a resource provider for a specific extension point (i.e. path segment) in a target resource of type ExtensibleResource. The resource contribution is instantiated in a lazy way when the modules are registered. (i.e. the first time the module registry is accessed by client code - usually at first request on a web module root resource)

The resource contribution is responsible of checking if the contribution can be done - depending on current context and to instantiate new resources to be used when request is matching the contribution key.

Classes implementing this interface must be annotated using ResourceExtension to define the target resource, the path segment used for matching and optional hints for computing enabling state of this contribution depending on the runtiem context.

Author:
Bogdan Stefanescu

Constructor Summary
ResourceContribution()
           
 
Method Summary
 boolean accept(Resource target)
          Checks if the given resource is accepted.
 java.lang.String[] getCategories()
           
 java.lang.String getKey()
           
 java.lang.String getLabel()
           
 java.lang.String getLinkTarget()
          Override this to specify a link target page.
 boolean hasCategory(java.lang.String category)
           
abstract  java.lang.Object newInstance(Resource target)
          Creates a resource instance to handle the request.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceContribution

public ResourceContribution()
Method Detail

getKey

public java.lang.String getKey()

getLinkTarget

public java.lang.String getLinkTarget()
Override this to specify a link target page.


getLabel

public java.lang.String getLabel()

getCategories

public java.lang.String[] getCategories()

hasCategory

public boolean hasCategory(java.lang.String category)

accept

public boolean accept(Resource target)
Checks if the given resource is accepted. Override this method if you need to filter your contributions using custom logic. The default implementation is using the target facets declared in the ResourceExtension annotation to check contribution enablement.

Parameters:
target -
Returns:
true if the target resource is accepted and contribution can be done, false otherwise

newInstance

public abstract java.lang.Object newInstance(Resource target)
Creates a resource instance to handle the request.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.