Class BaseRenderEngine
- java.lang.Object
-
- com.saperion.connector.render.engine.BaseRenderEngine
-
- All Implemented Interfaces:
RenderEngine
- Direct Known Subclasses:
ISYSRenderEngine
public abstract class BaseRenderEngine extends java.lang.Object implements RenderEngine
Render engine base implementation which does necessary pre-checks. (null, supported formats, ...)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_EXTENSION
-
Constructor Summary
Constructors Constructor Description BaseRenderEngine()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconfigure(java.util.Map<java.lang.String,java.lang.String> engineProperties)Configures the rendering engine with the specified properties.protected static InputStreamDescriptorcreateInputStreamDescriptor(byte[] content, java.lang.String filename)protected static InputStreamDescriptorcreateInputStreamDescriptor(byte[] content, java.net.URL url)static java.lang.StringgetFileFromUrl(java.net.URL url)java.util.Map<java.lang.String,java.lang.String>getProperties()java.lang.StringparseExtension(java.lang.String filename)Parses the extension the filename.java.util.List<Rendition>render(InputStreamDescriptor content, Options options)Loads the content that should be rendered with the specified options and creates the list containing the renditions.abstract java.util.List<Rendition>safeRender(InputStreamDescriptor content, SourceFormat format, Options options)Creates the collection ofinstances which represent rendered content incl.RenditionbooleansupportsSourceFormat(SourceFormat format)Checks if the source format is supported.booleansupportsTargetFormat(TargetFormat format)Checks if the target format is supported.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.saperion.connector.render.engine.RenderEngine
getSupportedSourceFormats, getSupportedTargetFormats
-
-
-
-
Field Detail
-
DEFAULT_EXTENSION
public static final java.lang.String DEFAULT_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
configure
public void configure(java.util.Map<java.lang.String,java.lang.String> engineProperties)
Configures the rendering engine with the specified properties.- Specified by:
configurein interfaceRenderEngine- Parameters:
engineProperties- Configuration for the Render Engine- See Also:
RenderEngine.configure(java.util.Map)
-
render
public java.util.List<Rendition> render(InputStreamDescriptor content, Options options) throws java.util.concurrent.TimeoutException, RenderingException
Loads the content that should be rendered with the specified options and creates the list containing the renditions.- Specified by:
renderin interfaceRenderEngine- Parameters:
content- Content asInputStreamDescriptorwhich should be rendered incl. filenameoptions-Optionswhich are describing how to render the content- Returns:
- the collection of
instances which represent rendered content incl. informationsRendition - Throws:
java.util.concurrent.TimeoutException- if a timeout was specified and it was reachedRenderingException- if engine is not available or internal initialization failures- See Also:
RenderEngine.render(com.saperion.common.io.InputStreamDescriptor, com.saperion.connector.options.Options)
-
supportsSourceFormat
public boolean supportsSourceFormat(SourceFormat format)
Checks if the source format is supported.- Specified by:
supportsSourceFormatin interfaceRenderEngine- Parameters:
format- the source format to be checked- Returns:
- true if the
SourceFormatwhich was recognized from the content filename is supported - See Also:
RenderEngine.supportsSourceFormat(SourceFormat)
-
supportsTargetFormat
public boolean supportsTargetFormat(TargetFormat format)
Checks if the target format is supported.- Specified by:
supportsTargetFormatin interfaceRenderEngine- Parameters:
format- the target format to be checked- Returns:
- true if the
TargetFormatwhich specifies how to render is supported - See Also:
RenderEngine.supportsTargetFormat(TargetFormat)
-
parseExtension
public java.lang.String parseExtension(java.lang.String filename)
Parses the extension the filename.- Parameters:
filename- filename which should be parsed- Returns:
- the extension or an empty string if nothing wDummyRenderEngineas found
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
- Returns:
- configuration properties for the engine
-
safeRender
public abstract java.util.List<Rendition> safeRender(InputStreamDescriptor content, SourceFormat format, Options options) throws java.util.concurrent.TimeoutException, RenderingException
Creates the collection ofinstances which represent rendered content incl. information.Rendition
Method to be implemented by the specific render engine.- Parameters:
content- Content asInputStreamDescriptorwhich should be rendered incl. filenameformat-SourceFormatdetermined by the file extensionoptions-Optionswhich are describing how to render the content- Returns:
- the collection of
instances which represent rendered content incl. informationsRendition - Throws:
FormatNotSupportedException- if the input or output format is not supportedPreconditionFailedException- if parts of the options are missingjava.util.concurrent.TimeoutException- if a timeout was specified and it was reachedRenderingException- if engine is not available or internal initialization failures
-
createInputStreamDescriptor
protected static InputStreamDescriptor createInputStreamDescriptor(byte[] content, java.net.URL url)
-
getFileFromUrl
public static java.lang.String getFileFromUrl(java.net.URL url)
-
createInputStreamDescriptor
protected static InputStreamDescriptor createInputStreamDescriptor(byte[] content, java.lang.String filename)
-
-