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, ...)


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.
 Properties toProperties(javax.jcr.Node node, AbstractPredicate<javax.jcr.Node> nodePredicate)
           
 
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)

toProperties

public Properties toProperties(javax.jcr.Node node,
                               AbstractPredicate<javax.jcr.Node> nodePredicate)
                        throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException


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