edu.cmu.sei.aadl.model.pluginsupport
Class OsateResourceManager

java.lang.Object
  extended by edu.cmu.sei.aadl.model.pluginsupport.OsateResourceManager

public class OsateResourceManager
extends java.lang.Object

static utility methods for handling models as persistent resources

Version:
$Id: OsateResourceManager.java,v 1.136.2.3 2007-12-18 21:52:55 jseibel Exp $
Author:
phf

Field Summary
protected static OsateResourceSet resourceSet
          The resource set to be used for all aaxl resources with cross references to each other This means all packages stored as separate files, as well as graphic file for an Aadl model
 
Constructor Summary
OsateResourceManager()
           
 
Method Summary
static void clearJustParsed()
          Clear all the "just parsed" flags.
static boolean containsIResourceByPath(java.util.Collection iresset, org.eclipse.core.resources.IResource matchIRes)
           
static boolean containsModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource ires)
          check whether the ires IResource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors
static org.eclipse.core.resources.IResource convertToIResource(org.eclipse.emf.ecore.resource.Resource res)
          converts Resource into corresponding IResource without use of registry.
static void deleteComplementFile(org.eclipse.core.resources.IFile deletedfile)
          delete the complement file for the given deleted file
static void deleteComplementFileIfGenerated(org.eclipse.core.resources.IFile deletedfile)
          delete the complement file for the given deleted file if the complement is a derived file
static void deleteComplementFolder(org.eclipse.core.resources.IFolder deletedfolder)
          delete the complement file for the given deleted file
static void deleteFile(org.eclipse.core.resources.IFile model)
          Delete the given file.
static void doPropagateModelChange(org.eclipse.emf.ecore.resource.Resource origres)
          make resources as modified if their model objects point to the any object in the given model (resource)
static void doPropagateNameChange(AObject obj)
          make resources as modified if their model objects point to the named object
 EnumLiteral findEnumerationLiteral(java.lang.String enumTypeName, java.lang.String enumLiteralName)
          Find a predeclared AADL enum literal by name.
 EnumLiteral findEnumerationLiteral(java.lang.String propertySetName, java.lang.String enumTypeName, java.lang.String enumLiteralName, AObject context)
          Find an AADL enum literal by name.
static AadlPackage findPrivateOnlyAadlPackage(java.lang.String pn, AObject context)
          Find an AADL package by name in in the local aadlspec, a resource in the resource set or workspace.
static PropertyConstant findPropertyConstant(java.lang.String constantName)
          Find a predeclared AADL property constant by name.
static PropertyConstant findPropertyConstant(java.lang.String propertySet, java.lang.String constantName, AObject context)
          Find an AADL property constant by name.
static PropertyDefinition findPropertyDefinition(java.lang.String propertyName)
          Find a predeclared AADL property definition by name.
static PropertyDefinition findPropertyDefinition(java.lang.String propertySet, java.lang.String propertyName, AObject context)
          Find an AADL property definition by name.
static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertyName, AObject modelobj)
          Find a predeclared AADL property definition by name.
static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertySetName, java.lang.String propertyName, AObject modelobj)
          Find a predeclared AADL property definition by name.
static PropertySet findPropertySet(java.lang.String psn, AObject context)
          Find an AADL property set by name in a resource in the resource set.
static PropertySet findPropertySetInResourceSet(java.lang.String psn)
          Find property set in resource set.
static PropertySet findPropertySetInResourceSet(java.lang.String psn, org.eclipse.emf.ecore.resource.ResourceSet resset)
          Find property set in resource set.
static PropertyType findPropertyType(java.lang.String typeName)
          Find a predeclared AADL property type by name.
static PropertyType findPropertyType(java.lang.String propertySet, java.lang.String constantName, AObject context)
          Find an AADL property type by name.
static AadlPackage findPublicAadlPackage(java.lang.String pn, AObject context)
          Find an AADL package by name in in the local aadlspec, a resource in the resource set or workspace.
