0 Replies Latest reply on Nov 10, 2008 4:05 AM by Ales Justin

    JBAS-4588; DeploymentSorter

    Ales Justin Master

      What exactly does this task want me to do? :-)
      - https://jira.jboss.org/jira/browse/JBAS-4588

      We currently have the following configuration:
      - LegacyDeploymentContextComparator (LDCC):

       static
       {
       legacyOrder = new HashMap<String, Integer>();
       legacyOrder.put(".deployer", 50);
       legacyOrder.put("-deployer.xml", 50);
       legacyOrder.put(".aop", 100);
       legacyOrder.put("-aop.xml", 100);
       legacyOrder.put(".sar", 150);
       legacyOrder.put("-service.xml", 150);
       legacyOrder.put(".beans", 200);
       legacyOrder.put("-jboss-beans.xml", 200);
       legacyOrder.put(".rar", 250);
       legacyOrder.put("-ds.xml", 300);
       legacyOrder.put(".har", 350);
       legacyOrder.put(".jar", 400);
       legacyOrder.put(".ejb3", 400);
       legacyOrder.put(".par", 400);
       legacyOrder.put(".war", 500);
       legacyOrder.put(".wsr", 600);
       legacyOrder.put(".ear", 650);
       legacyOrder.put(".jar", 700);
       legacyOrder.put(".zip", 750);
       legacyOrder.put(".bsh", 800);
       legacyOrder.put(".last", 900);
       }
      
       private boolean useDefaults = true;
       private Map<String, Integer> suffixOrder;
       private int defaultOrder = 850;
      
       /**
       * Get the instance.
       *
       * @return the instance
       */
       public static LegacyDeploymentContextComparator getInstance()
       {
       return INSTANCE;
       }
      
       public int compare(DeploymentContext fst, DeploymentContext snd)
       {
       int fstOrder = getContextOrder(fst);
       int sndOrder = getContextOrder(snd);
       int diff = fstOrder - sndOrder;
       if (diff != 0)
       return diff;
       else
       return super.compare(fst, snd);
       }
      
       /**
       * Get context's order.
       *
       * @param context the deployment context
       * @return context's order, or default if no match
       */
       protected int getContextOrder(DeploymentContext context)
       {
       String simpleName = context.getSimpleName();
       for (Map.Entry<String, Integer> entry : suffixOrder.entrySet())
       {
       if (simpleName.endsWith(entry.getKey()))
       return entry.getValue();
       }
       return defaultOrder;
       }
      

      - LDCC is then used in MainDeployer::comparator
      - LDCC is used in EARStructure::comparatorClassName
      - jboss-structure.xml/context can now take comparator attribute

      What else do we need?