Highlighted

Is it possible to disable OOTB service component? AEM 6.5

skmAem

10-08-2020

We want to allow our users (non admins) to download expired assets. There is an OOTB assetdownloadserviceImpl (java) that prevents them from doing so since it checks if an asset is expired or not. I have changed this behavior and implemented custom assetdownloadservice. Now the problem is there are two service implementations for the same service and the OOTB service implementation is getting priority over the custom one. I tried to set the service.ranking property to Integer=10000 for the custom implementation to see if that would help, but no luck. If I manually disable the OOTB service component through OSGI system console, my custom implementation gets called.

 

So my question is, is it possible to give priority to custom implementation in any other way than the service.ranking, if not, is it possible to disable the OOTB implementation using configuration or programmatically?

 

Thanks for any help and pointers in advance!!

-SKM

Replies

Highlighted

SundeepKatepally

10-08-2020

You should not  disabled OOTB component. Lets say , if you disabled you will get below issues.

1) OOTB bundles which has dependency on the OOTB bundle that has this class will not resolve.

 

Highlighted

skmAem

11-08-2020

Hi @SundeepKatepally , I also want to avoid disabling the OOTB service implementation but I am perplexed as to why my implementation is not getting executed. Here is my implementation declaration:

 

 

@Component(
        service= AssetDownloadService.class,
        immediate=true,
        property={
                Constants.SERVICE_DESCRIPTION + "=Asset Download Service",
                Constants.SERVICE_RANKING + ":Integer=10000"
        }
)
public class AssetDownloadServiceNewImpl implements AssetDownloadService {}

 

Screen Shot 2020-08-11 at 8.43.51 AM.png

 

Other option I could think of is to overlay downloadassetservlet to call custom service and register the servlet on a custom selector instead of assetdownload selector that way overlay of UI would use the new selector. But I feel this is all unnecessary and the higher service ranking should have done the trick.

Any other pointers from anyone?

Thanks,

SKM