org.makumba.analyser.engine
Class JavaParseData

java.lang.Object
  extended by org.makumba.analyser.engine.JavaParseData
All Implemented Interfaces:
SourceSyntaxPoints.PreprocessorClient

public class JavaParseData
extends Object
implements SourceSyntaxPoints.PreprocessorClient

This class performs a rudimentary detection of Java syntax elements in a Java class.

Author:
Rudolf Mayer

Field Summary
static String[] AllHighlightableTokens
           
static int analyzedPages
          Cache of all page analyses.
(package private)  JavaAnalyzer analyzer
          The analyzer plugged in.
(package private)  File file
          The Java file path
(package private)  Object holder
          The holder of the analysis status, and partial results.
(package private)  HashSet<String> importedPackages
          The set of in this class imported packages.
static String JAVA_STRING_LITERAL
           
(package private)  SourceSyntaxPoints syntaxPoints
          The syntax points of this page.
(package private)  String uri
          The Java URI, for debugging purposes.
 
Constructor Summary
protected JavaParseData(String path, JavaAnalyzer an, String uri)
          Private constructor, construction can only be made by getParseData().
 
Method Summary
 Object getAnalysisResult(Object initStatus)
          This method will perform the analysis if not performed already, or if the file has changed. the method is synchronized, so other accesses are blocked if the current access determines that an analysis needs be performed
 String[] getCommentPatternNames()
           
 Pattern[] getCommentPatterns()
           
 String getDefinedObjectClassName(String objectName, int position)
           
 Hashtable<String,String> getImportedClasses()
           
 HashSet<String> getImportedPackages()
          Gets the imported packages found in this java class.
 Pattern getIncludePattern()
           
 String getIncludePatternName()
           
 String[] getLiteralPatternNames()
           
 Pattern[] getLiteralPatterns()
           
static JavaParseData getParseData(String webappRoot, String path, JavaAnalyzer an)
          Return the pageData of the class at the given path in the given webapp.
 String getSuperClass()
           
 SyntaxPoint[] getSyntaxPointArray(Object initStatus)
           
 SourceSyntaxPoints getSyntaxPoints()
          Gets the collection of syntax points.
 String getViewedClass()
           
static boolean isClassUsageSyntaxPoint(String type)
           
static boolean isCommentSyntaxPoint(String type)
           
static boolean isPrimitiveType(String type)
           
(package private)  void parse(Object initStatus)
          Parses the file.
static boolean shallHighlight(String keyWord)
           
(package private)  void treatClassUsage(String content, JavaAnalyzer an)
           
 void treatInclude(int position, String includeDirective, SyntaxPoint start, SyntaxPoint end, SourceSyntaxPoints host)
           
(package private)  void treatJavaImports(String content, JavaAnalyzer an)
          Go thru the java import statments in the class.
(package private)  void treatJavaModifiers(String content, JavaAnalyzer an)
          Go thru the java modifiers in the class.
(package private)  void treatJavaStringLiterals(String content, JavaAnalyzer an)
          Go thru the java String Literals in the class.
(package private)  void treatMakumbaHandler(String content, JavaAnalyzer an)
           
(package private)  void treatMethodUsage(String content, JavaAnalyzer an)
           
(package private)  void treatReservedWords(String content, JavaAnalyzer an)
          Go thru the reserved words in the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JAVA_STRING_LITERAL

public static final String JAVA_STRING_LITERAL
See Also:
Constant Field Values

AllHighlightableTokens

public static String[] AllHighlightableTokens

analyzedPages

public static int analyzedPages
Cache of all page analyses.


analyzer

JavaAnalyzer analyzer
The analyzer plugged in.


file

File file
The Java file path


holder

Object holder
The holder of the analysis status, and partial results.


syntaxPoints

SourceSyntaxPoints syntaxPoints
The syntax points of this page.


uri

String uri
The Java URI, for debugging purposes.


importedPackages

HashSet<String> importedPackages
The set of in this class imported packages.

Constructor Detail

JavaParseData

