@@ -37,4 +37,4 @@ public interface ProtocolProperties {
|
||||
* @return <code>true</code> if the {@link ProtocolProperties} is enabled.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.net.URI;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CancelTargetAssignmentEvent extends AbstractEvent {
|
||||
public class CancelTargetAssignmentEvent extends DefaultEvent {
|
||||
|
||||
private final String controllerId;
|
||||
private final Long actionId;
|
||||
|
||||
@@ -12,11 +12,10 @@ package org.eclipse.hawkbit.eventbus.event;
|
||||
* Abstract event definition class which holds the necessary revsion and tenant
|
||||
* information which every event needs.
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
* @see AbstractDistributedEvent for events which should be distributed to other
|
||||
* cluster nodes
|
||||
*/
|
||||
public class AbstractEvent implements Event {
|
||||
public class DefaultEvent implements Event {
|
||||
|
||||
private final long revision;
|
||||
private final String tenant;
|
||||
@@ -27,7 +26,7 @@ public class AbstractEvent implements Event {
|
||||
* @param tenant
|
||||
* the tenant of the event
|
||||
*/
|
||||
protected AbstractEvent(final long revision, final String tenant) {
|
||||
protected DefaultEvent(final long revision, final String tenant) {
|
||||
this.revision = revision;
|
||||
this.tenant = tenant;
|
||||
}
|
||||
@@ -9,9 +9,7 @@
|
||||
package org.eclipse.hawkbit.eventbus.event;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* The event when a target is deleted.
|
||||
*/
|
||||
public class TargetDeletedEvent extends AbstractDistributedEvent {
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ package org.eclipse.hawkbit.exception;
|
||||
* Generic Custom Exception to wrap the Runtime and checked exception
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class SpServerRtException extends RuntimeException {
|
||||
public abstract class AbstractServerRtException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -28,7 +27,7 @@ public abstract class SpServerRtException extends RuntimeException {
|
||||
* @param error
|
||||
* detail
|
||||
*/
|
||||
public SpServerRtException(final SpServerError error) {
|
||||
public AbstractServerRtException(final SpServerError error) {
|
||||
super(error.getMessage());
|
||||
this.error = error;
|
||||
}
|
||||
@@ -41,7 +40,7 @@ public abstract class SpServerRtException extends RuntimeException {
|
||||
* @param error
|
||||
* detail
|
||||
*/
|
||||
public SpServerRtException(final String message, final SpServerError error) {
|
||||
public AbstractServerRtException(final String message, final SpServerError error) {
|
||||
super(message);
|
||||
this.error = error;
|
||||
}
|
||||
@@ -56,7 +55,7 @@ public abstract class SpServerRtException extends RuntimeException {
|
||||
* @param cause
|
||||
* of the exception
|
||||
*/
|
||||
public SpServerRtException(final String message, final SpServerError error, final Throwable cause) {
|
||||
public AbstractServerRtException(final String message, final SpServerError error, final Throwable cause) {
|
||||
super(message, cause);
|
||||
this.error = error;
|
||||
}
|
||||
@@ -69,7 +68,7 @@ public abstract class SpServerRtException extends RuntimeException {
|
||||
* @param cause
|
||||
* of the exception
|
||||
*/
|
||||
public SpServerRtException(final SpServerError error, final Throwable cause) {
|
||||
public AbstractServerRtException(final SpServerError error, final Throwable cause) {
|
||||
super(error.getMessage(), cause);
|
||||
this.error = error;
|
||||
}
|
||||
@@ -16,7 +16,7 @@ package org.eclipse.hawkbit.exception;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GenericSpServerException extends SpServerRtException {
|
||||
public class GenericSpServerException extends AbstractServerRtException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_REPO_GENERIC_ERROR;
|
||||
|
||||
|
||||
@@ -11,11 +11,8 @@ package org.eclipse.hawkbit.repository;
|
||||
/**
|
||||
* Sort fields for {@link ActionRest}.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum ActionFields implements FieldNameProvider,FieldValueConverter<ActionFields> {
|
||||
public enum ActionFields implements FieldNameProvider, FieldValueConverter<ActionFields> {
|
||||
|
||||
/**
|
||||
* The status field.
|
||||
@@ -42,13 +39,10 @@ public enum ActionFields implements FieldNameProvider,FieldValueConverter<Action
|
||||
|
||||
@Override
|
||||
public Object convertValue(final ActionFields e, final String value) {
|
||||
switch (e) {
|
||||
case STATUS:
|
||||
if (STATUS.equals(e)) {
|
||||
return convertStatusValue(value);
|
||||
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static Object convertStatusValue(final String value) {
|
||||
@@ -64,11 +58,9 @@ public enum ActionFields implements FieldNameProvider,FieldValueConverter<Action
|
||||
|
||||
@Override
|
||||
public String[] possibleValues(final ActionFields e) {
|
||||
switch (e) {
|
||||
case STATUS:
|
||||
if (STATUS.equals(e)) {
|
||||
return new String[] { ACTIVE, INACTIVE };
|
||||
default:
|
||||
return new String[0];
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface FieldNameProvider {
|
||||
/**
|
||||
* Separator for the sub attributes
|
||||
*/
|
||||
public static final String SUB_ATTRIBUTE_SEPERATOR = ".";
|
||||
String SUB_ATTRIBUTE_SEPERATOR = ".";
|
||||
|
||||
/**
|
||||
* @return the string representation of the underlying persistence field
|
||||
@@ -30,13 +30,24 @@ public interface FieldNameProvider {
|
||||
*/
|
||||
String getFieldName();
|
||||
|
||||
/**
|
||||
* Contains the sub entity the given field.
|
||||
*
|
||||
* @param propertyField
|
||||
* the given field
|
||||
* @return <true> contains <false> contains not
|
||||
*/
|
||||
default boolean containsSubEntityAttribute(final String propertyField) {
|
||||
return FieldNameProvider.containsSubEntityAttribute(propertyField, getSubEntityAttributes());
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return all sub entities attributes.
|
||||
*/
|
||||
default List<String> getSubEntityAttributes() {
|
||||
return Collections.emptyList();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* the database column for the key
|
||||
@@ -59,11 +70,11 @@ public interface FieldNameProvider {
|
||||
/**
|
||||
* Is the entity field a {@link Map}.
|
||||
*
|
||||
* @return
|
||||
* @return <true> is a map <false> is not a map
|
||||
*/
|
||||
default boolean isMap() {
|
||||
return getKeyFieldName() != null;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a sub attribute exists.
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.tenancy.configuration;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* The {@link #InvalidTenantConfigurationKeyException} is thrown when an invalid
|
||||
* configuration key is used.
|
||||
*
|
||||
*/
|
||||
public class InvalidTenantConfigurationKeyException extends SpServerRtException {
|
||||
public class InvalidTenantConfigurationKeyException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_KEY_INVALID;
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface TenantConfigurationValidator {
|
||||
* @throws TenantConfigurationValidatorException
|
||||
* is thrown, when parameter is invalid.
|
||||
*/
|
||||
default void validate(final Object tenantConfigurationValue) throws TenantConfigurationValidatorException {
|
||||
default void validate(final Object tenantConfigurationValue) {
|
||||
if (tenantConfigurationValue != null
|
||||
&& validateToClass().isAssignableFrom(tenantConfigurationValue.getClass())) {
|
||||
return;
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
package org.eclipse.hawkbit.tenancy.configuration.validator;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.SpServerRtException;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
|
||||
/**
|
||||
* Exception which is thrown, when the validation of the configuration value has
|
||||
* not been successful.
|
||||
*
|
||||
*/
|
||||
public class TenantConfigurationValidatorException extends SpServerRtException {
|
||||
public class TenantConfigurationValidatorException extends AbstractServerRtException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final SpServerError THIS_ERROR = SpServerError.SP_CONFIGURATION_VALUE_INVALID;
|
||||
|
||||
Reference in New Issue
Block a user