static AadlPackage findPublicAadlPackageInResourceSet(java.lang.String pn)
          find public package in resource set.
static org.eclipse.emf.ecore.resource.Resource findResource(java.lang.String name)
          Find the resource for given name in resource set This is done by comparing the name with the name in the root object of a CoreResourceImpl
static org.eclipse.emf.ecore.resource.Resource findResource(org.eclipse.emf.common.util.URI uri)
          Find the resource for given URI, but do not demand load
static UnitLiteral findUnitLiteral(java.lang.String unitsTypeName, java.lang.String unitLiteralName)
          Find a predeclared AADL unit literal by name.
static UnitLiteral findUnitLiteral(java.lang.String propertySetName, java.lang.String unitsTypeName, java.lang.String unitLiteralName, AObject context)
          Find an AADL unit literal by name.
static void forceLoadResource(org.eclipse.emf.common.util.URI uri)
          force the loading of a resource identified by the uri.
static AadlPackage getAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
          If the resource contains a package declaration only, then it is returned.
static java.util.Set<org.eclipse.emf.ecore.resource.Resource> getAllOtherResources(org.eclipse.emf.ecore.resource.Resource res)
          Get all resources in the resource set except res or standard property sets
static java.util.Set<CoreResourceImpl> getAllParsedResources()
          Get all resources in the resource set that have just been parsed.
static java.util.Set<PropertySet> getAllPropertySets()
          Get all the global property sets in the resource set.
static java.util.Set<PropertySet> getAllPropertySets(AObject context)
          Get all the property sets visible to the given model element.
static java.util.Set<AadlPackage> getAllPublicPackages()
          Get all the global public packages in the resource set.
static java.util.Set<AadlPackage> getAllPublicPackages(AObject context)
          Get all the property sets visible to the given model element.
static AObject getAObjectFromIResource(org.eclipse.core.resources.IResource ires)
          Given an IResource, returns the root AObject of the contains aadl meta model, if the resource contains one.
static org.eclipse.emf.ecore.resource.Resource getEmptyResource(org.eclipse.emf.common.util.URI uri)
          creates a Resource for file name with path within Eclipse If it exists, it will empty its content.
static org.eclipse.core.resources.IResource getIResource(org.eclipse.core.runtime.IPath path)
          return the IResource of the given path
static org.eclipse.core.runtime.IPath getOsatePath(org.eclipse.emf.common.util.URI resourceURI)
          return the IPath for the path.
static AadlPackage getPrivateOnlyAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
          return the AadlPackage if it only has a private part.
static PropertySet getPropertySet(org.eclipse.emf.ecore.resource.Resource res)
          return the propertyset as the single root of this file.
static AadlPackage getPublicAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
          return the AadlPackage if it has a public part.
static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.core.resources.IResource ires)
          gets Resource for given IResource.
static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri)
          gets Resource for given URI.
static OsateResourceSet getResourceSet()
          Get the resourceset shared by a collection of Aaxl, aagl files if it has not been initialized, this methid will initialize it.
static boolean isAadlXMLResource(org.eclipse.core.resources.IResource ires)
          is the file an XML file of an Aadl model.
static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.EObject model)
          check whether the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors
static boolean isModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource modelfile)
          check whether the model IResource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors
static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
          check whether the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors
static boolean isPredeclaredResource(org.eclipse.emf.ecore.resource.Resource r)
           
static void load(org.eclipse.emf.ecore.resource.Resource res)
          load resource
protected static void loadPluginContributedAadl()
           
static org.eclipse.emf.ecore.resource.Resource loadResource(org.eclipse.emf.common.util.URI uri)
          gets Resource for given URI. returns null if it does not exist or load failed
static void populateResourceSet()
          add all model files in workspace into resourceset.
static void populateResourceSet(java.util.List<? extends org.eclipse.core.resources.IFile> files)
          add all model files into resourceset.
static void printResourceSet()
           
static void reload(org.eclipse.emf.ecore.resource.Resource res)
          load resource
