org.apache.jackrabbit.core.security.authorization
Class GlobPattern

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.GlobPattern

public final class GlobPattern
extends Object

GlobPattern defines a simplistic pattern matching. It consists of a mandatory (leading) path and an optional "glob" that may contain one or more wildcard characters ("*") according to the glob matching defined by Node.getNodes(String[]). In contrast to that method the GlobPattern operates on path (not only names).

Please note the following special cases:

 NodePath     |   Restriction   |   Matches
 -----------------------------------------------------------------------------
 /foo         |   null          |   matches /foo and all children of /foo
 /foo         |   ""            |   matches /foo only
 

Examples including wildcard char:

 NodePath = "/foo"
 Restriction   |   Matches
 -----------------------------------------------------------------------------
 *         |   all siblings of foo and foo's and the siblings' descendants
 /*cat     |   all children of /foo whose path ends with "cat"
 /*/cat    |   all non-direct descendants of /foo named "cat"
 /cat*     |   all descendant path of /foo that have the direct foo-descendant segment starting with "cat"
 *cat      |   all siblings and descendants of foo that have a name ending with cat
 */cat     |   all descendants of /foo and foo's siblings that have a name segment "cat"
 cat/*     |   all descendants of '/foocat'
 /cat/*    |   all descendants of '/foo/cat'
 *cat/*    |   all descendants of /foo that have an intermediate segment ending with 'cat'
 


Method Summary
static GlobPattern create(String nodePath)
           
static GlobPattern create(String nodePath, String restrictions)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean matches(Item itemToMatch)
           
 boolean matches(String toMatch)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static GlobPattern create(String nodePath,
                                 String restrictions)

create

public static GlobPattern create(String nodePath)

matches

public boolean matches(String toMatch)

matches

public boolean matches(Item itemToMatch)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(Object)


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.