Small fixes

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-05-31 10:48:56 +02:00
committed by Michael Hirsch
parent 14cb962f42
commit b14d3bbd3c
42 changed files with 66 additions and 70 deletions

View File

@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
@@ -149,10 +149,10 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
actionStatus.setStatus(Status.DOWNLOAD);
if (range != null) {
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
+ request.getRequestURI());
} else {
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
}
controllerManagement.addInformationalActionStatus(actionStatus);
return action;

View File

@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
@@ -185,10 +185,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
statusMessage.setStatus(Status.DOWNLOAD);
if (range != null) {
statusMessage.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
+ request.getRequestURI());
} else {
statusMessage.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
}
controllerManagement.addInformationalActionStatus(statusMessage);
return action;
@@ -251,7 +251,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Found an active UpdateAction for target {}. returning deyploment: {}", targetid, base);
controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
+ "Target retrieved update action and should start now the download.");
return new ResponseEntity<>(base, HttpStatus.OK);
@@ -306,13 +306,13 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Controller confirmed cancel (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.CANCELED);
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation.");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target confirmed cancelation.");
break;
case REJECTED:
LOG.info("Controller reported internal error (actionid: {}, targetid: {}) as we got {} report.", actionid,
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.WARNING);
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target REJECTED update.");
break;
case CLOSED:
handleClosedUpdateStatus(feedback, targetid, actionid, actionStatus);
@@ -340,7 +340,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
targetid, feedback.getStatus().getExecution());
actionStatus.setStatus(Status.RUNNING);
actionStatus
.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
}
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
@@ -349,10 +349,10 @@ public class DdiRootController implements DdiRootControllerRestApi {
feedback.getStatus().getExecution());
if (feedback.getStatus().getResult().getFinished() == FinalResult.FAILURE) {
actionStatus.setStatus(Status.ERROR);
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with ERROR!");
} else {
actionStatus.setStatus(Status.FINISHED);
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported CLOSED with OK!");
}
}
@@ -390,7 +390,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
LOG.debug("Found an active CancelAction for target {}. returning cancel: {}", targetid, cancel);
controllerManagement.registerRetrieved(action, Constants.SERVER_MESSAGE_PREFIX
controllerManagement.registerRetrieved(action, RepositoryConstants.SERVER_MESSAGE_PREFIX
+ "Target retrieved cancel action and should start now the cancelation.");
return new ResponseEntity<>(cancel, HttpStatus.OK);

View File

@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.Constants;
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.Target;
@@ -113,7 +113,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.FORCED,
Constants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
RepositoryModelConstants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);
@@ -250,7 +250,7 @@ public class DdiDeploymentBaseTest extends AbstractRestIntegrationTestWithMongoD
assertThat(deploymentManagement.countActionStatusAll()).isEqualTo(0);
List<Target> saved = deploymentManagement.assignDistributionSet(ds.getId(), ActionType.SOFT,
Constants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
RepositoryModelConstants.NO_FORCE_TIME, savedTarget.getControllerId()).getAssignedEntity();
assertThat(deploymentManagement.findActiveActionsByTarget(savedTarget)).hasSize(1);
final Action action = deploymentManagement.findActiveActionsByTarget(savedTarget).get(0);

View File

