diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java index 69ed4fd4a..b7423e899 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/DeviceSimulatorUpdater.java @@ -118,6 +118,16 @@ public class DeviceSimulatorUpdater { } private static final class DeviceSimulatorUpdateThread implements Runnable { + /** + * + */ + private static final String BUT_GOT_LOG_MESSAGE = " but got: "; + + /** + * + */ + private static final String DOWNLOAD_LOG_MESSAGE = "Download "; + private static final int MINIMUM_TOKENLENGTH_FOR_HINT = 6; private static final Random rndSleep = new SecureRandom(); @@ -212,60 +222,73 @@ public class DeviceSimulatorUpdater { LOGGER.debug("Downloading {} with token {}, expected sha1 hash {} and size {}", url, hideTokenDetails(targetToken), sha1Hash, size); - long overallread = 0; try { - final CloseableHttpClient httpclient = createHttpClientThatAcceptsAllServerCerts(); - final HttpGet request = new HttpGet(url); - request.addHeader(HttpHeaders.AUTHORIZATION, "TargetToken " + targetToken); - - final String sha1HashResult; - try (final CloseableHttpResponse response = httpclient.execute(request)) { - - if (response.getStatusLine().getStatusCode() != HttpStatus.OK.value()) { - final String message = wrongStatusCode(url, response); - return new UpdateStatus(ResponseStatus.ERROR, message); - } - - if (response.getEntity().getContentLength() != size) { - final String message = wrongContentLength(url, size, response); - return new UpdateStatus(ResponseStatus.ERROR, message); - } - - // Exception squid:S2070 - not used for hashing sensitive - // data - @SuppressWarnings("squid:S2070") - final MessageDigest md = MessageDigest.getInstance("SHA-1"); - - try (final BufferedOutputStream bdos = new BufferedOutputStream( - new DigestOutputStream(ByteStreams.nullOutputStream(), md))) { - try (BufferedInputStream bis = new BufferedInputStream(response.getEntity().getContent())) { - overallread = ByteStreams.copy(bis, bdos); - } - } - - if (overallread != size) { - final String message = incompleteRead(url, size, overallread); - return new UpdateStatus(ResponseStatus.ERROR, message); - } - - sha1HashResult = BaseEncoding.base16().lowerCase().encode(md.digest()); - } - - if (!sha1Hash.equalsIgnoreCase(sha1HashResult)) { - final String message = wrongHash(url, sha1Hash, overallread, sha1HashResult); - return new UpdateStatus(ResponseStatus.ERROR, message); - } - + return readAndCheckDownloadUrl(url, targetToken, sha1Hash, size); } catch (IOException | KeyManagementException | NoSuchAlgorithmException | KeyStoreException e) { LOGGER.error("Failed to download" + url, e); return new UpdateStatus(ResponseStatus.ERROR, "Failed to download " + url + ": " + e.getMessage()); } + } + + private static UpdateStatus readAndCheckDownloadUrl(final String url, final String targetToken, + final String sha1Hash, final long size) + throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { + long overallread; + final CloseableHttpClient httpclient = createHttpClientThatAcceptsAllServerCerts(); + final HttpGet request = new HttpGet(url); + request.addHeader(HttpHeaders.AUTHORIZATION, "TargetToken " + targetToken); + + final String sha1HashResult; + try (final CloseableHttpResponse response = httpclient.execute(request)) { + + if (response.getStatusLine().getStatusCode() != HttpStatus.OK.value()) { + final String message = wrongStatusCode(url, response); + return new UpdateStatus(ResponseStatus.ERROR, message); + } + + if (response.getEntity().getContentLength() != size) { + final String message = wrongContentLength(url, size, response); + return new UpdateStatus(ResponseStatus.ERROR, message); + } + + // Exception squid:S2070 - not used for hashing sensitive + // data + @SuppressWarnings("squid:S2070") + final MessageDigest md = MessageDigest.getInstance("SHA-1"); + + overallread = getOverallRead(response, md); + + if (overallread != size) { + final String message = incompleteRead(url, size, overallread); + return new UpdateStatus(ResponseStatus.ERROR, message); + } + + sha1HashResult = BaseEncoding.base16().lowerCase().encode(md.digest()); + } + + if (!sha1Hash.equalsIgnoreCase(sha1HashResult)) { + final String message = wrongHash(url, sha1Hash, overallread, sha1HashResult); + return new UpdateStatus(ResponseStatus.ERROR, message); + } + final String message = "Downloaded " + url + " (" + overallread + " bytes)"; LOGGER.debug(message); return new UpdateStatus(ResponseStatus.SUCCESSFUL, message); } + private static long getOverallRead(final CloseableHttpResponse response, final MessageDigest md) + throws IOException { + long overallread; + try (final BufferedOutputStream bdos = new BufferedOutputStream( + new DigestOutputStream(ByteStreams.nullOutputStream(), md))) { + try (BufferedInputStream bis = new BufferedInputStream(response.getEntity().getContent())) { + overallread = ByteStreams.copy(bis, bdos); + } + } + return overallread; + } + private static String hideTokenDetails(final String targetToken) { if (targetToken == null) { return ""; @@ -285,29 +308,30 @@ public class DeviceSimulatorUpdater { private static String wrongHash(final String url, final String sha1Hash, final long overallread, final String sha1HashResult) { - final String message = "Download " + url + " failed with SHA1 hash missmatch (Expected: " + sha1Hash - + " but got: " + sha1HashResult + ") (" + overallread + " bytes)"; + final String message = DOWNLOAD_LOG_MESSAGE + url + " failed with SHA1 hash missmatch (Expected: " + + sha1Hash + BUT_GOT_LOG_MESSAGE + sha1HashResult + ") (" + overallread + " bytes)"; LOGGER.error(message); return message; } private static String incompleteRead(final String url, final long size, final long overallread) { - final String message = "Download " + url + " is incomplete (Expected: " + size + " but got: " + overallread - + ")"; + final String message = DOWNLOAD_LOG_MESSAGE + url + " is incomplete (Expected: " + size + + BUT_GOT_LOG_MESSAGE + overallread + ")"; LOGGER.error(message); return message; } private static String wrongContentLength(final String url, final long size, final CloseableHttpResponse response) { - final String message = "Download " + url + " has wrong content length (Expected: " + size + " but got: " - + response.getEntity().getContentLength() + ")"; + final String message = DOWNLOAD_LOG_MESSAGE + url + " has wrong content length (Expected: " + size + + BUT_GOT_LOG_MESSAGE + response.getEntity().getContentLength() + ")"; LOGGER.error(message); return message; } private static String wrongStatusCode(final String url, final CloseableHttpResponse response) { - final String message = "Download " + url + " failed (" + response.getStatusLine().getStatusCode() + ")"; + final String message = DOWNLOAD_LOG_MESSAGE + url + " failed (" + response.getStatusLine().getStatusCode() + + ")"; LOGGER.error(message); return message; } @@ -339,4 +363,5 @@ public class DeviceSimulatorUpdater { */ void updateFinished(AbstractSimulatedDevice device, final Long actionId); } + } diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java index 4f2981be1..7d55fb375 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/amqp/SpReceiverService.java @@ -67,8 +67,6 @@ public class SpReceiverService extends ReceiverService { * the incoming message * @param type * the action type - * @param contentType - * the content type in message header * @param thingId * the thing id in message header */ @@ -82,14 +80,11 @@ public class SpReceiverService extends ReceiverService { private void delegateMessage(final Message message, final String type, final String thingId) { final MessageType messageType = MessageType.valueOf(type); - switch (messageType) { - case EVENT: + if (MessageType.EVENT.equals(messageType)) { handleEventMessage(message, thingId); - break; - default: - LOGGER.info("No valid message type property."); - break; + return; } + LOGGER.info("No valid message type property."); } private void handleEventMessage(final Message message, final String thingId) { diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java index 272531407..b50098829 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/GenerateDialog.java @@ -33,9 +33,10 @@ import com.vaadin.ui.Window; * Popup dialog window for setting the values of generating the simulated * devices, e.g. the amount. * - * @author Michael Hirsch * */ +// Vaadin Inheritance +@SuppressWarnings("squid:MaximumInheritanceDepth") public class GenerateDialog extends Window { private static final long serialVersionUID = 1L; @@ -49,8 +50,8 @@ public class GenerateDialog extends Window { private final TextField pollDelayTextField; private final TextField pollUrlTextField; private final TextField gatewayTokenTextField; - private final OptionGroup protocolGroup; - private final Button buttonOk; + private OptionGroup protocolGroup; + private Button buttonOk; /** * Creates a new pop window for setting the configuration of simulating @@ -87,8 +88,8 @@ public class GenerateDialog extends Window { gatewayTokenTextField.setColumns(50); gatewayTokenTextField.setVisible(false); - protocolGroup = createProtocolGroup(); - buttonOk = createOkButton(callback); + createProtocolGroup(); + createOkButton(callback); namePrefixTextField.addValueChangeListener(event -> checkValid()); amountTextField.addValueChangeListener(event -> checkValid()); @@ -181,9 +182,9 @@ public class GenerateDialog extends Window { final URL basePollURL, final String gatewayToken, final Protocol protocol); } - private OptionGroup createProtocolGroup() { + private void createProtocolGroup() { - final OptionGroup protocolGroup = new OptionGroup("Simulated Device Protocol"); + this.protocolGroup = new OptionGroup("Simulated Device Protocol"); protocolGroup.addItem(Protocol.DMF_AMQP); protocolGroup.addItem(Protocol.DDI_HTTP); protocolGroup.setItemCaption(Protocol.DMF_AMQP, "Device Management Federation API (AMQP push)"); @@ -195,12 +196,11 @@ public class GenerateDialog extends Window { pollUrlTextField.setVisible(directDeviceOptionSelected); gatewayTokenTextField.setVisible(directDeviceOptionSelected); }); - return protocolGroup; } - private Button createOkButton(final GenerateDialogCallback callback) { + private void createOkButton(final GenerateDialogCallback callback) { - final Button buttonOk = new Button("generate"); + this.buttonOk = new Button("generate"); buttonOk.setImmediate(true); buttonOk.setIcon(FontAwesome.GEARS); buttonOk.addClickListener(event -> { @@ -210,14 +210,11 @@ public class GenerateDialog extends Window { Integer.valueOf(pollDelayTextField.getValue().replace(".", "")), new URL(pollUrlTextField.getValue()), gatewayTokenTextField.getValue(), (Protocol) protocolGroup.getValue()); - } catch (final NumberFormatException e) { - LOGGER.info(e.getMessage(), e); - } catch (final MalformedURLException e) { + } catch (final NumberFormatException | MalformedURLException e) { LOGGER.info(e.getMessage(), e); } GenerateDialog.this.close(); }); - return buttonOk; } private TextField createRequiredTextfield(final String caption, final String value, final Resource icon, @@ -226,7 +223,7 @@ public class GenerateDialog extends Window { return addTextFieldValues(textField, icon, validator); } - private TextField createRequiredTextfield(final String caption, final Property dataSource, final Resource icon, + private TextField createRequiredTextfield(final String caption, final Property dataSource, final Resource icon, final Validator validator) { final TextField textField = new TextField(caption, dataSource); return addTextFieldValues(textField, icon, validator); diff --git a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java index 9405edd2b..686945407 100644 --- a/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java +++ b/examples/hawkbit-device-simulator/src/main/java/org/eclipse/hawkbit/simulator/ui/SimulatorView.java @@ -57,6 +57,11 @@ import com.vaadin.ui.renderers.ProgressBarRenderer; @SuppressWarnings("squid:MaximumInheritanceDepth") public class SimulatorView extends VerticalLayout implements View { + /** + * + */ + private static final String HTML_SPAN = ";"; + private static final String NEXT_POLL_COUNTER_SEC_COL = "nextPollCounterSec"; private static final String RESPONSE_STATUS_COL = "updateStatus"; @@ -266,89 +271,90 @@ public class SimulatorView extends VerticalLayout implements View { })); } - private Converter createProtocolConverter() { - - return new Converter() { - - private static final long serialVersionUID = 1L; - - @Override - public Protocol convertToModel(final String value, final Class targetType, - final Locale locale) { - return null; - } - - @Override - public String convertToPresentation(final Protocol value, final Class targetType, - final Locale locale) { - switch (value) { - case DDI_HTTP: - return "DDI API (http)"; - case DMF_AMQP: - return "DMF API (amqp)"; - default: - return "unknown"; - } - } - - @Override - public Class getModelType() { - return Protocol.class; - } - - @Override - public Class getPresentationType() { - return String.class; - } - }; - + private ProtocolConverter createProtocolConverter() { + return new ProtocolConverter(); } - private Converter createStatusConverter() { - return new Converter() { - private static final long serialVersionUID = 1L; + private StatusConverter createStatusConverter() { + return new StatusConverter(); + } - @Override - public Status convertToModel(final String value, final Class targetType, - final Locale locale) { - return null; - } + public static final class ProtocolConverter implements Converter { + private static final long serialVersionUID = 1L; - @Override - public String convertToPresentation(final Status value, final Class targetType, - final Locale locale) { - switch (value) { - case UNKNWON: - return "&#x" - + Integer.toHexString(FontAwesome.QUESTION_CIRCLE.getCodepoint()) + ";"; - case PEDNING: - return "&#x" + Integer.toHexString(FontAwesome.REFRESH.getCodepoint()) - + ";"; - case FINISH: - return "&#x" - + Integer.toHexString(FontAwesome.CHECK_CIRCLE.getCodepoint()) + ";"; - case ERROR: - return "&#x" - + Integer.toHexString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()) + ";"; - default: - throw new IllegalStateException("unknown value"); - } - } + @Override + public Protocol convertToModel(final String value, final Class targetType, + final Locale locale) { + return null; + } - @Override - public Class getModelType() { - return Status.class; + @Override + public String convertToPresentation(final Protocol value, final Class targetType, + final Locale locale) { + switch (value) { + case DDI_HTTP: + return "DDI API (http)"; + case DMF_AMQP: + return "DMF API (amqp)"; + default: + return "unknown"; } + } - @Override - public Class getPresentationType() { - return String.class; + @Override + public Class getModelType() { + return Protocol.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } + } + + private static final class StatusConverter implements Converter { + private static final long serialVersionUID = 1L; + + @Override + public Status convertToModel(final String value, final Class targetType, + final Locale locale) { + return null; + } + + @Override + public String convertToPresentation(final Status value, final Class targetType, + final Locale locale) { + switch (value) { + case UNKNWON: + return "&#x" + Integer.toHexString(FontAwesome.QUESTION_CIRCLE.getCodepoint()) + + HTML_SPAN; + case PEDNING: + return "&#x" + Integer.toHexString(FontAwesome.REFRESH.getCodepoint()) + + HTML_SPAN; + case FINISH: + return "&#x" + Integer.toHexString(FontAwesome.CHECK_CIRCLE.getCodepoint()) + + HTML_SPAN; + case ERROR: + return "&#x" + + Integer.toHexString(FontAwesome.EXCLAMATION_CIRCLE.getCodepoint()) + HTML_SPAN; + default: + throw new IllegalStateException("unknown value"); } - }; + } + + @Override + public Class getModelType() { + return Status.class; + } + + @Override + public Class getPresentationType() { + return String.class; + } } } diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/eventbus/EventBusAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/eventbus/EventBusAutoConfiguration.java index d4cc32825..c0cbabb08 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/eventbus/EventBusAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/eventbus/EventBusAutoConfiguration.java @@ -23,7 +23,7 @@ import com.google.common.eventbus.AsyncEventBus; import com.google.common.eventbus.EventBus; /** - * + * Auto configuration for the event bus. * */ @Configuration diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerAutoConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerAutoConfiguration.java index 7e2b780b4..eebfac6b0 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerAutoConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/scheduling/AsyncConfigurerAutoConfiguration.java @@ -21,7 +21,7 @@ import org.springframework.scheduling.annotation.EnableAsync; /** * - * + * Auto config fot the exception handler. */ @Configuration @EnableAsync diff --git a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java index 1e4dbfb27..07ea15a8a 100644 --- a/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java +++ b/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityManagedConfiguration.java @@ -119,6 +119,8 @@ public class SecurityManagedConfiguration { */ @Bean @ConditionalOnMissingBean + // Exception squid:S00112 - Is aspectJ proxy + @SuppressWarnings({ "squid:S00112" }) public UserAuthenticationFilter userAuthenticationFilter() throws Exception { return new UserAuthenticationFilterBasicAuth(configuration.getAuthenticationManager()); } diff --git a/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/RedisConfiguration.java b/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/RedisConfiguration.java index fc3364d81..d9f759da3 100644 --- a/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/RedisConfiguration.java +++ b/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/RedisConfiguration.java @@ -56,6 +56,10 @@ public class RedisConfiguration { return new TenantAwareCacheManager(directCacheManager(), tenantAware); } + /** + * + * @return bean for the direct cache manager. + */ @Bean(name = "directCacheManager") public CacheManager directCacheManager() { return new RedisCacheManager(redisTemplate()); diff --git a/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/eventbus/EventDistributor.java b/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/eventbus/EventDistributor.java index 8749340f0..973dcb6d6 100644 --- a/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/eventbus/EventDistributor.java +++ b/hawkbit-cache-redis/src/main/java/org/eclipse/hawkbit/cache/eventbus/EventDistributor.java @@ -28,7 +28,7 @@ import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; /** - * + * The distributor for events. * */ @EventSubscriber @@ -100,11 +100,11 @@ public class EventDistributor { return topics; } - private void logDistributingEvent(final Event event, final String channel) { + private static void logDistributingEvent(final Event event, final String channel) { LOGGER.trace("distributing event {} from node {} to topic {}", event, NODE_ID, channel); } - private void logNotDistributingEvent(final Event event, final String channel) { + private static void logNotDistributingEvent(final Event event, final String channel) { LOGGER.debug("no redis template configured, event {} will not be distributed to channel {} from node {}", event, channel, NODE_ID); } diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/ProtocolProperties.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/ProtocolProperties.java index c4a9556b7..57f376c4e 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/ProtocolProperties.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/api/ProtocolProperties.java @@ -37,4 +37,4 @@ public interface ProtocolProperties { * @return true if the {@link ProtocolProperties} is enabled. */ boolean isEnabled(); -} \ No newline at end of file +} diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/CancelTargetAssignmentEvent.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/CancelTargetAssignmentEvent.java index da93cc1a3..78c718f36 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/CancelTargetAssignmentEvent.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/CancelTargetAssignmentEvent.java @@ -17,7 +17,7 @@ import java.net.URI; * * */ -public class CancelTargetAssignmentEvent extends AbstractEvent { +public class CancelTargetAssignmentEvent extends DefaultEvent { private final String controllerId; private final Long actionId; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/AbstractEvent.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/DefaultEvent.java similarity index 87% rename from hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/AbstractEvent.java rename to hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/DefaultEvent.java index 498418169..1874fc01f 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/AbstractEvent.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/DefaultEvent.java @@ -12,11 +12,10 @@ package org.eclipse.hawkbit.eventbus.event; * Abstract event definition class which holds the necessary revsion and tenant * information which every event needs. * - * @author Michael Hirsch * @see AbstractDistributedEvent for events which should be distributed to other * cluster nodes */ -public class AbstractEvent implements Event { +public class DefaultEvent implements Event { private final long revision; private final String tenant; @@ -27,7 +26,7 @@ public class AbstractEvent implements Event { * @param tenant * the tenant of the event */ - protected AbstractEvent(final long revision, final String tenant) { + protected DefaultEvent(final long revision, final String tenant) { this.revision = revision; this.tenant = tenant; } diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java index e6fcac135..048274abc 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/eventbus/event/TargetDeletedEvent.java @@ -9,9 +9,7 @@ package org.eclipse.hawkbit.eventbus.event; /** - * - * - * + * The event when a target is deleted. */ public class TargetDeletedEvent extends AbstractDistributedEvent { diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerRtException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java similarity index 79% rename from hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerRtException.java rename to hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java index ba691bb5f..cb695d2f7 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/SpServerRtException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/AbstractServerRtException.java @@ -15,8 +15,7 @@ package org.eclipse.hawkbit.exception; * Generic Custom Exception to wrap the Runtime and checked exception * */ - -public abstract class SpServerRtException extends RuntimeException { +public abstract class AbstractServerRtException extends RuntimeException { private static final long serialVersionUID = 1L; @@ -28,7 +27,7 @@ public abstract class SpServerRtException extends RuntimeException { * @param error * detail */ - public SpServerRtException(final SpServerError error) { + public AbstractServerRtException(final SpServerError error) { super(error.getMessage()); this.error = error; } @@ -41,7 +40,7 @@ public abstract class SpServerRtException extends RuntimeException { * @param error * detail */ - public SpServerRtException(final String message, final SpServerError error) { + public AbstractServerRtException(final String message, final SpServerError error) { super(message); this.error = error; } @@ -56,7 +55,7 @@ public abstract class SpServerRtException extends RuntimeException { * @param cause * of the exception */ - public SpServerRtException(final String message, final SpServerError error, final Throwable cause) { + public AbstractServerRtException(final String message, final SpServerError error, final Throwable cause) { super(message, cause); this.error = error; } @@ -69,7 +68,7 @@ public abstract class SpServerRtException extends RuntimeException { * @param cause * of the exception */ - public SpServerRtException(final SpServerError error, final Throwable cause) { + public AbstractServerRtException(final SpServerError error, final Throwable cause) { super(error.getMessage(), cause); this.error = error; } diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java index f0a3f4d1f..4ac02e081 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/exception/GenericSpServerException.java @@ -16,7 +16,7 @@ package org.eclipse.hawkbit.exception; * * */ -public class GenericSpServerException extends SpServerRtException { +public class GenericSpServerException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_GENERIC_ERROR; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java index c2d8ec49d..237fed978 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/repository/ActionFields.java @@ -11,11 +11,8 @@ package org.eclipse.hawkbit.repository; /** * Sort fields for {@link ActionRest}. * - * - * - * */ -public enum ActionFields implements FieldNameProvider,FieldValueConverter { +public enum ActionFields implements FieldNameProvider, FieldValueConverter { /** * The status field. @@ -42,13 +39,10 @@ public enum ActionFields implements FieldNameProvider,FieldValueConverter contains contains not + */ default boolean containsSubEntityAttribute(final String propertyField) { return FieldNameProvider.containsSubEntityAttribute(propertyField, getSubEntityAttributes()); - }; + } + /** + * + * @return all sub entities attributes. + */ default List getSubEntityAttributes() { return Collections.emptyList(); - }; + } /** * the database column for the key @@ -59,11 +70,11 @@ public interface FieldNameProvider { /** * Is the entity field a {@link Map}. * - * @return + * @return is a map is not a map */ default boolean isMap() { return getKeyFieldName() != null; - }; + } /** * Check if a sub attribute exists. diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/InvalidTenantConfigurationKeyException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/InvalidTenantConfigurationKeyException.java index dcc42065c..977b66a6a 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/InvalidTenantConfigurationKeyException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/InvalidTenantConfigurationKeyException.java @@ -9,14 +9,14 @@ package org.eclipse.hawkbit.tenancy.configuration; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * The {@link #InvalidTenantConfigurationKeyException} is thrown when an invalid * configuration key is used. * */ -public class InvalidTenantConfigurationKeyException extends SpServerRtException { +public class InvalidTenantConfigurationKeyException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_KEY_INVALID; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidator.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidator.java index dccf515e6..bb61f1ec5 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidator.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidator.java @@ -22,7 +22,7 @@ public interface TenantConfigurationValidator { * @throws TenantConfigurationValidatorException * is thrown, when parameter is invalid. */ - default void validate(final Object tenantConfigurationValue) throws TenantConfigurationValidatorException { + default void validate(final Object tenantConfigurationValue) { if (tenantConfigurationValue != null && validateToClass().isAssignableFrom(tenantConfigurationValue.getClass())) { return; diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidatorException.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidatorException.java index dffc13dcb..4cc545287 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidatorException.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/tenancy/configuration/validator/TenantConfigurationValidatorException.java @@ -9,14 +9,14 @@ package org.eclipse.hawkbit.tenancy.configuration.validator; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception which is thrown, when the validation of the configuration value has * not been successful. * */ -public class TenantConfigurationValidatorException extends SpServerRtException { +public class TenantConfigurationValidatorException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_VALUE_INVALID; diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java index 9541055f8..898ee244a 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiArtifactHash.java @@ -27,6 +27,7 @@ public class DdiArtifactHash { * Default constructor. */ public DdiArtifactHash() { + // needed for json create } /** diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiChunk.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiChunk.java index 78de8591d..cf146b597 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiChunk.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiChunk.java @@ -29,7 +29,7 @@ public class DdiChunk { private List artifacts; public DdiChunk() { - + // needed for json create } /** diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfig.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfig.java index 5ec1b4dde..0dfed6e79 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfig.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiConfig.java @@ -34,8 +34,11 @@ public class DdiConfig { this.polling = polling; } + /** + * Constructor. + */ public DdiConfig() { - + // needed for json create. } public DdiPolling getPolling() { diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java index 3f160157c..526227601 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiControllerBase.java @@ -37,7 +37,7 @@ public class DdiControllerBase extends ResourceSupport { } public DdiControllerBase() { - + // needed for json create } public DdiConfig getConfig() { diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java index f72083d7a..c7e364b36 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeployment.java @@ -23,8 +23,11 @@ public class DdiDeployment { private List chunks; + /** + * Constructor. + */ public DdiDeployment() { - + // needed for json create. } /** diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java index 8f1116b1b..a058fd24a 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiDeploymentBase.java @@ -21,10 +21,10 @@ public class DdiDeploymentBase extends ResourceSupport { @JsonProperty("id") @NotNull - private String deplyomentId; + private final String deplyomentId; @NotNull - private DdiDeployment deployment; + private final DdiDeployment deployment; /** * Constructor. @@ -35,14 +35,10 @@ public class DdiDeploymentBase extends ResourceSupport { * details. */ public DdiDeploymentBase(final String id, final DdiDeployment deployment) { - deplyomentId = id; + this.deplyomentId = id; this.deployment = deployment; } - public DdiDeploymentBase() { - - } - public DdiDeployment getDeployment() { return deployment; } diff --git a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java index 489178be8..81427510a 100644 --- a/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java +++ b/hawkbit-ddi-api/src/main/java/org/eclipse/hawkbit/ddi/json/model/DdiPolling.java @@ -30,11 +30,15 @@ public class DdiPolling { * between polls */ public DdiPolling(final String sleep) { - super(); this.sleep = sleep; } + /** + * Constructor. + * + */ public DdiPolling() { + // needed for json create } public String getSleep() { diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentfication.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentfication.java index 91d07de37..788d1d8d8 100644 --- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentfication.java +++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentfication.java @@ -36,7 +36,7 @@ import org.springframework.stereotype.Component; /** * - * + * A controller which handles the amqp authentfication. */ @Component public class AmqpControllerAuthentfication { diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java index 19ceb123f..8906bc96c 100644 --- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java +++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java @@ -138,6 +138,13 @@ public class AmqpMessageHandlerService extends BaseAmqpService { return onMessage(message, type, tenant, getRabbitTemplate().getConnectionFactory().getVirtualHost()); } + /** + * Executed on a authentication request. + * + * @param message + * the amqp message + * @return the rpc message back to supplier. + */ @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.authenticationReceiverQueue}", containerFactory = "listenerContainerFactory") public Message onAuthenticationRequest(final Message message) { checkContentTypeJson(message); @@ -153,6 +160,19 @@ public class AmqpMessageHandlerService extends BaseAmqpService { } } + /** + * * Executed if a amqp message arrives. + * + * @param message + * the message + * @param type + * the type + * @param tenant + * the tenant + * @param virtualHost + * the virtual host + * @return the rpc message back to supplier. + */ public Message onMessage(final Message message, final String type, final String tenant, final String virtualHost) { checkContentTypeJson(message); final SecurityContext oldContext = SecurityContextHolder.getContext(); diff --git a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java index b9314ac27..b11d5a437 100644 --- a/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java +++ b/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java @@ -88,8 +88,7 @@ public class BaseAmqpService { return rabbitTemplate.getMessageConverter(); } - protected final String getStringHeaderKey(final Message message, final String key, - final String errorMessageIfNull) { + protected String getStringHeaderKey(final Message message, final String key, final String errorMessageIfNull) { final Map header = message.getMessageProperties().getHeaders(); final Object value = header.get(key); if (value == null) { @@ -117,4 +116,5 @@ public class BaseAmqpService { protected void cleanMessageHeaderProperties(final Message message) { message.getMessageProperties().getHeaders().remove(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME); } + } diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadArtifactRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadArtifactRestApi.java index ea6dccc7e..9053af8c8 100644 --- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadArtifactRestApi.java +++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadArtifactRestApi.java @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody; * */ @RequestMapping(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING) +@FunctionalInterface public interface MgmtDownloadArtifactRestApi { /** diff --git a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadRestApi.java b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadRestApi.java index 52cd1c991..ea179b830 100644 --- a/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadRestApi.java +++ b/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtDownloadRestApi.java @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody; * */ @RequestMapping(MgmtRestConstants.DOWNLOAD_ID_V1_REQUEST_MAPPING_BASE) +@FunctionalInterface public interface MgmtDownloadRestApi { /** diff --git a/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadResource.java b/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadResource.java index 87a215183..b6f9f27c8 100644 --- a/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadResource.java +++ b/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadResource.java @@ -15,6 +15,7 @@ import org.eclipse.hawkbit.artifact.repository.ArtifactRepository; import org.eclipse.hawkbit.artifact.repository.model.DbArtifact; import org.eclipse.hawkbit.cache.CacheConstants; import org.eclipse.hawkbit.cache.DownloadArtifactCache; +import org.eclipse.hawkbit.cache.DownloadType; import org.eclipse.hawkbit.mgmt.rest.api.MgmtDownloadRestApi; import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder; import org.slf4j.Logger; @@ -73,14 +74,11 @@ public class MgmtDownloadResource implements MgmtDownloadRestApi { final DownloadArtifactCache artifactCache = (DownloadArtifactCache) cacheWrapper.get(); DbArtifact artifact = null; - switch (artifactCache.getDownloadType()) { - case BY_SHA1: - artifact = artifactRepository.getArtifactBySha1(artifactCache.getId()); - break; - default: + if (DownloadType.BY_SHA1.equals(artifactCache.getDownloadType())) { + artifact = artifactRepository.getArtifactBySha1(artifactCache.getId()); + } else { LOGGER.warn("Download Type {} not supported", artifactCache.getDownloadType()); - break; } if (artifact == null) { diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/DistributionSetManagement.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/DistributionSetManagement.java index a2e7e5213..1784606bd 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/DistributionSetManagement.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/DistributionSetManagement.java @@ -24,6 +24,7 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldExc import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSetFilter; +import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult; @@ -32,7 +33,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.Tag; import org.eclipse.hawkbit.repository.model.Target; -import org.eclipse.hawkbit.repository.model.DistributionSetFilter.DistributionSetFilterBuilder; import org.hibernate.validator.constraints.NotEmpty; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -44,9 +44,6 @@ import org.springframework.security.access.prepost.PreAuthorize; */ public interface DistributionSetManagement { - // TODO rename/document the whole with details thing (document what the - // details are and maybe find a better name, e.g. with dependencies?) - /** * Assigns {@link SoftwareModule} to existing {@link DistributionSet}. * @@ -320,7 +317,6 @@ public interface DistributionSetManagement { @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) List findDistributionSetsAll(Collection dist); - // TODO discuss: use enum instead of the true,false,null switch ? /** * finds all {@link DistributionSet}s. * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutChangeEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutChangeEvent.java index 2ff739726..05960938f 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutChangeEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutChangeEvent.java @@ -8,7 +8,7 @@ */ package org.eclipse.hawkbit.repository.eventbus.event; -import org.eclipse.hawkbit.eventbus.event.AbstractEvent; +import org.eclipse.hawkbit.eventbus.event.DefaultEvent; /** * Event declaration for the UI to notify the UI that a rollout has been @@ -17,7 +17,7 @@ import org.eclipse.hawkbit.eventbus.event.AbstractEvent; * @author Michael Hirsch * */ -public class RolloutChangeEvent extends AbstractEvent { +public class RolloutChangeEvent extends DefaultEvent { private final Long rolloutId; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutGroupChangeEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutGroupChangeEvent.java index 5c36ab61f..686625d03 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutGroupChangeEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/RolloutGroupChangeEvent.java @@ -8,7 +8,7 @@ */ package org.eclipse.hawkbit.repository.eventbus.event; -import org.eclipse.hawkbit.eventbus.event.AbstractEvent; +import org.eclipse.hawkbit.eventbus.event.DefaultEvent; /** * Event declaration for the UI to notify the UI that a rollout has been @@ -17,7 +17,7 @@ import org.eclipse.hawkbit.eventbus.event.AbstractEvent; * @author Michael Hirsch * */ -public class RolloutGroupChangeEvent extends AbstractEvent { +public class RolloutGroupChangeEvent extends DefaultEvent { private final Long rolloutId; private final Long rolloutGroupId; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/TargetAssignDistributionSetEvent.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/TargetAssignDistributionSetEvent.java index 077e05462..586a4b9d2 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/TargetAssignDistributionSetEvent.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/eventbus/event/TargetAssignDistributionSetEvent.java @@ -11,14 +11,14 @@ package org.eclipse.hawkbit.repository.eventbus.event; import java.net.URI; import java.util.Collection; -import org.eclipse.hawkbit.eventbus.event.AbstractEvent; +import org.eclipse.hawkbit.eventbus.event.DefaultEvent; import org.eclipse.hawkbit.repository.model.SoftwareModule; /** * Event that gets sent when a distribution set gets assigned to a target. * */ -public class TargetAssignDistributionSetEvent extends AbstractEvent { +public class TargetAssignDistributionSetEvent extends DefaultEvent { private final Collection softwareModules; private final String controllerId; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactDeleteFailedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactDeleteFailedException.java index 7b7975d78..c7ed8637e 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactDeleteFailedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactDeleteFailedException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if artifact deletion failed. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class ArtifactDeleteFailedException extends SpServerRtException { +public final class ArtifactDeleteFailedException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactUploadFailedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactUploadFailedException.java index d83f80e64..6f762b56c 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactUploadFailedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ArtifactUploadFailedException.java @@ -9,14 +9,14 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * * * */ -public final class ArtifactUploadFailedException extends SpServerRtException { +public final class ArtifactUploadFailedException extends AbstractServerRtException { /** * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/CancelActionNotAllowedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/CancelActionNotAllowedException.java index 0a787e5bb..1afd994cf 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/CancelActionNotAllowedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/CancelActionNotAllowedException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if cancelation of actions is performened where the action is not @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class CancelActionNotAllowedException extends SpServerRtException { +public final class CancelActionNotAllowedException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ConcurrentModificationException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ConcurrentModificationException.java index c2a3b4456..ec2691e52 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ConcurrentModificationException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ConcurrentModificationException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * {@link ConcurrentModificationException} is thrown when a given entity in's @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class ConcurrentModificationException extends SpServerRtException { +public class ConcurrentModificationException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_CONCURRENT_MODIFICATION; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetCreationFailedMissingMandatoryModuleException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetCreationFailedMissingMandatoryModuleException.java index 0dc2f9752..936d3e5d2 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetCreationFailedMissingMandatoryModuleException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetCreationFailedMissingMandatoryModuleException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if DS creation failed. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class DistributionSetCreationFailedMissingMandatoryModuleException extends SpServerRtException { +public final class DistributionSetCreationFailedMissingMandatoryModuleException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetTypeUndefinedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetTypeUndefinedException.java index d3e10b213..8cf3c6162 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetTypeUndefinedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/DistributionSetTypeUndefinedException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSetType; @@ -21,7 +21,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType; * * */ -public class DistributionSetTypeUndefinedException extends SpServerRtException { +public class DistributionSetTypeUndefinedException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityAlreadyExistsException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityAlreadyExistsException.java index a38ec5bb6..73b14c57a 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityAlreadyExistsException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityAlreadyExistsException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * the {@link EntityAlreadyExistsException} is thrown when a entity is tried to @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class EntityAlreadyExistsException extends SpServerRtException { +public class EntityAlreadyExistsException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_ALRREADY_EXISTS; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityLockedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityLockedException.java index 1d55bdc34..23c372410 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityLockedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityLockedException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * The {@link EntityLockedException} is thrown when an entity has been locked by @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class EntityLockedException extends SpServerRtException { +public class EntityLockedException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_ENTITY_LOCKED; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityNotFoundException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityNotFoundException.java index 280436d3b..ce1446f67 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityNotFoundException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityNotFoundException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * the {@link EntityNotFoundException} is thrown when a entity is tried find but @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class EntityNotFoundException extends SpServerRtException { +public class EntityNotFoundException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_NOT_EXISTS; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityReadOnlyException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityReadOnlyException.java index 7908c4db5..f2686abb1 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityReadOnlyException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/EntityReadOnlyException.java @@ -9,13 +9,13 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * the {@link EntityReadOnlyException} is thrown when a entity is in read only * mode and a user tries to change it. */ -public class EntityReadOnlyException extends SpServerRtException { +public class EntityReadOnlyException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_ENTITY_READ_ONLY; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ForceQuitActionNotAllowedException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ForceQuitActionNotAllowedException.java index 23b5f7067..83957739a 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ForceQuitActionNotAllowedException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ForceQuitActionNotAllowedException.java @@ -9,14 +9,14 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown when force quitting an actions is not allowed. e.g. the action is not * active or it is not canceled before. * */ -public final class ForceQuitActionNotAllowedException extends SpServerRtException { +public final class ForceQuitActionNotAllowedException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/GridFSDBFileNotFoundException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/GridFSDBFileNotFoundException.java index d22fe2b6e..3f3c49e03 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/GridFSDBFileNotFoundException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/GridFSDBFileNotFoundException.java @@ -9,14 +9,14 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * * * */ -public final class GridFSDBFileNotFoundException extends SpServerRtException { +public final class GridFSDBFileNotFoundException extends AbstractServerRtException { /** * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/IncompleteDistributionSetException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/IncompleteDistributionSetException.java index 51b95afbd..10bc5bba4 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/IncompleteDistributionSetException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/IncompleteDistributionSetException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if a distribution set is assigned to a a target that is incomplete @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class IncompleteDistributionSetException extends SpServerRtException { +public final class IncompleteDistributionSetException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InsufficientPermissionException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InsufficientPermissionException.java index e15ba43ee..d3802300a 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InsufficientPermissionException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InsufficientPermissionException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception which is thrown in case the current security context object does @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class InsufficientPermissionException extends SpServerRtException { +public class InsufficientPermissionException extends AbstractServerRtException { private static final long serialVersionUID = 1L; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidMD5HashException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidMD5HashException.java index c08673164..f6083a612 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidMD5HashException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidMD5HashException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if MD5 checksum check fails. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class InvalidMD5HashException extends SpServerRtException { +public class InvalidMD5HashException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidSHA1HashException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidSHA1HashException.java index e4136cd82..4cc26c571 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidSHA1HashException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidSHA1HashException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if SHA1 checksum check fails. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class InvalidSHA1HashException extends SpServerRtException { +public class InvalidSHA1HashException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidTargetAddressException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidTargetAddressException.java index 70b890483..160d5c07b 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidTargetAddressException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/InvalidTargetAddressException.java @@ -9,12 +9,12 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception which is thrown when trying to set an invalid target address. */ -public class InvalidTargetAddressException extends SpServerRtException { +public class InvalidTargetAddressException extends AbstractServerRtException { /** * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/MultiPartFileUploadException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/MultiPartFileUploadException.java index e37786e19..7b554982e 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/MultiPartFileUploadException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/MultiPartFileUploadException.java @@ -9,13 +9,13 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if a multi part exception occurred. * */ -public final class MultiPartFileUploadException extends SpServerRtException { +public final class MultiPartFileUploadException extends AbstractServerRtException { private static final long serialVersionUID = 1L; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterSyntaxException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterSyntaxException.java index 268ab02ba..d46f6d827 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterSyntaxException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterSyntaxException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception used by the REST API in case of RSQL search filter query. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class RSQLParameterSyntaxException extends SpServerRtException { +public class RSQLParameterSyntaxException extends AbstractServerRtException { /** * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterUnsupportedFieldException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterUnsupportedFieldException.java index df58ecc8b..402a3eee7 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterUnsupportedFieldException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RSQLParameterUnsupportedFieldException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception used by the REST API in case of invalid field name in the rsql @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class RSQLParameterUnsupportedFieldException extends SpServerRtException { +public class RSQLParameterUnsupportedFieldException extends AbstractServerRtException { /** * diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RolloutIllegalStateException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RolloutIllegalStateException.java index f2920c18d..2f1937008 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RolloutIllegalStateException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/RolloutIllegalStateException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * the {@link RolloutIllegalStateException} is thrown when a rollout is changing @@ -17,7 +17,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * rollout, or trying to resume a already finished rollout. * */ -public class RolloutIllegalStateException extends SpServerRtException { +public class RolloutIllegalStateException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_ROLLOUT_ILLEGAL_STATE; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TenantNotExistException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TenantNotExistException.java index 95aab39a8..810054e93 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TenantNotExistException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/TenantNotExistException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * the {@link TenantNotExistException} is thrown when e.g. a controller tries to @@ -20,7 +20,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class TenantNotExistException extends SpServerRtException { +public class TenantNotExistException extends AbstractServerRtException { private static final long serialVersionUID = 1L; private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_TENANT_NOT_EXISTS; diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyAttributeEntriesException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyAttributeEntriesException.java index 78da0b9f3..6004bc2e7 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyAttributeEntriesException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyAttributeEntriesException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if too many status entries have been inserted. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class ToManyAttributeEntriesException extends SpServerRtException { +public final class ToManyAttributeEntriesException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java index 5d4367924..7b8f4a1b0 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/ToManyStatusEntriesException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if too many status entries have been inserted. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public final class ToManyStatusEntriesException extends SpServerRtException { +public final class ToManyStatusEntriesException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/UnsupportedSoftwareModuleForThisDistributionSetException.java b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/UnsupportedSoftwareModuleForThisDistributionSetException.java index 3726e3188..2ed76dfbc 100644 --- a/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/UnsupportedSoftwareModuleForThisDistributionSetException.java +++ b/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/exception/UnsupportedSoftwareModuleForThisDistributionSetException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.repository.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.SoftwareModule; @@ -23,7 +23,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule; * * */ -public class UnsupportedSoftwareModuleForThisDistributionSetException extends SpServerRtException { +public class UnsupportedSoftwareModuleForThisDistributionSetException extends AbstractServerRtException { /** * */ diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/MessageNotReadableException.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/MessageNotReadableException.java index 3c5e0aee3..319ac9a38 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/MessageNotReadableException.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/MessageNotReadableException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.rest.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception which is thrown in case an request body is not well formaned and @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class MessageNotReadableException extends SpServerRtException { +public class MessageNotReadableException extends AbstractServerRtException { /** * diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/ResponseExceptionHandler.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/ResponseExceptionHandler.java index 02a48ef78..81d70103b 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/ResponseExceptionHandler.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/ResponseExceptionHandler.java @@ -16,7 +16,7 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.exception.ExceptionUtils; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; import org.eclipse.hawkbit.repository.exception.MultiPartFileUploadException; import org.eclipse.hawkbit.rest.json.model.ExceptionInfo; import org.slf4j.Logger; @@ -75,7 +75,7 @@ public class ResponseExceptionHandler { } /** - * method for handling exception of type SpServerRtException. Called by the + * method for handling exception of type AbstractServerRtException. Called by the * Spring-Framework for exception handling. * * @param request @@ -86,14 +86,14 @@ public class ResponseExceptionHandler { * @return the entity to be responded containing the exception information * as entity. */ - @ExceptionHandler(SpServerRtException.class) + @ExceptionHandler(AbstractServerRtException.class) public ResponseEntity handleSpServerRtExceptions(final HttpServletRequest request, final Exception ex) { logRequest(request, ex); final ExceptionInfo response = createExceptionInfo(ex); final HttpStatus responseStatus; - if (ex instanceof SpServerRtException) { - responseStatus = getStatusOrDefault(((SpServerRtException) ex).getError()); + if (ex instanceof AbstractServerRtException) { + responseStatus = getStatusOrDefault(((AbstractServerRtException) ex).getError()); } else { responseStatus = DEFAULT_RESPONSE_STATUS; } @@ -152,8 +152,8 @@ public class ResponseExceptionHandler { final ExceptionInfo response = new ExceptionInfo(); response.setMessage(ex.getMessage()); response.setExceptionClass(ex.getClass().getName()); - if (ex instanceof SpServerRtException) { - response.setErrorCode(((SpServerRtException) ex).getError().getKey()); + if (ex instanceof AbstractServerRtException) { + response.setErrorCode(((AbstractServerRtException) ex).getError().getKey()); } return response; diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterSyntaxErrorException.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterSyntaxErrorException.java index a8d476ac1..d43cec066 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterSyntaxErrorException.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterSyntaxErrorException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.rest.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception used by the REST API in case of invalid sort parameter syntax. @@ -18,7 +18,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class SortParameterSyntaxErrorException extends SpServerRtException { +public class SortParameterSyntaxErrorException extends AbstractServerRtException { /** * diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedDirectionException.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedDirectionException.java index b44b94917..6a79e8abe 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedDirectionException.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedDirectionException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.rest.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception used by the REST API in case of invalid sort parameter direction @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class SortParameterUnsupportedDirectionException extends SpServerRtException { +public class SortParameterUnsupportedDirectionException extends AbstractServerRtException { /** * diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedFieldException.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedFieldException.java index c9ce0dcdd..a00d245ab 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedFieldException.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/exception/SortParameterUnsupportedFieldException.java @@ -9,7 +9,7 @@ package org.eclipse.hawkbit.rest.exception; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Exception used by the REST API in case of invalid field name in the sort @@ -19,7 +19,7 @@ import org.eclipse.hawkbit.exception.SpServerRtException; * * */ -public class SortParameterUnsupportedFieldException extends SpServerRtException { +public class SortParameterUnsupportedFieldException extends AbstractServerRtException { /** * diff --git a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileSteamingFailedException.java b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileSteamingFailedException.java index abf7c0245..472c78c2a 100644 --- a/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileSteamingFailedException.java +++ b/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileSteamingFailedException.java @@ -9,12 +9,12 @@ package org.eclipse.hawkbit.rest.util; import org.eclipse.hawkbit.exception.SpServerError; -import org.eclipse.hawkbit.exception.SpServerRtException; +import org.eclipse.hawkbit.exception.AbstractServerRtException; /** * Thrown if artifact content streaming to client failed. */ -public final class FileSteamingFailedException extends SpServerRtException { +public final class FileSteamingFailedException extends AbstractServerRtException { private static final long serialVersionUID = 1L;