5 Replies Latest reply on Nov 4, 2006 9:33 AM by adrian.brock

    Relative order of deployers to other deployers

    starksm64

      A common usecase is that a given deployer want to be relative to another deployer as it operates on the the metadata going into or coming out of the other deployer. To do this in a deployers getRelativeOrder method requires stepping outside of the deployer spis as the MainDeployer has no registry of deployers by name, and we don't have a notion of specifying that a deployer's relativeOrder is relative to another deployer.

      One way would be to expand the OrderedDeployer interface:

      public interface OrderedDeployer
      {
       /** The unique name of the deployer */
       public String getName();
       /** The name of the deployer this deployer is relative to. A null value means the
       relativeOrder is an global value. Otherwise, relativeOrder is translated into a global
       order by looking up the relativeOrder of the indicated deployer.
       */
       public String getRelativeToName();
      
       /**
       * Get the relative order
       *
       * @return the relative order
       */
       int getRelativeOrder();
       /**
       * Set the deployer relative order.
       * @param order - the order of the deployer in a deployer chain.
       */
       public void setRelativeOrder(int order);
      ...
      




        • 1. Re: Relative order of deployers to other deployers
          bill.burke

          Why can't you just create a dependency in the bean definition and ensure that the bean will comein the same relative order number but after any of that level.

          • 2. Re: Relative order of deployers to other deployers
            starksm64

            That does not help if I want to be ahead of another deployer. I still depend on the other deployer, but want to modify its input. Deployers can exist independent of the kernel anyway and need to be ordered in that case as well.

            • 3. Re: Relative order of deployers to other deployers
              kabirkhan

              How about a precedence bean that is injected into the main deployer, and defines relative ordering between all the deployers that would otherwise be at the same level. Isn't the main deployer what maintains the order of all the deployers?

              • 4. Re: Relative order of deployers to other deployers
                starksm64

                 

                "kabir.khan@jboss.com" wrote:
                How about a precedence bean that is injected into the main deployer, and defines relative ordering between all the deployers that would otherwise be at the same level. Isn't the main deployer what maintains the order of all the deployers?


                Yes, its the MainDeployerImpl that uses standard collections and the Deployer.COMPARATOR to order deployers based on the relativeOrder value currently. Allowing for the injection of the comparator would allow for alternate ordering mechanisms.

                • 5. Re: Relative order of deployers to other deployers

                  Like I said on a different thread, my preference is for each deployer to
                  define its input/output metadata. This will lead to a natural (relative) ordering.

                  The relative order is still required however to define when each step is taken
                  (relative to other deployers that are not in the same chains).
                  e.g. We always classloaders to be created together even if they are
                  different implementations for different deployer chains.