Class IDILoader

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

    public class IDILoader
    extends java.net.URLClassLoader
    This class is responsible for loading classes from the jar files that are placed in the jars directory
    • Constructor Summary

      Constructors 
      Constructor Description
      IDILoader()
      Default constructor for the IDILoader object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addFiles​(java.lang.String path)
      Add all files in the given path to our internal list of jar files
      void addInstalledComponent​(java.lang.String path)
      Locate idi.inf in a jar file, and add it to the installedConfigs
      void addInstalledXMLComponent​(java.lang.String path)
      Locate tdi.xml in a jar file, and add it to the sysconfigs Vector
      void addPackages​(java.io.File path)
      Add all files in the given path to our internal list of packages
      static java.util.Vector<java.lang.String> getAllSysConfigs()
      Returns a Vector with all the idi.inf files.
      static java.util.List<java.lang.String> getInstalledPackages()
      Provide a list of all installed packages.
      static IDILoader getInstance()
      Provide an instance of IDILoader.
      static java.lang.String getModificationDate​(java.lang.String className)
      Returns the time a class was modified
      java.lang.String getPathForClass​(java.lang.String clsname)
      Provides a path to a specified class.
      java.lang.Class<?> loadClassFromFile​(java.lang.String fileName)
      Load a Class from a .class file Try to avoid duplicate defining of classes by keeping a local cache, which maps from fileName to class.
      java.lang.Class<?> loadClassFromFile​(java.lang.String path, java.lang.String className)
      Locate all classes in a jar file, and define the classes found.
      • Methods inherited from class java.net.URLClassLoader

        addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
      • Methods inherited from class java.security.SecureClassLoader

        defineClass, defineClass
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, clone, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

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

      • IDILoader

        public IDILoader()
        Default constructor for the IDILoader object
    • Method Detail

      • getAllSysConfigs

        public static java.util.Vector<java.lang.String> getAllSysConfigs()
        Returns a Vector with all the idi.inf files.
        Returns:
        Vector containing Strings, each String is the URL for an idi.inf file.
        Since:
        7.0
      • getModificationDate

        public static java.lang.String getModificationDate​(java.lang.String className)
        Returns the time a class was modified
        Parameters:
        className - the name of the class
        Returns:
        The modification time as a String or null if not found
      • getInstalledPackages

        public static java.util.List<java.lang.String> getInstalledPackages()
        Provide a list of all installed packages.
        Returns:
        the list of installed packages
      • getPathForClass

        public java.lang.String getPathForClass​(java.lang.String clsname)
        Provides a path to a specified class. This is the Jar file where the specified class is located.
        Parameters:
        clsname - the name of the class which path to get
        Returns:
        the path from which a class is/will be loaded.
      • addFiles

        public void addFiles​(java.lang.String path)
        Add all files in the given path to our internal list of jar files
        Parameters:
        path - The path of the file(s) to be added
      • addPackages

        public void addPackages​(java.io.File path)
        Add all files in the given path to our internal list of packages
        Parameters:
        path - The path of the file(s) to be added
      • addInstalledComponent

        public void addInstalledComponent​(java.lang.String path)
        Locate idi.inf in a jar file, and add it to the installedConfigs
        Parameters:
        path - The absolute path of the jar file
      • addInstalledXMLComponent

        public void addInstalledXMLComponent​(java.lang.String path)
        Locate tdi.xml in a jar file, and add it to the sysconfigs Vector
        Parameters:
        path - The absolute path of the jar file
      • getInstance

        public static IDILoader getInstance()
        Provide an instance of IDILoader.
        Returns:
        the first instance of IDILoader that was created.
        Since:
        7.0
      • loadClassFromFile

        public java.lang.Class<?> loadClassFromFile​(java.lang.String fileName)
                                             throws java.lang.Exception
        Load a Class from a .class file Try to avoid duplicate defining of classes by keeping a local cache, which maps from fileName to class.
        Parameters:
        fileName - - The name of the .class file
        Returns:
        - The loaded class
        Throws:
        java.lang.Exception - if an internal error occurs.
      • loadClassFromFile

        public java.lang.Class<?> loadClassFromFile​(java.lang.String path,
                                                    java.lang.String className)
        Locate all classes in a jar file, and define the classes found.
        Parameters:
        path - The absolute path of the jar file