static void removeResource(org.eclipse.core.resources.IResource ires)
          Unload and remove from the resource set the Resource associated with the given IResource.
static void removeResource(org.eclipse.emf.ecore.resource.Resource res)
          Unload and remove from the resource set the given Resource.
static void removeResources()
          removes the resources from the resourceset Does unload resources from resourceset
protected static void run(java.util.List<? extends org.eclipse.core.resources.IFile> files, org.eclipse.core.runtime.IProgressMonitor monitor)
          add all model files in workspace into resourceset.
static void save(org.eclipse.emf.ecore.resource.Resource res)
          save the resource as aaxl file Called by the editors.
static void saveAllParsed()
          Save all resources in the resource set that have been parsed.
static void saveAsDerived(org.eclipse.emf.ecore.resource.Resource res)
          save resource as derived file. to be called by parser.
static void tagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
          tag the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors It is also touched to make sure it has a newer date than the text.
static void untagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
          untag the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourceSet

protected static OsateResourceSet resourceSet
The resource set to be used for all aaxl resources with cross references to each other This means all packages stored as separate files, as well as graphic file for an Aadl model

Constructor Detail

OsateResourceManager

public OsateResourceManager()
Method Detail

getResourceSet

public static OsateResourceSet getResourceSet()
Get the resourceset shared by a collection of Aaxl, aagl files if it has not been initialized, this methid will initialize it.

Returns:
ResourceSet

printResourceSet

public static void printResourceSet()

removeResources

public static void removeResources()
removes the resources from the resourceset Does unload resources from resourceset


removeResource

public static void removeResource(org.eclipse.core.resources.IResource ires)
Unload and remove from the resource set the Resource associated with the given IResource.

Parameters:
ires -

removeResource

public static void removeResource(org.eclipse.emf.ecore.resource.Resource res)
Unload and remove from the resource set the given Resource. If the Resource is not part of the resource set no action is taken (i.e., it is not unloaded).


populateResourceSet

public static void populateResourceSet()
add all model files in workspace into resourceset. If they are already in the resource set. force their reload.


populateResourceSet

public static void populateResourceSet(java.util.List<? extends org.eclipse.core.resources.IFile> files)
add all model files into resourceset. If they are already in the resource set. force their reload.

Parameters:
files -

forceLoadResource

public static void forceLoadResource(org.eclipse.emf.common.util.URI uri)
force the loading of a resource identified by the uri. Reload if it was already loaded, but not if just saved.

Parameters:
uri -

run

protected static void run(java.util.List<? extends org.eclipse.core.resources.IFile> files,
                          org.eclipse.core.runtime.IProgressMonitor monitor)
add all model files in workspace into resourceset.


load

public static void load(org.eclipse.emf.ecore.resource.Resource res)
load resource

Parameters:
res - resource

reload

public static void reload(org.eclipse.emf.ecore.resource.Resource res)
load resource

Parameters:
res - resource

save

public static void save(org.eclipse.emf.ecore.resource.Resource res)
save the resource as aaxl file Called by the editors. Will propagate the model change to update references.

Parameters:
res - Resource

convertToIResource

public static org.eclipse.core.resources.IResource convertToIResource(org.eclipse.emf.ecore.resource.Resource res)
converts Resource into corresponding IResource without use of registry.

Parameters:
res - Resource
Returns:
IResource

getIResource

public static org.eclipse.core.resources.IResource getIResource(org.eclipse.core.runtime.IPath path)
return the IResource of the given path

Parameters:
path -
Returns:
IResource

getResource

public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.core.resources.IResource ires)
gets Resource for given IResource. Will create the resource if it does not exist

Parameters:
ires - IResource
Returns:
Resource

getResource

public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri)
gets Resource for given URI. Will create the resource if it does not exist

Parameters:
uri - URI
Returns:
Resource

loadResource

public static org.eclipse.emf.ecore.resource.Resource loadResource(org.eclipse.emf.common.util.URI uri)
gets Resource for given URI. returns null if it does not exist or load failed

Parameters:
uri - URI
Returns:
Resource

