0
votes

I am referencing the aem-phonegap-kitchen-sink and aem-phonegap-starter-kit. I get to the point where I can export my PhoneGap application, build and run it. However, I tried adding additional images to one of my page templates. Only the image resource named image gets exported. All other images are ignored. If you see my content tree bellow, image will get exported as page-one.img.png, but the other two are ignored.

content tree

I started to look into the ContentSync config of aem-phonegap-kitchen-sink and [aem-phonegap-starter-kit] and I find these handlers getting referenced

  • mobileapprootpage
  • mobileapppages
  • mobilepageassets
  • mobilecontentlisting

I look up the content sync documentation (I'm using 6.1) but that only makes mention of the simple handlers like copy and assets.

I looked all over the place and I can't find documentation on them. I figured that the mobilepageassets is what is exporting my image.

So how can I get my other images exported?

UPDATE

I tried to add wcm/foundation/components/image to a com.day.cq.wcm.contentsync.impl.handler.PagesUpdateHandler OSGi configuration. This had no effect. I also tried switching my image resource types to foundation/components/image. That had no effect either.

2

2 Answers

2
votes

Since I could not find any documentation I went and found the content update handler implementation for mobilepageassets and decompiled it.

A custom handler component is created with

@Component(factory="com.day.cq.contentsync.handler.ContentUpdateHandler/identifier")

So to find the mobilepageassets implementation, I went to the services console and did a filter lookup with

(component.factory=*mobilepageassets)

From there I was able to get the implementing class, and location of the JAR file that I downloaded and ran through the Luyten decomplier.

By looking at that source I came to understand 2 things:

  1. The only reason I even got a page-name.img.png was because I happend to name my image resource image which is the same name used by the WCM page thumbnail.
  2. This update handler reads its own OSGi config, which has a property for cq.pagesupdatehandler.imageresourcetypes.

Finally, I added the com.adobe.cq.mobile.platform.impl.contentsync.handler.MobilePageAssetsUpdateHandler OSGi config

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="sling:OsgiConfig"
    cq.pagesupdatehandler.imageresourcetypes="[wcm/foundation/components/image]"/>

which did get my images exported, however the paths were wrong. They got exported to a 'jcr_content' folder where the markup was looking for '__jcr_content'. I did note that in the PG starter kit & kitchen sink there was special handling for this. Instead of implementing my own image component I found mobileapps/components/image which was simple enough for my needs. In that case I didn't even need the OSGi config.

-1
votes

Even in AEM 6.2 you can add resourceTypes of the components in OSGi console for following services:

com.adobe.cq.mobile.platform.impl.contentsync.handler.MobilePageAssetsUpdateHandler.name -

com.adobe.cq.mobile.platform.impl.contentsync.handler.MobilePagesUpdateHandler.name -

com.adobe.cq.mobile.platform.impl.contentsync.handler.MobileRootPageUpdateHandler.name -

com.adobe.cq.mobile.platform.impl.contentsync.handler.OffersUpdateHandler.name