Class DefaultCockpitJarCache

  • All Implemented Interfaces:
    CockpitJarCache, java.io.Closeable, java.lang.AutoCloseable

    public class DefaultCockpitJarCache
    extends java.lang.Object
    implements CockpitJarCache
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(java.io.File rootPath, java.util.jar.JarFile jarFile, java.util.jar.JarEntry entry)
      Adds new result of searching for entry into cache
      void addJarFile​(java.io.File filePath, java.util.jar.JarFile jarFile)
      Adds a loaded jar file into cache
      void close()  
      boolean containsEntry​(java.io.File rootPath, java.lang.String resourceName)
      Checks whether result of searching for entry is cached
      boolean containsJarFile​(java.io.File filePath)
      Checks whether a jar file is cached
      protected java.lang.Object createEntryKey​(java.io.File rootPath, java.lang.String resourceName)  
      java.util.jar.JarEntry getEntry​(java.io.File rootPath, java.lang.String resourceName)
      Retrieves previously cached result of searching for entry
      java.util.jar.JarFile getEntryJarFile​(java.io.File rootPath, java.lang.String resourceName)
      Retrieves jar file of previously cached result of searching for entry
      java.util.jar.JarFile getJarFile​(java.io.File filePath)
      Retrieves a jar file from cache
      java.util.jar.JarEntry removeEntry​(java.io.File rootPath, java.lang.String resourceName)
      Removes previously cached result of searching for entry
      java.util.jar.JarFile removeJarFile​(java.io.File filePath)
      Removes a loaded jar file from cache
      • Methods inherited from class java.lang.Object

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

      • DefaultCockpitJarCache

        public DefaultCockpitJarCache()
    • Method Detail

      • addJarFile

        public void addJarFile​(java.io.File filePath,
                               java.util.jar.JarFile jarFile)
        Description copied from interface: CockpitJarCache
        Adds a loaded jar file into cache
        Specified by:
        addJarFile in interface CockpitJarCache
        Parameters:
        filePath - full path to jar file
        jarFile - loaded jar file
      • removeJarFile

        public java.util.jar.JarFile removeJarFile​(java.io.File filePath)
        Description copied from interface: CockpitJarCache
        Removes a loaded jar file from cache
        Specified by:
        removeJarFile in interface CockpitJarCache
        Parameters:
        filePath - full path to jar file
        Returns:
        jar file removed ot null if there was nothing cached for provided path
      • containsJarFile

        public boolean containsJarFile​(java.io.File filePath)
        Description copied from interface: CockpitJarCache
        Checks whether a jar file is cached
        Specified by:
        containsJarFile in interface CockpitJarCache
        Parameters:
        filePath - full path to jar file
        Returns:
        true if jar file is cached
      • getJarFile

        public java.util.jar.JarFile getJarFile​(java.io.File filePath)
        Description copied from interface: CockpitJarCache
        Retrieves a jar file from cache
        Specified by:
        getJarFile in interface CockpitJarCache
        Parameters:
        filePath - full path to jar file
        Returns:
        jar file or null if jar file is not cached
      • createEntryKey

        protected java.lang.Object createEntryKey​(java.io.File rootPath,
                                                  java.lang.String resourceName)
      • addEntry

        public void addEntry​(java.io.File rootPath,
                             java.util.jar.JarFile jarFile,
                             java.util.jar.JarEntry entry)
        Description copied from interface: CockpitJarCache
        Adds new result of searching for entry into cache
        Specified by:
        addEntry in interface CockpitJarCache
        Parameters:
        rootPath - root path, in which an entry was found
        jarFile - jar file in which an entry was found
        entry - entry found
      • removeEntry

        public java.util.jar.JarEntry removeEntry​(java.io.File rootPath,
                                                  java.lang.String resourceName)
        Description copied from interface: CockpitJarCache
        Removes previously cached result of searching for entry
        Specified by:
        removeEntry in interface CockpitJarCache
        Parameters:
        rootPath - root path, in which an entry was found
        resourceName - name of resource searched
        Returns:
        jar entry removed ot null if there was nothing cached for provided conditions
      • containsEntry

        public boolean containsEntry​(java.io.File rootPath,
                                     java.lang.String resourceName)
        Description copied from interface: CockpitJarCache
        Checks whether result of searching for entry is cached
        Specified by:
        containsEntry in interface CockpitJarCache
        Parameters:
        rootPath - root path, in should have been found
        resourceName - name of resource searched
      • getEntry

        public java.util.jar.JarEntry getEntry​(java.io.File rootPath,
                                               java.lang.String resourceName)
        Description copied from interface: CockpitJarCache
        Retrieves previously cached result of searching for entry
        Specified by:
        getEntry in interface CockpitJarCache
        Parameters:
        rootPath - root path, in should have been found
        resourceName - name of resource searched
        Returns:
        jar entry or null if jar entry is not cached
      • getEntryJarFile

        public java.util.jar.JarFile getEntryJarFile​(java.io.File rootPath,
                                                     java.lang.String resourceName)
        Description copied from interface: CockpitJarCache
        Retrieves jar file of previously cached result of searching for entry
        Specified by:
        getEntryJarFile in interface CockpitJarCache
        Parameters:
        rootPath - root path, in should have been found
        resourceName - name of resource searched
        Returns:
        jar entry or null if jar entry is not cached
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException