com.okworx.ilcd.validation.util.TransletCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ilcd-validation Show documentation
Show all versions of ilcd-validation Show documentation
A Java library for performing technical validation of data in ILCD data format.
package com.okworx.ilcd.validation.util;
import org.apache.logging.log4j.Logger;
import javax.xml.transform.Templates;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
/**
* TransletCache class.
*
* @author oliver.kusche
* @version $Id: $Id
*/
public class TransletCache {
protected final Logger log = org.apache.logging.log4j.LogManager.getLogger( this.getClass() );
private static final TransletCache instance = new TransletCache();
private Templates translet;
/**
* Getter for the field translet
.
*
* @return a {@link javax.xml.transform.Templates} object.
*/
public Templates getTranslet() {
return this.translet;
}
/**
* Constructor for TransletCache.
*/
protected TransletCache() {
TransformerFactory fact = TransformerFactory.newInstance();
try {
this.translet = fact.newTemplates(new StreamSource(this.getClass()
.getClassLoader()
.getResourceAsStream("stylesheets/extractReferences.xsl")));
} catch (TransformerConfigurationException e) {
log.error(e);
}
}
/**
* Getter for the field instance
.
*
* @return a {@link com.okworx.ilcd.validation.util.TransletCache} object.
*/
public static TransletCache getInstance() {
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy