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.String
DEFAULT_EXTENSION
-
Constructor Summary
Constructors Constructor Description BaseRenderEngine()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
configure(java.util.Map<java.lang.String,java.lang.String> engineProperties)
Configures the rendering engine with the specified properties.protected static InputStreamDescriptor
createInputStreamDescriptor(byte[] content, java.lang.String filename)
protected static InputStreamDescriptor
createInputStreamDescriptor(byte[] content, java.net.URL url)
static java.lang.String
getFileFromUrl(java.net.URL url)
java.util.Map<java.lang.String,java.lang.String>
getProperties()
java.lang.String
parseExtension(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 of
instances which represent rendered content incl.Rendition
boolean
supportsSourceFormat(SourceFormat format)
Checks if the source format is supported.boolean
supportsTargetFormat(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:
configure
in 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:
render
in interfaceRenderEngine
- Parameters:
content
- Content asInputStreamDescriptor
which should be rendered incl. filenameoptions
-Options
which 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:
supportsSourceFormat
in interfaceRenderEngine
- Parameters:
format
- the source format to be checked- Returns:
- true if the
SourceFormat
which 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:
supportsTargetFormat
in interfaceRenderEngine
- Parameters:
format
- the target format to be checked- Returns:
- true if the
TargetFormat
which 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 of
instances which represent rendered content incl. information.Rendition
Method to be implemented by the specific render engine.- Parameters:
content
- Content asInputStreamDescriptor
which should be rendered incl. filenameformat
-SourceFormat
determined by the file extensionoptions
-Options
which 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)
-
-