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);
 }
Exemple #2
0
 public void load(Access access) throws MappableException, UserException {
   myNavajo = access.getInDoc();
 }