TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.tptp.platform.analysis.core.provider
Class AbstractAnalysisProvider

java.lang.Object
  extended by org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
      extended by org.eclipse.tptp.platform.analysis.core.provider.AbstractAnalysisProvider
All Implemented Interfaces:
org.eclipse.core.runtime.IExecutableExtension
Direct Known Subclasses:
CodeReviewProvider, CodeReviewProvider

public abstract class AbstractAnalysisProvider
extends AbstractAnalysisElement
implements org.eclipse.core.runtime.IExecutableExtension

Provides common functionality for most analysis providers. Any methods here can be overridden by derivatives of this class


Field Summary
static long MAX_SCORE
          The maximum (worst) quality score that a provider should produce.
static int PROVIDER_TYPE_CODE
          Indicates a provider that measures code quality (i.e. code review)
static int PROVIDER_TYPE_COMPLEXITY
          Indicates a provider that measures code complexity
static int PROVIDER_TYPE_COMPLIANCE
          Indicates a provider that measures governance/compliance quality
static int PROVIDER_TYPE_STRUCTURAL
          Indicates a provider that measures structural quality
static int PROVIDER_TYPE_UNKNOWN
          Indicates a provider that measures an unknown quality
static long UNSUPPORTED_SCORE
           
 
Fields inherited from class org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
CATEGORY_ELEMENT_TYPE, COMBO_VALUE, DETAIL_PROVIDER, PROVIDER_ELEMENT_TYPE, PROVIDER_MANAGER_ELEMENT_TYPE, RESULT_ELEMENT_TYPE, RULE_ELEMENT_TYPE
 
Method Summary
 void addTemplate(RuleTemplate template)
          INTERNAL USE ONLY Used internally to add new templates to the provider.
 void analyze(org.eclipse.core.runtime.IProgressMonitor parentMonitor, AnalysisHistory history)
          Analyze the categories selected by the user
 long getAnalysisScore(AnalysisHistory history)
          Returns a calculated score of the analysis of this provider on a scale from 0 to 1000 (MAX_SCORE) where 0 is worst and 1000 is best.
 java.util.List getDataExporters()
          Return a list of data exporters associated with this provider.
 org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
           
 java.lang.Object getProperty(java.lang.String historyId, java.lang.String name)
          Retrieve the data from a previously set property value
 int getProviderQualityType()
          This method indicated the type of quality measure that is supplied by this analysis provider.
 java.util.List getResources()
          Return a list of IResources that were selected through the user interface.
 java.util.List getRuleTemplates()
          INTERNAL USE ONLY
 IAnalysisViewer getViewer()
           
 void removeProperty(java.lang.String historyId, java.lang.String name)
          Remove a property and it's data from the property table
 void setInitializationData(org.eclipse.core.runtime.IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)
           
 void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
          This method assigns the progress monitor to the provider.
 void setProperty(java.lang.String historyId, java.lang.String name, java.lang.Object data)
          Provides a place to store data that may be common across multiple categories and/or rules.
 
Methods inherited from class org.eclipse.tptp.platform.analysis.core.element.AbstractAnalysisElement
addDetailProvider, addHistoryResultSet, addOwnedElement, addOwnedElements, addParameter, addParameters, deleteHistoryResults, dispose, getDetailProviders, getElementType, getExecutionHistory, getExternalDataMap, getHelpID, getHistoryResults, getIconName, getId, getLabel, getOwnedElements, getOwner, getOwnerId, getParameter, getParameterCount, getParameterList, getPluginId, getProvider, getProviderManager, getViewerID, getVisibleParameterCount, postAnalyze, preAnalyze, removeHistoryResultSet, removeHistoryResultSet, setElementType, setExternalDataMap, setHelpID, setIconName, setId, setInitializationData, setLabel, setOwner, setOwnerId, setPluginId, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROVIDER_TYPE_UNKNOWN

public static final int PROVIDER_TYPE_UNKNOWN
Indicates a provider that measures an unknown quality

See Also:
Constant Field Values

PROVIDER_TYPE_CODE

public static final int PROVIDER_TYPE_CODE
Indicates a provider that measures code quality (i.e. code review)

See Also:
Constant Field Values

PROVIDER_TYPE_COMPLEXITY

public static final int PROVIDER_TYPE_COMPLEXITY
Indicates a provider that measures code complexity

