Issue regarding model detection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue regarding model detection

BeK27
Hey,

I've followed your tutorial for Slice 4.2 all the way.
The explanations are well written but it lacks concrete examples.
I'm new to CQ6 and I was wondering, regarding the simple TextModel class (in the "model" package), you basically have a String "text" with @JcrRepository reference. No @Injection in the constructor. The constructor is the default.

If my bundle is com.adobe.test.core.test-core, in the Activator class the values should be:
1) INJECTOR_NAME = "faq"; (representing the /content/faq, a page with jcr:content available based on a simple template)
2) as BASE_PACKAGE = "com.adobe.test";
3) BUNDLE_NAME_FILTER = "test-core.*";

In the pom.xml of the test-core:
<Bundle-Activator> com.adobe.test.core.Activator </Bundle-Activator>
<Bundle-SymbolicName> test-core </Bundle-SymbolicName>
<Export-Package> com.adobe.test.* </Export-Package>

If I create a new component with reference (sling:resourceType) to something in "apps/", a simple .jsp (the one that was referenced earlier in the INJECTION_NAME) page structure that uses slice, and that has "text" value, the mapping should be done to the model itself using this value configured directly in the CRXDE, without any extra information.

I ran full from maven and the package is being installed correctly on the instance.

Error: com.adobe.test.core.model.TextModel cannot be resolved to a type.

Can you give me a hint, or probably something that I am missing. Thanks so much!
Reply | Threaded
Open this post in threaded view
|

Re: Issue regarding model detection

BeK27
Something I forgot to mention: it is not very specified:
Which modules should be included in the Injector Runner ? It is not clear at all. The explanations state about a Model to be referenced and populated. Nothing regarding custom module.
Reply | Threaded
Open this post in threaded view
|

Re: Issue regarding model detection

tommix
This post was updated on .
In reply to this post by BeK27
Hi,
One thing, just making sure: Which version of Service Pack have you got on your machine? If you want to use Slice 4.2 please make sure you use AEM 6.0 SP2 (There is a bug in SP1 which causes Peaberry - part of Slice - not to resolve properly.

Coming back to your issues, couple things I would check:
1. Did you annotate your model class with @SliceResource?
2. In regards to bundle name filter: test-core.* Is that correct? Can you give the actual name of your bundle which holds the model class?

Rest of the stuff that you mentioned looks good.

You made a valid remark about lack of fully working example of Slice-based AEM project in the Wiki.
In terms of model in the easiest case it's a matter of @SliceResource on class level, and then @JcrProperty on the fields. Nothing has to be injected in constructor, etc. for this to work. If everything is set up properly, and you have a value stored in proper place in repository Slice should pick it up and put into your "text" field.
In regards to custom modules you don't need to write any to have basic functionality running. You would start creating your own modules as soon as you started providing custom configuration of your application (custom bindings, providers, etc)

Hope any of the above helps. Ultimately if you still run into problems you can share the whole sample codebase, I could take a look into it.
Reply | Threaded
Open this post in threaded view
|

Re: Issue regarding model detection

LeiZeng
I just have the same issue, can anyone put a working example of Slice?