Class CompositeComponentImpl<C extends Component>

    • Constructor Detail

      • CompositeComponentImpl

        public CompositeComponentImpl​(Collection<C> aComponents)
        Creates a CompositeComponentImpl containing the provided components. The ExecutionStrategy.JOIN ExecutionStrategy is used by default.
        Parameters:
        aComponents - The components to be managed by the CompositeComponentImpl.
      • CompositeComponentImpl

        public CompositeComponentImpl​(org.refcodes.controlflow.ExecutionStrategy aStrategy,
                                      Collection<C> aComponents)
        Creates a CompositeComponentImpl containing the provided components.
        Parameters:
        aStrategy - The ExecutionStrategy for executing the state change requests.
        aComponents - The components to be managed by the CompositeComponentImpl.
      • CompositeComponentImpl

        @SafeVarargs
        public CompositeComponentImpl​(C... aComponents)
        Creates a CompositeComponentImpl containing the provided components. The ExecutionStrategy.JOIN ExecutionStrategy is used by default.
        Parameters:
        aComponents - The components to be managed by the CompositeComponentImpl.
      • CompositeComponentImpl

        @SafeVarargs
        public CompositeComponentImpl​(org.refcodes.controlflow.ExecutionStrategy aStrategy,
                                      C... aComponents)
        Creates a CompositeComponentImpl containing the provided components.
        Parameters:
        aStrategy - The ExecutionStrategy for executing the state change requests.
        aComponents - The components to be managed by the CompositeComponentImpl.
    • Method Detail

      • decompose

        public void decompose()
        Decomposes the component. External resources might get deleted (such as files or DB schemas)!
        Specified by:
        decompose in interface Decomposeable
      • 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 a Component has been destroyed, then invoking any of that Component instance's methods (except the Destroyable.destroy() method) must throw an IllegalStateException as by definition a once destroyed Component is in the state of being destroyed which is irreversible.
        Specified by:
        destroy in interface Destroyable
      • reset

        public void reset()
        Resets the component. No exception is thrown as decomposition must work always!
        Specified by:
        reset in interface Resetable
      • open

        public void open()
                  throws IOException
        Open the component's connection(s).
        Specified by:
        open in interface Openable
        Throws:
        IOException - Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
      • close

        public void close()
                   throws IOException
        Closes the component's connection(s). Throws a IOException 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 interface Closable
        Throws:
        IOException - thrown in case closing failed.
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.refcodes.mixin.Disposable
      • getExecutionStrategy

        protected org.refcodes.controlflow.ExecutionStrategy getExecutionStrategy()
        Provides access to the ExecutionStrategy.
        Returns:
        The ExecutionStrategy being set.
      • getComponents

        protected Set<C> getComponents()
        Provides access to the Component instances.
        Returns:
        The Component instances being set.