org.drasyl.pipeline.AbstractEndHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of drasyl-core Show documentation
Show all versions of drasyl-core Show documentation
This packages contains the building blocks required to create the drasyl overlay network.
/*
* Copyright (c) 2020-2021 Heiko Bornholdt and Kevin Röbert
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.drasyl.pipeline;
import org.drasyl.DrasylConfig;
import org.drasyl.event.Event;
import org.drasyl.identity.Identity;
import org.drasyl.peer.PeersManager;
import org.drasyl.pipeline.address.Address;
import org.drasyl.pipeline.serialization.Serialization;
import org.drasyl.util.scheduler.DrasylScheduler;
import java.util.concurrent.CompletableFuture;
/**
* Skeleton implementation for end handler of the {@link Pipeline}.
*/
@SuppressWarnings({ "common-java:DuplicatedBlocks", "java:S107" })
abstract class AbstractEndHandler extends AbstractHandlerContext implements Handler {
protected AbstractEndHandler(final String name,
final DrasylConfig config,
final Pipeline pipeline,
final DrasylScheduler dependentScheduler,
final DrasylScheduler independentScheduler,
final Identity identity,
final PeersManager peersManager,
final Serialization inboundSerialization,
final Serialization outboundSerialization) {
super(name, config, pipeline, dependentScheduler, independentScheduler, identity, peersManager, inboundSerialization, outboundSerialization);
}
@Override
public Handler handler() {
return this;
}
@Override
public void onAdded(final HandlerContext ctx) {
// skip
}
@Override
public void onRemoved(final HandlerContext ctx) {
// skip
}
@Skip
@Override
public void onInbound(final HandlerContext ctx,
final Address sender,
final Object msg,
final CompletableFuture future) {
// skip
ctx.passInbound(sender, msg, future);
}
@Skip
@Override
public void onEvent(final HandlerContext ctx,
final Event event,
final CompletableFuture future) {
// skip
ctx.passEvent(event, future);
}
@Skip
@Override
public void onException(final HandlerContext ctx, final Exception cause) {
//skip
ctx.passException(cause);
}
@Skip
@Override
public void onOutbound(final HandlerContext ctx,
final Address recipient,
final Object msg,
final CompletableFuture future) {
// skip
ctx.passOutbound(recipient, msg, future);
}
}