Package org.garret.perst

Examples of org.garret.perst.Storage


    this.databaseFile = databaseFile;
    this.xstreamFile = xstreamFile;
  }

  public void toXML() {
    Storage db = StorageFactory.getInstance().createStorage();
    db.open(databaseFile);
    new XStreamFile(xstreamFile).write((Set) db.getRoot());
    db.close();
  }
View Full Code Here


    new XStreamFile(xstreamFile).write((Set) db.getRoot());
    db.close();
  }

  public void fromXML() {
    Storage db = StorageFactory.getInstance().createStorage();
    db.open(databaseFile);
    db.setRoot(db.createSet());
    for (Object obj : new XStreamFile(xstreamFile).read()) {
      ((Set) db.getRoot()).add(obj);
      db.store(obj);
    }
    db.commit();
    db.close();
  }
View Full Code Here

TOP

Related Classes of org.garret.perst.Storage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.