|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sei.aadl.model.pluginsupport.OsateResourceManager
public class OsateResourceManager
static utility methods for handling models as persistent resources
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 |
---|
protected static OsateResourceSet resourceSet
Constructor Detail |
---|
public OsateResourceManager()
Method Detail |
---|
public static OsateResourceSet getResourceSet()
public static void printResourceSet()
public static void removeResources()
public static void removeResource(org.eclipse.core.resources.IResource ires)
ires
- public static void removeResource(org.eclipse.emf.ecore.resource.Resource res)
public static void populateResourceSet()
public static void populateResourceSet(java.util.List<? extends org.eclipse.core.resources.IFile> files)
files
- public static void forceLoadResource(org.eclipse.emf.common.util.URI uri)
uri
- protected static void run(java.util.List<? extends org.eclipse.core.resources.IFile> files, org.eclipse.core.runtime.IProgressMonitor monitor)
public static void load(org.eclipse.emf.ecore.resource.Resource res)
res
- resourcepublic static void reload(org.eclipse.emf.ecore.resource.Resource res)
res
- resourcepublic static void save(org.eclipse.emf.ecore.resource.Resource res)
res
- Resourcepublic static org.eclipse.core.resources.IResource convertToIResource(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource
public static org.eclipse.core.resources.IResource getIResource(org.eclipse.core.runtime.IPath path)
path
-
public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.core.resources.IResource ires)
ires
- IResource
public static org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri)
uri
- URI
public static org.eclipse.emf.ecore.resource.Resource loadResource(org.eclipse.emf.common.util.URI uri)
uri
- URI
public static org.eclipse.emf.ecore.resource.Resource findResource(org.eclipse.emf.common.util.URI uri)
uri
- URI
public static org.eclipse.emf.ecore.resource.Resource findResource(java.lang.String name)
name
- String
public static org.eclipse.emf.ecore.resource.Resource getEmptyResource(org.eclipse.emf.common.util.URI uri)
uri
- uri
public static org.eclipse.core.runtime.IPath getOsatePath(org.eclipse.emf.common.util.URI resourceURI)
resourceURI
- The URI of the Resource
java.lang.IllegalArgumentException
- Thrown if the URI is
does not use the "platform:" protocol.public static boolean isAadlXMLResource(org.eclipse.core.resources.IResource ires)
ires
- public static AObject getAObjectFromIResource(org.eclipse.core.resources.IResource ires)
null
otherwise.
public static PropertySet findPropertySet(java.lang.String psn, AObject context)
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.
psn
- String property set namecontext
- 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.
public static PropertySet findPropertySetInResourceSet(java.lang.String psn)
psn
- property set name
public static PropertySet findPropertySetInResourceSet(java.lang.String psn, org.eclipse.emf.ecore.resource.ResourceSet resset)
psn
- property set name
public static PropertySet getPropertySet(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource to hold PropertySet
public static PropertyDefinition findPropertyDefinition(java.lang.String propertySet, java.lang.String propertyName, AObject context)
propertySet
- The name of the property set in which to look for the property
definition.propertyName
- The name of the property to look forcontext
- 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)
PropertyDefinition
of
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.public static PropertyDefinition findPropertyDefinition(java.lang.String propertyName)
propertyName
- The name of the property to look for
PropertyDefinition
of
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.public static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertyName, AObject modelobj)
propertyName
- The name of the property to look for
PropertyDefinition
of
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.public static PropertyDefinition findPropertyDefinitionInModel(java.lang.String propertySetName, java.lang.String propertyName, AObject modelobj)
propertySetName
- propertyName
- The name of the property to look for
PropertyDefinition
of
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.public static PropertyConstant findPropertyConstant(java.lang.String propertySet, java.lang.String constantName, AObject context)
propertySet
- The name of the property set in which to look for the property
constant.constantName
- The name of the constant to look forcontext
- 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)
PropertyConstant
of
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.public static PropertyConstant findPropertyConstant(java.lang.String constantName)
constantName
- The name of the constant to look for
PropertyConstant
of
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.public static PropertyType findPropertyType(java.lang.String typeName)
typeName
- The name of the type to look for
PropertyType
of 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.public static PropertyType findPropertyType(java.lang.String propertySet, java.lang.String constantName, AObject context)
propertySet
- The name of the property set in which to look for the property
constant.constantName
- The name of the type to look forcontext
- 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)
PropertyType
of 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.public static UnitLiteral findUnitLiteral(java.lang.String propertySetName, java.lang.String unitsTypeName, java.lang.String unitLiteralName, AObject context)
edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupUnitLiteral(String, String, String)
.
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)
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.
java.lang.ClassCastException
- Thrown if unitsTypeName
refers to a
PropertyType
object in the given property set which is not a
UnitsType
.public static UnitLiteral findUnitLiteral(java.lang.String unitsTypeName, java.lang.String unitLiteralName)
edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupUnitLiteral(String, String)
.
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.
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.
java.lang.ClassCastException
- Thrown if unitsTypeName
refers to a
PropertyType
object which is not a
UnitsType
.public EnumLiteral findEnumerationLiteral(java.lang.String propertySetName, java.lang.String enumTypeName, java.lang.String enumLiteralName, AObject context)
edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupEnumerationLiteral(String, String, String)
.
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)
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.
java.lang.ClassCastException
- Thrown if enumTypeName
refers to a
PropertyType
object in the given property set which is not an
EnumType
.public EnumLiteral findEnumerationLiteral(java.lang.String enumTypeName, java.lang.String enumLiteralName)
edu.cmu.sei.osate.ui.actions.AbstractAaxlAction.lookupEnumerationLiteral(String, String)
.
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.
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.
java.lang.ClassCastException
- Thrown if enumTypeName
refers to a
PropertyType
object which is not an
EnumType
.public static java.util.Set<PropertySet> getAllPropertySets()
Set
of PropertySet
objects.public static java.util.Set<AadlPackage> getAllPublicPackages()
Set
of Public Packages.public static java.util.Set<PropertySet> getAllPropertySets(AObject context)
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.
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)
public static java.util.Set<AadlPackage> getAllPublicPackages(AObject context)
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.
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)
public static AadlPackage findPublicAadlPackage(java.lang.String pn, AObject context)
pn
- string property set namecontext
- AObject whose root object may provide a local context for
package lookup
public static AadlPackage findPublicAadlPackageInResourceSet(java.lang.String pn)
pn
- package name in AADL syntax
public static AadlPackage findPrivateOnlyAadlPackage(java.lang.String pn, AObject context)
pn
- string property set namecontext
- AObject whose root object may provide a local context for
package lookup
public static AadlPackage getPublicAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource to hold AadlPackage
public static AadlPackage getAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
public static AadlPackage getPrivateOnlyAadlPackage(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource to hold AadlPackage
public static java.util.Set<CoreResourceImpl> getAllParsedResources()
Set
of Resource
objects.public static void clearJustParsed()
public static void saveAllParsed()
public static void saveAsDerived(org.eclipse.emf.ecore.resource.Resource res)
res
- public static boolean containsIResourceByPath(java.util.Collection iresset, org.eclipse.core.resources.IResource matchIRes)
public static void tagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
model
- Resource of aaxl modelpublic static void untagModelWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
model
- Resource of aaxl modelpublic static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.EObject model)
model
- any EObject in the model
public static boolean isModelTaggedWithSyntaxErrors(org.eclipse.emf.ecore.resource.Resource model)
model
- Resource of aaxl model
public static boolean isModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource modelfile)
modelfile
- aaxl file
public static boolean containsModelTaggedWithSyntaxErrors(org.eclipse.core.resources.IResource ires)
ires
- project, folder, or IResource
public static java.util.Set<org.eclipse.emf.ecore.resource.Resource> getAllOtherResources(org.eclipse.emf.ecore.resource.Resource res)
res
- resoruce to be excluded
Set
of Resource
objects.protected static void loadPluginContributedAadl()
public static boolean isPredeclaredResource(org.eclipse.emf.ecore.resource.Resource r)
public static void deleteComplementFileIfGenerated(org.eclipse.core.resources.IFile deletedfile)
deletedfile
- public static void deleteComplementFile(org.eclipse.core.resources.IFile deletedfile)
deletedfile
- public static void deleteComplementFolder(org.eclipse.core.resources.IFolder deletedfolder)
deletedfolder
- public static void deleteFile(org.eclipse.core.resources.IFile model)
public static void doPropagateModelChange(org.eclipse.emf.ecore.resource.Resource origres)
obj
- public static void doPropagateNameChange(AObject obj)
obj
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |