Update ExampleLiveActionFactory to use OSGi Declarative Services Annotations | Community
Skip to main content
Level 2
May 14, 2020
Solved

Update ExampleLiveActionFactory to use OSGi Declarative Services Annotations

  • May 14, 2020
  • 2 replies
  • 3905 views

How do I update the LiveActionFactory example to use OSGi Declarative Services Annotations?

 

@8220494(metatype = false) @Service public class ExampleLiveActionFactory implements LiveActionFactory<LiveAction> { @2542150(value="exampleLiveAction") static final String actionname = LiveActionFactory.LIVE_ACTION_NAME; ... }

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ankur_Khare

refer this link and update your code-

https://www.argildx.com/technology/migration-of-scr-annotations-to-ds-annotations/

2 replies

Ankur_Khare
Community Advisor
Ankur_KhareCommunity AdvisorAccepted solution
Community Advisor
May 14, 2020
ArpitVarshney
Community Advisor
Community Advisor
May 14, 2020

Hi @danc13675873 , Try the below code snippet:

 

package aem.service;

import com.day.cq.wcm.api.WCMException;
import com.day.cq.wcm.msm.api.LiveAction;
import com.day.cq.wcm.msm.api.LiveActionFactory;
import org.apache.sling.api.resource.Resource;
import org.osgi.service.component.annotations.Component;

@Component(immediate = false, service = LiveActionFactory.class)
public class ExampleLiveActionFactory implements LiveActionFactory<LiveAction>{

@Override
public String createsAction() {
//add your code
return null;
}

@Override
public LiveAction createAction(Resource resource) throws WCMException {
//add your code
return null;
}
}