[
https://issues.apache.org/jira/browse/CXF-8958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Colm O hEigeartaigh resolved CXF-8958.
--------------------------------------
Resolution: Won't Fix
> A migration Guide for CXF-DOSGI Users
> -------------------------------------
>
> Key: CXF-8958
> URL: https://issues.apache.org/jira/browse/CXF-8958
> Project: CXF
> Issue Type: Wish
> Reporter: Mehmet Can Cömert
> Priority: Major
>
> As I noticed, CXF-DOSGI project is retired in the middle of 2022.
> We have a big REST API implementation relying on this framework.
> Now we want to update other components such as Jetty and they need newer
> version of Javax.Servlet-API (4.0.0 or above) however DOSGI components seems
> to request older Javax.Servlet-API (from 2.0.0 until 4.0.0)
> We do not need to provide REST API resources as OSGI services, but they still
> need to consume OSGI Services from the Business Logic layer.
> A resource definition is done in an interface and implementation done in
> another class with the help of DOSGI Intents and calling OSGI Services.
> Here is the API for Resource definition in an API Bundle:
> {code:java}
> @Path("")
> public interface IJobStatusResource {
> @GET
> @Produces({MediaType.APPLICATION_JSON})
> Response getJobStatusEntries(@Context UriInfo uriInfo,
> @QueryParam(IFieldKeys.IDENTIFIER) String
> identifier)
> throws RestApiException;
> }
> {code}
> Here is the implementation exposing the Resource over OSGI and supplying the
> DOSGI Intents provider for HTML/JSON serialization.
> {code:java}
> import org.apache.cxf.dosgi.common.api.IntentsProvider;
> @Component(name = "JobStatusConfigurationResource", immediate = true, //
> service = {
> IJobStatusResource.class, IntentsProvider.class
> }, property = {
> "service.exported.configs=org.apache.cxf.rs", //
> "service.exported.interfaces=*", //
> "org.apache.cxf.rs.address=" +
> IRestResourcePaths.JOB_STATUS_ENTRIES_PATH, //
> "org.apache.cxf.rs.provider.expected=true", //
> })
> public class JobStatusResource implements IJobStatusResource, IntentsProvider
> {
>
> @Reference(name = "jobstatus.service.ref", //
> policy = ReferencePolicy.DYNAMIC, cardinality =
> ReferenceCardinality.MANDATORY, //
> bind = "registerConnector", unbind = "unregisterConnector")
> public void registerConnector(IJobStatusService jobStatusService) {
> service = jobStatusService;
> }
> public void unregisterConnector(IJobStatusService jobStatusService) {
> service = null;
> }
> @Reference(name = "jobstatus.intent.service.ref", //
> policy = ReferencePolicy.DYNAMIC, cardinality =
> ReferenceCardinality.MANDATORY, //
> bind = "registerIntentFactory", unbind = "unregisterIntentFactory")
> public void registerIntentFactory(IIntentFactory intentFactory) {
> intentFactoryService = intentFactory;
> }
> public void unregisterIntentFactory(IIntentFactory intentFactory) {
> intentFactoryService = null;
> }
> @Override
> public Response getJobStatusEntries(UriInfo uriInfo, String id) throws
> RestApiException {
> // use Service from OSGI to call business logic.
> }
> @Override
> public List< ? > getIntents() {
> return intentFactoryService.createDefaultIntents();
> }
> }{code}
>
> Any help or documentation would be very nice to switch resources without
> DOSGI dependencies.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)