Class GroupTree


  • public class GroupTree
    extends java.lang.Object
    Group tree for Maven groupIDs. This class parses a text file that has a directive on each line. Directive examples:
    • ignored/formatting - each line starting with '#' (hash) or being empty/blank is ignored.
    • modifier ! is negation (disallow; by def entry allows). If present must be first character.
    • modifier = is limiter (to given G; by def is "G and below"). If present, must be first character. If negation present, must be second character.
    • a valid Maven groupID ie "org.apache.maven".
    By default, a G entry ie org.apache.maven means "allow org.apache.maven G and all Gs below (so org.apache.maven.plugins etc. are all allowed). There is one special entry "*" (asterisk) that means "root" and defines the default acceptance: "*" means "by default accept" and "!*" means "by default deny" (same effect as when this character is not present in file). Use of limiter modifier on "root" like "=*" has no effect, is simply ignored.

    Examples:

     
     # this is my group filter list
    
     org.apache.maven
     !=org.apache.maven.foo
     !org.apache.maven.indexer
     =org.apache.bar
     
     
    File meaning: "allow all org.apache.maven and below", "disallow org.apache.maven.foo groupId ONLY" (hence org.apache.maven.foo.bar is allowed due first line), "disallow org.apache.maven.indexer and below" and "allow org.apache.bar groupID ONLY".

    In case of conflicting rules, parsing happens by "last wins", so line closer to last line in file "wins", and conflicting line value is lost.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name  
      protected java.util.concurrent.ConcurrentHashMap<java.lang.String,​N> siblings  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptedGroupId​(java.lang.String groupId)  
      static GroupTree create​(java.lang.String name)
      Creates root, that is special: accept is never null.
      void dump​(java.lang.String prefix)  
      java.lang.String getName()  
      boolean isLeaf()  
      boolean loadNode​(java.lang.String line)  
      int loadNodes​(java.util.stream.Stream<java.lang.String> linesStream)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        protected final java.lang.String name
      • siblings

        protected final java.util.concurrent.ConcurrentHashMap<java.lang.String,​N extends org.eclipse.aether.internal.impl.filter.ruletree.Node<?>> siblings
    • Method Detail

      • create

        public static GroupTree create​(java.lang.String name)
        Creates root, that is special: accept is never null.
      • loadNodes

        public int loadNodes​(java.util.stream.Stream<java.lang.String> linesStream)
      • loadNode

        public boolean loadNode​(java.lang.String line)
      • acceptedGroupId

        public boolean acceptedGroupId​(java.lang.String groupId)
      • toString

        public java.lang.String toString()
      • dump

        public void dump​(java.lang.String prefix)
      • getName

        public java.lang.String getName()
      • isLeaf

        public boolean isLeaf()