|
|||||||||
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.BasicNotifierImpl org.eclipse.emf.common.notify.impl.NotifierImpl org.eclipse.emf.ecore.resource.impl.ResourceSetImpl org.eclipse.emf.henshin.model.resource.HenshinResourceSet
public class HenshinResourceSet
Resource set implementation for Henshin. Provides some convenience methods for easy use and supports automatic resolving of relative file URIs using a base directory.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl |
---|
ResourceSetImpl.MappedResourceLocator, ResourceSetImpl.ResourceLocator, ResourceSetImpl.ResourcesEList<E extends Object & Resource> |
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl |
---|
BasicNotifierImpl.EAdapterList<E extends Object & Adapter>, BasicNotifierImpl.EObservableAdapterList |
Field Summary |
---|
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl |
---|
adapterFactories, loadOptions, packageRegistry, resourceFactoryRegistry, resourceLocator, resources, uriConverter, uriResourceMap |
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl |
---|
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG |
Fields inherited from interface org.eclipse.emf.ecore.resource.ResourceSet |
---|
RESOURCE_SET__RESOURCES |
Constructor Summary | |
---|---|
HenshinResourceSet()
Constructor without base directory. |
|
HenshinResourceSet(String baseDir)
Constructor which sets the base directory for this resource set. |
Method Summary | |
---|---|
Resource |
createResource(String path)
Create a resource for a given path. |
URI |
getBaseDir()
Get the base directory for this resource set as a file URI. |
EObject |
getEObject(String path)
Load a resource for the given file name and get the first EObject contained in it. |
Module |
getModule(String path)
Load a Module from a Henshin file given as a
path and file name. |
Module |
getModule(String path,
boolean fixImports)
Load a Module from a Henshin file given as a
path and file name. |
Module |
getModule(URI uri,
boolean fixImports)
Load a Module from a Henshin file given by a URI. |
Resource |
getResource(String path)
Load a resource for the given (relative) path and file name. |
boolean |
initPackageImplementation(String packageClassName)
Try to initialize a generated package implementation. |
List<EPackage> |
registerDynamicEPackages(String ecorePath)
Load EPackage s from an Ecore file and
register them in the local package registry. |
void |
registerXMIResourceFactories(String... fileExtensions)
Register XMIResourceFactoryImpl s for the given file extensions. |
void |
saveEObject(EObject object,
String path)
Save an EObject at a given path. |
void |
saveEObject(EObject object,
URI uri)
Save an EObject at a given URI. |
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceSetImpl |
---|
createResource, createResource, delegatedGetResource, demandCreateResource, demandLoad, demandLoadHelper, getAdapterFactories, getAllContents, getEObject, getLoadOptions, getPackageRegistry, getResource, getResourceFactoryRegistry, getResources, getURIConverter, getURIResourceMap, handleDemandLoadException, setPackageRegistry, setResourceFactoryRegistry, setURIConverter, setURIResourceMap, toString |
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl |
---|
eAdapters, eBasicAdapters, eDeliver, eSetDeliver |
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl |
---|
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.emf.common.notify.Notifier |
---|
eAdapters, eDeliver, eNotify, eSetDeliver |
Constructor Detail |
---|
public HenshinResourceSet(String baseDir)
baseDir
- Base directory (can be also null
).public HenshinResourceSet()
Method Detail |
---|
public URI getBaseDir()
null
.public void registerXMIResourceFactories(String... fileExtensions)
XMIResourceFactoryImpl
s for the given file extensions.
The factories are registered in the scope of this resource set. The
resource factories are registered only if no other resource factory
is already registered for the file extension.
fileExtension
- File extensions.public List<EPackage> registerDynamicEPackages(String ecorePath)
EPackage
s from an Ecore file and
register them in the local package registry.
ecorePath
- The relative path to an Ecore file.
EPackage
s.public boolean initPackageImplementation(String packageClassName)
packageClassName
- Class name of the (interface) of a package implementation.
true
if the package was successfully initialized.public Resource getResource(String path)
path
- Possible relative model path.
public Resource createResource(String path)
path
- Possible relative model path.
getResource(String)
,
ResourceSetImpl.createResource(URI)
public EObject getEObject(String path)
EObject
contained in it. If the path is relative,
it will be resolved using the base directory of this resource set.
path
- Possible relative path and file name.
public Module getModule(String path, boolean fixImports)
Module
from a Henshin file given as a
path and file name. If the path is relative, it will be
resolved using the base directory of this resource set.
The behavior is as in getModule(URI, boolean)
.
path
- Possibly relative path to a Henshin file.fixImports
- If true
, tries to fix the imports of the loaded module (default is false
).
Module
.getModule(URI, boolean)
public Module getModule(URI uri, boolean fixImports)
Load a Module
from a Henshin file given by a URI.
If fixImports
is set to true
,
the method will try to fix broken imports of the module.
Specifically, it will check for every imported package
of the module, if a another package with the same namespace
URI is registered in the local package registry of this
resource. If yes, all references to elements of this package
in the module will be replaced by the found package.
If you want to fix the imports, you should first load the instance models to be transformed, and then call this method.
path
- Possible relative path and file name of a Henshin resource.fixImports
- If true
, tries to fix the imports of the loaded module (default is false
).
Module
.public Module getModule(String path)
Module
from a Henshin file given as a
path and file name. If the path is relative, it will be
resolved using the base directory of this resource set.
This does not fix imports.
path
- Possibly relative path to a Henshin file.
Module
.getModule(String, boolean)
public void saveEObject(EObject object, String path)
EObject
at a given path. This creates a new resource
under the given path, adds the object to the resource and saves it.
This delegates to saveEObject(EObject, URI)
.
object
- EObject
to be saved.path
- Possibly relative file path.public void saveEObject(EObject object, URI uri)
EObject
at a given URI. This creates a new resource
under the given path, adds the object to the resource and saves it.
object
- EObject
to be saved.uri
- URI pointing to the file where the object should be saved.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |