|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sei.aadl.modelsupport.eclipseinterface.OsateResourceManager
public class OsateResourceManager
static utility methods for handling models as persistent resources
Field Summary | |
---|---|
static GlobalNamespace |
GLOBAL_NAMESPACE
Reference to the global namespace singleton for OSATE. |
static java.util.Map<java.lang.Object,java.lang.Object> |
LOAD_OPTIONS
|
static java.lang.String |
PLUGIN_RESOURCES_DIRECTORY_NAME
|
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 |
static java.util.Map<java.lang.Object,java.lang.Object> |
SAVE_OPTIONS
|
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(Element obj)
make resources as modified if their model objects point to the named object |
static NamedElement |
findPackageOrPropertySet(java.lang.String name)
Find an AadlPackage or a PropertySet in the resource set. |
static PrivatePackageSection |
findPrivatePackageSection(java.lang.String name)
Find a PrivatePackageSection in the resource set. |
static Property |
findProperty(java.lang.String propertyName)
Find a predeclared AADL property definition by name. |
static Property |
findProperty(java.lang.String propertySet,
java.lang.String propertyName)
Find an AADL property definition by name. |
static PropertyConstant |
findPropertyConstant(java.lang.String propertyName)
Find an AADL property constant by name. |
static PropertyConstant |
findPropertyConstant(java.lang.String propertySet,
java.lang.String propertyName)
|
static PropertySet |
findPropertySet(java.lang.String name)
|
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 propertyName)
|
static AadlPackage |
findPublicAadlPackage(java.lang.String pn,
Element 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 PublicPackageSection |
findPublicPackageSection(java.lang.String name)
Find a PublicPackageSection in the 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 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<Aadl2ResourceImpl> |
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<AadlPackage> |
getAllPublicPackages()
Get all the global public packages in the resource set. |
static java.util.Set<AadlPackage> |
getAllPublicPackages(Element context)
Get all the property sets visible to the given model element. |
static Element |
getElementFromIResource(org.eclipse.core.resources.IResource ires)
Given an IResource, returns the root Element 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 java.util.List<PropertySet> |
getPredeclaredPropertySets()
|
static PropertySet |
getPropertySet(org.eclipse.emf.ecore.resource.Resource res)
Return the property set 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 resource set shared by a collection of Aaxl, aagl files if it has not been initialized, this method 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 |
isNewerThan(org.eclipse.emf.ecore.resource.Resource a,
org.eclipse.emf.ecore.resource.Resource b)
compare modification date of a to b based on LocalTimeStamp |
static boolean |
isPredeclaredResource(org.eclipse.emf.ecore.resource.Resource r)
|
static void |
load(org.eclipse.emf.ecore.resource.Resource res)
load resource |
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 |
static void |
revertToContributed(org.eclipse.core.resources.IFile contributedResourceInWorkspace)
|
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 |
---|
public static final GlobalNamespace GLOBAL_NAMESPACE
public static final java.lang.String PLUGIN_RESOURCES_DIRECTORY_NAME
protected static OsateResourceSet resourceSet
public static final java.util.Map<java.lang.Object,java.lang.Object> LOAD_OPTIONS
public static final java.util.Map<java.lang.Object,java.lang.Object> SAVE_OPTIONS
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 Element getElementFromIResource(org.eclipse.core.resources.IResource ires)
null
otherwise.
public static PropertySet getPropertySet(org.eclipse.emf.ecore.resource.Resource res)
res
- Resource to hold PropertySet
public static Property findProperty(java.lang.String propertySet, java.lang.String propertyName)
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, Element)
edu.cmu.sei.aadl.model.property.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 Property findProperty(java.lang.String propertyName)
propertyName
- The name of the property to look for
Property
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 propertyName)
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, Element)
edu.cmu.sei.aadl.model.property.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 propertySet, java.lang.String propertyName)
public static PropertyType findPropertyType(java.lang.String typeName)
typeName
- The name of the type to look for
edu.cmu.sei.aadl.model.property.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 propertyName)
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<AadlPackage> getAllPublicPackages(Element 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, Element)
) 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, Element)
public static AadlPackage findPublicAadlPackage(java.lang.String pn, Element 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 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 java.util.Set<Aadl2ResourceImpl> 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.public static void loadPluginContributedAadl()
public static void revertToContributed(org.eclipse.core.resources.IFile contributedResourceInWorkspace) throws java.io.IOException, org.eclipse.core.runtime.CoreException
java.io.IOException
org.eclipse.core.runtime.CoreException
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(Element obj)
obj
- public static PublicPackageSection findPublicPackageSection(java.lang.String name)
PublicPackageSection
in the resource set. The name of a
PublicPackageSection
is the same as the name of its containing
AadlPackage
. Returns null
if a
PublicPackageSection
with the specified name cannot be found.
name
- The name of the AadlPackage
and
PublicPackageSection
to search for.
PublicPackageSection
or null
if it
cannot be found.public static PrivatePackageSection findPrivatePackageSection(java.lang.String name)
PrivatePackageSection
in the resource set. The name of a
PrivatePackageSection
is the same as the name of its containing
AadlPackage
. Returns null
if a
PrivatePackageSection
with the specified name cannot be found.
name
- The name of the AadlPackage
and
PrivatePackageSection
to search for.
PrivatePackageSection
or null
if it
cannot be found.public static NamedElement findPackageOrPropertySet(java.lang.String name)
AadlPackage
or a PropertySet
in the resource set.
Returns null
if an AadlPackage
or a PropertySet
with the specified name cannot be found.
name
- The name of the AadlPackage
or PropertySet
to
search for.
AadlPackage
or PropertySet
or
null
if it cannot be found.public static PropertySet findPropertySet(java.lang.String name)
public static java.util.List<PropertySet> getPredeclaredPropertySets()
public static boolean isNewerThan(org.eclipse.emf.ecore.resource.Resource a, org.eclipse.emf.ecore.resource.Resource b)
res
- Resource to be compared against
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |