コード例 #1
0
 @Override
 public String retrieveXML() throws RepositoryException {
   try {
     return Tools.readTextFile(getFile());
   } catch (IOException e) {
     throw new RepositoryException("Cannot read " + getFile() + ": " + e, e);
   }
 }
コード例 #2
0
  /** @return the text for the beta eula */
  private String loadBetaEULA() {
    String eulaText = null;
    // read EULA text
    try (InputStream inputStream = Tools.getResourceInputStream(BETA_EULA)) {
      eulaText = Tools.readTextFile(inputStream);
    } catch (IOException | RepositoryException e2) {
      // loading the EULA failed (this should never happen)
      LogService.getRoot()
          .log(
              Level.SEVERE,
              "com.rapidminer.gui.properties.BetaFeaturesListener.cannot_open_beta_eula");
    }

    return eulaText;
  }
コード例 #3
0
 public static void init() {
   File connectionsFile = getOldConnectionsFile();
   File xmlConnectionsFile = getXMLConnectionsFile();
   if (!xmlConnectionsFile.exists() && !connectionsFile.exists()) {
     // both files do not exist, create the new xml format file
     try {
       xmlConnectionsFile.createNewFile();
       writeXMLConnectionsEntries(getConnectionEntries(), xmlConnectionsFile);
     } catch (IOException ex) {
       // do nothing
     }
   } else if (!xmlConnectionsFile.exists() && connectionsFile.exists()) {
     // only the old text format exists, read it and save as new xml format so next time only the
     // new xml format exists
     connections = readConnectionEntries(connectionsFile);
     writeXMLConnectionsEntries(getConnectionEntries(), xmlConnectionsFile);
     connectionsFile.delete();
   } else {
     try {
       if (!"".equals(Tools.readTextFile(xmlConnectionsFile))) {
         Document document = XMLTools.parse(xmlConnectionsFile);
         Element jdbcElement = document.getDocumentElement();
         connections = new LinkedList<FieldConnectionEntry>(parseEntries(jdbcElement));
       }
     } catch (Exception e) {
       // LogService.getRoot().log(Level.WARNING, "Failed to read database connections file: "+e,
       // e);
       LogService.getRoot()
           .log(
               Level.WARNING,
               I18N.getMessage(
                   LogService.getRoot().getResourceBundle(),
                   "com.rapidminer.tools.jdbc.connection.DatabaseConnectionService.reading_database_error",
                   e),
               e);
     }
   }
 }