Class DeployableChain<T>


  • public class DeployableChain<T>
    extends Object
    A DeployableChain is a container which manages dependencies between Deployables. You deploy() them in, then call rebuild() which will set up a chain, correctly ordered according to the constraints in the Deployables.
    • Constructor Detail

      • DeployableChain

        public DeployableChain()
    • Method Detail

      • deploy

        public void deploy​(Deployable deployable)
                    throws Exception
        Deploy a Deployable into this chain. Note that this does NOT order yet. The idea is to deploy everything first, then call rebuild() to generate the fully ordered chain. This method will validate the Deployable, including confirming that it's compatible with any previously deployed item of the same name.
        Parameters:
        deployable - Deployable to deploy.
        Throws:
        Exception - if there is a deployment error.
      • rebuild

        public void rebuild()
                     throws Exception
        Taking into account all the active constraints, order the list. This blows away the old order. Could improve this slightly with a "dirty" flag.
        Throws:
        Exception - if there's an ordering conflict
      • addRelationship

        public void addRelationship​(String before,
                                    String after)
        Adds a before/after relationship to the active constraints.
        Parameters:
        before - name of the Deployable that must come first
        after - name of the Deployable that must come later
      • getChain

        public List<T> getChain()
        Get the chain - once rebuild() has been called this will be the chain of target objects.
        Returns:
        a List of target objects in the correct order