public class DocumentViewCodecService extends DefaultComponent implements DocumentViewCodecManager
Modifier and Type | Field and Description |
---|---|
static String |
CODECS_EXTENSION_POINT |
static String |
NAME |
Constructor and Description |
---|
DocumentViewCodecService() |
Modifier and Type | Method and Description |
---|---|
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) |
activate, applicationStarted, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public static final String NAME
public static final String CODECS_EXTENSION_POINT
public void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic <T> T getAdapter(Class<T> adapter)
Adaptable
null
if
no such object can be found.getAdapter
in interface Adaptable
getAdapter
in class DefaultComponent
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public String getDefaultCodecName()
DocumentViewCodecManager
This information is set on codec descriptors.
getDefaultCodecName
in interface DocumentViewCodecManager
public DocumentViewCodec getCodec()
public DocumentViewCodec getCodec(String codecName)
public String getUrlFromDocumentView(DocumentView docView, boolean needBaseUrl, String baseUrl)
DocumentViewCodecManager
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
getUrlFromDocumentView
in interface DocumentViewCodecManager
docView
- the original document view from requestbaseUrl
- value of the base url.public String getUrlFromDocumentView(String codecName, DocumentView docView, boolean needBaseUrl, String baseUrl)
DocumentViewCodecManager
getUrlFromDocumentView
in interface DocumentViewCodecManager
docView
- the original document view from requestbaseUrl
- value of the base url.public DocumentView getDocumentViewFromUrl(String url, boolean hasBaseUrl, String baseUrl)
DocumentViewCodecManager
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.
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.public DocumentView getDocumentViewFromUrl(String codecName, String url, boolean hasBaseUrl, String baseUrl)
DocumentViewCodecManager
DocumentViewCodec#getDocumentViewFromUrl(String, boolean, String)
on codec with given name.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.Copyright © 2013 Nuxeo SA. All Rights Reserved.