예제 #1
0
 private static void createFileProperties(MappingTool tool, File directory) throws DAOException {
   Properties prop = new Properties();
   FileOutputStream out = null;
   try {
     prop.setProperty(
         tool.getName() + ".mapping_file",
         Utils.toRelativePath(directory.getAbsolutePath(), tool.getMappingFilePath()));
     prop.setProperty(
         tool.getName() + ".instance_translated_file",
         Utils.toRelativePath(directory.getAbsolutePath(), tool.getTranslatedInstancePath()));
     if (tool.getFileScript() != null && !tool.getFileScript().equals("")) {
       prop.setProperty(
           tool.getName() + ".script_file",
           Utils.toRelativePath(directory.getAbsolutePath(), tool.getFileScript()));
     }
     // save properties to project root folder
     logger.trace(
         "Path for File properties: "
             + directory.getAbsolutePath()
             + File.separator
             + "tool.properties");
     File file = new File(directory.getAbsolutePath() + File.separator + "tool.properties");
     out = new FileOutputStream(file.getAbsolutePath(), true);
     prop.store(out, Constant.MESSAGE_FILE_PROPERTIES + "Mapping Tool");
     // out.close();
   } catch (IOException ex) {
     logger.error(ex.getLocalizedMessage());
     throw new DAOException("Problem to build the tool.properties file", ex);
   } finally {
     try {
       if (out != null) {
         out.close();
       }
     } catch (IOException ex) {
     }
   }
 }