From b5ea7ed9c92400ee2f3731702f42bdaf2db594ab Mon Sep 17 00:00:00 2001 From: dseurotech Date: Wed, 5 Feb 2025 15:04:18 +0100 Subject: [PATCH] :boom: removed DevicePackageFactory, in favour of councrete DTOs Signed-off-by: dseurotech --- .../GwtDeviceManagementServiceImpl.java | 237 +++++++++--------- .../kapua/qa/common/SimulatedDeviceSteps.java | 3 +- .../resources/DeviceManagementPackages.java | 80 +++--- .../eclipse/kapua/model/domain/Actions.java | 18 +- .../packages/DevicePackageFactory.java | 152 ----------- .../packages/model/DevicePackage.java | 60 +++-- .../model/DevicePackageBundleInfo.java | 30 ++- .../model/DevicePackageBundleInfos.java | 17 +- .../packages/model/DevicePackageOptions.java | 15 +- .../model/DevicePackageXmlRegistry.java | 134 ---------- .../packages/model/DevicePackages.java | 22 +- .../AdvancedPackageDownloadOptions.java | 111 ++++++-- .../DevicePackageDownloadOperation.java | 48 ++-- .../DevicePackageDownloadOptions.java | 3 +- .../DevicePackageDownloadRequest.java | 155 +++++++++--- .../DevicePackageInstallOperation.java | 49 ++-- .../install/DevicePackageInstallOptions.java | 3 +- .../install/DevicePackageInstallRequest.java | 40 ++- .../DevicePackageUninstallOperation.java | 47 +++- .../DevicePackageUninstallOptions.java | 3 +- .../DevicePackageUninstallRequest.java | 47 ++-- .../DeviceManagementPackagesModule.java | 4 - .../internal/DevicePackageFactoryImpl.java | 127 ---------- .../DevicePackageManagementServiceImpl.java | 19 +- .../AdvancedPackageDownloadOptionsImpl.java | 119 --------- .../DevicePackageDownloadOperationImpl.java | 79 ------ .../DevicePackageDownloadOptionsImpl.java | 24 -- .../DevicePackageDownloadRequestImpl.java | 158 ------------ .../DevicePackageInstallOperationImpl.java | 70 ------ .../DevicePackageInstallOptionsImpl.java | 24 -- .../DevicePackageInstallRequestImpl.java | 69 ----- .../internal/DevicePackageBundleInfoImpl.java | 54 ---- .../DevicePackageBundleInfosImpl.java | 45 ---- .../model/internal/DevicePackageImpl.java | 83 ------ .../internal/DevicePackageOptionsImpl.java | 35 --- .../model/internal/DevicePackagesImpl.java | 42 ---- .../DevicePackageUninstallOperationImpl.java | 70 ------ .../DevicePackageUninstallOptionsImpl.java | 24 -- .../DevicePackageUninstallRequestImpl.java | 70 ------ .../DevicePackageDownloadTargetProcessor.java | 13 +- ...DevicePackageUninstallTargetProcessor.java | 16 +- .../registry/common/DeviceValidationImpl.java | 3 +- .../kapua/TranslatorAppPackageKuraKapua.java | 45 ++-- .../test/TranslatorLocatorConfiguration.java | 2 - 44 files changed, 696 insertions(+), 1773 deletions(-) delete mode 100644 service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/DevicePackageFactory.java delete mode 100644 service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageXmlRegistry.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageFactoryImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/AdvancedPackageDownloadOptionsImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOperationImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOptionsImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadRequestImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOperationImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOptionsImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallRequestImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfoImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfosImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageOptionsImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackagesImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOperationImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOptionsImpl.java delete mode 100644 service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallRequestImpl.java diff --git a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java index 241de57aeaa..79503c1fd0e 100644 --- a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java +++ b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java @@ -12,8 +12,28 @@ *******************************************************************************/ package org.eclipse.kapua.app.console.module.device.server; -import com.extjs.gxt.ui.client.data.BaseListLoadResult; -import com.extjs.gxt.ui.client.data.ListLoadResult; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.StringTokenizer; + +import javax.xml.namespace.QName; + import org.apache.commons.codec.binary.Base64; import org.apache.commons.imaging.ImageFormat; import org.apache.commons.imaging.ImageFormats; @@ -65,7 +85,6 @@ import org.eclipse.kapua.service.device.management.configuration.store.DeviceConfigurationStoreService; import org.eclipse.kapua.service.device.management.configuration.store.settings.DeviceConfigurationStoreEnablementPolicy; import org.eclipse.kapua.service.device.management.configuration.store.settings.DeviceConfigurationStoreSettings; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; @@ -74,8 +93,10 @@ import org.eclipse.kapua.service.device.management.packages.model.FileType; import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; +import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadStatus; +import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOptions; import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest; import org.eclipse.kapua.service.device.management.snapshot.DeviceSnapshot; import org.eclipse.kapua.service.device.management.snapshot.DeviceSnapshotManagementService; @@ -83,26 +104,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.xml.namespace.QName; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.StringTokenizer; +import com.extjs.gxt.ui.client.data.BaseListLoadResult; +import com.extjs.gxt.ui.client.data.ListLoadResult; /** * The server side implementation of the Device RPC service. @@ -132,7 +135,6 @@ public class GwtDeviceManagementServiceImpl extends KapuaRemoteServiceServlet im private static final DeviceConfigurationStoreFactory DEVICE_CONFIGURATION_STORE_FACTORY = LOCATOR.getFactory(DeviceConfigurationStoreFactory.class); private static final DevicePackageManagementService PACKAGE_MANAGEMENT_SERVICE = LOCATOR.getService(DevicePackageManagementService.class); - private static final DevicePackageFactory DEVICE_PACKAGE_FACTORY = LOCATOR.getFactory(DevicePackageFactory.class); private static final DeviceSnapshotManagementService SNAPSHOT_MANAGEMENT_SERVICE = LOCATOR.getService(DeviceSnapshotManagementService.class); @@ -190,7 +192,7 @@ public void installPackage(GwtXSRFToken xsrfToken, GwtPackageInstallRequest gwtP throw new GwtKapuaException(GwtKapuaErrorCode.PACKAGE_URI_SYNTAX_ERROR, e, e.getLocalizedMessage()); } - DevicePackageDownloadRequest packageDownloadRequest = DEVICE_PACKAGE_FACTORY.newPackageDownloadRequest(); + DevicePackageDownloadRequest packageDownloadRequest = new DevicePackageDownloadRequest(); packageDownloadRequest.setUri(packageUri); packageDownloadRequest.setName(gwtPackageInstallRequest.getPackageName()); packageDownloadRequest.setVersion(gwtPackageInstallRequest.getPackageVersion()); @@ -210,7 +212,7 @@ public void installPackage(GwtXSRFToken xsrfToken, GwtPackageInstallRequest gwtP advancedOptions.setNotifyBlockSize(gwtPackageInstallRequest.getNotifyBlockSize()); advancedOptions.setInstallVerifierURI(gwtPackageInstallRequest.getInstallVerifierURI()); - PACKAGE_MANAGEMENT_SERVICE.downloadExec(scopeId, deviceId, packageDownloadRequest, DEVICE_PACKAGE_FACTORY.newPackageDownloadOptions()); + PACKAGE_MANAGEMENT_SERVICE.downloadExec(scopeId, deviceId, packageDownloadRequest, new DevicePackageDownloadOptions()); } catch (Throwable t) { throw KapuaExceptionHandler.buildExceptionFromError(t); } @@ -252,13 +254,13 @@ public void uninstallPackage(GwtXSRFToken xsrfToken, GwtPackageUninstallRequest KapuaId scopeId = KapuaEid.parseCompactId(gwtPackageUninstallRequest.getScopeId()); KapuaId deviceId = KapuaEid.parseCompactId(gwtPackageUninstallRequest.getDeviceId()); - DevicePackageUninstallRequest packageUninstallRequest = DEVICE_PACKAGE_FACTORY.newPackageUninstallRequest(); + DevicePackageUninstallRequest packageUninstallRequest = new DevicePackageUninstallRequest(); packageUninstallRequest.setName(gwtPackageUninstallRequest.getPackageName()); packageUninstallRequest.setVersion(gwtPackageUninstallRequest.getPackageVersion()); packageUninstallRequest.setReboot(gwtPackageUninstallRequest.isReboot()); packageUninstallRequest.setRebootDelay(gwtPackageUninstallRequest.getRebootDelay()); - PACKAGE_MANAGEMENT_SERVICE.uninstallExec(scopeId, deviceId, packageUninstallRequest, DEVICE_PACKAGE_FACTORY.newPackageUninstallOptions()); + PACKAGE_MANAGEMENT_SERVICE.uninstallExec(scopeId, deviceId, packageUninstallRequest, new DevicePackageUninstallOptions()); } catch (Throwable t) { throw KapuaExceptionHandler.buildExceptionFromError(t); } @@ -372,7 +374,7 @@ public int compare(DeviceComponentConfiguration arg0, DeviceComponentConfigurati strValues.add(v.toString()); } } - gwtParam.setValues(strValues.toArray(new String[]{})); + gwtParam.setValues(strValues.toArray(new String[] {})); } } } @@ -462,7 +464,8 @@ public GwtDeviceConfigurationStoreSettings getApplicationSettings(String scopeId deviceConfigurationStoreSettings = DEVICE_CONFIGURATION_STORE_SERVICE.getApplicationSettings(scopeId, deviceId); gwtDeviceConfigurationStoreSettings = new GwtDeviceConfigurationStoreSettings(); - gwtDeviceConfigurationStoreSettings.setStoreEnablementPolicy(GwtDeviceConfigurationStoreSettings.GwtDeviceConfigurationStoreEnablementPolicy.valueOf(deviceConfigurationStoreSettings.getEnablementPolicy().name())); + gwtDeviceConfigurationStoreSettings.setStoreEnablementPolicy( + GwtDeviceConfigurationStoreSettings.GwtDeviceConfigurationStoreEnablementPolicy.valueOf(deviceConfigurationStoreSettings.getEnablementPolicy().name())); return gwtDeviceConfigurationStoreSettings; } catch (Throwable t) { throw KapuaExceptionHandler.buildExceptionFromError(t); @@ -470,7 +473,8 @@ public GwtDeviceConfigurationStoreSettings getApplicationSettings(String scopeId } @Override - public void setApplicationSettings(GwtXSRFToken xsrfToken, String scopeIdString, String deviceIdString, GwtDeviceConfigurationStoreSettings gwtDeviceConfigurationStoreSettings) throws GwtKapuaException { + public void setApplicationSettings(GwtXSRFToken xsrfToken, String scopeIdString, String deviceIdString, GwtDeviceConfigurationStoreSettings gwtDeviceConfigurationStoreSettings) + throws GwtKapuaException { checkXSRFToken(xsrfToken); try { @@ -677,36 +681,36 @@ private Object getObjectValue(GwtConfigParameter gwtConfigParam, String strValue if (strValue != null) { GwtConfigParameterType gwtType = gwtConfigParam.getType(); switch (gwtType) { - case LONG: - objValue = Long.parseLong(strValue); - break; - case DOUBLE: - objValue = Double.parseDouble(strValue); - break; - case FLOAT: - objValue = Float.parseFloat(strValue); - break; - case INTEGER: - objValue = Integer.parseInt(strValue); - break; - case SHORT: - objValue = Short.parseShort(strValue); - break; - case BYTE: - objValue = Byte.parseByte(strValue); - break; - case BOOLEAN: - objValue = Boolean.parseBoolean(strValue); - break; - case PASSWORD: - objValue = new Password(strValue); - break; - case CHAR: - objValue = strValue.charAt(0); - break; - case STRING: - objValue = strValue; - break; + case LONG: + objValue = Long.parseLong(strValue); + break; + case DOUBLE: + objValue = Double.parseDouble(strValue); + break; + case FLOAT: + objValue = Float.parseFloat(strValue); + break; + case INTEGER: + objValue = Integer.parseInt(strValue); + break; + case SHORT: + objValue = Short.parseShort(strValue); + break; + case BYTE: + objValue = Byte.parseByte(strValue); + break; + case BOOLEAN: + objValue = Boolean.parseBoolean(strValue); + break; + case PASSWORD: + objValue = new Password(strValue); + break; + case CHAR: + objValue = strValue.charAt(0); + break; + case STRING: + objValue = strValue; + break; } } return objValue; @@ -716,79 +720,76 @@ private Object[] getObjectValue(GwtConfigParameter gwtConfigParam, String[] defa List values = new ArrayList(); GwtConfigParameterType type = gwtConfigParam.getType(); switch (type) { - case BOOLEAN: - for (String value : defaultValues) { - values.add(Boolean.valueOf(value)); - } - return values.toArray(); + case BOOLEAN: + for (String value : defaultValues) { + values.add(Boolean.valueOf(value)); + } + return values.toArray(); - case BYTE: - for (String value : defaultValues) { - values.add(Byte.valueOf(value)); - } - return values.toArray(); + case BYTE: + for (String value : defaultValues) { + values.add(Byte.valueOf(value)); + } + return values.toArray(); - case CHAR: - for (String value : defaultValues) { - values.add(value.charAt(0)); - } - return values.toArray(); + case CHAR: + for (String value : defaultValues) { + values.add(value.charAt(0)); + } + return values.toArray(); - case DOUBLE: - for (String value : defaultValues) { - values.add(Double.valueOf(value)); - } - return values.toArray(); + case DOUBLE: + for (String value : defaultValues) { + values.add(Double.valueOf(value)); + } + return values.toArray(); - case FLOAT: - for (String value : defaultValues) { - values.add(Float.valueOf(value)); - } - return values.toArray(); + case FLOAT: + for (String value : defaultValues) { + values.add(Float.valueOf(value)); + } + return values.toArray(); - case INTEGER: - for (String value : defaultValues) { - values.add(Integer.valueOf(value)); - } - return values.toArray(); + case INTEGER: + for (String value : defaultValues) { + values.add(Integer.valueOf(value)); + } + return values.toArray(); - case LONG: - for (String value : defaultValues) { - values.add(Long.valueOf(value)); - } - return values.toArray(); + case LONG: + for (String value : defaultValues) { + values.add(Long.valueOf(value)); + } + return values.toArray(); - case SHORT: - for (String value : defaultValues) { - values.add(Short.valueOf(value)); - } - return values.toArray(); + case SHORT: + for (String value : defaultValues) { + values.add(Short.valueOf(value)); + } + return values.toArray(); - case PASSWORD: - for (String value : defaultValues) { - values.add(new Password(value)); - } - return values.toArray(); + case PASSWORD: + for (String value : defaultValues) { + values.add(new Password(value)); + } + return values.toArray(); - case STRING: - default: - return defaultValues; + case STRING: + default: + return defaultValues; } } /** - * Checks the source of the icon. - * The component config icon can be one of the well known icon (i.e. MqttDataTransport icon) - * as well as an icon loaded from external source with an HTTP link. + * Checks the source of the icon. The component config icon can be one of the well known icon (i.e. MqttDataTransport icon) as well as an icon loaded from external source with an HTTP link. *

- * We need to filter HTTP link to protect the console page and also to have content always served from - * EC console. Otherwise browsers can alert the user that content is served from domain different from - * *.everyware-cloud.com and over insicure connection. + * We need to filter HTTP link to protect the console page and also to have content always served from EC console. Otherwise browsers can alert the user that content is served from domain + * different from *.everyware-cloud.com and over insicure connection. *

- * To avoid this we will download the image locally on the server temporary directory and give back the page - * a token URL to get the file. + * To avoid this we will download the image locally on the server temporary directory and give back the page a token URL to get the file. * - * @param icon The icon from the OCD of the component configuration. + * @param icon + * The icon from the OCD of the component configuration. */ private void checkIconResource(KapuaTicon icon) { ConsoleSetting config = ConsoleSetting.getInstance(); diff --git a/qa/common/src/main/java/org/eclipse/kapua/qa/common/SimulatedDeviceSteps.java b/qa/common/src/main/java/org/eclipse/kapua/qa/common/SimulatedDeviceSteps.java index dbe3ef150c4..be030528a98 100644 --- a/qa/common/src/main/java/org/eclipse/kapua/qa/common/SimulatedDeviceSteps.java +++ b/qa/common/src/main/java/org/eclipse/kapua/qa/common/SimulatedDeviceSteps.java @@ -42,7 +42,6 @@ import org.eclipse.kapua.service.device.management.bundle.DeviceBundle; import org.eclipse.kapua.service.device.management.bundle.DeviceBundleManagementService; import org.eclipse.kapua.service.device.management.bundle.DeviceBundles; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; @@ -334,7 +333,7 @@ public void downloadPackage(final String packageName, final String version, fina With.withDevice(account, currentDevice.getClientId(), device -> { final DevicePackageManagementService service = KapuaLocator.getInstance().getService(DevicePackageManagementService.class); - final DevicePackageDownloadRequest request = KapuaLocator.getInstance().getFactory(DevicePackageFactory.class).newPackageDownloadRequest(); + final DevicePackageDownloadRequest request = new DevicePackageDownloadRequest(); request.setInstall(true); request.setName(packageName); request.setVersion(version); diff --git a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DeviceManagementPackages.java b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DeviceManagementPackages.java index 4cb368ecfff..cb696d05ad4 100644 --- a/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DeviceManagementPackages.java +++ b/rest-api/resources/src/main/java/org/eclipse/kapua/app/api/resources/v1/resources/DeviceManagementPackages.java @@ -12,6 +12,17 @@ *******************************************************************************/ package org.eclipse.kapua.app.api.resources.v1.resources; +import javax.inject.Inject; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.eclipse.kapua.KapuaException; import org.eclipse.kapua.app.api.core.model.EntityId; import org.eclipse.kapua.app.api.core.model.ScopeId; @@ -21,7 +32,6 @@ import org.eclipse.kapua.locator.KapuaLocator; import org.eclipse.kapua.model.id.KapuaId; import org.eclipse.kapua.service.KapuaService; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.model.DevicePackages; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; @@ -32,41 +42,33 @@ import org.eclipse.kapua.service.device.management.registry.operation.DeviceManagementOperationRegistryService; import org.eclipse.kapua.service.device.registry.Device; -import javax.inject.Inject; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - @Path("{scopeId}/devices/{deviceId}/packages") public class DeviceManagementPackages extends AbstractKapuaResource { - private final Boolean responseLegacyMode = KapuaLocator.getInstance().getComponent(KapuaApiCoreSetting.class).getBoolean(KapuaApiCoreSettingKeys.API_DEVICE_MANAGEMENT_PACKAGE_RESPONSE_LEGACY_MODE, false); + private final Boolean responseLegacyMode = KapuaLocator.getInstance().getComponent(KapuaApiCoreSetting.class) + .getBoolean(KapuaApiCoreSettingKeys.API_DEVICE_MANAGEMENT_PACKAGE_RESPONSE_LEGACY_MODE, false); @Inject public DevicePackageManagementService devicePackageManagementService; @Inject - public DevicePackageFactory devicePackageFactory; - @Inject public DeviceManagementOperationRegistryService deviceManagementOperationRegistryService; /** * Returns the list of all the packages installed on the device. * - * @param scopeId The {@link ScopeId} in which to search results. - * @param deviceId The id of the device - * @param timeout The timeout of the operation + * @param scopeId + * The {@link ScopeId} in which to search results. + * @param deviceId + * The id of the device + * @param timeout + * The timeout of the operation * @return The list of packages installed. - * @throws KapuaException Whenever something bad happens. See specific {@link KapuaService} exceptions. + * @throws KapuaException + * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @GET - @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public DevicePackages get( @PathParam("scopeId") ScopeId scopeId, @PathParam("deviceId") EntityId deviceId, @@ -77,17 +79,22 @@ public DevicePackages get( /** * Download and optionally installs a package into the device. * - * @param scopeId The {@link ScopeId} in which to search results. - * @param deviceId The {@link Device} ID. - * @param timeout The timeout of the operation - * @param packageDownloadRequest Mandatory object with all the informations needed to download and install a package + * @param scopeId + * The {@link ScopeId} in which to search results. + * @param deviceId + * The {@link Device} ID. + * @param timeout + * The timeout of the operation + * @param packageDownloadRequest + * Mandatory object with all the informations needed to download and install a package * @return HTTP 200 if operation has completed successfully. - * @throws KapuaException Whenever something bad happens. See specific {@link KapuaService} exceptions. + * @throws KapuaException + * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @POST @Path("_download") - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response download( @PathParam("scopeId") ScopeId scopeId, @PathParam("deviceId") EntityId deviceId, @@ -95,7 +102,7 @@ public Response download( @QueryParam("legacy") @DefaultValue("false") boolean legacy, DevicePackageDownloadRequest packageDownloadRequest) throws KapuaException { - DevicePackageDownloadOptions options = devicePackageFactory.newPackageDownloadOptions(); + DevicePackageDownloadOptions options = new DevicePackageDownloadOptions(); options.setTimeout(timeout); KapuaId deviceManagementOperationId = devicePackageManagementService.downloadExec(scopeId, deviceId, packageDownloadRequest, options); @@ -108,24 +115,29 @@ public Response download( /** * Uninstalls a package into the device. * - * @param scopeId The {@link ScopeId} in which to search results. - * @param deviceId The {@link Device} ID. - * @param timeout The timeout of the operation - * @param packageUninstallRequest Mandatory object with all the informations needed to uninstall a package + * @param scopeId + * The {@link ScopeId} in which to search results. + * @param deviceId + * The {@link Device} ID. + * @param timeout + * The timeout of the operation + * @param packageUninstallRequest + * Mandatory object with all the informations needed to uninstall a package * @return HTTP 200 if operation has completed successfully. - * @throws KapuaException Whenever something bad happens. See specific {@link KapuaService} exceptions. + * @throws KapuaException + * Whenever something bad happens. See specific {@link KapuaService} exceptions. * @since 1.0.0 */ @POST @Path("_uninstall") - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response uninstall( @PathParam("scopeId") ScopeId scopeId, @PathParam("deviceId") EntityId deviceId, @QueryParam("timeout") @DefaultValue("30000") Long timeout, @QueryParam("legacy") @DefaultValue("false") boolean legacy, DevicePackageUninstallRequest packageUninstallRequest) throws KapuaException { - DevicePackageUninstallOptions options = devicePackageFactory.newPackageUninstallOptions(); + DevicePackageUninstallOptions options = new DevicePackageUninstallOptions(); options.setTimeout(timeout); KapuaId deviceManagementOperationId = devicePackageManagementService.uninstallExec(scopeId, deviceId, packageUninstallRequest, options); diff --git a/service/api/src/main/java/org/eclipse/kapua/model/domain/Actions.java b/service/api/src/main/java/org/eclipse/kapua/model/domain/Actions.java index 480fb8ea560..ba95d84737d 100644 --- a/service/api/src/main/java/org/eclipse/kapua/model/domain/Actions.java +++ b/service/api/src/main/java/org/eclipse/kapua/model/domain/Actions.java @@ -13,7 +13,6 @@ package org.eclipse.kapua.model.domain; import org.eclipse.kapua.model.KapuaEntityCreator; -import org.eclipse.kapua.model.KapuaUpdatableEntity; import org.eclipse.kapua.model.id.KapuaId; import org.eclipse.kapua.model.query.KapuaQuery; import org.eclipse.kapua.service.KapuaEntityService; @@ -21,8 +20,7 @@ import org.eclipse.kapua.service.KapuaUpdatableEntityService; /** - * {@link Actions} implementation {@code enum}.
- * Available actions defined are: + * {@link Actions} implementation {@code enum}.
Available actions defined are: *

    *
  • {@link Actions#read}: Represent any type of fetching data from the system.
  • *
  • {@link Actions#write}: Represent any type of writing data into the system.
  • @@ -35,8 +33,7 @@ */ public enum Actions { /** - * Represent any type of fetching data from the system.
    - * Common usage is on: + * Represent any type of fetching data from the system.
    Common usage is on: *
      *
    • {@link KapuaEntityService#find(KapuaId, KapuaId)}
    • *
    • {@link KapuaEntityService#query(KapuaQuery)}
    • @@ -49,11 +46,10 @@ public enum Actions { read, /** - * Represent any type of writing data into the system. - * Common usage is on: + * Represent any type of writing data into the system. Common usage is on: *
        *
      • {@link KapuaEntityService#create(KapuaEntityCreator)}
      • - *
      • {@link KapuaUpdatableEntityService#update(KapuaUpdatableEntity)}
      • + *
      • {@link KapuaUpdatableEntityService#update(Object)}
      • *
      * * @since 1.0.0 @@ -61,8 +57,7 @@ public enum Actions { write, /** - * Represent any type of deleting data from the system.
      - * Common usage is on: + * Represent any type of deleting data from the system.
      Common usage is on: *
        *
      • {@link KapuaEntityService#delete(KapuaId, KapuaId)}
      • *
      @@ -72,8 +67,7 @@ public enum Actions { delete, /** - * Represent any type of connect to resources of the system.
      - * Examples are: + * Represent any type of connect to resources of the system.
      Examples are: *
        *
      • Connecting to the message broker.
      • *
      diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/DevicePackageFactory.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/DevicePackageFactory.java deleted file mode 100644 index 1c41afcc3aa..00000000000 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/DevicePackageFactory.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages; - -import org.eclipse.kapua.model.KapuaObjectFactory; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfos; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackages; -import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOptions; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallRequest; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOptions; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest; - -/** - * {@link DevicePackageFactory} definition. - * - * @since 1.0.0 - */ -public interface DevicePackageFactory extends KapuaObjectFactory { - - /** - * Creates a new {@link DevicePackages} - * - * @return the newly created {@link DevicePackages} - * @since 1.0.0 - */ - DevicePackages newDeviceDeploymentPackages(); - - /** - * Creates a new {@link DevicePackage} - * - * @return The newly created {@link DevicePackage} - * @since 1.0.0 - */ - DevicePackage newDeviceDeploymentPackage(); - - /** - * Creates a new {@link DevicePackageBundleInfo} - * - * @return the newly created {@link DevicePackageBundleInfo} - * @since 1.0.0 - */ - DevicePackageBundleInfo newDevicePackageBundleInfo(); - - /** - * Creates a new {@link DevicePackageBundleInfos} - * - * @return the newly created {@link DevicePackageBundleInfos} - * @since 1.0.0 - */ - DevicePackageBundleInfos newDevicePackageBundleInfos(); - // Download operation - - /** - * Creates a new {@link DevicePackageDownloadRequest} - * - * @return The newly created {@link DevicePackageDownloadRequest} - * @since 1.0.0 - */ - DevicePackageDownloadRequest newPackageDownloadRequest(); - - /** - * Creates a new {@link DevicePackageDownloadOptions} - * - * @return the newly created {@link DevicePackageDownloadOptions} - * @since 1.1.0 - */ - DevicePackageDownloadOptions newPackageDownloadOptions(); - - /** - * Creates a new {@link AdvancedPackageDownloadOptions} - * - * @return the newly created {@link AdvancedPackageDownloadOptions} - * @since 1.1.0 - */ - AdvancedPackageDownloadOptions newAdvancedPackageDownloadOptions(); - - /** - * Creates a new {@link DevicePackageDownloadOperation} - * - * @return the newly created {@link DevicePackageDownloadOperation} - * @since 1.0.0 - */ - DevicePackageDownloadOperation newPackageDownloadOperation(); - // Install operation - - /** - * Creates a new {@link DevicePackageInstallRequest} - * - * @return the newly created {@link DevicePackageInstallRequest} - * @since 1.0.0 - */ - DevicePackageInstallRequest newPackageInstallRequest(); - - /** - * Creates a new {@link DevicePackageInstallOptions} - * - * @return the newly created {@link DevicePackageInstallOptions} - * @since 1.1.0 - */ - DevicePackageInstallOptions newPackageInstallOptions(); - - /** - * Instantiates a new {@link DevicePackageInstallOperation}. - * - * @return The newly instantiated {@link DevicePackageInstallOperation}. - * @since 1.5.0 - */ - DevicePackageInstallOperation newPackageInstallOperation(); - // Uninstall operation - - /** - * Creates a new {@link DevicePackageUninstallRequest} - * - * @return the newly created {@link DevicePackageUninstallRequest} - * @since 1.0.0 - */ - DevicePackageUninstallRequest newPackageUninstallRequest(); - - /** - * Creates a new {@link DevicePackageUninstallOptions} - * - * @return the newly created {@link DevicePackageUninstallOptions} - * @since 1.1.0 - */ - DevicePackageUninstallOptions newPackageUninstallOptions(); - - /** - * Instantiates a new {@link DevicePackageUninstallOperation}. - * - * @return The newly instantiated {@link DevicePackageUninstallOperation}. - * @since 1.5.0 - */ - DevicePackageUninstallOperation newPackageUninstallOperation(); -} diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackage.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackage.java index 037ded2f00b..efe15fe3401 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackage.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackage.java @@ -12,12 +12,13 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model; +import java.util.Date; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import java.util.Date; /** * {@link DevicePackage} definition. @@ -26,8 +27,13 @@ */ @XmlRootElement(name = "devicePackage") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackage") -public interface DevicePackage { +@XmlType +public class DevicePackage { + + private String name; + private String version; + private DevicePackageBundleInfos bundleInfos; + private Date installDate; /** * Gets the name. @@ -36,15 +42,20 @@ public interface DevicePackage { * @since 1.0.0 */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Sets the name. * - * @param name The name. + * @param name + * The name. * @since 1.0.0 */ - void setName(String name); + public void setName(String name) { + this.name = name; + } /** * Gets the version. @@ -53,15 +64,20 @@ public interface DevicePackage { * @since 1.0.0 */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Sets the version. * - * @param version The version. + * @param version + * The version. * @since 1.0.0 */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Gets the {@link DevicePackageBundleInfos}. @@ -70,15 +86,24 @@ public interface DevicePackage { * @since 1.0.0 */ @XmlElement(name = "bundleInfos") - DevicePackageBundleInfos getBundleInfos(); + public DevicePackageBundleInfos getBundleInfos() { + if (bundleInfos == null) { + bundleInfos = new DevicePackageBundleInfos(); + } + + return bundleInfos; + } /** * Sets the {@link DevicePackageBundleInfos}. * - * @param bundleInfos The {@link DevicePackageBundleInfos}. + * @param bundleInfos + * The {@link DevicePackageBundleInfos}. * @since 1.0.0 */ - void setBundleInfos(DevicePackageBundleInfos bundleInfos); + public void setBundleInfos(DevicePackageBundleInfos bundleInfos) { + this.bundleInfos = bundleInfos; + } /** * Gets the installation date. @@ -87,13 +112,18 @@ public interface DevicePackage { * @since 1.0.0 */ @XmlElement(name = "installDate") - Date getInstallDate(); + public Date getInstallDate() { + return installDate; + } /** * Sets the installation date. * - * @param installDate The installation date. + * @param installDate + * The installation date. * @since 1.0.0 */ - void setInstallDate(Date installDate); + public void setInstallDate(Date installDate) { + this.installDate = installDate; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfo.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfo.java index 639a90d89d1..6ed39a2c99a 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfo.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfo.java @@ -25,8 +25,11 @@ */ @XmlRootElement(name = "bundleInfo") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageBundleInfo") -public interface DevicePackageBundleInfo { +@XmlType +public class DevicePackageBundleInfo { + + public String name; + public String version; /** * Gets the name. @@ -35,15 +38,20 @@ public interface DevicePackageBundleInfo { * @since 1.0.0 */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Sets the name. * - * @param name The name. + * @param name + * The name. * @since 1.0.0 */ - void setName(String name); + public void setName(String name) { + this.name = name; + } /** * Gets the version. @@ -52,13 +60,19 @@ public interface DevicePackageBundleInfo { * @since 1.0.0 */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Sets the version. * - * @param version The version. + * @param version + * The version. * @since 1.0.0 */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfos.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfos.java index eda213f8315..37736c709be 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfos.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageBundleInfos.java @@ -13,12 +13,14 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model; +import java.util.ArrayList; +import java.util.List; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import java.util.List; /** * {@link DevicePackageBundleInfos} implementation. @@ -27,8 +29,10 @@ */ @XmlRootElement(name = "bundleInfos") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageBundleInfos") -public interface DevicePackageBundleInfos { +@XmlType +public class DevicePackageBundleInfos { + + List bundleInfos; /** * Gets the {@link DevicePackageBundleInfo} {@link List}. @@ -37,5 +41,10 @@ public interface DevicePackageBundleInfos { * @since 1.0.0 */ @XmlElement(name = "bundleInfo") - List getBundlesInfos(); + public List getBundlesInfos() { + if (bundleInfos == null) { + bundleInfos = new ArrayList<>(); + } + return bundleInfos; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageOptions.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageOptions.java index f6372608273..e7213a50533 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageOptions.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageOptions.java @@ -19,7 +19,9 @@ * * @since 1.1.0 */ -public interface DevicePackageOptions { +public abstract class DevicePackageOptions { + + private Long timeout; /** * The {@link DeviceManagementOperation} timeout. @@ -27,13 +29,18 @@ public interface DevicePackageOptions { * @return The {@link DeviceManagementOperation} timeout. * @since 1.1.0 */ - Long getTimeout(); + public Long getTimeout() { + return timeout; + } /** * Sets the {@link DeviceManagementOperation} timeout. * - * @param timeout The {@link DeviceManagementOperation} timeout. + * @param timeout + * The {@link DeviceManagementOperation} timeout. * @since 1.1.0 */ - void setTimeout(Long timeout); + public void setTimeout(Long timeout) { + this.timeout = timeout; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageXmlRegistry.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageXmlRegistry.java deleted file mode 100644 index 11b81d2b41a..00000000000 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackageXmlRegistry.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model; - -import org.eclipse.kapua.locator.KapuaLocator; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; -import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest; - -import javax.xml.bind.annotation.XmlRegistry; - -/** - * {@link DevicePackageXmlRegistry} class. - * - * @since 1.0.0 - */ -@XmlRegistry -public class DevicePackageXmlRegistry { - - private final DevicePackageFactory devicePackageFactory = KapuaLocator.getInstance().getFactory(DevicePackageFactory.class); - - /** - * Creates a new device package instance - * - * @return - * @since 1.0.0 - */ - public DevicePackage newDevicePackage() { - return devicePackageFactory.newDeviceDeploymentPackage(); - } - - /** - * Creates a new device packages instance - * - * @return - * @since 1.0.0 - */ - public DevicePackages newDevicePackages() { - return devicePackageFactory.newDeviceDeploymentPackages(); - } - - /** - * Creates a new device package bundle information instance - * - * @return - * @since 1.0.0 - */ - public DevicePackageBundleInfo newDevicePackageBundleInfo() { - return devicePackageFactory.newDevicePackageBundleInfo(); - } - - /** - * Creates a new device package bundle informations instance - * - * @return - * @since 1.0.0 - */ - public DevicePackageBundleInfos newDevicePackageBundleInfos() { - return devicePackageFactory.newDevicePackageBundleInfos(); - } - - /** - * Creates a new device package download request instance - * - * @return - */ - public DevicePackageDownloadRequest newDevicePackageDownloadRequest() { - return devicePackageFactory.newPackageDownloadRequest(); - } - - /** - * Creates a new device package download request instance - * - * @return - * @since 1.1.0 - */ - public AdvancedPackageDownloadOptions newAdvancedPackageDownloadOptions() { - return devicePackageFactory.newAdvancedPackageDownloadOptions(); - } - - /** - * Instantiates a new {@link DevicePackageDownloadOperation}. - * - * @return The newly instantiated {@link DevicePackageDownloadOperation}. - * @since 1.5.0 - */ - public DevicePackageDownloadOperation newDevicePackageDownloadOperation() { - return devicePackageFactory.newPackageDownloadOperation(); - } - - /** - * Instantiates a new {@link DevicePackageInstallOperation}. - * - * @return The newly instantiated {@link DevicePackageInstallOperation}. - * @since 1.5.0 - */ - public DevicePackageInstallOperation newDevicePackageInstallOperation() { - return devicePackageFactory.newPackageInstallOperation(); - } - - /** - * Creates a new device package uninstall request instance - * - * @return - * @since 1.0.0 - */ - public DevicePackageUninstallRequest newDevicePackageUninstallRequest() { - return devicePackageFactory.newPackageUninstallRequest(); - } - - /** - * Instantiates a new {@link DevicePackageUninstallOperation}. - * - * @return The newly instantiated {@link DevicePackageUninstallOperation}. - * @since 1.5.0 - */ - public DevicePackageUninstallOperation newDevicePackageUninstallOperation() { - return devicePackageFactory.newPackageUninstallOperation(); - } -} diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackages.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackages.java index 276ef765984..c703e9fdc32 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackages.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/DevicePackages.java @@ -13,14 +13,16 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model; -import org.eclipse.kapua.KapuaSerializable; +import java.util.ArrayList; +import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import java.util.List; + +import org.eclipse.kapua.KapuaSerializable; /** * {@link DevicePackages} definition. @@ -29,8 +31,12 @@ */ @XmlRootElement(name = "devicePackages") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackages") -public interface DevicePackages extends KapuaSerializable { +@XmlType +public class DevicePackages implements KapuaSerializable { + + private static final long serialVersionUID = 2450088980495469562L; + + public List deploymentPackages; /** * Gets the {@link DevicePackage} {@link List} @@ -39,5 +45,11 @@ public interface DevicePackages extends KapuaSerializable { * @since 1.0.0 */ @XmlElement(name = "devicePackage") - List getPackages(); + public List getPackages() { + if (deploymentPackages == null) { + deploymentPackages = new ArrayList<>(); + } + + return deploymentPackages; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/AdvancedPackageDownloadOptions.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/AdvancedPackageDownloadOptions.java index 989445165a6..9c38087ae86 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/AdvancedPackageDownloadOptions.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/AdvancedPackageDownloadOptions.java @@ -12,8 +12,6 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.download; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -25,8 +23,41 @@ * @since 1.1.0 */ @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newAdvancedPackageDownloadOptions") -public interface AdvancedPackageDownloadOptions { +@XmlType +public class AdvancedPackageDownloadOptions { + + private Boolean restart; + private Integer blockSize; + private Integer blockDelay; + private Integer blockTimeout; + private Integer notifyBlockSize; + private String installVerifierURI; + + /** + * Constructor. + * + * @since 1.1.0 + */ + public AdvancedPackageDownloadOptions() { + } + + /** + * Clone Constructor. + * + * @param advancedPackageDownloadOptions + * The {@link AdvancedPackageDownloadOptions} to clone. + * @since 1.1.0 + */ + public AdvancedPackageDownloadOptions(AdvancedPackageDownloadOptions advancedPackageDownloadOptions) { + super(); + + setRestart(advancedPackageDownloadOptions.getRestart()); + setBlockSize(advancedPackageDownloadOptions.getBlockSize()); + setBlockDelay(advancedPackageDownloadOptions.getBlockDelay()); + setBlockTimeout(advancedPackageDownloadOptions.getBlockTimeout()); + setNotifyBlockSize(advancedPackageDownloadOptions.getNotifyBlockSize()); + setInstallVerifierURI(advancedPackageDownloadOptions.getInstallVerifierURI()); + } /** * Gets whether or not to restart the download from the beginning. @@ -34,15 +65,20 @@ public interface AdvancedPackageDownloadOptions { * @return {@code true} if the download must be restarted from the beginning, {@code false} otherwise. * @since 1.2.0 */ - Boolean getRestart(); + public Boolean getRestart() { + return restart; + } /** * Sets whether or not to restart the download from the beginning. * - * @param restart {@code true} if the download must be restarted from the beginning, {@code false} otherwise. + * @param restart + * {@code true} if the download must be restarted from the beginning, {@code false} otherwise. * @since 1.2.0 */ - void setRestart(Boolean restart); + public void setRestart(Boolean restart) { + this.restart = restart; + } /** * Gets the size in {@code Byte}s of the blocks to transfer from the URI. @@ -51,15 +87,20 @@ public interface AdvancedPackageDownloadOptions { * @since 1.1.0 */ @XmlElement(name = "blockSize") - Integer getBlockSize(); + public Integer getBlockSize() { + return blockSize; + } /** * Sets the size in {@code Byte}s of the blocks to transfer from the URI. * - * @param blockSize The size in {@code Byte}s of the blocks to transfer from the URI. + * @param blockSize + * The size in {@code Byte}s of the blocks to transfer from the URI. * @since 1.1.0 */ - void setBlockSize(Integer blockSize); + public void setBlockSize(Integer blockSize) { + this.blockSize = blockSize; + } /** * Gets the delay between each block transfer from the URI. @@ -68,15 +109,20 @@ public interface AdvancedPackageDownloadOptions { * @since 1.1.0 */ @XmlElement(name = "blockDelay") - Integer getBlockDelay(); + public Integer getBlockDelay() { + return blockDelay; + } /** * Sets the delay between each block transfer from the URI. * - * @param blockDelay The delay between each block transfer from the URI. + * @param blockDelay + * The delay between each block transfer from the URI. * @since 1.1.0 */ - void setBlockDelay(Integer blockDelay); + public void setBlockDelay(Integer blockDelay) { + this.blockDelay = blockDelay; + } /** * Gets the timeout for transferring a block from the URI. @@ -85,32 +131,44 @@ public interface AdvancedPackageDownloadOptions { * @since 1.1.0 */ @XmlElement(name = "blockTimeout") - Integer getBlockTimeout(); + public Integer getBlockTimeout() { + return blockTimeout; + } /** * Sets the timeout for transferring a block from the URI. * - * @param blockTimeout The timeout for transferring a block from the URI. + * @param blockTimeout + * The timeout for transferring a block from the URI. * @since 1.1.0 */ - void setBlockTimeout(Integer blockTimeout); + public void setBlockTimeout(Integer blockTimeout) { + this.blockTimeout = blockTimeout; + } /** - * Gets the size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification} to be sent from the {@link org.eclipse.kapua.service.device.registry.Device}. + * Gets the size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification} to be + * sent from the {@link org.eclipse.kapua.service.device.registry.Device}. * * @return The size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification}. * @since 1.1.0 */ @XmlElement(name = "notifyBlockSize") - Integer getNotifyBlockSize(); + public Integer getNotifyBlockSize() { + return notifyBlockSize; + } /** - * Sets the size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification} to be sent from the {@link org.eclipse.kapua.service.device.registry.Device}. + * Sets the size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification} to be + * sent from the {@link org.eclipse.kapua.service.device.registry.Device}. * - * @param notifyBlockSize The size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification}. + * @param notifyBlockSize + * The size in {@code Byte}s of the blocks to be transfer to cause a {@link org.eclipse.kapua.service.device.management.registry.operation.notification.ManagementOperationNotification}. * @since 1.1.0 */ - void setNotifyBlockSize(Integer notifyBlockSize); + public void setNotifyBlockSize(Integer notifyBlockSize) { + this.notifyBlockSize = notifyBlockSize; + } /** * Gets the URI for the executable shell script to verify the installing of the downloaded file. @@ -119,13 +177,18 @@ public interface AdvancedPackageDownloadOptions { * @since 1.1.0 */ @XmlElement(name = "installVerifierURI") - String getInstallVerifierURI(); + public String getInstallVerifierURI() { + return installVerifierURI; + } /** * Sets the URI for the executable shell script to verify the installing of the downloaded file. * - * @param installVerifiesURI The URI for the executable shell script to verify the installing of the downloaded file. + * @param installVerifiesURI + * The URI for the executable shell script to verify the installing of the downloaded file. * @since 1.1.0 */ - void setInstallVerifierURI(String installVerifiesURI); + public void setInstallVerifierURI(String installVerifiesURI) { + this.installVerifierURI = installVerifiesURI; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOperation.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOperation.java index 2f874f1141e..6f893f294ce 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOperation.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOperation.java @@ -12,10 +12,6 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.download; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.model.id.KapuaIdAdapter; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -23,6 +19,9 @@ import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.eclipse.kapua.model.id.KapuaId; +import org.eclipse.kapua.model.id.KapuaIdAdapter; + /** * Device download package operation entity definition. * @@ -30,8 +29,13 @@ */ @XmlRootElement(name = "packageDownloadOperation") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageDownloadOperation") -public interface DevicePackageDownloadOperation { +@XmlType +public class DevicePackageDownloadOperation { + + private KapuaId id; + private Integer size; + private Integer progress; + private DevicePackageDownloadStatus status; /** * Get the download package identifier @@ -40,14 +44,18 @@ public interface DevicePackageDownloadOperation { */ @XmlElement(name = "id") @XmlJavaTypeAdapter(KapuaIdAdapter.class) - KapuaId getId(); + public KapuaId getId() { + return id; + } /** * Set the download package identifier * * @param id */ - void setId(KapuaId id); + public void setId(KapuaId id) { + this.id = id; + } /** * Get the package size @@ -55,14 +63,18 @@ public interface DevicePackageDownloadOperation { * @return */ @XmlElement(name = "size") - Integer getSize(); + public Integer getSize() { + return size; + } /** * Set the package size * * @param downloadSize */ - void setSize(Integer downloadSize); + public void setSize(Integer downloadSize) { + this.size = downloadSize; + } /** * Get the download progress @@ -70,14 +82,18 @@ public interface DevicePackageDownloadOperation { * @return */ @XmlElement(name = "progress") - Integer getProgress(); + public Integer getProgress() { + return progress; + } /** * Set the download progress * * @param downloadProgress */ - void setProgress(Integer downloadProgress); + public void setProgress(Integer downloadProgress) { + this.progress = downloadProgress; + } /** * Get the download status @@ -85,13 +101,17 @@ public interface DevicePackageDownloadOperation { * @return */ @XmlElement(name = "status") - DevicePackageDownloadStatus getStatus(); + public DevicePackageDownloadStatus getStatus() { + return status; + } /** * Set the download status * * @param status */ - void setStatus(DevicePackageDownloadStatus status); + public void setStatus(DevicePackageDownloadStatus status) { + this.status = status; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOptions.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOptions.java index cd7f3cdeeb3..ab38d2c13ae 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOptions.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadOptions.java @@ -19,5 +19,6 @@ * * @since 1.1.0 */ -public interface DevicePackageDownloadOptions extends DevicePackageOptions { +public class DevicePackageDownloadOptions extends DevicePackageOptions { + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadRequest.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadRequest.java index 3a20b13fa61..9d0be8bc06c 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadRequest.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/DevicePackageDownloadRequest.java @@ -12,15 +12,15 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.download; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; -import org.eclipse.kapua.service.device.management.packages.model.FileType; +import java.net.URI; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import java.net.URI; + +import org.eclipse.kapua.service.device.management.packages.model.FileType; /** * {@link DevicePackageDownloadRequest} definition. @@ -31,8 +31,25 @@ */ @XmlRootElement(name = "downloadRequest") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageDownloadRequest") -public interface DevicePackageDownloadRequest { +@XmlType +public class DevicePackageDownloadRequest { + + private URI uri; + private String name; + private String version; + + private String username; + private String password; + + private String fileHash; + private FileType fileType; + + private Boolean install; + + private Boolean reboot; + private Integer rebootDelay; + + private AdvancedPackageDownloadOptions advancedOptions; /** * Gets the download URI of the file. @@ -41,15 +58,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "uri") - URI getUri(); + public URI getUri() { + return uri; + } /** * Sets the download URI of the file. * - * @param uri The download URI of the file. + * @param uri + * The download URI of the file. * @since 1.0.0 */ - void setUri(URI uri); + public void setUri(URI uri) { + this.uri = uri; + } /** * Gets the package name. @@ -58,15 +80,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Sets the package name. * - * @param name The package name. + * @param name + * The package name. * @since 1.0.0 */ - void setName(String name); + public void setName(String name) { + this.name = name; + } /** * Gets the package version. @@ -75,15 +102,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Set the package version. * - * @param version The package version. + * @param version + * The package version. * @since 1.0.0 */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Gets the username to provide as a credential when accessing the URI. @@ -91,15 +123,20 @@ public interface DevicePackageDownloadRequest { * @return The username to provide as a credential when accessing the URI. * @since 1.1.0 */ - String getUsername(); + public String getUsername() { + return username; + } /** * Sets the username to provide as a credential when accessing the URI. * - * @param username The username to provide as a credential when accessing the URI. + * @param username + * The username to provide as a credential when accessing the URI. * @since 1.1.0 */ - void setUsername(String username); + public void setUsername(String username) { + this.username = username; + } /** * Gets the password to provide as a credential when accessing the URI. @@ -107,37 +144,46 @@ public interface DevicePackageDownloadRequest { * @return The password to provide as a credential when accessing the URI. * @since 1.1.0 */ - String getPassword(); + public String getPassword() { + return password; + } /** * Sets the password to provide as a credential when accessing the URI. * - * @param password The password to provide as a credential when accessing the URI. + * @param password + * The password to provide as a credential when accessing the URI. * @since 1.1.0 */ - void setPassword(String password); + public void setPassword(String password) { + this.password = password; + } /** * Gets the file hash to verify the downloaded file. *

      * It must be specifies as {@code {HASH_ALGORITHM}:{HASH_VALUE}} *

      - * Example: - * MD5:46cbc7f212b94187cb6480fe9429a89c + * Example: MD5:46cbc7f212b94187cb6480fe9429a89c * * @return The file hash to verify the downloaded file. * @since 1.1.0 */ - String getFileHash(); + public String getFileHash() { + return fileHash; + } /** * Sets the file hash to verify the downloaded file. * - * @param fileHash The file hash to verify the downloaded file. + * @param fileHash + * The file hash to verify the downloaded file. * @see DevicePackageDownloadRequest#getFileHash() * @since 1.1.0 */ - void setFileHash(String fileHash); + public void setFileHash(String fileHash) { + this.fileHash = fileHash; + } /** * Gets the {@link FileType} of the target file to download. @@ -145,15 +191,20 @@ public interface DevicePackageDownloadRequest { * @return The {@link FileType} of the target file to download. * @since 1.1.0 */ - FileType getFileType(); + public FileType getFileType() { + return fileType; + } /** * Sets the {@link FileType} of the target file to download. * - * @param fileType The {@link FileType} of the target file to download. + * @param fileType + * The {@link FileType} of the target file to download. * @since 1.1.0 */ - void setFileType(FileType fileType); + public void setFileType(FileType fileType) { + this.fileType = fileType; + } /** * Gets whether or not install the file right after it has been downloaded. @@ -162,15 +213,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "install") - Boolean getInstall(); + public Boolean getInstall() { + return install; + } /** * Sets whether or not install the file right after it has been downloaded. * - * @param install Whether or not install the file right after it has been downloaded. + * @param install + * Whether or not install the file right after it has been downloaded. * @since 1.0.0 */ - void setInstall(Boolean install); + public void setInstall(Boolean install) { + this.install = install; + } /** * Gets whether or not reboot the device after the operation has been completed. @@ -179,15 +235,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "reboot") - Boolean getReboot(); + public Boolean getReboot() { + return reboot; + } /** * Sets whether or not reboot the device after the operation has been completed. * - * @param reboot Whether or not reboot the device after the operation has been completed. + * @param reboot + * Whether or not reboot the device after the operation has been completed. * @since 1.0.0 */ - void setReboot(Boolean reboot); + public void setReboot(Boolean reboot) { + this.reboot = reboot; + } /** * Gets the delay after which the device is rebooted when the operation has been completed. @@ -196,15 +257,20 @@ public interface DevicePackageDownloadRequest { * @since 1.0.0 */ @XmlElement(name = "rebootDelay") - Integer getRebootDelay(); + public Integer getRebootDelay() { + return rebootDelay; + } /** * Sets the delay after which the device is rebooted when the operation has been completed. * - * @param rebootDelay The delay after which the device is rebooted when the operation has been completed. + * @param rebootDelay + * The delay after which the device is rebooted when the operation has been completed. * @since 1.0.0 */ - void setRebootDelay(Integer rebootDelay); + public void setRebootDelay(Integer rebootDelay) { + this.rebootDelay = rebootDelay; + } /** * Gets the {@link AdvancedPackageDownloadOptions} to tune the download operation. @@ -213,13 +279,22 @@ public interface DevicePackageDownloadRequest { * @since 1.1.0 */ @XmlElement(name = "advancedOptions") - AdvancedPackageDownloadOptions getAdvancedOptions(); + public AdvancedPackageDownloadOptions getAdvancedOptions() { + if (advancedOptions == null) { + advancedOptions = new AdvancedPackageDownloadOptions(); + } + + return advancedOptions; + } /** * Sets the {@link AdvancedPackageDownloadOptions} to tune the download operation. * - * @param advancedOptions The {@link AdvancedPackageDownloadOptions} to tune the download operation. + * @param advancedOptions + * The {@link AdvancedPackageDownloadOptions} to tune the download operation. * @since 1.1.0 */ - void setAdvancedOptions(AdvancedPackageDownloadOptions advancedOptions); + public void setAdvancedOptions(AdvancedPackageDownloadOptions advancedOptions) { + this.advancedOptions = advancedOptions; + } } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOperation.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOperation.java index 1912435d74b..0d3a5ac8c8c 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOperation.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOperation.java @@ -12,10 +12,6 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.install; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.model.id.KapuaIdAdapter; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -23,6 +19,9 @@ import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.eclipse.kapua.model.id.KapuaId; +import org.eclipse.kapua.model.id.KapuaIdAdapter; + /** * {@link DevicePackageInstallOperation} definition. * @@ -30,8 +29,13 @@ */ @XmlRootElement(name = "packageInstallOperation") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageInstallOperation") -public interface DevicePackageInstallOperation { +@XmlType +public class DevicePackageInstallOperation { + + private KapuaId id; + private String name; + private String version; + private DevicePackageInstallStatus status; /** * Get the package identifier @@ -40,14 +44,18 @@ public interface DevicePackageInstallOperation { */ @XmlElement(name = "id") @XmlJavaTypeAdapter(KapuaIdAdapter.class) - KapuaId getId(); + public KapuaId getId() { + return id; + } /** * Set the package identifier * * @param id */ - void setId(KapuaId id); + public void setId(KapuaId id) { + this.id = id; + } /** * Get the package name @@ -55,14 +63,18 @@ public interface DevicePackageInstallOperation { * @return */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Set the package name * * @param packageName */ - void setName(String packageName); + public void setName(String packageName) { + this.name = packageName; + } /** * Get the package version @@ -70,14 +82,18 @@ public interface DevicePackageInstallOperation { * @return */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Set the package version * * @param version */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Get the package install status @@ -85,12 +101,17 @@ public interface DevicePackageInstallOperation { * @return */ @XmlElement(name = "status") - DevicePackageInstallStatus getStatus(); + public DevicePackageInstallStatus getStatus() { + return status; + } /** * Set the package install status * * @param status */ - void setStatus(DevicePackageInstallStatus status); + public void setStatus(DevicePackageInstallStatus status) { + this.status = status; + } + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOptions.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOptions.java index ca4f5815ecf..c2c122c342d 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOptions.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallOptions.java @@ -19,5 +19,6 @@ * * @since 1.1.0 */ -public interface DevicePackageInstallOptions extends DevicePackageOptions { +public class DevicePackageInstallOptions extends DevicePackageOptions { + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallRequest.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallRequest.java index 9911293de15..4821c9096d2 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallRequest.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/DevicePackageInstallRequest.java @@ -17,61 +17,83 @@ * * @since 1.0 */ -public interface DevicePackageInstallRequest { +public class DevicePackageInstallRequest { + + private String name; + private String version; + private Boolean reboot; + private Integer rebootDelay; /** * Get the package name * * @return */ - String getName(); + public String getName() { + return name; + } /** * Set the package name * * @param name */ - void setName(String name); + public void setName(String name) { + this.name = name; + } /** * Get the package version * * @return */ - String getVersion(); + public String getVersion() { + return version; + } /** * Set the package version * * @param version */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Get the device reboot flag * * @return */ - Boolean isReboot(); + public Boolean isReboot() { + return reboot; + } /** * Set the device reboot flag * * @param reboot */ - void setReboot(Boolean reboot); + public void setReboot(Boolean reboot) { + this.reboot = reboot; + } /** * Get the reboot delay * * @return */ - Integer getRebootDelay(); + public Integer getRebootDelay() { + return rebootDelay; + } /** * Set the reboot delay * * @param rebootDelay */ - void setRebootDelay(Integer rebootDelay); + public void setRebootDelay(Integer rebootDelay) { + this.rebootDelay = rebootDelay; + } + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOperation.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOperation.java index eb72ce0f767..2725c56c1e0 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOperation.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOperation.java @@ -12,15 +12,14 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.uninstall; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import org.eclipse.kapua.model.id.KapuaId; + /** * {@link DevicePackageUninstallOperation} definition. * @@ -28,8 +27,13 @@ */ @XmlRootElement(name = "devicePackageUninstallOperation") @XmlAccessorType(XmlAccessType.PROPERTY) -@XmlType(factoryClass = DevicePackageXmlRegistry.class, factoryMethod = "newDevicePackageUninstallOperation") -public interface DevicePackageUninstallOperation { +@XmlType +public class DevicePackageUninstallOperation { + + private KapuaId id; + private String name; + private String version; + private DevicePackageUninstallStatus status; /** * Get the package identifier @@ -37,14 +41,18 @@ public interface DevicePackageUninstallOperation { * @return */ @XmlElement(name = "id") - KapuaId getId(); + public KapuaId getId() { + return id; + } /** * Set the package identifier * * @param id */ - void setId(KapuaId id); + public void setId(KapuaId id) { + this.id = id; + } /** * Get the package name @@ -52,14 +60,18 @@ public interface DevicePackageUninstallOperation { * @return */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Set the package name * * @param packageName */ - void setName(String packageName); + public void setName(String packageName) { + this.name = packageName; + } /** * Get the package version @@ -67,14 +79,18 @@ public interface DevicePackageUninstallOperation { * @return */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Set the package version * * @param version */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Get the package uninstall status @@ -82,12 +98,17 @@ public interface DevicePackageUninstallOperation { * @return */ @XmlElement(name = "status") - DevicePackageUninstallStatus getStatus(); + public DevicePackageUninstallStatus getStatus() { + return status; + } /** * Set the package uninstall status * * @param status */ - void setStatus(DevicePackageUninstallStatus status); + public void setStatus(DevicePackageUninstallStatus status) { + this.status = status; + } + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOptions.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOptions.java index 405b00e5b37..981ad7d383c 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOptions.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallOptions.java @@ -19,5 +19,6 @@ * * @since 1.1.0 */ -public interface DevicePackageUninstallOptions extends DevicePackageOptions { +public class DevicePackageUninstallOptions extends DevicePackageOptions { + } diff --git a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallRequest.java b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallRequest.java index 6e4cebf5dc0..fd546d84474 100644 --- a/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallRequest.java +++ b/service/device/management/packages/api/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/DevicePackageUninstallRequest.java @@ -12,8 +12,6 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.model.uninstall; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageXmlRegistry; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -31,10 +29,14 @@ "name", "version", "reboot", - "rebootDelay" }, - factoryClass = DevicePackageXmlRegistry.class, - factoryMethod = "newDevicePackageUninstallRequest") -public interface DevicePackageUninstallRequest { + "rebootDelay" }) +public class DevicePackageUninstallRequest { + + public String name; + public String version; + + public Boolean reboot; + public Integer rebootDelay; /** * Get package name @@ -42,14 +44,18 @@ public interface DevicePackageUninstallRequest { * @return */ @XmlElement(name = "name") - String getName(); + public String getName() { + return name; + } /** * Set package name * * @param name */ - void setName(String name); + public void setName(String name) { + this.name = name; + } /** * Get package version @@ -57,14 +63,18 @@ public interface DevicePackageUninstallRequest { * @return */ @XmlElement(name = "version") - String getVersion(); + public String getVersion() { + return version; + } /** * Set package version * * @param version */ - void setVersion(String version); + public void setVersion(String version) { + this.version = version; + } /** * Get the device reboot flag @@ -72,14 +82,18 @@ public interface DevicePackageUninstallRequest { * @return */ @XmlElement(name = "reboot") - Boolean isReboot(); + public Boolean isReboot() { + return reboot; + } /** * Set the device reboot flag * * @param reboot */ - void setReboot(Boolean reboot); + public void setReboot(Boolean reboot) { + this.reboot = reboot; + } /** * Get the reboot delay @@ -87,12 +101,17 @@ public interface DevicePackageUninstallRequest { * @return */ @XmlElement(name = "rebootDelay") - Integer getRebootDelay(); + public Integer getRebootDelay() { + return rebootDelay; + } /** * Set the reboot delay * * @param rebootDelay */ - void setRebootDelay(Integer rebootDelay); + public void setRebootDelay(Integer rebootDelay) { + this.rebootDelay = rebootDelay; + } + } diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DeviceManagementPackagesModule.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DeviceManagementPackagesModule.java index 32ad41abbdb..c7994fc7d7d 100644 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DeviceManagementPackagesModule.java +++ b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DeviceManagementPackagesModule.java @@ -20,7 +20,6 @@ import org.eclipse.kapua.commons.core.SimpleJaxbClassProvider; import org.eclipse.kapua.commons.jpa.KapuaJpaTxManagerFactory; import org.eclipse.kapua.service.authorization.AuthorizationService; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.internal.setting.PackageManagementServiceSetting; import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallRequest; @@ -37,7 +36,6 @@ public class DeviceManagementPackagesModule extends AbstractKapuaModule { @Override protected void configureModule() { - bind(DevicePackageFactory.class).to(DevicePackageFactoryImpl.class).in(Singleton.class); bind(PackageManagementServiceSetting.class).in(Singleton.class); final Multibinder jaxbClassProviderMultibinder = Multibinder.newSetBinder(binder(), JaxbClassProvider.class); jaxbClassProviderMultibinder.addBinding() @@ -56,7 +54,6 @@ DevicePackageManagementService devicePackageManagementService( DeviceRegistryService deviceRegistryService, DeviceManagementOperationRegistryService deviceManagementOperationRegistryService, DeviceManagementOperationFactory deviceManagementOperationFactory, - DevicePackageFactory devicePackageFactory, KapuaJpaTxManagerFactory jpaTxManagerFactory, PackageManagementServiceSetting packageManagementServiceSetting ) { @@ -68,7 +65,6 @@ DevicePackageManagementService devicePackageManagementService( deviceRegistryService, deviceManagementOperationRegistryService, deviceManagementOperationFactory, - devicePackageFactory, packageManagementServiceSetting ); } diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageFactoryImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageFactoryImpl.java deleted file mode 100644 index 27ebc05a402..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageFactoryImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.internal; - -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfos; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackages; -import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; -import org.eclipse.kapua.service.device.management.packages.model.download.internal.AdvancedPackageDownloadOptionsImpl; -import org.eclipse.kapua.service.device.management.packages.model.download.internal.DevicePackageDownloadOperationImpl; -import org.eclipse.kapua.service.device.management.packages.model.download.internal.DevicePackageDownloadOptionsImpl; -import org.eclipse.kapua.service.device.management.packages.model.download.internal.DevicePackageDownloadRequestImpl; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOptions; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallRequest; -import org.eclipse.kapua.service.device.management.packages.model.install.internal.DevicePackageInstallOperationImpl; -import org.eclipse.kapua.service.device.management.packages.model.install.internal.DevicePackageInstallOptionsImpl; -import org.eclipse.kapua.service.device.management.packages.model.install.internal.DevicePackageInstallRequestImpl; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageBundleInfoImpl; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageBundleInfosImpl; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageImpl; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackagesImpl; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOptions; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.internal.DevicePackageUninstallOperationImpl; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.internal.DevicePackageUninstallOptionsImpl; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.internal.DevicePackageUninstallRequestImpl; - -import javax.inject.Singleton; - -/** - * {@link DevicePackageFactory} implementation. - * - * @since 1.0.0 - */ -@Singleton -public class DevicePackageFactoryImpl implements DevicePackageFactory { - - @Override - public DevicePackages newDeviceDeploymentPackages() { - return new DevicePackagesImpl(); - } - - @Override - public DevicePackage newDeviceDeploymentPackage() { - return new DevicePackageImpl(); - } - - @Override - public DevicePackageBundleInfo newDevicePackageBundleInfo() { - return new DevicePackageBundleInfoImpl(); - } - - @Override - public DevicePackageBundleInfos newDevicePackageBundleInfos() { - return new DevicePackageBundleInfosImpl(); - } - - // Download operation - @Override - public DevicePackageDownloadRequest newPackageDownloadRequest() { - return new DevicePackageDownloadRequestImpl(); - } - - @Override - public DevicePackageDownloadOperation newPackageDownloadOperation() { - return new DevicePackageDownloadOperationImpl(); - } - - @Override - public DevicePackageDownloadOptions newPackageDownloadOptions() { - return new DevicePackageDownloadOptionsImpl(); - } - - @Override - public AdvancedPackageDownloadOptions newAdvancedPackageDownloadOptions() { - return new AdvancedPackageDownloadOptionsImpl(); - } - - // Install operation - @Override - public DevicePackageInstallRequest newPackageInstallRequest() { - return new DevicePackageInstallRequestImpl(); - } - - @Override - public DevicePackageInstallOptions newPackageInstallOptions() { - return new DevicePackageInstallOptionsImpl(); - } - - @Override - public DevicePackageInstallOperation newPackageInstallOperation() { - return new DevicePackageInstallOperationImpl(); - } - - // Uninstall operation - @Override - public DevicePackageUninstallRequest newPackageUninstallRequest() { - return new DevicePackageUninstallRequestImpl(); - } - - @Override - public DevicePackageUninstallOptions newPackageUninstallOptions() { - return new DevicePackageUninstallOptionsImpl(); - } - - @Override - public DevicePackageUninstallOperation newPackageUninstallOperation() { - return new DevicePackageUninstallOperationImpl(); - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageManagementServiceImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageManagementServiceImpl.java index 9cbc1dbec2f..3aa37d401c3 100644 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageManagementServiceImpl.java +++ b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/internal/DevicePackageManagementServiceImpl.java @@ -40,7 +40,6 @@ import org.eclipse.kapua.service.device.management.message.notification.NotifyStatus; import org.eclipse.kapua.service.device.management.message.request.KapuaRequestMessage; import org.eclipse.kapua.service.device.management.message.response.KapuaResponseMessage; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.internal.setting.PackageManagementServiceSetting; import org.eclipse.kapua.service.device.management.packages.internal.setting.PackageManagementServiceSettingKeys; @@ -56,7 +55,6 @@ import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; -import org.eclipse.kapua.service.device.management.packages.model.download.internal.DevicePackageDownloadOperationImpl; import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOperation; import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOptions; import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallRequest; @@ -91,7 +89,6 @@ public class DevicePackageManagementServiceImpl extends AbstractDeviceManagement private final DeviceManagementOperationRegistryService deviceManagementOperationRegistryService; private final DeviceManagementOperationFactory deviceManagementOperationFactory; - private final DevicePackageFactory devicePackageFactory; private static final String SCOPE_ID = "scopeId"; private static final String DEVICE_ID = "deviceId"; @@ -105,7 +102,6 @@ public DevicePackageManagementServiceImpl( DeviceRegistryService deviceRegistryService, DeviceManagementOperationRegistryService deviceManagementOperationRegistryService, DeviceManagementOperationFactory deviceManagementOperationFactory, - DevicePackageFactory devicePackageFactory, PackageManagementServiceSetting packageManagementServiceSetting) { super(txManager, authorizationService, @@ -114,7 +110,6 @@ public DevicePackageManagementServiceImpl( deviceRegistryService); this.deviceManagementOperationRegistryService = deviceManagementOperationRegistryService; this.deviceManagementOperationFactory = deviceManagementOperationFactory; - this.devicePackageFactory = devicePackageFactory; this.packageManagementServiceSetting = packageManagementServiceSetting; } // Installed @@ -161,13 +156,13 @@ public DevicePackages getInstalled(KapuaId scopeId, KapuaId deviceId, Long timeo // Create event createDeviceEvent(scopeId, deviceId, packageRequestMessage, responseMessage); // Check response - return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackages().orElse(devicePackageFactory.newDeviceDeploymentPackages())); + return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackages().orElse(new DevicePackages())); } // Download @Override public KapuaId downloadExec(KapuaId scopeId, KapuaId deviceId, DevicePackageDownloadRequest packageDownloadRequest, Long timeout) throws KapuaException { - DevicePackageDownloadOptions packageDownloadOptions = devicePackageFactory.newPackageDownloadOptions(); + DevicePackageDownloadOptions packageDownloadOptions = new DevicePackageDownloadOptions(); packageDownloadOptions.setTimeout(timeout); return downloadExec(scopeId, deviceId, packageDownloadRequest, packageDownloadOptions); @@ -314,7 +309,7 @@ public DevicePackageDownloadOperation downloadStatus(KapuaId scopeId, KapuaId de return checkResponseAcceptedOrThrowError(responseMessage, () -> { PackageResponsePayload responsePayload = responseMessage.getPayload(); - DevicePackageDownloadOperation downloadOperation = new DevicePackageDownloadOperationImpl(); + DevicePackageDownloadOperation downloadOperation = new DevicePackageDownloadOperation(); downloadOperation.setId(responsePayload.getPackageDownloadOperationId()); downloadOperation.setStatus(responsePayload.getPackageDownloadOperationStatus()); downloadOperation.setSize(responsePayload.getPackageDownloadOperationSize()); @@ -372,7 +367,7 @@ public void downloadStop(KapuaId scopeId, KapuaId deviceId, Long timeout) throws @Override public KapuaId installExec(KapuaId scopeId, KapuaId deviceId, DevicePackageInstallRequest packageInstallRequest, Long timeout) throws KapuaException { - DevicePackageInstallOptions packageInstallOptions = devicePackageFactory.newPackageInstallOptions(); + DevicePackageInstallOptions packageInstallOptions = new DevicePackageInstallOptions(); packageInstallOptions.setTimeout(timeout); return installExec(scopeId, deviceId, packageInstallRequest, packageInstallOptions); @@ -483,13 +478,13 @@ public DevicePackageInstallOperation installStatus(KapuaId scopeId, KapuaId devi // Create event createDeviceEvent(scopeId, deviceId, packageRequestMessage, responseMessage); // Check response - return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackageInstallOperation().orElse(devicePackageFactory.newPackageInstallOperation())); + return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackageInstallOperation().orElse(new DevicePackageInstallOperation())); } // Uninstall @Override public KapuaId uninstallExec(KapuaId scopeId, KapuaId deviceId, DevicePackageUninstallRequest packageUninstallRequest, Long timeout) throws KapuaException { - DevicePackageUninstallOptions packageUninstallOptions = devicePackageFactory.newPackageUninstallOptions(); + DevicePackageUninstallOptions packageUninstallOptions = new DevicePackageUninstallOptions(); packageUninstallOptions.setTimeout(timeout); return uninstallExec(scopeId, deviceId, packageUninstallRequest, packageUninstallOptions); @@ -601,7 +596,7 @@ public DevicePackageUninstallOperation uninstallStatus(KapuaId scopeId, KapuaId // Create event createDeviceEvent(scopeId, deviceId, packageRequestMessage, responseMessage); // Check response - return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackageUninstallOperation().orElse(devicePackageFactory.newPackageUninstallOperation())); + return checkResponseAcceptedOrThrowError(responseMessage, () -> responseMessage.getPayload().getDevicePackageUninstallOperation().orElse(new DevicePackageUninstallOperation())); } private void verifyOverflowPackageFields(DevicePackageDownloadRequest packageDownloadRequest) throws KapuaIllegalArgumentException { diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/AdvancedPackageDownloadOptionsImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/AdvancedPackageDownloadOptionsImpl.java deleted file mode 100644 index 9974d18459d..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/AdvancedPackageDownloadOptionsImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.download.internal; - -import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; - -/** - * {@link AdvancedPackageDownloadOptions} implementation. - * - * @since 1.1.0 - */ -public class AdvancedPackageDownloadOptionsImpl implements AdvancedPackageDownloadOptions { - - private Boolean restart; - private Integer blockSize; - private Integer blockDelay; - private Integer blockTimeout; - private Integer notifyBlockSize; - private String installVerifierURI; - - /** - * Constructor. - * - * @since 1.1.0 - */ - public AdvancedPackageDownloadOptionsImpl() { - } - - /** - * Clone Constructor. - * - * @param advancedPackageDownloadOptions The {@link AdvancedPackageDownloadOptions} to clone. - * @since 1.1.0 - */ - public AdvancedPackageDownloadOptionsImpl(AdvancedPackageDownloadOptions advancedPackageDownloadOptions) { - super(); - - setRestart(advancedPackageDownloadOptions.getRestart()); - setBlockSize(advancedPackageDownloadOptions.getBlockSize()); - setBlockDelay(advancedPackageDownloadOptions.getBlockDelay()); - setBlockTimeout(advancedPackageDownloadOptions.getBlockTimeout()); - setNotifyBlockSize(advancedPackageDownloadOptions.getNotifyBlockSize()); - setInstallVerifierURI(advancedPackageDownloadOptions.getInstallVerifierURI()); - } - - @Override - public Boolean getRestart() { - return restart; - } - - @Override - public void setRestart(Boolean restart) { - this.restart = restart; - } - - @Override - public Integer getBlockSize() { - return blockSize; - } - - @Override - public void setBlockSize(Integer blockSize) { - this.blockSize = blockSize; - } - - @Override - public Integer getBlockDelay() { - return blockDelay; - } - - @Override - public void setBlockDelay(Integer blockDelay) { - this.blockDelay = blockDelay; - } - - @Override - public Integer getBlockTimeout() { - return blockTimeout; - } - - @Override - public void setBlockTimeout(Integer blockTimeout) { - this.blockTimeout = blockTimeout; - } - - @Override - public Integer getNotifyBlockSize() { - return notifyBlockSize; - } - - @Override - public void setNotifyBlockSize(Integer notifyBlockSize) { - this.notifyBlockSize = notifyBlockSize; - } - - @Override - public String getInstallVerifierURI() { - return installVerifierURI; - } - - @Override - public void setInstallVerifierURI(String installVerifierURI) { - this.installVerifierURI = installVerifierURI; - } - - public static AdvancedPackageDownloadOptionsImpl parse(AdvancedPackageDownloadOptions advancedPackageDownloadOptions) { - return advancedPackageDownloadOptions != null ? (advancedPackageDownloadOptions instanceof AdvancedPackageDownloadOptionsImpl ? (AdvancedPackageDownloadOptionsImpl) advancedPackageDownloadOptions : new AdvancedPackageDownloadOptionsImpl(advancedPackageDownloadOptions)) : null; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOperationImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOperationImpl.java deleted file mode 100644 index 8f067a9cbe8..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOperationImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.download.internal; - -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOperation; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadStatus; - -/** - * Device download package operation entity. - * - * @since 1.0 - */ -public class DevicePackageDownloadOperationImpl implements DevicePackageDownloadOperation { - - - private KapuaId id; - private Integer size; - private Integer progress; - private DevicePackageDownloadStatus status; - - /** - * Constructor. - * - * @since 1.0.0 - */ - public DevicePackageDownloadOperationImpl() { - } - - @Override - public KapuaId getId() { - return id; - } - - @Override - public void setId(KapuaId id) { - this.id = id; - } - - @Override - public Integer getSize() { - return size; - } - - @Override - public void setSize(Integer size) { - this.size = size; - } - - @Override - public Integer getProgress() { - return progress; - } - - @Override - public void setProgress(Integer progress) { - this.progress = progress; - } - - @Override - public DevicePackageDownloadStatus getStatus() { - return status; - } - - @Override - public void setStatus(DevicePackageDownloadStatus status) { - this.status = status; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOptionsImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOptionsImpl.java deleted file mode 100644 index 80ae4602392..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadOptionsImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.download.internal; - -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageOptionsImpl; - -/** - * {@link DevicePackageDownloadOptions} implementation. - * - * @since 1.1.0 - */ -public class DevicePackageDownloadOptionsImpl extends DevicePackageOptionsImpl implements DevicePackageDownloadOptions { -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadRequestImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadRequestImpl.java deleted file mode 100644 index fb272a0cb26..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/download/internal/DevicePackageDownloadRequestImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.download.internal; - -import org.eclipse.kapua.service.device.management.packages.model.FileType; -import org.eclipse.kapua.service.device.management.packages.model.download.AdvancedPackageDownloadOptions; -import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadRequest; - -import java.net.URI; - -/** - * {@link DevicePackageDownloadRequest} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageDownloadRequestImpl implements DevicePackageDownloadRequest { - - private URI uri; - private String name; - private String version; - - private String username; - private String password; - - private String fileHash; - private FileType fileType; - - private Boolean install; - - private Boolean reboot; - private Integer rebootDelay; - - private AdvancedPackageDownloadOptionsImpl advancedOptions; - - @Override - public URI getUri() { - return uri; - } - - @Override - public void setUri(URI uri) { - this.uri = uri; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public Boolean getInstall() { - return install; - } - - @Override - public String getUsername() { - return username; - } - - @Override - public void setUsername(String username) { - this.username = username; - } - - @Override - public String getPassword() { - return password; - } - - @Override - public void setPassword(String password) { - this.password = password; - } - - @Override - public String getFileHash() { - return fileHash; - } - - @Override - public void setFileHash(String fileHash) { - this.fileHash = fileHash; - } - - @Override - public FileType getFileType() { - return fileType; - } - - @Override - public void setFileType(FileType fileType) { - this.fileType = fileType; - } - - @Override - public void setInstall(Boolean install) { - this.install = install; - } - - @Override - public Boolean getReboot() { - return reboot; - } - - @Override - public void setReboot(Boolean reboot) { - this.reboot = reboot; - } - - @Override - public Integer getRebootDelay() { - return rebootDelay; - } - - @Override - public void setRebootDelay(Integer rebootDelay) { - this.rebootDelay = rebootDelay; - } - - @Override - public AdvancedPackageDownloadOptions getAdvancedOptions() { - if (advancedOptions == null) { - advancedOptions = new AdvancedPackageDownloadOptionsImpl(); - } - - return advancedOptions; - } - - @Override - public void setAdvancedOptions(AdvancedPackageDownloadOptions advancedOptions) { - this.advancedOptions = AdvancedPackageDownloadOptionsImpl.parse(advancedOptions); - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOperationImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOperationImpl.java deleted file mode 100644 index c018ff3544e..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOperationImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.install.internal; - -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallStatus; - -/** - * {@link DevicePackageInstallOperation} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageInstallOperationImpl implements DevicePackageInstallOperation { - - private KapuaId id; - private String name; - private String version; - private DevicePackageInstallStatus status; - - @Override - public KapuaId getId() { - return id; - } - - @Override - public void setId(KapuaId id) { - this.id = id; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public DevicePackageInstallStatus getStatus() { - return status; - } - - @Override - public void setStatus(DevicePackageInstallStatus status) { - this.status = status; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOptionsImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOptionsImpl.java deleted file mode 100644 index eb7fee1f396..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallOptionsImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.install.internal; - -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallOptions; -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageOptionsImpl; - -/** - * {@link DevicePackageInstallOptions} implementation - * - * @since 1.1.0 - */ -public class DevicePackageInstallOptionsImpl extends DevicePackageOptionsImpl implements DevicePackageInstallOptions { -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallRequestImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallRequestImpl.java deleted file mode 100644 index 57d5b2ff5cd..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/install/internal/DevicePackageInstallRequestImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.install.internal; - -import org.eclipse.kapua.service.device.management.packages.model.install.DevicePackageInstallRequest; - -/** - * Device package install request. - * - * @since 1.0 - * - */ -public class DevicePackageInstallRequestImpl implements DevicePackageInstallRequest { - - private String name; - private String version; - private Boolean reboot; - private Integer rebootDelay; - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public Boolean isReboot() { - return reboot; - } - - @Override - public void setReboot(Boolean reboot) { - this.reboot = reboot; - } - - @Override - public Integer getRebootDelay() { - return rebootDelay; - } - - @Override - public void setRebootDelay(Integer rebootDelay) { - this.rebootDelay = rebootDelay; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfoImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfoImpl.java deleted file mode 100644 index 7f6c725fa2e..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfoImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.internal; - -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; - -/** - * {@link DevicePackageBundleInfo} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageBundleInfoImpl implements DevicePackageBundleInfo { - - public String name; - public String version; - - /** - * Constructor. - * - * @since 1.0.0 - */ - public DevicePackageBundleInfoImpl() { - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfosImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfosImpl.java deleted file mode 100644 index 971a0ed28c0..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageBundleInfosImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.internal; - -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfo; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfos; - -import java.util.ArrayList; -import java.util.List; - -/** - * {@link DevicePackageBundleInfos} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageBundleInfosImpl implements DevicePackageBundleInfos { - - List bundleInfos; - - /** - * Constructor. - * - * @since 1.0.0 - */ - public DevicePackageBundleInfosImpl() { - } - - @Override - public List getBundlesInfos() { - if (bundleInfos == null) { - bundleInfos = new ArrayList<>(); - } - return bundleInfos; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageImpl.java deleted file mode 100644 index 692a2bb3486..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.internal; - -import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageBundleInfos; - -import java.util.Date; - -/** - * {@link DevicePackage} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageImpl implements DevicePackage { - - private String name; - private String version; - private DevicePackageBundleInfos bundleInfos; - private Date installDate; - - /** - * Constructor. - * - * @since 1.0.0 - */ - public DevicePackageImpl() { - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public DevicePackageBundleInfos getBundleInfos() { - if (bundleInfos == null) { - bundleInfos = new DevicePackageBundleInfosImpl(); - } - - return bundleInfos; - } - - @Override - public void setBundleInfos(DevicePackageBundleInfos bundleInfos) { - this.bundleInfos = bundleInfos; - } - - @Override - public Date getInstallDate() { - return installDate; - } - - @Override - public void setInstallDate(Date installDate) { - this.installDate = installDate; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageOptionsImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageOptionsImpl.java deleted file mode 100644 index 85c0043e552..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackageOptionsImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.internal; - -import org.eclipse.kapua.service.device.management.packages.model.DevicePackageOptions; - -/** - * {@link DevicePackageOptions} {@code abstract} implementation. - * - * @since 1.1.0 - */ -public abstract class DevicePackageOptionsImpl implements DevicePackageOptions { - - private Long timeout; - - @Override - public Long getTimeout() { - return timeout; - } - - @Override - public void setTimeout(Long timeout) { - this.timeout = timeout; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackagesImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackagesImpl.java deleted file mode 100644 index 08c80aa6e81..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/internal/DevicePackagesImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - * Red Hat Inc - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.internal; - -import org.eclipse.kapua.service.device.management.packages.model.DevicePackage; -import org.eclipse.kapua.service.device.management.packages.model.DevicePackages; - -import java.util.ArrayList; -import java.util.List; - -/** - * {@link DevicePackages} implementation. - * - * @since 1.0.0 - */ -public class DevicePackagesImpl implements DevicePackages { - - private static final long serialVersionUID = 2450088980495469562L; - - public List deploymentPackages; - - @Override - public List getPackages() { - if (deploymentPackages == null) { - deploymentPackages = new ArrayList<>(); - } - - return deploymentPackages; - } - -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOperationImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOperationImpl.java deleted file mode 100644 index 59c5aaee911..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOperationImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.uninstall.internal; - -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOperation; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallStatus; - -/** - * {@link DevicePackageUninstallOperation} implementation. - * - * @since 1.0.0 - */ -public class DevicePackageUninstallOperationImpl implements DevicePackageUninstallOperation { - - private KapuaId id; - private String name; - private String version; - private DevicePackageUninstallStatus status; - - @Override - public KapuaId getId() { - return id; - } - - @Override - public void setId(KapuaId id) { - this.id = id; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public DevicePackageUninstallStatus getStatus() { - return status; - } - - @Override - public void setStatus(DevicePackageUninstallStatus status) { - this.status = status; - } -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOptionsImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOptionsImpl.java deleted file mode 100644 index 83c70875213..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallOptionsImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.uninstall.internal; - -import org.eclipse.kapua.service.device.management.packages.model.internal.DevicePackageOptionsImpl; -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOptions; - -/** - * {@link DevicePackageUninstallOptions} implementation. - * - * @since 1.1.0 - */ -public class DevicePackageUninstallOptionsImpl extends DevicePackageOptionsImpl implements DevicePackageUninstallOptions { -} diff --git a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallRequestImpl.java b/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallRequestImpl.java deleted file mode 100644 index 468c96f19a1..00000000000 --- a/service/device/management/packages/internal/src/main/java/org/eclipse/kapua/service/device/management/packages/model/uninstall/internal/DevicePackageUninstallRequestImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Eurotech - initial API and implementation - *******************************************************************************/ -package org.eclipse.kapua.service.device.management.packages.model.uninstall.internal; - -import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallRequest; - -/** - * Device package uninstall request. - * - * @since 1.0 - * - */ -public class DevicePackageUninstallRequestImpl implements DevicePackageUninstallRequest { - - public String name; - public String version; - - public Boolean reboot; - public Integer rebootDelay; - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public void setVersion(String version) { - this.version = version; - } - - @Override - public Boolean isReboot() { - return reboot; - } - - @Override - public void setReboot(Boolean reboot) { - this.reboot = reboot; - } - - @Override - public Integer getRebootDelay() { - return rebootDelay; - } - - @Override - public void setRebootDelay(Integer rebootDelay) { - this.rebootDelay = rebootDelay; - } -} diff --git a/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageDownloadTargetProcessor.java b/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageDownloadTargetProcessor.java index cc868c49c1f..fd1ea813b7f 100644 --- a/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageDownloadTargetProcessor.java +++ b/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageDownloadTargetProcessor.java @@ -12,11 +12,14 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.job; +import javax.batch.runtime.context.JobContext; +import javax.batch.runtime.context.StepContext; +import javax.inject.Inject; + import org.eclipse.kapua.KapuaException; import org.eclipse.kapua.commons.security.KapuaSecurityUtils; import org.eclipse.kapua.job.engine.commons.wrappers.JobTargetWrapper; import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.job.definition.DevicePackageDownloadPropertyKeys; import org.eclipse.kapua.service.device.management.packages.model.download.DevicePackageDownloadOptions; @@ -25,10 +28,6 @@ import org.eclipse.kapua.service.job.targets.JobTarget; import org.eclipse.kapua.service.job.targets.JobTargetStatus; -import javax.batch.runtime.context.JobContext; -import javax.batch.runtime.context.StepContext; -import javax.inject.Inject; - /** * {@link TargetProcessor} for {@link DevicePackageManagementService#downloadExec(KapuaId, KapuaId, DevicePackageDownloadRequest, Long)}. * @@ -39,8 +38,6 @@ public class DevicePackageDownloadTargetProcessor extends AbstractDevicePackageT @Inject DevicePackageManagementService devicePackageManagementService; @Inject - DevicePackageFactory devicePackageFactory; - @Inject JobContext jobContext; @Inject StepContext stepContext; @@ -63,7 +60,7 @@ public void processTarget(JobTarget jobTarget) throws KapuaException { DevicePackageDownloadRequest packageDownloadRequest = stepContextWrapper.getStepProperty(DevicePackageDownloadPropertyKeys.PACKAGE_DOWNLOAD_REQUEST, DevicePackageDownloadRequest.class); Long timeout = stepContextWrapper.getStepProperty(DevicePackageDownloadPropertyKeys.TIMEOUT, Long.class); // Send the request - DevicePackageDownloadOptions packageDownloadOptions = devicePackageFactory.newPackageDownloadOptions(); + DevicePackageDownloadOptions packageDownloadOptions = new DevicePackageDownloadOptions(); packageDownloadOptions.setTimeout(timeout); KapuaId operationId = KapuaSecurityUtils.doPrivileged(() -> devicePackageManagementService.downloadExec(scopeId, jobTarget.getJobTargetId(), packageDownloadRequest, packageDownloadOptions)); diff --git a/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageUninstallTargetProcessor.java b/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageUninstallTargetProcessor.java index 1b8d9171a2c..c1a50784a9e 100644 --- a/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageUninstallTargetProcessor.java +++ b/service/device/management/packages/job/src/main/java/org/eclipse/kapua/service/device/management/packages/job/DevicePackageUninstallTargetProcessor.java @@ -12,11 +12,14 @@ *******************************************************************************/ package org.eclipse.kapua.service.device.management.packages.job; +import javax.batch.runtime.context.JobContext; +import javax.batch.runtime.context.StepContext; +import javax.inject.Inject; + import org.eclipse.kapua.KapuaException; import org.eclipse.kapua.commons.security.KapuaSecurityUtils; import org.eclipse.kapua.job.engine.commons.wrappers.JobTargetWrapper; import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.DevicePackageManagementService; import org.eclipse.kapua.service.device.management.packages.job.definition.DevicePackageUninstallPropertyKeys; import org.eclipse.kapua.service.device.management.packages.model.uninstall.DevicePackageUninstallOptions; @@ -25,10 +28,6 @@ import org.eclipse.kapua.service.job.targets.JobTarget; import org.eclipse.kapua.service.job.targets.JobTargetStatus; -import javax.batch.runtime.context.JobContext; -import javax.batch.runtime.context.StepContext; -import javax.inject.Inject; - /** * {@link TargetProcessor} for {@link DevicePackageManagementService#uninstallExec(KapuaId, KapuaId, DevicePackageUninstallRequest, Long)}. * @@ -39,8 +38,6 @@ public class DevicePackageUninstallTargetProcessor extends AbstractDevicePackage @Inject DevicePackageManagementService devicePackageManagementService; @Inject - DevicePackageFactory devicePackageFactory; - @Inject JobContext jobContext; @Inject StepContext stepContext; @@ -59,10 +56,11 @@ public void processTarget(JobTarget jobTarget) throws KapuaException { DevicePackageUninstallRequest packageUninstallRequest = stepContextWrapper.getStepProperty(DevicePackageUninstallPropertyKeys.PACKAGE_UNINSTALL_REQUEST, DevicePackageUninstallRequest.class); Long timeout = stepContextWrapper.getStepProperty(DevicePackageUninstallPropertyKeys.TIMEOUT, Long.class); // Send the request - DevicePackageUninstallOptions packageUninstallOptions = devicePackageFactory.newPackageUninstallOptions(); + DevicePackageUninstallOptions packageUninstallOptions = new DevicePackageUninstallOptions(); packageUninstallOptions.setTimeout(timeout); - KapuaId operationId = KapuaSecurityUtils.doPrivileged(() -> devicePackageManagementService.uninstallExec(scopeId, jobTarget.getJobTargetId(), packageUninstallRequest, packageUninstallOptions)); + KapuaId operationId = KapuaSecurityUtils.doPrivileged( + () -> devicePackageManagementService.uninstallExec(scopeId, jobTarget.getJobTargetId(), packageUninstallRequest, packageUninstallOptions)); // Save the jobId-deviceManagementOperationId pair to track resuming createJobDeviceManagementOperation(scopeId, jobId, jobTarget, operationId); } diff --git a/service/device/registry/internal/src/main/java/org/eclipse/kapua/service/device/registry/common/DeviceValidationImpl.java b/service/device/registry/internal/src/main/java/org/eclipse/kapua/service/device/registry/common/DeviceValidationImpl.java index 40a9cd58eca..328337a0e7e 100644 --- a/service/device/registry/internal/src/main/java/org/eclipse/kapua/service/device/registry/common/DeviceValidationImpl.java +++ b/service/device/registry/internal/src/main/java/org/eclipse/kapua/service/device/registry/common/DeviceValidationImpl.java @@ -20,7 +20,6 @@ import org.eclipse.kapua.commons.security.KapuaSecurityUtils; import org.eclipse.kapua.commons.util.ArgumentValidator; import org.eclipse.kapua.model.KapuaEntityAttributes; -import org.eclipse.kapua.model.KapuaUpdatableEntity; import org.eclipse.kapua.model.domain.Actions; import org.eclipse.kapua.model.id.KapuaId; import org.eclipse.kapua.model.query.KapuaQuery; @@ -260,7 +259,7 @@ public void validateCreatePreconditions(DeviceCreator deviceCreator) throws Kapu } /** - * Validates the {@link Device} for {@link DeviceRegistryService#update(KapuaUpdatableEntity)} operation. + * Validates the {@link Device} for {@link DeviceRegistryService#update(Object)} operation. * * @param device * The {@link Device} to validate. diff --git a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/TranslatorAppPackageKuraKapua.java b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/TranslatorAppPackageKuraKapua.java index 10d46a278a8..a5e239d2ca4 100644 --- a/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/TranslatorAppPackageKuraKapua.java +++ b/translator/kapua/kura/src/main/java/org/eclipse/kapua/translator/kura/kapua/TranslatorAppPackageKuraKapua.java @@ -13,6 +13,11 @@ *******************************************************************************/ package org.eclipse.kapua.translator.kura.kapua; +import java.math.BigInteger; +import java.util.Map; + +import javax.inject.Inject; + import org.eclipse.kapua.commons.model.id.KapuaEid; import org.eclipse.kapua.service.device.call.kura.model.deploy.KuraBundleInfo; import org.eclipse.kapua.service.device.call.kura.model.deploy.KuraDeploymentPackage; @@ -23,7 +28,6 @@ import org.eclipse.kapua.service.device.call.message.kura.app.response.KuraResponseMessage; import org.eclipse.kapua.service.device.call.message.kura.app.response.KuraResponsePayload; import org.eclipse.kapua.service.device.management.commons.setting.DeviceManagementSetting; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.packages.message.internal.PackageResponseChannel; import org.eclipse.kapua.service.device.management.packages.message.internal.PackageResponseMessage; import org.eclipse.kapua.service.device.management.packages.message.internal.PackageResponsePayload; @@ -37,10 +41,6 @@ import org.eclipse.kapua.translator.exception.TranslatorErrorCodes; import org.eclipse.kapua.translator.exception.TranslatorException; -import javax.inject.Inject; -import java.math.BigInteger; -import java.util.Map; - /** * {@link org.eclipse.kapua.translator.Translator} implementation from {@link KuraResponseMessage} to {@link PackageResponseMessage} * @@ -48,12 +48,9 @@ */ public class TranslatorAppPackageKuraKapua extends AbstractSimpleTranslatorResponseKuraKapua { - private final DevicePackageFactory devicePackageFactory; - @Inject - public TranslatorAppPackageKuraKapua(DeviceManagementSetting deviceManagementSetting, DevicePackageFactory devicePackageFactory) { + public TranslatorAppPackageKuraKapua(DeviceManagementSetting deviceManagementSetting) { super(deviceManagementSetting, PackageResponseMessage.class, PackageResponsePayload.class); - this.devicePackageFactory = devicePackageFactory; } @Override @@ -84,18 +81,18 @@ protected PackageResponsePayload translatePayload(KuraResponsePayload kuraRespon String kuraStatus = (String) metrics.get(PackageMetrics.APP_METRIC_PACKAGE_DOWNLOAD_STATUS.getName()); switch (kuraStatus) { - case "IN_PROGRESS": - status = DevicePackageDownloadStatus.IN_PROGRESS; - break; - case "FAILED": - status = DevicePackageDownloadStatus.FAILED; - break; - case "COMPLETED": - case "ALREADY DONE": - status = DevicePackageDownloadStatus.COMPLETED; - break; - default: - throw new TranslatorException(TranslatorErrorCodes.INVALID_PAYLOAD, null, kuraStatus); + case "IN_PROGRESS": + status = DevicePackageDownloadStatus.IN_PROGRESS; + break; + case "FAILED": + status = DevicePackageDownloadStatus.FAILED; + break; + case "COMPLETED": + case "ALREADY DONE": + status = DevicePackageDownloadStatus.COMPLETED; + break; + default: + throw new TranslatorException(TranslatorErrorCodes.INVALID_PAYLOAD, null, kuraStatus); } responsePayload.setPackageDownloadOperationStatus(status); } @@ -129,18 +126,18 @@ protected PackageResponsePayload translatePayload(KuraResponsePayload kuraRespon } private DevicePackages translate(KuraDeploymentPackages kuraDeploymentPackages) { - DevicePackages deviceDeploymentPackages = devicePackageFactory.newDeviceDeploymentPackages(); + DevicePackages deviceDeploymentPackages = new DevicePackages(); KuraDeploymentPackage[] deploymentPackageArray = kuraDeploymentPackages.getDeploymentPackages(); for (KuraDeploymentPackage deploymentPackage : deploymentPackageArray) { - DevicePackage deviceDeploymentPackage = devicePackageFactory.newDeviceDeploymentPackage(); + DevicePackage deviceDeploymentPackage = new DevicePackage(); deviceDeploymentPackage.setName(deploymentPackage.getName()); deviceDeploymentPackage.setVersion(deploymentPackage.getVersion()); DevicePackageBundleInfos devicePackageBundleInfos = deviceDeploymentPackage.getBundleInfos(); KuraBundleInfo[] bundleInfoArray = deploymentPackage.getBundleInfos(); for (KuraBundleInfo bundleInfo : bundleInfoArray) { - DevicePackageBundleInfo devicePackageBundleInfo = devicePackageFactory.newDevicePackageBundleInfo(); + DevicePackageBundleInfo devicePackageBundleInfo = new DevicePackageBundleInfo(); devicePackageBundleInfo.setName(bundleInfo.getName()); devicePackageBundleInfo.setVersion(bundleInfo.getVersion()); diff --git a/translator/test/src/test/java/org/eclipse/kapua/translator/test/TranslatorLocatorConfiguration.java b/translator/test/src/test/java/org/eclipse/kapua/translator/test/TranslatorLocatorConfiguration.java index dc2b7656c1e..05ecc25f4b8 100644 --- a/translator/test/src/test/java/org/eclipse/kapua/translator/test/TranslatorLocatorConfiguration.java +++ b/translator/test/src/test/java/org/eclipse/kapua/translator/test/TranslatorLocatorConfiguration.java @@ -42,7 +42,6 @@ import org.eclipse.kapua.service.device.management.configuration.DeviceConfigurationFactory; import org.eclipse.kapua.service.device.management.inventory.DeviceInventoryManagementFactory; import org.eclipse.kapua.service.device.management.keystore.DeviceKeystoreManagementFactory; -import org.eclipse.kapua.service.device.management.packages.DevicePackageFactory; import org.eclipse.kapua.service.device.management.request.GenericRequestFactory; import org.eclipse.kapua.service.device.management.snapshot.DeviceSnapshotFactory; import org.eclipse.kapua.service.device.registry.DeviceRegistryService; @@ -105,7 +104,6 @@ protected void configure() { bind(DeviceAssetFactory.class).toInstance(Mockito.mock(DeviceAssetFactory.class)); bind(DeviceBundleFactory.class).toInstance(Mockito.mock(DeviceBundleFactory.class)); bind(KapuaIdFactory.class).toInstance(Mockito.mock(KapuaIdFactory.class)); - bind(DevicePackageFactory.class).toInstance(Mockito.mock(DevicePackageFactory.class)); bind(DeviceSnapshotFactory.class).toInstance(Mockito.mock(DeviceSnapshotFactory.class)); bind(KapuaDataMessageFactory.class).toInstance(Mockito.mock(KapuaDataMessageFactory.class)); bind(DeviceConfigurationFactory.class).toInstance(Mockito.mock(DeviceConfigurationFactory.class));