org.jhotdraw.util
Class JDOStorageFormat

java.lang.Object
  extended byorg.jhotdraw.util.StandardStorageFormat
      extended byorg.jhotdraw.util.JDOStorageFormat
All Implemented Interfaces:
StorageFormat

public class JDOStorageFormat
extends StandardStorageFormat

Version:
<$CURRENT_VERSION$>

Constructor Summary
JDOStorageFormat()
          Create a SerialzationStorageFormat for storing and restoring Drawings.
 
Method Summary
 java.lang.String createFileDescription()
          Factory method to create a file description for the file type when displaying the associated FileFilter.
protected  java.lang.String createFileExtension()
          Factory method to create the file extension recognized by the FileFilter for this SerializationStorageFormat.
 boolean isRestoreFormat()
          Every format has to identify itself as able to store and/or restore from the format it represents.
 boolean isStoreFormat()
          Every format has to identify itself as able to store and/or restore from the format it represents.
static void main(java.lang.String[] args)
           
 Drawing restore(java.lang.String fileName)
          Restore a Drawing from a file with a given name.
 java.lang.String store(java.lang.String fileName, Drawing storeDrawing)
          Store a Drawing under a given name.
 
Methods inherited from class org.jhotdraw.util.StandardStorageFormat
adjustFileName, createFileFilter, equals, getFileDescription, getFileExtension, getFileFilter, hasCorrectFileExtension, setFileDescription, setFileExtension, setFileFilter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOStorageFormat

public JDOStorageFormat()
Create a SerialzationStorageFormat for storing and restoring Drawings.

Method Detail

createFileExtension

protected java.lang.String createFileExtension()
Factory method to create the file extension recognized by the FileFilter for this SerializationStorageFormat. The SerializationStorageFormat has the file extension "ser" (e.g. my_picasso.ser).

Overrides:
createFileExtension in class StandardStorageFormat
Returns:
new file extension

createFileDescription

public java.lang.String createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter.

Overrides:
createFileDescription in class StandardStorageFormat
Returns:
new file description

isRestoreFormat

public boolean isRestoreFormat()
Description copied from interface: StorageFormat
Every format has to identify itself as able to store and/or restore from the format it represents. If the storage format can load from the format, it should return true in this method.

Specified by:
isRestoreFormat in interface StorageFormat
Overrides:
isRestoreFormat in class StandardStorageFormat
See Also:
StorageFormat.isRestoreFormat()

isStoreFormat

public boolean isStoreFormat()
Description copied from interface: StorageFormat
Every format has to identify itself as able to store and/or restore from the format it represents. If the storage format can save to the format, it should return true in this method.

Specified by:
isStoreFormat in interface StorageFormat
Overrides:
isStoreFormat in class StandardStorageFormat
See Also:
StorageFormat.isStoreFormat()

store

public java.lang.String store(java.lang.String fileName,
                              Drawing storeDrawing)
                       throws java.io.IOException
Store a Drawing under a given name. The name should be valid with regard to the FileFilter that means, it should already contain the appropriate file extension.

Specified by:
store in interface StorageFormat
Overrides:
store in class StandardStorageFormat
Parameters:
fileName - file name of the Drawing under which it should be stored
storeDrawing - drawing to be saved
Returns:
file name with correct file extension
Throws:
java.io.IOException

restore

public Drawing restore(java.lang.String fileName)
                throws java.io.IOException
Restore a Drawing from a file with a given name. The name must be should with regard to the FileFilter that means, it should have the appropriate file extension.

Specified by:
restore in interface StorageFormat
Overrides:
restore in class StandardStorageFormat
Parameters:
fileName - of the file in which the Drawing has been saved
Returns:
restored Drawing
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)