class: ValidationSchemaCache

public class: ValidationSchemaCache
Author: mfranke
Project: Phase: 1.0; Status: Proposed; Version: $Revision: 146 $$LastChangedDate: 2007-12-18 14:42; Complexity: 1
Dates: Created: 16.07.2009 15:21:28; Modified: 16.07.2009 15:21:28;
Flags: Active: false; IsRoot: false; IsLeaf: true;
Extension Points:
UUID: {D5D6B6F2-727E-4adb-A209-FF5B306476AA}
Class to deal with validation schemas.
 

Goto: Custom Properties, Fields, Methods

See also: XmlTransforming, ValidationCacheTest

Appears in: validation

Connections
 
Custom Properties
 
ValidationSchemaCache Attributes
Attribute Details
private static TransformerFactory
  factory
Initial: null
Notes: XSLT transformer factory.
private static ValidationSchemaCache
  instance
Initial: null
Notes: Singleton.
private Date
  lastRefreshDate
Initial: null
private static const Logger
  LOGGER
Initial: Logger.getLogger(ValidationSchemaCache.class)
Notes: Logger for this class.
private Transformer
  phaseTemplate
Initial: null
Notes: The phase template used for precompilation.
private Transformer
  schematronTemplate
Initial: null
Notes: The schematron skeleton template used for precompilation.
private const HashMap
  validationSchemaContextMap
Initial: new HashMap()
Notes: Cached map of contexts and the according validation schemas.
private XmlTransforming
  xmlTransforming
Notes: Common XML transforming functionalities.
private HashMap
  xsltCache
Initial: new HashMap()
Notes: XSLT Transformer cache.
private const boolean
  xsltCacheEnabled
Initial: true
Notes: Enable caching of XSLT Transformer objects.
 
ValidationSchemaCache Methods
Operation Details
public
clearCache():void
Sequential
Tags: throws=TechnicalException
Notes: Clear validation database.
public
createCache():void
Sequential
Tags: throws=TechnicalException
Notes: Create validation cache.
private
getConnection():Connection
Sequential
Tags: throws=TechnicalException
Notes: Initialize Connection to database.
public static
getInstance():ValidationSchemaCache
Sequential
Tags: throws=TechnicalException
Notes: Get a singleton instance.
@return The singleton.
public
getLastRefreshDate():Date
Sequential
private
getPhaseTemplate():Transformer
Sequential
Tags: throws=TechnicalException
Notes: Get the xslt template for extracting the phases.
@return phase template.
public
getPrecompiledSchema(
   String context,
   String contentType,
   String validationPoint):String
Sequential
Tags: throws=TechnicalException,ValidationSchemaNotFoundException
Notes: Retrieve the precompiled schematron validation schema according to the given schemaName and content-type.
@param schemaName The escidoc schemaName id.
@param contentModel The escidoc content-type.
@return The validation schema as xml.
public
getPrecompiledTransformer(
   String context,
   String contentType,
   String validationPoint):Transformer
Sequential
Tags: throws=TechnicalException,ValidationSchemaNotFoundException
Notes: Retrieve the precompiled schematron validation schema according to the given schemaName and content-type.
@param schemaName The escidoc schemaName id.
@param contentModel The escidoc content-type.
@return The validation schema as xml.
private
getSchematronTemplate():Transformer
Sequential
Tags: throws=TechnicalException
Notes: Get the schematron skeleton template from the database.
@return Schematron skeleton template.
public
getValidationSchema(
   String schemaName,
   String contentModel):String
Sequential
Tags: throws=TechnicalException,ValidationSchemaNotFoundException
Notes: Retrieve the precompiled schematron validation schema according to the given schemaName and content model.
@return The validation schema as xml.
public
getValidationSchemaId(
   String context):String
Sequential
Tags: throws=Exception
private
insertConeContent(
   String schema):String
Sequential
public static
main(
   String[] args):void
Sequential
Tags: throws=Exception
Notes: Main method for testing.
private
precompile(
   String context,
   String contentType,
   String metadataVersion):void
Sequential
Tags: throws=TechnicalException,ValidationSchemaNotFoundException
Notes: Precompile a validation schema.
@param schemaName The escidoc schemaName id.
@param contentModel The escidoc content-type.
private
precompileAll():void
Sequential
Tags: throws=TechnicalException
Notes: Precompile every validation schema in the database.
public
refreshCache():void
Sequential
Tags: throws=TechnicalException
Notes: Update the cache from the main repository.
public
refreshCache(
   Date lastRefresh):void
Sequential
Tags: throws=Exception
Notes: Update the cache from the main repository.
public
resetCache():void
Sequential
Tags: throws=TechnicalException
Notes: Resets the validation schema cache database.
private
retrieveNewSchemas(
   Date lastRefresh):void
Sequential
Tags: throws=Exception
public
setLastRefreshDate(
   Date lastRefreshDate):void
Sequential
public
setValidationSchema(
   String schemaName,
   String contentModel,
   String content):void
Sequential
Tags: throws=TechnicalException,ValidationSchemaNotFoundException
Notes: Retrieve the precompiled schematron validation schema according to the given schemaName and content model.
@return The validation schema as xml.
private
transformSchema(
   String schema,
   String context,
   String contentType,
   String metadataVersion):void
Sequential
Tags: throws=TechnicalException,SQLException
Notes: Internal method to store the preecompiled Template for each phase into the database.
@param schemaId The schema uid.
private
ValidationSchemaCache():
Sequential
Tags: throws=TechnicalException
Notes: Constructor is hidden. An instance can be retrieved by calling getInstance.