conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
private final PayloadMapping payloadMapping;
@Nullable private final ReplyTarget replyTarget;
=======
private final PayloadMapping payloadMapping;
>>>>>>>
private final PayloadMapping payloadMapping;
@Nullable private final ReplyTarget replyTarget;
<<<<<<<
this.payloadMapping = builder.payloadMapping;
this.replyTarget = builder.replyTarget;
=======
this.payloadMapping = builder.payloadMapping;
>>>>>>>
this.payloadMapping = builder.payloadMapping;
this.replyTarget = builder.replyTarget;
<<<<<<<
public PayloadMapping getPayloadMapping() {
return payloadMapping;
}
@Override
public Optional<ReplyTarget> getReplyTarget() {
return Optional.ofNullable(replyTarget);
}
@Override
=======
public PayloadMapping getPayloadMapping() {
return payloadMapping;
}
@Override
>>>>>>>
public PayloadMapping getPayloadMapping() {
return payloadMapping;
}
@Override
public Optional<ReplyTarget> getReplyTarget() {
return Optional.ofNullable(replyTarget);
}
@Override
<<<<<<<
jsonObjectBuilder.set(JsonFields.HEADER_MAPPING, headerMapping.toJson(schemaVersion, thePredicate),
predicate);
}
if (!payloadMapping.isEmpty()) {
jsonObjectBuilder.set(JsonFields.PAYLOAD_MAPPING, JsonArray.of(payloadMapping.getMappings()));
}
if (replyTarget != null) {
jsonObjectBuilder.set(JsonFields.REPLY_TARGET, replyTarget.toJson(schemaVersion, thePredicate));
=======
jsonObjectBuilder.set(JsonFields.HEADER_MAPPING, headerMapping.toJson(schemaVersion, thePredicate),
predicate);
}
if (!payloadMapping.isEmpty()) {
jsonObjectBuilder.set(JsonFields.PAYLOAD_MAPPING, payloadMapping.toJson(), predicate);
>>>>>>>
jsonObjectBuilder.set(JsonFields.HEADER_MAPPING, headerMapping.toJson(schemaVersion, thePredicate),
predicate);
}
if (!payloadMapping.isEmpty()) {
jsonObjectBuilder.set(JsonFields.PAYLOAD_MAPPING, payloadMapping.toJson(), predicate);
}
if (replyTarget != null) {
jsonObjectBuilder.set(JsonFields.REPLY_TARGET, replyTarget.toJson(schemaVersion, thePredicate));
<<<<<<<
final PayloadMapping readPayloadMapping =
jsonObject.getValue(JsonFields.PAYLOAD_MAPPING)
.map(ImmutablePayloadMapping::fromJson)
.orElse(ConnectivityModelFactory.emptyPayloadMapping());
final ReplyTarget readReplyTarget =
jsonObject.getValue(JsonFields.REPLY_TARGET).map(ReplyTarget::fromJson).orElse(null);
=======
final PayloadMapping readPayloadMapping =
jsonObject.getValue(JsonFields.PAYLOAD_MAPPING)
.map(ImmutablePayloadMapping::fromJson)
.orElse(ConnectivityModelFactory.emptyPayloadMapping());
>>>>>>>
final PayloadMapping readPayloadMapping =
jsonObject.getValue(JsonFields.PAYLOAD_MAPPING)
.map(ImmutablePayloadMapping::fromJson)
.orElse(ConnectivityModelFactory.emptyPayloadMapping());
final ReplyTarget readReplyTarget =
jsonObject.getValue(JsonFields.REPLY_TARGET).map(ReplyTarget::fromJson).orElse(null);
<<<<<<<
.payloadMapping(readPayloadMapping)
.replyTarget(readReplyTarget)
=======
.payloadMapping(readPayloadMapping)
>>>>>>>
.payloadMapping(readPayloadMapping)
.replyTarget(readReplyTarget)
<<<<<<<
Objects.equals(payloadMapping, that.payloadMapping) &&
Objects.equals(authorizationContext, that.authorizationContext) &&
Objects.equals(replyTarget, that.replyTarget);
=======
Objects.equals(payloadMapping, that.payloadMapping) &&
Objects.equals(authorizationContext, that.authorizationContext);
>>>>>>>
Objects.equals(payloadMapping, that.payloadMapping) &&
Objects.equals(authorizationContext, that.authorizationContext) &&
Objects.equals(replyTarget, that.replyTarget);
<<<<<<<
return Objects.hash(index, addresses, qos, consumerCount, authorizationContext, enforcement, headerMapping,
payloadMapping, replyTarget);
=======
return Objects.hash(index, addresses, qos, consumerCount, authorizationContext, enforcement, headerMapping,
payloadMapping);
>>>>>>>
return Objects.hash(index, addresses, qos, consumerCount, authorizationContext, enforcement, headerMapping,
payloadMapping, replyTarget);
<<<<<<<
", mapping=" + payloadMapping +
", replyTarget=" + replyTarget +
=======
", payloadMapping=" + payloadMapping +
>>>>>>>
", replyTarget=" + replyTarget +
", payloadMapping=" + payloadMapping +
<<<<<<<
public SourceBuilder payloadMapping(final PayloadMapping payloadMapping) {
this.payloadMapping = payloadMapping;
return this;
}
@Override
public SourceBuilder replyTarget(@Nullable final ReplyTarget replyTarget) {
this.replyTarget = replyTarget;
return this;
}
@Override
=======
public SourceBuilder payloadMapping(final PayloadMapping payloadMapping) {
this.payloadMapping = payloadMapping;
return this;
}
@Override
>>>>>>>
public SourceBuilder payloadMapping(final PayloadMapping payloadMapping) {
this.payloadMapping = payloadMapping;
return this;
}
@Override
public SourceBuilder replyTarget(@Nullable final ReplyTarget replyTarget) {
this.replyTarget = replyTarget;
return this;
}
@Override |
<<<<<<<
import java.util.Collections;
import java.util.List;
=======
>>>>>>>
import java.util.Collections;
<<<<<<<
private final Cache<String, TraceContext> traces;
private final MessageHeaderFilter headerFilter;
=======
>>>>>>>
private final Cache<String, TraceContext> traces;
private final MessageHeaderFilter headerFilter;
<<<<<<<
final MessageHeaderFilter headerFilter,
final List<MappingContext> mappingContexts) {
=======
final MessageMappingProcessor processor) {
>>>>>>>
final MessageHeaderFilter headerFilter,
final MessageMappingProcessor processor) {
<<<<<<<
authorizationContext, headerFilter, mappingContexts);
=======
authorizationContext, processor);
>>>>>>>
authorizationContext, headerFilter, processor); |
<<<<<<<
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetrics;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetricsResponse;
import org.eclipse.ditto.signals.commands.things.ThingErrorResponse;
import org.eclipse.ditto.signals.commands.things.exceptions.ThingNotModifiableException;
import org.eclipse.ditto.signals.commands.things.modify.ModifyThing;
import org.eclipse.ditto.signals.commands.things.modify.ModifyThingResponse;
import org.eclipse.ditto.signals.events.things.ThingModifiedEvent;
=======
import org.eclipse.ditto.signals.commands.connectivity.modify.TestConnection;
>>>>>>>
import org.eclipse.ditto.signals.commands.connectivity.modify.TestConnection;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetrics;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetricsResponse;
import org.eclipse.ditto.signals.commands.things.ThingErrorResponse;
import org.eclipse.ditto.signals.commands.things.exceptions.ThingNotModifiableException;
import org.eclipse.ditto.signals.commands.things.modify.ModifyThing;
import org.eclipse.ditto.signals.commands.things.modify.ModifyThingResponse;
import org.eclipse.ditto.signals.events.things.ThingModifiedEvent;
<<<<<<<
@Test
public void testSpecialCharactersInSourceAndRequestMetrics() throws JMSException {
new TestKit(actorSystem) {{
final String sourceWithSpecialCharacters =
IntStream.range(32, 255).mapToObj(i -> (char) i)
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
.toString();
final String sourceWithUnicodeCharacters = "\uD83D\uDE00\uD83D\uDE01\uD83D\uDE02\uD83D\uDE03\uD83D\uDE04" +
"\uD83D\uDE05\uD83D\uDE06\uD83D\uDE07\uD83D\uDE08\uD83D\uDE09\uD83D\uDE0A\uD83D\uDE0B\uD83D\uDE0C" +
"\uD83D\uDE0D\uD83D\uDE0E\uD83D\uDE0F";
final Source source =
ConnectivityModelFactory.newSource(1, 0, sourceWithSpecialCharacters, sourceWithUnicodeCharacters);
final String connectionId = createRandomConnectionId();
final Connection connectionWithSpecialCharacters =
TestConstants.createConnection(connectionId, actorSystem, singletonList(source));
testConsumeMessageAndExpectForwardToConciergeForwarder(connectionWithSpecialCharacters, 1, (cmd) -> {
// nothing to do here
}, ref -> {
ref.tell(RetrieveConnectionMetrics.of(connectionId, DittoHeaders.empty()), getRef());
final RetrieveConnectionMetricsResponse retrieveConnectionMetricsResponse =
expectMsgClass(RetrieveConnectionMetricsResponse.class);
assertThat(retrieveConnectionMetricsResponse.getConnectionMetrics()
.getSourcesMetrics()
.stream()
.findFirst()
.map(metrics -> metrics.getAddressMetrics().get(sourceWithSpecialCharacters + "-0"))
.map(AddressMetric::getStatus))
.contains(ConnectionStatus.OPEN);
assertThat(retrieveConnectionMetricsResponse.getConnectionMetrics()
.getSourcesMetrics()
.stream()
.findFirst()
.map(metrics -> metrics.getAddressMetrics().get(sourceWithUnicodeCharacters + "-0"))
.map(AddressMetric::getStatus))
.contains(ConnectionStatus.OPEN);
});
}};
}
=======
@Test
public void testTestConnection() {
new TestKit(actorSystem) {{
final Props props =
AmqpClientActor.propsForTests(connection, connectionStatus, getRef(), (ac, el) -> mockConnection);
final ActorRef amqpClientActor = actorSystem.actorOf(props);
amqpClientActor.tell(TestConnection.of(connection, DittoHeaders.empty()), getRef());
expectMsgClass(Status.Success.class);
}};
}
@Test
public void testTestConnectionFailsOnTimeout() throws JMSException {
new TestKit(actorSystem) {{
when(mockConnection.createSession(Session.CLIENT_ACKNOWLEDGE)).thenAnswer(
(Answer<Session>) invocationOnMock -> {
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return mockSession;
});
final Props props =
AmqpClientActor.propsForTests(connection, connectionStatus, getRef(), (ac, el) -> mockConnection);
final ActorRef amqpClientActor = actorSystem.actorOf(props);
amqpClientActor.tell(TestConnection.of(connection, DittoHeaders.empty()), getRef());
expectMsgClass(java.time.Duration.ofSeconds(11), Status.Failure.class);
}};
}
>>>>>>>
@Test
public void testSpecialCharactersInSourceAndRequestMetrics() throws JMSException {
new TestKit(actorSystem) {{
final String sourceWithSpecialCharacters =
IntStream.range(32, 255).mapToObj(i -> (char) i)
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
.toString();
final String sourceWithUnicodeCharacters = "\uD83D\uDE00\uD83D\uDE01\uD83D\uDE02\uD83D\uDE03\uD83D\uDE04" +
"\uD83D\uDE05\uD83D\uDE06\uD83D\uDE07\uD83D\uDE08\uD83D\uDE09\uD83D\uDE0A\uD83D\uDE0B\uD83D\uDE0C" +
"\uD83D\uDE0D\uD83D\uDE0E\uD83D\uDE0F";
final Source source =
ConnectivityModelFactory.newSource(1, 0, sourceWithSpecialCharacters, sourceWithUnicodeCharacters);
final String connectionId = createRandomConnectionId();
final Connection connectionWithSpecialCharacters =
TestConstants.createConnection(connectionId, actorSystem, singletonList(source));
testConsumeMessageAndExpectForwardToConciergeForwarder(connectionWithSpecialCharacters, 1, (cmd) -> {
// nothing to do here
}, ref -> {
ref.tell(RetrieveConnectionMetrics.of(connectionId, DittoHeaders.empty()), getRef());
final RetrieveConnectionMetricsResponse retrieveConnectionMetricsResponse =
expectMsgClass(RetrieveConnectionMetricsResponse.class);
assertThat(retrieveConnectionMetricsResponse.getConnectionMetrics()
.getSourcesMetrics()
.stream()
.findFirst()
.map(metrics -> metrics.getAddressMetrics().get(sourceWithSpecialCharacters + "-0"))
.map(AddressMetric::getStatus))
.contains(ConnectionStatus.OPEN);
assertThat(retrieveConnectionMetricsResponse.getConnectionMetrics()
.getSourcesMetrics()
.stream()
.findFirst()
.map(metrics -> metrics.getAddressMetrics().get(sourceWithUnicodeCharacters + "-0"))
.map(AddressMetric::getStatus))
.contains(ConnectionStatus.OPEN);
});
}};
}
@Test
public void testTestConnection() {
new TestKit(actorSystem) {{
final Props props =
AmqpClientActor.propsForTests(connection, connectionStatus, getRef(), (ac, el) -> mockConnection);
final ActorRef amqpClientActor = actorSystem.actorOf(props);
amqpClientActor.tell(TestConnection.of(connection, DittoHeaders.empty()), getRef());
expectMsgClass(Status.Success.class);
}};
}
@Test
public void testTestConnectionFailsOnTimeout() throws JMSException {
new TestKit(actorSystem) {{
when(mockConnection.createSession(Session.CLIENT_ACKNOWLEDGE)).thenAnswer(
(Answer<Session>) invocationOnMock -> {
try {
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return mockSession;
});
final Props props =
AmqpClientActor.propsForTests(connection, connectionStatus, getRef(), (ac, el) -> mockConnection);
final ActorRef amqpClientActor = actorSystem.actorOf(props);
amqpClientActor.tell(TestConnection.of(connection, DittoHeaders.empty()), getRef());
expectMsgClass(java.time.Duration.ofSeconds(11), Status.Failure.class);
}};
} |
<<<<<<<
import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException;
=======
import org.eclipse.ditto.json.JsonCollectors;
>>>>>>>
import org.eclipse.ditto.json.JsonCollectors;
import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException;
<<<<<<<
import org.eclipse.ditto.signals.commands.base.Command;
import org.eclipse.ditto.signals.commands.base.CommandResponse;
=======
import org.eclipse.ditto.signals.base.WithId;
import org.eclipse.ditto.signals.commands.policies.PolicyCommandSizeValidator;
>>>>>>>
import org.eclipse.ditto.signals.commands.base.Command;
import org.eclipse.ditto.signals.commands.base.CommandResponse;
import org.eclipse.ditto.signals.commands.policies.PolicyCommandSizeValidator; |
<<<<<<<
import com.mongodb.client.model.Filters;
import org.eclipse.ditto.model.query.model.expression.ExistsFieldExpression;
import org.eclipse.ditto.model.query.model.expression.FieldExpressionUtil;
import org.eclipse.ditto.model.query.model.expression.visitors.ExistsFieldExpressionVisitor;
=======
import org.eclipse.ditto.services.thingsearch.querymodel.expression.ExistsFieldExpression;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.FieldExpressionUtil;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.visitors.ExistsFieldExpressionVisitor;
>>>>>>>
import org.eclipse.ditto.model.query.model.expression.ExistsFieldExpression;
import org.eclipse.ditto.model.query.model.expression.FieldExpressionUtil;
import org.eclipse.ditto.model.query.model.expression.visitors.ExistsFieldExpressionVisitor; |
<<<<<<<
protected static AccessControlList getAclOrThrow(final Adaptable adaptable) {
=======
protected static JsonArray thingsArrayFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.filter(JsonValue::isArray)
.map(JsonValue::asArray)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
/**
* @param adaptable the protocol message
* @return the ACL of the adaptable
* @deprecated AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
*/
@Deprecated
protected static AccessControlList aclFrom(final Adaptable adaptable) {
>>>>>>>
/**
* @param adaptable the protocol message
* @return the ACL of the adaptable
* @deprecated AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
*/
@Deprecated
protected static AccessControlList getAclOrThrow(final Adaptable adaptable) {
<<<<<<<
protected static AclEntry getAclEntryOrThrow(final Adaptable adaptable) {
=======
/**
* @param adaptable the protocol message
* @return the ACL-entry of the adaptable
* @deprecated AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
*/
@Deprecated
protected static AclEntry aclEntryFrom(final Adaptable adaptable) {
>>>>>>>
/**
* @param adaptable the protocol message
* @return the ACL-entry of the adaptable
* @deprecated AccessControlLists belong to deprecated API version 1. Use API version 2 with policies instead.
*/
@Deprecated
protected static AclEntry getAclEntryOrThrow(final Adaptable adaptable) { |
<<<<<<<
Assert.assertFalse("The root table should never be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
=======
assertFalse("The root table should never be replicated", ReplicationConfigurationUtil
.isEnabled(extent, new ConfigurationCopy(new HashMap<String,String>())));
>>>>>>>
assertFalse("The root table should never be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
<<<<<<<
Assert.assertFalse("The metadata table should never be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
=======
assertFalse("The metadata table should never be replicated", ReplicationConfigurationUtil
.isEnabled(extent, new ConfigurationCopy(new HashMap<String,String>())));
>>>>>>>
assertFalse("The metadata table should never be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
<<<<<<<
KeyExtent extent = new KeyExtent(Table.ID.of("1"), new Text("b"), new Text("a"));
Assert.assertTrue("Table should be replicated",
ReplicationConfigurationUtil.isEnabled(extent, conf));
=======
KeyExtent extent = new KeyExtent("1", new Text("b"), new Text("a"));
assertTrue("Table should be replicated", ReplicationConfigurationUtil.isEnabled(extent, conf));
>>>>>>>
KeyExtent extent = new KeyExtent(Table.ID.of("1"), new Text("b"), new Text("a"));
assertTrue("Table should be replicated", ReplicationConfigurationUtil.isEnabled(extent, conf));
<<<<<<<
KeyExtent extent = new KeyExtent(Table.ID.of("1"), new Text("b"), new Text("a"));
Assert.assertFalse("Table should not be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>())));
=======
KeyExtent extent = new KeyExtent("1", new Text("b"), new Text("a"));
assertFalse("Table should not be replicated", ReplicationConfigurationUtil.isEnabled(extent,
new ConfigurationCopy(new HashMap<String,String>())));
>>>>>>>
KeyExtent extent = new KeyExtent(Table.ID.of("1"), new Text("b"), new Text("a"));
assertFalse("Table should not be replicated",
ReplicationConfigurationUtil.isEnabled(extent, new ConfigurationCopy(new HashMap<>()))); |
<<<<<<<
import org.eclipse.ditto.services.utils.akka.logging.DittoLoggerFactory;
=======
import org.eclipse.ditto.services.connectivity.messaging.monitoring.logs.ConnectionLogger;
import org.eclipse.ditto.services.utils.akka.LogUtil;
>>>>>>>
import org.eclipse.ditto.services.utils.akka.logging.DittoLoggerFactory;
import org.eclipse.ditto.services.connectivity.messaging.monitoring.logs.ConnectionLogger; |
<<<<<<<
import org.eclipse.ditto.services.connectivity.messaging.config.ConnectionConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.utils.config.DefaultScopedConfig;
=======
import org.eclipse.ditto.services.models.concierge.pubsub.DittoProtocolSub;
import org.eclipse.ditto.services.models.concierge.streaming.StreamingType;
>>>>>>>
import org.eclipse.ditto.services.connectivity.messaging.config.ConnectionConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.models.concierge.pubsub.DittoProtocolSub;
import org.eclipse.ditto.services.models.concierge.streaming.StreamingType;
import org.eclipse.ditto.services.utils.config.DefaultScopedConfig; |
<<<<<<<
private static String getIdOrThrow(final Thing thing) {
return thing.getId().orElseThrow(() -> new NoSuchElementException("Failed to get ID from thing!"));
=======
private ActorRef createPersistenceActorWithPubSubFor(final Thing thing, final ActorRef pubSubMediator) {
return createPersistenceActorWithPubSubFor(getIdOrThrow(thing), pubSubMediator, thingConfig);
}
private static ThingId getIdOrThrow(final Thing thing) {
return thing.getEntityId().orElseThrow(() -> new NoSuchElementException("Failed to get ID from thing!"));
>>>>>>>
private static ThingId getIdOrThrow(final Thing thing) {
return thing.getEntityId().orElseThrow(() -> new NoSuchElementException("Failed to get ID from thing!")); |
<<<<<<<
=======
import org.eclipse.ditto.services.connectivity.messaging.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.HttpPushConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.MonitoringLoggerConfig;
>>>>>>> |
<<<<<<<
import static java.util.stream.Collectors.toMap;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
=======
>>>>>>>
import static java.util.stream.Collectors.toMap;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
<<<<<<<
import java.util.stream.Collectors;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
=======
import java.util.concurrent.TimeUnit;
>>>>>>>
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.TextMessage;
<<<<<<<
traces = new HashMap<>();
final ActorSystem actorSystem = getContext().getSystem();
payloadMappers = mappingContexts.stream()
.collect(Collectors.toMap(MappingContext::getContentType, mappingContext -> {
final Map<String, String> optionsMap = mappingContext.getOptions();
final PayloadMapperOptions.Builder optionsBuilder =
PayloadMappers.createMapperOptionsBuilder(optionsMap);
final PayloadMapperOptions options = optionsBuilder.build();
// dynamically lookup static method for instantiating the payloadMapper:
return Arrays.stream(PayloadMappers.class.getDeclaredMethods())
.filter(m -> m.getReturnType().equals(PayloadMapper.class))
.filter(m -> m.getName()
.toLowerCase()
.contains(mappingContext.getMappingEngine().toLowerCase()))
.findFirst()
.map(m -> {
try {
return (PayloadMapper) m.invoke(null, options);
} catch (final ClassCastException | IllegalAccessException |
InvocationTargetException e) {
log.error(e, "Could not initialize PayloadMapper: <{}>", e.getMessage());
return null;
}
})
// as fallback, try loading the configured "mappingEngine" as implementation of PayloadMapper class:
.orElseGet(() -> {
final String mappingEngineClass = mappingContext.getMappingEngine();
final ClassTag<PayloadMapper> tag =
scala.reflect.ClassTag$.MODULE$.apply(PayloadMapper.class);
final List<Tuple2<Class<?>, Object>> constructorArgs = new ArrayList<>();
constructorArgs.add(Tuple2.apply(PayloadMapperOptions.class, options));
final Try<PayloadMapper> payloadMapperImpl = ((ExtendedActorSystem) actorSystem)
.dynamicAccess()
.createInstanceFor(mappingEngineClass,
JavaConversions.asScalaBuffer(constructorArgs).toList(), tag);
if (payloadMapperImpl.isSuccess()) {
return payloadMapperImpl.get();
} else {
log.error("Could not initialize mappingEngine <{}>",
mappingContext.getMappingEngine());
return null;
}
});
}));
=======
traces = CacheBuilder.newBuilder()
.expireAfterWrite(5, TimeUnit.MINUTES)
.removalListener((RemovalListener<String, TraceContext>) notification
-> log.info("Trace for {} expired.", notification.getKey()))
.build();
>>>>>>>
traces = CacheBuilder.newBuilder()
.expireAfterWrite(5, TimeUnit.MINUTES)
.removalListener((RemovalListener<String, TraceContext>) notification
-> log.info("Trace for {} expired.", notification.getKey()))
.build();
final ActorSystem actorSystem = getContext().getSystem();
payloadMappers = mappingContexts.stream()
.collect(Collectors.toMap(MappingContext::getContentType, mappingContext -> {
final Map<String, String> optionsMap = mappingContext.getOptions();
final PayloadMapperOptions.Builder optionsBuilder =
PayloadMappers.createMapperOptionsBuilder(optionsMap);
final PayloadMapperOptions options = optionsBuilder.build();
// dynamically lookup static method for instantiating the payloadMapper:
return Arrays.stream(PayloadMappers.class.getDeclaredMethods())
.filter(m -> m.getReturnType().equals(PayloadMapper.class))
.filter(m -> m.getName()
.toLowerCase()
.contains(mappingContext.getMappingEngine().toLowerCase()))
.findFirst()
.map(m -> {
try {
return (PayloadMapper) m.invoke(null, options);
} catch (final ClassCastException | IllegalAccessException |
InvocationTargetException e) {
log.error(e, "Could not initialize PayloadMapper: <{}>", e.getMessage());
return null;
}
})
// as fallback, try loading the configured "mappingEngine" as implementation of PayloadMapper class:
.orElseGet(() -> {
final String mappingEngineClass = mappingContext.getMappingEngine();
final ClassTag<PayloadMapper> tag =
scala.reflect.ClassTag$.MODULE$.apply(PayloadMapper.class);
final List<Tuple2<Class<?>, Object>> constructorArgs = new ArrayList<>();
constructorArgs.add(Tuple2.apply(PayloadMapperOptions.class, options));
final Try<PayloadMapper> payloadMapperImpl = ((ExtendedActorSystem) actorSystem)
.dynamicAccess()
.createInstanceFor(mappingEngineClass,
JavaConversions.asScalaBuffer(constructorArgs).toList(), tag);
if (payloadMapperImpl.isSuccess()) {
return payloadMapperImpl.get();
} else {
log.error("Could not initialize mappingEngine <{}>",
mappingContext.getMappingEngine());
return null;
}
});
}));
<<<<<<<
final Optional<TraceContext> traceContext = response.getDittoHeaders().getCorrelationId().map(traces::remove);
if (traceContext.isPresent()) {
traceContext.get().finish();
} else {
log.warning("Trace missing for response: '{}'", response);
}
}
private void handleMessage(final Message message) throws JMSException {
LogUtil.enhanceLogWithCorrelationId(log, message.getJMSCorrelationID());
log.debug("Received Message: {}", message);
final TraceContext traceContext = Kamon.tracer().newContext("commandProcessor",
Option.apply(message.getJMSCorrelationID()));
final Command<?> command = buildCommandFromPublicProtocol(message, traceContext);
traceContext.finish();
if (command != null) {
traceCommand(command);
log.info("Publishing '{}' from AMQP Message '{}'", command.getType(), message.getJMSMessageID());
pubSubMediator.tell(new DistributedPubSubMediator.Send(pubSubTargetActorPath, command, true), getSelf());
}
=======
correlationId.ifPresent(cid -> {
final TraceContext traceContext = traces.getIfPresent(cid);
traces.invalidate(cid);
if (traceContext != null) {
traceContext.finish();
} else {
log.info("Trace missing for response: '{}'", response);
}
});
>>>>>>>
response.getDittoHeaders().getCorrelationId().ifPresent(cid -> {
final TraceContext traceContext = traces.getIfPresent(cid);
traces.invalidate(cid);
if (traceContext != null) {
traceContext.finish();
} else {
log.info("Trace missing for response: '{}'", response);
}
});
<<<<<<<
final Segment protocolAdapterSegment = traceContext
.startSegment("protocoladapter", "payload-mapping", "commandProcessor");
=======
>>>>>>>
final Segment protocolAdapterSegment = traceContext
.startSegment("protocoladapter", "payload-mapping", "commandProcessor");
<<<<<<<
protocolAdapterSegment.finish();
final DittoHeaders dittoHeaders = dittoHeadersBuilder.build();
=======
>>>>>>>
protocolAdapterSegment.finish(); |
<<<<<<<
private final ExponentialBackOffConfig exponentialBackOffConfig;
private final SupervisorStrategy supervisorStrategy;
=======
private final Duration minBackOff;
private final Duration maxBackOff;
private final double randomFactor;
>>>>>>>
private final ExponentialBackOffConfig exponentialBackOffConfig;
<<<<<<<
private ThingSupervisorActor(final ActorRef pubSubMediator,
final ThingConfig thingConfig,
=======
private final SupervisorStrategy supervisorStrategy = new OneForOneStrategy(true, DeciderBuilder
.match(ActorKilledException.class, e -> {
log.error(e, "ActorKilledException in ThingsPersistenceActor, stopping actor: {}", e.message());
return SupervisorStrategy.stop();
})
.matchAny(e -> {
log.error(e,"Passing unhandled error to ThingsRootActor: {}", e.getMessage());
return SupervisorStrategy.escalate();
})
.build());
private ThingSupervisorActor(final Duration minBackOff,
final Duration maxBackOff,
final double randomFactor,
>>>>>>>
private final SupervisorStrategy supervisorStrategy = new OneForOneStrategy(true, DeciderBuilder
.match(ActorKilledException.class, e -> {
log.error(e, "ActorKilledException in ThingsPersistenceActor, stopping actor: {}", e.message());
return SupervisorStrategy.stop();
})
.matchAny(e -> {
log.error(e,"Passing unhandled error to ThingsRootActor: {}", e.getMessage());
return SupervisorStrategy.escalate();
})
.build());
private ThingSupervisorActor(final ActorRef pubSubMediator,
final ThingConfig thingConfig,
<<<<<<<
final SupervisorStrategy supervisorStrategy) {
=======
final ActorRef pubSubMediator) {
>>>>>>>
final SupervisorStrategy supervisorStrategy) {
<<<<<<<
exponentialBackOffConfig = thingConfig.getSupervisorConfig().getExponentialBackOffConfig();
this.supervisorStrategy = supervisorStrategy;
=======
this.minBackOff = minBackOff;
this.maxBackOff = maxBackOff;
this.randomFactor = randomFactor;
>>>>>>>
exponentialBackOffConfig = thingConfig.getSupervisorConfig().getExponentialBackOffConfig();
<<<<<<<
final OneForOneStrategy oneForOneStrategy = new OneForOneStrategy(true, DeciderBuilder
.match(NullPointerException.class, e -> SupervisorStrategy.restart())
.match(ActorKilledException.class, e -> SupervisorStrategy.stop())
.matchAny(e -> SupervisorStrategy.escalate())
.build());
return new ThingSupervisorActor(pubSubMediator, thingConfig, thingPersistenceActorPropsFactory,
oneForOneStrategy);
=======
return new ThingSupervisorActor(minBackOff, maxBackOff, randomFactor, thingPersistenceActorPropsFactory,
pubSubMediator);
>>>>>>>
return new ThingSupervisorActor(minBackOff, maxBackOff, randomFactor, thingPersistenceActorPropsFactory,
pubSubMediator); |
<<<<<<<
private static final Map<String,Map<TableId,TableConfiguration>> tableConfigs = new HashMap<>(1);
private static final Map<String,Map<NamespaceId,NamespaceConfiguration>> namespaceConfigs = new HashMap<>(
1);
private static final Map<String,Map<TableId,NamespaceConfiguration>> tableParentConfigs = new HashMap<>(
1);
=======
private static final Map<String,Map<String,TableConfiguration>> tableConfigs = new HashMap<>(1);
private static final Map<String,Map<String,NamespaceConfiguration>> namespaceConfigs =
new HashMap<>(1);
private static final Map<String,Map<String,NamespaceConfiguration>> tableParentConfigs =
new HashMap<>(1);
>>>>>>>
private static final Map<String,Map<TableId,TableConfiguration>> tableConfigs = new HashMap<>(1);
private static final Map<String,Map<NamespaceId,NamespaceConfiguration>> namespaceConfigs =
new HashMap<>(1);
private static final Map<String,Map<TableId,NamespaceConfiguration>> tableParentConfigs =
new HashMap<>(1);
<<<<<<<
tableParentConfigs.computeIfAbsent(iid, k -> new HashMap<>());
=======
if (!tableParentConfigs.containsKey(iid)) {
tableParentConfigs.put(iid, new HashMap<String,NamespaceConfiguration>());
}
}
}
private static final SecurityPermission CONFIGURATION_PERMISSION =
new SecurityPermission("configurationPermission");
private static final SecurityManager SM = System.getSecurityManager();
private static void checkPermissions() {
if (SM != null) {
SM.checkPermission(CONFIGURATION_PERMISSION);
>>>>>>>
tableParentConfigs.computeIfAbsent(iid, k -> new HashMap<>());
<<<<<<<
systemConfig = new ZooConfigurationFactory().getInstance(context, zcf,
getSiteConfiguration());
=======
checkPermissions();
systemConfig =
new ZooConfigurationFactory().getInstance(instance, zcf, getSiteConfiguration());
>>>>>>>
systemConfig =
new ZooConfigurationFactory().getInstance(context, zcf, getSiteConfiguration()); |
<<<<<<<
import org.eclipse.ditto.services.connectivity.config.ClientConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigBuildable;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigModifiedBehavior;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProvider;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProviderFactory;
import org.eclipse.ditto.services.connectivity.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.MonitoringConfig;
=======
import org.eclipse.ditto.protocoladapter.ProtocolAdapter;
import org.eclipse.ditto.services.connectivity.messaging.config.ClientConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.ConnectivityConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.connectivity.messaging.config.MonitoringConfig;
>>>>>>>
import org.eclipse.ditto.protocoladapter.ProtocolAdapter;
import org.eclipse.ditto.services.connectivity.config.ClientConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigBuildable;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigModifiedBehavior;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProvider;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProviderFactory;
import org.eclipse.ditto.services.connectivity.config.DittoConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.MonitoringConfig;
<<<<<<<
getContext().getSystem(), retrievedConnectivityConfig, protocolAdapterProvider, logger);
=======
getContext().getSystem(),
connectivityConfig,
protocolAdapter,
logger);
>>>>>>>
getContext().getSystem(),
retrievedConnectivityConfig,
protocolAdapter,
logger); |
<<<<<<<
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
connectivityConfigProvider = ConnectivityConfigProviderFactory.getInstance(getContext().getSystem());
=======
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config()));
>>>>>>>
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
connectivityConfigProvider = ConnectivityConfigProviderFactory.getInstance(getContext().getSystem());
<<<<<<<
processor = MessageMappingProcessor.of(connection.getId(), connection.getPayloadMappingDefinition(),
getContext().getSystem(), retrievedConnectivityConfig, protocolAdapterProvider, log);
=======
processor = MessageMappingProcessor.of(connection.getId(), connection.getConnectionType(),
connection.getPayloadMappingDefinition(),
getContext().getSystem(), connectivityConfig, protocolAdapterProvider, logger);
>>>>>>>
processor = MessageMappingProcessor.of(connection.getId(), connection.getConnectionType(),
connection.getPayloadMappingDefinition(),
getContext().getSystem(), retrievedConnectivityConfig, protocolAdapterProvider, logger);
<<<<<<<
/**
* Message sent to {@link MessageMappingProcessorActor} instructing it to replace the current
* {@link MessageMappingProcessor}.
*/
static class ReplaceMessageMappingProcessor {
private final MessageMappingProcessor messageMappingProcessor;
private ReplaceMessageMappingProcessor(
final MessageMappingProcessor messageMappingProcessor) {
this.messageMappingProcessor = messageMappingProcessor;
}
MessageMappingProcessor getMessageMappingProcessor() {
return messageMappingProcessor;
}
}
=======
>>>>>>>
/**
* Message sent to {@link MessageMappingProcessorActor} instructing it to replace the current
* {@link MessageMappingProcessor}.
*/
static class ReplaceMessageMappingProcessor {
private final MessageMappingProcessor messageMappingProcessor;
private ReplaceMessageMappingProcessor(
final MessageMappingProcessor messageMappingProcessor) {
this.messageMappingProcessor = messageMappingProcessor;
}
MessageMappingProcessor getMessageMappingProcessor() {
return messageMappingProcessor;
}
} |
<<<<<<<
import org.eclipse.ditto.services.utils.pubsub.DistributedPub;
import org.eclipse.ditto.signals.base.WithThingId;
=======
>>>>>>>
import org.eclipse.ditto.services.utils.pubsub.DistributedPub;
<<<<<<<
private final String thingId;
private final DistributedPub<ThingEvent> distributedPub;
=======
private final ThingId thingId;
private final ActorRef pubSubMediator;
>>>>>>>
private final ThingId thingId;
private final DistributedPub<ThingEvent> distributedPub;
<<<<<<<
@SuppressWarnings("unused")
private ThingPersistenceActor(final String thingId, final DistributedPub<ThingEvent> distributedPub,
=======
ThingPersistenceActor(final ThingId thingId, final ActorRef pubSubMediator,
>>>>>>>
@SuppressWarnings("unused")
private ThingPersistenceActor(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub,
<<<<<<<
public static Props props(final String thingId, final DistributedPub<ThingEvent> distributedPub,
=======
public static Props props(final ThingId thingId, final ActorRef pubSubMediator,
>>>>>>>
public static Props props(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub,
<<<<<<<
public static Props props(final String thingId, final DistributedPub<ThingEvent> distributedPub) {
return props(thingId, distributedPub, new ThingMongoSnapshotAdapter());
=======
public static Props props(final ThingId thingId, final ActorRef pubSubMediator) {
return props(thingId, pubSubMediator, new ThingMongoSnapshotAdapter());
>>>>>>>
public static Props props(final ThingId thingId, final DistributedPub<ThingEvent> distributedPub) {
return props(thingId, distributedPub, new ThingMongoSnapshotAdapter()); |
<<<<<<<
import org.eclipse.ditto.services.concierge.cache.config.CachesConfig;
=======
import org.eclipse.ditto.model.things.Thing;
>>>>>>>
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.services.concierge.cache.config.CachesConfig;
<<<<<<<
EnforcerActor.props(pubSubMediator, enforcementProviders, enforcementAskTimeout, conciergeForwarder,
enforcerExecutor, enforcementConfig.getBufferSize(), enforcementConfig.getParallelism(),
preEnforcer, thingIdCache, aclEnforcerCache,
policyEnforcerCache) // passes in the caches to be able to invalidate cache entries
.withDispatcher(ENFORCER_DISPATCHER);
=======
EnforcerActor.props(pubSubMediator, enforcementProviders, enforcementAskTimeout,
conciergeForwarder, enforcerExecutor, enforcement.bufferSize(), enforcement.parallelism(),
preEnforcer, thingIdCache, aclEnforcerCache,
policyEnforcerCache) // passes in the caches to be able to invalidate cache entries
.withDispatcher(ENFORCER_DISPATCHER);
>>>>>>>
EnforcerActor.props(pubSubMediator, enforcementProviders, enforcementAskTimeout, conciergeForwarder,
enforcerExecutor, enforcementConfig.getBufferSize(), enforcementConfig.getParallelism(),
preEnforcer, thingIdCache, aclEnforcerCache,
policyEnforcerCache) // passes in the caches to be able to invalidate cache entries
.withDispatcher(ENFORCER_DISPATCHER); |
<<<<<<<
=======
import java.util.Arrays;
import org.eclipse.ditto.model.base.entity.id.NamespacedEntityIdInvalidException;
>>>>>>>
import org.eclipse.ditto.model.base.entity.id.NamespacedEntityIdInvalidException;
<<<<<<<
NamespaceBlockedException.class);
=======
NamespaceBlockedException.class,
NamespacedEntityIdInvalidException.class,
ThingIdInvalidException.class,
PolicyIdInvalidException.class
));
>>>>>>>
NamespaceBlockedException.class,
NamespacedEntityIdInvalidException.class,
ThingIdInvalidException.class,
PolicyIdInvalidException.class
); |
<<<<<<<
import org.eclipse.ditto.services.base.actors.ShutdownBehaviour;
=======
import org.eclipse.ditto.services.base.actors.ShutdownNamespaceBehavior;
import org.eclipse.ditto.services.base.config.DittoServiceConfig;
import org.eclipse.ditto.services.base.config.supervision.ExponentialBackOffConfig;
import org.eclipse.ditto.services.policies.common.config.DittoPoliciesConfig;
>>>>>>>
import org.eclipse.ditto.services.base.actors.ShutdownBehaviour;
import org.eclipse.ditto.services.base.config.DittoServiceConfig;
import org.eclipse.ditto.services.base.config.supervision.ExponentialBackOffConfig;
import org.eclipse.ditto.services.policies.common.config.DittoPoliciesConfig;
<<<<<<<
private final Duration minBackoff;
private final Duration maxBackoff;
private final double randomFactor;
private final SupervisorStrategy supervisorStrategy;
private final ShutdownBehaviour shutdownBehaviour;
=======
private final ExponentialBackOffConfig exponentialBackOffConfig;
private final ShutdownNamespaceBehavior shutdownNamespaceBehavior;
>>>>>>>
private final ExponentialBackOffConfig exponentialBackOffConfig;
private final ShutdownBehaviour shutdownBehaviour;
<<<<<<<
this.persistenceActorProps =
PolicyPersistenceActor.props(policyId, snapshotAdapter, pubSubMediator);
this.minBackoff = minBackoff;
this.maxBackoff = maxBackoff;
this.randomFactor = randomFactor;
this.supervisorStrategy = supervisorStrategy;
shutdownBehaviour = ShutdownBehaviour.fromId(policyId, pubSubMediator, getSelf());
=======
persistenceActorProps = PolicyPersistenceActor.props(policyId, snapshotAdapter, pubSubMediator);
exponentialBackOffConfig = policiesConfig.getPolicyConfig().getSupervisorConfig().getExponentialBackOffConfig();
shutdownNamespaceBehavior = ShutdownNamespaceBehavior.fromId(policyId, pubSubMediator, getSelf());
child = null;
restartCount = 0L;
>>>>>>>
persistenceActorProps = PolicyPersistenceActor.props(policyId, snapshotAdapter, pubSubMediator);
exponentialBackOffConfig = policiesConfig.getPolicyConfig().getSupervisorConfig().getExponentialBackOffConfig();
shutdownBehaviour = ShutdownBehaviour.fromId(policyId, pubSubMediator, getSelf());
child = null;
restartCount = 0L; |
<<<<<<<
* Returns the metadata of this entity.
*
* @return the metadata.
* @since 1.2.0
*/
Optional<Metadata> getMetadata();
/**
=======
* Returns the created timestamp of this entity.
*
* @return the timestamp.
* @since 1.2.0
*/
Optional<Instant> getCreated();
/**
>>>>>>>
* Returns the created timestamp of this entity.
*
* @return the timestamp.
* @since 1.2.0
*/
Optional<Instant> getCreated();
/**
* Returns the metadata of this entity.
*
* @return the metadata.
* @since 1.2.0
*/
Optional<Metadata> getMetadata();
/** |
<<<<<<<
super(connectionId, sourceAddress, inboundMessageProcessor, source, ConnectionType.AMQP_091);
log = DittoLoggerFactory.getThreadSafeDittoLoggingAdapter(this)
.withMdcEntry(ConnectivityMdcEntryKey.CONNECTION_ID.toString(), connectionId);
=======
super(connection, sourceAddress, inboundMessageProcessor, source);
>>>>>>>
super(connection, sourceAddress, inboundMessageProcessor, source);
log = DittoLoggerFactory.getThreadSafeDittoLoggingAdapter(this)
.withMdcEntry(ConnectivityMdcEntryKey.CONNECTION_ID.toString(), connectionId); |
<<<<<<<
import org.eclipse.ditto.services.connectivity.util.ConfigKeys;
import org.eclipse.ditto.services.connectivity.util.ConnectionConfigReader;
import org.eclipse.ditto.services.connectivity.util.ConnectionLogUtil;
import org.eclipse.ditto.services.connectivity.util.MonitoringConfigReader;
=======
>>>>>>>
import org.eclipse.ditto.services.connectivity.util.ConnectionLogUtil;
<<<<<<<
private final ConnectionMonitorRegistry<ConnectionMonitor> connectionMonitorRegistry;
@Nullable private Cancellable enabledLoggingChecker;
private final Duration checkLoggingActiveInterval;
@Nullable private Instant loggingEnabledUntil;
private final Duration loggingEnabledDuration;
=======
@SuppressWarnings("unused")
>>>>>>>
private final ConnectionMonitorRegistry<ConnectionMonitor> connectionMonitorRegistry;
@Nullable private Cancellable enabledLoggingChecker;
private final Duration checkLoggingActiveInterval;
@Nullable private Instant loggingEnabledUntil;
private final Duration loggingEnabledDuration;
@SuppressWarnings("unused")
<<<<<<<
final Config config = getContext().system().settings().config();
final ConnectionConfigReader configReader = ConnectionConfigReader.fromRawConfig(config);
snapshotThreshold = configReader.snapshotThreshold();
=======
final ConnectionConfig connectionConfig = DittoConnectivityConfig.of(
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
).getConnectionConfig();
final SnapshotConfig snapshotConfig = connectionConfig.getSnapshotConfig();
snapshotThreshold = snapshotConfig.getThreshold();
>>>>>>>
final ConnectivityConfig connectivityConfig = DittoConnectivityConfig.of(
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
final ConnectionConfig connectionConfig = connectivityConfig.getConnectionConfig();
final SnapshotConfig snapshotConfig = connectionConfig.getSnapshotConfig();
snapshotThreshold = snapshotConfig.getThreshold(); |
<<<<<<<
Scanner s = connector.createScanner("test", Authorizations.EMPTY);
=======
Scanner s = connector.createScanner("test", Constants.NO_AUTHS);
int oneCnt = 0;
>>>>>>>
Scanner s = connector.createScanner("test", Authorizations.EMPTY);
int oneCnt = 0; |
<<<<<<<
=======
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.ditto.model.base.entity.Revision;
>>>>>>>
import org.eclipse.ditto.model.base.entity.Revision;
<<<<<<<
import org.eclipse.ditto.signals.commands.cleanup.Cleanup;
import org.eclipse.ditto.signals.commands.cleanup.CleanupResponse;
=======
import org.eclipse.ditto.services.utils.persistence.SnapshotAdapter;
>>>>>>>
import org.eclipse.ditto.services.utils.persistence.SnapshotAdapter;
import org.eclipse.ditto.signals.commands.cleanup.Cleanup;
import org.eclipse.ditto.signals.commands.cleanup.CleanupResponse;
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>>
<<<<<<<
/**
*
*/
=======
>>>>>>> |
<<<<<<<
processor, connectionId());
final String messageMappingProcessorName = getMessageMappingProcessorActorName(connection.getId());
=======
processor);
>>>>>>>
processor, connectionId()); |
<<<<<<<
=======
import org.eclipse.ditto.signals.commands.connectivity.modify.TestConnection;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetrics;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetricsResponse;
import org.eclipse.ditto.signals.events.things.ThingEvent;
>>>>>>>
import org.eclipse.ditto.signals.commands.connectivity.modify.TestConnection;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetrics;
import org.eclipse.ditto.signals.commands.connectivity.query.RetrieveConnectionMetricsResponse;
<<<<<<<
.match(Signal.class, this::handleSignal)
=======
.match(RetrieveConnectionMetrics.class, this::handleRetrieveMetrics)
.match(ThingEvent.class, this::handleThingEvent)
>>>>>>>
.match(Signal.class, this::handleSignal)
.match(RetrieveConnectionMetrics.class, this::handleRetrieveMetrics)
<<<<<<<
getSourcesOrEmptySet().forEach(consumer -> {
consumer.getSources().forEach(source -> {
for (int i = 0; i < consumer.getConsumerCount(); i++) {
final ActorRef commandConsumer = startChildActor(CONSUMER_ACTOR_PREFIX + source + "-" + i,
RabbitMQConsumerActor.props(messageMappingProcessor));
try {
final String consumerTag = channel.basicConsume(source, false,
new RabbitMQMessageConsumer(commandConsumer, channel));
log.debug("Consuming queue {}, consumer tag is {}", consumer, consumerTag);
} catch (final IOException e) {
log.warning("Failed to consume queue '{}': {}", consumer, e.getMessage());
}
}
});
});
=======
if (!testConnection) {
if (messageMappingProcessor != null) {
getSourcesOrEmptySet().forEach(source -> {
final ActorRef commandConsumer = startChildActor("consumer-" + source,
RabbitMQConsumerActor.props(messageMappingProcessor));
try {
final String consumerTag =
channel.basicConsume(source, false,
new RabbitMQMessageConsumer(commandConsumer, channel));
log.debug("Consuming queue {}, consumer tag is {}", source, consumerTag);
} catch (final IOException e) {
log.warning("Failed to consume queue '{}': {}", source, e.getMessage());
}
});
} else {
log.error("The messageMappingProcessor was null and therefore no consumers were started!");
}
} else {
log.info("Not starting consumer on channel <{}> as this is only a test connection", channel);
}
>>>>>>>
if (!testConnection) {
if (messageMappingProcessor != null) {
getSourcesOrEmptySet().forEach(consumer -> {
consumer.getSources().forEach(source -> {
for (int i = 0; i < consumer.getConsumerCount(); i++) {
final ActorRef commandConsumer = startChildActor(CONSUMER_ACTOR_PREFIX + source + "-" + i,
RabbitMQConsumerActor.props(messageMappingProcessor));
try {
final String consumerTag = channel.basicConsume(source, false,
new RabbitMQMessageConsumer(commandConsumer, channel));
log.debug("Consuming queue {}, consumer tag is {}", consumer, consumerTag);
} catch (final IOException e) {
log.warning("Failed to consume queue '{}': {}", consumer, e.getMessage());
}
}
});
});
} else {
log.error("The messageMappingProcessor was null and therefore no consumers were started!");
}
} else {
log.info("Not starting consumer on channel <{}> as this is only a test connection", channel);
}
<<<<<<<
getSourcesOrEmptySet().forEach(consumer -> {
consumer.getSources().forEach(source -> {
try {
channel.queueDeclarePassive(source);
} catch (final IOException e) {
missingQueues.add(source);
}
});
=======
getSourcesOrEmptySet().forEach(source -> {
try {
channel.queueDeclarePassive(source);
} catch (final IOException e) {
missingQueues.add(source);
log.warning("The queue <{}> does not exist.", source);
}
>>>>>>>
getSourcesOrEmptySet().forEach(consumer -> {
consumer.getSources().forEach(source -> {
try {
channel.queueDeclarePassive(source);
} catch (final IOException e) {
missingQueues.add(source);
log.warning("The queue <{}> does not exist.", source);
}
}); |
<<<<<<<
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.services.base.config.limits.DefaultLimitsConfig;
=======
import org.eclipse.ditto.services.base.config.DittoLimitsConfigReader;
>>>>>>>
import org.eclipse.ditto.services.base.config.limits.DefaultLimitsConfig;
<<<<<<<
protected static QueryBuilderFactory qbf;
protected static AggregationBuilderFactory abf;
=======
protected static final QueryBuilderFactory qbf = new MongoQueryBuilderFactory
(DittoLimitsConfigReader.fromRawConfig(ConfigFactory.load("test")));
>>>>>>>
protected static QueryBuilderFactory qbf; |
<<<<<<<
import org.eclipse.ditto.services.base.actors.ShutdownBehaviour;
=======
import org.eclipse.ditto.services.base.actors.ShutdownNamespaceBehavior;
import org.eclipse.ditto.services.base.config.supervision.ExponentialBackOffConfig;
import org.eclipse.ditto.services.things.common.config.DittoThingsConfig;
>>>>>>>
import org.eclipse.ditto.services.base.actors.ShutdownBehaviour;
import org.eclipse.ditto.services.base.config.supervision.ExponentialBackOffConfig;
import org.eclipse.ditto.services.things.common.config.DittoThingsConfig;
<<<<<<<
private final Duration minBackOff;
private final Duration maxBackOff;
private final double randomFactor;
private final ShutdownBehaviour shutdownBehaviour;
=======
private final ExponentialBackOffConfig exponentialBackOffConfig;
private final ShutdownNamespaceBehavior shutdownNamespaceBehavior;
>>>>>>>
private final ExponentialBackOffConfig exponentialBackOffConfig;
private final ShutdownBehaviour shutdownBehaviour;
<<<<<<<
this.minBackOff = minBackOff;
this.maxBackOff = maxBackOff;
this.randomFactor = randomFactor;
shutdownBehaviour = ShutdownBehaviour.fromId(thingId, pubSubMediator, getSelf());
=======
exponentialBackOffConfig = thingsConfig.getThingConfig().getSupervisorConfig().getExponentialBackOffConfig();
shutdownNamespaceBehavior = ShutdownNamespaceBehavior.fromId(thingId, pubSubMediator, getSelf());
>>>>>>>
exponentialBackOffConfig = thingsConfig.getThingConfig().getSupervisorConfig().getExponentialBackOffConfig();
shutdownBehaviour = ShutdownBehaviour.fromId(thingId, pubSubMediator, getSelf()); |
<<<<<<<
import org.eclipse.ditto.protocoladapter.HeaderTranslator;
import org.eclipse.ditto.services.gateway.endpoints.config.AuthenticationConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.CachesConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.DevOpsConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.HttpConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.WebSocketConfig;
=======
import org.eclipse.ditto.model.base.headers.DittoHeadersSizeChecker;
import org.eclipse.ditto.services.base.config.HealthConfigReader;
import org.eclipse.ditto.services.base.config.HttpConfigReader;
import org.eclipse.ditto.services.base.config.ServiceConfigReader;
>>>>>>>
import org.eclipse.ditto.model.base.headers.DittoHeadersSizeChecker;
import org.eclipse.ditto.protocoladapter.HeaderTranslator;
import org.eclipse.ditto.services.gateway.endpoints.config.AuthenticationConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.CachesConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.DevOpsConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.HttpConfig;
import org.eclipse.ditto.services.gateway.endpoints.config.WebSocketConfig;
<<<<<<<
.bindAndHandle(createRoute(actorSystem, gatewayConfig, proxyActor, streamingActor, healthCheckActor,
healthCheckConfig).flow(actorSystem, materializer),
=======
.bindAndHandle(createRoute(actorSystem, configReader, proxyActor, streamingActor, healthCheckActor)
.flow(actorSystem, materializer),
>>>>>>>
.bindAndHandle(createRoute(actorSystem, gatewayConfig, proxyActor, streamingActor, healthCheckActor,
healthCheckConfig).flow(actorSystem, materializer),
<<<<<<<
private static Route createRoute(final ActorSystem actorSystem,
final GatewayConfig gatewayConfig,
=======
private Route createRoute(final ActorSystem actorSystem,
final ServiceConfigReader configReader,
>>>>>>>
private static Route createRoute(final ActorSystem actorSystem,
final GatewayConfig gatewayConfig,
<<<<<<<
final AuthenticationConfig authConfig = gatewayConfig.getAuthenticationConfig();
final CachesConfig cachesConfig = gatewayConfig.getCachesConfig();
final DefaultHttpClientFacade httpClient = DefaultHttpClientFacade.getInstance(actorSystem, authConfig.getHttpProxyConfig());
=======
final Config config = configReader.getRawConfig();
final HttpClientFacade httpClient = DefaultHttpClientFacade.getInstance(actorSystem);
final ClusterStatusSupplier clusterStateSupplier = new ClusterStatusSupplier(Cluster.get(actorSystem));
>>>>>>>
final Config config = configReader.getRawConfig();
final AuthenticationConfig authConfig = gatewayConfig.getAuthenticationConfig();
final CachesConfig cachesConfig = gatewayConfig.getCachesConfig();
final DefaultHttpClientFacade httpClient = DefaultHttpClientFacade.getInstance(actorSystem, authConfig.getHttpProxyConfig());
<<<<<<<
final GatewayAuthenticationDirectiveFactory authenticationDirectiveFactory =
new DittoGatewayAuthenticationDirectiveFactory(authConfig, cachesConfig.getPublicKeysConfig(),
httpClient, authenticationDispatcher);
final ProtocolAdapterProvider protocolAdapterProvider =
ProtocolAdapterProvider.load(gatewayConfig.getProtocolConfig(), actorSystem);
final HeaderTranslator headerTranslator = protocolAdapterProvider.getHttpHeaderTranslator();
final WebSocketConfig webSocketConfig = gatewayConfig.getWebSocketConfig();
final Supplier<ClusterStatus> clusterStateSupplier = new ClusterStatusSupplier(Cluster.get(actorSystem));
final StatusAndHealthProvider statusAndHealthProvider =
DittoStatusAndHealthProviderFactory.of(actorSystem, clusterStateSupplier, healthCheckConfig);
final HttpConfig httpConfig = gatewayConfig.getHttpConfig();
final DevOpsConfig devOpsConfig = authConfig.getDevOpsConfig();
return RootRoute.getBuilder(httpConfig)
.statsRoute(new StatsRoute(proxyActor, actorSystem, httpConfig, devOpsConfig, headerTranslator))
.statusRoute(new StatusRoute(clusterStateSupplier, healthCheckingActor, actorSystem))
.overallStatusRoute(new OverallStatusRoute(clusterStateSupplier, statusAndHealthProvider, devOpsConfig))
.cachingHealthRoute(
new CachingHealthRoute(statusAndHealthProvider, gatewayConfig.getPublicHealthConfig()))
.devopsRoute(new DevOpsRoute(proxyActor, actorSystem, httpConfig, devOpsConfig, headerTranslator))
.policiesRoute(new PoliciesRoute(proxyActor, actorSystem, httpConfig, headerTranslator))
.sseThingsRoute(
new SseThingsRoute(proxyActor, actorSystem, httpConfig, streamingActor, headerTranslator))
.thingsRoute(new ThingsRoute(proxyActor, actorSystem, gatewayConfig.getMessageConfig(),
gatewayConfig.getClaimMessageConfig(), httpConfig, headerTranslator))
.thingSearchRoute(new ThingSearchRoute(proxyActor, actorSystem, httpConfig, headerTranslator))
.websocketRoute(new WebsocketRoute(streamingActor, webSocketConfig, actorSystem.eventStream()))
.supportedSchemaVersions(httpConfig.getSupportedSchemaVersions())
.protocolAdapterProvider(protocolAdapterProvider)
.headerTranslator(headerTranslator)
.httpAuthenticationDirective(authenticationDirectiveFactory.buildHttpAuthentication())
.wsAuthenticationDirective(authenticationDirectiveFactory.buildWsAuthentication())
=======
final DittoGatewayAuthenticationDirectiveFactory authenticationDirectiveFactory =
new DittoGatewayAuthenticationDirectiveFactory(config, httpClient, authenticationDispatcher);
final RouteFactory routeFactory = RouteFactory.newInstance(actorSystem, proxyActor, streamingActor,
healthCheckingActor, clusterStateSupplier, authenticationDirectiveFactory);
final DittoHeadersSizeChecker dittoHeadersSizeChecker =
DittoHeadersSizeChecker.of(configReader.limits().headersMaxSize(),
configReader.limits().authSubjectsCount());
return RootRoute.getBuilder()
.statsRoute(routeFactory.newStatsRoute())
.statusRoute(routeFactory.newStatusRoute())
.overallStatusRoute(routeFactory.newOverallStatusRoute())
.cachingHealthRoute(routeFactory.newCachingHealthRoute())
.devopsRoute(routeFactory.newDevopsRoute())
.policiesRoute(routeFactory.newPoliciesRoute())
.sseThingsRoute(routeFactory.newSseThingsRoute())
.thingsRoute(routeFactory.newThingsRoute())
.thingSearchRoute(routeFactory.newThingSearchRoute())
.websocketRoute(routeFactory.newWebSocketRoute())
.supportedSchemaVersions(config.getIntList(ConfigKeys.SCHEMA_VERSIONS))
.protocolAdapterProvider(routeFactory.getProtocolAdapterProvider())
.headerTranslator(routeFactory.getHeaderTranslator())
.httpAuthenticationDirective(routeFactory.newHttpAuthenticationDirective())
.wsAuthenticationDirective(routeFactory.newWsAuthenticationDirective())
.dittoHeadersSizeChecker(dittoHeadersSizeChecker)
>>>>>>>
final GatewayAuthenticationDirectiveFactory authenticationDirectiveFactory =
new DittoGatewayAuthenticationDirectiveFactory(authConfig, cachesConfig.getPublicKeysConfig(),
httpClient, authenticationDispatcher);
final ProtocolAdapterProvider protocolAdapterProvider =
ProtocolAdapterProvider.load(gatewayConfig.getProtocolConfig(), actorSystem);
final HeaderTranslator headerTranslator = protocolAdapterProvider.getHttpHeaderTranslator();
final WebSocketConfig webSocketConfig = gatewayConfig.getWebSocketConfig();
final Supplier<ClusterStatus> clusterStateSupplier = new ClusterStatusSupplier(Cluster.get(actorSystem));
final StatusAndHealthProvider statusAndHealthProvider =
DittoStatusAndHealthProviderFactory.of(actorSystem, clusterStateSupplier, healthCheckConfig);
final DittoHeadersSizeChecker dittoHeadersSizeChecker =
DittoHeadersSizeChecker.of(configReader.limits().headersMaxSize(),
configReader.limits().authSubjectsCount());
final HttpConfig httpConfig = gatewayConfig.getHttpConfig();
final DevOpsConfig devOpsConfig = authConfig.getDevOpsConfig();
return RootRoute.getBuilder(httpConfig)
.statsRoute(new StatsRoute(proxyActor, actorSystem, httpConfig, devOpsConfig, headerTranslator))
.statusRoute(new StatusRoute(clusterStateSupplier, healthCheckingActor, actorSystem))
.overallStatusRoute(new OverallStatusRoute(clusterStateSupplier, statusAndHealthProvider, devOpsConfig))
.cachingHealthRoute(
new CachingHealthRoute(statusAndHealthProvider, gatewayConfig.getPublicHealthConfig()))
.devopsRoute(new DevOpsRoute(proxyActor, actorSystem, httpConfig, devOpsConfig, headerTranslator))
.policiesRoute(new PoliciesRoute(proxyActor, actorSystem, httpConfig, headerTranslator))
.sseThingsRoute(
new SseThingsRoute(proxyActor, actorSystem, httpConfig, streamingActor, headerTranslator))
.thingsRoute(new ThingsRoute(proxyActor, actorSystem, gatewayConfig.getMessageConfig(),
gatewayConfig.getClaimMessageConfig(), httpConfig, headerTranslator))
.thingSearchRoute(new ThingSearchRoute(proxyActor, actorSystem, httpConfig, headerTranslator))
.websocketRoute(new WebsocketRoute(streamingActor, webSocketConfig, actorSystem.eventStream()))
.supportedSchemaVersions(httpConfig.getSupportedSchemaVersions())
.protocolAdapterProvider(protocolAdapterProvider)
.headerTranslator(headerTranslator)
.httpAuthenticationDirective(authenticationDirectiveFactory.buildHttpAuthentication())
.wsAuthenticationDirective(authenticationDirectiveFactory.buildWsAuthentication())
.dittoHeadersSizeChecker(dittoHeadersSizeChecker) |
<<<<<<<
import org.eclipse.ditto.services.things.starter.util.ConfigKeys;
=======
import org.eclipse.ditto.services.things.persistence.snapshotting.ThingSnapshotter;
>>>>>>>
<<<<<<<
import org.eclipse.ditto.services.utils.persistence.mongo.MongoMetricsReporter;
=======
import org.eclipse.ditto.services.utils.persistence.mongo.config.TagsConfig;
>>>>>>>
import org.eclipse.ditto.services.utils.persistence.mongo.MongoMetricsReporter;
import org.eclipse.ditto.services.utils.persistence.mongo.config.TagsConfig;
<<<<<<<
final int numberOfShards = configReader.cluster().numberOfShards();
final Config config = configReader.getRawConfig();
final Props thingSupervisorProps = getThingSupervisorActorProps(config, pubSubMediator,
thingPersistenceActorPropsFactory);
final ClusterShardingSettings shardingSettings =
ClusterShardingSettings.create(getContext().system())
.withRole(CLUSTER_ROLE);
=======
final ActorSystem actorSystem = getContext().system();
>>>>>>>
final ActorSystem actorSystem = getContext().system();
<<<<<<<
* @param materializer the materializer for the akka actor system
* @param thingPersistenceActorPropsFactory factory of props of thing persistence actors.
=======
* @param materializer the materializer for the Akka actor system.
>>>>>>>
* @param materializer the materializer for the Akka actor system. |
<<<<<<<
private final String connectionId;
private final DittoProtocolSub dittoProtocolSub;
=======
private final ConnectionId connectionId;
private final ActorRef pubSubMediator;
>>>>>>>
private final ConnectionId connectionId;
private final DittoProtocolSub dittoProtocolSub;
<<<<<<<
private ConnectionActor(final String connectionId,
final DittoProtocolSub dittoProtocolSub,
=======
private ConnectionActor(final ConnectionId connectionId,
final ActorRef pubSubMediator,
>>>>>>>
private ConnectionActor(final ConnectionId connectionId,
final DittoProtocolSub dittoProtocolSub,
<<<<<<<
public static Props props(final String connectionId,
final DittoProtocolSub dittoProtocolSub,
=======
public static Props props(final ConnectionId connectionId,
final ActorRef pubSubMediator,
>>>>>>>
public static Props props(final ConnectionId connectionId,
final DittoProtocolSub dittoProtocolSub, |
<<<<<<<
import java.time.Instant;
=======
import java.util.Arrays;
>>>>>>>
<<<<<<<
import org.eclipse.ditto.services.connectivity.messaging.internal.RetrieveAddressMetric;
=======
import org.eclipse.ditto.model.connectivity.ResourceStatus;
import org.eclipse.ditto.services.connectivity.mapping.MessageMappers;
import org.eclipse.ditto.services.connectivity.messaging.BaseConsumerActor;
import org.eclipse.ditto.services.connectivity.messaging.internal.RetrieveAddressStatus;
>>>>>>>
import org.eclipse.ditto.model.connectivity.ResourceStatus;
import org.eclipse.ditto.services.connectivity.messaging.BaseConsumerActor;
import org.eclipse.ditto.services.connectivity.messaging.internal.RetrieveAddressStatus;
<<<<<<<
private final ActorRef messageMappingProcessor;
private final AuthorizationContext authorizationContext;
=======
>>>>>>>
<<<<<<<
@Nullable private final HeaderMapping headerMapping;
private long consumedMessages = 0L;
private Instant lastMessageConsumedAt;
@Nullable private AddressMetric addressMetric = null;
private RabbitMQConsumerActor(final ActorRef messageMappingProcessor,
final AuthorizationContext authorizationContext,
@Nullable final Enforcement enforcement,
@Nullable final HeaderMapping headerMapping) {
this.messageMappingProcessor = checkNotNull(messageMappingProcessor, "messageMappingProcessor");
this.authorizationContext = authorizationContext;
=======
private RabbitMQConsumerActor(final String connectionId, final String sourceAddress,
final ActorRef messageMappingProcessor, final AuthorizationContext authorizationContext,
@Nullable Enforcement enforcement, @Nullable final HeaderMapping headerMapping) {
super(connectionId, sourceAddress, messageMappingProcessor, authorizationContext, headerMapping);
>>>>>>>
private RabbitMQConsumerActor(final String connectionId, final String sourceAddress,
final ActorRef messageMappingProcessor, final AuthorizationContext authorizationContext,
@Nullable final Enforcement enforcement, @Nullable final HeaderMapping headerMapping) {
super(connectionId, sourceAddress, messageMappingProcessor, authorizationContext, headerMapping);
<<<<<<<
static Props props(final ActorRef messageMappingProcessor,
final AuthorizationContext authorizationContext,
@Nullable final Enforcement enforcement,
@Nullable final HeaderMapping headerMapping) {
return Props.create(RabbitMQConsumerActor.class, new Creator<RabbitMQConsumerActor>() {
private static final long serialVersionUID = 1L;
@Override
public RabbitMQConsumerActor create() {
return new RabbitMQConsumerActor(messageMappingProcessor, authorizationContext, enforcement,
headerMapping);
}
});
=======
static Props props(final String source, final ActorRef messageMappingProcessor, final
AuthorizationContext authorizationContext, @Nullable final Enforcement enforcement,
@Nullable final HeaderMapping headerMapping, final String connectionId) {
return Props.create(
RabbitMQConsumerActor.class, new Creator<RabbitMQConsumerActor>() {
private static final long serialVersionUID = 1L;
@Override
public RabbitMQConsumerActor create() {
return new RabbitMQConsumerActor(connectionId, source, messageMappingProcessor,
authorizationContext, enforcement, headerMapping);
}
});
>>>>>>>
static Props props(final String source, final ActorRef messageMappingProcessor, final
AuthorizationContext authorizationContext, @Nullable final Enforcement enforcement,
@Nullable final HeaderMapping headerMapping, final String connectionId) {
return Props.create(
RabbitMQConsumerActor.class, new Creator<RabbitMQConsumerActor>() {
private static final long serialVersionUID = 1L;
@Override
public RabbitMQConsumerActor create() {
return new RabbitMQConsumerActor(connectionId, source, messageMappingProcessor,
authorizationContext, enforcement, headerMapping);
}
}); |
<<<<<<<
import org.eclipse.ditto.services.utils.cleanup.AbstractPersistentActorWithTimersAndCleanup;
=======
import org.eclipse.ditto.services.utils.config.DefaultScopedConfig;
>>>>>>>
import org.eclipse.ditto.services.utils.cleanup.AbstractPersistentActorWithTimersAndCleanup;
import org.eclipse.ditto.services.utils.config.DefaultScopedConfig;
<<<<<<<
private final Duration activityCheckInterval;
private final Duration activityCheckDeletedInterval;
private final long snapshotThreshold;
=======
private final PolicyConfig policyConfig;
>>>>>>>
private final PolicyConfig policyConfig;
<<<<<<<
=======
>>>>>>>
<<<<<<<
final Config config = getContext().system().settings().config();
activityCheckInterval = config.getDuration(ConfigKeys.Policy.ACTIVITY_CHECK_INTERVAL);
activityCheckDeletedInterval = config.getDuration(ConfigKeys.Policy.ACTIVITY_CHECK_DELETED_INTERVAL);
scheduleCheckForPolicyActivity(activityCheckInterval);
snapshotThreshold = config.getLong(ConfigKeys.Policy.SNAPSHOT_THRESHOLD);
if (snapshotThreshold < 0) {
throw new ConfigurationException(String.format("Config setting '%s' must be positive, but is: %d.",
ConfigKeys.Policy.SNAPSHOT_THRESHOLD, snapshotThreshold));
}
final Duration snapshotInterval = config.getDuration(ConfigKeys.Policy.SNAPSHOT_INTERVAL);
scheduleSnapshot(snapshotInterval);
=======
this.pubSubMediator = pubSubMediator;
final DittoPoliciesConfig policiesConfig = DittoPoliciesConfig.of(
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
this.policyConfig = policiesConfig.getPolicyConfig();
>>>>>>>
this.pubSubMediator = pubSubMediator;
final DittoPoliciesConfig policiesConfig = DittoPoliciesConfig.of(
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
this.policyConfig = policiesConfig.getPolicyConfig();
scheduleCheckForPolicyActivity(policyConfig.getActivityCheckConfig().getDeletedInterval());
<<<<<<<
=======
public void postStop() {
super.postStop();
invokeAfterSnapshotRunnable = null;
if (null != activityChecker) {
activityChecker.cancel();
}
if (null != snapshotter) {
snapshotter.cancel();
}
}
@Override
>>>>>>>
<<<<<<<
=======
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getInactiveInterval());
final SnapshotConfig snapshotConfig = policyConfig.getSnapshotConfig();
scheduleSnapshot(snapshotConfig.getInterval());
>>>>>>>
scheduleCheckForPolicyActivity(policyConfig.getActivityCheckConfig().getInactiveInterval());
scheduleSnapshot();
<<<<<<<
=======
if (null != activityChecker) {
activityChecker.cancel();
}
if (null != snapshotter) {
snapshotter.cancel();
}
/*
* Check in the next X minutes and therefore
* - stay in-memory for a short amount of minutes after deletion
* - get a Snapshot when removed from memory
*/
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getDeletedInterval());
>>>>>>>
/*
* Check in the next X minutes and therefore
* - stay in-memory for a short amount of minutes after deletion
* - get a Snapshot when removed from memory
*/
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getDeletedInterval());
cancelSnapshot();
<<<<<<<
if ((lastSequenceNr() - lastSnapshotSequenceNr) >= snapshotThreshold) {
takeSnapshot("snapshot threshold is reached");
=======
final SnapshotConfig snapshotConfig = policyConfig.getSnapshotConfig();
if (lastSequenceNr() - lastSnapshotSequenceNr > snapshotConfig.getThreshold()) {
doSaveSnapshot(null);
>>>>>>>
if ((lastSequenceNr() - lastSnapshotSequenceNr) >= policyConfig.getSnapshotConfig().getThreshold()) {
takeSnapshot("snapshot threshold is reached");
<<<<<<<
=======
* This strategy handles the success of saving a snapshot by logging the Policy's ID.
*/
@NotThreadSafe
private final class SaveSnapshotSuccessStrategy extends AbstractReceiveStrategy<SaveSnapshotSuccess> {
/**
* Constructs a new {@code SaveSnapshotSuccessStrategy} object.
*/
SaveSnapshotSuccessStrategy() {
super(SaveSnapshotSuccess.class, log);
}
@Override
protected void doApply(final SaveSnapshotSuccess message) {
final SnapshotMetadata snapshotMetadata = message.metadata();
log.debug("Snapshot taken for Policy <{}> with metadata <{}>.", policyId, snapshotMetadata);
final long newSnapShotSequenceNumber = snapshotMetadata.sequenceNr();
if (newSnapShotSequenceNumber <= lastSnapshotSequenceNr) {
log.warning("Policy <{}> has been already snap-shot with a newer or equal sequence number." +
" Last sequence number: <{}>, new snapshot metadata: <{}>.", policyId,
lastSnapshotSequenceNr, snapshotMetadata);
resetSnapshotInProgress();
} else {
deleteSnapshot(lastSnapshotSequenceNr);
deleteEventsOlderThan(newSnapShotSequenceNumber);
lastSnapshotSequenceNr = newSnapShotSequenceNumber;
resetSnapshotInProgress();
}
}
private void deleteEventsOlderThan(final long newestSequenceNumber) {
final SnapshotConfig snapshotConfig = policyConfig.getSnapshotConfig();
if (snapshotConfig.isDeleteOldEvents() && newestSequenceNumber > 1) {
final long upToSequenceNumber = newestSequenceNumber - 1;
log.debug("Delete all event messages for Policy <{}> up to sequence number <{}>.", policy,
upToSequenceNumber);
deleteMessages(upToSequenceNumber);
}
}
private void deleteSnapshot(final long sequenceNumber) {
final SnapshotConfig snapshotConfig = policyConfig.getSnapshotConfig();
if (snapshotConfig.isDeleteOldSnapshot() && sequenceNumber != -1) {
log.debug("Delete old snapshot for Policy <{}> with sequence number <{}>.", policyId, sequenceNumber);
PolicyPersistenceActor.this.deleteSnapshot(sequenceNumber);
}
}
private void resetSnapshotInProgress() {
if (invokeAfterSnapshotRunnable != null) {
invokeAfterSnapshotRunnable.run();
invokeAfterSnapshotRunnable = null;
}
snapshotInProgress = false;
}
}
/**
* This strategy handles the failure of saving a snapshot by logging an error.
*/
@NotThreadSafe
private final class SaveSnapshotFailureStrategy extends AbstractReceiveStrategy<SaveSnapshotFailure> {
/**
* Constructs a new {@code SaveSnapshotFailureStrategy} object.
*/
SaveSnapshotFailureStrategy() {
super(SaveSnapshotFailure.class, log);
}
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Override
protected void doApply(final SaveSnapshotFailure message) {
final Throwable cause = message.cause();
final String causeMessage = cause.getMessage();
if (isPolicyDeleted()) {
log.error(cause, "Failed to save snapshot for delete operation of <{}>. Cause: {}.", policyId,
causeMessage);
} else {
log.error(cause, "Failed to save snapshot for <{}>. Cause: {}.", policyId, causeMessage);
}
}
}
/**
* This strategy handles the success of deleting a snapshot by logging an info.
*/
@NotThreadSafe
private final class DeleteSnapshotSuccessStrategy extends AbstractReceiveStrategy<DeleteSnapshotSuccess> {
/**
* Constructs a new {@code DeleteSnapshotSuccessStrategy} object.
*/
DeleteSnapshotSuccessStrategy() {
super(DeleteSnapshotSuccess.class, log);
}
@Override
protected void doApply(final DeleteSnapshotSuccess message) {
log.debug("Deleting snapshot with sequence number <{}> for Policy <{}> was successful.",
message.metadata().sequenceNr(), policyId);
}
}
/**
* This strategy handles the failure of deleting a snapshot by logging an error.
*/
@NotThreadSafe
private final class DeleteSnapshotFailureStrategy extends AbstractReceiveStrategy<DeleteSnapshotFailure> {
/**
* Constructs a new {@code DeleteSnapshotFailureStrategy} object.
*/
DeleteSnapshotFailureStrategy() {
super(DeleteSnapshotFailure.class, log);
}
@Override
protected void doApply(final DeleteSnapshotFailure message) {
final Throwable cause = message.cause();
log.error(cause, "Deleting snapshot with sequence number <{}> for Policy <{}> failed. Cause {}: {}",
message.metadata().sequenceNr(), policyId, cause.getClass().getSimpleName(), cause.getMessage());
}
}
/**
* This strategy handles the success of deleting messages by logging an info.
*/
@NotThreadSafe
private final class DeleteMessagesSuccessStrategy extends AbstractReceiveStrategy<DeleteMessagesSuccess> {
/**
* Constructs a new {@code DeleteMessagesSuccessStrategy} object.
*/
DeleteMessagesSuccessStrategy() {
super(DeleteMessagesSuccess.class, log);
}
@Override
protected void doApply(final DeleteMessagesSuccess message) {
log.debug("Deleting messages for Policy <{}> was successful.", policyId);
}
}
/**
* This strategy handles the failure of deleting messages by logging an error.
*/
@NotThreadSafe
private final class DeleteMessagesFailureStrategy extends AbstractReceiveStrategy<DeleteMessagesFailure> {
/**
* Constructs a new {@code DeleteMessagesFailureStrategy} object.
*/
DeleteMessagesFailureStrategy() {
super(DeleteMessagesFailure.class, log);
}
@Override
protected void doApply(final DeleteMessagesFailure message) {
final Throwable cause = message.cause();
log.error(cause, "Deleting messages up to sequence number <{}> for Policy <{}> failed. Cause {}: {}",
policyId, message.toSequenceNr(), cause.getClass().getSimpleName(), cause.getMessage());
}
}
/**
>>>>>>>
<<<<<<<
=======
// Make sure activity checker is on, but there is no need to schedule it more than once.
if (null == activityChecker) {
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getInactiveInterval());
}
>>>>>>>
<<<<<<<
// - the latest snapshot is out of date
takeSnapshot("the policy is deleted and has no up-to-date snapshot");
scheduleCheckForPolicyActivity(activityCheckDeletedInterval);
=======
// - the latest snapshot is out of date or is still ongoing.
final Object snapshotToStore = snapshotAdapter.toSnapshotStore(policy);
saveSnapshot(snapshotToStore);
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getDeletedInterval());
>>>>>>>
// - the latest snapshot is out of date
takeSnapshot("the policy is deleted and has no up-to-date snapshot");
scheduleCheckForPolicyActivity(policyConfig.getActivityCheckConfig().getDeletedInterval());
<<<<<<<
scheduleCheckForPolicyActivity(activityCheckInterval);
=======
final ActivityCheckConfig activityCheckConfig = policyConfig.getActivityCheckConfig();
scheduleCheckForPolicyActivity(activityCheckConfig.getInactiveInterval());
>>>>>>>
scheduleCheckForPolicyActivity(policyConfig.getActivityCheckConfig().getInactiveInterval());
<<<<<<<
@Override
public FI.UnitApply<T> getApplyFunction() {
return consumer::accept;
=======
// if the Policy is not "deleted":
if (isPolicyActive()) {
// schedule the next snapshot:
final SnapshotConfig snapshotConfig = policyConfig.getSnapshotConfig();
scheduleSnapshot(snapshotConfig.getInterval());
}
>>>>>>>
@Override
public FI.UnitApply<T> getApplyFunction() {
return consumer::accept; |
<<<<<<<
private ThingEventAdapter(
final Map<String, JsonifiableMapper<ThingEvent>> mappingStrategies,
final HeaderTranslator headerTranslator) {
super(mappingStrategies, headerTranslator);
=======
private ThingEventAdapter(final Map<String, JsonifiableMapper<ThingEvent<?>>> mappingStrategies) {
super(mappingStrategies);
>>>>>>>
private ThingEventAdapter(
final Map<String, JsonifiableMapper<ThingEvent<?>>> mappingStrategies,
final HeaderTranslator headerTranslator) {
super(mappingStrategies, headerTranslator);
<<<<<<<
public Adaptable constructAdaptable(final ThingEvent event, final TopicPath.Channel channel) {
=======
protected String getType(final Adaptable adaptable) {
final TopicPath topicPath = adaptable.getTopicPath();
final JsonPointer path = adaptable.getPayload().getPath();
final String eventName = PathMatcher.match(path) + getActionNameWithFirstLetterUpperCase(topicPath);
return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + eventName;
}
@Override
public Adaptable toAdaptable(final ThingEvent<?> event, final TopicPath.Channel channel) {
>>>>>>>
protected String getType(final Adaptable adaptable) {
final TopicPath topicPath = adaptable.getTopicPath();
final JsonPointer path = adaptable.getPayload().getPath();
final String eventName = PathMatcher.match(path) + getActionNameWithFirstLetterUpperCase(topicPath);
return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + eventName;
}
@Override
public Adaptable constructAdaptable(final ThingEvent<?> event, final TopicPath.Channel channel) { |
<<<<<<<
private static MongodExecutable tryToConfigureMongoDb(final String bindIp, final int mongoDbPort,
final IProxyFactory proxyFactory) {
=======
private MongodExecutable tryToConfigureMongoDb(final String bindIp, final int mongoDbPort,
final IProxyFactory proxyFactory, final Logger logger) {
>>>>>>>
private static MongodExecutable tryToConfigureMongoDb(final String bindIp,
final int mongoDbPort,
final IProxyFactory proxyFactory,
final Logger logger) {
<<<<<<<
.defaultsForCommand(command)
.proxyFactory(proxyFactory)
.progressListener(new StandardConsoleProgressListener())))
.build());
=======
.defaultsForCommand(command)
.proxyFactory(proxyFactory)
.progressListener(new StandardConsoleProgressListener())
.build()
)
).build()
);
>>>>>>>
.defaultsForCommand(command)
.proxyFactory(proxyFactory)
.progressListener(new StandardConsoleProgressListener())
.build()))
.build()); |
<<<<<<<
import com.mongodb.MongoCredential;
import com.mongodb.ReadPreference;
=======
import com.mongodb.MongoClientSettings;
>>>>>>>
import com.mongodb.MongoClientSettings;
import com.mongodb.MongoCredential;
import com.mongodb.ReadPreference;
<<<<<<<
public static MongoClientWrapper newInstance(final Config config) {
return (MongoClientWrapper) getBuilder(MongoConfig.of(config)).build();
=======
public static MongoClientWrapper newInstance(final Config config,
@Nullable final CommandListener customCommandListener,
@Nullable final ConnectionPoolListener customConnectionPoolListener) {
final int maxPoolSize = MongoConfig.getPoolMaxSize(config);
final int maxPoolWaitQueueSize = MongoConfig.getPoolMaxWaitQueueSize(config);
final Duration maxPoolWaitTime = MongoConfig.getPoolMaxWaitTime(config);
final boolean jmxListenerEnabled = MongoConfig.getJmxListenerEnabled(config);
final String uri = MongoConfig.getMongoUri(config);
final ConnectionString connectionString = new ConnectionString(uri);
final String database = connectionString.getDatabase();
final MongoClientSettings.Builder builder =
MongoClientSettings.builder().applyConnectionString(connectionString);
if (connectionString.getCredential() != null) {
builder.credential(connectionString.getCredential());
}
final EventLoopGroup eventLoopGroup;
if (MongoConfig.getSSLEnabled(config)) {
eventLoopGroup = new NioEventLoopGroup();
builder.streamFactoryFactory(NettyStreamFactoryFactory.builder().eventLoopGroup(eventLoopGroup).build())
.applyToSslSettings(MongoClientWrapper::buildSSLSettings);
} else {
eventLoopGroup = null;
builder.applyToSslSettings(sslBuilder -> sslBuilder.applyConnectionString(connectionString));
}
if (customCommandListener != null) {
builder.addCommandListener(customCommandListener);
}
if (connectionString.getWriteConcern() != null) {
builder.writeConcern(connectionString.getWriteConcern());
}
final MongoClientSettings mongoClientSettings = buildClientSettings(builder, maxPoolSize,
maxPoolWaitQueueSize, maxPoolWaitTime, jmxListenerEnabled, customConnectionPoolListener);
return new MongoClientWrapper(database, mongoClientSettings, eventLoopGroup);
>>>>>>>
public static MongoClientWrapper newInstance(final Config config) {
return (MongoClientWrapper) getBuilder(MongoConfig.of(config)).build(); |
<<<<<<<
=======
import org.eclipse.ditto.model.things.ThingId;
import org.eclipse.ditto.protocoladapter.TopicPath;
>>>>>>>
import org.eclipse.ditto.model.things.ThingId;
<<<<<<<
private LiveSignalEnforcement(final Contextual<Signal> context, final Cache<EntityId, Entry<EntityId>> thingIdCache,
final Cache<EntityId, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityId, Entry<Enforcer>> aclEnforcerCache,
final LiveSignalPub liveSignalPub) {
=======
private LiveSignalEnforcement(final Contextual<Signal> context,
final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache) {
>>>>>>>
private LiveSignalEnforcement(final Contextual<Signal> context,
final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache,
final LiveSignalPub liveSignalPub) {
<<<<<<<
private final Cache<EntityId, Entry<EntityId>> thingIdCache;
private final Cache<EntityId, Entry<Enforcer>> policyEnforcerCache;
private final Cache<EntityId, Entry<Enforcer>> aclEnforcerCache;
private final LiveSignalPub liveSignalPub;
=======
private final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache;
private final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache;
private final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache;
>>>>>>>
private final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache;
private final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache;
private final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache;
private final LiveSignalPub liveSignalPub;
<<<<<<<
public Provider(final Cache<EntityId, Entry<EntityId>> thingIdCache,
final Cache<EntityId, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityId, Entry<Enforcer>> aclEnforcerCache,
final LiveSignalPub liveSignalPub) {
=======
public Provider(final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache) {
>>>>>>>
public Provider(final Cache<EntityIdWithResourceType, Entry<EntityIdWithResourceType>> thingIdCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> policyEnforcerCache,
final Cache<EntityIdWithResourceType, Entry<Enforcer>> aclEnforcerCache,
final LiveSignalPub liveSignalPub) { |
<<<<<<<
getConnectionSupervisorProps(pubSubMediator, conciergeForwarder, commandValidator, connectivityConfig.getConnectionConfig());
=======
getConnectionSupervisorProps(dittoProtocolSub, conciergeForwarder, commandValidator);
>>>>>>>
getConnectionSupervisorProps(dittoProtocolSub, conciergeForwarder, commandValidator,
connectivityConfig.getConnectionConfig()); |
<<<<<<<
startMessageMappingProcessorActor(Optional.ofNullable(amqpPublisherActor));
startCommandConsumers();
=======
startMessageMappingProcessorActor();
startCommandConsumers(c.consumerList, jmsActor);
>>>>>>>
startMessageMappingProcessorActor(Optional.ofNullable(amqpPublisherActor));
startCommandConsumers(c.consumerList, jmsActor);
<<<<<<<
protected boolean isEventUpToDate(final Object event, final BaseClientState state, final ActorRef sender) {
=======
protected Optional<ActorRef> getPublisherActor() {
return Optional.ofNullable(amqpPublisherActor);
}
@Override
protected boolean isEventUpToDate(final Object event, final BaseClientState state,
@Nullable final ActorRef sender) {
>>>>>>>
protected boolean isEventUpToDate(final Object event, final BaseClientState state,
@Nullable final ActorRef sender) {
<<<<<<<
startMessageMappingProcessorActor(Optional.ofNullable(amqpPublisherActor));
startCommandConsumers();
=======
startMessageMappingProcessorActor();
startCommandConsumers(sessionRecovered.getConsumerList(), jmsActor);
>>>>>>>
startMessageMappingProcessorActor(Optional.ofNullable(amqpPublisherActor));
startCommandConsumers(sessionRecovered.getConsumerList(), jmsActor); |
<<<<<<<
final CreateThing createThing =
CreateThing.of(newThing, inlinePolicy.orElse(null), externalMessage.getInternalHeaders());
=======
final Signal<CreateThing> createThing = CreateThing.of(newThing, null, externalMessage.getInternalHeaders());
>>>>>>>
final Signal<CreateThing> createThing =
CreateThing.of(newThing, inlinePolicy.orElse(null), externalMessage.getInternalHeaders()); |
<<<<<<<
import org.eclipse.ditto.services.utils.akka.controlflow.ResumeSource;
=======
import org.eclipse.ditto.services.utils.cluster.DistPubSubAccess;
>>>>>>>
import org.eclipse.ditto.services.utils.akka.controlflow.ResumeSource;
import org.eclipse.ditto.services.utils.cluster.DistPubSubAccess;
<<<<<<<
final String path, final EntityIdWithRevision seed) {
return new DistributedPubSubMediator.Send(path, sudoStreamSnapshotRevisions(config, seed), false);
=======
final String path) {
return DistPubSubAccess.send(path, sudoStreamSnapshotRevisions(config), false);
>>>>>>>
final String path, final EntityIdWithRevision seed) {
return DistPubSubAccess.send(path, sudoStreamSnapshotRevisions(config, seed), false); |
<<<<<<<
return new MessageMappingProcessor(connectionId, connectionType, registry, log,
=======
return new MessageMappingProcessor(connectionId, registry, loggerWithConnectionId,
>>>>>>>
return new MessageMappingProcessor(connectionId, connectionType, registry, loggerWithConnectionId, |
<<<<<<<
import org.eclipse.ditto.model.connectivity.Topic;
=======
import org.eclipse.ditto.model.connectivity.ConnectivityModelFactory;
import org.eclipse.ditto.model.connectivity.Target;
import org.eclipse.ditto.model.connectivity.Topic;
>>>>>>>
import org.eclipse.ditto.model.connectivity.Topic;
import org.eclipse.ditto.model.connectivity.ConnectivityModelFactory;
import org.eclipse.ditto.model.connectivity.Target;
import org.eclipse.ditto.model.connectivity.Topic; |
<<<<<<<
import com.mongodb.client.model.Filters;
import org.eclipse.ditto.model.query.model.criteria.Predicate;
import org.eclipse.ditto.model.query.model.expression.FieldExpressionUtil;
import org.eclipse.ditto.model.query.model.expression.visitors.FieldExpressionVisitor;
=======
import org.eclipse.ditto.services.thingsearch.querymodel.criteria.Predicate;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.FieldExpressionUtil;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.visitors.FieldExpressionVisitor;
>>>>>>>
import org.eclipse.ditto.model.query.model.criteria.Predicate;
import org.eclipse.ditto.model.query.model.expression.FieldExpressionUtil;
import org.eclipse.ditto.model.query.model.expression.visitors.FieldExpressionVisitor; |
<<<<<<<
Accumulo.init(fs, instance, conf, app);
final TabletServer server = new TabletServer(instance, conf, fs);
=======
MetricsSystemHelper.configure(TabletServer.class.getSimpleName());
Accumulo.init(fs, conf, app);
final TabletServer server = new TabletServer(conf, fs);
>>>>>>>
MetricsSystemHelper.configure(TabletServer.class.getSimpleName());
Accumulo.init(fs, instance, conf, app);
final TabletServer server = new TabletServer(instance, conf, fs); |
<<<<<<<
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
=======
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
import javax.annotation.Nullable;
>>>>>>>
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
<<<<<<<
static final DittoHeaders DITTO_HEADERS_V_2_NO_STATUS = DittoHeaders.newBuilder()
.correlationId(CORRELATION_ID)
.schemaVersion(JsonSchemaVersion.V_2)
.contentType(DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE)
.build();
static final DittoHeaders HEADERS_V_1 = ProtocolFactory.newHeadersWithDittoContentType(DITTO_HEADERS_V_1);
=======
public static final DittoHeaders HEADERS_V_1 = ProtocolFactory.newHeadersWithDittoContentType(DITTO_HEADERS_V_1);
>>>>>>>
public static final DittoHeaders DITTO_HEADERS_V_2_NO_STATUS = DittoHeaders.newBuilder()
.correlationId(CORRELATION_ID)
.schemaVersion(JsonSchemaVersion.V_2)
.contentType(DittoConstants.DITTO_PROTOCOL_CONTENT_TYPE)
.build();
public static final DittoHeaders HEADERS_V_1 = ProtocolFactory.newHeadersWithDittoContentType(DITTO_HEADERS_V_1); |
<<<<<<<
import org.eclipse.ditto.model.amqpbridge.MappingContext;
=======
import org.eclipse.ditto.model.base.headers.DittoHeaders;
>>>>>>>
import org.eclipse.ditto.model.base.headers.DittoHeaders;
import org.eclipse.ditto.model.amqpbridge.MappingContext;
<<<<<<<
private ActorRef commandProcessor;
=======
>>>>>>>
<<<<<<<
mappingContexts = command.getMappingContexts();
try {
jmsConnection = jmsConnectionFactory.createConnection(amqpConnection, this);
log.info("Connection '{}' created.", amqpConnection.getId());
} catch (final JMSRuntimeException | JMSException | NamingException e) {
final ConnectionFailedException error = ConnectionFailedException.newBuilder(connectionId)
.description(e.getMessage())
.build();
getSender().tell(error, getSelf());
log.error(e, "Failed to create Connection '{}' with Error: '{}'.", amqpConnection.getId(), e.getMessage());
return;
}
final ConnectionCreated connectionCreated = ConnectionCreated.of(amqpConnection, mappingContexts,
command.getDittoHeaders());
persistEvent(connectionCreated, persistedEvent -> {
final boolean success = startCommandConsumersWithErrorHandling("create");
if (!success) {
return;
}
getSender().tell(CreateConnectionResponse.of(amqpConnection, mappingContexts, command.getDittoHeaders()),
getSelf());
getContext().become(connectionCreatedBehaviour);
getContext().getParent().tell(ConnectionSupervisorActor.ManualReset.getInstance(), getSelf());
});
=======
final ConnectionCreated connectionCreated = ConnectionCreated.of(amqpConnection, command.getDittoHeaders());
persistEvent(connectionCreated,
persistedEvent -> doWithErrorHandling("create", () -> {
startCommandProcessorActor();
doCreateConnection(command);
getSender().tell(CreateConnectionResponse.of(amqpConnection, command.getDittoHeaders()), getSelf());
getContext().become(createConnectionCreatedBehaviour());
getContext().getParent().tell(ConnectionSupervisorActor.ManualReset.getInstance(), getSelf());
})
);
>>>>>>>
mappingContexts = command.getMappingContexts();
final ConnectionCreated connectionCreated = ConnectionCreated.of(amqpConnection, mappingContexts, command.getDittoHeaders());
persistEvent(connectionCreated,
persistedEvent -> doWithErrorHandling("create", () -> {
startCommandProcessorActor();
doCreateConnection(command);
getSender().tell(CreateConnectionResponse.of(amqpConnection, mappingContexts, command.getDittoHeaders()), getSelf());
getContext().become(createConnectionCreatedBehaviour());
getContext().getParent().tell(ConnectionSupervisorActor.ManualReset.getInstance(), getSelf());
})
);
<<<<<<<
private void startCommandConsumers() throws JMSException {
startConnection();
final Props amqpCommandProcessorProps =
CommandProcessorActor.props(pubSubMediator, pubSubTargetActorPath,
amqpConnection.getAuthorizationSubject(), mappingContexts);
final String amqpCommandProcessorName = CommandProcessorActor.ACTOR_NAME_PREFIX + amqpConnection.getId();
final DefaultResizer resizer = new DefaultResizer(1, 5); // TODO configurable
commandProcessor = getContext().actorOf(new RoundRobinPool(1)
.withDispatcher("command-processor-dispatcher")
.withResizer(resizer)
.props(amqpCommandProcessorProps), amqpCommandProcessorName);
for (final String source : amqpConnection.getSources()) {
startCommandConsumer(source);
}
log.info("Subscribed Connection '{}' to sources: {}", amqpConnection.getId(), amqpConnection.getSources());
connectionStatus = ConnectionStatus.OPEN;
}
private void stopCommandConsumers() throws JMSException {
if (amqpConnection != null) {
for (final String source : amqpConnection.getSources()) {
stopChildActor(source);
}
stopChildActor(CommandProcessorActor.ACTOR_NAME_PREFIX + amqpConnection.getId());
log.info("Unsubscribed Connection '{}' from sources: {}", amqpConnection.getId(),
amqpConnection.getSources());
connectionStatus = ConnectionStatus.CLOSED;
stopConnection();
}
}
private void startCommandConsumer(final String source) {
final Props props = CommandConsumerActor.props(jmsSession, source, commandProcessor);
final String name = CommandConsumerActor.ACTOR_NAME_PREFIX + source;
startChildActor(name, props);
}
private void startConnection() throws JMSException {
if (shutdownCancellable != null) {
shutdownCancellable.cancel();
}
if (jmsConnection != null) {
jmsConnection.start();
jmsSession = jmsConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
log.info("Connection '{}' opened.", amqpConnection.getId());
}
}
private void stopConnection() throws JMSException {
if (jmsSession != null) {
try {
jmsSession.close();
jmsSession = null;
} catch (final JMSException e) {
log.debug("Session of connection '{}' already closed: {}", amqpConnection.getId(), e.getMessage());
}
}
if (jmsConnection != null) {
try {
jmsConnection.stop();
jmsConnection.close();
jmsConnection = null;
log.info("Connection '{}' closed.", amqpConnection.getId());
} catch (final JMSException e) {
log.debug("Connection '{}' already closed: {}", amqpConnection.getId(), e.getMessage());
}
}
}
=======
>>>>>>> |
<<<<<<<
sourceQueue.offer(Pair.create(request, new HttpPushContext(message, request.getUri())))
.handle(handleQueueOfferResult(message));
=======
final HttpPushContext context = newContext(signal, autoAckTarget, request, message, ackSizeQuota, resultFuture);
sourceQueue.offer(Pair.create(request, context))
.handle(handleQueueOfferResult(message, resultFuture));
return resultFuture;
>>>>>>>
final HttpPushContext context = newContext(signal, autoAckTarget, request, message, ackSizeQuota, resultFuture);
sourceQueue.offer(Pair.create(request, context))
.handle(handleQueueOfferResult(message, resultFuture));
return resultFuture;
<<<<<<<
private static CompletionStage<String> getResponseBody(final HttpResponse response,
final Materializer materializer) {
=======
private static CompletionStage<JsonValue> getResponseBody(final HttpResponse response, final int maxBytes,
final ActorMaterializer materializer) {
>>>>>>>
private static CompletionStage<JsonValue> getResponseBody(final HttpResponse response, final int maxBytes,
final Materializer materializer) { |
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
@Test
public void actorCannotBeStartedWithNegativeSnapshotThreshold() {
final Config customConfig = createNewDefaultTestConfig().
withValue(ConfigKeys.Policy.SNAPSHOT_THRESHOLD, ConfigValueFactory.fromAnyRef(-1));
setup(customConfig);
disableLogging();
new TestKit(actorSystem) {
{
final ActorRef underTest = createPersistenceActorFor("fail");
watch(underTest);
expectTerminated(underTest);
}
};
}
>>>>>>>
@Test
public void actorCannotBeStartedWithNegativeSnapshotThreshold() {
final Config customConfig = createNewDefaultTestConfig().
withValue(ConfigKeys.Policy.SNAPSHOT_THRESHOLD, ConfigValueFactory.fromAnyRef(-1));
setup(customConfig);
disableLogging();
new TestKit(actorSystem) {
{
final ActorRef underTest = createPersistenceActorFor("fail");
watch(underTest);
expectTerminated(underTest);
}
};
} |
<<<<<<<
import org.eclipse.ditto.services.gateway.streaming.StreamingSessionIdentifier;
=======
import org.eclipse.ditto.services.gateway.streaming.actors.EventAndResponsePublisher;
>>>>>>>
<<<<<<<
final Flow<Message, DittoRuntimeException, NotUsed> incoming =
createIncoming(version, connectionCorrelationId, authContext, dittoHeaders, adapter, request,
websocketConfig);
final Flow<DittoRuntimeException, Message, NotUsed> outgoing =
createOutgoing(version, connectionCorrelationId, dittoHeaders, adapter, request, websocketConfig,
signalEnrichmentFacade);
=======
final Pair<Connect, Flow<DittoRuntimeException, Message, NotUsed>> outgoing =
createOutgoing(version, connectionCorrelationId, dittoHeaders, adapter, request,
websocketConfig, signalEnrichmentFacade);
>>>>>>>
final Pair<Connect, Flow<DittoRuntimeException, Message, NotUsed>> outgoing =
createOutgoing(version, connectionCorrelationId, dittoHeaders, adapter, request,
websocketConfig, signalEnrichmentFacade);
<<<<<<<
final Source<SessionedJsonifiable, NotUsed> eventAndResponseSource = publisherSource.mapMaterializedValue(
withQueue -> {
webSocketSupervisor.supervise(withQueue.getSupervisedStream(), connectionCorrelationId,
additionalHeaders);
streamingActor.tell(
new Connect(withQueue.getSourceQueue(), connectionCorrelationId, STREAMING_TYPE_WS, version,
optJsonWebToken.map(JsonWebToken::getExpirationTime).orElse(null)),
ActorRef.noSender());
return NotUsed.getInstance();
=======
final Source<SessionedJsonifiable, Connect> sourceToPreMaterialize = publisherSource.mapMaterializedValue(
publisherActor -> {
webSocketSupervisor.supervise(publisherActor, connectionCorrelationId, additionalHeaders);
return new Connect(publisherActor, connectionCorrelationId, STREAMING_TYPE_WS, version,
optJsonWebToken.map(JsonWebToken::getExpirationTime).orElse(null));
>>>>>>>
final Source<SessionedJsonifiable, Connect> sourceToPreMaterialize = publisherSource.mapMaterializedValue(
withQueue -> {
webSocketSupervisor.supervise(withQueue.getSupervisedStream(), connectionCorrelationId,
additionalHeaders);
return new Connect(withQueue.getSourceQueue(), connectionCorrelationId, STREAMING_TYPE_WS, version,
optJsonWebToken.map(JsonWebToken::getExpirationTime).orElse(null)); |
<<<<<<<
import org.eclipse.ditto.protocoladapter.Adaptable;
=======
import org.eclipse.ditto.model.base.auth.AuthorizationContext;
>>>>>>>
import org.eclipse.ditto.protocoladapter.Adaptable;
import org.eclipse.ditto.model.base.auth.AuthorizationContext;
<<<<<<<
* Sets the passed {@code originatingAdaptable} to the builder.
*
* @param originatingAdaptable Adaptable from which this ExternalMessage originated
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withOriginatingAdaptable(@Nullable Adaptable originatingAdaptable);
/**
=======
* Marks the message as an error message.
*
* @param error whether the message is an error message
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder asError(boolean error);
/**
>>>>>>>
* Marks the message as an error message.
*
* @param error whether the message is an error message
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder asError(boolean error);
/**
* Sets the passed {@code originatingAdaptable} to the builder.
*
* @param originatingAdaptable Adaptable from which this ExternalMessage originated
* @return this builder in order to enable method chaining
*/
ExternalMessageBuilder withOriginatingAdaptable(@Nullable Adaptable originatingAdaptable);
/** |
<<<<<<<
@Nullable private final Metadata metadata;
=======
@Nullable private final Instant created;
>>>>>>>
@Nullable private final Instant created;
@Nullable private final Metadata metadata;
<<<<<<<
@Nullable final Instant modified,
@Nullable final Metadata metadata) {
=======
@Nullable final Instant modified,
@Nullable final Instant created) {
>>>>>>>
@Nullable final Instant modified,
@Nullable final Instant created,
@Nullable final Metadata metadata) {
<<<<<<<
* {@link #of(ThingId, AccessControlList, Attributes, Features, ThingLifecycle, ThingRevision, java.time.Instant, Metadata)}
=======
* {@link #of(ThingId, AccessControlList, Attributes, Features, ThingLifecycle, ThingRevision, java.time.Instant,
* java.time.Instant)}
>>>>>>>
* {@link #of(ThingId, AccessControlList, Attributes, Features, ThingLifecycle, ThingRevision, java.time.Instant,
* java.time.Instant, Metadata)}
<<<<<<<
@Nullable final Instant modified,
@Nullable final Metadata metadata) {
=======
@Nullable final Instant modified,
@Nullable final Instant created) {
>>>>>>>
@Nullable final Instant modified,
@Nullable final Instant created,
@Nullable final Metadata metadata) {
<<<<<<<
@Nullable final Instant modified,
@Nullable final Metadata metadata) {
=======
@Nullable final Instant modified,
@Nullable final Instant created) {
>>>>>>>
@Nullable final Instant modified,
@Nullable final Instant created,
@Nullable final Metadata metadata) {
<<<<<<<
revision, modified, metadata);
=======
revision, modified, created);
>>>>>>>
revision, modified, created, metadata);
<<<<<<<
* @param metadata the metadata of the Thing to be created.
=======
* @param created the created timestamp of the thing to be created.
>>>>>>>
* @param created the created timestamp of the thing to be created.
* @param metadata the metadata of the Thing to be created.
<<<<<<<
@Nullable final Instant modified,
@Nullable final Metadata metadata) {
=======
@Nullable final Instant modified,
@Nullable final Instant created) {
>>>>>>>
@Nullable final Instant modified,
@Nullable final Instant created,
@Nullable final Metadata metadata) {
<<<<<<<
revision, modified, metadata);
=======
revision, modified, created);
>>>>>>>
revision, modified, created, metadata);
<<<<<<<
* @param modified the modified timestamp of the Thing to be created.
* @param metadata the metadata of the Thing to be created.
=======
* @param modified the modified timestamp of the thing to be created.
* @param created the created timestamp of the thing to be created.
>>>>>>>
* @param modified the modified timestamp of the Thing to be created.
* @param created the created timestamp of the Thing to be created.
* @param metadata the metadata of the Thing to be created.
<<<<<<<
@Nullable final Instant modified,
@Nullable final Metadata metadata) {
=======
@Nullable final Instant modified,
@Nullable final Instant created) {
>>>>>>>
@Nullable final Instant modified,
@Nullable final Instant created,
@Nullable final Metadata metadata) {
<<<<<<<
modified, metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
<<<<<<<
modified, metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
<<<<<<<
modified,
metadata);
=======
modified,
created);
>>>>>>>
modified,
created,
metadata);
<<<<<<<
modified,
metadata);
=======
modified,
created);
>>>>>>>
modified,
created,
metadata);
<<<<<<<
modified, metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
<<<<<<<
modified, metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
<<<<<<<
revision, modified, metadata);
=======
revision, modified, created);
>>>>>>>
revision, modified, created, metadata);
<<<<<<<
modified, metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
<<<<<<<
modified, metadata);
}
@Override
public Optional<Metadata> getMetadata() {
return Optional.ofNullable(metadata);
=======
modified, created);
>>>>>>>
modified, created, metadata);
}
@Override
public Optional<Metadata> getMetadata() {
return Optional.ofNullable(metadata);
<<<<<<<
return Objects.hash(thingId, policyId, acl, definition, attributes, features, lifecycle, revision,
modified, metadata);
=======
return Objects.hash(thingId, policyId, acl, definition, attributes, features, lifecycle, revision, modified,
created);
>>>>>>>
return Objects.hash(thingId, policyId, acl, definition, attributes, features, lifecycle, revision, modified,
created, metadata);
<<<<<<<
Objects.equals(modified, other.modified) &&
Objects.equals(metadata, other.metadata);
=======
Objects.equals(modified, other.modified) &&
Objects.equals(created, other.created);
>>>>>>>
Objects.equals(modified, other.modified) &&
Objects.equals(created, other.created) &&
Objects.equals(metadata, other.metadata);
<<<<<<<
return getClass().getSimpleName() + " [thingId=" + thingId + ", acl=" + acl +
", policyId=" + policyId + ", definition=" + definition + ", attributes=" + attributes +
", features=" + features + ", lifecycle=" + lifecycle + ", revision=" + revision +
", modified=" + modified + ", metadata=" + metadata + "]";
=======
return getClass().getSimpleName() + " ["
+ "thingId=" + thingId +
", acl=" + acl +
", policyId=" + policyId +
", definition=" + definition +
", attributes=" + attributes +
", features=" + features +
", lifecycle=" + lifecycle +
", revision=" + revision +
", modified=" + modified +
", created=" + created
+ "]";
>>>>>>>
return getClass().getSimpleName() + " ["
+ "thingId=" + thingId +
", acl=" + acl +
", policyId=" + policyId +
", definition=" + definition +
", attributes=" + attributes +
", features=" + features +
", lifecycle=" + lifecycle +
", revision=" + revision +
", modified=" + modified +
", created=" + created +
", metadata=" + metadata
+ "]"; |
<<<<<<<
public Optional<Metadata> getMetadata() {
// TODO Add real implementation.
return Optional.empty();
}
@Override
=======
public Optional<Instant> getCreated() {
return Optional.ofNullable(created);
}
@Override
>>>>>>>
public Optional<Instant> getCreated() {
return Optional.ofNullable(created);
}
@Override
public Optional<Metadata> getMetadata() {
// TODO Add real implementation.
return Optional.empty();
}
@Override |
<<<<<<<
private Route routeLogging(final RequestContext ctx,
final String serviceName,
final Integer instance,
=======
private Route routeLogging(final RequestContext ctx, final String serviceName, final String instance,
>>>>>>>
private Route routeLogging(final RequestContext ctx,
final String serviceName,
final String instance,
<<<<<<<
private Route routePiggyback(final RequestContext ctx,
@Nullable final String serviceName,
@Nullable final Integer instance,
final DittoHeaders dittoHeaders) {
=======
private Route routePiggyback(final RequestContext ctx, @Nullable final String serviceName,
@Nullable final String instance, final DittoHeaders dittoHeaders) {
>>>>>>>
private Route routePiggyback(final RequestContext ctx,
@Nullable final String serviceName,
@Nullable final String instance,
final DittoHeaders dittoHeaders) {
<<<<<<<
private static Function<JsonValue, JsonValue> transformResponse(final CharSequence serviceName,
final Integer instance) {
=======
private static Function<JsonValue, JsonValue> transformResponse(final String serviceName, final String instance) {
>>>>>>>
private static Function<JsonValue, JsonValue> transformResponse(final CharSequence serviceName,
final String instance) {
<<<<<<<
private static JsonPointer transformerPointer(@Nullable final CharSequence serviceName,
@Nullable final Integer instance) {
=======
private static JsonPointer transformerPointer(@Nullable final String serviceName,
@Nullable final String instance) {
>>>>>>>
private static JsonPointer transformerPointer(@Nullable final CharSequence serviceName,
@Nullable final String instance) {
<<<<<<<
Route build(RequestContext ctx, String serviceName, Integer instance, DittoHeaders dittoHeaders);
=======
Route build(final RequestContext ctx, final String serviceName, final String instance,
final DittoHeaders dittoHeaders);
>>>>>>>
Route build(RequestContext ctx, String serviceName, String instance, DittoHeaders dittoHeaders); |
<<<<<<<
import org.eclipse.ditto.services.utils.persistence.mongo.config.DefaultMongoDbConfig;
=======
import java.util.concurrent.TimeUnit;
>>>>>>>
import org.eclipse.ditto.services.utils.persistence.mongo.config.DefaultMongoDbConfig;
import java.util.concurrent.TimeUnit; |
<<<<<<<
import org.eclipse.ditto.services.connectivity.util.ConnectivityMdcEntryKey;
import org.eclipse.ditto.services.utils.akka.logging.ThreadSafeDittoLoggingAdapter;
=======
import org.eclipse.ditto.services.connectivity.util.ConnectionLogUtil;
import org.eclipse.ditto.services.models.connectivity.BaseClientState;
>>>>>>>
import org.eclipse.ditto.services.connectivity.util.ConnectivityMdcEntryKey;
import org.eclipse.ditto.services.models.connectivity.BaseClientState;
import org.eclipse.ditto.services.utils.akka.logging.ThreadSafeDittoLoggingAdapter; |
<<<<<<<
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
=======
import org.eclipse.ditto.services.utils.cluster.RetrieveStatisticsDetailsResponseSupplier;
>>>>>>>
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
import org.eclipse.ditto.services.utils.cluster.RetrieveStatisticsDetailsResponseSupplier;
<<<<<<<
// start cluster singleton for namespace ops
ClusterUtil.startSingleton(getContext(), CLUSTER_ROLE, ThingNamespaceOpsActor.ACTOR_NAME,
ThingNamespaceOpsActor.props(pubSubMediator, config));
=======
retrieveStatisticsDetailsResponseSupplier = RetrieveStatisticsDetailsResponseSupplier.of(thingsShardRegion,
ThingsMessagingConstants.SHARD_REGION, log);
>>>>>>>
// start cluster singleton for namespace ops
ClusterUtil.startSingleton(getContext(), CLUSTER_ROLE, ThingNamespaceOpsActor.ACTOR_NAME,
ThingNamespaceOpsActor.props(pubSubMediator, config));
retrieveStatisticsDetailsResponseSupplier = RetrieveStatisticsDetailsResponseSupplier.of(thingsShardRegion,
ThingsMessagingConstants.SHARD_REGION, log); |
<<<<<<<
import org.eclipse.ditto.model.namespaces.NamespaceBlockedException;
import org.eclipse.ditto.services.base.config.DevOpsConfigReader;
=======
import org.eclipse.ditto.services.base.config.ServiceConfigReader;
>>>>>>>
import org.eclipse.ditto.model.namespaces.NamespaceBlockedException;
import org.eclipse.ditto.services.base.config.DevOpsConfigReader;
import org.eclipse.ditto.services.base.config.ServiceConfigReader;
<<<<<<<
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
import org.eclipse.ditto.services.utils.namespaces.BlockNamespaceBehavior;
import org.eclipse.ditto.services.utils.namespaces.BlockedNamespaces;
import org.eclipse.ditto.services.utils.namespaces.BlockedNamespacesUpdater;
=======
import org.eclipse.ditto.services.utils.cluster.ShardRegionExtractor;
>>>>>>>
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
import org.eclipse.ditto.services.utils.cluster.ShardRegionExtractor;
import org.eclipse.ditto.services.utils.namespaces.BlockNamespaceBehavior;
import org.eclipse.ditto.services.utils.namespaces.BlockedNamespaces;
import org.eclipse.ditto.services.utils.namespaces.BlockedNamespacesUpdater;
<<<<<<<
=======
final Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> preEnforcer =
PlaceholderSubstitution.newInstance();
final ActorRef conciergeForwarder = getInternalConciergeForwarder(context, configReader, pubSubMediator);
>>>>>>>
final ActorRef conciergeForwarder = getInternalConciergeForwarder(context, configReader, pubSubMediator);
<<<<<<<
preEnforcer, activityCheckInterval);
final ActorRef enforcerShardRegion = startShardRegion(actorSystem, configReader.cluster(), enforcerProps);
=======
conciergeForwarder, preEnforcer, activityCheckInterval);
final ActorRef enforcerShardRegion = startShardRegion(context.system(), configReader.cluster(), enforcerProps);
>>>>>>>
conciergeForwarder, preEnforcer, activityCheckInterval);
final ActorRef enforcerShardRegion = startShardRegion(context.system(), configReader.cluster(), enforcerProps);
<<<<<<<
private static Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> newPreEnforcer(
final BlockedNamespaces blockedNamespaces, final DevOpsConfigReader devOpsConfigReader,
final PlaceholderSubstitution placeholderSubstitution) {
return withDittoHeaders -> BlockNamespaceBehavior.of(blockedNamespaces)
.block(withDittoHeaders)
.thenCompose(placeholderSubstitution)
.exceptionally(throwable -> {
if (throwable instanceof NamespaceBlockedException) {
final String description = String.format("Please try again after %s.",
devOpsConfigReader.namespaceBlockTime().toString());
throw ((NamespaceBlockedException) throwable).toBuilder()
.description(description)
.build();
}
return null;
});
}
=======
private ActorRef getInternalConciergeForwarder(final ActorContext actorContext,
final ServiceConfigReader configReader, final ActorRef pubSubMediator) {
final ActorRef conciergeShardRegionProxy = ClusterSharding.get(actorContext.system())
.startProxy(ConciergeMessagingConstants.SHARD_REGION,
Optional.of(ConciergeMessagingConstants.CLUSTER_ROLE),
ShardRegionExtractor.of(configReader.cluster().numberOfShards(),
actorContext.system()));
return actorContext.actorOf(
ConciergeForwarderActor.props(pubSubMediator, conciergeShardRegionProxy),
"internal" + ConciergeForwarderActor.ACTOR_NAME);
}
>>>>>>>
private static Function<WithDittoHeaders, CompletionStage<WithDittoHeaders>> newPreEnforcer(
final BlockedNamespaces blockedNamespaces, final DevOpsConfigReader devOpsConfigReader,
final PlaceholderSubstitution placeholderSubstitution) {
return withDittoHeaders -> BlockNamespaceBehavior.of(blockedNamespaces)
.block(withDittoHeaders)
.thenCompose(placeholderSubstitution)
.exceptionally(throwable -> {
if (throwable instanceof NamespaceBlockedException) {
final String description = String.format("Please try again after %s.",
devOpsConfigReader.namespaceBlockTime().toString());
throw ((NamespaceBlockedException) throwable).toBuilder()
.description(description)
.build();
}
return null;
});
}
private ActorRef getInternalConciergeForwarder(final ActorContext actorContext,
final ServiceConfigReader configReader, final ActorRef pubSubMediator) {
final ActorRef conciergeShardRegionProxy = ClusterSharding.get(actorContext.system())
.startProxy(ConciergeMessagingConstants.SHARD_REGION,
Optional.of(ConciergeMessagingConstants.CLUSTER_ROLE),
ShardRegionExtractor.of(configReader.cluster().numberOfShards(),
actorContext.system()));
return actorContext.actorOf(
ConciergeForwarderActor.props(pubSubMediator, conciergeShardRegionProxy),
"internal" + ConciergeForwarderActor.ACTOR_NAME);
} |
<<<<<<<
import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.binary.Base64;
=======
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.util.Base64;
>>>>>>>
import java.nio.charset.StandardCharsets;
import org.apache.accumulo.core.util.Base64;
<<<<<<<
String encodedRow = new String(Base64.encodeBase64(TextUtil.getBytes(data)), StandardCharsets.UTF_8);
encodedRow = encodedRow.replace('/', '_').replace('+', '-');
=======
String encodedRow = Base64.encodeBase64URLSafeString(TextUtil.getBytes(data));
>>>>>>>
String encodedRow = Base64.encodeBase64URLSafeString(TextUtil.getBytes(data));
<<<<<<<
node = node.replace('_', '/').replace('-', '+');
return Base64.decodeBase64(node.getBytes(StandardCharsets.UTF_8));
=======
/* decode transparently handles URLSafe encodings */
return Base64.decodeBase64(node.getBytes(Constants.UTF8));
>>>>>>>
/* decode transparently handles URLSafe encodings */
return Base64.decodeBase64(node.getBytes(StandardCharsets.UTF_8)); |
<<<<<<<
import org.eclipse.ditto.model.base.acks.AcknowledgementLabelInvalidException;
=======
>>>>>>>
import org.eclipse.ditto.model.base.acks.AcknowledgementLabelInvalidException;
<<<<<<<
=======
import org.eclipse.ditto.services.gateway.security.authentication.jwt.PublicKeyProviderUnavailableException;
>>>>>>>
import org.eclipse.ditto.services.gateway.security.authentication.jwt.PublicKeyProviderUnavailableException;
<<<<<<<
PolicyIdInvalidException.class,
AcknowledgementLabelInvalidException.class,
AcknowledgementCorrelationIdMissingException.class);
=======
PolicyIdInvalidException.class,
PublicKeyProviderUnavailableException.class
);
>>>>>>>
PolicyIdInvalidException.class,
PublicKeyProviderUnavailableException.class,
AcknowledgementLabelInvalidException.class,
AcknowledgementCorrelationIdMissingException.class); |
<<<<<<<
ConnectionLogUtil.enhanceLogWithConnectionId(log, connectionId);
log.debug("Received MQTT message on topic {}: {}", message.topic(), message.payload().utf8String());
headers = new HashMap<>();
=======
if (log.isDebugEnabled()) {
log.debug("Received MQTT message on topic <{}>: {}", message.topic(),
message.payload().utf8String());
}
final HashMap<String, String> headers = new HashMap<>();
>>>>>>>
ConnectionLogUtil.enhanceLogWithConnectionId(log, connectionId);
if (log.isDebugEnabled()) {
log.debug("Received MQTT message on topic <{}>: {}", message.topic(),
message.payload().utf8String());
}
headers = new HashMap<>();
<<<<<<<
inboundMonitor.success(externalMessage);
messageMappingProcessor.tell(externalMessage, getSelf());
=======
inboundCounter.recordSuccess();
final Object msg = new ConsistentHashingRouter.ConsistentHashableEnvelope(externalMessage, message.topic());
messageMappingProcessor.tell(msg, getSelf());
>>>>>>>
inboundMonitor.success(externalMessage);
final Object msg = new ConsistentHashingRouter.ConsistentHashableEnvelope(externalMessage, message.topic());
messageMappingProcessor.tell(msg, getSelf()); |
<<<<<<<
private static final String DIRECTION_TAG_NAME = "direction";
private static final DittoProtocolAdapter PROTOCOL_ADAPTER = DittoProtocolAdapter.newInstance();
=======
>>>>>>>
private static final String DIRECTION_TAG_NAME = "direction";
<<<<<<<
final StartedTimer overAllProcessingTimer = startNewTimer().tag(DIRECTION_TAG_NAME, OUTBOUND);
return withTimer(overAllProcessingTimer,
() -> convertToExternalMessage(() -> PROTOCOL_ADAPTER.toAdaptable(signal), overAllProcessingTimer));
=======
final String correlationId = signal.getDittoHeaders().getCorrelationId().orElse("no-correlation-id");
return doApplyTraced(
() -> createProcessingContext(connectionId + OUTBOUND_MAPPING_TRACE_SUFFIX, correlationId),
ctx -> convertToExternalMessage(() -> protocolAdapter.toAdaptable(signal), ctx));
>>>>>>>
final StartedTimer overAllProcessingTimer = startNewTimer().tag(DIRECTION_TAG_NAME, OUTBOUND);
return withTimer(overAllProcessingTimer,
() -> convertToExternalMessage(() -> protocolAdapter.toAdaptable(signal), overAllProcessingTimer)); |
<<<<<<<
protected final ConnectionLogger connectionLogger;
private final ConnectionLoggerRegistry connectionLoggerRegistry;
private final ConnectivityCounterRegistry connectionCounterRegistry;
=======
private final Gauge clientGauge;
>>>>>>>
private final Gauge clientGauge;
private final ConnectionLoggerRegistry connectionLoggerRegistry;
private final ConnectivityCounterRegistry connectionCounterRegistry; |
<<<<<<<
=======
import org.eclipse.ditto.model.policies.PolicyId;
import org.eclipse.ditto.model.things.AccessControlList;
import org.eclipse.ditto.model.things.AccessControlListModelFactory;
import org.eclipse.ditto.model.things.AclEntry;
import org.eclipse.ditto.model.things.Attributes;
import org.eclipse.ditto.model.things.Feature;
import org.eclipse.ditto.model.things.FeatureDefinition;
import org.eclipse.ditto.model.things.FeatureProperties;
import org.eclipse.ditto.model.things.Features;
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.model.things.ThingDefinition;
>>>>>>>
import org.eclipse.ditto.model.things.ThingDefinition;
<<<<<<<
=======
protected static Thing thingFrom(final Adaptable adaptable) {
return adaptable.getPayload().getValue()
.map(JsonValue::asObject)
.map(ThingsModelFactory::newThing)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static JsonArray thingsArrayFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.filter(JsonValue::isArray)
.map(JsonValue::asArray)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static AccessControlList aclFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.map(JsonValue::asObject)
.map(AccessControlListModelFactory::newAcl)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static AclEntry aclEntryFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.map(permissions -> AccessControlListModelFactory
.newAclEntry(leafValue(adaptable.getPayload().getPath()), permissions))
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static Attributes attributesFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.map(JsonValue::asObject)
.map(ThingsModelFactory::newAttributes)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static JsonPointer attributePointerFrom(final Adaptable adaptable) {
final JsonPointer path = adaptable.getPayload().getPath();
return path.getSubPointer(ATTRIBUTE_PATH_LEVEL)
.orElseThrow(() -> UnknownPathException.newBuilder(path).build());
}
protected static JsonValue attributeValueFrom(final Adaptable adaptable) {
return adaptable.getPayload().getValue().orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static ThingDefinition thingDefinitionFrom(final Adaptable adaptable) {
return adaptable.getPayload()
.getValue()
.map(JsonValue::asString)
.map(ThingsModelFactory::newDefinition)
.orElseThrow(() -> JsonParseException.newBuilder().build());
}
protected static String featureIdFrom(final Adaptable adaptable) {
final JsonPointer path = adaptable.getPayload().getPath();
return path.get(1).orElseThrow(() -> UnknownPathException.newBuilder(path).build()).toString();
}
>>>>>>> |
<<<<<<<
import org.eclipse.ditto.model.query.filter.QueryFilterCriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.Criteria;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactoryImpl;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.things.ModelBasedThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.things.ThingPredicateVisitor;
import org.eclipse.ditto.model.things.Thing;
=======
import org.eclipse.ditto.protocoladapter.TopicPath;
>>>>>>>
import org.eclipse.ditto.model.query.filter.QueryFilterCriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.Criteria;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactoryImpl;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.things.ModelBasedThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.things.ThingPredicateVisitor;
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.protocoladapter.TopicPath;
<<<<<<<
private Criteria parseCriteria(final String filter) {
final CriteriaFactory criteriaFactory = new CriteriaFactoryImpl();
final ThingsFieldExpressionFactory fieldExpressionFactory =
new ModelBasedThingsFieldExpressionFactory();
final QueryFilterCriteriaFactory queryFilterCriteriaFactory =
new QueryFilterCriteriaFactory(criteriaFactory, fieldExpressionFactory);
return queryFilterCriteriaFactory.filterCriteria(filter, DittoHeaders.empty());
}
private boolean matchesFilter(final Signal<?> signal) {
if (signal instanceof ThingEvent) {
// currently only ThingEvents may be filtered
return ThingEventToThingConverter.thingEventToThing((ThingEvent) signal)
.filter(this::doMatchFilter)
.isPresent();
} else {
return true;
}
}
private boolean doMatchFilter(final Thing thing) {
if (eventFilterCriteria != null) {
return ThingPredicateVisitor.apply(eventFilterCriteria)
.test(thing);
} else {
// let all events through if there was no criteria/filter set
return true;
}
}
private void acknowledgeSubscriptionForSignal(final Signal liveSignal) {
if (liveSignal instanceof MessageCommand && outstandingSubscriptionAcks.contains(StreamingType.MESSAGES)) {
acknowledgeSubscription(StreamingType.MESSAGES, getSelf());
} else if (liveSignal instanceof Command && outstandingSubscriptionAcks.contains(StreamingType.LIVE_COMMANDS)) {
acknowledgeSubscription(StreamingType.LIVE_COMMANDS, getSelf());
} else if (liveSignal instanceof Event && outstandingSubscriptionAcks.contains(StreamingType.LIVE_EVENTS)) {
acknowledgeSubscription(StreamingType.LIVE_EVENTS, getSelf());
=======
private void acknowledgeSubscriptionForSignal(final Signal signal) {
if (isLiveSignal(signal)) {
if (signal instanceof MessageCommand &&
outstandingSubscriptionAcks.contains(StreamingType.MESSAGES)) {
acknowledgeSubscription(StreamingType.MESSAGES, getSelf());
} else if (signal instanceof Command && outstandingSubscriptionAcks.contains(StreamingType.LIVE_COMMANDS)) {
acknowledgeSubscription(StreamingType.LIVE_COMMANDS, getSelf());
} else if (signal instanceof Event && outstandingSubscriptionAcks.contains(StreamingType.LIVE_EVENTS)) {
acknowledgeSubscription(StreamingType.LIVE_EVENTS, getSelf());
}
} else if (signal instanceof Event && outstandingSubscriptionAcks.contains(StreamingType.EVENTS)) {
acknowledgeSubscription(StreamingType.EVENTS, getSelf());
>>>>>>>
private Criteria parseCriteria(final String filter) {
final CriteriaFactory criteriaFactory = new CriteriaFactoryImpl();
final ThingsFieldExpressionFactory fieldExpressionFactory =
new ModelBasedThingsFieldExpressionFactory();
final QueryFilterCriteriaFactory queryFilterCriteriaFactory =
new QueryFilterCriteriaFactory(criteriaFactory, fieldExpressionFactory);
return queryFilterCriteriaFactory.filterCriteria(filter, DittoHeaders.empty());
}
private boolean matchesFilter(final Signal<?> signal) {
if (signal instanceof ThingEvent) {
// currently only ThingEvents may be filtered
return ThingEventToThingConverter.thingEventToThing((ThingEvent) signal)
.filter(this::doMatchFilter)
.isPresent();
} else {
return true;
}
}
private boolean doMatchFilter(final Thing thing) {
if (eventFilterCriteria != null) {
return ThingPredicateVisitor.apply(eventFilterCriteria)
.test(thing);
} else {
// let all events through if there was no criteria/filter set
return true;
}
}
private void acknowledgeSubscriptionForSignal(final Signal signal) {
if (isLiveSignal(signal)) {
if (signal instanceof MessageCommand &&
outstandingSubscriptionAcks.contains(StreamingType.MESSAGES)) {
acknowledgeSubscription(StreamingType.MESSAGES, getSelf());
} else if (signal instanceof Command && outstandingSubscriptionAcks.contains(StreamingType.LIVE_COMMANDS)) {
acknowledgeSubscription(StreamingType.LIVE_COMMANDS, getSelf());
} else if (signal instanceof Event && outstandingSubscriptionAcks.contains(StreamingType.LIVE_EVENTS)) {
acknowledgeSubscription(StreamingType.LIVE_EVENTS, getSelf());
}
} else if (signal instanceof Event && outstandingSubscriptionAcks.contains(StreamingType.EVENTS)) {
acknowledgeSubscription(StreamingType.EVENTS, getSelf()); |
<<<<<<<
connection = TestConstants.createConnection(connectionId);
=======
connection = TestConstants.createConnection(CONNECTION_ID, actorSystem);
>>>>>>>
connection = TestConstants.createConnection(CONNECTION_ID);
<<<<<<<
TestConstants.createConnection(connectionId,
=======
TestConstants.createConnection(CONNECTION_ID, actorSystem,
>>>>>>>
TestConstants.createConnection(CONNECTION_ID,
<<<<<<<
TestConstants.createConnection(connectionId,
=======
TestConstants.createConnection(CONNECTION_ID, actorSystem,
>>>>>>>
TestConstants.createConnection(CONNECTION_ID,
<<<<<<<
TestConstants.createConnection(connectionId,
=======
TestConstants.createConnection(CONNECTION_ID, actorSystem,
>>>>>>>
TestConstants.createConnection(CONNECTION_ID, |
<<<<<<<
import org.eclipse.ditto.services.utils.akka.logging.DittoLoggerFactory;
=======
import org.eclipse.ditto.services.utils.akka.LogUtil;
import org.eclipse.ditto.services.utils.cache.config.CacheConfig;
>>>>>>>
import org.eclipse.ditto.services.utils.akka.logging.DittoLoggerFactory;
import org.eclipse.ditto.services.utils.cache.config.CacheConfig; |
<<<<<<<
import org.eclipse.ditto.services.connectivity.util.ConnectivityMdcEntryKey;
import org.eclipse.ditto.services.utils.akka.logging.ThreadSafeDittoLoggingAdapter;
=======
import org.eclipse.ditto.services.connectivity.util.ConnectionLogUtil;
import org.eclipse.ditto.services.models.connectivity.BaseClientState;
>>>>>>>
import org.eclipse.ditto.services.connectivity.util.ConnectivityMdcEntryKey;
import org.eclipse.ditto.services.models.connectivity.BaseClientState;
import org.eclipse.ditto.services.utils.akka.logging.ThreadSafeDittoLoggingAdapter; |
<<<<<<<
private <A extends ThingModifiedEvent> void persistAndApplyEvent(final A event, final Consumer<A> handler) {
if (event.getDittoHeaders().isDryRun()) {
handler.accept(event);
=======
private <A extends ThingModifiedEvent> void persistAndApplyEvent(final A event, final Consumer<A> handler) {
final A modifiedEvent;
if (thing != null) {
// set version of event to the version of the thing
final DittoHeaders newHeaders = event.getDittoHeaders().toBuilder()
.schemaVersion(thing.getImplementedSchemaVersion())
.build();
modifiedEvent = (A) event.setDittoHeaders(newHeaders);
>>>>>>>
private <A extends ThingModifiedEvent> void persistAndApplyEvent(final A event, final Consumer<A> handler) {
final A modifiedEvent;
if (thing != null) {
// set version of event to the version of the thing
final DittoHeaders newHeaders = event.getDittoHeaders().toBuilder()
.schemaVersion(thing.getImplementedSchemaVersion())
.build();
modifiedEvent = (A) event.setDittoHeaders(newHeaders);
<<<<<<<
=======
private void loadSnapshot(final RetrieveThing command, final long snapshotRevision, final ActorRef sender) {
thingSnapshotter.loadSnapshot(snapshotRevision).thenAccept(snapshotThing -> {
if (snapshotThing.isPresent()) {
respondWithLoadSnapshotResult(command, sender, snapshotThing.get());
} else {
respondWithNotAccessibleException(command, sender);
}
});
}
private void respondWithLoadSnapshotResult(final RetrieveThing command, final ActorRef sender,
final Thing snapshotThing) {
final JsonObject thingJson = command.getSelectedFields()//
.map(sf -> snapshotThing.toJson(command.getImplementedSchemaVersion(), sf))
.orElseGet(() -> snapshotThing.toJson(command.getImplementedSchemaVersion()));
notifySender(sender, RetrieveThingResponse.of(thingId, thingJson, command.getDittoHeaders()));
}
private void respondWithNotAccessibleException(final RetrieveThing command, final ActorRef sender) {
final String commandThingId = command.getThingId();
final DittoHeaders dittoHeaders = command.getDittoHeaders();
final ThingNotAccessibleException exception = ThingNotAccessibleException.newBuilder(commandThingId).build();
// reset command headers so that correlationId etc. are preserved
final DittoRuntimeException withDittoHeaders = exception.setDittoHeaders(dittoHeaders);
notifySender(sender, withDittoHeaders);
}
private boolean validThing(final JsonSchemaVersion version, final Thing thing, final DittoHeaders headers) {
final Optional<AccessControlList> accessControlList = thing.getAccessControlList();
if (JsonSchemaVersion.V_1.equals(version)) {
if (accessControlList.isPresent()) {
final Validator aclValidator =
AclValidator.newInstance(accessControlList.get(), Thing.MIN_REQUIRED_PERMISSIONS);
// before persisting, check if the ACL is valid and reject if not:
if (!aclValidator.isValid()) {
notifySender(getSender(), AclInvalidException.newBuilder(thing.getId().orElse(thingId))
.dittoHeaders(headers)
.build());
return false;
}
} else {
return false;
}
}
return true;
}
private Thing handleCommandVersion(final JsonSchemaVersion version, final Thing thing,
final DittoHeaders dittoHeaders) {
if (JsonSchemaVersion.V_1.equals(version)) {
return enhanceNewThingWithFallbackAcl(enhanceThingWithLifecycle(thing),
dittoHeaders.getAuthorizationContext());
}
// default case handle as v2 and upwards:
else {
//acl is not allowed to be set in v2
if (thing.getAccessControlList().isPresent()) {
throw AclNotAllowedException.newBuilder(thingId).dittoHeaders(dittoHeaders).build();
}
return enhanceThingWithLifecycle(thing);
}
}
/**
* Retrieves the Thing with first authorization subjects as fallback for the ACL of the Thing if the passed
* {@code newThing} has no ACL set.
*
* @param newThing the new Thing to take as a "base" and to check for presence of ACL inside.
* @param authorizationContext the AuthorizationContext to take the first AuthorizationSubject as fallback from.
* @return the really new Thing with guaranteed ACL.
*/
private static Thing enhanceNewThingWithFallbackAcl(final Thing newThing,
final AuthorizationContext authorizationContext) {
final ThingBuilder.FromCopy newThingBuilder = ThingsModelFactory.newThingBuilder(newThing);
final Boolean isAclEmpty = newThing.getAccessControlList()
.map(AccessControlList::isEmpty)
.orElse(true);
if (isAclEmpty) {
// do the fallback and use the first authorized subject and give all permissions to it:
final AuthorizationSubject authorizationSubject = authorizationContext.getFirstAuthorizationSubject()
.orElseThrow(() -> new NullPointerException("AuthorizationContext does not contain an " +
"AuthorizationSubject!"));
newThingBuilder.setPermissions(authorizationSubject, Thing.MIN_REQUIRED_PERMISSIONS);
}
return newThingBuilder.build();
}
>>>>>>>
<<<<<<<
final String msgTemplate = "This Thing Actor did not handle the requested Thing with ID <{0}>!";
throw new IllegalArgumentException(MessageFormat.format(msgTemplate, command.getId()));
=======
throw new IllegalArgumentException(MessageFormat.format(UNHANDLED_MESSAGE_TEMPLATE, command.getId()));
>>>>>>>
throw new IllegalArgumentException(MessageFormat.format(UNHANDLED_MESSAGE_TEMPLATE, command.getId()));
<<<<<<<
final String msgTemplate = "This Thing Actor did not handle the requested Thing with ID <{0}>!";
throw new IllegalArgumentException(MessageFormat.format(msgTemplate, command.getId()));
=======
throw new IllegalArgumentException(MessageFormat.format(UNHANDLED_MESSAGE_TEMPLATE, command.getId()));
>>>>>>>
throw new IllegalArgumentException(MessageFormat.format(UNHANDLED_MESSAGE_TEMPLATE, command.getId()));
<<<<<<<
private void deleteAclEntry(final AuthorizationSubject authorizationSubject, final DittoHeaders dittoHeaders) {
final AclEntryDeleted aclEntryDeleted =
AclEntryDeleted.of(thingId, authorizationSubject, nextRevision(), eventTimestamp(), dittoHeaders);
=======
private void deleteAclEntry(final AuthorizationSubject authorizationSubject,
final DittoHeaders dittoHeaders) {
final AclEntryDeleted aclEntryDeleted = AclEntryDeleted
.of(thingId, authorizationSubject, nextRevision(), eventTimestamp(),
dittoHeaders);
>>>>>>>
private void deleteAclEntry(final AuthorizationSubject authorizationSubject, final DittoHeaders dittoHeaders) {
final AclEntryDeleted aclEntryDeleted =
AclEntryDeleted.of(thingId, authorizationSubject, nextRevision(), eventTimestamp(), dittoHeaders);
<<<<<<<
FeaturePropertiesDeleted.of(command.getThingId(), featureId, nextRevision(),
eventTimestamp(), dittoHeaders);
persistAndApplyEvent(propertiesDeleted, event -> notifySender(
DeleteFeaturePropertiesResponse.of(thingId, featureId, dittoHeaders)));
=======
FeaturePropertiesDeleted.of(command.getThingId(), command.getFeatureId(),
nextRevision(), eventTimestamp(), dittoHeaders);
persistAndApplyEvent(propertiesDeleted, event -> notifySender(
DeleteFeaturePropertiesResponse.of(thingId, command.getFeatureId(), dittoHeaders)));
>>>>>>>
FeaturePropertiesDeleted.of(command.getThingId(), featureId, nextRevision(),
eventTimestamp(), dittoHeaders);
persistAndApplyEvent(propertiesDeleted, event -> notifySender(
DeleteFeaturePropertiesResponse.of(thingId, featureId, dittoHeaders)));
<<<<<<<
persistAndApplyEvent(propertyDeleted, event -> notifySender(
DeleteFeaturePropertyResponse.of(thingId, featureId, propertyJsonPointer,
=======
persistAndApplyEvent(propertyDeleted, event -> notifySender(
DeleteFeaturePropertyResponse.of(thingId, command.getFeatureId(), propertyJsonPointer,
>>>>>>>
persistAndApplyEvent(propertyDeleted, event -> notifySender(
DeleteFeaturePropertyResponse.of(thingId, featureId, propertyJsonPointer,
<<<<<<<
}
/**
=======
}
/**
>>>>>>>
}
/**
<<<<<<<
private static final String UNHANDLED_MESSAGE_TEMPLATE =
"This Thing Actor did not handle the requested Thing with ID <{0}>!";
=======
>>>>>>>
<<<<<<<
.filter(command.getId()::equals)
=======
.filter(id -> Objects.equals(id, command.getId()))
>>>>>>>
.filter(command.getId()::equals) |
<<<<<<<
import javax.annotation.Nullable;
import org.eclipse.ditto.services.thingsearch.common.util.RootSupervisorStrategyFactory;
import org.eclipse.ditto.services.thingsearch.persistence.PersistenceConstants;
import org.eclipse.ditto.services.thingsearch.persistence.write.ThingsSearchUpdaterPersistence;
import org.eclipse.ditto.services.thingsearch.persistence.write.impl.MongoEventToPersistenceStrategyFactory;
import org.eclipse.ditto.services.thingsearch.persistence.write.impl.MongoThingsSearchUpdaterPersistence;
import org.eclipse.ditto.services.thingsearch.updater.config.DeletionConfig;
import org.eclipse.ditto.services.thingsearch.updater.config.UpdaterConfig;
import org.eclipse.ditto.services.utils.akka.streaming.SyncConfig;
=======
import org.eclipse.ditto.services.base.config.ServiceConfigReader;
import org.eclipse.ditto.services.utils.akka.streaming.StreamConsumerSettings;
>>>>>>>
import javax.annotation.Nullable;
import org.eclipse.ditto.services.thingsearch.common.util.RootSupervisorStrategyFactory;
import org.eclipse.ditto.services.thingsearch.persistence.PersistenceConstants;
import org.eclipse.ditto.services.thingsearch.persistence.write.ThingsSearchUpdaterPersistence;
import org.eclipse.ditto.services.thingsearch.persistence.write.impl.MongoThingsSearchUpdaterPersistence;
import org.eclipse.ditto.services.thingsearch.updater.config.DeletionConfig;
import org.eclipse.ditto.services.thingsearch.updater.config.UpdaterConfig;
import org.eclipse.ditto.services.utils.akka.streaming.SyncConfig;
<<<<<<<
=======
import com.mongodb.reactivestreams.client.MongoDatabase;
import com.typesafe.config.Config;
>>>>>>>
import com.mongodb.reactivestreams.client.MongoDatabase;
<<<<<<<
}
@Nullable
private static CommandListener getCommandListenerOrNull(final MongoDbConfig.MonitoringConfig monitoringConfig) {
return monitoringConfig.isCommandsEnabled() ? new KamonCommandListener(KAMON_METRICS_PREFIX) : null;
}
@Nullable
private static ConnectionPoolListener getConnectionPoolListenerOrNull(
final MongoDbConfig.MonitoringConfig monitoringConfig) {
return monitoringConfig.isConnectionPoolEnabled()
? new KamonConnectionPoolListener(KAMON_METRICS_PREFIX)
: null;
}
private ThingsSearchUpdaterPersistence initializeThingsSearchUpdaterPersistence(final DittoMongoClient mongoClient,
final ActorMaterializer materializer, final IndexInitializationConfig indexInitializationConfig) {
final ThingsSearchUpdaterPersistence searchUpdaterPersistence =
new MongoThingsSearchUpdaterPersistence(mongoClient, log,
MongoEventToPersistenceStrategyFactory.getInstance(), materializer);
if (indexInitializationConfig.isIndexInitializationConfigEnabled()) {
searchUpdaterPersistence.initializeIndices();
} else {
log.info("Skipping IndexInitializer because it is disabled.");
}
return searchUpdaterPersistence;
=======
>>>>>>>
}
@Nullable
private static CommandListener getCommandListenerOrNull(final MongoDbConfig.MonitoringConfig monitoringConfig) {
return monitoringConfig.isCommandsEnabled() ? new KamonCommandListener(KAMON_METRICS_PREFIX) : null;
}
@Nullable
private static ConnectionPoolListener getConnectionPoolListenerOrNull(
final MongoDbConfig.MonitoringConfig monitoringConfig) {
return monitoringConfig.isConnectionPoolEnabled()
? new KamonConnectionPoolListener(KAMON_METRICS_PREFIX)
: null;
}
private ThingsSearchUpdaterPersistence initializeThingsSearchUpdaterPersistence(final DittoMongoClient mongoClient,
final ActorMaterializer materializer, final IndexInitializationConfig indexInitializationConfig) {
final ThingsSearchUpdaterPersistence searchUpdaterPersistence =
new MongoThingsSearchUpdaterPersistence(mongoClient, log,
MongoEventToPersistenceStrategyFactory.getInstance(), materializer);
if (indexInitializationConfig.isIndexInitializationConfigEnabled()) {
searchUpdaterPersistence.initializeIndices();
} else {
log.info("Skipping IndexInitializer because it is disabled.");
}
return searchUpdaterPersistence;
<<<<<<<
private ActorRef startChildActor(final Props props) {
log.info("Starting child actor <{}>.", ThingsUpdater.ACTOR_NAME);
return getContext().actorOf(props, ThingsUpdater.ACTOR_NAME);
}
=======
>>>>>>> |
<<<<<<<
import akka.japi.function.Function;
import akka.stream.ActorMaterializer;
=======
>>>>>>>
import akka.stream.ActorMaterializer;
<<<<<<<
private final ActorMaterializer materializer;
=======
private final RejectionHandler rejectionHandler = DittoRejectionHandlerFactory.createInstance();
>>>>>>>
private final ActorMaterializer materializer;
private final RejectionHandler rejectionHandler = DittoRejectionHandlerFactory.createInstance();
<<<<<<<
private Route wrapWithRootDirectives(final java.util.function.Function<String, Route> rootRoute) {
/* the outer handleExceptions is for handling exceptions in the directives wrapping the rootRoute (which
normally should not occur */
return handleExceptions(exceptionHandler, () ->
ensureCorrelationId(correlationId ->
rewriteResponse(materializer, correlationId, () ->
RequestTimeoutHandlingDirective.handleRequestTimeout(correlationId, () ->
logRequestResult(correlationId, () ->
EncodingEnsuringDirective.ensureEncoding(correlationId, () ->
HttpsEnsuringDirective.ensureHttps(correlationId, () ->
CorsEnablingDirective.enableCors(() ->
SecurityResponseHeadersDirective.addSecurityResponseHeaders(
() ->
/* handling the rejections is done by akka automatically, but if we
do it here explicitly, we are able to log the status code for the
rejection (e.g. 404 or 405) in a wrapping directive. */
handleRejections(
RejectionHandler.defaultHandler(),
() ->
/* the inner handleExceptions is for handling exceptions
occurring in the route route. It makes sure that the
wrapping directives such as addSecurityResponseHeaders are
even called in an error case in the route route. */
handleExceptions(
exceptionHandler,
() -> rootRoute
.apply(
correlationId))
)
)
)
=======
private Route wrapWithRootDirectives(final Function<String, Route> rootRoute) {
final Function<Function<String, Route>, Route> outerRouteProvider = innerRouteProvider ->
/* the outer handleExceptions is for handling exceptions in the directives wrapping the rootRoute
(which normally should not occur */
handleExceptions(exceptionHandler, () ->
ensureCorrelationId(correlationId ->
rewriteResponse(correlationId, () ->
RequestTimeoutHandlingDirective.handleRequestTimeout(correlationId, () ->
logRequestResult(correlationId, () ->
innerRouteProvider.apply(correlationId)
)
)
)
)
);
final Function<String, Route> innerRouteProvider = correlationId ->
EncodingEnsuringDirective.ensureEncoding(correlationId, () ->
HttpsEnsuringDirective.ensureHttps(correlationId, () ->
CorsEnablingDirective.enableCors(() ->
SecurityResponseHeadersDirective.addSecurityResponseHeaders(() ->
/* handling the rejections is done by akka automatically, but if we
do it here explicitly, we are able to log the status code for the
rejection (e.g. 404 or 405) in a wrapping directive. */
handleRejections(rejectionHandler, () ->
/* the inner handleExceptions is for handling exceptions
occurring in the route route. It makes sure that the
wrapping directives such as addSecurityResponseHeaders are
even called in an error case in the route route. */
handleExceptions(exceptionHandler, () ->
rootRoute.apply(correlationId)
>>>>>>>
private Route wrapWithRootDirectives(final java.util.function.Function<String, Route> rootRoute) {
final Function<Function<String, Route>, Route> outerRouteProvider = innerRouteProvider ->
/* the outer handleExceptions is for handling exceptions in the directives wrapping the rootRoute
(which normally should not occur */
handleExceptions(exceptionHandler, () ->
ensureCorrelationId(correlationId ->
rewriteResponse(materializer, correlationId, () ->
RequestTimeoutHandlingDirective.handleRequestTimeout(correlationId, () ->
logRequestResult(correlationId, () ->
innerRouteProvider.apply(correlationId)
)
)
)
)
);
final Function<String, Route> innerRouteProvider = correlationId ->
EncodingEnsuringDirective.ensureEncoding(correlationId, () ->
HttpsEnsuringDirective.ensureHttps(correlationId, () ->
CorsEnablingDirective.enableCors(() ->
SecurityResponseHeadersDirective.addSecurityResponseHeaders(() ->
/* handling the rejections is done by akka automatically, but if we
do it here explicitly, we are able to log the status code for the
rejection (e.g. 404 or 405) in a wrapping directive. */
handleRejections(rejectionHandler, () ->
/* the inner handleExceptions is for handling exceptions
occurring in the route route. It makes sure that the
wrapping directives such as addSecurityResponseHeaders are
even called in an error case in the route route. */
handleExceptions(exceptionHandler, () ->
rootRoute.apply(correlationId) |
<<<<<<<
ThingPersistenceActor(final String thingId,
final ActorRef pubSubMediator,
final ThingSnapshotter.Create thingSnapshotterCreate,
final ThingConfig thingConfig,
final boolean logIncomingMessages) {
=======
ThingPersistenceActor(final String thingId, final ActorRef pubSubMediator,
final ThingSnapshotter.Create thingSnapshotterCreate) {
>>>>>>>
ThingPersistenceActor(final String thingId,
final ActorRef pubSubMediator,
final ThingSnapshotter.Create thingSnapshotterCreate,
final ThingConfig thingConfig,
final boolean logIncomingMessages) {
<<<<<<<
defaultContext = DefaultContext.getInstance(thingId, log, thingSnapshotter, this::becomeThingCreatedHandler,
this::becomeThingDeletedHandler, this::stopThisActor, this::isFirstMessage);
=======
final Runnable becomeCreatedRunnable = this::becomeThingCreatedHandler;
final Runnable becomeDeletedRunnable = this::becomeThingDeletedHandler;
defaultContext =
DefaultContext.getInstance(thingId, log, thingSnapshotter, becomeCreatedRunnable,
becomeDeletedRunnable);
>>>>>>>
final Runnable becomeCreatedRunnable = this::becomeThingCreatedHandler;
final Runnable becomeDeletedRunnable = this::becomeThingDeletedHandler;
defaultContext =
DefaultContext.getInstance(thingId, log, thingSnapshotter, becomeCreatedRunnable,
becomeDeletedRunnable);
<<<<<<<
private boolean isFirstMessage() {
return firstMessageCounter <= 1;
}
=======
private void scheduleCheckForThingActivity(final long intervalInSeconds) {
log.debug("Scheduling for Activity Check in <{}> seconds.", intervalInSeconds);
// if there is a previous activity checker, cancel it
if (activityChecker != null) {
activityChecker.cancel();
}
// send a message to ourselves:
activityChecker = getContext()
.system()
.scheduler()
.scheduleOnce(Duration.apply(intervalInSeconds, TimeUnit.SECONDS), getSelf(),
new CheckForActivity(getRevisionNumber(), accessCounter), getContext().dispatcher(), null);
}
>>>>>>>
private void scheduleCheckForThingActivity(final long intervalInSeconds) {
log.debug("Scheduling for Activity Check in <{}> seconds.", intervalInSeconds);
// if there is a previous activity checker, cancel it
if (activityChecker != null) {
activityChecker.cancel();
}
// send a message to ourselves:
activityChecker = getContext()
.system()
.scheduler()
.scheduleOnce(Duration.apply(intervalInSeconds, TimeUnit.SECONDS), getSelf(),
new CheckForActivity(getRevisionNumber(), accessCounter), getContext().dispatcher(), null);
}
<<<<<<<
private Consumer<Object> getPeekConsumer() {
return new PeekConsumer(logIncomingMessages);
=======
@Nullable
private Consumer<Object> getIncomingMessagesLoggerOrNull() {
if (isLogIncomingMessages()) {
return new LogIncomingMessagesConsumer();
} else {
return null;
}
>>>>>>>
@Nullable
private Consumer<Object> getIncomingMessagesLoggerOrNull() {
if (isLogIncomingMessages()) {
return new LogIncomingMessagesConsumer();
}
return null; |
<<<<<<<
super(connectionId, inboundMessageProcessor, source, dryRun, reconnectForRedelivery);
=======
super(connectionId, messageMappingProcessor, source, dryRun, reconnectForRedelivery, ConnectionType.MQTT_5);
>>>>>>>
super(connectionId, inboundMessageProcessor, source, dryRun, reconnectForRedelivery, ConnectionType.MQTT_5); |
<<<<<<<
import java.util.Optional;
=======
>>>>>>>
import java.util.Optional;
<<<<<<<
return extractAttributes(thing)
=======
return nonNullThing.getAttributes()
>>>>>>>
return nonNullThing.getAttributes() |
<<<<<<<
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
=======
>>>>>>>
import java.nio.charset.StandardCharsets; |
<<<<<<<
=======
import org.eclipse.ditto.model.connectivity.FilteredTopic;
import org.eclipse.ditto.model.connectivity.Target;
import org.eclipse.ditto.model.connectivity.Topic;
import org.eclipse.ditto.model.things.ThingId;
import org.eclipse.ditto.model.things.WithThingId;
import org.eclipse.ditto.services.connectivity.config.ConnectionConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProvider;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProviderFactory;
import org.eclipse.ditto.services.connectivity.config.MonitoringConfig;
>>>>>>>
import org.eclipse.ditto.services.connectivity.config.ConnectionConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfig;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProvider;
import org.eclipse.ditto.services.connectivity.config.ConnectivityConfigProviderFactory;
import org.eclipse.ditto.services.connectivity.config.MonitoringConfig; |
<<<<<<<
disableLogging(actorSystem);
final ThingIdEnforcement thingIdEnforcement = ThingIdEnforcement
.of("some/invalid/target", Collections.singleton("mqtt/topic/{{ thing:namespace }}/{{ thing:name }}"));
testExternalMessageInDittoProtocolIsProcessed(thingIdEnforcement, false);
=======
final Enforcement mqttEnforcement =
ConnectivityModelFactory.newEnforcement("{{ test:placeholder }}",
"mqtt/topic/{{ thing:namespace }}/{{ thing:name }}");
final EnforcementFilterFactory<String, String> factory =
EnforcementFactoryFactory.newEnforcementFilterFactory(mqttEnforcement, new TestPlaceholder());
final EnforcementFilter<String> enforcementFilter = factory.getFilter("some/invalid/target");
testExternalMessageInDittoProtocolIsProcessed(enforcementFilter, false);
>>>>>>>
disableLogging(actorSystem);
final Enforcement mqttEnforcement =
ConnectivityModelFactory.newEnforcement("{{ test:placeholder }}",
"mqtt/topic/{{ thing:namespace }}/{{ thing:name }}");
final EnforcementFilterFactory<String, String> factory =
EnforcementFactoryFactory.newEnforcementFilterFactory(mqttEnforcement, new TestPlaceholder());
final EnforcementFilter<String> enforcementFilter = factory.getFilter("some/invalid/target");
testExternalMessageInDittoProtocolIsProcessed(enforcementFilter, false);
<<<<<<<
=======
private static class TestPlaceholder implements Placeholder<String> {
@Override
public String getPrefix() {
return "test";
}
@Override
public List<String> getSupportedNames() {
return Collections.emptyList();
}
@Override
public boolean supports(final String name) {
return true;
}
@Override
public Optional<String> apply(final String source, final String name) {
return Optional.of(source);
}
}
>>>>>>>
private static class TestPlaceholder implements Placeholder<String> {
@Override
public String getPrefix() {
return "test";
}
@Override
public List<String> getSupportedNames() {
return Collections.emptyList();
}
@Override
public boolean supports(final String name) {
return true;
}
@Override
public Optional<String> apply(final String source, final String name) {
return Optional.of(source);
}
} |
<<<<<<<
import org.eclipse.ditto.services.policies.persistence.actors.PersistenceActorTestBase;
import org.eclipse.ditto.services.policies.persistence.serializer.DefaultPolicyMongoEventAdapter;
=======
import org.eclipse.ditto.services.policies.persistence.serializer.PolicyMongoEventAdapter;
>>>>>>>
import org.eclipse.ditto.services.policies.persistence.serializer.DefaultPolicyMongoEventAdapter;
<<<<<<<
private DefaultPolicyMongoEventAdapter eventAdapter;
=======
private static final String POLICY_SNAPSHOT_PREFIX = "ditto.policies.policy.snapshot.";
private static final String SNAPSHOT_INTERVAL = POLICY_SNAPSHOT_PREFIX + "interval";
private static final String SNAPSHOT_THRESHOLD = POLICY_SNAPSHOT_PREFIX + "threshold";
private static final Duration VERY_LONG_DURATION = Duration.ofDays(100);
private PolicyMongoEventAdapter eventAdapter;
>>>>>>>
private static final String POLICY_SNAPSHOT_PREFIX = "ditto.policies.policy.snapshot.";
private static final String SNAPSHOT_INTERVAL = POLICY_SNAPSHOT_PREFIX + "interval";
private static final String SNAPSHOT_THRESHOLD = POLICY_SNAPSHOT_PREFIX + "threshold";
private static final Duration VERY_LONG_DURATION = Duration.ofDays(100);
private DefaultPolicyMongoEventAdapter eventAdapter; |
<<<<<<<
private static JwtSubjectIssuersConfig buildJwtSubjectIssuersConfig(final OAuthConfig config) {
final Set<JwtSubjectIssuerConfig> configItems =
Stream.concat(config.getOpenIdConnectIssuers().entrySet().stream(),
config.getOpenIdConnectIssuersExtension().entrySet().stream())
.map(entry -> new JwtSubjectIssuerConfig(entry.getValue(), entry.getKey()))
.collect(Collectors.toSet());
return new JwtSubjectIssuersConfig(configItems);
}
public JwtAuthenticationResultProvider newJwtAuthorizationContextProvider() {
=======
public JwtAuthorizationContextProvider newJwtAuthorizationContextProvider() {
>>>>>>>
public JwtAuthenticationResultProvider newJwtAuthorizationContextProvider() { |
<<<<<<<
final ActorRef conciergeForwarder,
final ActorRef connectionActor,
final HiveMqtt5ClientFactory clientFactory) {
super(connection, conciergeForwarder, connectionActor, clientFactory);
=======
final ActorRef proxyActor,
final HiveMqtt5ClientFactory clientFactory,
final ActorRef connectionActor) {
super(connection, proxyActor, connectionActor);
this.connection = connection;
this.clientFactory = clientFactory;
>>>>>>>
final ActorRef proxyActor,
final ActorRef connectionActor,
final HiveMqtt5ClientFactory clientFactory) {
super(connection, proxyActor, connectionActor, clientFactory);
<<<<<<<
this(connection, conciergeForwarder, connectionActor, DefaultHiveMqtt5ClientFactory.getInstance());
=======
this(connection, proxyActor, DefaultHiveMqtt5ClientFactory.getInstance(), connectionActor);
>>>>>>>
this(connection, proxyActor, connectionActor, DefaultHiveMqtt5ClientFactory.getInstance());
<<<<<<<
return Props.create(HiveMqtt5ClientActor.class, connection, conciergeForwarder, connectionActor, clientFactory);
=======
return Props.create(HiveMqtt5ClientActor.class, validateConnection(connection),
proxyActor, clientFactory, connectionActor);
>>>>>>>
return Props.create(HiveMqtt5ClientActor.class, connection, proxyActor, connectionActor, clientFactory);
<<<<<<<
return Props.create(HiveMqtt5ClientActor.class, connection, conciergeForwarder, connectionActor);
=======
return Props.create(HiveMqtt5ClientActor.class, validateConnection(connection),
proxyActor, connectionActor);
}
private Mqtt5Client getClient() {
if (null == client) {
throw new IllegalStateException("Mqtt5Client not initialized!");
}
return client;
}
private HiveMqtt5SubscriptionHandler getSubscriptionHandler() {
if (null == subscriptionHandler) {
throw new IllegalStateException("HiveMqtt5SubscriptionHandler not initialized!");
}
return subscriptionHandler;
>>>>>>>
return Props.create(HiveMqtt5ClientActor.class, connection, proxyActor, connectionActor); |
<<<<<<<
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/org.eclipse.ditto%3Adummy/policyId")
.withEntity(ContentTypes.APPLICATION_JSON, "hello:world:123")).entityString();
=======
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/policyId")
.withEntity("hello:world:123")).entityString();
>>>>>>>
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/policyId")
.withEntity(ContentTypes.APPLICATION_JSON, "hello:world:123")).entityString();
<<<<<<<
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/org.eclipse.ditto%3At1/definition")
.withEntity(ContentTypes.APPLICATION_JSON, "hello:world:123")).entityString();
=======
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/definition")
.withEntity("hello:world:123")).entityString();
>>>>>>>
final String nonJsonStringResponse = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/definition")
.withEntity(ContentTypes.APPLICATION_JSON, "hello:world:123")).entityString();
<<<<<<<
final String putResult = underTest.run(HttpRequest.PUT("/things/org.eclipse.ditto%3At1/definition")
.withEntity(ContentTypes.APPLICATION_JSON, "null")).entityString();
=======
final String putResult = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/definition")
.withEntity("null")).entityString();
>>>>>>>
final String putResult = underTest.run(HttpRequest.PUT("/things/" + EndpointTestConstants.KNOWN_THING_ID + "/definition")
.withEntity(ContentTypes.APPLICATION_JSON, "null")).entityString(); |
<<<<<<<
private final ActorRef connectionActor;
private final LimitsConfig limitsConfig;
=======
>>>>>>>
private final ActorRef connectionActor;
private final LimitsConfig limitsConfig; |
<<<<<<<
final String thingId = signal().getThingId();
final String policyId = enforcerKeyEntry.getValue().getId();
final DittoRuntimeException error = errorForExistingThingWithDeletedPolicy(signal(), thingId, policyId);
log().info("Enforcer was not existing for Thing <{}>, responding with: {}", thingId, error);
replyToSender(error);
=======
final String thingId = thingCommand.getThingId();
final String policyId = enforcerKeyEntry.getValueOrThrow().getId();
final DittoRuntimeException error = errorForExistingThingWithDeletedPolicy(thingCommand, thingId, policyId);
log(thingCommand).info("Enforcer was not existing for Thing <{}>, responding with: {}", thingId, error);
replyToSender(error, sender);
>>>>>>>
final String thingId = thingCommand.getThingId();
final String policyId = enforcerKeyEntry.getValueOrThrow().getId();
final DittoRuntimeException error = errorForExistingThingWithDeletedPolicy(signal(), thingId, policyId);
log().info("Enforcer was not existing for Thing <{}>, responding with: {}", thingId, error);
replyToSender(error);
<<<<<<<
enforceThingCommandByPolicyEnforcer(command, policyId, policyEnforcerEntry.getValue());
=======
enforceThingCommandByPolicyEnforcer(createThing, policyId, policyEnforcerEntry.getValueOrThrow(), sender);
>>>>>>>
enforceThingCommandByPolicyEnforcer(command, policyId, policyEnforcerEntry.getValueOrThrow());
<<<<<<<
=======
* Check if an enforcer key points to an access-control-list enforcer.
*
* @param enforcerKeyEntry cache key entry of an enforcer.
* @return whether it is based on an access control list and requires special handling.
*/
private static boolean isAclEnforcer(final Entry<EntityId> enforcerKeyEntry) {
return enforcerKeyEntry.exists() &&
Objects.equals(ThingCommand.RESOURCE_TYPE, enforcerKeyEntry.getValueOrThrow().getResourceType());
}
/**
>>>>>>> |
<<<<<<<
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
=======
import java.util.HashMap;
>>>>>>>
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
<<<<<<<
protected Adaptable doForward(final InternalMessage message) {
requireMatchingContentType(message);
final Optional<String> payload = message.isTextMessage() ? message.getTextPayload()
: message.getBytePayload().isPresent() ? message.getBytePayload()
.map(ByteBuffer::array)
.map(ba -> new String(ba, StandardCharsets.UTF_8))
: Optional.empty();
=======
protected Adaptable doForwardMap(@Nonnull final InternalMessage message) {
if (!message.isTextMessage()) {
throw new IllegalArgumentException("Message is not a text message");
}
>>>>>>>
protected Adaptable doForwardMap(@Nonnull final InternalMessage message) {
final Optional<String> payload = message.isTextMessage() ? message.getTextPayload()
: message.getBytePayload().isPresent() ? message.getBytePayload()
.map(ByteBuffer::array)
.map(ba -> new String(ba, StandardCharsets.UTF_8))
: Optional.empty(); |
<<<<<<<
import org.eclipse.ditto.services.concierge.cache.AclEnforcerCacheLoader;
import org.eclipse.ditto.services.concierge.cache.CacheFactory;
import org.eclipse.ditto.services.concierge.cache.PolicyEnforcerCacheLoader;
import org.eclipse.ditto.services.concierge.cache.ThingEnforcementIdCacheLoader;
import org.eclipse.ditto.services.concierge.cache.config.CachesConfig;
=======
>>>>>>>
import org.eclipse.ditto.services.concierge.cache.config.CachesConfig;
<<<<<<<
import org.eclipse.ditto.services.concierge.starter.actors.DispatcherActorCreator;
import org.eclipse.ditto.services.concierge.starter.config.ConciergeConfig;
=======
import org.eclipse.ditto.services.concierge.starter.actors.DispatcherActor;
import org.eclipse.ditto.services.concierge.util.config.ConciergeConfigReader;
import org.eclipse.ditto.services.concierge.util.config.EnforcementConfigReader;
>>>>>>>
import org.eclipse.ditto.services.concierge.starter.actors.DispatcherActor;
import org.eclipse.ditto.services.concierge.starter.config.ConciergeConfig;
<<<<<<<
import org.eclipse.ditto.services.utils.cluster.ShardRegionExtractor;
import org.eclipse.ditto.services.utils.cluster.config.ClusterConfig;
import org.eclipse.ditto.services.utils.config.InstanceIdentifierSupplier;
=======
import org.eclipse.ditto.services.utils.config.ConfigUtil;
>>>>>>>
import org.eclipse.ditto.services.utils.cluster.config.ClusterConfig;
import org.eclipse.ditto.services.utils.config.InstanceIdentifierSupplier;
<<<<<<<
final EnforcementConfig enforcementConfig = conciergeConfig.getEnforcementConfig();
final Duration enforcementAskTimeout = enforcementConfig.getAskTimeout();
// set activity check interval identical to cache retention
final Duration activityCheckInterval = cachesConfig.getIdCacheConfig().getExpireAfterWrite();
final ActorRef conciergeForwarder = getInternalConciergeForwarder(context, clusterConfig, pubSubMediator);
final Executor enforcerExecutor = actorSystem.dispatchers().lookup(ENFORCER_DISPATCHER);
final Props enforcerProps =
EnforcerActorCreator.props(pubSubMediator, enforcementProviders, enforcementAskTimeout,
conciergeForwarder, enforcerExecutor, preEnforcer, activityCheckInterval);
final ActorRef enforcerShardRegion = startShardRegion(context.system(), clusterConfig, enforcerProps);
=======
final ActorRef conciergeEnforcerRouter =
ConciergeEnforcerClusterRouterFactory.createConciergeEnforcerClusterRouter(context,
configReader.cluster().numberOfShards());
final EnforcementConfigReader enforcement = configReader.enforcement();
context.actorOf(DispatcherActor.props(configReader, pubSubMediator, conciergeEnforcerRouter,
enforcement.bufferSize(), enforcement.parallelism()), DispatcherActor.ACTOR_NAME);
final ActorRef conciergeForwarder =
context.actorOf(ConciergeForwarderActor.props(pubSubMediator, conciergeEnforcerRouter),
ConciergeForwarderActor.ACTOR_NAME);
pubSubMediator.tell(new DistributedPubSubMediator.Put(conciergeForwarder), ActorRef.noSender());
>>>>>>>
final ActorRef conciergeEnforcerRouter =
ConciergeEnforcerClusterRouterFactory.createConciergeEnforcerClusterRouter(context, numberOfShards);
final EnforcementConfig enforcementConfig = conciergeConfig.getEnforcementConfig();
context.actorOf(DispatcherActor.props(conciergeConfig, pubSubMediator, conciergeEnforcerRouter,
enforcementConfig.getBufferSize(), enforcementConfig.getParallelism()), DispatcherActor.ACTOR_NAME);
final ActorRef conciergeForwarder =
context.actorOf(ConciergeForwarderActor.props(pubSubMediator, conciergeEnforcerRouter),
ConciergeForwarderActor.ACTOR_NAME);
pubSubMediator.tell(new DistributedPubSubMediator.Put(conciergeForwarder), ActorRef.noSender());
<<<<<<<
context.actorOf(DispatcherActorCreator.props(conciergeConfig, pubSubMediator, enforcerShardRegion),
DispatcherActorCreator.ACTOR_NAME);
=======
final Duration enforcementAskTimeout = enforcement.askTimeout();
final Executor enforcerExecutor = actorSystem.dispatchers().lookup(ENFORCER_DISPATCHER);
final Props enforcerProps =
EnforcerActor.props(pubSubMediator, enforcementProviders, enforcementAskTimeout,
conciergeForwarder, enforcerExecutor, enforcement.bufferSize(), enforcement.parallelism(),
preEnforcer, thingIdCache, aclEnforcerCache, policyEnforcerCache) // passes in the caches to be able to invalidate cache entries
.withDispatcher(ENFORCER_DISPATCHER);
>>>>>>>
final Duration enforcementAskTimeout = enforcementConfig.askTimeout();
final Executor enforcerExecutor = actorSystem.dispatchers().lookup(ENFORCER_DISPATCHER);
final Props enforcerProps =
EnforcerActor.props(pubSubMediator, enforcementProviders, enforcementAskTimeout,
conciergeForwarder, enforcerExecutor, enforcement.bufferSize(), enforcement.parallelism(),
preEnforcer, thingIdCache, aclEnforcerCache, policyEnforcerCache) // passes in the caches to be able to invalidate cache entries
.withDispatcher(ENFORCER_DISPATCHER);
<<<<<<<
private static ActorRef getInternalConciergeForwarder(final ActorContext actorContext,
final ClusterConfig clusterConfig, final ActorRef pubSubMediator) {
final ActorRef conciergeShardRegionProxy = ClusterSharding.get(actorContext.system())
.startProxy(ConciergeMessagingConstants.SHARD_REGION,
Optional.of(ConciergeMessagingConstants.CLUSTER_ROLE),
ShardRegionExtractor.of(clusterConfig.getNumberOfShards(), actorContext.system()));
return actorContext.actorOf(ConciergeForwarderActor.props(pubSubMediator, conciergeShardRegionProxy),
"internal" + ConciergeForwarderActor.ACTOR_NAME);
}
=======
>>>>>>> |
<<<<<<<
private static final Duration DELETED_ACTOR_LIFETIME = Duration.ofSeconds(10);
=======
/**
* The prefix of the persistenceId.
*/
public static final String PERSISTENCE_ID_PREFIX = "connection:";
/**
* The ID of the journal plugin this persistence actor uses.
*/
public static final String JOURNAL_PLUGIN_ID = "akka-contrib-mongodb-persistence-connection-journal";
/**
* The ID of the snapshot plugin this persistence actor uses.
*/
public static final String SNAPSHOT_PLUGIN_ID = "akka-contrib-mongodb-persistence-connection-snapshots";
private static final FiniteDuration DELETED_ACTOR_LIFETIME = Duration.create(10L, TimeUnit.SECONDS);
>>>>>>>
/**
* The prefix of the persistenceId.
*/
public static final String PERSISTENCE_ID_PREFIX = "connection:";
/**
* The ID of the journal plugin this persistence actor uses.
*/
public static final String JOURNAL_PLUGIN_ID = "akka-contrib-mongodb-persistence-connection-journal";
/**
* The ID of the snapshot plugin this persistence actor uses.
*/
public static final String SNAPSHOT_PLUGIN_ID = "akka-contrib-mongodb-persistence-connection-snapshots";
private static final FiniteDuration DELETED_ACTOR_LIFETIME = Duration.create(10L, TimeUnit.SECONDS);
private static final Duration DELETED_ACTOR_LIFETIME = Duration.ofSeconds(10); |
<<<<<<<
// yes, this is intentionally a RetrieveConnectionStatus instead of OpenConnection
// the response is expected in this actor
log.debug("Sending a reconnect for Connection {}", connectionId);
connectionShardRegion.tell(RetrieveConnectionStatus.of(connectionId, DittoHeaders.newBuilder()
.correlationId("reconnect-actor-triggered").build()), getSelf());
=======
// yes, this is intentionally a RetrieveConnectionStatus instead of OpenConnection.
// ConnectionActor manages its own reconnection on recovery.
// OpenConnection would set desired state to OPEN even for deleted connections.
//
// Save connection ID as correlation ID so that nonexistent connections are removed from the store.
final DittoHeaders dittoHeaders = DittoHeaders.newBuilder()
.correlationId(toCorrelationId(connectionId))
.build();
connectionShardRegion.tell(RetrieveConnectionStatus.of(connectionId, dittoHeaders), getSelf());
>>>>>>>
// yes, this is intentionally a RetrieveConnectionStatus instead of OpenConnection.
// ConnectionActor manages its own reconnection on recovery.
// OpenConnection would set desired state to OPEN even for deleted connections.
//
// Save connection ID as correlation ID so that nonexistent connections are removed from the store.
final DittoHeaders dittoHeaders = DittoHeaders.newBuilder()
.correlationId(toCorrelationId(connectionId))
.build();
log.debug("Sending a reconnect for Connection {}", connectionId);
connectionShardRegion.tell(RetrieveConnectionStatus.of(connectionId, dittoHeaders), getSelf());
<<<<<<<
private enum ReconnectConnections {
INSTANCE
}
=======
static String toCorrelationId(final String connectionId) {
return CORRELATION_ID_PREFIX + connectionId;
}
static Optional<String> toConnectionId(final String correlationId) {
return correlationId.startsWith(CORRELATION_ID_PREFIX)
? Optional.of(correlationId.replace(CORRELATION_ID_PREFIX, ""))
: Optional.empty();
}
>>>>>>>
static String toCorrelationId(final String connectionId) {
return CORRELATION_ID_PREFIX + connectionId;
}
static Optional<String> toConnectionId(final String correlationId) {
return correlationId.startsWith(CORRELATION_ID_PREFIX)
? Optional.of(correlationId.replace(CORRELATION_ID_PREFIX, ""))
: Optional.empty();
}
private enum ReconnectConnections {
INSTANCE
} |
<<<<<<<
final String childName = child.path().name();
if (!(InboundMappingProcessorActor.ACTOR_NAME.equals(childName) ||
OutboundMappingProcessorActor.ACTOR_NAME.equals(childName))) {
log.debug("Forwarding RetrieveAddressStatus to child: {}", child.path());
=======
if (!messageMappingProcessorActor.equals(child)) {
logger.withCorrelationId(command)
.debug("Forwarding RetrieveAddressStatus to child <{}>.", child.path());
>>>>>>>
final String childName = child.path().name();
if (!(InboundMappingProcessorActor.ACTOR_NAME.equals(childName) ||
OutboundMappingProcessorActor.ACTOR_NAME.equals(childName))) {
logger.withCorrelationId(command)
.debug("Forwarding RetrieveAddressStatus to child <{}>.", child.path());
<<<<<<<
enhanceLogUtil(signal.getSource());
outboundMappingProcessorActor.tell(signal, getSender());
=======
messageMappingProcessorActor.tell(signal, getSender());
>>>>>>>
outboundMappingProcessorActor.tell(signal, getSender()); |
<<<<<<<
private Map<TableId,String> tableIdToTableName = null;
private Map<String,Pattern> poolNameToRegexPattern = null;
=======
private volatile Map<String,String> tableIdToTableName = null;
private volatile Map<String,Pattern> poolNameToRegexPattern = null;
>>>>>>>
private volatile Map<TableId,String> tableIdToTableName = null;
private volatile Map<String,Pattern> poolNameToRegexPattern = null;
<<<<<<<
TableId tableId = TableId.of(table.getValue());
tableIdToTableName.put(tableId, table.getKey());
conf.getTableConfiguration(tableId).addObserver(this);
Map<String,String> customProps = conf.getTableConfiguration(tableId)
=======
tableIdToTableNameBuilder.put(table.getValue(), table.getKey());
conf.getTableConfiguration(table.getValue()).addObserver(this);
Map<String,String> customProps = conf.getTableConfiguration(table.getValue())
>>>>>>>
TableId tableId = TableId.of(table.getValue());
tableIdToTableNameBuilder.put(tableId, table.getKey());
conf.getTableConfiguration(tableId).addObserver(this);
Map<String,String> customProps = conf.getTableConfiguration(tableId)
<<<<<<<
String oobProperty = conf.getSystemConfiguration().get(HOST_BALANCER_OOB_CHECK_KEY);
if (oobProperty != null) {
oobCheckMillis = ConfigurationTypeHelper.getTimeInMillis(oobProperty);
=======
tableIdToTableName = ImmutableMap.copyOf(tableIdToTableNameBuilder);
poolNameToRegexPattern = ImmutableMap.copyOf(poolNameToRegexPatternBuilder);
String oobProperty = conf.getConfiguration().get(HOST_BALANCER_OOB_CHECK_KEY);
if (null != oobProperty) {
oobCheckMillis = AccumuloConfiguration.getTimeInMillis(oobProperty);
>>>>>>>
tableIdToTableName = ImmutableMap.copyOf(tableIdToTableNameBuilder);
poolNameToRegexPattern = ImmutableMap.copyOf(poolNameToRegexPatternBuilder);
String oobProperty = conf.getSystemConfiguration().get(HOST_BALANCER_OOB_CHECK_KEY);
if (oobProperty != null) {
oobCheckMillis = ConfigurationTypeHelper.getTimeInMillis(oobProperty); |
<<<<<<<
logger.setCorrelationId(allDittoHeaders);
final Map<String, String> externalHeaders = getExternalHeaders(allDittoHeaders);
=======
LogUtil.enhanceLogWithCorrelationId(logger, allDittoHeaders);
final Map<String, String> externalHeaders = headerTranslator.toFilteredExternalHeaders(allDittoHeaders);
>>>>>>>
logger.setCorrelationId(allDittoHeaders);
final Map<String, String> externalHeaders = headerTranslator.toExternalHeaders(allDittoHeaders); |
<<<<<<<
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
=======
import org.eclipse.ditto.services.utils.cluster.RetrieveStatisticsDetailsResponseSupplier;
>>>>>>>
import org.eclipse.ditto.services.utils.cluster.ClusterUtil;
import org.eclipse.ditto.services.utils.cluster.RetrieveStatisticsDetailsResponseSupplier;
<<<<<<<
// start cluster singleton for namespace ops
ClusterUtil.startSingleton(getContext(), CLUSTER_ROLE, PolicyNamespaceOpsActor.ACTOR_NAME,
PolicyNamespaceOpsActor.props(pubSubMediator, config));
=======
retrieveStatisticsDetailsResponseSupplier = RetrieveStatisticsDetailsResponseSupplier.of(policiesShardRegion,
PoliciesMessagingConstants.SHARD_REGION, log);
>>>>>>>
// start cluster singleton for namespace ops
ClusterUtil.startSingleton(getContext(), CLUSTER_ROLE, PolicyNamespaceOpsActor.ACTOR_NAME,
PolicyNamespaceOpsActor.props(pubSubMediator, config));
retrieveStatisticsDetailsResponseSupplier = RetrieveStatisticsDetailsResponseSupplier.of(policiesShardRegion,
PoliciesMessagingConstants.SHARD_REGION, log); |
<<<<<<<
import org.junit.Test;
import org.eclipse.ditto.model.query.model.criteria.Criteria;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactoryImpl;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactoryImpl;
=======
import org.eclipse.ditto.services.thingsearch.querymodel.criteria.Criteria;
import org.eclipse.ditto.services.thingsearch.querymodel.criteria.CriteriaFactory;
import org.eclipse.ditto.services.thingsearch.querymodel.criteria.CriteriaFactoryImpl;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.ThingsFieldExpressionFactory;
import org.eclipse.ditto.services.thingsearch.querymodel.expression.ThingsFieldExpressionFactoryImpl;
import org.junit.Test;
>>>>>>>
import org.eclipse.ditto.model.query.model.criteria.Criteria;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactory;
import org.eclipse.ditto.model.query.model.criteria.CriteriaFactoryImpl;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactory;
import org.eclipse.ditto.model.query.model.expression.ThingsFieldExpressionFactoryImpl;
import org.junit.Test; |
<<<<<<<
import org.eclipse.ditto.services.gateway.security.config.AuthenticationConfig;
import org.eclipse.ditto.services.gateway.security.config.CachesConfig;
import org.eclipse.ditto.services.gateway.security.config.DefaultAuthenticationConfig;
import org.eclipse.ditto.services.gateway.security.config.DefaultCachesConfig;
=======
import org.eclipse.ditto.services.gateway.streaming.DefaultStreamingConfig;
import org.eclipse.ditto.services.gateway.streaming.StreamingConfig;
>>>>>>>
import org.eclipse.ditto.services.gateway.security.config.AuthenticationConfig;
import org.eclipse.ditto.services.gateway.security.config.CachesConfig;
import org.eclipse.ditto.services.gateway.security.config.DefaultAuthenticationConfig;
import org.eclipse.ditto.services.gateway.security.config.DefaultCachesConfig;
import org.eclipse.ditto.services.gateway.streaming.DefaultStreamingConfig;
import org.eclipse.ditto.services.gateway.streaming.StreamingConfig; |
<<<<<<<
final Config config = configReader.getRawConfig();
=======
final Config config = determineConfig();
final double parallelismMax =
config.getDouble("akka.actor.default-dispatcher.fork-join-executor.parallelism-max");
logger.info("Running 'default-dispatcher' with 'parallelism-max': <{}>", parallelismMax);
>>>>>>>
final Config config = configReader.getRawConfig();
final double parallelismMax =
config.getDouble("akka.actor.default-dispatcher.fork-join-executor.parallelism-max");
logger.info("Running 'default-dispatcher' with 'parallelism-max': <{}>", parallelismMax); |
<<<<<<<
=======
import java.util.Set;
>>>>>>>
import java.util.Set;
<<<<<<<
import org.eclipse.ditto.model.base.common.CharsetDeterminer;
=======
>>>>>>>
import org.eclipse.ditto.model.base.common.CharsetDeterminer;
<<<<<<<
private MqttPublisherActor(final ActorRef mqttClientActor, final boolean dryRun,
final MqttConnectionFactory factory) {
=======
private MqttPublisherActor(final String connectionId, final Set<Target> targets,
final MqttConnectionFactory factory,
final ActorRef mqttClientActor,
final boolean dryRun) {
super(connectionId, targets);
>>>>>>>
private MqttPublisherActor(final String connectionId, final Set<Target> targets,
final MqttConnectionFactory factory,
final ActorRef mqttClientActor,
final boolean dryRun) {
super(connectionId, targets);
<<<<<<<
.map(this::countPublishedMqttMessage)
.toMat(factory.newSink(), Keep.both())
=======
.toMat(mqttSink, Keep.both())
>>>>>>>
.toMat(factory.newSink(), Keep.both())
<<<<<<<
return new MqttPublisherActor(mqttClientActor, dryRun, factory);
=======
return new MqttPublisherActor(connectionId, targets, factory, mqttClientActor, dryRun);
>>>>>>>
return new MqttPublisherActor(connectionId, targets, factory, mqttClientActor, dryRun);
<<<<<<<
final MqttQoS targetQoS = null == target
? MqttQoS.atMostOnce()
: MqttValidator.getQoS(((org.eclipse.ditto.model.connectivity.MqttTarget) target).getQos());
publishMessage(publishTarget, targetQoS, message);
=======
final MqttQoS targetQoS;
if (target == null) {
targetQoS = MqttQoS.atMostOnce();
} else {
final int qos = target.getQos().orElse(DEFAULT_TARGET_QOS);
targetQoS = MqttValidator.getQoS(qos);
}
publishMessage(publishTarget, targetQoS, message, publishedCounter);
>>>>>>>
final MqttQoS targetQoS;
if (target == null) {
targetQoS = MqttQoS.atMostOnce();
} else {
final int qos = target.getQos().orElse(DEFAULT_TARGET_QOS);
targetQoS = MqttValidator.getQoS(qos);
}
publishMessage(publishTarget, targetQoS, message, publishedCounter);
<<<<<<<
=======
publishedCounter.recordSuccess();
>>>>>>>
publishedCounter.recordSuccess(); |
<<<<<<<
private final ProtocolAdapterProvider protocolAdapterProvider;
private final ActorSelection proxyActorSelection;
=======
private final ActorRef proxyActor;
>>>>>>>
private final ActorSelection proxyActorSelection;
<<<<<<<
private final ClientActorRefs clientActorRefs;
private final Duration clientActorRefsNotificationDelay;
private final DittoProtocolSub dittoProtocolSub;
private final int subscriptioniIdPrefixLength;
=======
private final ProtocolAdapter protocolAdapter;
private final ConnectivityConfigProvider connectivityConfigProvider;
>>>>>>>
private final ClientActorRefs clientActorRefs;
private final Duration clientActorRefsNotificationDelay;
private final DittoProtocolSub dittoProtocolSub;
private final int subscriptioniIdPrefixLength;
private final ProtocolAdapter protocolAdapter;
private final ConnectivityConfigProvider connectivityConfigProvider;
<<<<<<<
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config()));
clientConfig = connectivityConfig.getClientConfig();
proxyActorSelection = getLocalActorOfSamePath(proxyActor);
protocolAdapterProvider =
=======
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config())
);
connectivityConfigProvider = ConnectivityConfigProviderFactory.getInstance(getContext().getSystem());
final ProtocolAdapterProvider protocolAdapterProvider =
>>>>>>>
DefaultScopedConfig.dittoScoped(getContext().getSystem().settings().config()));
clientConfig = connectivityConfig.getClientConfig();
proxyActorSelection = getLocalActorOfSamePath(proxyActor);
connectivityConfigProvider = ConnectivityConfigProviderFactory.getInstance(getContext().getSystem());
final ProtocolAdapterProvider protocolAdapterProvider =
<<<<<<<
final Pair<ActorRef, ActorRef> actorPair = startOutboundActors(connection);
outboundDispatchingActor = actorPair.first();
=======
outboundMappingProcessorActor = startOutboundMappingProcessorActor(connection, protocolAdapter);
>>>>>>>
final Pair<ActorRef, ActorRef> actorPair = startOutboundActors(connection, protocolAdapter);
outboundDispatchingActor = actorPair.first();
outboundMappingProcessorActor = actorPair.second();
<<<<<<<
return matchEvent(RetrieveConnectionMetrics.class, (command, data) -> retrieveConnectionMetrics(command))
.event(ThingSearchCommand.class, this::forwardThingSearchCommand)
.event(RetrieveConnectionStatus.class, this::retrieveConnectionStatus)
.event(ResetConnectionMetrics.class, this::resetConnectionMetrics)
.event(EnableConnectionLogs.class, (command, data) -> enableConnectionLogs(command))
.event(RetrieveConnectionLogs.class, (command, data) -> retrieveConnectionLogs(command))
.event(ResetConnectionLogs.class, this::resetConnectionLogs)
.event(CheckConnectionLogsActive.class, (command, data) -> checkLoggingActive(command))
.event(InboundSignal.class, this::handleInboundSignal)
.event(PublishMappedMessage.class, this::publishMappedMessage)
.event(ConnectivityCommand.class, this::onUnknownEvent) // relevant connectivity commands were handled
.event(Signal.class, this::handleSignal)
.event(ActorRef.class, this::onOtherClientActorStartup)
.event(Terminated.class, this::otherClientActorTerminated)
.eventEquals(Control.REFRESH_CLIENT_ACTOR_REFS, this::refreshClientActorRefs)
.event(FatalPubSubException.class, this::failConnectionDueToPubSubException);
=======
return matchEvent(RetrieveConnectionMetrics.class, BaseClientData.class,
(command, data) -> retrieveConnectionMetrics(command))
.event(ThingSearchCommand.class, BaseClientData.class, this::forwardThingSearchCommand)
.event(RetrieveConnectionStatus.class, BaseClientData.class, this::retrieveConnectionStatus)
.event(ResetConnectionMetrics.class, BaseClientData.class, this::resetConnectionMetrics)
.event(EnableConnectionLogs.class, BaseClientData.class,
(command, data) -> enableConnectionLogs(command))
.event(RetrieveConnectionLogs.class, BaseClientData.class,
(command, data) -> retrieveConnectionLogs(command))
.event(ResetConnectionLogs.class, BaseClientData.class, this::resetConnectionLogs)
.event(CheckConnectionLogsActive.class, BaseClientData.class,
(command, data) -> checkLoggingActive(command))
.event(OutboundSignal.class, BaseClientData.class, this::handleOutboundSignal)
.event(PublishMappedMessage.class, BaseClientData.class, this::publishMappedMessage)
.event(org.eclipse.ditto.signals.events.base.Event.class,
(event, data) -> connectivityConfigProvider.canHandle(event),
(ccb, data) -> {
handleEvent(ccb);
return stay();
});
>>>>>>>
return matchEvent(RetrieveConnectionMetrics.class, (command, data) -> retrieveConnectionMetrics(command))
.event(ThingSearchCommand.class, this::forwardThingSearchCommand)
.event(RetrieveConnectionStatus.class, this::retrieveConnectionStatus)
.event(ResetConnectionMetrics.class, this::resetConnectionMetrics)
.event(EnableConnectionLogs.class, (command, data) -> enableConnectionLogs(command))
.event(RetrieveConnectionLogs.class, (command, data) -> retrieveConnectionLogs(command))
.event(ResetConnectionLogs.class, this::resetConnectionLogs)
.event(CheckConnectionLogsActive.class, (command, data) -> checkLoggingActive(command))
.event(InboundSignal.class, this::handleInboundSignal)
.event(PublishMappedMessage.class, this::publishMappedMessage)
.event(ConnectivityCommand.class, this::onUnknownEvent) // relevant connectivity commands were handled
.event(org.eclipse.ditto.signals.events.base.Event.class,
(event, data) -> connectivityConfigProvider.canHandle(event),
(ccb, data) -> {
handleEvent(ccb);
return stay();
})
.event(Signal.class, this::handleSignal)
.event(ActorRef.class, this::onOtherClientActorStartup)
.event(Terminated.class, this::otherClientActorTerminated)
.eventEquals(Control.REFRESH_CLIENT_ACTOR_REFS, this::refreshClientActorRefs)
.event(FatalPubSubException.class, this::failConnectionDueToPubSubException);
<<<<<<<
private Pair<ActorRef, ActorRef> startOutboundActors(final Connection connection) {
final ProtocolAdapter protocolAdapter = protocolAdapterProvider.getProtocolAdapter(null);
final OutboundMappingSettings settings;
final OutboundMappingProcessor outboundMappingProcessor;
=======
/**
* Starts the {@link OutboundMappingProcessorActor} responsible for payload transformation/mapping as child actor.
*
* @param connection the connection.
* @param protocolAdapter the protocol adapter.
* @return the ref to the started {@link OutboundMappingProcessorActor}
* @throws DittoRuntimeException when mapping processor could not get started.
*/
private ActorRef startOutboundMappingProcessorActor(final Connection connection,
final ProtocolAdapter protocolAdapter) {
final OutboundMappingProcessor outboundMappingProcessor;
>>>>>>>
private Pair<ActorRef, ActorRef> startOutboundActors(final Connection connection,
final ProtocolAdapter protocolAdapter) {
final OutboundMappingSettings settings;
final OutboundMappingProcessor outboundMappingProcessor;
<<<<<<<
proxyActorSelection,
connectivityConfig,
=======
retrievedConnectivityConfig,
>>>>>>>
proxyActorSelection,
retrievedConnectivityConfig, |
<<<<<<<
/**
* Maps the given {@code PolicyQueryCommand} to an {@code Adaptable}.
*
* @param policyQueryCommand the command.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommand was not supported by the ProtocolAdapter
*/
default Adaptable toAdaptable(PolicyQueryCommand<?> policyQueryCommand) {
return toAdaptable(policyQueryCommand, TopicPath.Channel.TWIN);
}
/**
* Maps the given {@code PolicyQueryCommand} to an {@code Adaptable}.
*
* @param policyQueryCommand the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommand was not supported by the ProtocolAdapter
*/
Adaptable toAdaptable(PolicyQueryCommand<?> policyQueryCommand, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyCommandResponse} to an {@code Adaptable}.
*
* @param policyCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyCommandResponse<?> policyCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyQueryCommandResponse} to an {@code Adaptable}.
*
* @param policyQueryCommandResponse the response.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommandResponse was not supported by the
* ProtocolAdapter
*/
default Adaptable toAdaptable(PolicyQueryCommandResponse<?> policyQueryCommandResponse) {
return toAdaptable(policyQueryCommandResponse, TopicPath.Channel.TWIN);
}
/**
* Maps the given {@code PolicyQueryCommandResponse} to an {@code Adaptable}.
*
* @param policyQueryCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyQueryCommandResponse<?> policyQueryCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyModifyCommand} to an {@code Adaptable}.
*
* @param policyModifyCommand the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyModifyCommand was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyModifyCommand<?> policyModifyCommand, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyModifyCommandResponse} to an {@code Adaptable}.
*
* @param policyModifyCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyModifyCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyModifyCommandResponse<?> policyModifyCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyErrorResponse} to an {@code Adaptable}.
*
* @param policyErrorResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyErrorResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyErrorResponse policyErrorResponse, TopicPath.Channel channel);
=======
/**
* Retrieve the header translator responsible for this protocol adapter.
*
* @return the header translator.
*/
HeaderTranslator headerTranslator();
>>>>>>>
/**
* Maps the given {@code PolicyQueryCommand} to an {@code Adaptable}.
*
* @param policyQueryCommand the command.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommand was not supported by the ProtocolAdapter
*/
default Adaptable toAdaptable(PolicyQueryCommand<?> policyQueryCommand) {
return toAdaptable(policyQueryCommand, TopicPath.Channel.TWIN);
}
/**
* Maps the given {@code PolicyQueryCommand} to an {@code Adaptable}.
*
* @param policyQueryCommand the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommand was not supported by the ProtocolAdapter
*/
Adaptable toAdaptable(PolicyQueryCommand<?> policyQueryCommand, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyCommandResponse} to an {@code Adaptable}.
*
* @param policyCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyCommandResponse<?> policyCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyQueryCommandResponse} to an {@code Adaptable}.
*
* @param policyQueryCommandResponse the response.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommandResponse was not supported by the
* ProtocolAdapter
*/
default Adaptable toAdaptable(PolicyQueryCommandResponse<?> policyQueryCommandResponse) {
return toAdaptable(policyQueryCommandResponse, TopicPath.Channel.TWIN);
}
/**
* Maps the given {@code PolicyQueryCommandResponse} to an {@code Adaptable}.
*
* @param policyQueryCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyQueryCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyQueryCommandResponse<?> policyQueryCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyModifyCommand} to an {@code Adaptable}.
*
* @param policyModifyCommand the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyModifyCommand was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyModifyCommand<?> policyModifyCommand, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyModifyCommandResponse} to an {@code Adaptable}.
*
* @param policyModifyCommandResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyModifyCommandResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyModifyCommandResponse<?> policyModifyCommandResponse, TopicPath.Channel channel);
/**
* Maps the given {@code PolicyErrorResponse} to an {@code Adaptable}.
*
* @param policyErrorResponse the response.
* @param channel the Channel (Twin/Live) to use.
* @return the adaptable.
* @throws UnknownCommandResponseException if the passed PolicyErrorResponse was not supported by the
* ProtocolAdapter
*/
Adaptable toAdaptable(PolicyErrorResponse policyErrorResponse, TopicPath.Channel channel);
/**
* Retrieve the header translator responsible for this protocol adapter.
*
* @return the header translator.
*/
HeaderTranslator headerTranslator(); |
<<<<<<<
import java.util.Map;
import java.util.Optional;
=======
>>>>>>>
import java.util.Optional; |
<<<<<<<
import javax.annotation.Nullable;
import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException;
import org.eclipse.ditto.model.base.headers.WithDittoHeaders;
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.services.things.persistence.actors.strategies.events.EventHandleStrategy;
import org.eclipse.ditto.services.things.persistence.actors.strategies.events.EventStrategy;
=======
>>>>>>>
import javax.annotation.Nullable;
import org.eclipse.ditto.model.base.exceptions.DittoRuntimeException;
import org.eclipse.ditto.model.base.headers.WithDittoHeaders;
import org.eclipse.ditto.model.things.Thing;
import org.eclipse.ditto.services.things.persistence.actors.strategies.events.EventHandleStrategy;
import org.eclipse.ditto.services.things.persistence.actors.strategies.events.EventStrategy;
<<<<<<<
import org.eclipse.ditto.signals.commands.base.Command;
import org.eclipse.ditto.signals.commands.base.CommandResponse;
import org.eclipse.ditto.signals.events.things.ThingEvent;
import org.eclipse.ditto.signals.events.things.ThingModifiedEvent;
=======
import org.eclipse.ditto.signals.commands.things.ThingCommandSizeValidator;
>>>>>>>
import org.eclipse.ditto.signals.commands.things.ThingCommandSizeValidator;
import org.eclipse.ditto.signals.commands.base.Command;
import org.eclipse.ditto.signals.commands.base.CommandResponse;
import org.eclipse.ditto.signals.events.things.ThingEvent;
import org.eclipse.ditto.signals.events.things.ThingModifiedEvent; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.