Package com.microstrategy.web.transform
Class LayoutSourceFile
- java.lang.Object
-
- com.microstrategy.web.transform.AbstractLayoutSource
-
- com.microstrategy.web.transform.LayoutSourceFile
-
- All Implemented Interfaces:
LayoutSource
- Direct Known Subclasses:
AppLayoutSourceFile
public class LayoutSourceFile extends AbstractLayoutSource
The LayoutSourceFile implements theLayoutSource
interface by providing a way to associate layout definitions with disk files.- Since:
- MicroStrategy Web 8.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.web.transform.AbstractLayoutSource
AbstractLayoutSource.LayoutCacheHint
-
-
Constructor Summary
Constructors Constructor Description LayoutSourceFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDescription()
Gets the description of this layout source object (to be read by someone wishing to use it).protected java.io.InputStream
getLayoutAsStream(java.lang.String location)
Returns an InputStream for reading the layout XHTML at the specified layout location.protected java.lang.String
getLayoutString(java.lang.String location)
Returns the string representation of a layout definition.LayoutTag
retrieveLayoutDefinition(java.lang.String sourceLocation, LayoutParser layoutParser)
Retrieves an in-memory representation of the layout at the supplied source location.void
saveLayoutDefinition(java.lang.String targetLocation, LayoutTag layoutDefn)
Saves the in-memory layout definition back to its persistent storage at the supplied target location.-
Methods inherited from class com.microstrategy.web.transform.AbstractLayoutSource
checkNullObject, getLayout
-
-
-
-
Method Detail
-
getDescription
public java.lang.String getDescription()
Gets the description of this layout source object (to be read by someone wishing to use it). This description should include the syntax for a valid location.- Returns:
- A textual description of this layout source object.
-
retrieveLayoutDefinition
public LayoutTag retrieveLayoutDefinition(java.lang.String sourceLocation, LayoutParser layoutParser) throws WebTransformException
Retrieves an in-memory representation of the layout at the supplied source location. If a layout has already been loaded, it should be returned as is. If there is not already an existing in-memory representation, the layout definition (as a String) should be parsed using the suppliedLayoutParser
.- Parameters:
sourceLocation
- The location that the layout definition can be found.layoutParser
- A layout parser to use, if necessary.- Returns:
- The in-memory representation of the layout definition.
- Throws:
WebTransformException
- thrown if the layout can not be parsed.
-
saveLayoutDefinition
public void saveLayoutDefinition(java.lang.String targetLocation, LayoutTag layoutDefn) throws WebTransformException
Saves the in-memory layout definition back to its persistent storage at the supplied target location.- Parameters:
targetLocation
- The location where the layout definition should be saved.layoutDefn
- The in-memory layout definition to save.- Throws:
WebTransformException
- This exception is thrown if the layout definition could not be saved back to the target location.
-
getLayoutAsStream
protected java.io.InputStream getLayoutAsStream(java.lang.String location) throws WebTransformException
Returns an InputStream for reading the layout XHTML at the specified layout location. The default implementation takes the input parameterlocation
as a full path to a physical file in your local disk.- Parameters:
location
- the layout location, defined in the StyleCatalog XML file.- Returns:
- the input stream, which must be not null, for reading layout XHTML
- Throws:
WebTransformException
- thrown if there is error when reading the layout.
-
getLayoutString
protected java.lang.String getLayoutString(java.lang.String location) throws WebTransformException
Description copied from class:AbstractLayoutSource
Returns the string representation of a layout definition. The layout cache uses this method to load the layout definition string and then delegates to the layout parser to parse it. The parsed layou definition is cached.- Specified by:
getLayoutString
in classAbstractLayoutSource
- Parameters:
location
- the layout location, defined in the StyleCatalog XML file.- Returns:
- the string representation of a layout definition.
- Throws:
WebTransformException
- if there is any error while retrieving the layout string
-
-