com.rational.test.ft

Class RationalFtClassLoader

  • java.lang.Object
    • java.lang.ClassLoader
      • com.rational.test.ft.RationalFtClassLoader


  • public class RationalFtClassLoader
    extends java.lang.ClassLoader
    This class loader is given a path when constructed, and it knows to load classes on that path. We'll use it to load our classes when we infest the SUT, giving it the path to where Functional Test jar is installed. This will allow us to load our classes into the SUT without being on the CLASSPATH.
    • Constructor Summary

      Constructors 
      Constructor and Description
      RationalFtClassLoader(java.lang.String[] path)
      Construct an FtClassLoader, and give it the path it should use for loading our classes.
      RationalFtClassLoader(java.lang.String[] path, java.lang.ClassLoader parentClassLoader)
      Construct an FtClassLoader, and give it the path it should use for loading our classes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void append(java.lang.String[] path)
      Append the specified directories and jars to the existing path
      protected java.net.URL findResource(java.lang.String name)
      Overrides the same-named method in ClassLoader.
      java.net.URL getResource(java.lang.String name)
      Overrides the same-named method in ClassLoader.
      java.io.InputStream getResourceAsStream(java.lang.String name)
      Overrides the same-named method in ClassLoader.
      protected java.lang.Class loadClass(java.lang.String name, boolean resolve)
      This overrides ClassLoader.loadClass().
      void prepend(java.lang.String[] path)
      Prepend the specified directories and jars to the existing path
      byte[] readFile(java.lang.String fileName)
      This is our readFile(), overriding the one in ClassLoader.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, clone, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

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

      • RationalFtClassLoader

        public RationalFtClassLoader(java.lang.String[] path)
        Construct an FtClassLoader, and give it the path it should use for loading our classes.
        Parameters:
        path - The directories and jars (separated by the path.separator
        See Also:
        File.pathSeparator
      • RationalFtClassLoader

        public RationalFtClassLoader(java.lang.String[] path,
                                     java.lang.ClassLoader parentClassLoader)
        Construct an FtClassLoader, and give it the path it should use for loading our classes.
        Parameters:
        path - The directories and jars (separated by the path.separator
        See Also:
        File.pathSeparator
    • Method Detail

      • loadClass

        protected java.lang.Class loadClass(java.lang.String name,
                                            boolean resolve)
                                     throws java.lang.ClassNotFoundException
        This overrides ClassLoader.loadClass(). The loadClass method loads a single class on our path.
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • readFile

        public byte[] readFile(java.lang.String fileName)
        This is our readFile(), overriding the one in ClassLoader. Return the byte contents of the given file, looking on our classpath.
        Parameters:
        fileName - The file name
        Returns:
        !null - the bytes

        null - not found.

      • getResourceAsStream

        public java.io.InputStream getResourceAsStream(java.lang.String name)
        Overrides the same-named method in ClassLoader.

        Returns an input stream for reading the specified resource.

        Overrides:
        getResourceAsStream in class java.lang.ClassLoader
        Parameters:
        name - the resource name
        Returns:
        an input stream for reading the resource, or null if the resource could not be found
        Since:
        JDK1.1
      • getResource

        public java.net.URL getResource(java.lang.String name)
        Overrides the same-named method in ClassLoader. Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.

        The name of a resource is a "/"-separated path name that identifies the resource.

        Overrides:
        getResource in class java.lang.ClassLoader
        Parameters:
        name - resource name
        Returns:
        a URL for reading the resource, or null if the resource could not be found or the caller doesn't have adequate privileges to get the resource.
        Since:
        JDK1.1
        See Also:
        findResource(String)
      • findResource

        protected java.net.URL findResource(java.lang.String name)
        Overrides the same-named method in ClassLoader. Finds the resource with the given name.
        Overrides:
        findResource in class java.lang.ClassLoader
        Parameters:
        name - the resource name
        Returns:
        a URL for reading the resource, or null if the resource could not be found
        Since:
        JDK1.2
      • append

        public void append(java.lang.String[] path)
        Append the specified directories and jars to the existing path
        Parameters:
        path - The directories and jars (separated by the path.separator
        See Also:
        File.pathSeparator
      • prepend

        public void prepend(java.lang.String[] path)
        Prepend the specified directories and jars to the existing path
        Parameters:
        path - The directories and jars (separated by the path.separator
        See Also:
        File.pathSeparator