diff --git a/kura/distrib/config/kura.build.properties b/kura/distrib/config/kura.build.properties index 0d69568b55e..baf0a621337 100644 --- a/kura/distrib/config/kura.build.properties +++ b/kura/distrib/config/kura.build.properties @@ -116,7 +116,7 @@ org.eclipse.kura.rest.inventory.provider.version=1.0.0-SNAPSHOT org.eclipse.kura.rest.command.provider.version=1.0.0-SNAPSHOT org.eclipse.kura.rest.position.provider.version=1.0.0-SNAPSHOT org.eclipse.kura.rest.security.provider.version=1.0.0-SNAPSHOT -org.eclipse.kura.rest.services.provider.version=1.0.0-SNAPSHOT +org.eclipse.kura.rest.service.listing.provider.version=1.0.0-SNAPSHOT org.eclipse.kura.rest.system.provider.version=1.0.0-SNAPSHOT org.eclipse.kura.request.handler.jaxrs.version=1.3.0-SNAPSHOT org.eclipse.kura.rest.wire.provider.version=1.3.0-SNAPSHOT diff --git a/kura/distrib/pom.xml b/kura/distrib/pom.xml index 699fea864cc..32bc66932bf 100644 --- a/kura/distrib/pom.xml +++ b/kura/distrib/pom.xml @@ -620,8 +620,8 @@ org.eclipse.kura - org.eclipse.kura.rest.services.provider - ${org.eclipse.kura.rest.services.provider.version} + org.eclipse.kura.rest.service.listing.provider + ${org.eclipse.kura.rest.service.listing.provider.version} org.eclipse.kura @@ -822,7 +822,7 @@ - + @@ -2537,7 +2537,7 @@ - + diff --git a/kura/distrib/src/main/ant/build_equinox_distrib.xml b/kura/distrib/src/main/ant/build_equinox_distrib.xml index 1e54fd6a7a7..9fc40a71132 100644 --- a/kura/distrib/src/main/ant/build_equinox_distrib.xml +++ b/kura/distrib/src/main/ant/build_equinox_distrib.xml @@ -1320,7 +1320,7 @@ fi]]> + value=", reference:file:${kura.install.dir}/${kura.symlink}/${plugins.folder}/org.eclipse.kura.rest.service.listing.provider_${org.eclipse.kura.rest.service.listing.provider.version}.jar@4:start" /> file="${project.build.directory}/plugins/org.eclipse.kura.rest.security.provider_${org.eclipse.kura.rest.security.provider.version}.jar" prefix="${build.output.name}/${plugins.folder}" /> - - + + - + - + - org.eclipse.kura.rest.services.provider + org.eclipse.kura.rest.service.listing.provider eclipse-plugin 1.0.0-SNAPSHOT diff --git a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/RestServicesProvider.java b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java similarity index 82% rename from kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/RestServicesProvider.java rename to kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java index 62d2b091050..c032c1e5415 100644 --- a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/RestServicesProvider.java +++ b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/RestServiceListingProvider.java @@ -1,4 +1,4 @@ -package org.eclipse.kura.internal.rest.services.provider; +package org.eclipse.kura.internal.rest.service.listing.provider; import java.util.ArrayList; import java.util.Arrays; @@ -16,8 +16,8 @@ import org.eclipse.kura.KuraException; import org.eclipse.kura.cloudconnection.request.RequestHandler; import org.eclipse.kura.cloudconnection.request.RequestHandlerRegistry; -import org.eclipse.kura.internal.rest.services.provider.dto.InterfacesIdsDTO; -import org.eclipse.kura.internal.rest.services.provider.dto.ServicesDTO; +import org.eclipse.kura.internal.rest.service.listing.provider.dto.InterfacesIdsDTO; +import org.eclipse.kura.internal.rest.service.listing.provider.dto.ServiceListDTO; import org.eclipse.kura.request.handler.jaxrs.DefaultExceptionHandler; import org.eclipse.kura.request.handler.jaxrs.JaxRsRequestHandlerProxy; import org.osgi.framework.BundleContext; @@ -29,14 +29,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Path("services/v1") -public class RestServicesProvider { +@Path("serviceListing/v1") +public class RestServiceListingProvider { - private static final Logger logger = LoggerFactory.getLogger(RestServicesProvider.class); + private static final Logger logger = LoggerFactory.getLogger(RestServiceListingProvider.class); private static final String DEBUG_MESSSAGE = "Processing request for method '{}'"; - private static final String MQTT_APP_ID = "SER-V1"; - private static final String REST_ROLE_NAME = "services"; + private static final String MQTT_APP_ID = "SERLIST-V1"; + private static final String REST_ROLE_NAME = "serviceListing"; private static final String KURA_PERMISSION_REST_ROLE = "kura.permission.rest." + REST_ROLE_NAME; private static final String KURA_SERVICE_PID_FILTER = "kura.service.pid"; @@ -73,14 +73,14 @@ public void unbindRequestHandlerRegistry(RequestHandlerRegistry registry) { @RolesAllowed(REST_ROLE_NAME) @Path("/list") @Produces(MediaType.APPLICATION_JSON) - public ServicesDTO getServicesList() { + public ServiceListDTO getServicesList() { try { - logger.debug(DEBUG_MESSSAGE, "securityServices/v1/services"); + logger.debug(DEBUG_MESSSAGE, "serviceListing/v1/list"); - BundleContext context = FrameworkUtil.getBundle(RestServicesProvider.class).getBundleContext(); + BundleContext context = FrameworkUtil.getBundle(RestServiceListingProvider.class).getBundleContext(); List resultDTO = getAllServices(context); - return new ServicesDTO(resultDTO); + return new ServiceListDTO(resultDTO); } catch (Exception e) { throw DefaultExceptionHandler.toWebApplicationException(e); } @@ -88,13 +88,15 @@ public ServicesDTO getServicesList() { } @POST - @RolesAllowed("byAllInterfaces") + @RolesAllowed(REST_ROLE_NAME) @Path("/list/byAllInterfaces") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) - public ServicesDTO getServicesByInterface(final InterfacesIdsDTO interfaceIds) { + public ServiceListDTO getServicesByInterface(final InterfacesIdsDTO interfaceIds) { try { + logger.debug(DEBUG_MESSSAGE, "serviceListing/v1/list/byAllInterfaces"); + InterfacesIdsDTO returnInterfaceIds; if (interfaceIds == null) { returnInterfaceIds = new InterfacesIdsDTO(null); @@ -104,7 +106,7 @@ public ServicesDTO getServicesByInterface(final InterfacesIdsDTO interfaceIds) { returnInterfaceIds = interfaceIds; } - BundleContext context = FrameworkUtil.getBundle(RestServicesProvider.class).getBundleContext(); + BundleContext context = FrameworkUtil.getBundle(RestServiceListingProvider.class).getBundleContext(); return generateResponseDTO(context, returnInterfaceIds); @@ -164,10 +166,10 @@ private String generateFilterString(List interfacesIds) { return filterStringBuilder.toString(); } - private ServicesDTO generateResponseDTO(BundleContext context, InterfacesIdsDTO returnInterfaceIds) + private ServiceListDTO generateResponseDTO(BundleContext context, InterfacesIdsDTO returnInterfaceIds) throws KuraException, InvalidSyntaxException { try { - return new ServicesDTO(getStrictFilteredInterfaces(context, returnInterfaceIds.getInterfacesIds())); + return new ServiceListDTO(getStrictFilteredInterfaces(context, returnInterfaceIds.getInterfacesIds())); } catch (NullPointerException ex) { throw new KuraException(KuraErrorCode.BAD_REQUEST, "No result found for the passed interfaces"); } diff --git a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/InterfacesIdsDTO.java b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/InterfacesIdsDTO.java similarity index 94% rename from kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/InterfacesIdsDTO.java rename to kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/InterfacesIdsDTO.java index 8dc9c47103f..26ac23f8b30 100644 --- a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/InterfacesIdsDTO.java +++ b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/InterfacesIdsDTO.java @@ -1,4 +1,4 @@ -package org.eclipse.kura.internal.rest.services.provider.dto; +package org.eclipse.kura.internal.rest.service.listing.provider.dto; import java.util.List; import java.util.Objects; diff --git a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/ServicesDTO.java b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/ServiceListDTO.java similarity index 82% rename from kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/ServicesDTO.java rename to kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/ServiceListDTO.java index 69b005fd01c..c31fd765ec7 100644 --- a/kura/org.eclipse.kura.rest.services.provider/src/main/java/org/eclipse/kura/internal/rest/services/provider/dto/ServicesDTO.java +++ b/kura/org.eclipse.kura.rest.service.listing.provider/src/main/java/org/eclipse/kura/internal/rest/service/listing/provider/dto/ServiceListDTO.java @@ -11,15 +11,15 @@ * Eurotech *******************************************************************************/ -package org.eclipse.kura.internal.rest.services.provider.dto; +package org.eclipse.kura.internal.rest.service.listing.provider.dto; import java.util.List; -public class ServicesDTO { +public class ServiceListDTO { List keystoreServices; - public ServicesDTO(List entries) { + public ServiceListDTO(List entries) { this.keystoreServices = entries; } diff --git a/kura/pom.xml b/kura/pom.xml index ca8c02a1d60..753128aaf96 100644 --- a/kura/pom.xml +++ b/kura/pom.xml @@ -112,7 +112,7 @@ org.eclipse.kura.rest.command.provider org.eclipse.kura.rest.position.provider org.eclipse.kura.rest.security.provider - org.eclipse.kura.rest.services.provider + org.eclipse.kura.rest.service.listing.provider org.eclipse.kura.rest.system.provider org.eclipse.kura.request.handler.jaxrs org.eclipse.kura.rest.wire.provider