CON
- The type of the connection to be used.public class ConnectionAutomatonImpl<CON> extends Object implements ConnectionComponent.ConnectionAutomaton<CON>
ConnectionComponent.ConnectionAutomaton
.ConnectionComponent.ConnectionAutomaton<CON>, ConnectionComponent.ConnectionComponentBuilder<CON,B extends ConnectionComponent.ConnectionComponentBuilder<CON,B>>
ConnectionOpenable.ConnectionOpenAutomaton<CON>, ConnectionOpenable.ConnectionOpenBuilder<CON,B extends ConnectionOpenable.ConnectionOpenBuilder<CON,B>>
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedProperty
Closable.CloseAutomaton, Closable.CloseBuilder<B extends Closable.CloseBuilder<B>>
ClosedAccessor.ClosedMutator, ClosedAccessor.ClosedProperty
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusProperty
Modifier and Type | Field and Description |
---|---|
protected ConnectionComponent<CON> |
_connectionComponent |
Constructor and Description |
---|
ConnectionAutomatonImpl()
Empty constructor, such
LifeCycleComponent.LifeCycleAutomaton cannot do much more
than decline the various LifeCycleStatus states for you. |
ConnectionAutomatonImpl(ConnectionComponent<CON> aConnectionComponent)
This constructor uses a
LifeCycleStatus for wrapping it inside
the ConnectionAutomatonImpl , making sure of obeying and guarding
the correct LifeCycleStatus 's order of LifeCycleStatus
states for you. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component's connection(s).
|
ConnectionStatus |
getConnectionStatus()
Retrieves the
ConnectionStatus property from the property. |
boolean |
isClosable()
Determines whether the component's connection(s) may get closed.
|
boolean |
isClosed()
Retrieves the is-closed status.
|
boolean |
isOpenable(CON aConnection)
Determines whether the given connection may get opened, if true then
component may open a connection with the given connection via the
ConnectionOpenable.open(Object) method. |
boolean |
isOpened()
Retrieves the is-opened property from the opened property.
|
void |
open(CON aConnection)
Opens the component with the given connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
openUnchecked
closeIn, closeQuietly, closeUnchecked
protected ConnectionComponent<CON> _connectionComponent
public ConnectionAutomatonImpl()
LifeCycleComponent.LifeCycleAutomaton
cannot do much more
than decline the various LifeCycleStatus
states for you.public ConnectionAutomatonImpl(ConnectionComponent<CON> aConnectionComponent)
LifeCycleStatus
for wrapping it inside
the ConnectionAutomatonImpl
, making sure of obeying and guarding
the correct LifeCycleStatus
's order of LifeCycleStatus
states for you.aConnectionComponent
- The component to be guarded regarding the
correct declination of the LifeCycleStatus
states.public ConnectionStatus getConnectionStatus()
ConnectionStatus
property from the property.
Determines in which ConnectionStatus
status a component is in.getConnectionStatus
in interface ConnectionStatusAccessor
ConnectionStatus
property stored by the
property.public boolean isOpenable(CON aConnection)
ConnectionOpenable.open(Object)
method. Usually no physical connection is
established; usually criteria describing the provided connection are
evaluated; for example the connection is tested against a black list,
a white list or against well-formedness or whether the specified
protocols are supported (in case of a connection being a String URL
beginning with "http://", "ftp://" or similar).
---------------------------------------------------------------------
CAUTION: Even in case true is returned, the actual opening of a
connection may fail (e.g. due to network failure or authentication
issues).
---------------------------------------------------------------------isOpenable
in interface ConnectionOpenable.ConnectionOpenAutomaton<CON>
aConnection
- The connection for which to determine whether it
can be used to open a connection.ConnectionOpenable.open(Object)
is theoretically possible.public void open(CON aConnection) throws OpenException
open
in interface ConnectionOpenable<CON>
aConnection
- The connection used for opening the connection.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public boolean isOpened()
Openable.open()
or
ConnectionOpenable.open(Object)
.isOpened
in interface OpenedAccessor
public boolean isClosable()
isClosable
in interface Closable.CloseAutomaton
Closable.close()
is possible.public boolean isClosed()
Closable.close()
.isClosed
in interface ClosedAccessor
public void close()
CloseException
as
upon close we may have to do things like flushing buffers which can fail
(and would otherwise fail unhandled or even worse unnoticed).Copyright © 2017. All rights reserved.