findResource

public static org.eclipse.emf.ecore.resource.Resource findResource(org.eclipse.emf.common.util.URI uri)
Find the resource for given URI, but do not demand load

Parameters:
uri - URI
Returns:
Resource, null if it is not in the resource set.

findResource

public static org.eclipse.emf.ecore.resource.Resource findResource(java.lang.String name)
Find the resource for given name in resource set This is done by comparing the name with the name in the root object of a CoreResourceImpl

Parameters:
name - String
Returns:
Resource, null if it is not in the resource set.

getEmptyResource

public static org.eclipse.emf.ecore.resource.Resource getEmptyResource(org.eclipse.emf.common.util.URI uri)
creates a Resource for file name with path within Eclipse If it exists, it will empty its content.

Parameters:
uri - uri
Returns:
Resource

getOsatePath

public static org.eclipse.core.runtime.IPath getOsatePath(org.eclipse.emf.common.util.URI resourceURI)
return the IPath for the path. Strips the leading "resource" as necessary

Parameters:
resourceURI - The URI of the Resource
Returns:
IPath to the file identified by the URI
Throws:
java.lang.IllegalArgumentException - Thrown if the URI is does not use the "platform:" protocol.

isAadlXMLResource

public static boolean isAadlXMLResource(org.eclipse.core.resources.IResource ires)
is the file an XML file of an Aadl model. Currently checks for extension "aaxl"

Parameters:
ires -

getAObjectFromIResource

public static AObject getAObjectFromIResource(org.eclipse.core.resources.IResource ires)
Given an IResource, returns the root AObject of the contains aadl meta model, if the resource contains one. Returns null otherwise.


findPropertySet

public static PropertySet findPropertySet(java.lang.String psn,
                                          AObject context)
Find an AADL property set by name in a resource in the resource set. The lookup is controlled by the given context object, which is the object on whose behalf the lookup is being performed. If the object is inside an AadlSpec that contains local property set or defintions, we first try to find the named property set in those local definitions. If not found, or if the AadlSpec doesn't contain local property definitions, the global name space is searched. If the context is null then the search starts with global name space. TODO: This global name space is bounded by the projects that the project that contains the AadlSpec is declared to depend on.

Parameters:
psn - String property set name
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest.
Returns:
Reference to the property set, null if not found.

findPropertySetInResourceSet

public static PropertySet findPropertySetInResourceSet(java.lang.String psn)
Find property set in resource set. We only find the resource if it contains only that property set

Parameters:
psn - property set name
Returns:
PropertySet or null

findPropertySetInResourceSet

public static PropertySet findPropertySetInResourceSet(java.lang.String psn,
                                                       org.eclipse.emf.ecore.resource.ResourceSet resset)
Find property set in resource set. We only find the resource if it contains only that property set

Parameters:
psn - property set name
Returns:
PropertySet or null

getPropertySet

public static PropertySet getPropertySet(org.eclipse.emf.ecore.resource.Resource res)
return the propertyset as the single root of this file. The propertyset may be the root itself or the single element of the AadlSpec

Parameters:
res - Resource to hold PropertySet
Returns:
Propertyset or null

findPropertyDefinition

public static PropertyDefinition findPropertyDefinition(java.lang.String propertySet,
                                                        java.lang.String propertyName,
                                                        AObject context)
Find an AADL property definition by name.

Parameters:
propertySet - The name of the property set in which to look for the property definition.
propertyName - The name of the property to look for
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)
Returns:
The PropertyDefinitionof the given property if found, or null if the property definition cannot be found. The property might not be found if either the property set does not exist, or if the property is not found in the given property set.

findPropertyDefinition

public static PropertyDefinition findPropertyDefinition(java.lang.String propertyName)
Find a predeclared AADL property definition by name.

Parameters:
propertyName - The name of the property to look for
Returns:
The PropertyDefinitionof the given property if found, or null if the property definition cannot be found. The property might not be found if either the property set does not exist, or if the property is not found in the given property set.

