org.eclipse.ocl.examples.domain.utilities
Class StandaloneProjectMap.AbstractResourceDescriptor

java.lang.Object
  extended by org.eclipse.ocl.examples.domain.utilities.StandaloneProjectMap.AbstractResourceDescriptor
All Implemented Interfaces:
StandaloneProjectMap.IResourceDescriptor
Direct Known Subclasses:
StandaloneProjectMap.MultiplePackageResourceDescriptor, StandaloneProjectMap.SinglePackageResourceDescriptor
Enclosing class:
StandaloneProjectMap

public abstract static class StandaloneProjectMap.AbstractResourceDescriptor
extends java.lang.Object
implements StandaloneProjectMap.IResourceDescriptor

PackageDescriptor supports lazy class loading and initialization of a compiled Ecore package. Class loading occurs in the context of the ProjectMap, which performs classpath scans, so it is assumed that everything is visible. Re-use in a larger context may require a new ProjectMap to be created. If a PackageDescriptor is installed under multiple URIs, the resource created by the first load is shared by all subsequent resolutions. If a PackageDescriptor is set to useModel, the *.ecore file is loaded to provide the EPackage, rather than the Java className. A PackageDescriptor maintains the declared context of a package which may be shared by many ResourceSets. In contrast a PackageStatus maintains the actual state of a package for a particular EPackage.Registry, each of which may have a distinct ResourceLoadStrategy and consequently may not load the same EPackage.


Field Summary
protected  org.eclipse.emf.common.util.URI genModelURI
          The project-relative URI of the GenModel for the EPackage (e.g.
protected  java.util.List<StandaloneProjectMap.IPackageDescriptor> packageDescriptors
          The package descriptors for each of the multiple packages in the genmodel.
protected  StandaloneProjectMap.IProjectDescriptor projectDescriptor
          The bundle/project in which this package is defined (e.g.
 
Constructor Summary
protected StandaloneProjectMap.AbstractResourceDescriptor(StandaloneProjectMap.IProjectDescriptor projectDescriptor, org.eclipse.emf.common.util.URI genModelURI, java.util.Map<org.eclipse.emf.common.util.URI,java.lang.String> nsURI2className)
           
 
Method Summary
 void addedDynamicResource(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.resource.Resource resource)
           
 void addedGeneratedPackage(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.EPackage ePackage)
           
 void configure(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, StandaloneProjectMap.IResourceLoadStrategy resourceLoadStrategy, StandaloneProjectMap.IConflictHandler conflictHandler)
           
 void configureResourceSetURIResourceMap(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.resource.Resource resource)
           
protected abstract  StandaloneProjectMap.IResourceLoadStatus createResourceLoadStatus(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
           
 org.eclipse.emf.common.util.URI getGenModelURI()
          Return the project relative Gen Model URI.
 org.eclipse.emf.common.util.URI getLocationURI()
          Return the external filespace form of the model URI containing the package.
 java.util.List<? extends StandaloneProjectMap.IPackageDescriptor> getPackageDescriptors()
          Return the descriptors for allpackages in this resource.
 org.eclipse.emf.common.util.URI getPlatformPluginURI()
          Return the platform:/plugin form of the model URI containing the package
 org.eclipse.emf.common.util.URI getPlatformResourceURI()
          Return the platform:/resource form of the model URI containing the package
 StandaloneProjectMap.IProjectDescriptor getProjectDescriptor()
          Return the Project Descriptor containing this resource.
 org.eclipse.emf.common.util.URI getProjectRelativeEcorePackageURI(org.eclipse.emf.common.util.URI genModelRelativeEcorePackageURI)
           
 StandaloneProjectMap.IResourceLoadStatus getResourceLoadStatus(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Return IResourceLoadStatus for this resource in conjunction with resourceSet.
 boolean hasEcoreModel()
          Return true if setEcoreModel has defined the Ecore Model context.
 void setEcoreModel(java.util.List<java.lang.String> genModelRelativeEcorePackageUris, java.util.Map<java.lang.String,StandaloneProjectMap.IPackageDescriptor> nsURI2packageDescriptor)
          Set the Ecore Model context of the resource from a list of URIs of the Ecore Packages relative to the genModelURI, and a map of the package namespace URI to package descriptor.
 void unload(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Unload the package registry to force a reload.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

projectDescriptor

@NonNull
protected final StandaloneProjectMap.IProjectDescriptor projectDescriptor
The bundle/project in which this package is defined (e.g. for org.eclipse.emf.ecore).


genModelURI

@NonNull
protected final org.eclipse.emf.common.util.URI genModelURI
The project-relative URI of the GenModel for the EPackage (e.g. model/Ecore.genmodel).


packageDescriptors

@NonNull
protected final java.util.List<StandaloneProjectMap.IPackageDescriptor> packageDescriptors
The package descriptors for each of the multiple packages in the genmodel.

Constructor Detail

StandaloneProjectMap.AbstractResourceDescriptor

protected StandaloneProjectMap.AbstractResourceDescriptor(@NonNull
                                                          StandaloneProjectMap.IProjectDescriptor projectDescriptor,
                                                          @NonNull
                                                          org.eclipse.emf.common.util.URI genModelURI,
                                                          @NonNull
                                                          java.util.Map<org.eclipse.emf.common.util.URI,java.lang.String> nsURI2className)
Method Detail

addedDynamicResource

public void addedDynamicResource(@NonNull
                                 org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                 @NonNull
                                 org.eclipse.emf.ecore.resource.Resource resource)
Specified by:
addedDynamicResource in interface StandaloneProjectMap.IResourceDescriptor

addedGeneratedPackage

public void addedGeneratedPackage(@NonNull
                                  org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                  @NonNull
                                  org.eclipse.emf.ecore.EPackage ePackage)
Specified by:
addedGeneratedPackage in interface StandaloneProjectMap.IResourceDescriptor

configure

public void configure(@Nullable
                      org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                      @NonNull
                      StandaloneProjectMap.IResourceLoadStrategy resourceLoadStrategy,
                      @Nullable
                      StandaloneProjectMap.IConflictHandler conflictHandler)
Specified by:
configure in interface StandaloneProjectMap.IResourceDescriptor

configureResourceSetURIResourceMap

public void configureResourceSetURIResourceMap(@NonNull
                                               org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                               @NonNull
                                               org.eclipse.emf.ecore.resource.Resource resource)
Specified by:
configureResourceSetURIResourceMap in interface StandaloneProjectMap.IResourceDescriptor

createResourceLoadStatus

@NonNull
protected abstract StandaloneProjectMap.IResourceLoadStatus createResourceLoadStatus(@Nullable
                                                                                             org.eclipse.emf.ecore.resource.ResourceSet resourceSet)

getGenModelURI

@NonNull
public org.eclipse.emf.common.util.URI getGenModelURI()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the project relative Gen Model URI.

Specified by:
getGenModelURI in interface StandaloneProjectMap.IResourceDescriptor

getLocationURI

@NonNull
public org.eclipse.emf.common.util.URI getLocationURI()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the external filespace form of the model URI containing the package.

Specified by:
getLocationURI in interface StandaloneProjectMap.IResourceDescriptor

getPackageDescriptors

@NonNull
public java.util.List<? extends StandaloneProjectMap.IPackageDescriptor> getPackageDescriptors()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the descriptors for allpackages in this resource.

Specified by:
getPackageDescriptors in interface StandaloneProjectMap.IResourceDescriptor

getPlatformPluginURI

@NonNull
public org.eclipse.emf.common.util.URI getPlatformPluginURI()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the platform:/plugin form of the model URI containing the package

Specified by:
getPlatformPluginURI in interface StandaloneProjectMap.IResourceDescriptor

getPlatformResourceURI

@NonNull
public org.eclipse.emf.common.util.URI getPlatformResourceURI()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the platform:/resource form of the model URI containing the package

Specified by:
getPlatformResourceURI in interface StandaloneProjectMap.IResourceDescriptor

getProjectDescriptor

@NonNull
public StandaloneProjectMap.IProjectDescriptor getProjectDescriptor()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return the Project Descriptor containing this resource.

Specified by:
getProjectDescriptor in interface StandaloneProjectMap.IResourceDescriptor

getProjectRelativeEcorePackageURI

@NonNull
public org.eclipse.emf.common.util.URI getProjectRelativeEcorePackageURI(@NonNull
                                                                                 org.eclipse.emf.common.util.URI genModelRelativeEcorePackageURI)
Specified by:
getProjectRelativeEcorePackageURI in interface StandaloneProjectMap.IResourceDescriptor

getResourceLoadStatus

@NonNull
public StandaloneProjectMap.IResourceLoadStatus getResourceLoadStatus(@Nullable
                                                                              org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return IResourceLoadStatus for this resource in conjunction with resourceSet.

Specified by:
getResourceLoadStatus in interface StandaloneProjectMap.IResourceDescriptor

hasEcoreModel

public boolean hasEcoreModel()
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Return true if setEcoreModel has defined the Ecore Model context.

Specified by:
hasEcoreModel in interface StandaloneProjectMap.IResourceDescriptor

setEcoreModel

public void setEcoreModel(@NonNull
                          java.util.List<java.lang.String> genModelRelativeEcorePackageUris,
                          @NonNull
                          java.util.Map<java.lang.String,StandaloneProjectMap.IPackageDescriptor> nsURI2packageDescriptor)
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Set the Ecore Model context of the resource from a list of URIs of the Ecore Packages relative to the genModelURI, and a map of the package namespace URI to package descriptor.

Specified by:
setEcoreModel in interface StandaloneProjectMap.IResourceDescriptor

unload

public void unload(@NonNull
                   org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Description copied from interface: StandaloneProjectMap.IResourceDescriptor
Unload the package registry to force a reload.

Specified by:
unload in interface StandaloneProjectMap.IResourceDescriptor