public class ProjectMap extends StandaloneProjectMap
StandaloneProjectMap
to support polymorphic access in either plugin or standalone environments
to EMF resources and EPackages.
#getProjectMap()
returns a map of project names, but not bundle names, to resolvable location.
initializePackageRegistry(ResourceSet)
augments the default EMF startup in a plugin environment
whereby the global package registry acquires a registration for each namespace URI
(e.g. http://www.eclipse.org/emf/2002/Ecore) defined by the
org.eclipse.emf.ecore.generated_package extension point in plugins.
The standard reguistration is auugmented where appropriate, by two further registrations for
the project URI (e.g. platform:/resource/org.eclipse.emf.ecore/model/Ecore.ecore) and the plugin URI
(e.g. platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore). These extra registrations
derived from the genPackages.ecorePackage referenced by the genmodel
org.eclipse.emf.ecore.generated_package declarations ensure that all three URIs resolve to
the same Resource eliminating most opportunities for meta-model schizophrenia.
#initializePlatformResourceMap()
does nothing since the standard EMF Platform URI Handler
can open platform resources directly.
#initializeGenModelLocationMap(ResourceSet)
does nothing, since the standard EMF startup in a
plugin environment populates the EcorePlugin.getEPackageNsURIToGenModelLocationMap()
.
#initializeURIMap(URIConverter)
installs explicit URI mappings into the URIConverter
so that for each project so that both platform:/resource/project and
platform:/plugin/project reference platform:/resource/project. An additional
backstop URI mapping redirects platform:/resource to platform:/plugin.
The explicit mapping ensures that projects are accessible as either platform:/resource/project or platform:/plugin/project. The backstop mapping ensures that plugins, that are not occluded by projects, are accessible as platform:/plugin/project or platform:/resource/project, without needing to create an explicit URI map entry for each of the many hundreds of bundles in typical use.
Modifier and Type | Class and Description |
---|---|
static class |
ProjectMap.ProjectDescriptor |
StandaloneProjectMap.GenModelEcorePackageHandler, StandaloneProjectMap.IPackageDescriptor, StandaloneProjectMap.IProjectDescriptor, StandaloneProjectMap.PackageDescriptor, StandaloneProjectMap.PluginGenModelHandler
initializedGenModelLocationMap, initializedPlatformResourceMap
Constructor and Description |
---|
ProjectMap() |
Modifier and Type | Method and Description |
---|---|
protected StandaloneProjectMap.IProjectDescriptor.Internal |
createProjectDescriptor(java.lang.String projectName,
org.eclipse.emf.common.util.URI locationURI) |
static ProjectMap |
findAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) |
static ProjectMap |
getAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) |
org.eclipse.emf.common.util.URI |
getLocation(java.lang.String projectName)
Return the resolveable URI for a given project or bundle name.
|
void |
initializeGenModelLocationMap(boolean force)
Initialize the
EcorePlugin.getEPackageNsURIToGenModelLocationMap() so that in a
standalone environment the locations of all genmodels are available. |
void |
initializePackageRegistry(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Install lazy IPackageDescriptors in the EPackage.Registry for all
registered packages and their platform:/plugin and platform:/resource
synonyms, which are determined by examining the genPackages.ecorePackage
attribute in all genModels.
|
void |
initializePlatformResourceMap(boolean force)
Initialize the
EcorePlugin.getPlatformResourceMap() so that in a
standalone environment and in conjunction with initializeURIMap(URIConverter) URIs such as
platform:/resource/project and
platform:/plugin/project are useable. |
void |
initializeURIMap(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Initialize the uriMap of a uriConverter so that each of
platform:/resource/project and
platform:/plugin/project resolve the workspace project
resource else the plugin bundle for use in either standalone or plugin
environment.
|
boolean |
isAdapterForType(java.lang.Object type) |
protected void |
scanClassPath(java.util.Map<java.lang.String,StandaloneProjectMap.IProjectDescriptor.Internal> projectDescriptors,
javax.xml.parsers.SAXParser saxParser) |
protected void |
scanGenModels(javax.xml.parsers.SAXParser saxParser) |
protected void |
scanProjects(java.util.Map<java.lang.String,StandaloneProjectMap.IProjectDescriptor.Internal> projectDescriptors) |
getExceptionMap, getPackageRegistry, getProjectDescriptor, getProjectDescriptorInternal, getProjectDescriptors, getResourceFactoryRegistry, getURIConverter, getURIMap, initializeResourceSet, initializeURIResourceMap, initStatics, logException, registerBundle, registerProject, scanFolder, toString
public static ProjectMap findAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
public static ProjectMap getAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
protected StandaloneProjectMap.IProjectDescriptor.Internal createProjectDescriptor(java.lang.String projectName, org.eclipse.emf.common.util.URI locationURI)
createProjectDescriptor
in class StandaloneProjectMap
public org.eclipse.emf.common.util.URI getLocation(java.lang.String projectName)
StandaloneProjectMap
getLocation
in class StandaloneProjectMap
public void initializeGenModelLocationMap(boolean force)
StandaloneProjectMap
EcorePlugin.getEPackageNsURIToGenModelLocationMap()
so that in a
standalone environment the locations of all genmodels are available.
Initialization is only necessary once and for a standalone environment. If force is true a re-initialization or plugin initialization may be forced.
initializeGenModelLocationMap
in class StandaloneProjectMap
public void initializePackageRegistry(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
StandaloneProjectMap
initializePackageRegistry
in class StandaloneProjectMap
public void initializePlatformResourceMap(boolean force)
StandaloneProjectMap
EcorePlugin.getPlatformResourceMap()
so that in a
standalone environment and in conjunction with initializeURIMap(URIConverter)
URIs such as
platform:/resource/project and
platform:/plugin/project are useable.
Initialization is only necessary once and for a standalone environment. If force is true a re-initialization or plugin initialization may be forced.
initializePlatformResourceMap
in class StandaloneProjectMap
public void initializeURIMap(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
StandaloneProjectMap
Note that in a plugin environment, a single platform:/resource/ to platform:/plugin/ mapping is sufficient since platform:/plugin/ is directly resolveable by the Eclipse Platform.
initializeURIMap
in class StandaloneProjectMap
public boolean isAdapterForType(java.lang.Object type)
isAdapterForType
in interface org.eclipse.emf.common.notify.Adapter
isAdapterForType
in class StandaloneProjectMap
protected void scanClassPath(java.util.Map<java.lang.String,StandaloneProjectMap.IProjectDescriptor.Internal> projectDescriptors, javax.xml.parsers.SAXParser saxParser)
scanClassPath
in class StandaloneProjectMap
protected void scanGenModels(javax.xml.parsers.SAXParser saxParser)
protected void scanProjects(java.util.Map<java.lang.String,StandaloneProjectMap.IProjectDescriptor.Internal> projectDescriptors)