org.apache.sling.jcr.contentloader.internal
Interface ContentCreator

All Known Implementing Classes:
DefaultContentCreator

public interface ContentCreator

The ContentCreator is used by the ContentReader to create the actual content.

Since:
2.0.4

Method Summary
 void createAce(String principal, String[] grantedPrivileges, String[] deniedPrivileges, String order)
          Creates an Access Control Entry for the current node for the specified principal and privileges.
 void createFileAndResourceNode(String name, InputStream data, String mimeType, long lastModified)
          Create a file and a resource node.
 void createGroup(String name, String[] members, Map<String,Object> extraProperties)
          Create a Group in the jackrabbit UserManager
 void createNode(String name, String primaryNodeType, String[] mixinNodeTypes)
          Create a new node.
 void createProperty(String name, int propertyType, String value)
          Create a new property to the current node.
 void createProperty(String name, int propertyType, String[] values)
          Create a new multi value property to the current node.
 void createProperty(String name, Object value)
          Add a new property to the current node.
 void createProperty(String name, Object[] values)
          Add a new multi value property to the current node.
 void createUser(String name, String password, Map<String,Object> extraProperties)
          Create a User in the jackrabbit UserManager
 void finishNode()
          Indicates that a node is finished.
 boolean switchCurrentNode(String subPath, String newNodeType)
          Switch the current node to the path (which must be relative to the current node).
 

Method Detail

createNode

void createNode(String name,
                String primaryNodeType,
                String[] mixinNodeTypes)
                throws javax.jcr.RepositoryException
Create a new node. To add properties to this node, one of the createProperty() methods should be called. To add child nodes, this method should be called to create a new child node. If all properties and child nodes have been added finishNode() must be called.

Parameters:
name - The name of the node.
primaryNodeType - The primary node type or null.
mixinNodeTypes - The mixin node types or null.
Throws:
javax.jcr.RepositoryException - If anything goes wrong.

finishNode

void finishNode()
                throws javax.jcr.RepositoryException
Indicates that a node is finished. The parent node of the current node becomes the current node.

Throws:
javax.jcr.RepositoryException

createProperty

void createProperty(String name,
                    int propertyType,
                    String value)
                    throws javax.jcr.RepositoryException
Create a new property to the current node.

Parameters:
name - The property name.
propertyType - The type of the property.
value - The string value.
Throws:
javax.jcr.RepositoryException

createProperty

void createProperty(String name,
                    int propertyType,
                    String[] values)
                    throws javax.jcr.RepositoryException
Create a new multi value property to the current node.

Parameters:
name - The property name.
propertyType - The type of the property.
values - The string values.
Throws:
javax.jcr.RepositoryException

createProperty

void createProperty(String name,
                    Object value)
                    throws javax.jcr.RepositoryException
Add a new property to the current node.

Parameters:
name - The property name.
value - The value.
Throws:
javax.jcr.RepositoryException

createProperty

void createProperty(String name,
                    Object[] values)
                    throws javax.jcr.RepositoryException
Add a new multi value property to the current node.

Parameters:
name - The property name.
propertyType - The type of the property.
values - The values.
Throws:
javax.jcr.RepositoryException

createFileAndResourceNode

void createFileAndResourceNode(String name,
                               InputStream data,
                               String mimeType,
                               long lastModified)
                               throws javax.jcr.RepositoryException
Create a file and a resource node. After the nodes have been created, the current node is the resource node. So this method call should be followed by two calls to finishNode() to be on the same level as before the file creation.

Parameters:
name - The name of the file node
data - The data of the file
mimeType - The mime type or null
lastModified - The last modified or -1
Throws:
javax.jcr.RepositoryException

switchCurrentNode

boolean switchCurrentNode(String subPath,
                          String newNodeType)
                          throws javax.jcr.RepositoryException
Switch the current node to the path (which must be relative to the current node). If the path does not exist and a node type is supplied, the nodes are created with the given node type. If the path does not exist and node type is null, false is returned. When the changes to the node are finished, finishNode() must be callsed.

Parameters:
subPath - The relative path
newNodeType - Node typ for newly created nodes.
Throws:
javax.jcr.RepositoryException

createUser

void createUser(String name,
                String password,
                Map<String,Object> extraProperties)
                throws javax.jcr.RepositoryException
Create a User in the jackrabbit UserManager

Parameters:
name - the name of the user
password - the password of the user
extraProperties - extra properties to assign to the created user
Throws:
javax.jcr.RepositoryException

createGroup

void createGroup(String name,
                 String[] members,
                 Map<String,Object> extraProperties)
                 throws javax.jcr.RepositoryException
Create a Group in the jackrabbit UserManager

Parameters:
name - the name of the group
members - the members of the group (principal names)
extraProperties - extra properties to assign to the created group
Throws:
javax.jcr.RepositoryException

createAce

void createAce(String principal,
               String[] grantedPrivileges,
               String[] deniedPrivileges,
               String order)
               throws javax.jcr.RepositoryException
Creates an Access Control Entry for the current node for the specified principal and privileges.

Parameters:
principal - the user or group id for the ACE
grantedPrivileges - the set of privileges to grant the principal
deniedPrivileges - the set of privileges to deny the principal (for users only)
order - specifies the position of the ACE in the containing ACL. (may be null) Value should be one of these:
firstPlace the target ACE as the first amongst its siblings
lastPlace the target ACE as the last amongst its siblings
before xyzPlace the target ACE immediately before the sibling whose name is xyz
after xyzPlace the target ACE immediately after the sibling whose name is xyz
numericPlace the target ACE at the specified index
Throws:
javax.jcr.RepositoryException


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.