Feature horizontal scalability (#305)
Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
committed by
Kai Zimmermann
parent
07cb62a3dd
commit
866bc72114
@@ -16,7 +16,7 @@ import java.util.Optional;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.DownloadProgressEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.DownloadProgressEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
||||
@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
@@ -34,8 +33,6 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* Service layer for all operations of the DDI API (with access permissions only
|
||||
* for the controller).
|
||||
@@ -59,7 +56,7 @@ public interface ControllerManagement {
|
||||
Action addCancelActionStatus(@NotNull ActionStatus actionStatus);
|
||||
|
||||
/**
|
||||
* Sends the download progress and notifies the {@link EventBus} with a
|
||||
* Sends the download progress and notifies the event publisher with a
|
||||
* {@link DownloadProgressEvent}.
|
||||
*
|
||||
* @param statusId
|
||||
@@ -148,19 +145,6 @@ public interface ControllerManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Target findOrRegisterTargetIfItDoesNotexist(@NotEmpty String controllerId, URI address);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link SoftwareModule}s which are assigned to the given
|
||||
* {@link DistributionSet}.
|
||||
*
|
||||
* @param distributionSet
|
||||
* the distribution set which should be assigned to the returned
|
||||
* {@link SoftwareModule}s
|
||||
* @return a list of {@link SoftwareModule}s assigned to given
|
||||
* {@code distributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
List<SoftwareModule> findSoftwareModulesByDistributionSet(@NotNull DistributionSet distributionSet);
|
||||
|
||||
/**
|
||||
* Retrieves last {@link Action} for a download of an artifact of given
|
||||
* module and target.
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||
import org.eclipse.hawkbit.repository.model.ActionWithStatusCount;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.eventbus.event.RolloutGroupCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutGroupCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.exception.RolloutIllegalStateException;
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfigurationValue;
|
||||
@@ -40,7 +42,8 @@ public interface TenantConfigurationManagement {
|
||||
* if the property cannot be converted to the given
|
||||
*/
|
||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
<T> TenantConfigurationValue<T> addOrUpdateConfiguration(TenantConfigurationKey configurationKey, T value);
|
||||
<T extends Serializable> TenantConfigurationValue<T> addOrUpdateConfiguration(
|
||||
TenantConfigurationKey configurationKey, T value);
|
||||
|
||||
/**
|
||||
* Build the tenant configuration by the given key
|
||||
@@ -55,8 +58,8 @@ public interface TenantConfigurationManagement {
|
||||
* or returns the tenant configuration value
|
||||
*/
|
||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
<T> TenantConfigurationValue<T> buildTenantConfigurationValueByKey(TenantConfigurationKey configurationKey,
|
||||
Class<T> propertyType, TenantConfiguration tenantConfiguration);
|
||||
<T extends Serializable> TenantConfigurationValue<T> buildTenantConfigurationValueByKey(
|
||||
TenantConfigurationKey configurationKey, Class<T> propertyType, TenantConfiguration tenantConfiguration);
|
||||
|
||||
/**
|
||||
* Deletes a specific configuration for the current tenant. Does nothing in
|
||||
@@ -87,7 +90,7 @@ public interface TenantConfigurationManagement {
|
||||
* {@code propertyType}
|
||||
*/
|
||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
<T> TenantConfigurationValue<T> getConfigurationValue(TenantConfigurationKey configurationKey);
|
||||
<T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(TenantConfigurationKey configurationKey);
|
||||
|
||||
/**
|
||||
* Retrieves a configuration value from the e.g. tenant overwritten
|
||||
@@ -113,7 +116,7 @@ public interface TenantConfigurationManagement {
|
||||
* {@code propertyType}
|
||||
*/
|
||||
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
<T> TenantConfigurationValue<T> getConfigurationValue(TenantConfigurationKey configurationKey,
|
||||
<T extends Serializable> TenantConfigurationValue<T> getConfigurationValue(TenantConfigurationKey configurationKey,
|
||||
Class<T> propertyType);
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event;
|
||||
|
||||
/**
|
||||
* Events to be published to refresh data on UI.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum CustomEvents {
|
||||
|
||||
TARGETS_CREATED_EVENT,
|
||||
|
||||
DISTRIBUTION_CREATED_EVENT
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event;
|
||||
|
||||
/**
|
||||
* An event declaration which holds an revision for each event so consumers have
|
||||
* the chance to know if they might already retrieved a newer event.
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface TenantAwareEvent {
|
||||
|
||||
/**
|
||||
* @return the tenant of the event.
|
||||
*/
|
||||
String getTenant();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the remote event for deletion of {@link DistributionSet}.
|
||||
*/
|
||||
public class DistributionSetDeletedEvent extends RemoteIdEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetDeletedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public DistributionSetDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
|
||||
/**
|
||||
* Defines the the remote event of delete a {@link DistributionSetTag}.
|
||||
*/
|
||||
public class DistributionSetTagDeletedEvent extends RemoteIdEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetTagDeletedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for json serialization.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
|
||||
public DistributionSetTagDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent that contains an updated download progress for a given
|
||||
* ActionStatus that was written for a download request.
|
||||
*
|
||||
*/
|
||||
public class DownloadProgressEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long shippedBytesSinceLast;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DownloadProgressEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param shippedBytesSinceLast
|
||||
* the shippedBytesSinceLast
|
||||
* @param applicationId
|
||||
* the application id.
|
||||
*/
|
||||
public DownloadProgressEvent(final String tenant, final Long shippedBytesSinceLast, final String applicationId) {
|
||||
super(shippedBytesSinceLast, tenant, applicationId);
|
||||
this.shippedBytesSinceLast = shippedBytesSinceLast;
|
||||
}
|
||||
|
||||
public long getShippedBytesSinceLast() {
|
||||
return shippedBytesSinceLast;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
|
||||
/**
|
||||
* Loads an entity e.g. if a remote event is received.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface EventEntityManager {
|
||||
|
||||
/**
|
||||
* Find an entity by given id and return it.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param id
|
||||
* the id
|
||||
* @param entityType
|
||||
* the entity type
|
||||
* @return the entity
|
||||
*/
|
||||
<E extends TenantAwareBaseEntity> E findEntity(String tenant, Long id, Class<E> entityType);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* A singleton bean which holds the event entity manager to have autowiring in
|
||||
* the events.
|
||||
*
|
||||
*/
|
||||
public final class EventEntityManagerHolder {
|
||||
|
||||
private static final EventEntityManagerHolder SINGLETON = new EventEntityManagerHolder();
|
||||
|
||||
@Autowired
|
||||
private EventEntityManager eventEntityManager;
|
||||
|
||||
private EventEntityManagerHolder() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cache manager holder singleton instance
|
||||
*/
|
||||
public static EventEntityManagerHolder getInstance() {
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the eventEntityManager
|
||||
*/
|
||||
public EventEntityManager getEventEntityManager() {
|
||||
return eventEntityManager;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
/**
|
||||
* An base definition class for an event which contains an id.
|
||||
*
|
||||
*/
|
||||
public class RemoteIdEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long entityId;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected RemoteIdEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for json serialization.
|
||||
*
|
||||
* @param entityId
|
||||
* the entity Id
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
protected RemoteIdEvent(final Long entityId, final String tenant, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public Long getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.event.TenantAwareEvent;
|
||||
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
|
||||
|
||||
/**
|
||||
* A distributed tenant aware event. It's the base class of the other
|
||||
* distributed events. All the necessary information of distributing events to
|
||||
* other nodes.
|
||||
*
|
||||
*/
|
||||
public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements TenantAwareEvent {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String tenant;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected RemoteTenantAwareEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param source
|
||||
* the for the remote event.
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param applicationId
|
||||
* the applicationId
|
||||
*/
|
||||
public RemoteTenantAwareEvent(final Object source, final String tenant, final String applicationId) {
|
||||
super(source, applicationId, "**");
|
||||
this.tenant = tenant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent that gets sent when a distribution set gets assigned to a
|
||||
* target.
|
||||
*/
|
||||
public class TargetAssignDistributionSetEvent extends RemoteTenantAwareEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long actionId;
|
||||
|
||||
private Long distributionSetId;
|
||||
|
||||
private String controllerId;
|
||||
|
||||
private transient Collection<SoftwareModule> modules;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetAssignDistributionSetEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param action
|
||||
* the action
|
||||
* @param applicationId
|
||||
* the application id.
|
||||
*/
|
||||
public TargetAssignDistributionSetEvent(final Action action, final String applicationId) {
|
||||
this(action.getTenant(), action.getId(), action.getDistributionSet().getId(),
|
||||
action.getTarget().getControllerId(), applicationId);
|
||||
this.modules = action.getDistributionSet().getModules();
|
||||
|
||||
}
|
||||
|
||||
private TargetAssignDistributionSetEvent(final String tenant, final Long actionId, final Long distributionSetId,
|
||||
final String controllerId, final String applicationId) {
|
||||
super(actionId, tenant, applicationId);
|
||||
this.actionId = actionId;
|
||||
this.distributionSetId = distributionSetId;
|
||||
this.controllerId = controllerId;
|
||||
}
|
||||
|
||||
public Long getActionId() {
|
||||
return actionId;
|
||||
}
|
||||
|
||||
public String getControllerId() {
|
||||
return controllerId;
|
||||
}
|
||||
|
||||
public Long getDistributionSetId() {
|
||||
return distributionSetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return modules if Event has been published by same node otherwise empty.
|
||||
*/
|
||||
@JsonIgnore
|
||||
public Collection<SoftwareModule> getModules() {
|
||||
if (modules == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return modules;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* Defines the remote event of deleting a {@link Target}.
|
||||
*/
|
||||
public class TargetDeletedEvent extends RemoteIdEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetDeletedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for json serialization.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
|
||||
/**
|
||||
* Defines the remote event of delete a {@link TargetTag}.
|
||||
*
|
||||
*/
|
||||
public class TargetTagDeletedEvent extends RemoteIdEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetTagDeletedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for json serialization.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant
|
||||
* @param entityId
|
||||
* the entity id
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetTagDeletedEvent(final String tenant, final Long entityId, final String applicationId) {
|
||||
super(entityId, tenant, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
|
||||
/**
|
||||
* Defines the remote event of creating a new {@link Action}.
|
||||
*/
|
||||
public class ActionCreatedEvent extends RemoteEntityEvent<Action> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public ActionCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param action
|
||||
* the created action
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public ActionCreatedEvent(final Action action, final String applicationId) {
|
||||
super(action, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
|
||||
/**
|
||||
* Defines the remote event of updated a {@link Action}.
|
||||
*/
|
||||
public class ActionUpdatedEvent extends RemoteEntityEvent<Action> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public ActionUpdatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param action
|
||||
* the updated action
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public ActionUpdatedEvent(final Action action, final String applicationId) {
|
||||
super(action, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Event that gets sent when the assignment of a distribution set to a target
|
||||
* gets canceled.
|
||||
*/
|
||||
public class CancelTargetAssignmentEvent extends RemoteEntityEvent<Target> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long actionId;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public CancelTargetAssignmentEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* the target
|
||||
* @param actionId
|
||||
* the actionId
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public CancelTargetAssignmentEvent(final Target baseEntity, final Long actionId, final String applicationId) {
|
||||
super(baseEntity, applicationId);
|
||||
this.actionId = actionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the action id of the assignment
|
||||
*/
|
||||
public Long getActionId() {
|
||||
return actionId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the the remote of creating a new {@link DistributionSet}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetCreatedEvent extends RemoteEntityEvent<DistributionSet> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param distributionSet
|
||||
* the created distributionSet
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public DistributionSetCreatedEvent(final DistributionSet distributionSet, final String applicationId) {
|
||||
super(distributionSet, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,26 +6,35 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} for creation of a new
|
||||
* Defines the {@link RemoteEntityEvent} for creation of a new
|
||||
* {@link DistributionSetTag}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagCreatedEvent extends AbstractBaseEntityEvent<DistributionSetTag> {
|
||||
public class DistributionSetTagCreatedEvent extends RemoteEntityEvent<DistributionSetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetTagCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which is updated
|
||||
* the tag which is deleted
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public DistributionSetTagCreatedEvent(final DistributionSetTag tag) {
|
||||
super(tag);
|
||||
public DistributionSetTagCreatedEvent(final DistributionSetTag tag, final String applicationId) {
|
||||
super(tag, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -6,26 +6,34 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} for update a
|
||||
* {@link DistributionSetTag}.
|
||||
* Defines the remote event for update a {@link DistributionSetTag}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagUpdateEvent extends AbstractBaseEntityEvent<DistributionSetTag> {
|
||||
public class DistributionSetTagUpdateEvent extends RemoteEntityEvent<DistributionSetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetTagUpdateEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which is updated
|
||||
* tag the tag which is updated
|
||||
* @param applicationId
|
||||
* the applicationID
|
||||
*/
|
||||
public DistributionSetTagUpdateEvent(final DistributionSetTag tag) {
|
||||
super(tag);
|
||||
public DistributionSetTagUpdateEvent(final DistributionSetTag tag, final String applicationId) {
|
||||
super(tag, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the remote event for updating a {@link DistributionSet}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetUpdateEvent extends RemoteEntityEvent<DistributionSet> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public DistributionSetUpdateEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ds
|
||||
* Distribution Set
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public DistributionSetUpdateEvent(final DistributionSet ds, final String applicationId) {
|
||||
super(ds, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||
import org.eclipse.hawkbit.repository.event.remote.RemoteIdEvent;
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* A base definition class for remote events which contain a tenant aware base
|
||||
* entity.
|
||||
*
|
||||
* @param <E>
|
||||
* the type of the entity
|
||||
*/
|
||||
public class RemoteEntityEvent<E extends TenantAwareBaseEntity> extends RemoteIdEvent {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(RemoteEntityEvent.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String entityClass;
|
||||
|
||||
private transient E entity;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected RemoteEntityEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* the base entity
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
protected RemoteEntityEvent(final E baseEntity, final String applicationId) {
|
||||
super(baseEntity.getId(), baseEntity.getTenant(), applicationId);
|
||||
this.entityClass = baseEntity.getClass().getName();
|
||||
this.entity = baseEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the entityClass
|
||||
*/
|
||||
public String getEntityClass() {
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public E getEntity() {
|
||||
if (entity == null) {
|
||||
entity = reloadEntityFromRepository();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private E reloadEntityFromRepository() {
|
||||
try {
|
||||
final Class<E> clazz = (Class<E>) ClassUtils.getClass(entityClass);
|
||||
return EventEntityManagerHolder.getInstance().getEventEntityManager().findEntity(getTenant(), getEntityId(),
|
||||
clazz);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
LOG.error("Cannot reload entity because class is not found", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
/**
|
||||
* TenantAwareEvent definition which is been published in case a rollout group
|
||||
* has been created for a specific rollout.
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupCreatedEvent extends RemoteEntityEvent<RolloutGroup> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long rolloutId;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public RolloutGroupCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param rolloutGroup
|
||||
* the updated rolloutGroup
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public RolloutGroupCreatedEvent(final RolloutGroup rolloutGroup, final String applicationId) {
|
||||
super(rolloutGroup, applicationId);
|
||||
this.rolloutId = rolloutGroup.getRollout().getId();
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
/**
|
||||
* Defines the remote event of updated a {@link RolloutGroup}.
|
||||
*/
|
||||
public class RolloutGroupUpdatedEvent extends RemoteEntityEvent<RolloutGroup> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public RolloutGroupUpdatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param rolloutGroup
|
||||
* the updated rolloutGroup
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public RolloutGroupUpdatedEvent(final RolloutGroup rolloutGroup, final String applicationId) {
|
||||
super(rolloutGroup, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
|
||||
/**
|
||||
* Defines the remote event of updated a {@link Rollout}.
|
||||
*/
|
||||
public class RolloutUpdatedEvent extends RemoteEntityEvent<Rollout> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public RolloutUpdatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param rollout
|
||||
* the updated rollout
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public RolloutUpdatedEvent(final Rollout rollout, final String applicationId) {
|
||||
super(rollout, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Defines the remote event of creating a new {@link Target}.
|
||||
*
|
||||
*/
|
||||
public class TargetCreatedEvent extends RemoteEntityEvent<Target> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* the target
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetCreatedEvent(final Target baseEntity, final String applicationId) {
|
||||
super(baseEntity, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,25 +6,34 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of update a {@link TargetTag}.
|
||||
* Defines the remote event for the creation of a new {@link TargetTag}.
|
||||
*
|
||||
*/
|
||||
public class TargetTagDeletedEvent extends AbstractBaseEntityEvent<TargetTag> {
|
||||
public class TargetTagCreatedEvent extends RemoteEntityEvent<TargetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetTagCreatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which is deleted
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetTagDeletedEvent(final TargetTag tag) {
|
||||
super(tag);
|
||||
public TargetTagCreatedEvent(final TargetTag tag, final String applicationId) {
|
||||
super(tag, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -6,25 +6,34 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} for update a {@link TargetTag}.
|
||||
* Defines the remote event for updating a {@link TargetTag}.
|
||||
*
|
||||
*/
|
||||
public class TargetTagUpdateEvent extends AbstractBaseEntityEvent<TargetTag> {
|
||||
public class TargetTagUpdateEvent extends RemoteEntityEvent<TargetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetTagUpdateEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which is updated
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetTagUpdateEvent(final TargetTag tag) {
|
||||
super(tag);
|
||||
public TargetTagUpdateEvent(final TargetTag tag, final String applicationId) {
|
||||
super(tag, applicationId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.event.remote.entity;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Defines the remote event for updating a {@link Target}.
|
||||
*
|
||||
*/
|
||||
public class TargetUpdatedEvent extends RemoteEntityEvent<Target> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TargetUpdatedEvent() {
|
||||
// for serialization libs like jackson
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param baseEntity
|
||||
* Target entity
|
||||
* @param applicationId
|
||||
* the origin application id
|
||||
*/
|
||||
public TargetUpdatedEvent(final Target baseEntity, final String applicationId) {
|
||||
super(baseEntity, applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractDistributedEvent;
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
|
||||
/**
|
||||
* An abstract definition class for {@link EntityEvent} for
|
||||
* {@link TenantAwareBaseEntity}s, which holds the {@link TenantAwareBaseEntity}
|
||||
* .
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param <E>
|
||||
* the type of the {@link TenantAwareBaseEntity}
|
||||
*/
|
||||
public abstract class AbstractBaseEntityEvent<E extends TenantAwareBaseEntity> extends AbstractDistributedEvent
|
||||
implements EntityEvent {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final E entity;
|
||||
|
||||
/**
|
||||
* @param baseEntity
|
||||
* the entity which has been created or modified
|
||||
*/
|
||||
public AbstractBaseEntityEvent(final E baseEntity) {
|
||||
super(baseEntity.getOptLockRevision(), baseEntity.getTenant());
|
||||
this.entity = baseEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getEntity(final Class<T> entityClass) {
|
||||
return entityClass.cast(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return entity.getTenant();
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
|
||||
|
||||
/**
|
||||
* Property change event.
|
||||
*
|
||||
* @param <E>
|
||||
*/
|
||||
public class AbstractPropertyChangeEvent<E extends TenantAwareBaseEntity> extends AbstractBaseEntityEvent<E> {
|
||||
|
||||
private static final long serialVersionUID = -3671601415138242311L;
|
||||
private final transient Map<String, PropertyChange> changeSet;
|
||||
|
||||
/**
|
||||
* Initialize base entity and property changed with old and new value.
|
||||
*
|
||||
* @param baseEntity
|
||||
* entity changed
|
||||
* @param changeSetValues
|
||||
* details of properties changed and old value and new value of
|
||||
* the changed properties
|
||||
*/
|
||||
public AbstractPropertyChangeEvent(final E baseEntity, final Map<String, PropertyChange> changeSetValues) {
|
||||
super(baseEntity);
|
||||
this.changeSet = changeSetValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the changeSet
|
||||
*/
|
||||
public Map<String, PropertyChange> getChangeSet() {
|
||||
return changeSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Carries old value and new value of a property .
|
||||
*/
|
||||
public static class PropertyChange {
|
||||
|
||||
private final Object oldValue;
|
||||
private final Object newValue;
|
||||
|
||||
/**
|
||||
* Initialize old value and new changes value of property.
|
||||
*
|
||||
* @param oldValue
|
||||
* old value before change
|
||||
* @param newValue
|
||||
* new value after change
|
||||
*/
|
||||
public PropertyChange(final Object oldValue, final Object newValue) {
|
||||
super();
|
||||
this.oldValue = oldValue;
|
||||
this.newValue = newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the oldValue
|
||||
*/
|
||||
public Object getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the newValue
|
||||
*/
|
||||
public Object getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of creating a new {@link Action}.
|
||||
*/
|
||||
public class ActionCreatedEvent extends AbstractBaseEntityEvent<Action> {
|
||||
private static final long serialVersionUID = 181780358321768629L;
|
||||
|
||||
/**
|
||||
* @param action
|
||||
*/
|
||||
public ActionCreatedEvent(final Action action) {
|
||||
super(action);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractPropertyChangeEvent} of {@link Action}.
|
||||
*/
|
||||
public class ActionPropertyChangeEvent extends AbstractPropertyChangeEvent<Action> {
|
||||
private static final long serialVersionUID = 181780358321768629L;
|
||||
|
||||
/**
|
||||
* @param action
|
||||
* @param changeSetValues
|
||||
*/
|
||||
public ActionPropertyChangeEvent(final Action action, final Map<String, PropertyChange> changeSetValues) {
|
||||
super(action, changeSetValues);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Event that gets sent when the assignment of a distribution set to a target
|
||||
* gets canceled.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CancelTargetAssignmentEvent implements Event {
|
||||
|
||||
private final Target target;
|
||||
private final Long actionId;
|
||||
|
||||
/**
|
||||
* Creates a new {@link CancelTargetAssignmentEvent}.
|
||||
*
|
||||
* @param target
|
||||
* entity
|
||||
* @param actionId
|
||||
* the action id of the assignment
|
||||
*/
|
||||
public CancelTargetAssignmentEvent(final Target target, final Long actionId) {
|
||||
this.target = target;
|
||||
this.actionId = actionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the action id of the assignment
|
||||
*/
|
||||
public Long getActionId() {
|
||||
return actionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return target where the action got canceled
|
||||
*/
|
||||
public Target getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRevision() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return target.getTenant();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of creating a new {@link DistributionSet}.
|
||||
*
|
||||
*/
|
||||
public class DistributionCreatedEvent extends AbstractBaseEntityEvent<DistributionSet> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @param distributionSet
|
||||
* the distributionSet which has been created
|
||||
*/
|
||||
public DistributionCreatedEvent(final DistributionSet distributionSet) {
|
||||
super(distributionSet);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractDistributedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractDistributedEvent} for deletion of
|
||||
* {@link DistributionSet}.
|
||||
*/
|
||||
public class DistributionDeletedEvent extends AbstractDistributedEvent {
|
||||
private static final long serialVersionUID = -3308850381757843098L;
|
||||
private final Long distributionId;
|
||||
|
||||
/**
|
||||
* @param tenant
|
||||
* the tenant for this event
|
||||
* @param distributionId
|
||||
* the ID of the distribution set which has been deleted
|
||||
*/
|
||||
public DistributionDeletedEvent(final String tenant, final Long distributionId) {
|
||||
super(-1, tenant);
|
||||
this.distributionId = distributionId;
|
||||
}
|
||||
|
||||
public Long getDistributionSetId() {
|
||||
return distributionId;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
|
||||
|
||||
/**
|
||||
* A event for assignment target tag.
|
||||
*/
|
||||
public class DistributionSetTagAssigmentResultEvent implements Event {
|
||||
|
||||
private final DistributionSetTagAssignmentResult assigmentResult;
|
||||
private final String tenant;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param assigmentResult
|
||||
* the assignment result
|
||||
* @param tenant
|
||||
* current
|
||||
*/
|
||||
public DistributionSetTagAssigmentResultEvent(final DistributionSetTagAssignmentResult assigmentResult,
|
||||
final String tenant) {
|
||||
this.assigmentResult = assigmentResult;
|
||||
this.tenant = tenant;
|
||||
}
|
||||
|
||||
public DistributionSetTagAssignmentResult getAssigmentResult() {
|
||||
return assigmentResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRevision() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of update a
|
||||
* {@link DistributionSetTag}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagDeletedEvent extends AbstractBaseEntityEvent<DistributionSetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which is deleted
|
||||
*/
|
||||
public DistributionSetTagDeletedEvent(final DistributionSetTag tag) {
|
||||
super(tag);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} for update a {@link DistributionSet}.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetUpdateEvent extends AbstractBaseEntityEvent<DistributionSet> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param ds Distribution Set
|
||||
*/
|
||||
public DistributionSetUpdateEvent(final DistributionSet ds) {
|
||||
super(ds);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractDistributedEvent;
|
||||
|
||||
/**
|
||||
* Event that contains an updated download progress for a given ActionStatus
|
||||
* that was written for a download request.
|
||||
*
|
||||
*/
|
||||
public class DownloadProgressEvent extends AbstractDistributedEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Long statusId;
|
||||
private final long requestedBytes;
|
||||
private final long shippedBytesSinceLast;
|
||||
private final long shippedBytesOverall;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant for this event
|
||||
* @param statusId
|
||||
* of ActionStatus that was written for the download request
|
||||
* @param requestedBytes
|
||||
* bytes requested
|
||||
* @param shippedBytesSinceLast
|
||||
* bytes since last event
|
||||
* @param shippedBytesOverall
|
||||
* on the download request
|
||||
*/
|
||||
public DownloadProgressEvent(final String tenant, final Long statusId, final Long requestedBytes,
|
||||
final Long shippedBytesSinceLast, final Long shippedBytesOverall) {
|
||||
// the revision of the DownloadProgressEvent is just equal the
|
||||
// shippedBytesOverall as this is a growing number.
|
||||
super(shippedBytesOverall, tenant);
|
||||
this.statusId = statusId;
|
||||
this.requestedBytes = requestedBytes;
|
||||
this.shippedBytesSinceLast = shippedBytesSinceLast;
|
||||
this.shippedBytesOverall = shippedBytesOverall;
|
||||
}
|
||||
|
||||
public Long getStatusId() {
|
||||
return statusId;
|
||||
}
|
||||
|
||||
public long getRequestedBytes() {
|
||||
return requestedBytes;
|
||||
}
|
||||
|
||||
public long getShippedBytesSinceLast() {
|
||||
return shippedBytesSinceLast;
|
||||
}
|
||||
|
||||
public long getShippedBytesOverall() {
|
||||
return shippedBytesOverall;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
|
||||
/**
|
||||
* Event declaration for the UI to notify the UI that a rollout has been
|
||||
* changed.
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public class RolloutChangeEvent extends DefaultEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
|
||||
/**
|
||||
* @param revision
|
||||
* the revision of the event
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout which has been changed
|
||||
*/
|
||||
public RolloutChangeEvent(final long revision, final String tenant, final Long rolloutId) {
|
||||
super(revision, tenant);
|
||||
this.rolloutId = rolloutId;
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
|
||||
/**
|
||||
* Event declaration for the UI to notify the UI that a rollout has been
|
||||
* changed.
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupChangeEvent extends DefaultEvent {
|
||||
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutGroupId;
|
||||
|
||||
/**
|
||||
* @param revision
|
||||
* the revision of the event
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout which has been changed
|
||||
* @param rolloutGroupId
|
||||
* the ID of the rollout group which has been changed
|
||||
*/
|
||||
public RolloutGroupChangeEvent(final long revision, final String tenant, final Long rolloutId,
|
||||
final Long rolloutGroupId) {
|
||||
super(revision, tenant);
|
||||
this.rolloutId = rolloutId;
|
||||
this.rolloutGroupId = rolloutGroupId;
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
public Long getRolloutGroupId() {
|
||||
return rolloutGroupId;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractDistributedEvent;
|
||||
|
||||
/**
|
||||
* Event definition which is been published in case a rollout group has been
|
||||
* created for a specific rollout.
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public class RolloutGroupCreatedEvent extends AbstractDistributedEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final Long rolloutId;
|
||||
private final Long rolloutGroupId;
|
||||
private final int totalRolloutGroup;
|
||||
private final int createdRolloutGroup;
|
||||
|
||||
/**
|
||||
* Creating a new rollout group created event for a specific rollout.
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant of this event
|
||||
* @param revision
|
||||
* the revision of the event
|
||||
* @param rolloutId
|
||||
* the ID of the rollout the group has been created
|
||||
* @param rolloutGroupId
|
||||
* identifier of this group
|
||||
* @param totalRolloutGroup
|
||||
* the total number of rollout groups for this rollout
|
||||
* @param createdRolloutGroup
|
||||
* the number of already created groups of the rollout
|
||||
*/
|
||||
public RolloutGroupCreatedEvent(final String tenant, final long revision, final Long rolloutId,
|
||||
final Long rolloutGroupId, final int totalRolloutGroup, final int createdRolloutGroup) {
|
||||
super(revision, tenant);
|
||||
this.rolloutId = rolloutId;
|
||||
this.rolloutGroupId = rolloutGroupId;
|
||||
this.totalRolloutGroup = totalRolloutGroup;
|
||||
this.createdRolloutGroup = createdRolloutGroup;
|
||||
|
||||
}
|
||||
|
||||
public Long getRolloutId() {
|
||||
return rolloutId;
|
||||
}
|
||||
|
||||
public int getTotalRolloutGroup() {
|
||||
return totalRolloutGroup;
|
||||
}
|
||||
|
||||
public int getCreatedRolloutGroup() {
|
||||
return createdRolloutGroup;
|
||||
}
|
||||
|
||||
public Long getRolloutGroupId() {
|
||||
return rolloutGroupId;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractPropertyChangeEvent} of {@link RolloutGroup}.
|
||||
*/
|
||||
public class RolloutGroupPropertyChangeEvent extends AbstractPropertyChangeEvent<RolloutGroup> {
|
||||
|
||||
private static final long serialVersionUID = 4026477044419472686L;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param rolloutGroup
|
||||
* @param changeSetValues
|
||||
*/
|
||||
public RolloutGroupPropertyChangeEvent(final RolloutGroup rolloutGroup,
|
||||
final Map<String, PropertyChange> changeSetValues) {
|
||||
super(rolloutGroup, changeSetValues);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractPropertyChangeEvent} of {@link Rollout}.
|
||||
*/
|
||||
public class RolloutPropertyChangeEvent extends AbstractPropertyChangeEvent<Rollout> {
|
||||
private static final long serialVersionUID = 1056221355466373514L;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param rollout
|
||||
* @param changeSetValues
|
||||
*/
|
||||
public RolloutPropertyChangeEvent(final Rollout rollout, final Map<String, PropertyChange> changeSetValues) {
|
||||
super(rollout, changeSetValues);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DefaultEvent;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Event that gets sent when a distribution set gets assigned to a target.
|
||||
*
|
||||
*/
|
||||
public class TargetAssignDistributionSetEvent extends DefaultEvent {
|
||||
|
||||
private final Collection<SoftwareModule> softwareModules;
|
||||
private final Target target;
|
||||
private final Long actionId;
|
||||
|
||||
/**
|
||||
* Creates a new {@link TargetAssignDistributionSetEvent}.
|
||||
*
|
||||
* @param revision
|
||||
* the revision of the event
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
* @param target
|
||||
* the assigned {@link Target}
|
||||
* @param actionId
|
||||
* the action id of the assignment
|
||||
* @param softwareModules
|
||||
* the software modules which have been assigned to the target
|
||||
*/
|
||||
public TargetAssignDistributionSetEvent(final long revision, final String tenant, final Target target,
|
||||
final Long actionId, final Collection<SoftwareModule> softwareModules) {
|
||||
super(revision, tenant);
|
||||
this.target = target;
|
||||
this.actionId = actionId;
|
||||
this.softwareModules = softwareModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the action id of the assignment
|
||||
*/
|
||||
public Long getActionId() {
|
||||
return actionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link Target} which has been assigned to the distribution
|
||||
* set
|
||||
*/
|
||||
public Target getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the software modules which have been assigned to the target
|
||||
*/
|
||||
public Collection<SoftwareModule> getSoftwareModules() {
|
||||
return softwareModules;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of creating a new {@link Target}.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TargetCreatedEvent extends AbstractBaseEntityEvent<Target> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @param target
|
||||
* the target which has been created
|
||||
*/
|
||||
public TargetCreatedEvent(final Target target) {
|
||||
super(target);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.AbstractDistributedEvent;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* Defines the {@link AbstractBaseEntityEvent} of deleting a {@link Target}.
|
||||
*/
|
||||
public class TargetDeletedEvent extends AbstractDistributedEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final long targetId;
|
||||
|
||||
/**
|
||||
* @param tenant
|
||||
* the tenant for this event
|
||||
* @param targetId
|
||||
* the ID of the target which has been deleted
|
||||
*/
|
||||
public TargetDeletedEvent(final String tenant, final long targetId) {
|
||||
super(-1, tenant);
|
||||
this.targetId = targetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetId
|
||||
*/
|
||||
public long getTargetId() {
|
||||
return targetId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.EntityEvent;
|
||||
import org.eclipse.hawkbit.repository.model.TargetInfo;
|
||||
|
||||
/**
|
||||
* Event for update the targets info.
|
||||
*/
|
||||
public class TargetInfoUpdateEvent implements EntityEvent {
|
||||
|
||||
private final long revision;
|
||||
private final TargetInfo targetInfo;
|
||||
private final String tenant;
|
||||
private String originNodeId;
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param targetInfo
|
||||
* the target info entity
|
||||
*/
|
||||
public TargetInfoUpdateEvent(final TargetInfo targetInfo) {
|
||||
this.targetInfo = targetInfo;
|
||||
this.tenant = targetInfo.getTarget().getTenant();
|
||||
this.revision = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOriginNodeId(final String originNodeId) {
|
||||
this.originNodeId = originNodeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNodeId(final String nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginNodeId() {
|
||||
return this.originNodeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return this.nodeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E> E getEntity(final Class<E> entityClass) {
|
||||
return entityClass.cast(targetInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetInfo getEntity() {
|
||||
return targetInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
|
||||
/**
|
||||
* A event for assignment target tag.
|
||||
*/
|
||||
public class TargetTagAssigmentResultEvent implements Event {
|
||||
|
||||
private final TargetTagAssignmentResult assigmentResult;
|
||||
private final String tenant;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param assigmentResult
|
||||
* the assignment result-
|
||||
* @param tenant
|
||||
* current
|
||||
*/
|
||||
public TargetTagAssigmentResultEvent(final TargetTagAssignmentResult assigmentResult, final String tenant) {
|
||||
this.tenant = tenant;
|
||||
this.assigmentResult = assigmentResult;
|
||||
}
|
||||
|
||||
public TargetTagAssignmentResult getAssigmentResult() {
|
||||
return assigmentResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRevision() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} for creation of a new
|
||||
* {@link TargetTag}.
|
||||
*
|
||||
*/
|
||||
public class TargetTagCreatedEvent extends AbstractBaseEntityEvent<TargetTag> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param tag
|
||||
* the tag which has been created
|
||||
*/
|
||||
public TargetTagCreatedEvent(final TargetTag tag) {
|
||||
super(tag);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.eventbus.event;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
|
||||
/**
|
||||
* Defines the {@link AbstractBaseEntityEvent} of updating a {@link Target}.
|
||||
*
|
||||
*/
|
||||
public class TargetUpdatedEvent extends AbstractBaseEntityEvent<Target> {
|
||||
|
||||
private static final long serialVersionUID = 5665118668865832477L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param baseEntity
|
||||
* Target entity
|
||||
*/
|
||||
public TargetUpdatedEvent(final Target baseEntity) {
|
||||
super(baseEntity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,12 +43,6 @@ public interface ActionStatus extends TenantAwareBaseEntity {
|
||||
*/
|
||||
void addMessage(String message);
|
||||
|
||||
/**
|
||||
* @return current {@link Status#DOWNLOAD} progress if known by the update
|
||||
* server.
|
||||
*/
|
||||
short getDownloadProgressPercent();
|
||||
|
||||
/**
|
||||
* @return immutable list of message entries that in the
|
||||
* {@link ActionStatus}.
|
||||
|
||||
@@ -6,13 +6,12 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository;
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.AssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
@@ -10,16 +10,13 @@ package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.Event;
|
||||
|
||||
/**
|
||||
* Result object for {@link DistributionSetTag} assignments.
|
||||
*
|
||||
*/
|
||||
public class DistributionSetTagAssignmentResult extends AssignmentResult<DistributionSet> implements Event {
|
||||
public class DistributionSetTagAssignmentResult extends AssignmentResult<DistributionSet> {
|
||||
|
||||
private final DistributionSetTag distributionSetTag;
|
||||
private final String tenant;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -39,24 +36,13 @@ public class DistributionSetTagAssignmentResult extends AssignmentResult<Distrib
|
||||
*/
|
||||
public DistributionSetTagAssignmentResult(final int alreadyAssigned, final int assigned, final int unassigned,
|
||||
final List<DistributionSet> assignedDs, final List<DistributionSet> unassignedDs,
|
||||
final DistributionSetTag distributionSetTag, final String tenant) {
|
||||
final DistributionSetTag distributionSetTag) {
|
||||
super(assigned, alreadyAssigned, unassigned, assignedDs, unassignedDs);
|
||||
this.distributionSetTag = distributionSetTag;
|
||||
this.tenant = tenant;
|
||||
}
|
||||
|
||||
public DistributionSetTag getDistributionSetTag() {
|
||||
return distributionSetTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRevision() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,17 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* represents a tenant configuration value including some meta data
|
||||
*
|
||||
* @param <T>
|
||||
* type of the configuration value
|
||||
*/
|
||||
public final class TenantConfigurationValue<T> {
|
||||
public final class TenantConfigurationValue<T extends Serializable> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private T value;
|
||||
private Long lastModifiedAt;
|
||||
private String lastModifiedBy;
|
||||
@@ -87,7 +90,7 @@ public final class TenantConfigurationValue<T> {
|
||||
* the key type
|
||||
* @return the tenant configuration value builder
|
||||
*/
|
||||
public static <K> TenantConfigurationValueBuilder<K> builder() {
|
||||
public static <K extends Serializable> TenantConfigurationValueBuilder<K> builder() {
|
||||
|
||||
return new TenantConfigurationValueBuilder<>();
|
||||
}
|
||||
@@ -98,7 +101,7 @@ public final class TenantConfigurationValue<T> {
|
||||
* @param <T>
|
||||
* type of the configuration value
|
||||
*/
|
||||
public static class TenantConfigurationValueBuilder<T> {
|
||||
public static class TenantConfigurationValueBuilder<T extends Serializable> {
|
||||
|
||||
private final TenantConfigurationValue<T> configuration = new TenantConfigurationValue<>();
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ import java.io.Serializable;
|
||||
* @param <T>
|
||||
* The type parameter for the report series data
|
||||
*/
|
||||
public class InnerOuterDataReportSeries<T extends Serializable> {
|
||||
public class InnerOuterDataReportSeries<T extends Serializable> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final DataReportSeries<T> innerSeries;
|
||||
private final DataReportSeries<T> outerSeries;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user