delete a bunch of old crap
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2279 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
3adf980b9c
commit
456d36e550
|
@ -7,8 +7,6 @@ Bundle-Vendor: %VENDORNAME
|
|||
Bundle-Localization: plugin
|
||||
Export-Package: .,
|
||||
com.ibm.wala.j2ee,
|
||||
com.ibm.wala.j2ee.client,
|
||||
com.ibm.wala.j2ee.client.impl,
|
||||
com.ibm.wala.j2ee.util
|
||||
Require-Bundle: com.ibm.wala.core;visibility:=reexport,
|
||||
org.eclipse.jem;visibility:=reexport,
|
||||
|
|
|
@ -1,25 +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;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface to information about an array
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface IArrayContents {
|
||||
|
||||
/**
|
||||
* @return declared type of this array
|
||||
*/
|
||||
IClass getDeclaredClass();
|
||||
}
|
|
@ -1,39 +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;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface to information about a class.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface IClass {
|
||||
/**
|
||||
* This method returns something like "Primordial" or "Application"
|
||||
*
|
||||
* @return String representation of the name of the classloader
|
||||
*/
|
||||
public abstract String getClassLoaderName();
|
||||
/**
|
||||
* This method returns something like com.ibm.foo.Foo
|
||||
*
|
||||
* @return String representation of the name of the method
|
||||
*/
|
||||
public abstract String getName();
|
||||
/**
|
||||
* This method returns something like com.ibm.foo
|
||||
*
|
||||
* @return String representation of the name of the package
|
||||
*/
|
||||
public abstract String getPackage();
|
||||
|
||||
}
|
|
@ -1,39 +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;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface to information about a field.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface IField {
|
||||
/**
|
||||
* This method returns something of the form com.foo.bar
|
||||
*
|
||||
* @return String representation of the declaring class
|
||||
*/
|
||||
public abstract IClass getDeclaringClass();
|
||||
/**
|
||||
* This method returns something like "Primordial" or "Application"
|
||||
*
|
||||
* @return String representation of the name of the classloader
|
||||
*/
|
||||
public abstract String getClassLoaderName();
|
||||
/**
|
||||
* This method returns something like createLargeOrder
|
||||
*
|
||||
* @return String representation of the name of the method
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
}
|
|
@ -1,56 +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;
|
||||
|
||||
/**
|
||||
* Interface to information about a method.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface IMethod {
|
||||
/**
|
||||
* This method returns something of the form com.foo.bar
|
||||
*
|
||||
* @return String representation of the declaring class
|
||||
*/
|
||||
public abstract IClass getDeclaringClass();
|
||||
/**
|
||||
* This method returns something like "Primordial" or "Application"
|
||||
*
|
||||
* @return String representation of the name of the classloader
|
||||
*/
|
||||
public abstract String getClassLoaderName();
|
||||
/**
|
||||
* This method returns something like createLargeOrder
|
||||
*
|
||||
* @return String representation of the name of the method
|
||||
*/
|
||||
public abstract String getName();
|
||||
/**
|
||||
* A descriptor is a string like:
|
||||
* (IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
|
||||
* @return String representation of the signature
|
||||
*/
|
||||
public abstract String getDescriptor();
|
||||
/**
|
||||
* A signature is a string like:
|
||||
* com.foo.bar.createLargeOrder(IILjava/lang/String;SLjava/sql/Date;)Ljava/lang/Integer;
|
||||
* @return String representation of the signature
|
||||
*/
|
||||
public abstract String getSignature();
|
||||
/**
|
||||
* A selector is a string like:
|
||||
* createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
|
||||
* @return String representation of the selector
|
||||
*/
|
||||
public abstract String getSelector();
|
||||
}
|
|
@ -1,27 +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;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents a static program location, a bytecode index in a method
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface IProgramLocation {
|
||||
|
||||
IMethod getMethod();
|
||||
|
||||
int getBytecodeIndex();
|
||||
|
||||
int getLineNumber();
|
||||
}
|
|
@ -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 J2EEAnalysisEngine 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);
|
||||
|
||||
}
|
|
@ -1,61 +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 com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.j2ee.DeploymentMetaData;
|
||||
import com.ibm.wala.j2ee.J2EEAnalysisScope;
|
||||
|
||||
/**
|
||||
*
|
||||
* A factory for call graph builders; tailored to J2EE
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public interface J2EECallGraphBuilderFactory extends com.ibm.wala.client.CallGraphBuilderFactory {
|
||||
|
||||
public final static String IMPL_PROPERTY = "callGraphBuilderFactoryImplementation";
|
||||
|
||||
public final static String RTA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.RTABuilderFactory";
|
||||
|
||||
public final static String XTA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.XTABuilderFactory";
|
||||
|
||||
public final static String XTA_CONTAINER_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.XTAContainerBuilderFactory";
|
||||
|
||||
public final static String ZERO_CFA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.ZeroCFABuilderFactory";
|
||||
|
||||
public final static String ZERO_CONTAINER_CFA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.ZeroContainerCFABuilderFactory";
|
||||
|
||||
public final static String ZERO_ONE_CFA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.ZeroOneCFABuilderFactory";
|
||||
|
||||
public final static String ZERO_ONE_CONTAINER_CFA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.ZeroOneContainerCFABuilderFactory";
|
||||
|
||||
public final static String OBJECT_SENSITIVE_CONTAINER_HACK_CFA_BUILDER_FACTORY = "com.ibm.wala.j2ee.client.impl.ObjectSensitiveContainerHackCFABuilderFactory";
|
||||
|
||||
/**
|
||||
* @param options
|
||||
* options that govern call graph construction
|
||||
* @param cha
|
||||
* governing class hierarchy
|
||||
* @param scope
|
||||
* representation of the analysis scope
|
||||
* @param dmd
|
||||
* deployment descriptor abstraction
|
||||
* @param keepPointsTo
|
||||
* preserve PointsTo graph for posterity?
|
||||
*
|
||||
*/
|
||||
CallGraphBuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, J2EEAnalysisScope scope, DeploymentMetaData dmd,
|
||||
boolean keepPointsTo);
|
||||
}
|
|
@ -1,51 +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 com.ibm.wala.j2ee.client.IArrayContents;
|
||||
import com.ibm.wala.j2ee.client.IClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* Object to track array contents in analysis results
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public class ArrayContentsImpl implements IArrayContents {
|
||||
|
||||
private final IClass klass;
|
||||
|
||||
public ArrayContentsImpl(IClass klass) {
|
||||
this.klass = klass;
|
||||
}
|
||||
|
||||
|
||||
public IClass getDeclaredClass() {
|
||||
return klass;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ArrayContents:" + klass;
|
||||
}
|
||||
|
||||
public boolean equals(Object arg0) {
|
||||
if (getClass().equals(arg0.getClass())) {
|
||||
ArrayContentsImpl that = (ArrayContentsImpl)arg0;
|
||||
return klass.equals(that.klass);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return 653 * klass.hashCode();
|
||||
}
|
||||
}
|
|
@ -1,46 +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.Properties;
|
||||
|
||||
import com.ibm.wala.j2ee.client.J2EECallGraphBuilderFactory;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
||||
/**
|
||||
*
|
||||
* A factory for creating a call graph builder factory
|
||||
*
|
||||
* @author Stephen Fink
|
||||
*/
|
||||
|
||||
public class CallGraphBuilderFactoryFactory {
|
||||
|
||||
/**
|
||||
* Construct a CallGraphBuilderFactory
|
||||
*
|
||||
* @param props Optionally, influence the construction of the engine.
|
||||
* @return A non-null AppAnalysisEngine instance.
|
||||
*/
|
||||
public static J2EECallGraphBuilderFactory getCallGraphBuilderFactory(Properties props) {
|
||||
try {
|
||||
String klass = "com.ibm.wala.j2ee.client.impl.RTABuilderFactory";
|
||||
if (props != null) {
|
||||
klass = props.getProperty("analysis", "com.ibm.wala.j2ee.client.impl.RTABuilderFactory");
|
||||
}
|
||||
return (J2EECallGraphBuilderFactory) Class.forName(klass).newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Assertions.UNREACHABLE();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,103 +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 com.ibm.wala.j2ee.client.IClass;
|
||||
import com.ibm.wala.util.ImmutableByteArray;
|
||||
import com.ibm.wala.util.StringStuff;
|
||||
|
||||
/**
|
||||
*
|
||||
* A representation of a class used to communicate analysis results.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public class ClassImpl implements IClass {
|
||||
|
||||
private final String classLoader;
|
||||
private final String name;
|
||||
private final String pack;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ClassImpl(com.ibm.wala.classLoader.IClass klass) {
|
||||
this(klass.getReference().getName().toString(),klass.getClassLoader().getName().toString());
|
||||
}
|
||||
|
||||
public ClassImpl(String name, String classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
this.name = name;
|
||||
String canon = StringStuff.deployment2CanonicalTypeString(name);
|
||||
ImmutableByteArray b = StringStuff.parseForPackage(new ImmutableByteArray(canon.getBytes()));
|
||||
this.pack = (b == null) ? null : b.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.atk.Method#getClassLoaderName()
|
||||
*/
|
||||
|
||||
public String getClassLoaderName() {
|
||||
return classLoader;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.atk.Method#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public int hashCode() {
|
||||
return getClassLoaderName().hashCode() * 4003 + getName().hashCode();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object arg0) {
|
||||
if (arg0 == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass().equals(arg0.getClass())) {
|
||||
ClassImpl other = (ClassImpl) arg0;
|
||||
return getName().equals(other.getName()) && getClassLoaderName().equals(other.getClassLoaderName());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.j2ee.client.IClass#getPackage()
|
||||
*/
|
||||
public String getPackage() {
|
||||
return pack;
|
||||
}
|
||||
}
|
|
@ -1,50 +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 com.ibm.wala.j2ee.client.IField;
|
||||
import com.ibm.wala.types.FieldReference;
|
||||
|
||||
/**
|
||||
*
|
||||
* Object to track a field in analysis results
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public class FieldImpl extends MemberImpl implements IField {
|
||||
|
||||
/**
|
||||
* @param f data structure representing a field
|
||||
*/
|
||||
public FieldImpl(FieldReference f) {
|
||||
super(f);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return getDeclaringClass() + "." + getName();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.ibm.wala.j2ee.client.impl.MemberImpl#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object arg0) {
|
||||
if (arg0 == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass().equals(arg0.getClass())) {
|
||||
FieldImpl other = (FieldImpl)arg0;
|
||||
return getName().equals(other.getName()) && getClassLoaderName().equals(other.getClassLoaderName());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,150 +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.io.IOException;
|
||||
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.client.impl.AbstractAnalysisEngine;
|
||||
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.J2EECallGraphBuilderFactory;
|
||||
import com.ibm.wala.j2ee.client.J2EEAnalysisEngine;
|
||||
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 J2EEAbstractAnalysisEngine extends AbstractAnalysisEngine implements J2EEAnalysisEngine {
|
||||
|
||||
/**
|
||||
* A representation of the deployment descriptor
|
||||
*/
|
||||
private DeploymentMetaData dmd;
|
||||
|
||||
/**
|
||||
* The J2EE libraries to analyze
|
||||
*/
|
||||
private Module[] j2eeLibs;
|
||||
|
||||
/**
|
||||
* Should we analyze dependent jar files?
|
||||
*/
|
||||
private boolean dependentJars = true;
|
||||
|
||||
protected J2EEAbstractAnalysisEngine() {
|
||||
}
|
||||
|
||||
protected CallGraphBuilder getCallGraphBuilder(ClassHierarchy cha, AnalysisOptions options) {
|
||||
return ((J2EECallGraphBuilderFactory) getCallGraphBuilderFactory()).make(options, getCache(), cha, (J2EEAnalysisScope) getScope(), getDmd(),
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the AnalysisScope object
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void buildAnalysisScope() throws IOException {
|
||||
buildAnalysisScope(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the AnalysisScope object
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void buildAnalysisScope(String exclusionsFile) throws IOException {
|
||||
// set up the scope of the analysis
|
||||
ClassLoader cl = J2EEAbstractAnalysisEngine.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 analysis 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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DeploymentMetaData getDmd() {
|
||||
return dmd;
|
||||
}
|
||||
|
||||
|
||||
protected void setDmd(DeploymentMetaData dmd) {
|
||||
this.dmd = dmd;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDependentJars() {
|
||||
return dependentJars;
|
||||
}
|
||||
|
||||
|
||||
public void setDependentJars(boolean dependentJars) {
|
||||
this.dependentJars = dependentJars;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +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 com.ibm.wala.j2ee.client.IClass;
|
||||
import com.ibm.wala.types.MemberReference;
|
||||
|
||||
/**
|
||||
*
|
||||
* A representation of a field used to communicate analysis results.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public abstract class MemberImpl {
|
||||
|
||||
private final IClass declaringClass;
|
||||
private final String name;
|
||||
|
||||
public MemberImpl(MemberReference m) {
|
||||
this.declaringClass = new ClassImpl(m.getDeclaringClass().getName().toString(),m.getDeclaringClass().getClassLoader().getName().toString());
|
||||
this.name = m.getName().toString();
|
||||
}
|
||||
|
||||
|
||||
public IClass getDeclaringClass() {
|
||||
return declaringClass;
|
||||
}
|
||||
|
||||
|
||||
public String getClassLoaderName() {
|
||||
return declaringClass.getClassLoaderName();
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
return getDeclaringClass().hashCode() * 4001 + getClassLoaderName().hashCode() * 4003 + getName().hashCode();
|
||||
}
|
||||
|
||||
public abstract boolean equals(Object arg0);
|
||||
}
|
|
@ -1,77 +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 com.ibm.wala.j2ee.client.IMethod;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
|
||||
/**
|
||||
*
|
||||
* A representation of a method used to communicate analysis results.
|
||||
*
|
||||
* @author sfink
|
||||
*/
|
||||
public class MethodImpl extends MemberImpl implements IMethod {
|
||||
|
||||
private final String descriptor;
|
||||
|
||||
public MethodImpl(MethodReference M) {
|
||||
super(M);
|
||||
descriptor = M.getDescriptor().toString();
|
||||
}
|
||||
|
||||
|
||||
public String getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* A signature is a string like:
|
||||
* com.foo.bar.createLargeOrder(IILjava.lang.String;SLjava.sql.Date;)Ljava.lang.Integer;
|
||||
*
|
||||
* @return String representation of the signature
|
||||
*/
|
||||
public String getSignature() {
|
||||
String s = getDeclaringClass().toString().substring(1).replace('/', '.') + "." + getName() + getDescriptor();
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
return getSignature();
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object arg0) {
|
||||
if (arg0 == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass().equals(arg0.getClass())) {
|
||||
MethodImpl other = (MethodImpl) arg0;
|
||||
return getDeclaringClass().equals(other.getDeclaringClass()) && getClassLoaderName().equals(other.getClassLoaderName())
|
||||
&& getName().equals(other.getName()) && descriptor.equals(other.descriptor);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
return getDeclaringClass().hashCode() * 4001 + getClassLoaderName().hashCode() * 4003 + getName().hashCode()
|
||||
+ descriptor.hashCode();
|
||||
}
|
||||
|
||||
|
||||
public String getSelector() {
|
||||
return getName() + descriptor;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,69 +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 com.ibm.wala.j2ee.client.IMethod;
|
||||
import com.ibm.wala.j2ee.client.IProgramLocation;
|
||||
|
||||
/**
|
||||
* @author sfink
|
||||
*/
|
||||
public class ProgramLocation implements IProgramLocation {
|
||||
|
||||
private final IMethod method;
|
||||
|
||||
private final int bytecodeIndex;
|
||||
|
||||
private final int lineNumber;
|
||||
|
||||
public ProgramLocation(IMethod method, int bytecodeIndex, int lineNumber) {
|
||||
this.method = method;
|
||||
this.bytecodeIndex = bytecodeIndex;
|
||||
this.lineNumber = lineNumber;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.j2ee.client.IProgramLocation#getMethod()
|
||||
*/
|
||||
public IMethod getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.j2ee.client.IProgramLocation#getBytecodeIndex()
|
||||
*/
|
||||
public int getBytecodeIndex() {
|
||||
return bytecodeIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.ibm.wala.j2ee.client.IProgramLocation#getLineNumber()
|
||||
*/
|
||||
public int getLineNumber() {
|
||||
return lineNumber;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return method + "@" + bytecodeIndex + "(line " + lineNumber + ")";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue