com.ibm.wala.client
Class AbstractAnalysisEngine

java.lang.Object
  extended by com.ibm.wala.client.AbstractAnalysisEngine
All Implemented Interfaces:
AnalysisEngine
Direct Known Subclasses:
EclipseProjectAnalysisEngine, JavaScriptAnalysisEngine, JavaSourceAnalysisEngine, SimpleThreadEscapeAnalysis

public abstract class AbstractAnalysisEngine
extends java.lang.Object
implements AnalysisEngine

Abstract base class for analysis engine implementations Some clients choose to build on this, but many don't. I usually don't in new code; I usually don't find the re-use enabled by this class compelling. I would probably nuke this except for some legacy code that uses it.


Nested Class Summary
static interface AbstractAnalysisEngine.EntrypointBuilder
           
 
Field Summary
protected  CallGraph cg
          Governing call graph
protected static int DEBUG_LEVEL
          DEBUG_LEVEL: 0 No output 1 Print some simple stats and warning information 2 Detailed debugging
protected  Module[] j2seLibs
          The standard J2SE libraries to analyze
protected  java.util.Collection<Module> moduleFiles
          The modules to analyze
protected  PointerAnalysis pointerAnalysis
          Results of pointer analysis
protected  AnalysisScope scope
          A representation of the analysis scope
static java.lang.String SYNTHETIC_J2SE_MODEL
           
 
Constructor Summary
AbstractAnalysisEngine()
           
 
Method Summary
protected  void addApplicationModulesToScope()
          Add the application modules to the analysis scope.
 void buildAnalysisScope()
          Set up the AnalysisScope object
protected  CallGraphBuilder buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, MonitorUtil.IProgressMonitor monitor)
           
 IClassHierarchy buildClassHierarchy()
           
 CallGraph buildDefaultCallGraph()
           
 CallGraphBuilder defaultCallGraphBuilder()
          Builds the call graph for the analysis scope in effect, using all of the given entry points.
 AnalysisCache getCache()
           
protected  CallGraph getCallGraph()
           
protected abstract  CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache)
           
 IClassHierarchy getClassHierarchy()
           
 AnalysisOptions getDefaultOptions(java.lang.Iterable<Entrypoint> entrypoints)
          Get the default analysis options appropriate for this engine
 java.lang.String getExclusionsFile()
           
 HeapGraph getHeapGraph()
           
 AnalysisOptions getOptions()
           
 PointerAnalysis getPointerAnalysis()
           
protected  AnalysisScope getScope()
           
 boolean isClosedWorld()
           
 AnalysisCache makeDefaultCache()
           
protected  java.lang.Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha)
           
protected  void setClassHierarchy(IClassHierarchy cha)
           
 void setClosedWorld(boolean b)
          Specify whether the engine should or should not employ "closed-world" analysis.
 void setEntrypointBuilder(AbstractAnalysisEngine.EntrypointBuilder builder)
           
 void setExclusionsFile(java.lang.String exclusionsFile)
           
 void setJ2SELibraries(java.util.jar.JarFile[] libs)
          Specify the jar files that represent the standard J2SE libraries
 void setJ2SELibraries(Module[] libs)
          Specify the mdoules that represent the standard J2SE libraries
 void setModuleFiles(java.util.Collection moduleFiles)
          Specify the list of modules that should be analyzed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYNTHETIC_J2SE_MODEL

public static final java.lang.String SYNTHETIC_J2SE_MODEL
See Also:
Constant Field Values

DEBUG_LEVEL

protected static final int DEBUG_LEVEL
DEBUG_LEVEL:

See Also:
Constant Field Values

moduleFiles

protected java.util.Collection<Module> moduleFiles
The modules to analyze


scope

protected AnalysisScope scope
A representation of the analysis scope


j2seLibs

protected Module[] j2seLibs
The standard J2SE libraries to analyze


cg

protected CallGraph cg
Governing call graph


pointerAnalysis

protected PointerAnalysis pointerAnalysis
Results of pointer analysis

Constructor Detail

AbstractAnalysisEngine

public AbstractAnalysisEngine()
Method Detail

getCallGraphBuilder

protected abstract CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha,
                                                        AnalysisOptions options,
                                                        AnalysisCache cache)

buildCallGraph

protected CallGraphBuilder buildCallGraph(IClassHierarchy cha,
                                          AnalysisOptions options,
                                          boolean savePointerAnalysis,
                                          MonitorUtil.IProgressMonitor monitor)
                                   throws java.lang.IllegalArgumentException,
                                          CancelException
Throws:
java.lang.IllegalArgumentException
CancelException

setModuleFiles

public void setModuleFiles(java.util.Collection moduleFiles)
Description copied from interface: AnalysisEngine
Specify the list of modules that should be analyzed. If an EARFile is included in the list, all of its contained modules should be examined. Multiple ear files can be specified for cross-app invocations, which will become increasingly common in the 5.1 release.

Specified by:
setModuleFiles in interface AnalysisEngine
Parameters:
moduleFiles - A non-null Collection of module files: (EARFile, WARFile, ApplicationClientFile, EJBJarFile).

buildAnalysisScope

public void buildAnalysisScope()
                        throws java.io.IOException
Set up the AnalysisScope object

Throws:
java.io.IOException

buildClassHierarchy

public IClassHierarchy buildClassHierarchy()
Returns:
a IClassHierarchy object for this analysis scope

getClassHierarchy

public IClassHierarchy getClassHierarchy()

setClassHierarchy

protected void setClassHierarchy(IClassHierarchy cha)

getCallGraph

protected CallGraph getCallGraph()
Returns:
Returns the call graph

addApplicationModulesToScope

protected void addApplicationModulesToScope()
Add the application modules to the analysis scope.


setJ2SELibraries

public void setJ2SELibraries(java.util.jar.JarFile[] libs)
Description copied from interface: AnalysisEngine
Specify the jar files that represent the standard J2SE libraries

Specified by:
setJ2SELibraries in interface AnalysisEngine
Parameters:
libs - an array of jar files; usually rt.jar for vanilla JDK core.jar, server.jar, and xml.jar for some WAS runtimes

setJ2SELibraries

public void setJ2SELibraries(Module[] libs)
Description copied from interface: AnalysisEngine
Specify the mdoules that represent the standard J2SE libraries

Specified by:
setJ2SELibraries in interface AnalysisEngine
Parameters:
libs - an array of Modules; usually rt.jar for vanilla JDK core.jar, server.jar, and xml.jar for some WAS runtimes

setClosedWorld

public void setClosedWorld(boolean b)
Description copied from interface: AnalysisEngine
Specify whether the engine should or should not employ "closed-world" analysis. In a closed-world analysis, the engine considers only application client main methods and servlet entrypoints to the application. In an open-world analysis, the engine additionally considers all EJB local and remote interface methods as entrypoints. By default, this property is false; the default analysis is open-world

Specified by:
setClosedWorld in interface AnalysisEngine
Parameters:
b - whether to use closed-world analysis

isClosedWorld

public boolean isClosedWorld()

getScope

protected AnalysisScope getScope()

getPointerAnalysis

public PointerAnalysis getPointerAnalysis()

getHeapGraph

public HeapGraph getHeapGraph()

getExclusionsFile

public java.lang.String getExclusionsFile()

setExclusionsFile

public void setExclusionsFile(java.lang.String exclusionsFile)

getDefaultOptions

public AnalysisOptions getDefaultOptions(java.lang.Iterable<Entrypoint> entrypoints)
Description copied from interface: AnalysisEngine
Get the default analysis options appropriate for this engine

Specified by:
getDefaultOptions in interface AnalysisEngine

makeDefaultCache

public AnalysisCache makeDefaultCache()

makeDefaultEntrypoints

protected java.lang.Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope,
                                                                IClassHierarchy cha)

setEntrypointBuilder

public void setEntrypointBuilder(AbstractAnalysisEngine.EntrypointBuilder builder)

defaultCallGraphBuilder

public CallGraphBuilder defaultCallGraphBuilder()
                                         throws java.lang.IllegalArgumentException,
                                                CancelException,
                                                java.io.IOException
Builds the call graph for the analysis scope in effect, using all of the given entry points.

Throws:
CancelException
java.lang.IllegalArgumentException
java.io.IOException

buildDefaultCallGraph

public CallGraph buildDefaultCallGraph()
                                throws java.lang.IllegalArgumentException,
                                       CancelException,
                                       java.io.IOException
Throws:
java.lang.IllegalArgumentException
CancelException
java.io.IOException

getCache

public AnalysisCache getCache()

getOptions

public AnalysisOptions getOptions()