com.javadocking.model.codec
Class DockModelPropertiesEncoder

java.lang.Object
  extended by com.javadocking.model.codec.DockModelPropertiesEncoder
All Implemented Interfaces:
DockModelEncoder

public class DockModelPropertiesEncoder
extends java.lang.Object
implements DockModelEncoder

This class encodes the DockModel and DockingPathModel into a java.util.Properties object. After that, it encodes this properties object in a file with extension .dck.

Author:
Heidi Rakels.

Field Summary
static java.lang.String EXTENSION
          The extension of the files generated by this dock model group encoder.
 
Constructor Summary
DockModelPropertiesEncoder()
           
 
Method Summary
 boolean canExport(DockModel dockModel, java.lang.String destinationName)
          Checks whether this encoder can export the given dock model to a new specified location.
 boolean canSave(DockModel dockModel)
          Checks whether this encoder can save the given dock model in the location, where it originally came from.
 void export(DockModel dockModel, java.lang.String destinationName)
          Exports the dock model to the specified location.
 void save(DockModel dockModel)
          Saves the dock model in the location, where it originally came from.
protected  void saveProperties(DockModel dockModel, DockingPathModel dockingPathModel, java.util.Properties properties, java.util.Map dockKeys)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTENSION

public static final java.lang.String EXTENSION
The extension of the files generated by this dock model group encoder.

See Also:
Constant Field Values
Constructor Detail

DockModelPropertiesEncoder

public DockModelPropertiesEncoder()
Method Detail

canExport

public boolean canExport(DockModel dockModel,
                         java.lang.String destinationName)
Description copied from interface: DockModelEncoder
Checks whether this encoder can export the given dock model to a new specified location.

Specified by:
canExport in interface DockModelEncoder
Parameters:
dockModel - The dock model that has to be exported.
destinationName - The name of the location where the dock model should be saved.
Returns:
True if this encoder can save the given dock model at the specified location, false otherwise.

canSave

public boolean canSave(DockModel dockModel)
Description copied from interface: DockModelEncoder
Checks whether this encoder can save the given dock model in the location, where it originally came from.

Specified by:
canSave in interface DockModelEncoder
Parameters:
dockModel - The dock model that has to be saved.
Returns:
True if this encoder can save the given dock model in the location, where it originally came from, false otherwise.

export

public void export(DockModel dockModel,
                   java.lang.String destinationName)
            throws java.io.IOException,
                   java.lang.IllegalArgumentException
Description copied from interface: DockModelEncoder
Exports the dock model to the specified location.

Specified by:
export in interface DockModelEncoder
Parameters:
dockModel - The dock model that has to be exported.
destinationName - The name of the location, where the dock model should be saved.
Throws:
java.io.IOException - If an error occurs while exporting the data.
java.lang.IllegalArgumentException - If the dock model can not be exported to the new location by this encoder.

save

public void save(DockModel dockModel)
          throws java.io.IOException,
                 java.lang.IllegalArgumentException
Description copied from interface: DockModelEncoder
Saves the dock model in the location, where it originally came from.

Specified by:
save in interface DockModelEncoder
Parameters:
dockModel - The dock model model that has to be saved.
Throws:
java.io.IOException - If an error occurs while saving the data.
java.lang.IllegalArgumentException - If the dock model can not be saved by this encoder.

saveProperties

protected void saveProperties(DockModel dockModel,
                              DockingPathModel dockingPathModel,
                              java.util.Properties properties,
                              java.util.Map dockKeys)