Ejemplo n.º 1
0
 /**
  * Load preferences from the new file format.
  *
  * @param newPerfsFile FileWrapper containing the preferences information.
  * @throws XMLException Thrown if error reading preferences file.
  */
 private void loadNewPrefs(FileWrapper newPrefsFile) throws XMLException {
   try {
     try {
       _settingsCache.load(newPrefsFile.getPath(), getClass().getClassLoader());
     } catch (DuplicateObjectException ex) {
       s_log.error("Cache should have been empty", ex);
     }
     Iterator<LAFPreferences> it = _settingsCache.getAllForClass(LAFPreferences.class);
     if (it.hasNext()) {
       _lafPrefs = it.next();
     } else {
       s_log.error("LAFPreferences object not loaded");
     }
   } catch (FileNotFoundException ignore) {
     // property file not found for user - first time user ran pgm.
   }
 }
Ejemplo n.º 2
0
 void load() {
   try {
     if (new File(_queriesFileName).exists()) {
       XMLObjectCache cache = new XMLObjectCache();
       cache.load(_queriesFileName, getClass().getClassLoader());
       Iterator it = cache.getAllForClass(Folder.class);
       if (it.hasNext()) {
         _rootFolder = (Folder) it.next();
       }
     }
   } catch (FileNotFoundException ignore) { // first time user has run pgm.
   } catch (XMLException ex) {
     final Logger log = _app.getLogger();
     log.showMessage(Logger.ILogTypes.ERROR, "Error loading queries file: " + _queriesFileName);
     log.showMessage(Logger.ILogTypes.ERROR, ex);
   } catch (DuplicateObjectException ex) {
     final Logger log = _app.getLogger();
     log.showMessage(Logger.ILogTypes.ERROR, "Error loading queries file: " + _queriesFileName);
     log.showMessage(Logger.ILogTypes.ERROR, ex);
   }
 }
Ejemplo n.º 3
0
 /**
  * Load from a reader over an XML document. Use the system classloader and don't ignore duplicate
  * objects.
  *
  * @param rdr Reader over the XML document.
  * @exception XMLException Thrown if an XML error occurs.
  * @exception DuplicateObjectException Thrown if two objects of the same class and with the same
  *     identifier are added to the cache.
  */
 public void load(Reader rdr) throws XMLException, DuplicateObjectException {
   load(rdr, null, false);
 }
Ejemplo n.º 4
0
 /**
  * Load from an XML document.
  *
  * @param xmlFileName Name of XML file to load from.
  * @exception FileNotFoundException Thrown if file not found.
  * @exception XMLException Thrown if an XML error occurs.
  * @exception DuplicateObjectException Thrown if two objects of the same class and with the same
  *     identifier are added to the cache.
  */
 public void load(String xmlFileName)
     throws FileNotFoundException, XMLException, DuplicateObjectException {
   load(xmlFileName, null);
 }