info.magnolia.jcr.util
Class PropertiesImportExport

java.lang.Object
  extended by info.magnolia.jcr.util.PropertiesImportExport

public class PropertiesImportExport
extends Object

Utility class providing support for properties-like format to import/export jcr data. Useful when data regularly needs to be bootstrapped, for instance, and the jcr xml format is too cumbersome to maintain. Caution: Binary data is represented as ByteArrayInputStream because of the lack of a proper javax.jcr.Binary implementation TODO : handle conflicts (already existing nodes, properties, what to do with existing properties if we don't create new nodes, ...) TODO dlipp - export is not yet implemented


Constructor Summary
PropertiesImportExport()
           
 
Method Summary
protected  Object convertPropertyStringToObject(String valueStr)
           
 void createNodes(javax.jcr.Node root, InputStream propertiesStream)
          Each property or node in the stream has to be separated by the \n.
 void createNodes(javax.jcr.Node root, String... properties)
          Each property is one item in the properties varargs passed in.
protected  void populateNode(javax.jcr.Node node, String name, String valueStr)
           
protected  void setIdentifier(javax.jcr.Node ignoredNode, String ignoredString)
          Intentionally created this method to allow simple creation of subclasses actually setting the identifier (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesImportExport

public PropertiesImportExport()
Method Detail

createNodes

public void createNodes(javax.jcr.Node root,
                        String... properties)
                 throws IOException,
                        javax.jcr.RepositoryException
Each property is one item in the properties varargs passed in.

Throws:
IOException
javax.jcr.RepositoryException

createNodes

public void createNodes(javax.jcr.Node root,
                        InputStream propertiesStream)
                 throws IOException,
                        javax.jcr.RepositoryException
Each property or node in the stream has to be separated by the \n.

Throws:
IOException
javax.jcr.RepositoryException

populateNode

protected void populateNode(javax.jcr.Node node,
                            String name,
                            String valueStr)
                     throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

setIdentifier

protected void setIdentifier(javax.jcr.Node ignoredNode,
                             String ignoredString)
Intentionally created this method to allow simple creation of subclasses actually setting the identifier (e.g. in tests).


convertPropertyStringToObject

protected Object convertPropertyStringToObject(String valueStr)


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.