org.jboss.dna.graph.util
Class GraphImporter

java.lang.Object
  extended by org.jboss.dna.graph.util.GraphImporter

public class GraphImporter
extends Object

Author:
Randall Hauch

Nested Class Summary
static interface GraphImporter.ImportSpecification
           
 
Constructor Summary
GraphImporter(RepositoryConnectionFactory sources, ExecutionContext context)
           
 
Method Summary
 ExecutionContext getContext()
          Get the context in which the importer will be executed.
 GraphImporter.ImportSpecification importXml(File file)
          Import the content from the supplied XML file, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.
 GraphImporter.ImportSpecification importXml(String pathToFile)
          Import the content from the XML file at the supplied file location, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.
 GraphImporter.ImportSpecification importXml(URI uri)
          Import the content from the XML file at the supplied URI, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.
 void importXml(URI uri, String sourceName, Path destinationPathInSource)
          Read the content from the supplied URI and import into the repository at the supplied location.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphImporter

public GraphImporter(RepositoryConnectionFactory sources,
                     ExecutionContext context)
Method Detail

getContext

public ExecutionContext getContext()
Get the context in which the importer will be executed.

Returns:
the execution context; never null

importXml

public GraphImporter.ImportSpecification importXml(URI uri)
Import the content from the XML file at the supplied URI, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.

Parameters:
uri - the URI where the importer can read the content that is to be imported
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

importXml

public GraphImporter.ImportSpecification importXml(String pathToFile)
Import the content from the XML file at the supplied file location, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.

Parameters:
pathToFile - the path to the XML file that should be imported.
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

importXml

public GraphImporter.ImportSpecification importXml(File file)
Import the content from the supplied XML file, specifying on the returned GraphImporter.ImportSpecification where the content is to be imported.

Parameters:
file - the XML file that should be imported.
Returns:
the object that should be used to specify into which the content is to be imported
Throws:
IllegalArgumentException - if the uri or destination path are null

importXml

public void importXml(URI uri,
                      String sourceName,
                      Path destinationPathInSource)
               throws IOException,
                      RepositorySourceException
Read the content from the supplied URI and import into the repository at the supplied location.

Parameters:
uri - the URI where the importer can read the content that is to be imported
sourceName - the name of the source into which the content is to be imported
destinationPathInSource - the path in the repository source where the content is to be written; may not be null
Throws:
IllegalArgumentException - if the uri or destination path are null
IOException - if there is a problem reading the content
RepositorySourceException - if there is a problem while writing the content to the repository source


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.