com.ibm.di.loader
Class IDILoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by com.ibm.di.loader.IDILoader

public class IDILoader
extends URLClassLoader

This class is responsible for loading classes from the jar files that are placed in the jars directory


Constructor Summary
IDILoader()
          Default constructor for the IDILoader object
 
Method Summary
 void addFiles(String path)
          Add all files in the given path to our internal list of jar files
 void addInstalledComponent(String path)
          Locate idi.inf in a jar file, and add it to the installedConfigs
 void addInstalledXMLComponent(String path)
          Locate tdi.xml in a jar file, and add it to the sysconfigs Vector
 void addPackages(File path)
          Add all files in the given path to our internal list of packages
static Vector<String> getAllSysConfigs()
          Returns a Vector with all the idi.inf files.
static List<String> getInstalledPackages()
          Provide a list of all installed packages.
static IDILoader getInstance()
          Provide an instance of IDILoader.
static String getModificationDate(String className)
          Returns the time a class was modified
 String getPathForClass(String clsname)
          Provides a path to a specified class.
 Class<?> loadClassFromFile(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.
 Class<?> loadClassFromFile(String path, String className)
          Locate all classes in a jar file, and define the classes found.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, 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 Vector<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 String getModificationDate(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 List<String> getInstalledPackages()
Provide a list of all installed packages.

Returns:
the list of installed packages

getPathForClass

public String getPathForClass(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(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(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(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(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 Class<?> loadClassFromFile(String fileName)
                           throws 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:
Exception - if an internal error occurs.

loadClassFromFile

public Class<?> loadClassFromFile(String path,
                                  String className)
Locate all classes in a jar file, and define the classes found.

Parameters:
path - The absolute path of the jar file