@ Nullable public static SchematronProviderXSLTFromSCH getSchematronXSLTProvider ( @ Nonnull final IReadableResource aSchematronResource , @ Nonnull final SCHTransformerCustomizer aTransformerCustomizer ) { ValueEnforcer . notNull ( aSchematronResource , "SchematronResource" ) ; ValueEnforcer . notNull ( aTransformerCustomizer , "TransformerCustomizer" ) ; if ( ! aSchematronResource . exists ( ) ) { LOGGER . warn ( "Schematron resource " + aSchematronResource + " does not exist!" ) ; return null ; } if ( ! aTransformerCustomizer . canCacheResult ( ) ) { // Create new object and return without cache handling because the custom // parameters may have side effects on the created XSLT! return createSchematronXSLTProvider ( aSchematronResource , aTransformerCustomizer ) ; } // Determine the unique resource ID for caching final String sCacheKey = StringHelper . < String > getImploded ( ' ' , aSchematronResource . getResourceID ( ) , StringHelper . getNotNull ( aTransformerCustomizer . getPhase ( ) ) , StringHelper . getNotNull ( aTransformerCustomizer . getLanguageCode ( ) ) ) ; s_aLock . lock ( ) ; try { // Validator already in the cache? SchematronProviderXSLTFromSCH aProvider = s_aCache . get ( sCacheKey ) ; if ( aProvider == null ) { // Create new object and put in cache aProvider = createSchematronXSLTProvider ( aSchematronResource , aTransformerCustomizer ) ; if ( aProvider != null ) s_aCache . put ( sCacheKey , aProvider ) ; } return aProvider ; } finally { s_aLock . unlock ( ) ; } }
Get the Schematron validator for the passed resource . If no custom parameter are present the result is cached . The respective cache key is a combination of the Schematron resource path the phase and the language code .