@Override public void removeViews(String datasourceName) { w.lock(); try { File targetDir = getDatasourceViewsGit(datasourceName); FileUtil.delete(targetDir); } catch (IOException e) { throw new RuntimeException( "Failed deleting views in git for datasource: " + datasourceName, e); } finally { w.unlock(); } }
protected void writeOpalConfig(Document opalConfig) { OutputStream outputStream = null; try { Source source = new DOMSource(opalConfig); File tmpFile = File.createTempFile("cfg", ".tmp"); Result dest = new StreamResult(outputStream = new FileOutputStream(tmpFile)); transformer.transform(source, dest); FileUtil.moveFile(tmpFile, new File(opalConfigFile)); } catch (IOException | TransformerException e) { throw new RuntimeException(e); } finally { StreamUtil.silentSafeClose(outputStream); } }