Package org.refcodes.component
Class AbstractConnectableAutomaton
- java.lang.Object
-
- org.refcodes.component.AbstractConnectableAutomaton
-
- All Implemented Interfaces:
Closable
,Closable.CloseAutomaton
,ClosedAccessor
,ConnectableComponent
,ConnectableComponent.ConnectableAutomaton
,ConnectionStatusAccessor
,OpenedAccessor
- Direct Known Subclasses:
AbstractDeviceAutomaton
public abstract class AbstractConnectableAutomaton extends Object implements ConnectableComponent.ConnectableAutomaton
TheAbstractConnectableAutomaton
implements the very basicAbstractConnectableAutomaton
functionality.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B extends Closable.CloseBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
ClosedAccessor.ClosedMutator, ClosedAccessor.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
ConnectableComponent.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedProperty
-
-
Constructor Summary
Constructors Constructor Description AbstractConnectableAutomaton()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the component's connection(s).ConnectionStatus
getConnectionStatus()
Retrieves theConnectionStatus
property from the property.boolean
isClosable()
Determines whether the component's connection(s) may get closed.boolean
isClosed()
Retrieves the is-closed status.protected boolean
isOpenable()
Checks if is openable.boolean
isOpened()
Retrieves the is-opened property from the opened property.protected void
open()
Open.protected void
setConnectionStatus(ConnectionStatus aConnectionStatus)
Sets theConnectionStatus
property for the property.-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
isConnectionOpened
-
-
-
-
Method Detail
-
isOpened
public boolean isOpened()
Retrieves the is-opened property from the opened property. Determines whether the component's connection is opened. A component's connection is opened after being opened as ofOpenable.open()
orConnectionOpenable.open(Object)
.- Specified by:
isOpened
in interfaceOpenedAccessor
- Returns:
- True in case of being opened (returns the is-opened property stored by the opened property).
-
isClosable
public boolean isClosable()
Determines whether the component's connection(s) may get closed.- Specified by:
isClosable
in interfaceClosable.CloseAutomaton
- Returns:
- True if
Closable.close()
is possible.
-
close
public void close() throws CloseException
Closes the component's connection(s). Throws aCloseException
as upon close we may have to do things like flushing buffers which can fail (and would otherwise fail unhandled or even worse unnoticed).- Specified by:
close
in interfaceClosable
- Throws:
CloseException
- in case closing or pre-closing (flushing) fails.
-
isClosed
public boolean isClosed()
Retrieves the is-closed status. Determines whether the component's connection is closed. A component's connection is closed after being closed as ofClosable.close()
.- Specified by:
isClosed
in interfaceClosedAccessor
- Returns:
- True in case of being closed.
-
getConnectionStatus
public ConnectionStatus getConnectionStatus()
Retrieves theConnectionStatus
property from the property. Determines in whichConnectionStatus
status a component is in.- Specified by:
getConnectionStatus
in interfaceConnectionStatusAccessor
- Returns:
- Returns the
ConnectionStatus
property stored by the property.
-
isOpenable
protected boolean isOpenable()
Checks if is openable.- Returns:
- true, if is openable
- See Also:
Openable.OpenAutomaton.isOpenable()
-
open
protected void open() throws OpenException
Open.- Throws:
OpenException
- the open exception- See Also:
Openable.open()
-
setConnectionStatus
protected void setConnectionStatus(ConnectionStatus aConnectionStatus)
Sets theConnectionStatus
property for the property.- Parameters:
aConnectionStatus
- TheConnectionStatus
property to be stored by the property.
-
-