Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.url.service
Class DocumentViewCodecService

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.platform.url.service.DocumentViewCodecService
All Implemented Interfaces:
Serializable, DocumentViewCodecManager, Adaptable, Component, Extensible

public class DocumentViewCodecService
extends DefaultComponent
implements DocumentViewCodecManager

See Also:
Serialized Form

Field Summary
static String CODECS_EXTENSION_POINT
           
static String NAME
           
 
Constructor Summary
DocumentViewCodecService()
           
 
Method Summary
 void deactivate(ComponentContext context)
          Deactivates the component.
<T> T
getAdapter(Class<T> adapter)
          Returns an object which is an instance of the given class associated with this object.
 DocumentViewCodec getCodec()
           
 DocumentViewCodec getCodec(String codecName)
           
 String getDefaultCodecName()
          Returns the default codec name.
 List<String> getDocumentViewCodecDescriptorNames()
           
 DocumentView getDocumentViewFromUrl(String url, boolean hasBaseUrl, String baseUrl)
          Returns a DocumentView applying for given url, or null.
 DocumentView getDocumentViewFromUrl(String codecName, String url, boolean hasBaseUrl, String baseUrl)
          Returns a DocumentView calling DocumentViewCodec#getDocumentViewFromUrl(String, boolean, String) on codec with given name.
 String getUrlFromDocumentView(DocumentView docView, boolean needBaseUrl, String baseUrl)
          Returns an URL applying for given document view, or null.
 String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)
          Returns an URL calling {@link DocumentViewCodec#getUrlFromDocumentView(DocumentView) on codec with given name.
 void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, applicationStarted, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME

CODECS_EXTENSION_POINT

public static final String CODECS_EXTENSION_POINT
See Also:
Constant Field Values
Constructor Detail

DocumentViewCodecService

public DocumentViewCodecService()
Method Detail

deactivate

public void deactivate(ComponentContext context)
Description copied from interface: Component
Deactivates the component.

This method is called by the runtime when a component is deactivated.

Specified by:
deactivate in interface Component
Overrides:
deactivate in class DefaultComponent
Parameters:
context - the runtime context

getAdapter

public <T> T getAdapter(Class<T> adapter)
Description copied from interface: Adaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface Adaptable
Overrides:
getAdapter in class DefaultComponent
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class

registerContribution

public void registerContribution(Object contribution,
                                 String extensionPoint,
                                 ComponentInstance contributor)
Overrides:
registerContribution in class DefaultComponent

unregisterContribution

public void unregisterContribution(Object contribution,
                                   String extensionPoint,
                                   ComponentInstance contributor)
Overrides:
unregisterContribution in class DefaultComponent

getDocumentViewCodecDescriptorNames

public List<String> getDocumentViewCodecDescriptorNames()

getDefaultCodecName

public String getDefaultCodecName()
Description copied from interface: DocumentViewCodecManager
Returns the default codec name.

This information is set on codec descriptors.

Specified by:
getDefaultCodecName in interface DocumentViewCodecManager

getCodec

public DocumentViewCodec getCodec()

getCodec

public DocumentViewCodec getCodec(String codecName)

getUrlFromDocumentView

public String getUrlFromDocumentView(DocumentView docView,
                                     boolean needBaseUrl,
                                     String baseUrl)
Description copied from interface: DocumentViewCodecManager
Returns an URL applying for given document view, or null.

Iterates over registered codecs, starting from the default codec, and if DocumentViewCodec.handleDocumentView(DocumentView) returns true, calls DocumentViewCodec.getUrlFromDocumentView(DocumentView). Stops iterating when a codec returns a non-null value. am docView the original document view from request

Specified by:
getUrlFromDocumentView in interface DocumentViewCodecManager
Parameters:
docView - the original document view from request
baseUrl - value of the base url.

getUrlFromDocumentView

public String getUrlFromDocumentView(String codecName,
                                     DocumentView docView,
                                     boolean needBaseUrl,
                                     String baseUrl)
Description copied from interface: DocumentViewCodecManager
Returns an URL calling {@link DocumentViewCodec#getUrlFromDocumentView(DocumentView) on codec with given name.

Specified by:
getUrlFromDocumentView in interface DocumentViewCodecManager
docView - the original document view from request
baseUrl - value of the base url.

getDocumentViewFromUrl

public DocumentView getDocumentViewFromUrl(String url,
                                           boolean hasBaseUrl,
                                           String baseUrl)
Description copied from interface: DocumentViewCodecManager
Returns a DocumentView applying for given url, or null.

Iterates over registered codecs, starting from the default codec, and if DocumentViewCodec.handleUrl(String) returns true, calls DocumentViewCodec.getDocumentViewFromUrl(String). Stops iterating when a codec returns a non-null value.

Specified by:
getDocumentViewFromUrl in interface DocumentViewCodecManager
Parameters:
url - the original url from request, including request parameters if any.
hasBaseUrl - boolean indicating if base url should be removed from given url.
baseUrl - value of the base url.

getDocumentViewFromUrl

public DocumentView getDocumentViewFromUrl(String codecName,
                                           String url,
                                           boolean hasBaseUrl,
                                           String baseUrl)
Description copied from interface: DocumentViewCodecManager
Returns a DocumentView calling DocumentViewCodec#getDocumentViewFromUrl(String, boolean, String) on codec with given name.

Specified by:
getDocumentViewFromUrl in interface DocumentViewCodecManager
url - the original url from request, including request parameters if any.
hasBaseUrl - boolean indicating if base url should be removed from given url.
baseUrl - value of the base url.

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.