Hi, yes, this is the intended behavior :) A ModifyingResourceProvider keeps user state (state per ResourceProvider) like e.g. the jcr provider keeps the state within the session, therefore a ModifyingResourceProvider needs to be instanted per factory and each ResourceResolver gets its own instance. Non factory providers are shared across all resolvers.
Regards Carsten 2014-07-05 16:34 GMT+02:00 Paul Michelotti <[email protected]>: > Hello, > > In working on a POC project, I was endeavoring to implement a custom > ModifyingResourceProvider. The documentation seems to indicate that what > is necessary for a custom resource provider to participate in CRUD requests > initiated from a ResourceResolver is to register the custom provider as a > service which implements ModifyingResourceProvider and implement the > appropriate methods. Digging around in the Sling source this does not seem > to be entirely true. While this is true for most operations, the > hasChanges method of custom providers is not called when hasChanges is > called on the ResourceResolver. > > This appears to be a consequence of the > org.apache.sling.resourceresolver.impl.helper.ResourceResolverContext > implementation. The modifyingProviders list is only updated for providers > which come from a ResourceProviderFactory. As such, in order to make a > ModifyingResourceProvider which properly participates in the hasChanges > method the provider must be instantiated by a custom > ResourceProviderFactory (I went about doing this in my POC to ensure this > was in-fact the case). > > That said, I'm happy to endeavor to patch this if it is a defect, however > before starting down that path I wanted to determine whether this was the > intended behavior for some reason. > > Best > -Paul > > -- > Paul Michelotti > CITYTECH, Inc. > 312.673.6433 x 171 > [email protected] > www.citytechinc.com > -- Carsten Ziegeler Adobe Research Switzerland [email protected]
