Class ObservableConnectionSenderImpl<DATA extends java.io.Serializable,CON>
- java.lang.Object
-
- org.refcodes.connection.ext.observable.ObservableConnectionSenderImpl<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:
java.io.Flushable
,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.Flushable
,org.refcodes.component.OpenedAccessor
,ObservableConnectionSender<DATA,CON>
,org.refcodes.io.BlockConsumer<DATA>
,org.refcodes.io.BlockSender<DATA>
,org.refcodes.io.ConnectionSender<DATA,CON>
,org.refcodes.io.Consumer<DATA>
,org.refcodes.io.DatagramConsumer<DATA>
,org.refcodes.io.DatagramSender<DATA>
,org.refcodes.io.Sendable
,org.refcodes.io.Sender<DATA>
,org.refcodes.mixin.Loggable
,org.refcodes.observer.Observable<DATA>
public class ObservableConnectionSenderImpl<DATA extends java.io.Serializable,CON> extends java.lang.Object implements ObservableConnectionSender<DATA,CON>, org.refcodes.mixin.Loggable
TheObservableConnectionSenderImpl
implements theObservableConnectionSender
for wrapping and extending aConnectionSender
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
-
Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.Flushable
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.connection.ext.observable.ObservableConnectionSender
ObservableConnectionSender.ObservableConnectionRequestSender<DATA extends java.io.Serializable,CON>
-
-
Constructor Summary
Constructors Constructor Description ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.lang.Object aSource)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
destroy()
void
flush()
org.refcodes.component.ConnectionStatus
getConnectionStatus()
boolean
hasObserverSubscription(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
boolean
isClosable()
boolean
isClosed()
boolean
isOpenable(CON aConnection)
boolean
isOpened()
void
open(CON aConnection)
boolean
subscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
boolean
unsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
void
writeDatagram(DATA aDatagram)
-
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
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
to which the connection method calls are to be delegated to.
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.lang.Object aSource)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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.
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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
.
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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.
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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).
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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).
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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).
-
ObservableConnectionSenderImpl
public ObservableConnectionSenderImpl(org.refcodes.io.ConnectionSender<DATA,CON> aConnectionSender, org.refcodes.observer.EventMetaData aEventMetaData, java.lang.Object aSource, java.util.concurrent.ExecutorService aExecutorService, org.refcodes.controlflow.ExecutionStrategy aExecutionStrategy)
Constructs aObservableConnectionSenderImpl
with the given attributes.- Parameters:
aConnectionSender
- TheConnectionSender
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
-
flush
public void flush() throws org.refcodes.component.OpenException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in interfaceorg.refcodes.component.Flushable
- Specified by:
flush
in interfaceorg.refcodes.io.Sender<DATA extends java.io.Serializable>
- Throws:
org.refcodes.component.OpenException
-
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
-
writeDatagram
public void writeDatagram(DATA aDatagram) throws org.refcodes.component.OpenException
-
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>
-
hasObserverSubscription
public boolean hasObserverSubscription(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
- Specified by:
hasObserverSubscription
in interfaceorg.refcodes.observer.Observable<DATA extends java.io.Serializable>
-
subscribeObserver
public boolean subscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver aObserver)
- Specified by:
subscribeObserver
in interfaceorg.refcodes.observer.Observable<DATA extends java.io.Serializable>
-
unsubscribeObserver
public boolean unsubscribeObserver(org.refcodes.component.ext.observer.ConnectionObserver 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
-
-