Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Remove unnecessary SignalTransformer extension"
This reverts commit 061fa0f. Signed-off-by: Yannic Klem <Yannic.Klem@bosch.io>
- Loading branch information
Showing
6 changed files
with
118 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...rvice/src/main/java/org/eclipse/ditto/edge/service/dispatching/NoOpSignalTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.edge.service.dispatching; | ||
|
||
import java.util.function.UnaryOperator; | ||
|
||
import org.eclipse.ditto.base.model.signals.Signal; | ||
|
||
import akka.actor.ActorSystem; | ||
|
||
public class NoOpSignalTransformer implements SignalTransformer { | ||
|
||
/** | ||
* @param actorSystem the actor system in which to load the extension. | ||
*/ | ||
protected NoOpSignalTransformer(final ActorSystem actorSystem) { | ||
} | ||
|
||
@Override | ||
public Signal<?> apply(final Signal<?> signal) { | ||
return UnaryOperator.<Signal<?>>identity().apply(signal); | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
edge/service/src/main/java/org/eclipse/ditto/edge/service/dispatching/SignalTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.ditto.edge.service.dispatching; | ||
|
||
import static org.eclipse.ditto.base.model.common.ConditionChecker.checkNotNull; | ||
|
||
import java.util.function.UnaryOperator; | ||
|
||
import org.eclipse.ditto.base.model.signals.Signal; | ||
import org.eclipse.ditto.base.service.DittoExtensionPoint; | ||
|
||
import akka.actor.ActorSystem; | ||
|
||
public interface SignalTransformer extends DittoExtensionPoint, UnaryOperator<Signal<?>> { | ||
|
||
/** | ||
* Loads the implementation of {@code SignalTransformer} which is configured for the | ||
* {@code ActorSystem}. | ||
* | ||
* @param actorSystem the actorSystem in which the {@code SignalTransformer} should be loaded. | ||
* @return the {@code SignalTransformer} implementation. | ||
* @throws NullPointerException if {@code actorSystem} is {@code null}. | ||
*/ | ||
static SignalTransformer get(final ActorSystem actorSystem) { | ||
checkNotNull(actorSystem, "actorSystem"); | ||
return ExtensionId.INSTANCE.get(actorSystem); | ||
} | ||
|
||
final class ExtensionId extends DittoExtensionPoint.ExtensionId<SignalTransformer> { | ||
|
||
private static final String CONFIG_PATH = "ditto.signal-transformer"; | ||
private static final ExtensionId INSTANCE = new ExtensionId(SignalTransformer.class); | ||
|
||
private ExtensionId(final Class<SignalTransformer> parentClass) { | ||
super(parentClass); | ||
} | ||
|
||
@Override | ||
protected String getConfigPath() { | ||
return CONFIG_PATH; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters