Class PluginCache


  • public class PluginCache
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​PluginEntry>> categories  
    • Constructor Summary

      Constructors 
      Constructor Description
      PluginCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​PluginEntry>> getAllCategories()
      Returns all categories of plugins in this cache.
      java.util.Map<java.lang.String,​PluginEntry> getCategory​(java.lang.String category)
      Gets or creates a category of plugins.
      void loadCacheFiles​(java.util.Enumeration<java.net.URL> resources)
      Loads and merges all the Log4j plugin cache files specified.
      int size()
      Gets the number of plugin categories registered.
      void writeCache​(java.io.OutputStream os)
      Stores the plugin cache to a given OutputStream.
      • Methods inherited from class java.lang.Object

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

      • categories

        private final java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​PluginEntry>> categories
    • Constructor Detail

      • PluginCache

        public PluginCache()
    • Method Detail

      • getAllCategories

        public java.util.Map<java.lang.String,​java.util.Map<java.lang.String,​PluginEntry>> getAllCategories()
        Returns all categories of plugins in this cache.
        Returns:
        all categories of plugins in this cache.
        Since:
        2.1
      • getCategory

        public java.util.Map<java.lang.String,​PluginEntry> getCategory​(java.lang.String category)
        Gets or creates a category of plugins.
        Parameters:
        category - name of category to look up.
        Returns:
        plugin mapping of names to plugin entries.
      • writeCache

        public void writeCache​(java.io.OutputStream os)
                        throws java.io.IOException
        Stores the plugin cache to a given OutputStream.
        Parameters:
        os - destination to save cache to.
        Throws:
        java.io.IOException - if an I/O exception occurs.
      • loadCacheFiles

        public void loadCacheFiles​(java.util.Enumeration<java.net.URL> resources)
                            throws java.io.IOException
        Loads and merges all the Log4j plugin cache files specified. Usually, this is obtained via a ClassLoader.
        Parameters:
        resources - URLs to all the desired plugin cache files to load.
        Throws:
        java.io.IOException - if an I/O exception occurs.
      • size

        public int size()
        Gets the number of plugin categories registered.
        Returns:
        number of plugin categories in cache.