protected JavaParseData(String path,
                        JavaAnalyzer an,
                        String uri)
Private constructor, construction can only be made by getParseData().

Method Detail

shallHighlight

public static boolean shallHighlight(String keyWord)

isCommentSyntaxPoint

public static boolean isCommentSyntaxPoint(String type)

isClassUsageSyntaxPoint

public static boolean isClassUsageSyntaxPoint(String type)

isPrimitiveType

public static boolean isPrimitiveType(String type)

getParseData

public static JavaParseData getParseData(String webappRoot,
                                         String path,
                                         JavaAnalyzer an)
Return the pageData of the class at the given path in the given webapp. This is the only way for clients of this class to obtain instances of JavaPageData


getAnalysisResult

public Object getAnalysisResult(Object initStatus)
This method will perform the analysis if not performed already, or if the file has changed. the method is synchronized, so other accesses are blocked if the current access determines that an analysis needs be performed

Parameters:
initStatus - an initial status to be passed to the JavaAnalyzer. for example, the pageContext for an example-based analyzer

getSyntaxPointArray

public SyntaxPoint[] getSyntaxPointArray(Object initStatus)
Specified by:
getSyntaxPointArray in interface SourceSyntaxPoints.PreprocessorClient

getImportedPackages

public HashSet<String> getImportedPackages()
Gets the imported packages found in this java class.

Returns:
A collection of Strings denoting package names.

getImportedClasses

public Hashtable<String,String> getImportedClasses()

getCommentPatternNames

public String[] getCommentPatternNames()
Specified by:
getCommentPatternNames in interface SourceSyntaxPoints.PreprocessorClient

getCommentPatterns

public Pattern[] getCommentPatterns()
Specified by:
getCommentPatterns in interface SourceSyntaxPoints.PreprocessorClient

getLiteralPatternNames

public String[] getLiteralPatternNames()
Specified by:
getLiteralPatternNames in interface SourceSyntaxPoints.PreprocessorClient

getLiteralPatterns

public Pattern[] getLiteralPatterns()
Specified by:
getLiteralPatterns in interface SourceSyntaxPoints.PreprocessorClient

getIncludePattern

public Pattern getIncludePattern()
Specified by:
getIncludePattern in interface SourceSyntaxPoints.PreprocessorClient

getIncludePatternName

public String getIncludePatternName()
Specified by:
getIncludePatternName in interface SourceSyntaxPoints.PreprocessorClient

getDefinedObjectClassName

public String getDefinedObjectClassName(String objectName,
                                        int position)

getSuperClass

public String getSuperClass()
Returns:
Returns the superClass.

getViewedClass

public String getViewedClass()
Returns:
Returns the viewedClass.

getSyntaxPoints

public SourceSyntaxPoints getSyntaxPoints()
Gets the collection of syntax points.

Specified by:
getSyntaxPoints in interface SourceSyntaxPoints.PreprocessorClient

parse

void parse(Object initStatus)
Parses the file.


treatInclude

public void treatInclude(int position,
                         String includeDirective,
                         SyntaxPoint start,
                         SyntaxPoint end,
                         SourceSyntaxPoints host)
Specified by:
treatInclude in interface SourceSyntaxPoints.PreprocessorClient

treatJavaImports

void treatJavaImports(String content,
                      JavaAnalyzer an)
Go thru the java import statments in the class.


treatReservedWords

void treatReservedWords(String content,
                        JavaAnalyzer an)
Go thru the reserved words in the class.


treatClassUsage

void treatClassUsage(String content,
                     JavaAnalyzer an)

treatJavaStringLiterals

void treatJavaStringLiterals(String content,
                             JavaAnalyzer an)
Go thru the java String Literals in the class.


treatJavaModifiers

void treatJavaModifiers(String content,
                        JavaAnalyzer an)
Go thru the java modifiers in the class.


treatMethodUsage

void treatMethodUsage(String content,
                      JavaAnalyzer an)

treatMakumbaHandler

void treatMakumbaHandler(String content,
                         JavaAnalyzer an)