Package org.eclipse.steady.java
Class WarAnalyzer
- java.lang.Object
-
- org.eclipse.steady.java.JarAnalyzer
-
- org.eclipse.steady.java.WarAnalyzer
-
- All Implemented Interfaces:
Callable<FileAnalyzer>,FileAnalyzer,JarEntryWriter
@NotThreadSafe public class WarAnalyzer extends JarAnalyzer
Analyzes a single Web app archive (WAR) as to identify (and potentially instrument) all its classes (in directory WEB-INF/classes), as well as its JARs (in directory WEB-INF/lib).
-
-
Field Summary
-
Fields inherited from class org.eclipse.steady.java.JarAnalyzer
classCount, constructs, enumCount, instrControl, instrument, interfaceCount, jar, jarWriter, rename, url, workDir
-
-
Constructor Summary
Constructors Constructor Description WarAnalyzer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidanalyze(File _file)protected voidcreateInstrumentedArchive()See here: http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.htmlSet<FileAnalyzer>getChilds(boolean _recursive)Set<ConstructId>getConstructIds()Identifies allConstructIds of all methods and constructors.InputStreamgetInputStream(String _regex, JarEntry _entry)Callback used for rewriting particular JAR entries.String[]getSupportedFileExtensions()booleanhasChilds()voidsetIncludeDir(Path _p)Sets the directory containing JARs to be included in the rewritten WAR.voidsetRename(boolean _b)Determines whether the instrumented JAR is renamed or not.-
Methods inherited from class org.eclipse.steady.java.JarAnalyzer
call, canAnalyze, containsConstruct, equals, getAppContext, getClassNames, getClassPool, getConstruct, getConstructs, getFileName, getFileSize, getFqClassname, getInstrumentationControl, getInstrumentedArchive, getInstrumentedFileSize, getLibrary, getParent, getPath, getSHA1, getSharedConstructs, hashCode, hasJARConstructs, insertClasspath, isJavaIdentifier, setAppContext, setInstrument, setLibraryId, setParent, setWorkDir, toString
-
-
-
-
Method Detail
-
getSupportedFileExtensions
public String[] getSupportedFileExtensions()
- Specified by:
getSupportedFileExtensionsin interfaceFileAnalyzer- Overrides:
getSupportedFileExtensionsin classJarAnalyzer
-
analyze
public void analyze(File _file) throws FileAnalysisException
- Specified by:
analyzein interfaceFileAnalyzer- Overrides:
analyzein classJarAnalyzer- Throws:
FileAnalysisException
-
setIncludeDir
public void setIncludeDir(Path _p)
Sets the directory containing JARs to be included in the rewritten WAR. All JARs contained therein will be modified as well in order to set the application scope in the Vulas configuration file.- Parameters:
_p- aPathobject.
-
setRename
public void setRename(boolean _b)
Determines whether the instrumented JAR is renamed or not. If yes, the new file name follows the following format: - If app context is provided: [originalJarName]-vulas-[appGroupId]-[appArtifactId]-[appVersion].jar - Otherwise: [originalJarName]-vulas-instr.jar Determines whether the instrumented JAR is renamed or not. If yes, the new file name follows the following format: - If app context is provided: [originalJarName]-vulas-[appGroupId]-[appArtifactId]-[appVersion].jar - Otherwise: [originalJarName]-vulas.jar- Overrides:
setRenamein classJarAnalyzer- Parameters:
_b- a boolean.
-
createInstrumentedArchive
protected void createInstrumentedArchive() throws JarAnalysisExceptionSee here: http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html See here: http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html- Overrides:
createInstrumentedArchivein classJarAnalyzer- Throws:
JarAnalysisException
-
hasChilds
public boolean hasChilds()
- Specified by:
hasChildsin interfaceFileAnalyzer- Overrides:
hasChildsin classJarAnalyzer
-
getChilds
public Set<FileAnalyzer> getChilds(boolean _recursive)
- Specified by:
getChildsin interfaceFileAnalyzer- Overrides:
getChildsin classJarAnalyzer
-
getConstructIds
public Set<ConstructId> getConstructIds()
Identifies allConstructIds of all methods and constructors. Identifies allConstructIds of all methods and constructors contained in the WAR file. Returns true if the WAR has classes in WEB-INF/classes, false otherwise. Note that classes in libraries contained in WEB-INF/lib are ignored.- Overrides:
getConstructIdsin classJarAnalyzer- Returns:
- a
Setobject.
-
getInputStream
public InputStream getInputStream(String _regex, JarEntry _entry)
Callback used for rewriting particular JAR entries. Return null to rewrite the original JAR entry. In case the archive is rewritten, this method is used to rewrite certainJarEntrys (rather than taking the file from the original archive). The callback registration takes place inJarAnalyzer.createInstrumentedArchive(). In case the archive is rewritten, this method is used to rewrite certainJarEntrys (rather than taking the file from the original archive). The callback registration takes place increateInstrumentedArchive().- Specified by:
getInputStreamin interfaceJarEntryWriter- Overrides:
getInputStreamin classJarAnalyzer- Parameters:
_regex- aStringobject._entry- aJarEntryobject.- Returns:
- a
InputStreamobject.
-
-