You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by "David G." <da...@gmail.com> on 2011/12/23 18:05:37 UTC

ContentImporter.importContent(..) questions

I am using the ContentImporter API to import JSON files from the FS and turn them into node-trees in the JCR.  

For testing i've created a "root" nt:folder node at: /apps/test

When importing i call:

node => /apps/test
jsonFile => new File(/tmp/demo.json).getName()
stream = new FileInputStream(jsonFile)
options = new CustomImportOptions(false, false, true, true)
// ischecking => false, isignoredimportprovider => false, isoverwrite => true, ispropertyoverwrite => true


contentImporterService.importContent(node, jsonFile, stream, options, null);

Try to execute the import results in a RepositoryException: 

REP ERROR: Unable to perform operation. Node is protected.

I've tried deleting /apps/test and re-creating it to clear any left over versioning, etc. that might have been inadvertently added, but to no avail.

When I inspect /apps/test in CRX/CRXDE it states "Protected: false" so I'm not entirely sure why during the import it thinks it (or at least i think thats the node its talking about) is protected.

Using the content import via maven-sling-plugin declarations works fine.

-- 
David Gonzalez
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


Re: ContentImporter.importContent(..) questions

Posted by Eric Norman <er...@gmail.com>.
Hi David,

Are you able to share the stack trace of the error that was thrown?  Seeing
where the error was thrown should narrow down what is going wrong.

Regards,
Eric

On Fri, Dec 23, 2011 at 9:05 AM, David G. <da...@gmail.com> wrote:

> I am using the ContentImporter API to import JSON files from the FS and
> turn them into node-trees in the JCR.
>
> For testing i've created a "root" nt:folder node at: /apps/test
>
> When importing i call:
>
> node => /apps/test
> jsonFile => new File(/tmp/demo.json).getName()
> stream = new FileInputStream(jsonFile)
> options = new CustomImportOptions(false, false, true, true)
> // ischecking => false, isignoredimportprovider => false, isoverwrite =>
> true, ispropertyoverwrite => true
>
>
> contentImporterService.importContent(node, jsonFile, stream, options,
> null);
>
> Try to execute the import results in a RepositoryException:
>
> REP ERROR: Unable to perform operation. Node is protected.
>
> I've tried deleting /apps/test and re-creating it to clear any left over
> versioning, etc. that might have been inadvertently added, but to no avail.
>
> When I inspect /apps/test in CRX/CRXDE it states "Protected: false" so I'm
> not entirely sure why during the import it thinks it (or at least i think
> thats the node its talking about) is protected.
>
> Using the content import via maven-sling-plugin declarations works fine.
>
> --
> David Gonzalez
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>
>