0 Replies Latest reply on Jul 28, 2006 3:57 AM by J-C jc

    Improvement for org.jboss.ejb3.embedded.EJB3StandaloneBootst

    J-C jc Apprentice

      When we start scanClasspath method, EJB3StandaloneBoostrap class defines a set of ignoredJars. These jars are not scan for deploy.
      ignoredJars is public static, consequently we can add some of our jars in the list (such as junit, jdbc driver, ...)

      When using build tools such as maven jars are named with - for example junit-3.8.2.jar. If we have added junit-3.8.2.jar in the set of jar to ignore, when we will migrate to next junit version we will have to update the set. When we have a lot of dependency the risk is to forget some librairies.

      A nice features will be that list of jars to ignore contains regular expression for jar (such has junit*.jar: ".*.junit-\\d.\\d.\\d.jar").

      Then it will be possible to list all our jars without taking care about the release. And when we will change the release of our components, it will not affect our list of jar to ignore.

      Code may looks like:

      protected boolean accept(String file) {
       for (String pattern : ignoredJars) {
       if (file.matches(pattern)) {
       return false;
       }
       }
       return true;
       }
      
       public static HashSet<String> ignoredJars = new HashSet<String>();
      
       static {
       ignoredJars.add(".*.junit.*.jar");
       ignoredJars.add(".*.commons-.*.jar");
       ignoredJars.add(".*.jboss-.*.jar");
       ...
       }
      public static void scanClasspath()
       {
      //if (ignoredJars.contains(fp.getName())) continue;
      if (!accept(fp.getName())) continue;
      ...
      
      ...}