|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.swing.filechooser.FileFilter
org.argouml.persistence.AbstractFilePersister
To persist to and from zargo (zipped file) storage.
| Constructor Summary | |
AbstractFilePersister()
|
|
| Method Summary | |
boolean |
accept(File f)
|
void |
addProgressListener(ProgressListener listener)
Add any object interested in listening to persistence progress. |
protected File |
copyFile(File src,
File dest)
Copies one file src to another, raising file exceptions if there are some problems. |
protected File |
createTempFile(File file)
Create a temporary copy of the existing file. |
abstract Project |
doLoad(File file)
|
protected abstract void |
doSave(Project project,
File file)
Implement in your concrete class to save a project to a file. |
protected void |
fireProgressEvent(long percent)
Inform listeners of any progress notifications. |
protected abstract String |
getDesc()
Just the description, not the extension between "()". |
String |
getDescription()
|
protected String |
getEncoding()
Supply the encoding to be used throughout the persistence mechanism. |
abstract String |
getExtension()
The extension valid for this type of file. |
abstract boolean |
hasAnIcon()
Returns true if a FileChooser should visualize an icon for the persister. |
boolean |
isFileExtensionApplicable(String filename)
Given the full filename this returns true if that filename contains the expected extension for the is persister. |
void |
removeProgressListener(ProgressListener listener)
Remove any object no longer interested in listening to persistence progress. |
void |
save(Project project,
File file)
Save a project to file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbstractFilePersister()
| Method Detail |
protected String getEncoding()
protected File createTempFile(File file)
throws FileNotFoundException,
IOException
file - the file to copy.
FileNotFoundException - if file not found
IOException - if error reading or writing
protected File copyFile(File src,
File dest)
throws FileNotFoundException,
IOException
dest - The destination file.src - The source file.
IOException - if there is some problems with the files.
FileNotFoundException - if any of the files cannot be found.public boolean accept(File f)
FileFilter.accept(java.io.File)public abstract String getExtension()
protected abstract String getDesc()
public boolean isFileExtensionApplicable(String filename)
filename - The filename to test.
public String getDescription()
FileFilter.getDescription()
public final void save(Project project,
File file)
throws SaveException
This first archives the existing file, then calls doSave(...) to do the actual saving.
Should doSave(...) throw an exception then it is caught here and any rollback handled before rethrowing the exception.
save in interface ProjectFilePersisterproject - The project being saved.file - The file to which the save is taking place.
SaveException - when anything goes wrongProjectFilePersister.save(
org.argouml.kernel.Project, java.io.File)
protected abstract void doSave(Project project,
File file)
throws SaveException
There is no need to worry about archiving or restoring archive on failure, that is handled by the rest of the framework.
project - the project to savefile - The file to write.
SaveException - when anything goes wrongsave(
org.argouml.kernel.Project, java.io.File)
public abstract Project doLoad(File file)
throws OpenException
doLoad in interface ProjectFilePersisterfile - the file of the project to load.
OpenException - when we fail to open from this urlProjectFilePersister.doLoad(java.io.File)protected void fireProgressEvent(long percent)
percent - the current percentage progress.public void addProgressListener(ProgressListener listener)
listener - the interested listener.public void removeProgressListener(ProgressListener listener)
listener - the listener to remove.public abstract boolean hasAnIcon()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
| ArgoUML © 1996-2006 | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |