Package org.drasyl.pipeline
Class DefaultHandlerContext
java.lang.Object
org.drasyl.pipeline.DefaultHandlerContext
- All Implemented Interfaces:
 HandlerContext
The default handler context implementation.
- 
Constructor Summary
ConstructorsConstructorDescriptionDefaultHandlerContext(String name, Handler handler, DrasylConfig config, Pipeline pipeline, io.reactivex.rxjava3.core.Scheduler scheduler, Identity identity, TypeValidator inboundValidator, TypeValidator outboundValidator) Generates a new default handler context for the givenhandler. - 
Method Summary
Modifier and TypeMethodDescriptionconfig()Returns the correspondingDrasylConfig.fireEventTriggered(Event event, CompletableFuture<Void> future) Received an event.fireExceptionCaught(Exception cause) Received anThrowablein one of the inbound operations.fireRead(Address sender, Object msg, CompletableFuture<Void> future) Received a message.handler()Returns the associatedHandler.identity()Returns the identifier of this node.Returns the inbound type validator of this pipeline.name()Returns the name of theHandler.Returns the outbound type validator of this pipeline.pipeline()Returns the correspondingPipeline.io.reactivex.rxjava3.core.SchedulerImplementation Note: This method should always return a scheduler, that differs from the normal pipeline scheduler.write(Address recipient, Object msg, CompletableFuture<Void> future) Request to write a message via thisHandlerContextthrough thePipeline. 
- 
Constructor Details
- 
DefaultHandlerContext
public DefaultHandlerContext(String name, Handler handler, DrasylConfig config, Pipeline pipeline, io.reactivex.rxjava3.core.Scheduler scheduler, Identity identity, TypeValidator inboundValidator, TypeValidator outboundValidator) Generates a new default handler context for the givenhandler.- Parameters:
 name- the name of the handlerhandler- the handlerconfig- the config of the drasyl nodepipeline- the corresponding pipeline objectscheduler- the corresponding scheduleridentity- the identity of the corresponding nodeinboundValidator- the inbound validator of the pipelineoutboundValidator- the outbound validator of the pipeline
 
 - 
 - 
Method Details
- 
handler
Description copied from interface:HandlerContextReturns the associatedHandler.- Returns:
 - the associated 
Handler 
 - 
name
Description copied from interface:HandlerContextReturns the name of theHandler.- Specified by:
 namein interfaceHandlerContext- Returns:
 - the name of the 
Handler 
 - 
fireExceptionCaught
Description copied from interface:HandlerContextReceived anThrowablein one of the inbound operations.This will result in having the
Handler.exceptionCaught(HandlerContext, Exception)method called of the nextHandlercontained in thePipeline.- Specified by:
 fireExceptionCaughtin interfaceHandlerContext- Parameters:
 cause- the cause
 - 
fireRead
Description copied from interface:HandlerContextReceived a message.This will result in having the
Handler.read(HandlerContext, Address, Object, CompletableFuture)method called of the nextHandlercontained in thePipeline.- Specified by:
 fireReadin interfaceHandlerContext- Parameters:
 sender- the sender of the messagemsg- the messagefuture- the future of the message
 - 
fireEventTriggered
Description copied from interface:HandlerContextReceived an event.This will result in having the
Handler.eventTriggered(HandlerContext, Event, CompletableFuture)method called of the nextHandlercontained in thePipeline.- Specified by:
 fireEventTriggeredin interfaceHandlerContext- Parameters:
 event- the eventfuture- the future of the message
 - 
write
Description copied from interface:HandlerContextRequest to write a message via thisHandlerContextthrough thePipeline.- Specified by:
 writein interfaceHandlerContext- Parameters:
 recipient- the recipient of the messagemsg- the messagefuture- the future of the message
 - 
config
Description copied from interface:HandlerContextReturns the correspondingDrasylConfig.- Specified by:
 configin interfaceHandlerContext- Returns:
 - the corresponding 
DrasylConfig 
 - 
pipeline
Description copied from interface:HandlerContextReturns the correspondingPipeline.- Specified by:
 pipelinein interfaceHandlerContext- Returns:
 - the corresponding 
Pipeline 
 - 
scheduler
public io.reactivex.rxjava3.core.Scheduler scheduler()Description copied from interface:HandlerContextImplementation Note: This method should always return a scheduler, that differs from the normal pipeline scheduler. E.g. theDrasylScheduler.getInstanceHeavy()- Specified by:
 schedulerin interfaceHandlerContext- Returns:
 - the corresponding 
Scheduler 
 - 
identity
Description copied from interface:HandlerContextReturns the identifier of this node.- Specified by:
 identityin interfaceHandlerContext- Returns:
 - the identity of this node
 
 - 
inboundValidator
Description copied from interface:HandlerContextReturns the inbound type validator of this pipeline.- Specified by:
 inboundValidatorin interfaceHandlerContext- Returns:
 - the inbound type validator
 
 - 
outboundValidator
Description copied from interface:HandlerContextReturns the outbound type validator of this pipeline.- Specified by:
 outboundValidatorin interfaceHandlerContext- Returns:
 - the outbound type validator
 
 
 -