Package org.eclipse.m2m.atl.drivers.emf4atl

# Class EMFModelLoader

java.lang.Object
org.eclipse.m2m.atl.engine.vm.ModelLoader
org.eclipse.m2m.atl.drivers.emf4atl.EMFModelLoader

Direct Known Subclasses:
  `UMLModelLoader`

public class EMFModelLoader extends ModelLoader
Loads EMF models into a `ResourceSet`. Make sure to use the same model loader for all EMF models used in a model transformation! Use different model loaders for different threads.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static ASMModel`
`atlmm`
`protected Map`
`bimm`
`protected static org.osgi.framework.Bundle`
`bundle`
`protected String`
`encoding`
`protected static org.eclipse.emf.common.util.URI`
`mofURI`
`protected boolean`
`removeIDs`
`protected org.eclipse.emf.ecore.resource.ResourceSet`
`resourceSet`
`protected Map`
`saveOptions`
`protected boolean`
`useIDs`

### Fields inherited from class org.eclipse.m2m.atl.engine.vm.ModelLoader

`loadedModels`

## Constructor Summary

Constructors
Constructor
Description
`EMFModelLoader()`
EMFModelLoader constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`adaptMetamodel(ASMEMFModel model, ASMEMFModel metamodel)`
Adapts model if its metamodel is MOF, such that its NsURI is registered and primitive datatypes are mapped to Java types.
`protected ASMEMFModel`
`createASMEMFModel(String name, org.eclipse.emf.ecore.resource.Resource extent, ASMModel metamodel, boolean isTarget)`
Creates a new `ASMEMFModel`.
`protected void`
`finalize()`
`protected void`
`finalizeResource(org.eclipse.emf.ecore.resource.Resource r)`
Finalizes r.
`ASMModel`
`getATL()`
`ASMModel`
`getBuiltInMetaModel(String name)`
`ASMModel`
`getMOF()`
`org.eclipse.emf.ecore.resource.ResourceSet`
`getResourceSet()`
Returns the internal `ResourceSet` that contains all models explicitly loaded by this loader.
`ASMModel`
`loadModel(String name, ASMModel metamodel, InputStream in)`
Loads a model with given name and metamodel from in.
`ASMEMFModel`
`loadModel(String name, ASMModel metamodel, org.eclipse.emf.common.util.URI uri)`
Loads an `ASMEMFModel` with the given name, metamodel and uri.
`ASMModel`
`newModel(String name, String uri, ASMModel metamodel)`
`ASMModel`
`newModel(String name, ASMModel metamodel)`
Deprecated.
`protected ASMModel`
`realLoadModel(String name, ASMModel metamodel, String href)`
`protected void`
`realSave(ASMModel model, String href)`
`protected void`
`setParameter(String name, Object value)`
`void`
`unload(ASMModel model)`

### Methods inherited from class org.eclipse.m2m.atl.engine.vm.ModelLoader

`addExtractor, addInjector, extract, inject, loadModel, save`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### bundle

protected static org.osgi.framework.Bundle bundle

### mofURI

protected static org.eclipse.emf.common.util.URI mofURI

### atlmm

protected static ASMModel atlmm

### resourceSet

protected org.eclipse.emf.ecore.resource.ResourceSet resourceSet

### bimm

protected Map bimm

### useIDs

protected boolean useIDs

### removeIDs

protected boolean removeIDs

### encoding

protected String encoding

### saveOptions

protected Map saveOptions

## Constructor Details

### EMFModelLoader

public EMFModelLoader()
EMFModelLoader constructor.

## Method Details

### getResourceSet

public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Returns the internal `ResourceSet` that contains all models explicitly loaded by this loader.

Returns:
  The internal `ResourceSet`.

### getMOF

public ASMModel getMOF()

Specified by:
  `getMOF` in class `ModelLoader`
See Also:
  - `ModelLoader.getMOF()`

### getATL

public ASMModel getATL()

Specified by:
  `getATL` in class `ModelLoader`
See Also:
  - `ModelLoader.getATL()`

### createASMEMFModel

protected ASMEMFModel createASMEMFModel(String name, org.eclipse.emf.ecore.resource.Resource extent, ASMModel metamodel, boolean isTarget)
Creates a new `ASMEMFModel`.

Parameters:
  `name` - the model name
  `extent` - the resource extent
  `metamodel` - the metamodel
  `isTarget` - true if the model is a target model
Returns:
  a new ASMEMFModel with this ModelLoader.

### loadModel

public ASMModel loadModel(String name, ASMModel metamodel, InputStream in) throws IOException
Loads a model with given name and metamodel from in. Use this method only if there is no real URI available!

Specified by:
  `loadModel` in class `ModelLoader`
Parameters:
  `name` - The model name.
  `metamodel` - The metamodel of the model to be loaded.
  `in` - The input stream from which to load.
Returns:
  The loaded ASMModel.
Throws:
  `IOException`
See Also:
  - `ModelLoader.loadModel(java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel, java.io.InputStream)`

### loadModel

public ASMEMFModel loadModel(String name, ASMModel metamodel, org.eclipse.emf.common.util.URI uri) throws IOException
Loads an `ASMEMFModel` with the given name, metamodel and uri.

Parameters:
  `name` - The name of the model to load.
  `metamodel` - The metamodel for the model to load.
  `uri` - The URI to load the model from.
Returns:
  The loaded model.
Throws:
  `IOException`

### realLoadModel

protected ASMModel realLoadModel(String name, ASMModel metamodel, String href)

Specified by:
  `realLoadModel` in class `ModelLoader`
See Also:
  - `ModelLoader.realLoadModel(java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel, java.lang.String)`

### newModel

public ASMModel newModel(String name, ASMModel metamodel)
Deprecated.

Specified by:
  `newModel` in class `ModelLoader`
Returns:
  A new ASMModel
See Also:
  - `ModelLoader.newModel(java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel)`

### newModel

public ASMModel newModel(String name, String uri, ASMModel metamodel)

Overrides:
  `newModel` in class `ModelLoader`
Returns:
  A new ASMModel
See Also:
  - `ModelLoader.newModel(java.lang.String, java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel)`

### getBuiltInMetaModel

public ASMModel getBuiltInMetaModel(String name)

Specified by:
  `getBuiltInMetaModel` in class `ModelLoader`
See Also:
  - `ModelLoader.getBuiltInMetaModel(String)`

### setParameter

protected void setParameter(String name, Object value)

Specified by:
  `setParameter` in class `ModelLoader`
See Also:
  - `ModelLoader.setParameter(java.lang.String, java.lang.Object)`

### realSave

protected void realSave(ASMModel model, String href) throws IOException

Specified by:
  `realSave` in class `ModelLoader`
Throws:
  `IOException`
See Also:
  - `ModelLoader.realSave(org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel, java.lang.String)`

### adaptMetamodel

protected void adaptMetamodel(ASMEMFModel model, ASMEMFModel metamodel) throws IOException
Adapts model if its metamodel is MOF, such that its NsURI is registered and primitive datatypes are mapped to Java types.

Parameters:
  `model` - The model to adapt.
  `metamodel` - The model's metamodel.
Throws:
  `IOException`

### finalize

protected void finalize() throws Throwable

Overrides:
  `finalize` in class `Object`
Throws:
  `Throwable`
See Also:
  - `Object.finalize()`

### finalizeResource

protected void finalizeResource(org.eclipse.emf.ecore.resource.Resource r)
Finalizes r. This implementation does nothing, but allows for overriding in subclasses.

Parameters:
  `r` - The `Resource` to finalize.

### unload

public void unload(ASMModel model)

Specified by:
  `unload` in class `ModelLoader`
See Also:
  - `ModelLoader.unload(ASMModel)`