See Also:
Constant Field Values

PROVIDER_TYPE_STRUCTURAL

public static final int PROVIDER_TYPE_STRUCTURAL
Indicates a provider that measures structural quality

See Also:
Constant Field Values

PROVIDER_TYPE_COMPLIANCE

public static final int PROVIDER_TYPE_COMPLIANCE
Indicates a provider that measures governance/compliance quality

See Also:
Constant Field Values

MAX_SCORE

public static final long MAX_SCORE
The maximum (worst) quality score that a provider should produce. All quality numbers should be normalized to the range 0-MAX_SCORE, with 0 being a perfect score and MAX_SCORE being the worst possible value

See Also:
Constant Field Values

UNSUPPORTED_SCORE

public static final long UNSUPPORTED_SCORE
See Also:
Constant Field Values
Method Detail

setInitializationData

public final void setInitializationData(org.eclipse.core.runtime.IConfigurationElement config,
                                        java.lang.String propertyName,
                                        java.lang.Object data)
                                 throws org.eclipse.core.runtime.CoreException
Specified by:
setInitializationData in interface org.eclipse.core.runtime.IExecutableExtension
Throws:
org.eclipse.core.runtime.CoreException

getViewer

public final IAnalysisViewer getViewer()
Returns:
the viewer for this result.

getResources

public final java.util.List getResources()
Return a list of IResources that were selected through the user interface. This method can also be called by any owned category or rule if required.

Returns:
A list of IResources to be analyzed

analyze

public void analyze(org.eclipse.core.runtime.IProgressMonitor parentMonitor,
                    AnalysisHistory history)
Analyze the categories selected by the user

Parameters:
parentMonitor - The progress monitor of the parent task
history - A reference to the history record for this analysis

getProviderQualityType

public int getProviderQualityType()
This method indicated the type of quality measure that is supplied by this analysis provider. This should be overridden by any provider that extends the AbstractAnalysisProvider class. The type returned is used by high level reporting tools to categorize the results that this provider generates.

Returns:
The provider quality type (See AbstractAnalysisProvider.PROVIDER_TYPE_*) for values

getAnalysisScore

public long getAnalysisScore(AnalysisHistory history)
Returns a calculated score of the analysis of this provider on a scale from 0 to 1000 (MAX_SCORE) where 0 is worst and 1000 is best. Derivatives of this class should override this method to produce a valid weighting for each analysis run. This number is used in reporting to indicate top-level quality of the the code that was analyzed.

Parameters:
history - The analysis history for which the quality score is requested
Returns:
A long integer value representing the quality score

setProperty

public final void setProperty(java.lang.String historyId,
                              java.lang.String name,
                              java.lang.Object data)
Provides a place to store data that may be common across multiple categories and/or rules. The data is specific to the provider and its children.

Parameters:
historyId - The unique identifier for the analysis run that stores the properties
name - The name of the property where the data will be stored
data - The data to store

getProperty

public final java.lang.Object getProperty(java.lang.String historyId,
                                          java.lang.String name)
Retrieve the data from a previously set property value

Parameters:
historyId - The unique identifier for the analysis run that stores the properties
name - The name of the property where the data is stored
Returns:
The data object or null if not found

removeProperty

public final void removeProperty(java.lang.String historyId,
                                 java.lang.String name)
Remove a property and it's data from the property table

Parameters:
historyId - The unique identifier for the analysis run that stores the properties
name - The name of the property to be removes

addTemplate

public final void addTemplate(RuleTemplate template)
INTERNAL USE ONLY Used internally to add new templates to the provider. This should not be called by developer code

Parameters:
template - The rule template to add to the provider

getRuleTemplates

public final java.util.List getRuleTemplates()
INTERNAL USE ONLY

Returns:
A list of rule templates suypported by this provider

getProgressMonitor

public final org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
Returns:
The progress monitor used by the analysis provider

setProgressMonitor

public final void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
This method assigns the progress monitor to the provider. Use this with caution. It should be called only from within the analysis() method of a custom analysis provider.

Parameters:
progressMonitor - The progress monitor from the analysis provider

getDataExporters

public final java.util.List getDataExporters()
Return a list of data exporters associated with this provider.

Returns:
a list of IAnalysisExporter instances related to this provider

TPTP 4.5.0 Platform Project
Public API Specification