I needed to push data from a legacy system into the CQ content
I have about 10,000 products/data in a legacy system, and don’t want
to manually create each product page in CQ5.
I wanted to write a utility/program/service that will read data from
my legacy system(database or xls) and create the product nodes
automatically in CQ.
Each product node created in the JCR repository should have a specific
structure. Example each product node(cq:Page) should contain two
cq:text nodes for the tile and description respectively.
What would be the best way to do this!
This is a workflow that can be solved by creating OSGi bundles. You can create an OSGi bundle that reads data from your backend database. For information, this development artilce talks about how to retrieve data from the backend. See .http://scottsdigitalcommunity.blogspot.ca/2012/04/creating-adobe-cq-we b-application-that.html.
You can use JCR API to modify nodes and properties located within the Adobe CQ. See http://scottsdigitalcommunity.blogspot.ca/2012/03/programmatically-acc essing-day-cq.html.
You can create a single OSGi bunlde that contains operations that retrieve data from the database and other operations that use the JCR API to update nodes with the data retrieved from the database.
Hope this helps!
I needed some help with the part of accessing JCR repository.
This above article seems to be for accessing the JCR repository from an external application.
I needed to access the JCR repository from within an OSGI-Bundle.
Please suggest what would be the way to get the repository instance.
Also my bundle is spring-based and I am using spring-dm.
For anyone who is interested this is the way to access the repository in a spring bundle:
1) Update the manifest:
2) Update the spring xml to get the sling repository:
<osgi:reference id="SlingRepository.class" interface="org.apache.sling.jcr.api.SlingRepository"/>
3) Sample Code in the class:
session = slingRepository.loginAdministrative(null);
Node root = session.getRootNode();
Node test = root.addNode("test");
Thanks to smacdonald2008, Sarwar and Scott's blog.
Europe, Middle East and Africa