rename J2EE analysis creator

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@502 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2006-12-07 17:14:55 +00:00
parent 7159e9eb9e
commit 67cb72785c
2 changed files with 0 additions and 201 deletions

View File

@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.j2ee.client;
import java.util.jar.JarFile;
import com.ibm.wala.classLoader.Module;
/**
*
* An AnalysisEngine analyzes one or more J2EE modules, including
* ear files, J2EE clients, web modules, and ejb modules.
*
* @author Logan Colby
* @author Stephen Fink
*/
public interface AnalysisEngine extends com.ibm.wala.client.AnalysisEngine {
/**
* Specify the jar file that represent the contents of the j2ee.jar
* that the application relies on
*
* @param libs an array of jar files; for WAS, j2ee.jar and webcontainer.jar
*/
void setJ2EELibraries(JarFile[] libs);
/**
* Specify the mdoules that represent the contents of the j2ee.jar
* that the application relies on
*
* @param libs an array of Modules; for WAS, j2ee.jar and webcontainer.jar
*/
void setJ2EELibraries(Module[] libs);
}

View File

@ -1,157 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package com.ibm.wala.j2ee.client.impl;
import java.util.Iterator;
import java.util.jar.JarFile;
import org.eclipse.jst.j2ee.commonarchivecore.internal.Archive;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.j2ee.DeploymentMetaData;
import com.ibm.wala.j2ee.J2EEAnalysisScope;
import com.ibm.wala.j2ee.client.AnalysisEngine;
import com.ibm.wala.j2ee.client.CallGraphBuilderFactory;
import com.ibm.wala.j2ee.util.TopLevelArchiveModule;
import com.ibm.wala.j2ee.util.TopLevelArchiveModule.BloatedArchiveModule;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.debug.Assertions;
/**
*
* abstract base class for analysis engine implementations
*
* @author sfink
*/
public abstract class AbstractAnalysisEngine extends com.ibm.wala.client.impl.AbstractAnalysisEngine implements AnalysisEngine {
/**
* A representation of the deployment descriptor
*/
private DeploymentMetaData dmd;
/**
* The J2EE libraries to analysze
*/
private Module[] j2eeLibs;
/**
* Should we analyze dependent jar files?
*/
private boolean dependentJars = true;
protected AbstractAnalysisEngine() {}
protected CallGraphBuilder getCallGraphBuilder(ClassHierarchy cha, AnalysisOptions options) {
return ((CallGraphBuilderFactory) getCallGraphBuilderFactory()).make(options, cha, (J2EEAnalysisScope) getScope(), getDmd(),
getWarnings(), false);
}
/**
* Set up the AnalysisScope object
*/
protected void buildAnalysisScope() {
buildAnalysisScope(null);
}
/**
* Set up the AnalysisScope object
*/
protected void buildAnalysisScope(String exclusionsFile) {
// set up the scope of the analysis
ClassLoader cl = AbstractAnalysisEngine.class.getClassLoader();
if (j2seLibs == null) {
Assertions.UNREACHABLE("no j2selibs specificed. You probably did not call AppAnalysisEngine.setJ2SELibrary.");
} else if (j2eeLibs == null) {
Assertions.UNREACHABLE("j2ee.jar is null. You probably did not call AnalysisEngine.setJ2EELibrary.");
} else {
scope = J2EEAnalysisScope.make(j2seLibs, j2eeLibs, exclusionsFile, cl, true);
}
addApplicationModulesToScope();
}
/**
* Add the application modules to the analyis scope.
*/
@SuppressWarnings({ "restriction", "unchecked" })
protected void addApplicationModulesToScope() {
ClassLoaderReference app = scope.getApplicationLoader();
for (Iterator<Archive> it = moduleFiles.iterator(); it.hasNext();) {
Archive A = (Archive) it.next();
// TODO: redesign to avoid holding onto BloatedArchives?
TopLevelArchiveModule M = new BloatedArchiveModule(A);
if (!dependentJars) {
M.setIgnoreDependentJars(true);
}
scope.addToScope(app, M);
}
}
/*
* (non-Javadoc)
*
* @see com.ibm.wala.atk.AppAnalysisEngine#setJ2EELibrary(java.util.jar.JarFile)
*/
public void setJ2EELibraries(JarFile[] libs) {
if (libs == null) {
Assertions.UNREACHABLE("Illegal to setJ2EELibrary(null)");
}
this.j2eeLibs = new Module[libs.length];
for (int i = 0; i < libs.length; i++) {
j2eeLibs[i] = new JarFileModule(libs[i]);
}
}
public void setJ2EELibraries(Module[] libs) {
if (libs == null) {
Assertions.UNREACHABLE("Illegal to setJ2EELibrary(null)");
}
this.j2eeLibs = new Module[libs.length];
for (int i = 0; i < libs.length; i++) {
j2eeLibs[i] = libs[i];
}
}
/**
* @return Returns the dmd.
*/
protected DeploymentMetaData getDmd() {
return dmd;
}
/**
* @param dmd
* The dmd to set.
*/
protected void setDmd(DeploymentMetaData dmd) {
this.dmd = dmd;
}
/**
* @return Returns the dependentJars.
*/
public boolean isDependentJars() {
return dependentJars;
}
/**
* @param dependentJars
* The dependentJars to set.
*/
public void setDependentJars(boolean dependentJars) {
this.dependentJars = dependentJars;
}
}