## 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
`protected static ASMModel` `atlmm`
`protected java.util.Map` `bimm`
`protected static org.osgi.framework.Bundle` `bundle`
`protected java.lang.String` `encoding`
`protected static org.eclipse.emf.common.util.URI` `mofURI`
`protected boolean` `removeIDs`
`protected org.eclipse.emf.ecore.resource.ResourceSet` `resourceSet`
`protected java.util.Map` `saveOptions`
`protected boolean` `useIDs`

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

Constructor Summary
`EMFModelLoader()` EMFModelLoader constructor.

Method Summary
`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(java.lang.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(java.lang.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(java.lang.String name, ASMModel metamodel, java.io.InputStream in)` Loads a model with given name and metamodel from in.
`ASMEMFModel` `loadModel(java.lang.String name, ASMModel metamodel, org.eclipse.emf.common.util.URI uri)` Loads an `ASMEMFModel` with the given name, metamodel and uri.
`ASMModel` `newModel(java.lang.String name, ASMModel metamodel)` Deprecated.
`ASMModel` `newModel(java.lang.String name, java.lang.String uri, ASMModel metamodel)`
`protected ASMModel` `realLoadModel(java.lang.String name, ASMModel metamodel, java.lang.String href)`
`protected void` `realSave(ASMModel model, java.lang.String href)`
`protected void` `setParameter(java.lang.String name, java.lang.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 Detail

### 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 java.util.Map bimm

### useIDs

    protected boolean useIDs

### removeIDs

    protected boolean removeIDs

### encoding

    protected java.lang.String encoding

### saveOptions

    protected java.util.Map saveOptions

Constructor Detail

### EMFModelLoader

    public EMFModelLoader()

  EMFModelLoader constructor.

Method Detail

### 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(java.lang.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(java.lang.String name,
                              ASMModel metamodel,
                              java.io.InputStream in)
                       throws java.io.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:
    `java.io.IOException`
  See Also:
    `ModelLoader.loadModel(java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMModel, java.io.InputStream)`

### loadModel

    public ASMEMFModel loadModel(java.lang.String name,
                                 ASMModel metamodel,
                                 org.eclipse.emf.common.util.URI uri)
                          throws java.io.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:
    `java.io.IOException`

### realLoadModel

    protected ASMModel realLoadModel(java.lang.String name,
                                     ASMModel metamodel,
                                     java.lang.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(java.lang.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(java.lang.String name,
                             java.lang.String uri,
                             ASMModel metamodel)

  Specified by:
    `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(java.lang.String name)

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

### setParameter

    protected void setParameter(java.lang.String name,
                                java.lang.Object value)

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

### realSave

    protected void realSave(ASMModel model,
                            java.lang.String href)
                     throws java.io.IOException

  Specified by:
    `realSave` in class `ModelLoader`
  Throws:
    `java.io.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 java.io.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:
    `java.io.IOException`

### finalize

    protected void finalize()
                     throws java.lang.Throwable

  Overrides:
    `finalize` in class `java.lang.Object`
  Throws:
    `java.lang.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)`

Copyright 2007 IBM Corporation and others. All Rights Reserved.