Skip to content

Commit

Permalink
Modifications on rest API timer setting parameter to reach coherence
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnul97 authored and Coduz committed Mar 1, 2023
1 parent 45ecbd4 commit 52e90a6
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DeviceManagementAssets extends AbstractKapuaResource {
public DeviceAssets get(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return get(scopeId, deviceId, timeout, deviceAssetFilter.newAssetListResult());
}

Expand All @@ -82,7 +82,7 @@ public DeviceAssets get(
public DeviceAssets get(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceAssets deviceAssetFilter) throws KapuaException {
return deviceManagementAssetService.get(scopeId, deviceId, deviceAssetFilter, timeout);
}
Expand All @@ -107,7 +107,7 @@ public DeviceAssets get(
public DeviceAssets read(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceAssets deviceAssetFilter) throws KapuaException {
return deviceManagementAssetService.read(scopeId, deviceId, deviceAssetFilter, timeout);
}
Expand All @@ -132,7 +132,7 @@ public DeviceAssets read(
public DeviceAssets write(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceAssets deviceAssetFilter) throws KapuaException {
return deviceManagementAssetService.write(scopeId, deviceId, deviceAssetFilter, timeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public DeviceBundles get(
@PathParam("deviceId") EntityId deviceId,
@QueryParam("sortParam") String sortParam,
@QueryParam("sortDir") @DefaultValue("ASCENDING") SortOrder sortDir,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
DeviceBundles deviceBundles = bundleService.get(scopeId, deviceId, timeout);
if (!Strings.isNullOrEmpty(sortParam)) {
deviceBundles.getBundles().sort((b1, b2) -> sortBundles(sortParam, sortDir, b1, b2));
Expand Down Expand Up @@ -112,7 +112,7 @@ public Response start(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("bundleId") String bundleId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
bundleService.start(scopeId, deviceId, bundleId, timeout);

return returnNoContent();
Expand All @@ -137,7 +137,7 @@ public Response stop(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("bundleId") String bundleId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
bundleService.stop(scopeId, deviceId, bundleId, timeout);

return returnNoContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class DeviceManagementCommands extends AbstractKapuaResource {
public DeviceCommandOutput sendCommand(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceCommandInput commandInput) throws KapuaException {
return commandService.exec(scopeId, deviceId, commandInput, timeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class DeviceManagementConfigurations extends AbstractKapuaResource {
public DeviceConfiguration get(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return getComponent(scopeId, deviceId, null, timeout);
}

Expand All @@ -84,7 +84,7 @@ public DeviceConfiguration get(
public Response update(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceConfiguration deviceConfiguration) throws KapuaException {
configurationService.put(scopeId, deviceId, deviceConfiguration, timeout);

Expand Down Expand Up @@ -118,7 +118,7 @@ public DeviceConfiguration getComponent(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("componentId") String componentId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return configurationService.get(scopeId, deviceId, null, componentId, timeout);
}

Expand Down Expand Up @@ -151,7 +151,7 @@ public Response updateComponent(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("componentId") String componentId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceComponentConfiguration deviceComponentConfiguration) throws KapuaException {
deviceComponentConfiguration.setId(componentId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class DeviceManagementInventory extends AbstractKapuaResource {
public DeviceInventory getInventory(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return DEVICE_INVENTORY_MANAGEMENT_SERVICE.getInventory(scopeId, deviceId, timeout);
}

Expand All @@ -81,7 +81,7 @@ public DeviceInventory getInventory(
public DeviceInventoryBundles getInventoryBundles(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return DEVICE_INVENTORY_MANAGEMENT_SERVICE.getBundles(scopeId, deviceId, timeout);
}

Expand All @@ -102,7 +102,7 @@ public DeviceInventoryBundles getInventoryBundles(
public Response startInventoryBundles(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceInventoryBundle deviceInventoryBundle) throws KapuaException {

DEVICE_INVENTORY_MANAGEMENT_SERVICE.execBundle(scopeId, deviceId, deviceInventoryBundle, DeviceInventoryBundleAction.START, timeout);
Expand All @@ -127,7 +127,7 @@ public Response startInventoryBundles(
public Response stopInventoryBundles(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceInventoryBundle deviceInventoryBundle) throws KapuaException {

DEVICE_INVENTORY_MANAGEMENT_SERVICE.execBundle(scopeId, deviceId, deviceInventoryBundle, DeviceInventoryBundleAction.STOP, timeout);
Expand All @@ -151,7 +151,7 @@ public Response stopInventoryBundles(
public DeviceInventoryContainers getInventoryContainers(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000")Long timeout) throws KapuaException {
return DEVICE_INVENTORY_MANAGEMENT_SERVICE.getContainers(scopeId, deviceId, timeout);
}

Expand All @@ -172,7 +172,7 @@ public DeviceInventoryContainers getInventoryContainers(
public Response startInventoryContainers(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceInventoryContainer deviceInventoryContainer) throws KapuaException {

DEVICE_INVENTORY_MANAGEMENT_SERVICE.execContainer(scopeId, deviceId, deviceInventoryContainer, DeviceInventoryContainerAction.START, timeout);
Expand All @@ -197,7 +197,7 @@ public Response startInventoryContainers(
public Response stopInventoryContainers(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout,
@QueryParam("timeout") @DefaultValue("30000")Long timeout,
DeviceInventoryContainer deviceInventoryContainer) throws KapuaException {

DEVICE_INVENTORY_MANAGEMENT_SERVICE.execContainer(scopeId, deviceId, deviceInventoryContainer, DeviceInventoryContainerAction.STOP, timeout);
Expand All @@ -221,7 +221,7 @@ public Response stopInventoryContainers(
public DeviceInventoryPackages getInventoryPackages(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000")Long timeout) throws KapuaException {
return DEVICE_INVENTORY_MANAGEMENT_SERVICE.getDeploymentPackages(scopeId, deviceId, timeout);
}

Expand All @@ -241,7 +241,7 @@ public DeviceInventoryPackages getInventoryPackages(
public DeviceInventorySystemPackages getInventorySystemPackages(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return DEVICE_INVENTORY_MANAGEMENT_SERVICE.getSystemPackages(scopeId, deviceId, timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class DeviceManagementKeystores extends AbstractKapuaResource {
public DeviceKeystores getKeystores(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return DEVICE_KEYSTORE_MANAGEMENT_SERVICE.getKeystores(scopeId, deviceId, timeout);
}

Expand All @@ -92,7 +92,7 @@ public DeviceKeystoreItems getKeystoreItems(
@PathParam("deviceId") EntityId deviceId,
@QueryParam("keystoreId") String keystoreId,
@QueryParam("alias") String alias,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {

DeviceKeystoreItemQuery itemQuery = DEVICE_KEYSTORE_MANAGEMENT_FACTORY.newDeviceKeystoreItemQuery();
itemQuery.setKeystoreId(keystoreId);
Expand All @@ -119,7 +119,7 @@ public DeviceKeystoreItem getKeystoreItem(
@PathParam("deviceId") EntityId deviceId,
@QueryParam("keystoreId") String keystoreId,
@QueryParam("alias") String alias,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {

return DEVICE_KEYSTORE_MANAGEMENT_SERVICE.getKeystoreItem(scopeId, deviceId, keystoreId, alias, timeout);
}
Expand All @@ -141,7 +141,7 @@ public DeviceKeystoreItem getKeystoreItem(
public Response createDeviceKeystoreCertificate(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceKeystoreCertificateInfo keystoreCertificateInfo) throws KapuaException {

DEVICE_KEYSTORE_MANAGEMENT_SERVICE.createKeystoreCertificate(
Expand Down Expand Up @@ -172,7 +172,7 @@ public Response createDeviceKeystoreCertificate(
public Response createDeviceKeystoreCertificate(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceKeystoreCertificate keystoreCertificate) throws KapuaException {

DEVICE_KEYSTORE_MANAGEMENT_SERVICE.createKeystoreCertificate(scopeId, deviceId, keystoreCertificate, timeout);
Expand All @@ -198,7 +198,7 @@ public Response createDeviceKeystoreCertificate(
public Response createDeviceKeystoreKeypair(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceKeystoreKeypair deviceKeystoreKeypair) throws KapuaException {

DEVICE_KEYSTORE_MANAGEMENT_SERVICE.createKeystoreKeypair(scopeId, deviceId, deviceKeystoreKeypair, timeout);
Expand All @@ -223,7 +223,7 @@ public Response createDeviceKeystoreKeypair(
public DeviceKeystoreCSR createDeviceKeystoreCSR(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
DeviceKeystoreCSRInfo deviceKeystoreCSRInfo) throws KapuaException {

return DEVICE_KEYSTORE_MANAGEMENT_SERVICE.createKeystoreCSR(scopeId, deviceId, deviceKeystoreCSRInfo, timeout);
Expand All @@ -247,7 +247,7 @@ public Response deleteKeystoreItem(
@PathParam("deviceId") EntityId deviceId,
@QueryParam("keystoreId") String keystoreId,
@QueryParam("alias") String alias,
@QueryParam("timeout") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {

DEVICE_KEYSTORE_MANAGEMENT_SERVICE.deleteKeystoreItem(scopeId, deviceId, keystoreId, alias, timeout);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class DeviceManagementPackages extends AbstractKapuaResource {
public DevicePackages get(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return devicePackageManagementService.getInstalled(scopeId, deviceId, timeout);
}

Expand All @@ -90,7 +90,7 @@ public DevicePackages get(
public Response download(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
@QueryParam("legacy") @DefaultValue("false") boolean legacy,
DevicePackageDownloadRequest packageDownloadRequest)
throws KapuaException {
Expand Down Expand Up @@ -121,7 +121,7 @@ public Response download(
public Response uninstall(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
@QueryParam("legacy") @DefaultValue("false") boolean legacy,
DevicePackageUninstallRequest packageUninstallRequest) throws KapuaException {
DevicePackageUninstallOptions options = devicePackageFactory.newPackageUninstallOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class DeviceManagementRequests extends AbstractKapuaResource {
public GenericResponseMessage sendRequest(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
GenericRequestMessage requestMessage) throws KapuaException {
requestMessage.setScopeId(scopeId);
requestMessage.setDeviceId(deviceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.kapua.service.device.registry.Device;

import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
Expand Down Expand Up @@ -65,7 +66,7 @@ public class DeviceManagementRequestsJson extends AbstractKapuaResource implemen
public JsonGenericResponseMessage sendRequest(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") Long timeout,
@QueryParam("timeout") @DefaultValue("30000") Long timeout,
JsonGenericRequestMessage jsonGenericRequestMessage) throws KapuaException {

GenericRequestMessage genericRequestMessage = GENERIC_REQUEST_FACTORY.newRequestMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class DeviceManagementSnapshots extends AbstractKapuaResource {
public DeviceSnapshots get(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return snapshotService.get(scopeId, deviceId, timeout);
}

Expand All @@ -87,7 +87,7 @@ public Response rollback(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("snapshotId") String snapshotId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
snapshotService.rollback(scopeId, deviceId, snapshotId, timeout);

return returnNoContent();
Expand Down Expand Up @@ -116,7 +116,7 @@ public DeviceConfiguration download(
@PathParam("scopeId") ScopeId scopeId,
@PathParam("deviceId") EntityId deviceId,
@PathParam("snapshotId") String snapshotId,
@QueryParam("timeout") @DefaultValue("10000") Long timeout) throws KapuaException {
@QueryParam("timeout") @DefaultValue("30000") Long timeout) throws KapuaException {
return configurationService.get(scopeId, deviceId, snapshotId, null, timeout);
}

Expand Down

0 comments on commit 52e90a6

Please sign in to comment.