findPropertyDefinitionInModel

public static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertyName,
                                                               AObject modelobj)
Find a predeclared AADL property definition by name.

Parameters:
propertyName - The name of the property to look for
Returns:
The PropertyDefinitionof the given property if found, or null if the property definition cannot be found. The property might not be found if either the property set does not exist, or if the property is not found in the given property set.

findPropertyDefinitionInModel

public static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertySetName,
                                                               java.lang.String propertyName,
                                                               AObject modelobj)
Find a predeclared AADL property definition by name.

Parameters:
propertySetName -
propertyName - The name of the property to look for
Returns:
The PropertyDefinitionof the given property if found, or null if the property definition cannot be found. The property might not be found if either the property set does not exist, or if the property is not found in the given property set.

findPropertyConstant

public static PropertyConstant findPropertyConstant(java.lang.String propertySet,
                                                    java.lang.String constantName,
                                                    AObject context)
Find an AADL property constant by name.

Parameters:
propertySet - The name of the property set in which to look for the property constant.
constantName - The name of the constant to look for
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)
Returns:
The PropertyConstantof the given constant if found, or null if the property constant cannot be found. The constant might not be found if either the property set does not exist, or if the constant is not found in the given property set.

findPropertyConstant

public static PropertyConstant findPropertyConstant(java.lang.String constantName)
Find a predeclared AADL property constant by name.

Parameters:
constantName - The name of the constant to look for
Returns:
The PropertyConstantof the given constant if found, or null if the property constant cannot be found. The constant might not be found if either the property set does not exist, or if the constant is not found in the predeclared property set.

findPropertyType

public static PropertyType findPropertyType(java.lang.String typeName)
Find a predeclared AADL property type by name.

Parameters:
typeName - The name of the type to look for
Returns:
The PropertyTypeof the given type if found, or null if the property type cannot be found. The type might not be found if either the property set does not exist, or if the type is not found in the given property set.

findPropertyType

public static PropertyType findPropertyType(java.lang.String propertySet,
                                            java.lang.String constantName,
                                            AObject context)
Find an AADL property type by name.

Parameters:
propertySet - The name of the property set in which to look for the property constant.
constantName - The name of the type to look for
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)
Returns:
The PropertyTypeof the given type if found, or null if the property type cannot be found. The type might not be found if either the property set does not exist, or if the type is not found in the given property set.

findUnitLiteral

public static UnitLiteral findUnitLiteral(java.lang.String propertySetName,
                                          java.lang.String unitsTypeName,
                                          java.lang.String unitLiteralName,
                                          AObject context)
Find an AADL unit literal by name. This method is a static alternative of edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupUnitLiteral(String, String, String).

Parameters:
propertySetName - The name of the property set in which to look for the units type.
unitsTypeName - The name of the units type in which to look for the unit literal.
unitLiteralName - The name of the unit literal to look for.
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)
Returns:
The UnitLiteral of the given literal if found, or null if the units type or unit literal cannot be found. The unit literal might not be found if the property set does not exist, the units type is not found in the given property set, or the units literal is not found in the given units type.
Throws:
java.lang.ClassCastException - Thrown if unitsTypeName refers to a PropertyType object in the given property set which is not a UnitsType.

findUnitLiteral

public static UnitLiteral findUnitLiteral(java.lang.String unitsTypeName,
                                          java.lang.String unitLiteralName)
Find a predeclared AADL unit literal by name. This method is a static alternative of edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupUnitLiteral(String, String).

Parameters:
unitsTypeName - The name of the units type in which to look for the unit literal.
unitLiteralName - The name of the unit literal to look for.
Returns:
The UnitLiteral of the given literal if found, or null if the units type or unit literal cannot be found. The unit literal might not be found if the units type is not found in the predeclared property sets or the units literal is not found in the given units type.
Throws:
java.lang.ClassCastException - Thrown if unitsTypeName refers to a PropertyType object which is not a UnitsType.

findEnumerationLiteral

