|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.common.notify.impl.SingletonAdapterImpl org.eclipse.ocl.examples.domain.utilities.StandaloneProjectMap org.eclipse.ocl.examples.domain.utilities.ProjectMap
public class ProjectMap
ProjectMap extends 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.
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()
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.
Nested Class Summary | |
---|---|
static class |
ProjectMap.ProjectDescriptor
|
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter |
---|
org.eclipse.emf.common.notify.Adapter.Internal |
Field Summary |
---|
Fields inherited from class org.eclipse.ocl.examples.domain.utilities.StandaloneProjectMap |
---|
initializedPlatformResourceMap, 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 |
Fields inherited from class org.eclipse.emf.common.notify.impl.SingletonAdapterImpl |
---|
targets |
Constructor Summary | |
---|---|
ProjectMap()
|
Method Summary | |
---|---|
protected StandaloneProjectMap.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 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> 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> projectDescriptors)
|
Methods inherited from class org.eclipse.ocl.examples.domain.utilities.StandaloneProjectMap |
---|
addResourceDescriptor, configure, dispose, finalize, getExceptionMap, getPackageDescriptor, getPackageRegistry, getProjectDescriptor, getProjectDescriptorInternal, getProjectDescriptors, getResourceFactoryRegistry, getURIConverter, getURIMap, initializeGenModelLocationMap, initializePackageRegistry, initializeResourceSet, initializeURIResourceMap, initStatics, logException, notifyAddedDynamicResource, notifyChanged, registerBundle, registerProject, scanFolder, toString, unload, useGeneratedResource |
Methods inherited from class org.eclipse.emf.common.notify.impl.SingletonAdapterImpl |
---|
dispose, getTarget, setTarget, unsetTarget |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProjectMap()
Method Detail |
---|
@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 StandaloneProjectMap.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 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(@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,StandaloneProjectMap.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,StandaloneProjectMap.IProjectDescriptor> projectDescriptors)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |