Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.io
Class GraphImporter

    java.lang.Object
      org.modeshape.graph.io.GraphImporter

    public class GraphImporter

extends Object

An importer of graph content. This class can be used directly, or the import can be done via the `Graph` using the `Graph.importXmlFrom(java.io.File)` (and similar) methods.

Constructor Summary
`GraphImporter(Graph graph)`

Method Summary
`ExecutionContext` | `getContext()` Get the context in which the importer will be executed.
`Graph` | `getGraph()` The graph that this importer uses.
`XmlHandler` | `getHandlerForImportingXml(Location location, boolean skip)` Return an `XmlHandler` that can be used to import content directly into the supplied location.
`protected Name` | `getNameAttribute()`
`protected Name` | `getTypeAttribute()`
`Graph.Batch` | `importXml(InputStream stream, Location location)` Read the content from the supplied URI and import into the repository at the supplied location.
`Graph.Batch` | `importXml(InputStream stream, Location location, boolean skip)` Read the content from the supplied URI and import into the repository at the supplied location.
`Graph.Batch` | `importXml(URI uri, Location location)` Read the content from the supplied URI and import into the repository at the supplied location.
`Graph.Batch` | `importXml(URI uri, Location location, boolean skip)` Read the content from the supplied URI and import into the repository at the supplied location.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GraphImporter

    public GraphImporter(Graph graph)

Method Detail

### getContext

    public ExecutionContext getContext()

  Get the context in which the importer will be executed.

  Returns:
    the execution context; never null

### getGraph

    public Graph getGraph()

  The graph that this importer uses.

  Returns:
    the graph; never null

### importXml

    public Graph.Batch importXml(URI uri,
                                 Location location)
                          throws IOException,
                                 SAXException,
                                 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
    `location` - the location in the `repository source` where the content is to be written; may not be null
  Returns:
    the batch of requests for creating the graph content that represents the imported content
  Throws:
    `IllegalArgumentException` - if the `uri` or destination path are null
    `IOException` - if there is a problem reading the content
    `SAXException` - if there is a problem with the SAX Parser
    `RepositorySourceException` - if there is a problem while writing the content to the `repository source`

### importXml

    public Graph.Batch importXml(URI uri,
                                 Location location,
                                 boolean skip)
                          throws IOException,
                                 SAXException,
                                 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
    `location` - the location in the `repository source` where the content is to be written; may not be null
    `skip` - true if the root element should be skipped, or false if a node should be created for the root XML element
  Returns:
    the batch of requests for creating the graph content that represents the imported content
  Throws:
    `IllegalArgumentException` - if the `uri` or destination path are null
    `IOException` - if there is a problem reading the content
    `SAXException` - if there is a problem with the SAX Parser
    `RepositorySourceException` - if there is a problem while writing the content to the `repository source`

### importXml

    public Graph.Batch importXml(InputStream stream,
                                 Location location)
                          throws IOException,
                                 SAXException,
                                 RepositorySourceException

  Read the content from the supplied URI and import into the repository at the supplied location. This method does not close the stream.

  Parameters:
    `stream` - the stream containing the content to be imported
    `location` - the location in the `repository source` where the content is to be written; may not be null
  Returns:
    the batch of requests for creating the graph content that represents the imported content
  Throws:
    `IllegalArgumentException` - if the `stream` or destination path are null
    `IOException` - if there is a problem reading the content
    `SAXException` - if there is a problem with the SAX Parser
    `RepositorySourceException` - if there is a problem while writing the content to the `repository source`

### importXml

    public Graph.Batch importXml(InputStream stream,
                                 Location location,
                                 boolean skip)
                          throws IOException,
                                 SAXException,
                                 RepositorySourceException

  Read the content from the supplied URI and import into the repository at the supplied location. This method does not close the stream.

  Parameters:
    `stream` - the stream containing the content to be imported
    `location` - the location in the `repository source` where the content is to be written; may not be null
    `skip` - true if the root element should be skipped, or false if a node should be created for the root XML element
  Returns:
    the batch of requests for creating the graph content that represents the imported content
  Throws:
    `IllegalArgumentException` - if the `stream` or destination path are null
    `IOException` - if there is a problem reading the content
    `SAXException` - if there is a problem with the SAX Parser
    `RepositorySourceException` - if there is a problem while writing the content to the `repository source`

### getHandlerForImportingXml

    public XmlHandler getHandlerForImportingXml(Location location,
                                                boolean skip)

  Return an `XmlHandler` that can be used to import content directly into the supplied location. The operations resulting from the `XmlHandler` operations are batched until the `XmlHandler.endDocument()` is called, at which point all enqueued operations are submitted to the graph.

  Parameters:
    `location` - the location in the `repository source` where the content is to be written; may not be null
    `skip` - true if the root element should be skipped, or false if a node should be created for the root XML element
  Returns:
    the `XmlHandler` that can be used to import content
  Throws:
    `IllegalArgumentException` - if the `stream` or destination path are null

### getNameAttribute

    protected Name getNameAttribute()

### getTypeAttribute

    protected Name getTypeAttribute()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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