Expand my Community achievements bar.

upload digital assets from directory. Directory can have sub directories, files and so on using assetmanger api using sheduler

Avatar

Level 2

            ResourceResolver resourceResolver = resResolverFactory.getAdministrativeResourceResolver(null);                           inStream = new FileInputStream(assetPath);             Session session=resourceResolver.adaptTo(Session.class);             BufferedInputStream stream = new BufferedInputStream(inStream);             AssetManager manager = resourceResolver.adaptTo(AssetManager.class);             log.info("finished");             manager.createAsset(destPath, inStream, "image/jpeg", true);             session.save();             session.logout();

 

in above code getting null pointer at AssetManager  

how to initialize assetmanget inside service and sheduler

2 Replies

Avatar

Level 10

TO learn how to work with AssetManager API to upload assets -- see this AEM community article: 

https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

Hope this helps

Avatar

Administrator

As mentioned by Scott, please refer to the community article.

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

This article helps us to create an AEM application that lets users select image files and upload them to a Java Sling Servlet. Once uploaded, the Servlet uses the AssetManager API to store the image file in the Adobe CQ DAM

Demo package :- https://helpx.adobe.com/content/help/en/experience-manager/using/uploading-files-aem1/_jcr_content/m...

I hope this would work for you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni