Garbage collector for Sling 7

2017-05-02 Thread Andrei Zafiu
Hello all,
I am trying to implement a Garbage Collector as a Sling Bundle to cleanup the 
Jackrabbit repository. I am working with the Sling 7 war version, deployed in a 
jetty 8.1.15 instance. I have tried to develop the bundle using the information 
from this url: 
http://www.astracorp.com/blog/basic_apache_sling_development_patterns


The problem I have is that gc = 
repositoryManager.createDataStoreGarbageCollector(); always returns null. The 
issue seems to be related to this: 
https://issues.apache.org/jira/browse/SLING-2501 which was marked as solve with 
the JCR Jackrabbit Server 2.1.2 but the Sling 7 instance is shipped with 2.3.0 
version of JCR Jackrabbit which has the same problem with the 
createDataStoreGarbaCollector() method. I have tried to replace the 2.3.0 
bundle from Sling with the 2.1.2 and 2.2.0 versions but Sling seems to depend 
heavily on this bundle and the discovery and authorization services are no 
longer available which pretty much make the application unusable.
Can you please point me in the right direction for the development of this 
functionality? I am open to switching to Sling 8 if there is an easier 
implementation of this functionality.
Thank you for your time,Andrei Zafiu.



RE: sling mocks "Creating resource resolver failed"

2017-05-02 Thread Stefan Seifert
using a newer Sling API than that sling-mocks was compiled against is usually 
no problem, because the API is backwards-compatible.
the problems start if other dependencies esp. org.apache.sling.resourceresolver 
or org.apache.sling.jcr.resource are updated withouth the other.

this is a sort of dependency hell we cannot solve automatically, because it 
highly depends on the dependencies already declared in the project poms. some 
hints are included in this talk
https://adapt.to/2016/en/schedule/unit-testing-with-sling-aem-mocks.html

if you have a proposal for some information added to the sling mocks 
documentation to make it easier for people to solve these issues i would be 
glad to add them to the sling site.

stefan


>-Original Message-
>From: Santiago Garcia Pimentel [mailto:santiago.pimen...@netcentric.biz]
>Sent: Tuesday, May 2, 2017 3:44 PM
>To: users@sling.apache.org
>Subject: Re: sling mocks "Creating resource resolver failed"
>
>Hi again,
>
>Coming back a bit on this.
>
>It seems the the point is that the version of the sling api and the
>resourceResolver you use need to match, and this needs to be done
>explicitly in your pom.
>
>This is more clear in the sling-mock source code. It has a profiles that
>uses different versions of the api and the resourceResolver:
>
>for api 2.11 -> RR 1.4.8
>for api 2.16 -> RR 1.5.x
>
>I could not find this information in the documentation. I think it would be
>worth it to explicitly mention it in the documentation since it is not so
>common to depend directly on the resourceResolver api.
>
>WDYT?
>
>Greetings.
>
>
>Santiago García Pimentel| Sr Software Engineer
>Netcentric Ibérica SLU
>M: +34687915463
>santiago.pimen...@netcentric.biz 
>| www.netcentric.biz 
>> On Apr 30, 2017, at 11:03 AM, Santiago Garcia Pimentel
> wrote:
>>
>> thanks Stefan!
>>
>> latest SNAPSHOT seems to work fine.
>>
>> Greetings.
>>
>> Santiago García Pimentel| Sr Software Engineer
>> Netcentric Ibérica SLU
>> M: +34687915463
>> santiago.pimen...@netcentric.biz
>  | www.netcentric.biz
>
>>> On Apr 28, 2017, at 5:44 PM, Stefan Seifert > wrote:
>>>
>>>
 I tried updating the resourceresolver version to 1.5.22 but got a
>different
 error:
>>>
>>> just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix
>from SLING-6811
>>>
>>> stefan
>>>
>>



Re: sling mocks "Creating resource resolver failed"

2017-05-02 Thread Santiago Garcia Pimentel
Hi again,

Coming back a bit on this.

It seems the the point is that the version of the sling api and the 
resourceResolver you use need to match, and this needs to be done explicitly in 
your pom.

This is more clear in the sling-mock source code. It has a profiles that uses 
different versions of the api and the resourceResolver:

for api 2.11 -> RR 1.4.8
for api 2.16 -> RR 1.5.x

I could not find this information in the documentation. I think it would be 
worth it to explicitly mention it in the documentation since it is not so 
common to depend directly on the resourceResolver api.

WDYT?

Greetings.


Santiago García Pimentel| Sr Software Engineer
Netcentric Ibérica SLU
M: +34687915463
santiago.pimen...@netcentric.biz   | 
www.netcentric.biz 
> On Apr 30, 2017, at 11:03 AM, Santiago Garcia Pimentel 
>  wrote:
> 
> thanks Stefan!
> 
> latest SNAPSHOT seems to work fine.
> 
> Greetings.
> 
> Santiago García Pimentel| Sr Software Engineer
> Netcentric Ibérica SLU
> M: +34687915463
> santiago.pimen...@netcentric.biz   | 
> www.netcentric.biz 
>> On Apr 28, 2017, at 5:44 PM, Stefan Seifert > > wrote:
>> 
>> 
>>> I tried updating the resourceresolver version to 1.5.22 but got a different
>>> error:
>> 
>> just hit this as well - also try osgi-mock 2.2.5-SNAPSHOT with the fix from 
>> SLING-6811
>> 
>> stefan
>> 
>