Example #1
0
 private static Boolean isInMemory() {
   if (inMemory == null) {
     Properties properties = new Properties();
     URL resource = PropertiesReader.class.getClassLoader().getResource("properties.properties");
     if (resource != null) {
       try (InputStream input = new FileInputStream(Paths.get(resource.toURI()).toFile())) {
         properties.load(input);
         String property = properties.getProperty("inMemory");
         URL = properties.getProperty("URL");
         LOGIN = properties.getProperty("LOGIN");
         PASSWORD = properties.getProperty("PASSWORD");
         DRIVER_CLASS = properties.getProperty("DRIVER_CLASS");
         if (property != null) {
           inMemory = Boolean.parseBoolean(property);
         }
         System.out.println(inMemory);
       } catch (IOException | URISyntaxException e) {
         e.printStackTrace();
       }
     }
   }
   return (inMemory != null && inMemory);
 }