de.dfki.mycbr.io
Class XMLImporter

java.lang.Object
  extended by de.dfki.mycbr.io.XMLImporter

public final class XMLImporter
extends java.lang.Object

Imports myCBR's internal XML files. A myCBR project is a zip-file that contains several XML files (x.myCBR, x.cb, x.expl, x.config)

Author:
myCBR Team

Field Summary
static java.lang.String TMP_PART_OF_CONCEPT
           
 
Constructor Summary
XMLImporter(Project p)
          Initializes this with the given project, path and name.
 
Method Summary
static void copyInputStream(java.io.InputStream in, java.io.OutputStream out)
          Copies the given input stream to the output stream.
 void doImport()
          Imports the model from the specified XML files to the given project.
 int getCurrentNumberOfCases()
          Returns the number of cases that have been imported so far.
 Project getProject()
          Returns the current project.
 int getTotalNumberOfCases()
          Returns the number of cases that have been imported.
 void importCases()
          Starts a new thread importing the cases.
 void importModel()
          Extracts the XML-files from the original project's zip-file.
 boolean isImporting()
          Returns true, when the import thread is still alive, false otherwise.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMP_PART_OF_CONCEPT

public static final java.lang.String TMP_PART_OF_CONCEPT
See Also:
Constant Field Values
Constructor Detail

XMLImporter

public XMLImporter(Project p)
            throws java.lang.Exception
Initializes this with the given project, path and name. Adds a new case base to this project.

Parameters:
p - the project whose model should be imported
Throws:
java.lang.Exception - if something goes wrong during parsing of document
Method Detail

doImport

public void doImport()
Imports the model from the specified XML files to the given project. The model contains the concepts hierarchy structure, the concepts attributes and the corresponding similarity functions.


importModel

public void importModel()
Extracts the XML-files from the original project's zip-file.


getTotalNumberOfCases

public int getTotalNumberOfCases()
Returns the number of cases that have been imported.

Returns:
the total number of cases

importCases

public void importCases()
Starts a new thread importing the cases.


isImporting

public boolean isImporting()
Returns true, when the import thread is still alive, false otherwise.

Returns:
true, when still importing, false otherwise

getCurrentNumberOfCases

public int getCurrentNumberOfCases()
Returns the number of cases that have been imported so far.

Returns:
the number of cases currently imported

copyInputStream

public static void copyInputStream(java.io.InputStream in,
                                   java.io.OutputStream out)
                            throws java.io.IOException
Copies the given input stream to the output stream.

Parameters:
in - input stream of file to be copied
out - the output stream of the file to be written
Throws:
java.io.IOException - if something goes wrong when reading/writing

getProject

public Project getProject()
Returns the current project.

Returns:
the project this importer belongs to