org.apache.sling.servlets.post.impl.operations
Class ImportOperation

java.lang.Object
  extended by org.apache.sling.servlets.post.AbstractSlingPostOperation
      extended by org.apache.sling.servlets.post.impl.operations.ImportOperation
All Implemented Interfaces:
SlingPostOperation

public class ImportOperation
extends AbstractSlingPostOperation

The ImportOperation class implements the SlingPostConstants.OPERATION_IMPORT import operation for the Sling default POST servlet.


Field Summary
 
Fields inherited from class org.apache.sling.servlets.post.AbstractSlingPostOperation
log
 
Fields inherited from interface org.apache.sling.servlets.post.SlingPostOperation
PROP_OPERATION_NAME, SERVICE_NAME
 
Constructor Summary
ImportOperation(NodeNameGenerator defaultNodeNameGenerator, ContentImporter contentImporter)
           
 
Method Summary
protected  Map<String,RequestProperty> collectContent(SlingHttpServletRequest request, HtmlResponse response)
          Collects the properties that form the content to be written back to the repository.
protected  javax.jcr.Node deepGetOrCreateNode(javax.jcr.Session session, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)
          Deep gets or creates a node, parent-padding with default nodes nodes.
protected  void doRun(SlingHttpServletRequest request, HtmlResponse response, List<Modification> changes)
           
protected  String generateName(SlingHttpServletRequest request, String basePath)
           
protected  void processCreate(javax.jcr.Session session, Map<String,RequestProperty> reqProperties, HtmlResponse response, List<Modification> changes, VersioningConfiguration versioningConfiguration)
          Create node(s) according to current request
 void setContentImporter(ContentImporter importer)
           
 void setExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)
           
protected  void updateMixins(javax.jcr.Session session, String path, Map<String,RequestProperty> reqProperties, List<Modification> changes, VersioningConfiguration versioningConfiguration)
           
 
Methods inherited from class org.apache.sling.servlets.post.AbstractSlingPostOperation
checkoutIfNecessary, externalizePath, findVersionableAncestor, getApplyToResources, getItemPath, getVersioningConfiguration, hasItemPathPrefix, isSkipCheckin, isVersionable, orderNode, removeAndValidateWorkspace, requireItemPathPrefix, resolvePath, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportOperation

public ImportOperation(NodeNameGenerator defaultNodeNameGenerator,
                       ContentImporter contentImporter)
Method Detail

setContentImporter

public void setContentImporter(ContentImporter importer)

doRun

protected void doRun(SlingHttpServletRequest request,
                     HtmlResponse response,
                     List<Modification> changes)
              throws javax.jcr.RepositoryException
Specified by:
doRun in class AbstractSlingPostOperation
Throws:
javax.jcr.RepositoryException

setExtraNodeNameGenerators

public void setExtraNodeNameGenerators(NodeNameGenerator[] extraNodeNameGenerators)

processCreate

protected void processCreate(javax.jcr.Session session,
                             Map<String,RequestProperty> reqProperties,
                             HtmlResponse response,
                             List<Modification> changes,
                             VersioningConfiguration versioningConfiguration)
                      throws javax.jcr.RepositoryException
Create node(s) according to current request

Throws:
javax.jcr.RepositoryException - if a repository error occurs

updateMixins

protected void updateMixins(javax.jcr.Session session,
                            String path,
                            Map<String,RequestProperty> reqProperties,
                            List<Modification> changes,
                            VersioningConfiguration versioningConfiguration)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            javax.jcr.nodetype.NoSuchNodeTypeException,
                            javax.jcr.version.VersionException,
                            javax.jcr.nodetype.ConstraintViolationException,
                            javax.jcr.lock.LockException
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException

collectContent

protected Map<String,RequestProperty> collectContent(SlingHttpServletRequest request,
                                                     HtmlResponse response)
Collects the properties that form the content to be written back to the repository.

Throws:
javax.jcr.RepositoryException - if a repository error occurs
javax.servlet.ServletException - if an internal error occurs

deepGetOrCreateNode

protected javax.jcr.Node deepGetOrCreateNode(javax.jcr.Session session,
                                             String path,
                                             Map<String,RequestProperty> reqProperties,
                                             List<Modification> changes,
                                             VersioningConfiguration versioningConfiguration)
                                      throws javax.jcr.RepositoryException
Deep gets or creates a node, parent-padding with default nodes nodes. If the path is empty, the given parent node is returned.

Parameters:
path - path to node that needs to be deep-created
checkedOutNodes -
Returns:
node at path
Throws:
javax.jcr.RepositoryException - if an error occurs
IllegalArgumentException - if the path is relative and parent is null

generateName

protected String generateName(SlingHttpServletRequest request,
                              String basePath)
                       throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException


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