Class ObservableConnectionRequestReceiverImpl<DATA extends java.io.Serializable,CON>
- java.lang.Object
-
- org.refcodes.connection.ext.observable.ObservableConnectionRequestReceiverImpl<DATA,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
,ObservableConnectionReceiver.ObservableConnectionRequestReceiver<DATA,CON>
,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>
,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 ObservableConnectionRequestReceiverImpl<DATA extends java.io.Serializable,CON> extends java.lang.Object implements ObservableConnectionReceiver.ObservableConnectionRequestReceiver<DATA,CON>, org.refcodes.mixin.Loggable
TheObservableConnectionRequestReceiverImpl
implements theObservableConnectionReceiver
for wrapping and extending aConnectionReceiver
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 java.lang.Object>, org.refcodes.component.ConnectionComponent.ConnectionComponentBuilder<CON extends java.lang.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 java.lang.Object>, org.refcodes.component.ConnectionOpenable.ConnectionOpenBuilder<CON extends java.lang.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
-
-
Constructor Summary
Constructors Constructor Description ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.lang.Object aSource)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
destroy()
org.refcodes.component.ConnectionStatus
getConnectionStatus()
boolean
hasDatagram()
boolean
hasObserverSubscription(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
boolean
isClosable()
boolean
isClosed()
boolean
isOpenable(CON aConnection)
boolean
isOpened()
void
open(CON aConnection)
DATA
readDatagram()
void
releaseAll()
boolean
subscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
boolean
unsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.mixin.Loggable
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
-
-
-
-
Constructor Detail
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.lang.Object aSource)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
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.
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.aEventMetaData
- TheEventMetaData
to be used when firing events in case theEventMetaData
is to be different from the auto-generatedEventMetaData
.
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.aEventMetaData
- TheEventMetaData
to be used when firing events in case theEventMetaData
is to be different from the auto-generatedEventMetaData
.aSource
- The source instance to be used when firing events in case the source is to be different from this class' instance.
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.aExecutorService
- The executor service to be used when firingGenericActionEvent
instances in multiple threads (if null then a default one is used).aExecutionStrategy
- TheExecutionStrategy
to be used when firingGenericActionEvent
instance (if null then the defaultExecutionStrategy.SEQUENTIAL
is used).
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
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 firingGenericActionEvent
instances in multiple threads (if null then a default one is used).aExecutionStrategy
- TheExecutionStrategy
to be used when firingGenericActionEvent
instance (if null then the defaultExecutionStrategy.SEQUENTIAL
is used).
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.aEventMetaData
- TheEventMetaData
to be used when firing events in case theEventMetaData
is to be different from the auto-generatedEventMetaData
.aExecutorService
- The executor service to be used when firingGenericActionEvent
instances in multiple threads (if null then a default one is used).aExecutionStrategy
- TheExecutionStrategy
to be used when firingGenericActionEvent
instance (if null then the defaultExecutionStrategy.SEQUENTIAL
is used).
-
ObservableConnectionRequestReceiverImpl
public ObservableConnectionRequestReceiverImpl(org.refcodes.io.ConnectionReceiver<DATA,CON> aConnectionReceiver, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionRequestReceiverImpl
with the given attributes.- Parameters:
aConnectionReceiver
- TheConnectionReceiver
to which the connection method calls are to be delegated to.aEventMetaData
- TheEventMetaData
to be used when firing events in case theEventMetaData
is to be different from the auto-generatedEventMetaData
.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 firingGenericActionEvent
instances in multiple threads (if null then a default one is used).aExecutionStrategy
- TheExecutionStrategy
to be used when firingGenericActionEvent
instance (if null then the defaultExecutionStrategy.SEQUENTIAL
is used).
-
-
Method Detail
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceorg.refcodes.component.ClosedAccessor
-
isOpened
public boolean isOpened()
- Specified by:
isOpened
in interfaceorg.refcodes.component.OpenedAccessor
-
getConnectionStatus
public org.refcodes.component.ConnectionStatus getConnectionStatus()
- Specified by:
getConnectionStatus
in interfaceorg.refcodes.component.ConnectionStatusAccessor
-
releaseAll
public void releaseAll()
- Specified by:
releaseAll
in interfaceorg.refcodes.mixin.Releaseable
-
close
public void close() throws org.refcodes.component.CloseException
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Throws:
org.refcodes.component.CloseException
-
open
public void open(CON aConnection) throws org.refcodes.component.OpenException
- Specified by:
open
in interfaceorg.refcodes.component.ConnectionOpenable<DATA extends java.io.Serializable>
- Throws:
org.refcodes.component.OpenException
-
readDatagram
public DATA readDatagram() throws org.refcodes.component.OpenException, java.lang.InterruptedException
- Specified by:
readDatagram
in interfaceorg.refcodes.io.DatagramProvider<DATA extends java.io.Serializable>
- Throws:
org.refcodes.component.OpenException
java.lang.InterruptedException
-
isClosable
public boolean isClosable()
- Specified by:
isClosable
in interfaceorg.refcodes.component.Closable.CloseAutomaton
-
isOpenable
public boolean isOpenable(CON aConnection)
- Specified by:
isOpenable
in interfaceorg.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<DATA extends java.io.Serializable>
-
hasDatagram
public boolean hasDatagram() throws org.refcodes.component.OpenException
- Specified by:
hasDatagram
in interfaceorg.refcodes.io.Receivable
- Throws:
org.refcodes.component.OpenException
-
hasObserverSubscription
public boolean hasObserverSubscription(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
- Specified by:
hasObserverSubscription
in interfaceorg.refcodes.observer.Observable<DATA extends java.io.Serializable>
-
subscribeObserver
public boolean subscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<DATA extends java.io.Serializable>
-
unsubscribeObserver
public boolean unsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver.ConnectionRequestObserver aObserver)
- Specified by:
unsubscribeObserver
in interfaceorg.refcodes.observer.Observable<DATA extends java.io.Serializable>
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceorg.refcodes.component.Destroyable
-
-