edu.cmu.sei.osate.core.builder
Class AadlBuilder

java.lang.Object
  extended by org.eclipse.core.internal.events.InternalBuilder
      extended by org.eclipse.core.resources.IncrementalProjectBuilder
          extended by edu.cmu.sei.osate.core.builder.AadlBuilder
All Implemented Interfaces:
org.eclipse.core.runtime.IExecutableExtension

public class AadlBuilder
extends org.eclipse.core.resources.IncrementalProjectBuilder


Nested Class Summary
protected  class AadlBuilder.DeltaVisitor
           
protected  class AadlBuilder.DuplicateModelsVisitor
           
protected  class AadlBuilder.Visitor
           
 
Field Summary
protected  AnalysisErrorReporterFactory analysisErrorLoggerFactory
           
protected  boolean askedAboutMissingPredeclared
          This value is only meaningful if reportedMissingPredeclared is true
static java.lang.String BUILDER_ID
           
static java.lang.String copyright
           
protected  CorePackage corePackage
           
static boolean DEBUG
           
static java.lang.String DEBUG_OPTION
           
protected static boolean didFullIncrementalBuild
           
protected  FilenameCache fcache
           
protected static java.util.Set<org.eclipse.core.resources.IFile> filesDone
          The set of files that have been processed in this build.
protected  InternalErrorReporter internalErrorLogger
           
protected  java.util.ArrayList<java.lang.String> markerMessagesForFilesNotInSourceDir
          Each element in this list correspond to the element with the same index in sourceFilesNotInSourceDir.
protected  java.util.Set modelsToSanityCheck
          Model files that were changed and need to have their sanity checked.
protected static java.util.Set packagesToDo
          Set of package names (Strings) to parse
protected  ParseErrorReporterFactory parseErrorLoggerFactory
           
protected  boolean parseMissingPredeclared
          This value is only meaningful if askedAboutMissingPredeclared is true
protected  java.util.Map<org.eclipse.core.resources.IProject,org.eclipse.jface.preference.PreferenceStore> prefCache
          Cache of project preference stores.
protected static java.util.Set propertysetsToDo
          Set of property set names (Strings) to parse
protected  boolean reportedMissingPredeclared
           
protected static boolean requestFullIncremenalBuild
          incremental build requires a full build
protected static org.eclipse.core.resources.IResourceChangeListener resourceChangeListener
           
protected  java.util.ArrayList<org.eclipse.core.resources.IFile> sourceFilesNotInSourceDir
          Files are added to this list when checking if each source file is in the project's source directory.
protected static java.util.Set<org.eclipse.core.resources.IFile> specsToDo
          Set of AADL specifications (IFile objects) to parse
protected  IAadlWorkspace workspace
          A reference to the current workspace.
 
Fields inherited from class org.eclipse.core.resources.IncrementalProjectBuilder
AUTO_BUILD, CLEAN_BUILD, FULL_BUILD, INCREMENTAL_BUILD
 
Constructor Summary
AadlBuilder()
           
 
Method Summary
protected  void addAllSourceFiles(org.eclipse.core.runtime.IProgressMonitor monitor)
          add all source files for processing if their XML files don't exist or are marked as with syntax errors
protected  void addAllSourceFilesWithCompileNeed(org.eclipse.core.runtime.IProgressMonitor monitor)
          add all source files for processing if their XML files don't exist or are marked as with syntax errors
static void addLocationInformation(org.eclipse.emf.ecore.resource.Resource res)
          adds location information to object model if not present
