Class PathManager<T>

java.lang.Object
jadex.publishservice.publish.PathManager<T>

public class PathManager<T> extends Object
The path manager helps resolving elements (handlers) for path with variables, e.g. a/{varb}/c. Using getBindings() one can get the concrete variable bindings for a given path/handler.
  • Field Details

    • pathparts

      protected List<Map<String,Collection<T>>> pathparts
      The list with maps per level. Each level has a map for looking up suitable elements. The results must be cut set.
    • addedpaths

      protected Map<T,String> addedpaths
      The exactly added paths of elements.
  • Constructor Details

    • PathManager

      public PathManager()
      Create a new info.
  • Method Details

    • addPathElement

      public void addPathElement(String path, T elem)
      Adds a new info.
      Parameters:
      path - The path.
      elem - The element.
    • getElementForPath

      public T getElementForPath(String path)
      Get the element for a path.
      Parameters:
      path - The path.
      Returns:
      The element.
    • getElementsForPath

      public Collection<T> getElementsForPath(String path)
      Get the element for a path.
      Parameters:
      path - The path.
      Returns:
      The element.
    • removeElementForPath

      public void removeElementForPath(String path)
      Parameters:
      path - Path being handled.
      vhost - Virtual host specification.
    • getBindingsForPath

      public Map<String,String> getBindingsForPath(String path)
      Get the variable bindings for path variables.
      Parameters:
      path - The path.
      Returns:
      The variables for the path.
    • getPathPartMap

      protected Map<String,Collection<T>> getPathPartMap(int level, boolean add)
      Get a path part map for a level.
      Parameters:
      level - The level.
      Returns:
      The map or null.
    • getPathDepth

      public int getPathDepth(String path)
      Get the path depth of an element.
      Parameters:
      path - The path.
      Returns:
      The path depth.
    • getPathDepth

      public int getPathDepth(T elem)
      Get the path depth of an element.
      Parameters:
      elem - The element.
      Returns:
      The path depth.
    • getPathForElement

      public String getPathForElement(T elem)
      Get the path for an element.
      Parameters:
      elem - The element.
      Returns:
      The added path.
    • size

      public int size()
      Get the number of added paths.
      Returns:
      The number of added paths.
    • getElements

      public Collection<T> getElements()
      Get the added elements.
    • main

      public static void main(String[] args)
      Main for testing.