/** * Destroy lifecycle */ public void destroy() { super.destroy(); templates = null; }
@Override protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception { // First look for an existing Document attachment Document document = unit.getAttachment(Document.class); if( document == null ) { // Next parse the metadata file document = doParse(unit, file); } // Transform the document into a T instance return parse(unit, file, document); }
public void setFeature(String featureName, Boolean flag) throws Exception { getDocumentBuilderFactory().setFeature(featureName, flag); } };
/** * Create lifecycle * * @throws Exception for any problem */ public void create() throws Exception { super.create(); TransformerFactory tf = TransformerFactory.newInstance(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xslPath); try { StreamSource ss = new StreamSource(is); ss.setSystemId(xslPath); templates = tf.newTemplates(ss); log.debug("Created templates: " + templates); } finally { try { is.close(); } catch (Exception ignored) { } } }
/** * Create lifecycle * * @throws Exception for any problem */ public void create() throws Exception { super.create(); TransformerFactory tf = TransformerFactory.newInstance(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xslPath); try { StreamSource ss = new StreamSource(is); ss.setSystemId(xslPath); templates = tf.newTemplates(ss); log.debugf("Created templates: %1s", templates); } finally { try { is.close(); } catch (Exception ignored) { } } }
@Override protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception { // First look for an existing Document attachment Document document = unit.getAttachment(Document.class); if( document == null ) { // Next parse the metadata file document = doParse(unit, file); } // Transform the document into a T instance return parse(unit, file, document); }
/** * Do the parsing * * @param unit the deployment unit * @param file the metadata file * @return the document * @throws Exception for any error */ protected Document doParse(VFSDeploymentUnit unit, VirtualFile file) throws Exception { if (file == null) throw new IllegalArgumentException("Null file"); log.debugf("Parsing: %1s", file.getName()); InputSource source = new VFSInputSource(file); DocumentBuilderFactory factory = getDocumentBuilderFactory(); DocumentBuilder parser = factory.newDocumentBuilder(); parser.setEntityResolver(new JBossEntityResolver()); return parser.parse(source); }
/** * Destroy lifecycle */ public void destroy() { super.destroy(); templates = null; }
try DocumentBuilder parser = getDocumentBuilderFactory().newDocumentBuilder(); InputSource source = new InputSource(is); source.setSystemId(file.toURI().toString());