pl.edu.agh.cast.model.mapper.internal
Class XMLSaver

java.lang.Object
  extended by pl.edu.agh.cast.model.mapper.internal.AbstractSaver
      extended by pl.edu.agh.cast.model.mapper.internal.XMLSaver
All Implemented Interfaces:
Saver

public class XMLSaver
extends AbstractSaver

Limited version of base model saver - allows only saving of DataSets. The DataSets are stored as separate XML files in their project's directory. The saved structure is limited - any links which go beyond DataSet - Relation - Entity relationships are discarded. The identifiers of mappable elements are unique only within the DataSet.

Author:
AGH CAST Team

Field Summary
static DateFormat DATE_FORMAT
          The format of the date.
static String EXTENSION
          The extension of the model file.
static String ID
          The name of the field which holds the id of the node.
static String MODEL_PROPS
          The name of the file where model properties are stored.
static String ROOT
          The name of the directory where the project is stored.
static String SOURCE
          The name of the field used to indicate the source of the relation.
static String TARGET
          The name of the field used to indicate the target of the relation.
static String TYPE
          The name of the field which holds the type of the node.
 
Fields inherited from class pl.edu.agh.cast.model.mapper.internal.AbstractSaver
force, log, nodes, primaryObject, queue, stored, visited
 
Constructor Summary
XMLSaver(Mappable object, boolean force, org.eclipse.core.resources.IProject project)
          The parameterized constructor.
 
Method Summary
static String dirFor(org.eclipse.core.resources.IProject project)
          For given project returns the directory where the model is stored.
static String fileFor(org.eclipse.core.resources.IProject project, String id)
          Returns the path to the file which holds data set with given id.
 boolean save()
          Save the model.
 
Methods inherited from class pl.edu.agh.cast.model.mapper.internal.AbstractSaver
getMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODEL_PROPS

public static final String MODEL_PROPS
The name of the file where model properties are stored.

See Also:
Constant Field Values

EXTENSION

public static final String EXTENSION
The extension of the model file.

See Also:
Constant Field Values

ROOT

public static final String ROOT
The name of the directory where the project is stored.

See Also:
Constant Field Values

TYPE

public static final String TYPE
The name of the field which holds the type of the node.

See Also:
Constant Field Values

ID

public static final String ID
The name of the field which holds the id of the node.

See Also:
Constant Field Values

DATE_FORMAT

public static final DateFormat DATE_FORMAT
The format of the date.


SOURCE

public static final String SOURCE
The name of the field used to indicate the source of the relation.

See Also:
Constant Field Values

TARGET

public static final String TARGET
The name of the field used to indicate the target of the relation.

See Also:
Constant Field Values
Constructor Detail

XMLSaver

public XMLSaver(Mappable object,
                boolean force,
                org.eclipse.core.resources.IProject project)
The parameterized constructor.

Parameters:
object - The object to save.
force - The force flag.
project - The project which is owner of the object.
Method Detail

save

public boolean save()
Save the model.

Returns:
true if the model was saved successfully.
See Also:
Saver.save()

dirFor

public static String dirFor(org.eclipse.core.resources.IProject project)
For given project returns the directory where the model is stored.

Parameters:
project - The project name.
Returns:
The directory object.

fileFor

public static String fileFor(org.eclipse.core.resources.IProject project,
                             String id)
Returns the path to the file which holds data set with given id.

Parameters:
project - the project where the data set is stored.
id - The id of the data set.
Returns:
The path to the file.


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.