protected  org.eclipse.core.resources.IProject[] build(int kind, java.util.Map args, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  void checkAll(AnalysisErrorReporterManager analErrMgr, java.util.Set modelsToCheck)
          This method collects all checks that need to be done on the workspace / resource set after parsing, including Semantic checking Property checking.
protected  void checkAnnexes(java.util.Set resources, AnalysisErrorReporterManager errMgr)
           
protected  void checkForUniquePropertySetAndPackageNames(AnalysisErrorReporterManager checkingErrManager)
           
protected  java.util.Set checkModelSanity(AnalysisErrorReporterManager errMgr, java.util.Set modelsToCheck)
           
protected  void checkProjectPreferences(org.eclipse.core.resources.IProject project, org.eclipse.jface.preference.PreferenceStore projectProperties)
           
 void checkUnresolvedProxies(org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  void clean(org.eclipse.core.runtime.IProgressMonitor monitor)
          deletes all declarative model files in the current projects
protected  void cleanAll(org.eclipse.core.runtime.IProgressMonitor monitor)
          deletes all declarative model files in all projects
protected  void clearProjectPrefsCache()
           
protected  boolean containsSegment(org.eclipse.core.runtime.IPath path, java.lang.String segmentName)
          returns true if named segment is contained in path as segment
 boolean doReinstantiate(org.eclipse.core.resources.IResource ires, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected  boolean fileNameMatchesName(java.lang.String fn, java.lang.String n)
           
protected  org.eclipse.jface.preference.PreferenceStore getProjectPrefs(org.eclipse.core.resources.IProject project)
           
static org.eclipse.core.resources.IFile getUpToDateAadlFile(org.eclipse.core.resources.IFile aaxlFile)
          makes sure the aadl file exists and is up to date with respect to the aaxl file.
protected  boolean hasNames(java.util.Set set)
           
protected  void initBuildListener()
          sets the resource change event listener for build events
static void loadStandardPropertySets()
          Deprecated. This method call is a noop, you can remove it.
static void loadStandardPropertySets(ParseErrorReporterManager parseErrManager, AnalysisErrorReporterManager checkingErrManager)
          Deprecated. This method call is a noop, you can remove it.
protected  void loadStandardPropertySets(ParseErrorReporterManager parseErrManager, AnalysisErrorReporterManager nameErrManager, AnalysisErrorReporterManager checkingErrManager)
          Deprecated. This method call is a noop, you can remove it.
protected  org.eclipse.emf.common.util.URI makeOutURI(org.eclipse.core.resources.IFile file)
           
protected  void markFilesNotInSourceDirectory(ParseErrorReporterManager errManager)
          Creates new warning markers with messages from markerMessagesForFilesNotInSourceDir and adds them to the corresponding file in sourceFilesNotInSourceDir.
protected  AadlSpec parseFile(org.eclipse.core.resources.IFile file, ParseErrorReporterManager parseErrManager)
          Parse an AADL file.
protected  AadlSpec parsePluginProvided(java.io.InputStream aadlis, java.io.InputStream aaxlis, java.lang.String pluginName, org.eclipse.emf.ecore.resource.Resource outRsrc)
          Parse an AADL file.
 AadlSpec parseSingleAadlFile(org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor)
          Process an AADL file but not any referenced external packages/propertysets.
protected  void processAadlFileInternal(org.eclipse.core.resources.IFile file)
          Process an AADL file including referenced external packages/propertysets.
protected  void processAll(ParseErrorReporterManager errManager, org.eclipse.core.runtime.IProgressMonitor monitor)
          Parse all AADL specification files in the specsToDo set as well as all packages and property sets in the sets packagesToDo and propertysetsToDo, respectively.
protected  void processFile(int fileType, org.eclipse.core.resources.IFile sourceFile, ParseErrorReporterManager errManager, org.eclipse.core.runtime.IProgressMonitor monitor)
          Process an AADL file.
protected  void processSet(int type, java.util.Set set, ParseErrorReporterManager errManager, org.eclipse.core.runtime.IProgressMonitor monitor)
          Helper method to process a set of package or property set names.
 void removeUnresolvedInstanceModelFiles()
           
 void removeUnresolvedInstanceModelFiles(org.eclipse.core.resources.IProject project)
           
protected  void resolveAllParsed(AnalysisErrorReporterManager errMgr)
           
static void synchronizeResources(org.eclipse.core.runtime.IProgressMonitor monitor)
          Given a resource was saved, make sure any affected XML models get saved to update their XPath.
protected  void updateInstanceModelFiles(boolean rebuildAll, org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
           
 
Methods inherited from class org.eclipse.core.resources.IncrementalProjectBuilder
forgetLastBuiltState, getCommand, getDelta, getProject, hasBeenBuilt, isInterrupted, needRebuild, setInitializationData, startupOnInitialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values

BUILDER_ID

public static final java.lang.String BUILDER_ID
See Also:
Constant Field Values

DEBUG_OPTION

public static final java.lang.String DEBUG_OPTION
See Also:
Constant Field Values

DEBUG

public static boolean DEBUG

resourceChangeListener

protected static org.eclipse.core.resources.IResourceChangeListener resourceChangeListener

corePackage

protected CorePackage corePackage

specsToDo

protected static java.util.Set<org.eclipse.core.resources.IFile> specsToDo
Set of AADL specifications (IFile objects) to parse


packagesToDo

protected static java.util.Set packagesToDo
Set of package names (Strings) to parse


propertysetsToDo

protected static java.util.Set propertysetsToDo
Set of property set names (Strings) to parse


filesDone

protected static java.util.Set<org.eclipse.core.resources.IFile> filesDone
The set of files that have been processed in this build.


workspace

protected IAadlWorkspace workspace
A reference to the current workspace.


requestFullIncremenalBuild

protected static boolean requestFullIncremenalBuild
incremental build requires a full build


didFullIncrementalBuild

protected static boolean didFullIncrementalBuild

reportedMissingPredeclared

protected boolean reportedMissingPredeclared

askedAboutMissingPredeclared

protected boolean askedAboutMissingPredeclared
This value is only meaningful if reportedMissingPredeclared is true


parseMissingPredeclared

protected boolean parseMissingPredeclared
This value is only meaningful if askedAboutMissingPredeclared is true


sourceFilesNotInSourceDir

protected java.util.ArrayList<org.eclipse.core.resources.IFile> sourceFilesNotInSourceDir
Files are added to this list when checking if each source file is in the project's source directory. The list is later accessed to add warning markers to the files. The markers are not added to the files during the check because all markers are deleted and regenerated after the source dir check.


markerMessagesForFilesNotInSourceDir

protected java.util.ArrayList<java.lang.String> markerMessagesForFilesNotInSourceDir
Each element in this list correspond to the element with the same index in sourceFilesNotInSourceDir.


prefCache

protected final java.util.Map<org.eclipse.core.resources.IProject,org.eclipse.jface.preference.PreferenceStore> prefCache
Cache of project preference stores. Reset at the start of each build.


internalErrorLogger

protected final InternalErrorReporter internalErrorLogger

parseErrorLoggerFactory

protected final ParseErrorReporterFactory parseErrorLoggerFactory

analysisErrorLoggerFactory

protected final AnalysisErrorReporterFactory analysisErrorLoggerFactory

fcache

protected final FilenameCache fcache

modelsToSanityCheck

protected java.util.Set modelsToSanityCheck
Model files that were changed and need to have their sanity checked.

Constructor Detail

AadlBuilder

public AadlBuilder()
Method Detail

clean

protected void clean(org.eclipse.core.runtime.IProgressMonitor monitor)
              throws org.eclipse.core.runtime.CoreException
deletes all declarative model files in the current projects

Overrides:
clean in class org.eclipse.core.resources.IncrementalProjectBuilder
Throws:
org.eclipse.core.runtime.CoreException

cleanAll

protected void cleanAll(org.eclipse.core.runtime.IProgressMonitor monitor)
deletes all declarative model files in all projects


initBuildListener

protected void initBuildListener()
sets the resource change event listener for build events


addAllSourceFilesWithCompileNeed

protected void addAllSourceFilesWithCompileNeed(org.eclipse.core.runtime.IProgressMonitor monitor)
add all source files for processing if their XML files don't exist or are marked as with syntax errors

Parameters:
monitor -

addAllSourceFiles

protected void addAllSourceFiles(org.eclipse.core.runtime.IProgressMonitor monitor)
add all source files for processing if their XML files don't exist or are marked as with syntax errors

Parameters:
monitor -

build

protected org.eclipse.core.resources.IProject[] build(int kind,
                                                      java.util.Map args,
                                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                                               throws org.eclipse.core.runtime.CoreException
Specified by:
build in class org.eclipse.core.resources.IncrementalProjectBuilder
Throws:
org.eclipse.core.runtime.CoreException

checkForUniquePropertySetAndPackageNames

protected void checkForUniquePropertySetAndPackageNames(AnalysisErrorReporterManager checkingErrManager)

processAadlFileInternal

protected void processAadlFileInternal(org.eclipse.core.resources.IFile file)
Process an AADL file including referenced external packages/propertysets. This internal version cannot be called from a UI action.

Parameters:
file - the AADL file to process

containsSegment

protected boolean containsSegment(org.eclipse.core.runtime.IPath path,
                                  java.lang.String segmentName)
returns true if named segment is contained in path as segment

Parameters:
path -
segmentName -

parseSingleAadlFile

public AadlSpec parseSingleAadlFile(org.eclipse.core.resources.IFile file,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
Process an AADL file but not any referenced external packages/propertysets. This method is used by the text editor.

This method parses the source file, loads the corresponding model file (if necessary and present), and copies all location references to the resource.

Parameters:
file - the AADL file to process
monitor - the progress monitor for this operation

processAll

protected void processAll(ParseErrorReporterManager errManager,
                          org.eclipse.core.runtime.IProgressMonitor monitor)
Parse all AADL specification files in the specsToDo set as well as all packages and property sets in the sets packagesToDo and propertysetsToDo, respectively.

Parameters:
monitor - the progress monitor for this job

hasNames

protected boolean hasNames(java.util.Set set)

processSet

protected void processSet(int type,
                          java.util.Set set,
                          ParseErrorReporterManager errManager,
                          org.eclipse.core.runtime.IProgressMonitor monitor)
Helper method to process a set of package or property set names.

Parameters:
type -
set -
monitor -

processFile

protected void processFile(int fileType,
                           org.eclipse.core.resources.IFile sourceFile,
                           ParseErrorReporterManager errManager,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
Process an AADL file. Load the corresponding model file if it is present in the workspace and current. Otherwise delegate processing to the parser.

Parameters:
sourceFile - the file to process in the current workspace
monitor - the progress monitor to use

parseFile

protected AadlSpec parseFile(org.eclipse.core.resources.IFile file,
                             ParseErrorReporterManager parseErrManager)
Parse an AADL file. Before this method can be called the AADL compilation unit must be resolved to a file in the current workspace. The object model for this file is added to the osate resource set and needs to be name resolved.

Parameters:
file - the file to parse in the current workspace
Returns:
An AADL spec object containing the parsed model or null if there were parse errors.

parsePluginProvided

protected AadlSpec parsePluginProvided(java.io.InputStream aadlis,
                                       java.io.InputStream aaxlis,
                                       java.lang.String pluginName,
                                       org.eclipse.emf.ecore.resource.Resource outRsrc)
Parse an AADL file. Before this method can be called the AADL compilation unit must be resolved to a file in the current workspace. The object model for this file is added to the osate resource set and needs to be name resolved.

Returns:
An AADL spec object containing the parsed model or null if there were parse errors.

fileNameMatchesName

protected boolean fileNameMatchesName(java.lang.String fn,
                                      java.lang.String n)

resolveAllParsed

protected void resolveAllParsed(AnalysisErrorReporterManager errMgr)

checkModelSanity

protected java.util.Set checkModelSanity(AnalysisErrorReporterManager errMgr,
                                         java.util.Set modelsToCheck)

checkAll

protected void checkAll(AnalysisErrorReporterManager analErrMgr,
                        java.util.Set modelsToCheck)
This method collects all checks that need to be done on the workspace / resource set after parsing, including


checkAnnexes

protected void checkAnnexes(java.util.Set resources,
                            AnalysisErrorReporterManager errMgr)

makeOutURI

protected org.eclipse.emf.common.util.URI makeOutURI(org.eclipse.core.resources.IFile file)
Parameters:
file -

loadStandardPropertySets

public static void loadStandardPropertySets()
Deprecated. This method call is a noop, you can remove it.

This method doesn't do anything anymore now that we treat the standard property sets as plug-in provided property sets. It is here for API compatibility.


loadStandardPropertySets

public static void loadStandardPropertySets(ParseErrorReporterManager parseErrManager,
                                            AnalysisErrorReporterManager checkingErrManager)
Deprecated. This method call is a noop, you can remove it.

This method doesn't do anything anymore now that we treat the standard property sets as plug-in provided property sets. It is here for API compatibility.


loadStandardPropertySets

protected void loadStandardPropertySets(ParseErrorReporterManager parseErrManager,
                                        AnalysisErrorReporterManager nameErrManager,
                                        AnalysisErrorReporterManager checkingErrManager)
Deprecated. This method call is a noop, you can remove it.

This method doesn't do anything anymore now that we treat the standard property sets as plug-in provided property sets. It is here for API compatibility.


updateInstanceModelFiles

protected void updateInstanceModelFiles(boolean rebuildAll,
                                        org.eclipse.core.resources.IProject project,
                                        org.eclipse.core.runtime.IProgressMonitor monitor)

doReinstantiate

public boolean doReinstantiate(org.eclipse.core.resources.IResource ires,
                               org.eclipse.core.runtime.IProgressMonitor monitor)

removeUnresolvedInstanceModelFiles

public void removeUnresolvedInstanceModelFiles()

removeUnresolvedInstanceModelFiles

public void removeUnresolvedInstanceModelFiles(org.eclipse.core.resources.IProject project)

markFilesNotInSourceDirectory

protected void markFilesNotInSourceDirectory(ParseErrorReporterManager errManager)
Creates new warning markers with messages from markerMessagesForFilesNotInSourceDir and adds them to the corresponding file in sourceFilesNotInSourceDir.


clearProjectPrefsCache

protected void clearProjectPrefsCache()

getProjectPrefs

protected org.eclipse.jface.preference.PreferenceStore getProjectPrefs(org.eclipse.core.resources.IProject project)

checkProjectPreferences

protected void checkProjectPreferences(org.eclipse.core.resources.IProject project,
                                       org.eclipse.jface.preference.PreferenceStore projectProperties)

getUpToDateAadlFile

public static org.eclipse.core.resources.IFile getUpToDateAadlFile(org.eclipse.core.resources.IFile aaxlFile)
makes sure the aadl file exists and is up to date with respect to the aaxl file. The aaxl file must exist and must not be an instance file. It will ensure up-to-date location references on the object model


addLocationInformation

public static void addLocationInformation(org.eclipse.emf.ecore.resource.Resource res)
adds location information to object model if not present

Parameters:
res - declarative model resource

checkUnresolvedProxies

public void checkUnresolvedProxies(org.eclipse.core.runtime.IProgressMonitor monitor)

synchronizeResources

public static void synchronizeResources(org.eclipse.core.runtime.IProgressMonitor monitor)
Given a resource was saved, make sure any affected XML models get saved to update their XPath. Also unparse any text files that are out of date to reflect the propagated change.

Parameters:
monitor -