Class DocumentViewCodecService
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.url.service.DocumentViewCodecService
-
- All Implemented Interfaces:
Serializable,DocumentViewCodecManager,Adaptable,Component,Extensible,TimestampedService
public class DocumentViewCodecService extends DefaultComponent implements DocumentViewCodecManager
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,DocumentViewCodec>codecsstatic StringCODECS_EXTENSION_POINTprotected StringdefaultCodecNameprotected Map<String,DocumentViewCodecDescriptor>descriptorsstatic StringNAME-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description DocumentViewCodecService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeactivate(ComponentContext context)Deactivates the component.<T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.DocumentViewCodecgetCodec()DocumentViewCodecgetCodec(String codecName)Returns theDocumentViewCodecwith the given name ornullif ot doesn't exist.StringgetDefaultCodecName()Returns the default codec name.List<String>getDocumentViewCodecDescriptorNames()DocumentViewgetDocumentViewFromUrl(String url, boolean hasBaseUrl, String baseUrl)Returns a DocumentView applying for given url, or null.DocumentViewgetDocumentViewFromUrl(String codecName, String url, boolean hasBaseUrl, String baseUrl)Returns a DocumentView callingDocumentViewCodec.getDocumentViewFromUrl(String)on codec with given name.protected DocumentViewgetDocumentViewFromUrl(DocumentViewCodec codec, String finalUrl)StringgetUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)Returns an URL callingDocumentViewCodec.getUrlFromDocumentView(DocumentView)on codec with given name.StringgetUrlFromDocumentView(DocumentView docView, boolean needBaseUrl, String baseUrl)Returns an URL applying for given document view, or null.protected StringgetUrlFromDocumentView(DocumentViewCodec codec, DocumentView docView, boolean needBaseUrl, String baseUrl)protected StringgetUrlWithoutBase(String url, boolean hasBaseUrl, String baseUrl)voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
NAME
public static final String NAME
-
CODECS_EXTENSION_POINT
public static final String CODECS_EXTENSION_POINT
- See Also:
- Constant Field Values
-
defaultCodecName
protected String defaultCodecName
-
descriptors
protected final Map<String,DocumentViewCodecDescriptor> descriptors
-
codecs
protected final Map<String,DocumentViewCodec> codecs
-
-
Method Detail
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:AdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.- Specified by:
getAdapterin interfaceAdaptable- Overrides:
getAdapterin classDefaultComponent- Parameters:
adapter- the adapter class to look up- Returns:
- a object castable to the given class, or
nullif this object does not have an adapter for the given class
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
getDefaultCodecName
public String getDefaultCodecName()
Description copied from interface:DocumentViewCodecManagerReturns the default codec name.This information is set on codec descriptors.
- Specified by:
getDefaultCodecNamein interfaceDocumentViewCodecManager
-
getCodec
public DocumentViewCodec getCodec()
-
getCodec
public DocumentViewCodec getCodec(String codecName)
Description copied from interface:DocumentViewCodecManagerReturns theDocumentViewCodecwith the given name ornullif ot doesn't exist.- Specified by:
getCodecin interfaceDocumentViewCodecManager
-
getUrlFromDocumentView
public String getUrlFromDocumentView(DocumentView docView, boolean needBaseUrl, String baseUrl)
Description copied from interface:DocumentViewCodecManagerReturns 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, callsDocumentViewCodec.getUrlFromDocumentView(DocumentView). Stops iterating when a codec returns a non-null value. am docView the original document view from request- Specified by:
getUrlFromDocumentViewin interfaceDocumentViewCodecManager- Parameters:
docView- the original document view from requestneedBaseUrl- boolean indicating if base url should be added to the url returned by the codec.baseUrl- value of the base url.
-
getUrlFromDocumentView
public String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)
Description copied from interface:DocumentViewCodecManagerReturns an URL callingDocumentViewCodec.getUrlFromDocumentView(DocumentView)on codec with given name.- Specified by:
getUrlFromDocumentViewin interfaceDocumentViewCodecManager- Parameters:
codecName- the codec name to usedocView- the original document view from requestneedBaseUrl- boolean indicating if base url should be added to the url returned by the codec.baseUrl- value of the base url.
-
getUrlFromDocumentView
protected String getUrlFromDocumentView(DocumentViewCodec codec, DocumentView docView, boolean needBaseUrl, String baseUrl)
-
getDocumentViewFromUrl
public DocumentView getDocumentViewFromUrl(String url, boolean hasBaseUrl, String baseUrl)
Description copied from interface:DocumentViewCodecManagerReturns a DocumentView applying for given url, or null.Iterates over registered codecs, starting from the default codec, and if
DocumentViewCodec.handleUrl(String)returns true, callsDocumentViewCodec.getDocumentViewFromUrl(String). Stops iterating when a codec returns a non-null value.- Specified by:
getDocumentViewFromUrlin interfaceDocumentViewCodecManager- 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:DocumentViewCodecManagerReturns a DocumentView callingDocumentViewCodec.getDocumentViewFromUrl(String)on codec with given name.- Specified by:
getDocumentViewFromUrlin interfaceDocumentViewCodecManagerurl- 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.
-
getUrlWithoutBase
protected String getUrlWithoutBase(String url, boolean hasBaseUrl, String baseUrl)
-
getDocumentViewFromUrl
protected DocumentView getDocumentViewFromUrl(DocumentViewCodec codec, String finalUrl)
-
-