org.argouml.persistence
Class UmlFilePersister

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by org.argouml.persistence.AbstractFilePersister
          extended by org.argouml.persistence.UmlFilePersister
All Implemented Interfaces:
ProjectFilePersister

public class UmlFilePersister
extends AbstractFilePersister

To persist to and from argo (xml file) storage.


Field Summary
static int PERSISTENCE_VERSION
          The PERSISTENCE_VERSION is increased every time the persistence format changes.
protected static int UML_PHASES_LOAD
          The TOTAL_PHASES_LOAD constant is the number of phases used by the load process.
 
Constructor Summary
UmlFilePersister()
          The constructor.
 
Method Summary
protected  boolean checkVersion(int fileVersion, java.lang.String releaseVersion)
           
 Project doLoad(java.io.File file)
           
protected  Project doLoad(java.io.File originalFile, java.io.File file, org.argouml.persistence.AbstractFilePersister.ProgressMgr progressMgr)
           
 void doSave(Project project, java.io.File file)
          It is being considered to save out individual xmi's from individuals diagrams to make it easier to modularize the output of Argo.
protected  java.lang.String getDesc()
          Just the description, not the extension between "()".
 java.lang.String getExtension()
          The extension valid for this type of file.
protected  int getPersistenceVersion(java.io.InputStream inputStream)
          Reads an XML file of uml format and extracts the persistence version number from the root tag.
protected  java.lang.String getReleaseVersion(java.io.InputStream inputStream)
          Reads an XML file of uml format and extracts the persistence version number from the root tag.
protected  java.lang.String getVersion(java.lang.String rootLine)
          Get the version attribute value from a string of XML.
 boolean hasAnIcon()
          Returns true.
 boolean isSaveEnabled()
          The .uml save format is no longer available to save.
 java.io.File transform(java.io.File file, int version)
          Transform a string of XML data according to the service required.
 
Methods inherited from class org.argouml.persistence.AbstractFilePersister
accept, addProgressListener, copyFile, createTempFile, getDescription, getMemberFilePersister, getMemberFilePersister, isFileExtensionApplicable, isLoadEnabled, removeProgressListener, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSISTENCE_VERSION

public static final int PERSISTENCE_VERSION
The PERSISTENCE_VERSION is increased every time the persistence format changes. This controls conversion of old persistence version files to be converted to the current one, keeping ArgoUML backwards compatible.

See Also:
Constant Field Values

UML_PHASES_LOAD

protected static final int UML_PHASES_LOAD
The TOTAL_PHASES_LOAD constant is the number of phases used by the load process.

See Also:
Constant Field Values
Constructor Detail

UmlFilePersister

public UmlFilePersister()
The constructor.

Method Detail

getExtension

public java.lang.String getExtension()
Description copied from class: AbstractFilePersister
The extension valid for this type of file. (Just the chars, not the dot: e.g. "zargo".)

Specified by:
getExtension in class AbstractFilePersister
Returns:
the extension valid for this type of file

getDesc

protected java.lang.String getDesc()
Description copied from class: AbstractFilePersister
Just the description, not the extension between "()".

Specified by:
getDesc in class AbstractFilePersister
Returns:
the description valid for this type of file

doSave

public void doSave(Project project,
                   java.io.File file)
            throws SaveException,
                   java.lang.InterruptedException
It is being considered to save out individual xmi's from individuals diagrams to make it easier to modularize the output of Argo.

Specified by:
doSave in class AbstractFilePersister
Parameters:
file - The file to write.
project - the project to save
Throws:
SaveException - when anything goes wrong
java.lang.InterruptedException - if the thread is interrupted
See Also:
ProjectFilePersister.save(org.argouml.kernel.Project, java.io.File)

isSaveEnabled

public boolean isSaveEnabled()
The .uml save format is no longer available to save. Some persisters only provide load functionality for discontinued formats but no save. This method returns true by default. Those Peristers that do not provide save must override this.

Overrides:
isSaveEnabled in class AbstractFilePersister
Returns:
true if this persister is able to save

doLoad

public Project doLoad(java.io.File file)
               throws OpenException,
                      java.lang.InterruptedException
Specified by:
doLoad in interface ProjectFilePersister
Specified by:
doLoad in class AbstractFilePersister
Parameters:
file - the file of the project to load.
Returns:
the Project
Throws:
OpenException - when we fail to open from this url
java.lang.InterruptedException - if the thread is interrupted

doLoad

protected Project doLoad(java.io.File originalFile,
                         java.io.File file,
                         org.argouml.persistence.AbstractFilePersister.ProgressMgr progressMgr)
                  throws OpenException,
                         java.lang.InterruptedException
Throws:
OpenException
java.lang.InterruptedException

checkVersion

protected boolean checkVersion(int fileVersion,
                               java.lang.String releaseVersion)
                        throws OpenException,
                               VersionException
Throws:
OpenException
VersionException

transform

public final java.io.File transform(java.io.File file,
                                    int version)
                             throws OpenException
Transform a string of XML data according to the service required.

Parameters:
file - The XML file to be transformed
version - the version of the persistence format the XML is to be transformed to.
Returns:
the transformed XML file
Throws:
OpenException - on XSLT transformation error or file read

getPersistenceVersion

protected int getPersistenceVersion(java.io.InputStream inputStream)
                             throws OpenException
Reads an XML file of uml format and extracts the persistence version number from the root tag.

Parameters:
inputStream - stream pointing to file to read.
Returns:
The version number
Throws:
OpenException - on any error

getReleaseVersion

protected java.lang.String getReleaseVersion(java.io.InputStream inputStream)
                                      throws OpenException
Reads an XML file of uml format and extracts the persistence version number from the root tag.

Parameters:
inputStream - the stream point to the XML file
Returns:
The ArgoUML release number
Throws:
OpenException - on any error

getVersion

protected java.lang.String getVersion(java.lang.String rootLine)
Get the version attribute value from a string of XML.

Parameters:
rootLine - the line
Returns:
the version

hasAnIcon

public boolean hasAnIcon()
Returns true. All Argo specific files have an icon. Returns true if a FileChooser should visualize an icon for the persister.

Specified by:
hasAnIcon in class AbstractFilePersister
Returns:
true if the persister is associated to an icon


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook