> -----Original Message-----
> From: Alexander Klimetschek [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 18, 2008 12:39 PM
> To: [email protected]
> Subject: Re: Can't resource.adaptTo my AbstractMappedObject
>
> On Wed, Jun 18, 2008 at 5:07 PM, Craig L. Ching
> <[EMAIL PROTECTED]> wrote:
> > Is that something new then? I didn't have to do this before ...
>
> I think it is quite new. But AFAIK it is an additional
> feature compared to the standard way of implementing
> Adaptable in your Resource class. It allows to build
> "adaptation" outside the affected classes.
>
Ok, so do I just need to implement Adaptable? The sample doesn't do
that, but, since you say this is new, I presume the sample just hasn't
been updated. I can submit a patch when I figure this out completely.
> > I thought that the OCM or SCR or something took care of
> doing that for
> > me, at least I assumed that ;-)
>
> OCM is not involved here. SCR is a generic component /
> dependency-injection framework in Apache Felix. You always
> have to configure it, preferrably with the @scr.* javadoc
> tags that are converted into the actual component xml
> description files by the maven-scr-plugin. That's how its
> done throughout Sling. What properties are available and who
> will be picking up the component or service depends on the
> service. For the AdaptableFactory it's the
> AdaptableManagerImpl, that you debugged, which referencs all
> AdapterFactories that are registered as scr components/services.
>
Ok, this was all that was necessary before (apparently, it did at least
work):
package org.apache.sling.sample;
import org.apache.sling.jcr.ocm.AbstractMappedObject;
/**
* The <code>SamplePage</code> is a page level sample content object
*
* @ocm.mapped jcrType="sling:SamplePage"
*/
public class SamplePage extends AbstractMappedObject {
/** @ocm.field */
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
So to get this to work, should I just need to implement Adaptable?
Thanks for the help!
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> [EMAIL PROTECTED]
>
Cheers,
Craig