public class ProjectMap extends StandaloneProjectMap
ProjectManager
to support polymorphic access in either plugin or standalone environments
to EMF resources and EPackages.
StandaloneProjectMap.getProjectDescriptors()
returns a map of project names, but not bundle names, to resolvable location.
StandaloneProjectMap.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(boolean)
does nothing since the standard EMF Platform URI Handler
can open platform resources directly.
StandaloneProjectMap.initializeGenModelLocationMap(boolean)
does nothing, since the standard EMF startup in a
plugin environment populates the EcorePlugin.getEPackageNsURIToGenModelLocationMap()
.
initializeURIMap(ResourceSet)
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.AbstractResourceDescriptor, StandaloneProjectMap.AbstractResourceLoadStatus, StandaloneProjectMap.AbstractResourceLoadStrategy, StandaloneProjectMap.DelegatedMultiplePackageResource, StandaloneProjectMap.DelegatedSinglePackageResource, StandaloneProjectMap.EPackageDescriptor, StandaloneProjectMap.GenModelReader, StandaloneProjectMap.LoadBothStrategy, StandaloneProjectMap.LoadDynamicResourceStrategy, StandaloneProjectMap.LoadFirstStrategy, StandaloneProjectMap.LoadGeneratedPackageStrategy, StandaloneProjectMap.LoadingBothLoadedDynamicResourceStrategy, StandaloneProjectMap.MapToFirstConflictHandler, StandaloneProjectMap.MapToFirstConflictHandlerWithLog, StandaloneProjectMap.MultiplePackageResourceDescriptor, StandaloneProjectMap.MultiplePackageResourceLoadStatus, StandaloneProjectMap.PackageDescriptor, StandaloneProjectMap.PackageLoadStatus, StandaloneProjectMap.PluginReader, StandaloneProjectMap.SinglePackageResourceDescriptor, StandaloneProjectMap.SinglePackageResourceLoadStatus
ProjectManager.IConflictHandler, ProjectManager.IPackageDescriptor, ProjectManager.IPackageLoadStatus, ProjectManager.IProjectDescriptor, ProjectManager.IResourceDescriptor, ProjectManager.IResourceLoadStatus, ProjectManager.IResourceLoadStrategy
initializedPlatformResourceMap, isGlobal, liveStandaloneProjectMaps, nsURI2package, PROJECT_MAP_ADD_EPACKAGE, PROJECT_MAP_ADD_GEN_MODEL, PROJECT_MAP_ADD_GENERATED_PACKAGE, PROJECT_MAP_ADD_URI_MAP, PROJECT_MAP_CONFIGURE, PROJECT_MAP_GET, PROJECT_MAP_INSTALL, PROJECT_MAP_RESOLVE, uri2resource
CLASS_PATH, NO_PROJECTS
Constructor and Description |
---|
ProjectMap(boolean isGlobal) |
Modifier and Type | Method and Description |
---|---|
protected ProjectManager.IProjectDescriptor |
createProjectDescriptor(java.lang.String projectName,
org.eclipse.emf.common.util.URI locationURI) |
static StandaloneProjectMap |
findAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet) |
static StandaloneProjectMap |
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 |
initializePlatformResourceMap(boolean force)
Initialize the
EcorePlugin.getPlatformResourceMap() so that in a standalone
environment and in conjunction with StandaloneProjectMap.initializeURIMap(ResourceSet) 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,ProjectManager.IProjectDescriptor> projectDescriptors,
javax.xml.parsers.SAXParser saxParser) |
protected void |
scanGenModels(javax.xml.parsers.SAXParser saxParser) |
protected void |
scanProjects(java.util.Map<java.lang.String,ProjectManager.IProjectDescriptor> projectDescriptors) |
addResourceDescriptor, configure, finalize, getExceptionMap, getPackageDescriptor, getPackageRegistry, getProjectDescriptor, getProjectDescriptorInternal, getProjectDescriptors, getProjectNames, getResourceFactoryRegistry, getTarget, getURIConverter, getURIMap, initializeGenModelLocationMap, initializePackageRegistry, initializeResourceSet, initializeURIResourceMap, initStatics, isGlobal, logException, notifyAddedDynamicResource, notifyChanged, registerBundle, registerProject, scanFolder, setTarget, toString, unload, useGeneratedResource
@Nullable public static StandaloneProjectMap findAdapter(@NonNull org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
@NonNull public static StandaloneProjectMap getAdapter(@NonNull org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
@NonNull protected ProjectManager.IProjectDescriptor createProjectDescriptor(@NonNull java.lang.String projectName, @NonNull org.eclipse.emf.common.util.URI locationURI)
createProjectDescriptor
in class StandaloneProjectMap
public org.eclipse.emf.common.util.URI getLocation(@NonNull java.lang.String projectName)
StandaloneProjectMap
getLocation
in class StandaloneProjectMap
public void initializePlatformResourceMap(boolean force)
StandaloneProjectMap
EcorePlugin.getPlatformResourceMap()
so that in a standalone
environment and in conjunction with StandaloneProjectMap.initializeURIMap(ResourceSet)
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(@Nullable 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(@NonNull java.util.Map<java.lang.String,ProjectManager.IProjectDescriptor> projectDescriptors, @NonNull javax.xml.parsers.SAXParser saxParser)
scanClassPath
in class StandaloneProjectMap
protected void scanGenModels(@NonNull javax.xml.parsers.SAXParser saxParser)
protected void scanProjects(@NonNull java.util.Map<java.lang.String,ProjectManager.IProjectDescriptor> projectDescriptors)