edu.mit.ai.psg.jeva
Class ClassPathMethods

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.ClassPathMethods

public class ClassPathMethods
extends Object

ClassPathMethods.findInClassPath searches classpath to obtain an input stream from either source directories or jar files; verifyPackageNameFromClassPath checks that a directory structure or jar file entry exists corresponding to a package name starting from some root in the class path.


Inner Class Summary
static class ClassPathMethods.ClassPathSearchResult
          Class for multiple value return of with found location path, input stream, and modification date
static class ClassPathMethods.StarFilenameFilter
          Filter to match filenames based on pattern with *'s in it
 
Field Summary
static String bootClassPath
          default: bootClassPath = System.getProperty("sun.boot.class.path");
static List classPaths
          memoizes getClassPathStrings after first call; set to null to decache
 
Constructor Summary
ClassPathMethods()
           
 
Method Summary
static void clearCaches()
          clear caches.
static String dotsToSeparators(String input)
          for example, if separator char is '/', then converts "java.io.File" to "java/io/File".
static String dotsToSeparators(String input, char separatorChar)
           
static ClassPathMethods.ClassPathSearchResult findBytecodesInClassPath(String fullClassName)
           
static ClassPathMethods.ClassPathSearchResult findInClassPath(List classPathStrings, String fullClassName, String suffix)
           
static ClassPathMethods.ClassPathSearchResult findSourceInClassPath(String fullClassName)
          classfilename should end in appropriate suffix, .java or .class, and should already have package "."'s converted to java.io.File.separator.
static List getClassPathStrings()
          creates class path from the following sources: bootClassPath jar files in the extension directories from System.getProperty("java.ext.dirs") application class path from System.getProperty("java.class.path") [See Java Extension Mechanism Specification, Application Class Path]
static List parseClassPathString(String classPathString)
           
static boolean verifyPackageNameFromClassPath(List classPathStrings, String fullPackageName)
           
static boolean verifyPackageNameFromClassPath(String fullPackageName)
          Verify there is a file system directory or zipfile directory in the classpath which corresponds to the package name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classPaths

public static List classPaths
memoizes getClassPathStrings after first call; set to null to decache

bootClassPath

public static String bootClassPath
default: bootClassPath = System.getProperty("sun.boot.class.path");
Constructor Detail

ClassPathMethods

public ClassPathMethods()
Method Detail

getClassPathStrings

public static List getClassPathStrings()
creates class path from the following sources:
  1. bootClassPath
  2. jar files in the extension directories from System.getProperty("java.ext.dirs")
  3. application class path from System.getProperty("java.class.path")
[See Java Extension Mechanism Specification, Application Class Path]

parseClassPathString

public static List parseClassPathString(String classPathString)

dotsToSeparators

public static String dotsToSeparators(String input)
for example, if separator char is '/', then converts "java.io.File" to "java/io/File". For now, assumes separator is single character: if File.separator.length() != 1, throws Error

dotsToSeparators

public static String dotsToSeparators(String input,
                                      char separatorChar)

findSourceInClassPath

public static ClassPathMethods.ClassPathSearchResult findSourceInClassPath(String fullClassName)
classfilename should end in appropriate suffix, .java or .class, and should already have package "."'s converted to java.io.File.separator. Returns an input stream so it can work on .jar files as well as directories in classpath.
Returns:
ClassPathMethods.ClassPathSearchResult to return multiple values; has fields
public String locationPath;
public InputStream stream;
public long modificationDate;

findBytecodesInClassPath

public static ClassPathMethods.ClassPathSearchResult findBytecodesInClassPath(String fullClassName)

findInClassPath

public static ClassPathMethods.ClassPathSearchResult findInClassPath(List classPathStrings,
                                                                     String fullClassName,
                                                                     String suffix)

verifyPackageNameFromClassPath

public static boolean verifyPackageNameFromClassPath(String fullPackageName)
Verify there is a file system directory or zipfile directory in the classpath which corresponds to the package name.
See Also:
clearCaches()

verifyPackageNameFromClassPath

public static boolean verifyPackageNameFromClassPath(List classPathStrings,
                                                     String fullPackageName)

clearCaches

public static void clearCaches()
clear caches. Only needed if jar files are rewritten or directory structure in classpath is changed.

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu