org.jboss.dna.cnd
Class CndImporter

java.lang.Object
  extended by org.jboss.dna.cnd.CndImporter

@NotThreadSafe
public class CndImporter
extends Object

A class that imports the node types contained in a JCR Compact Node Definition (CND) file into graph content. The content is written using the graph structured defined by JCR and the "nt:nodeType", "nt:propertyDefinition", and "nt:childNodeDefinition" node types.

Although instances of this class never change their behavior and all processing is done in local contexts, Destination is not thread-safe and therefore this component may not be considered thread-safe.


Constructor Summary
CndImporter(Destination destination, Path parentPath)
          Create a new importer that will place the content in the supplied destination under the supplied path.
 
Method Summary
 void importFrom(File file, Problems problems)
          Import the CND content from the supplied stream, placing the content into the importer's destination.
 void importFrom(InputStream stream, Problems problems, String resourceName)
          Import the CND content from the supplied stream, placing the content into the importer's destination.
 void importFrom(String content, Problems problems, String resourceName)
          Import the CND content from the supplied stream, placing the content into the importer's destination.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CndImporter

public CndImporter(Destination destination,
                   Path parentPath)
Create a new importer that will place the content in the supplied destination under the supplied path.

Parameters:
destination - the destination where content is to be written
parentPath - the path in the destination below which the generated content is to appear
Throws:
IllegalArgumentException - if either parameter is null
Method Detail

importFrom

public void importFrom(InputStream stream,
                       Problems problems,
                       String resourceName)
                throws IOException
Import the CND content from the supplied stream, placing the content into the importer's destination.

Parameters:
stream - the stream containing the CND content
problems - where any problems encountered during import should be reported
resourceName - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name
Throws:
IOException - if there is a problem reading from the supplied stream

importFrom

public void importFrom(String content,
                       Problems problems,
                       String resourceName)
                throws IOException
Import the CND content from the supplied stream, placing the content into the importer's destination.

Parameters:
content - the string containing the CND content
problems - where any problems encountered during import should be reported
resourceName - a logical name for the resource name to be used when reporting problems; may be null if there is no useful name
Throws:
IOException - if there is a problem reading from the supplied stream

importFrom

public void importFrom(File file,
                       Problems problems)
                throws IOException
Import the CND content from the supplied stream, placing the content into the importer's destination.

Parameters:
file - the file containing the CND content
problems - where any problems encountered during import should be reported
Throws:
IOException - if there is a problem reading from the supplied stream


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