public EnumLiteral findEnumerationLiteral(java.lang.String propertySetName,
                                          java.lang.String enumTypeName,
                                          java.lang.String enumLiteralName,
                                          AObject context)
Find an AADL enum literal by name. This method is a static alternative of edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupEnumerationLiteral(String, String, String).

Parameters:
propertySetName - The name of the property set in which to look for the enum type.
enumTypeName - The name of the enum type in which to look for the enum literal.
enumLiteralName - The name of the enum literal to look for.
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)
Returns:
The EnumLiteral of the given literal if found, or null if the enum type or enum literal cannot be found. The enum literal might not be found if the property set does not exist, the enum type is not found in the given property set, or the enum literal is not found in the given enum type.
Throws:
java.lang.ClassCastException - Thrown if enumTypeName refers to a PropertyType object in the given property set which is not an EnumType.

findEnumerationLiteral

public EnumLiteral findEnumerationLiteral(java.lang.String enumTypeName,
                                          java.lang.String enumLiteralName)
Find a predeclared AADL enum literal by name. This method is a static alternative of edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupEnumerationLiteral(String, String).

Parameters:
enumTypeName - The name of the enum type in which to look for the enum literal.
enumLiteralName - The name of the enum literal to look for.
Returns:
The EnumLiteral of the given literal if found, or null if the enum type or enum literal cannot be found. The enum literal might not be found if the enum type is not found in the predeclared property sets or the enum literal is not found in the given enum type.
Throws:
java.lang.ClassCastException - Thrown if enumTypeName refers to a PropertyType object which is not an EnumType.

getAllPropertySets

public static java.util.Set<PropertySet> getAllPropertySets()
Get all the global property sets in the resource set.

Returns:
Set of PropertySetobjects.

getAllPublicPackages

public static java.util.Set<AadlPackage> getAllPublicPackages()
Get all the global public packages in the resource set.

Returns:
Set of Public Packages.

getAllPropertySets

public static java.util.Set<PropertySet> getAllPropertySets(AObject context)
Get all the property sets visible to the given model element. If the given element is null, only the global property sets are returned. If the given element is not null, then any locally declared property sets in the model object's name space (see findPropertySet(String, AObject)) are also returned, and they shadow any globally declared property sets with the same name.

Parameters:
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)

getAllPublicPackages

public static java.util.Set<AadlPackage> getAllPublicPackages(AObject context)
Get all the property sets visible to the given model element. If the given element is null, only the global property sets are returned. If the given element is not null, then any locally declared property sets in the model object's name space (see findPropertySet(String, AObject)) are also returned, and they shadow any globally declared property sets with the same name.

Parameters:
context - The model object on whose behalf this lookup is being performed. For example, this could be the AadlSpec of the model being analyzed. Or it could be the object whose property values are of interest. See findPropertySet(String, AObject)

findPublicAadlPackage

public static AadlPackage findPublicAadlPackage(java.lang.String pn,
                                                AObject context)
Find an AADL package by name in in the local aadlspec, a resource in the resource set or workspace. The package must have a public part.

Parameters:
pn - string property set name
context - AObject whose root object may provide a local context for package lookup
Returns:
AadlPackage to the package, null if not found.

findPublicAadlPackageInResourceSet

public static AadlPackage findPublicAadlPackageInResourceSet(java.lang.String pn)
find public package in resource set.

Parameters:
pn - package name in AADL syntax
Returns:
AadlPackage or null

findPrivateOnlyAadlPackage

public static AadlPackage findPrivateOnlyAadlPackage(java.lang.String pn,
                                                     AObject context)
Find an AADL package by name in in the local aadlspec, a resource in the resource set or workspace. The package must have a only private part.

Parameters:
pn - string property set name
context - AObject whose root object may provide a local context for package lookup
Returns:
AadlPackage to the package, null if not found.

getPublicAadlPackage

public static AadlPackage getPublicAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
return the AadlPackage if it has a public part. The AadlPackage may be the root itself or the single element of the AadlSpec

Parameters:
res - Resource to hold AadlPackage
Returns:
AadlPackage or null

