org.grinvin.io

Class 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.

Method Summary

static void
cacheInvariants(GraphListElement gle)
static void
save(GraphInvariantList list, File file)
Convenience method which saves a graph list of type GraphInvariantList.
static void
save(GraphList list, InvariantList ilist, File file)
Save a list of graphs as an XML file.
static void
save(InvariantList list, File file)
Save a list of invariants as an XML file.
static void
saveIntoWorkspace(GraphList list, InvariantList ilist, File directory)
Save a (session) graph list into a (workspace) directory.
static void
saveIntoWorkspace(GraphListElement gle, File directory)
Save a (session) graph list element into a (workspace) directory.

Method Details

cacheInvariants

public static void cacheInvariants(GraphListElement gle)

save

public static void save(GraphInvariantList list,
                        File file)
            throws IOException
Convenience method which saves a graph list of type GraphInvariantList. Calls save(GraphList,InvariantList,File) with the appropriate arguments.

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
Parameters:
list - Graph list to be stored
ilist - 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>
 
Parameters:
list - List(model) of invariants to be stored
file - 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.

See Also:
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.