org.grinvin.io
Class GraphListSaver
java.lang.Object
org.grinvin.io.GraphListSaver
public final class GraphListSaver
extends java.lang.Object
Helper methods for saving graph list elements, lists of graphs
and lists of invariants to disk.
save
public static void save(GraphList list,
InvariantList ilist,
File file)
throws IOException
Save a list of graphs as an XML file. The XML file will only contain URL-references
to the corresponding graph bundles, and not the graph bundle contents. These should
be saved separately.
If the parameter
ilist is not null, also the invariants in that
list are stored into the XML file.
Creates a file with contents of the form
<graphlistelements name="...">
<graphlistelement graphURI="..."/>
...
<invariant invariantId="..."/>
...
</graphlistelements>
Note: Graphs without an URI ar note saved
list
- Graph list to be storedilist
- Optional invariant list to be stored into the same file (can be null)file
- File into which this list should be stored
save
public static void save(InvariantList list,
File file)
throws IOException
Save a list of invariants as an XML file. Creates a file with contents
of the form
<invariants>
<invariant invariantId="..."/>
...
</invariants>
list
- List(model) of invariants to be storedfile
- File into which these invariants should be stored
saveIntoWorkspace
public static void saveIntoWorkspace(GraphList list,
InvariantList ilist,
File directory)
throws IOException
Save a (session) graph list into a (workspace) directory. Uses the uri
of the graph list to determine the destination file name. If no URI was
assigned, a new URI is created. Note that the graph list elements themselves
need to be saved separately.
saveIntoWorkspace(GraphListElement gle, File directory)
saveIntoWorkspace
public static void saveIntoWorkspace(GraphListElement gle,
File directory)
throws IOException
Save a (session) graph list element into a (workspace) directory. Uses the uri
of the graph to determine the destination file name. If no URI was
assigned, a new URI is created.
Only saves graphs with a session URI and which are dirty or for which the
corresponding file does not yet exist. The 'dirty' flag of the graph list
element is cleared after it is saved.