@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
import org.eclipse.hawkbit.dmf.json.model.SoftwareModule;
import org.eclipse.hawkbit.eventbus.EventSubscriber;
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.util.IpUtil;
@@ -53,14 +52,11 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
@Autowired
private AmqpSenderService amqpSenderService;
@Autowired
private SoftwareManagement softwareManagement;
/**
* Constructor.
*
* @param messageConverter
* message converter
* @param rabbitTemplate
* the rabbitTemplate
*/
@Autowired
public AmqpMessageDispatcherService(final RabbitTemplate rabbitTemplate) {
@@ -118,7 +114,7 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
}
private MessageProperties createConnectorMessageProperties(final String tenant, final String controllerId,
private static MessageProperties createConnectorMessageProperties(final String tenant, final String controllerId,
final EventTopic topic) {
final MessageProperties messageProperties = createMessageProperties();
messageProperties.setHeader(MessageHeaderKey.TOPIC, topic);

View File

@@ -15,7 +15,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
* Repository constants.
*
*/
public final class Constants {
public final class RepositoryConstants {
/**
* Prefix that the server puts in front of
@@ -30,7 +30,7 @@ public final class Constants {
*/
public static final int DEFAULT_DS_TYPES_IN_TENANT = 2;
private Constants() {
private RepositoryConstants() {
// Utility class.
}

View File

@@ -74,7 +74,7 @@ public interface SystemManagement {
/**
* Returns {@link TenantMetaData} of given and current tenant. Creates for
* new tenants also two {@link SoftwareModuleType} (os and app) and
* {@link Constants#DEFAULT_DS_TYPES_IN_TENANT} {@link DistributionSetType}s
* {@link RepositoryConstants#DEFAULT_DS_TYPES_IN_TENANT} {@link DistributionSetType}s
* (os and os_app).
*
* DISCLAIMER: this variant is used during initial login (where the tenant

View File

@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.model;
* Repository model constants.
*
*/
public final class Constants {
public final class RepositoryModelConstants {
/**
* indicating that target action has no force time which is only needed in
@@ -20,7 +20,7 @@ public final class Constants {
*/
public static final Long NO_FORCE_TIME = 0L;
private Constants() {
private RepositoryModelConstants() {
// Utility class.
}

View File

@@ -19,7 +19,7 @@ public class TargetWithActionStatus {
private Target target;
private Status status = null;
private Status status;
public TargetWithActionStatus(final Target target) {
this.target = target;

View File

@@ -51,7 +51,7 @@ public class TargetWithActionType {
if (actionType == ActionType.TIMEFORCED) {
return forceTime;
}
return Constants.NO_FORCE_TIME;
return RepositoryModelConstants.NO_FORCE_TIME;
}
/**

View File

@@ -19,7 +19,7 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
@@ -216,7 +216,7 @@ public class JpaControllerManagement implements ControllerManagement {
handleFinishedCancelation(actionStatus, action);
break;
case RETRIEVED:
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation request retrieved.");
break;
default:
// do nothing
@@ -230,7 +230,7 @@ public class JpaControllerManagement implements ControllerManagement {
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
// in case of successful cancellation we also report the success at
// the canceled action itself.
actionStatus.addMessage(Constants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
entityManager);
}

View File

@@ -145,7 +145,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
return assignDistributionSetByTargetId((JpaDistributionSet) pset,
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()),
ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME);
ActionType.FORCED, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME);
}
@@ -155,7 +155,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
return assignDistributionSet(dsID, ActionType.FORCED,
org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME, targetIDs);
org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME, targetIDs);
}
@Override

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository.jpa.cache;
import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
/**
* Constants for cache keys used in multiple classes.
* RepositoryConstants for cache keys used in multiple classes.
*
*
*

View File

@@ -842,7 +842,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
final DistributionSet ds = testdataFactory.createDistributionSet("a");
// assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
ds.getId(), ActionType.SOFT, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
target.getControllerId());
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify preparation
@@ -865,7 +865,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
final DistributionSet ds = testdataFactory.createDistributionSet("a");
// assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement.assignDistributionSet(
ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.Constants.NO_FORCE_TIME,
ds.getId(), ActionType.FORCED, org.eclipse.hawkbit.repository.model.RepositoryModelConstants.NO_FORCE_TIME,
target.getControllerId());
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify perparation

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.repository.util;
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.Constants;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
@@ -72,7 +72,7 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
* {@link TestdataFactory#findOrCreateDefaultTestDsType()} and two
* {@link SystemManagement#getTenantMetadata()};
*/
protected static final int DEFAULT_DS_TYPES = Constants.DEFAULT_DS_TYPES_IN_TENANT + 1;
protected static final int DEFAULT_DS_TYPES = RepositoryConstants.DEFAULT_DS_TYPES_IN_TENANT + 1;
@Autowired
protected EntityFactory entityFactory;

View File

@@ -24,7 +24,7 @@ import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Constants;
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.common.confirmwindow.layout.AbstractConfirmationWindowLayout;
@@ -148,7 +148,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
final long forcedTimeStamp = (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout
.getActionTypeOptionGroup().getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Constants.NO_FORCE_TIME;
: RepositoryModelConstants.NO_FORCE_TIME;
final Map<Long, ArrayList<TargetIdName>> saveAssignedList = new HashMap<>();

View File

@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Constants;
import org.eclipse.hawkbit.repository.model.RepositoryModelConstants;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
@@ -465,7 +465,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED)
? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Constants.NO_FORCE_TIME;
: RepositoryModelConstants.NO_FORCE_TIME;
}
private ActionType getActionType() {

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.utils;
/**
* Constants required for Button.
* RepositoryConstants required for Button.
*
*
*

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.utils;
import com.vaadin.ui.themes.ValoTheme;
/**
* Constants required for Label.
* RepositoryConstants required for Label.
*
*
*

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.utils;
/**
* Constants required for Style.
* RepositoryConstants required for Style.
*
*
*

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.ui.utils;
/**
* Constants required for Target.
* RepositoryConstants required for Target.
*
*
*