/** * It copies some files (the organisation image file and CSS file) to the dataset web root. * * @param jobConf the {@link eu.aliada.linkeddataserversetup.model.JobConfiguration} that contains * information to setup the rewrite rules in Virtuoso. * @param pageFolder the dataset web page folder. * @param pageURL the dataset web page URL. * @return true if the files has been copied correctly. False otherwise. * @since 2.0 */ public boolean copyFilesToWebServerPath( final JobConfiguration jobConf, final String pageFolder, final String pageURL) { boolean success = false; try { // Move the organization image file from TMP folder to the definitive folder final File orgImageInitFile = new File(jobConf.getOrgImagePath()); final String definitiveImgFileName = pageFolder + File.separator + "orgLogo.jpeg"; final File definitiveImgFile = new File(definitiveImgFileName); Files.move( orgImageInitFile.toPath(), definitiveImgFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); jobConf.setOrgImagePath(definitiveImgFileName); final String orgImageURL = pageURL + "/" + definitiveImgFile.getName(); jobConf.setOrgImageURL(orgImageURL); // Copy the CSS file to the definitive folder final InputStream cssInpuStream = getClass().getResourceAsStream("/" + DATASET_CSS_FILE); final String definitiveCssFileName = pageFolder + File.separator + "aliada_dataset.css"; final File definitiveCssFile = new File(definitiveCssFileName); final FileOutputStream cssOutputStream = new FileOutputStream(definitiveCssFile); int read = 0; final byte[] bytes = new byte[1024]; while ((read = cssInpuStream.read(bytes)) != -1) { cssOutputStream.write(bytes, 0, read); } cssOutputStream.close(); jobConf.setCssFilePath(definitiveCssFileName); final String cssFileURL = pageURL + "/" + DATASET_CSS_FILE; jobConf.setCssFileURL(cssFileURL); success = true; } catch (Exception exception) { LOGGER.error(MessageCatalog._00035_FILE_ACCESS_FAILURE, exception); } return success; }