viper.descriptors
Class ImportExport

java.lang.Object
  extended byviper.descriptors.ImportExport

public class ImportExport
extends java.lang.Object

Methods for importing and exporting to the old .gtf file format.


Constructor Summary
ImportExport()
           
 
Method Summary
static org.w3c.dom.Element convertToModern(java.io.InputStream inFile)
           
static boolean exportSourcefileAsGTF(Sourcefile sf)
          Asks the user where, then saves the file as a gtf file.
static boolean exportSourcefileAsGTF(Sourcefile sf, java.io.File target)
          Saves the file as a gtf file.
static boolean importConfig(ViperData v)
          Prompts the user to open a file from which to import viper configuration information.
static boolean importConfig(ViperData target, Configs cfgs)
          Copies the configuration from the source metadata set into the target metadata set.
static boolean importConfig(ViperData v, java.io.File gtc)
          Imports the configuration from the given file.
static boolean importDataFromGTF(Sourcefile sf)
          TODO: currently, does not convert the config.
static boolean importDataFromGTF(Sourcefile asFile, java.io.File gtf)
          Imports the given gtf file as the named sourcefile.
static boolean importDataFromGTF(Sourcefile target, Sourcefile source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportExport

public ImportExport()
Method Detail

importConfig

public static boolean importConfig(ViperData v,
                                   java.io.File gtc)
                            throws java.io.IOException
Imports the configuration from the given file.

Parameters:
v - the data to import the config into
gtc - the location of the configuration
Returns:
if the data changed
Throws:
java.io.IOException - if the file has an error or is missing

importConfig

public static boolean importConfig(ViperData target,
                                   Configs cfgs)
Copies the configuration from the source metadata set into the target metadata set. It will not overwrite existing attribute definitions.

Parameters:
target - the metadata to modify
Returns:
if the target was modified

importConfig

public static boolean importConfig(ViperData v)
                            throws java.io.IOException
Prompts the user to open a file from which to import viper configuration information. TODO: return a list of attribute configs that were not imported because of a merge conflict

Parameters:
v - the data to import into
Returns:
if the configuration of v has changed
Throws:
java.io.IOException

convertToModern

public static org.w3c.dom.Element convertToModern(java.io.InputStream inFile)
                                           throws java.io.IOException
Throws:
java.io.IOException

importDataFromGTF

public static boolean importDataFromGTF(Sourcefile asFile,
                                        java.io.File gtf)
Imports the given gtf file as the named sourcefile.

Parameters:
asFile -
gtf -
Returns:
true if the import was successful

importDataFromGTF

public static boolean importDataFromGTF(Sourcefile target,
                                        Sourcefile source)
Parameters:
target -
source -

importDataFromGTF

public static boolean importDataFromGTF(Sourcefile sf)
TODO: currently, does not convert the config.

Parameters:
sf -
Returns:

exportSourcefileAsGTF

public static boolean exportSourcefileAsGTF(Sourcefile sf,
                                            java.io.File target)
                                     throws java.io.IOException,
                                            BadDataException
Saves the file as a gtf file.

Parameters:
sf - the viper-api representation of a single file's video metadata
target - where to save the file
Returns:
the file was written successfully
Throws:
java.io.IOException
BadDataException

exportSourcefileAsGTF

public static boolean exportSourcefileAsGTF(Sourcefile sf)
                                     throws java.io.IOException,
                                            BadDataException
Asks the user where, then saves the file as a gtf file.

Parameters:
sf - the file to serialize.
Returns:
if the file was written successfully
Throws:
java.io.IOException - if there is an error in writing
BadDataException - if there was a viper api/ viper-pe data mismatch