org.strutsme.wishlist.persistence.facade
Class WishlistPersistenceFacadeFile

java.lang.Object
  extended by org.strutsme.wishlist.persistence.facade.AbstractWishlistPersistenceFacade
      extended by org.strutsme.wishlist.persistence.facade.WishlistPersistenceFacadeFile
All Implemented Interfaces:
WishlistPersistenceFacade

public class WishlistPersistenceFacadeFile
extends AbstractWishlistPersistenceFacade

Implentation of the facade which uses serialiation to persist the state.

Author:
rfalke

Field Summary
static java.lang.String STORAGE_FILE
          The filename of the storage file.
 
Fields inherited from class org.strutsme.wishlist.persistence.facade.AbstractWishlistPersistenceFacade
count, users, wishes
 
Constructor Summary
WishlistPersistenceFacadeFile()
          Empty constructor.
 
Method Summary
protected  void load()
          Should load the data and update the instance variables.
protected  void stateChanged()
          Called if the state changed.
 
Methods inherited from class org.strutsme.wishlist.persistence.facade.AbstractWishlistPersistenceFacade
addDummyWishes, createWish, deleteWish, getDefaultUser, getUserById, getUserByName, getWishById, getWishes, saveWish
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORAGE_FILE

public static java.lang.String STORAGE_FILE
The filename of the storage file.

Constructor Detail

WishlistPersistenceFacadeFile

public WishlistPersistenceFacadeFile()
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Empty constructor. The exceptions require this.

Throws:
java.lang.ClassNotFoundException - if the wishes couldn't be loaded
java.io.IOException - if the wishes couldn't be loaded
Method Detail

load

protected final void load()
                   throws java.io.IOException,
                          java.lang.ClassNotFoundException
Should load the data and update the instance variables.

Specified by:
load in class AbstractWishlistPersistenceFacade
Throws:
java.io.IOException - if the wishes couldn't be loaded
java.lang.ClassNotFoundException - if the wishes couldn't be loaded

stateChanged

protected final void stateChanged()
                           throws java.io.IOException
Called if the state changed. Can be used to save it.

Specified by:
stateChanged in class AbstractWishlistPersistenceFacade
Throws:
java.io.IOException - if for example the saving failed.