Class AbstractComponentComposite<C extends Component>
java.lang.Object
org.refcodes.component.AbstractComponentComposite<C>
- Type Parameters:
C- The type of theComponentsupported by theAbstractComponentComposite.
- All Implemented Interfaces:
Flushable, Closable, ComponentComposite, Decomposable, Destroyable, Flushable, Initializable, LifecycleComponent, LinkComponent, Openable, Pausable, Resumable, Startable, Stoppable, Disposable, Resetable
- Direct Known Subclasses:
AbstractComponentComposite.ExtendedCompositeComponentImpl
public abstract class AbstractComponentComposite<C extends Component>
extends Object
implements ComponentComposite
The
AbstractComponentComposite is an implementation of the
ComponentComposite. To make sure that the state change requests you
require are supported by the managed Component instances, specify the
according type C as generic type argument.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheAbstractComponentComposite.ExtendedCompositeComponentImplis an implementation of theComponentComposite.ExtendedComponentComposite.Nested classes/interfaces inherited from interface Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B>Nested classes/interfaces inherited from interface ComponentComposite
ComponentComposite.ExtendedComponentComposite<CTX,CON> Nested classes/interfaces inherited from interface Decomposable
Decomposable.DecomposeAutomatonNested classes/interfaces inherited from interface Destroyable
Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface Flushable
Flushable.FlushBuilder<B>Nested classes/interfaces inherited from interface Initializable
Initializable.InitializeAutomaton, Initializable.InitializeBuilder<B>, Initializable.UncheckedInitializableNested classes/interfaces inherited from interface LifecycleComponent
LifecycleComponent.LifecycleAutomaton, LifecycleComponent.UncheckedLifecycleComponentNested classes/interfaces inherited from interface LinkComponent
LinkComponent.LinkAutomaton, LinkComponent.LinkComponentBuilder<B>Nested classes/interfaces inherited from interface Openable
Openable.OpenAutomaton, Openable.OpenBuilder<B>Nested classes/interfaces inherited from interface Pausable
Pausable.PauseAutomaton, Pausable.PauseBuilder<B>, Pausable.UncheckedPausableNested classes/interfaces inherited from interface Resumable
Resumable.ResumeAutomaton, Resumable.ResumeBuilder<B>, Resumable.UncheckedResumableNested classes/interfaces inherited from interface Startable
Startable.StartAutomaton, Startable.StartBuilder<B>, Startable.UncheckedStartableNested classes/interfaces inherited from interface Stoppable
Stoppable.StopAutomaton, Stoppable.StopBuilder<B>, Stoppable.UncheckedStoppable -
Constructor Summary
ConstructorsConstructorDescriptionAbstractComponentComposite(C... aComponents) Creates aAbstractComponentCompositecontaining the provided components.AbstractComponentComposite(Collection<C> aComponents) Creates aAbstractComponentCompositecontaining the provided components.AbstractComponentComposite(ExecutionStrategy aStrategy, C... aComponents) Creates aAbstractComponentCompositecontaining the provided components.AbstractComponentComposite(ExecutionStrategy aStrategy, Collection<C> aComponents) Creates aAbstractComponentCompositecontaining the provided components. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the component's connection(s).voidDecomposes the component.voiddestroy()Destroys the component.voiddispose()voidflush()Provides access to theComponentinstances.protected ExecutionStrategyProvides access to theExecutionStrategy.voidInitialize the component.voidopen()Open the component's connection(s).voidpause()Pauses the component.voidreset()voidresume()Resumes the component.voidstart()Starts the component.voidstop()Stops the component.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface Flushable
flushUnchecked, isFlushableMethods inherited from interface Initializable
initializeUncheckedMethods inherited from interface Openable
openUncheckedMethods inherited from interface Pausable
pauseUncheckedMethods inherited from interface Resumable
resumeUncheckedMethods inherited from interface Startable
startUncheckedMethods inherited from interface Stoppable
stopUnchecked
-
Constructor Details
-
AbstractComponentComposite
Creates aAbstractComponentCompositecontaining the provided components. TheExecutionStrategy.JOINExecutionStrategyis used by default.- Parameters:
aComponents- The components to be managed by theAbstractComponentComposite.
-
AbstractComponentComposite
Creates aAbstractComponentCompositecontaining the provided components.- Parameters:
aStrategy- TheExecutionStrategyfor executing the state change requests.aComponents- The components to be managed by theAbstractComponentComposite.
-
AbstractComponentComposite
Creates aAbstractComponentCompositecontaining the provided components. TheExecutionStrategy.JOINExecutionStrategyis used by default.- Parameters:
aComponents- The components to be managed by theAbstractComponentComposite.
-
AbstractComponentComposite
Creates aAbstractComponentCompositecontaining the provided components.- Parameters:
aStrategy- TheExecutionStrategyfor executing the state change requests.aComponents- The components to be managed by theAbstractComponentComposite.
-
-
Method Details
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
decompose
public void decompose()Decomposes the component. External resources might get deleted (such as files or DB schemas)!- Specified by:
decomposein interfaceDecomposable
-
destroy
public void destroy()Destroys the component. External resources might stay untouched! This should always be possible and must not throw any exception. In case aComponenthas been destroyed, then invoking any of thatComponentinstance's methods (except theDestroyable.destroy()method) must throw anIllegalStateExceptionas by definition a once destroyedComponentis in the state of being destroyed which is irreversible.- Specified by:
destroyin interfaceDestroyable
-
stop
Stops the component.- Specified by:
stopin interfaceStoppable- Throws:
StopException- Thrown in case stopping fails.
-
resume
Resumes the component.- Specified by:
resumein interfaceResumable- Throws:
ResumeException- Thrown in case resuming fails.
-
pause
Pauses the component.- Specified by:
pausein interfacePausable- Throws:
PauseException- in case pausing fails.
-
start
Starts the component.- Specified by:
startin interfaceStartable- Throws:
StartException- Thrown in case starting fails.
-
initialize
Initialize the component.- Specified by:
initializein interfaceInitializable- Throws:
InitializeException- Thrown in case initializing fails.
-
reset
-
open
Open the component's connection(s).- Specified by:
openin interfaceOpenable- Throws:
IOException- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
-
close
Closes the component's connection(s). Throws aIOExceptionas 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:
closein interfaceClosable- Throws:
IOException- thrown in case closing failed.
-
dispose
public void dispose()- Specified by:
disposein interfaceDisposable
-
getExecutionStrategy
Provides access to theExecutionStrategy.- Returns:
- The
ExecutionStrategybeing set.
-
getComponents
-