getAadlPackage

public static AadlPackage getAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
If the resource contains a package declaration only, then it is returned. The package can have public, private, or both public and private parts.


getPrivateOnlyAadlPackage

public static AadlPackage getPrivateOnlyAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
return the AadlPackage if it only has a private part. The AadlPackage may be the root itself or the single element of the AadlSpec

Parameters:
res - Resource to hold AadlPackage
Returns:
AadlPackage or null

getAllParsedResources

public static java.util.Set<CoreResourceImpl> getAllParsedResources()
Get all resources in the resource set that have just been parsed.

Returns:
Set of Resource objects.

clearJustParsed

public static void clearJustParsed()
Clear all the "just parsed" flags.


saveAllParsed

public static void saveAllParsed()
Save all resources in the resource set that have been parsed. They are saved and marked as derived.


saveAsDerived

public static void saveAsDerived(org.eclipse.emf.ecore.resource.Resource res)
save resource as derived file. to be called by parser.

Parameters:
res -

containsIResourceByPath

public static boolean containsIResourceByPath(java.util.Collection iresset,
                                              org.eclipse.core.resources.IResource matchIRes)

tagModelWithSyntaxErrors

public static void tagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
tag the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors It is also touched to make sure it has a newer date than the text.

Parameters:
model - Resource of aaxl model

untagModelWithSyntaxErrors

public static void untagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
untag the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors

Parameters:
model - Resource of aaxl model

isModelTaggedWithSyntaxErrors

public static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.EObject model)
check whether the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors

Parameters:
model - any EObject in the model
Returns:
true if its resource is tagged as its aadl text equivalent having syntax errors

isModelTaggedWithSyntaxErrors

public static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
check whether the IResource of the model Resource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors

Parameters:
model - Resource of aaxl model
Returns:
true if it is tagged as its aadl text equivalent having syntax errors

isModelTaggedWithSyntaxErrors

public static boolean isModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource modelfile)
check whether the model IResource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors

Parameters:
modelfile - aaxl file
Returns:
true if it is tagged as its aadl text equivalent having syntax errors

containsModelTaggedWithSyntaxErrors

public static boolean containsModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource ires)
check whether the ires IResource is tagged with syntax errors i.e., its corresponding aadl text file has syntax errors

Parameters:
ires - project, folder, or IResource
Returns:
true if it contains a IResource that is tagged as its aadl text equivalent having syntax errors

getAllOtherResources

public static java.util.Set<org.eclipse.emf.ecore.resource.Resource> getAllOtherResources(org.eclipse.emf.ecore.resource.Resource res)
Get all resources in the resource set except res or standard property sets

Parameters:
res - resoruce to be excluded
Returns:
Set of Resource objects.

loadPluginContributedAadl

protected static void loadPluginContributedAadl()

isPredeclaredResource

public static boolean isPredeclaredResource(org.eclipse.emf.ecore.resource.Resource r)

deleteComplementFileIfGenerated

public static void deleteComplementFileIfGenerated(org.eclipse.core.resources.IFile deletedfile)
delete the complement file for the given deleted file if the complement is a derived file

Parameters:
deletedfile -

deleteComplementFile

public static void deleteComplementFile(org.eclipse.core.resources.IFile deletedfile)
delete the complement file for the given deleted file

Parameters:
deletedfile -

deleteComplementFolder

public static void deleteComplementFolder(org.eclipse.core.resources.IFolder deletedfolder)
delete the complement file for the given deleted file

Parameters:
deletedfolder -

deleteFile

public static void deleteFile(org.eclipse.core.resources.IFile model)
Delete the given file.


doPropagateModelChange

public static void doPropagateModelChange(org.eclipse.emf.ecore.resource.Resource origres)
make resources as modified if their model objects point to the any object in the given model (resource)

Parameters:
obj -

doPropagateNameChange

public static void doPropagateNameChange(AObject obj)
make resources as modified if their model objects point to the named object

Parameters:
obj -