Exemple #1
0
 public void writeConfig(String name, Navajo conf) throws IOException {
   File f = getTempFile(name);
   System.err.println("IN WRITECONFIG(" + name + "): " + f.getAbsolutePath());
   FileWriter fw = new FileWriter(f);
   try {
     conf.write(fw);
   } catch (NavajoException e) {
     e.printStackTrace();
   }
   fw.close();
 }
 public void store() throws MappableException, UserException {
   File f = new File(pathPrefix);
   if (!f.exists()) {
     if (!f.mkdirs()) {
       throw new MappableException("Could not open directory, and could also not create it.");
     }
   }
   Navajo n = NavajoFactory.getInstance().createNavajo();
   Message filesMessage =
       NavajoFactory.getInstance().createMessage(n, "Files", Message.MSG_TYPE_ARRAY);
   try {
     n.addMessage(filesMessage);
   } catch (NavajoException ex2) {
     ex2.printStackTrace();
   }
   File[] files;
   if (fileNameFilter != null) {
     FilenameFilter ff =
         new FilenameFilter() {
           public boolean accept(File f, String s) {
             return s.endsWith(fileNameFilter);
           }
         };
     files = f.listFiles(ff);
   } else {
     files = f.listFiles();
   }
   for (int i = 0; i < files.length; i++) {
     try {
       Message m = createFileMessage(filesMessage, files[i], descriptionPath);
       if (m != null) {
         filesMessage.addMessage(m);
       }
     } catch (NavajoException ex1) {
       ex1.printStackTrace();
     }
   }
   access.setOutputDoc(n);
 }