Class ObservableConnectionReceiverImpl<DATA extends Serializable,CON>

  • Type Parameters:
    DATA - The type of the datagram to be operated with.
    CON - The type of the connection to be used.
    All Implemented Interfaces:
    org.refcodes.component.Closable, org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.ClosedAccessor, org.refcodes.component.Component, org.refcodes.component.ConnectableComponent, org.refcodes.component.ConnectableComponent.ConnectableAutomaton, org.refcodes.component.ConnectionComponent<DATA>, org.refcodes.component.ConnectionComponent.ConnectionAutomaton<DATA>, org.refcodes.component.ConnectionOpenable<DATA>, org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA>, org.refcodes.component.ConnectionStatusAccessor, org.refcodes.component.Destroyable, org.refcodes.component.OpenedAccessor, org.refcodes.io.BlockProvider<DATA>, org.refcodes.io.BlockReceiver<DATA>, org.refcodes.io.ConnectionReceiver<DATA,CON>, org.refcodes.io.DatagramProvider<DATA>, org.refcodes.io.DatagramReceiver<DATA>, ObservableConnectionReceiver<DATA,CON>, org.refcodes.io.Provider<DATA>, org.refcodes.io.Receivable, org.refcodes.io.Receiver<DATA>, org.refcodes.mixin.Loggable, org.refcodes.mixin.Releaseable, org.refcodes.observer.Observable<DATA>


    public class ObservableConnectionReceiverImpl<DATA extends Serializable,CON>
    extends Object
    implements ObservableConnectionReceiver<DATA,CON>, org.refcodes.mixin.Loggable
    The ObservableConnectionReceiverImpl implements the ObservableConnectionReceiver for wrapping and extending a ConnectionReceiver with observable functionality.

    TODO: Test cases are to be created!

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.component.Closable

        org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor

        org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent

        org.refcodes.component.ConnectableComponent.ConnectableAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionComponent

        org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON extends Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends Object,B extends org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON,B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionOpenable

        org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON extends Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends Object,B extends org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON,B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor

        org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable

        org.refcodes.component.Destroyable.DestroyAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor

        org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
    • Field Summary

      • Fields inherited from interface org.refcodes.mixin.Loggable

        RUNTIME_LOGGER_CLASS, RUNTIME_LOGGER_FACTORY_CLASS, RUNTIME_LOGGER_FACTORY_METHOD
    • Constructor Detail

      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                Object aSource)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aSource - The source instance to be used when firing events in case the source is to be different from this class' instance.
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                org.refcodes.mixin.EventMetaData aEventMetaData)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aEventMetaData - The EventMetaData to be used when firing events in case the EventMetaData is to be different from the auto-generated EventMetaData.
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                org.refcodes.mixin.EventMetaData aEventMetaData,
                                                Object aSource)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aEventMetaData - The EventMetaData to be used when firing events in case the EventMetaData is to be different from the auto-generated EventMetaData.
        aSource - The source instance to be used when firing events in case the source is to be different from this class' instance.
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                ExecutorService aExecutorService,
                                                org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aExecutorService - The executor service to be used when firing GenericActionEvent instances in multiple threads (if null then a default one is used).
        aExecutionStrategy - The ExecutionStrategy to be used when firing GenericActionEvent instance (if null then the default ExecutionStrategy.SEQUENTIAL is used).
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                Object aSource,
                                                ExecutorService aExecutorService,
                                                org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aSource - The source instance to be used when firing events in case the source is to be different from this class' instance.
        aExecutorService - The executor service to be used when firing GenericActionEvent instances in multiple threads (if null then a default one is used).
        aExecutionStrategy - The ExecutionStrategy to be used when firing GenericActionEvent instance (if null then the default ExecutionStrategy.SEQUENTIAL is used).
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                org.refcodes.mixin.EventMetaData aEventMetaData,
                                                ExecutorService aExecutorService,
                                                org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aEventMetaData - The EventMetaData to be used when firing events in case the EventMetaData is to be different from the auto-generated EventMetaData.
        aExecutorService - The executor service to be used when firing GenericActionEvent instances in multiple threads (if null then a default one is used).
        aExecutionStrategy - The ExecutionStrategy to be used when firing GenericActionEvent instance (if null then the default ExecutionStrategy.SEQUENTIAL is used).
      • ObservableConnectionReceiverImpl

        public ObservableConnectionReceiverImpl​(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver,
                                                org.refcodes.mixin.EventMetaData aEventMetaData,
                                                Object aSource,
                                                ExecutorService aExecutorService,
                                                org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
        Constructs a ObservableConnectionReceiverImpl with the given attributes.
        Parameters:
        aConnectionReceiver - The ConnectionReceiver to which the connection method calls are to be delegated to.
        aEventMetaData - The EventMetaData to be used when firing events in case the EventMetaData is to be different from the auto-generated EventMetaData.
        aSource - The source instance to be used when firing events in case the source is to be different from this class' instance.
        aExecutorService - The executor service to be used when firing GenericActionEvent instances in multiple threads (if null then a default one is used).
        aExecutionStrategy - The ExecutionStrategy to be used when firing GenericActionEvent instance (if null then the default ExecutionStrategy.SEQUENTIAL is used).
    • Method Detail

      • isClosed

        public boolean isClosed​()
        Specified by:
        isClosed in interface org.refcodes.component.ClosedAccessor
      • isOpened

        public boolean isOpened​()
        Specified by:
        isOpened in interface org.refcodes.component.OpenedAccessor
      • getConnectionStatus

        public org.refcodes.component.ConnectionStatus getConnectionStatus​()
        Specified by:
        getConnectionStatus in interface org.refcodes.component.ConnectionStatusAccessor
      • releaseAll

        public void releaseAll​()
        Specified by:
        releaseAll in interface org.refcodes.mixin.Releaseable
      • close

        public void close​()
                   throws org.refcodes.component.CloseException
        Specified by:
        close in interface org.refcodes.component.Closable
        Throws:
        org.refcodes.component.CloseException
      • open

        public void open​(CON aConnection)
                  throws org.refcodes.component.OpenException
        Specified by:
        open in interface org.refcodes.component.ConnectionOpenable<DATA extends Serializable>
        Throws:
        org.refcodes.component.OpenException
      • isClosable

        public boolean isClosable​()
        Specified by:
        isClosable in interface org.refcodes.component.Closable.CloseAutomaton
      • isOpenable

        public boolean isOpenable​(CON aConnection)
        Specified by:
        isOpenable in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA extends Serializable>
      • hasDatagram

        public boolean hasDatagram​()
                            throws org.refcodes.component.OpenException
        Specified by:
        hasDatagram in interface org.refcodes.io.Receivable
        Throws:
        org.refcodes.component.OpenException
      • hasObserverSubscription

        public boolean hasObserverSubscription​(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
        Specified by:
        hasObserverSubscription in interface org.refcodes.observer.Observable<DATA extends Serializable>
      • subscribeObserver

        public boolean subscribeObserver​(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
        Specified by:
        subscribeObserver in interface org.refcodes.observer.Observable<DATA extends Serializable>
      • unsubscribeObserver

        public boolean unsubscribeObserver​(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
        Specified by:
        unsubscribeObserver in interface org.refcodes.observer.Observable<DATA extends Serializable>
      • destroy

        public void destroy​()
        Specified by:
        destroy in interface org.refcodes.component.Destroyable