Package org.eclipse.m2m.atl.engine.vm

## Class ModelLoader

- java.lang.Object
- - org.eclipse.m2m.atl.engine.vm.ModelLoader

Direct Known Subclasses:
  `EMFModelLoader`

    public abstract class ModelLoader
    extends java.lang.Object

Model loading and saving facility. Must be extended by concrete implementations such as for EMF or MDR. This is only used in command-line mode at the present time.

### Field Summary

Fields
`protected java.util.Map` `loadedModels`

### Constructor Summary

Constructors
`ModelLoader()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
`void` `addExtractor​(java.lang.String prefix, java.lang.Class ext)`
`void` `addInjector​(java.lang.String prefix, java.lang.Class inj)`
`void` `extract​(ASMModel model, java.lang.String kind, java.lang.String params, java.lang.String uri, java.io.OutputStream out)`
`abstract ASMModel` `getATL()`
`abstract ASMModel` `getBuiltInMetaModel​(java.lang.String name)`
`abstract ASMModel` `getMOF()`
`ASMModelElement` `inject​(ASMModel ret, java.lang.String kind, java.lang.String params, java.lang.String uri, java.io.InputStream in)`
`abstract ASMModel` `loadModel​(java.lang.String name, ASMModel metamodel, java.io.InputStream in)` Loads a model with given name and metamodel from in.
`ASMModel` `loadModel​(java.lang.String name, ASMModel metamodel, java.lang.String href)` Loads a model from the URI represented by href.
`ASMModel` `newModel​(java.lang.String name, java.lang.String uri, ASMModel metamodel)`
`abstract ASMModel` `newModel​(java.lang.String name, ASMModel metamodel)` Deprecated. Use `newModel(String, String, ASMModel)` instead
`protected abstract ASMModel` `realLoadModel​(java.lang.String name, ASMModel metamodel, java.lang.String href)`
`protected abstract void` `realSave​(ASMModel model, java.lang.String href)`
`void` `save​(ASMModel model, java.lang.String href)` Saves the model to a writable URL.
`protected abstract void` `setParameter​(java.lang.String name, java.lang.Object value)`
`abstract void` `unload​(ASMModel model)`

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

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

### Field Detail

#### loadedModels

    protected java.util.Map loadedModels

### Constructor Detail

#### ModelLoader

    public ModelLoader()

### Method Detail

#### addInjector

    public void addInjector​(java.lang.String prefix,
                            java.lang.Class inj)

#### addExtractor

    public void addExtractor​(java.lang.String prefix,
                             java.lang.Class ext)

#### loadModel

    public abstract 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!

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`

#### realLoadModel

    protected abstract ASMModel realLoadModel​(java.lang.String name,
                                              ASMModel metamodel,
                                              java.lang.String href)
                                       throws java.io.IOException

Throws:
  `java.io.IOException`

#### loadModel

    public ASMModel loadModel​(java.lang.String name,
                              ASMModel metamodel,
                              java.lang.String href)
                       throws java.io.IOException

Loads a model from the URI represented by href.

Parameters:
  `name` - The model name.
  `metamodel` - The metamodel of the model to be loaded.
  `href` - The model URI.
Returns:
  The loaded ASMModel.
Throws:
  `java.io.IOException`

#### inject

    public ASMModelElement inject​(ASMModel ret,
                                  java.lang.String kind,
                                  java.lang.String params,
                                  java.lang.String uri,
                                  java.io.InputStream in)

#### newModel

    public abstract ASMModel newModel​(java.lang.String name,
                                      ASMModel metamodel)

Deprecated.
Use `newModel(String, String, ASMModel)` instead

Parameters:
  `name` -
  `metamodel` -
Returns:
  A new ASMModel

#### newModel

    public ASMModel newModel​(java.lang.String name,
                             java.lang.String uri,
                             ASMModel metamodel)

Parameters:
  `name` -
  `uri` -
  `metamodel` -
Returns:
  A new ASMModel

#### setParameter

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

#### realSave

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

Throws:
  `java.io.IOException`

#### save

    public void save​(ASMModel model,
                     java.lang.String href)
              throws java.io.IOException

Saves the model to a writable URL.

Parameters:
  `model` - The model to save
  `href` - The writable URL
Throws:
  `java.io.IOException`

#### extract

    public void extract​(ASMModel model,
                        java.lang.String kind,
                        java.lang.String params,
                        java.lang.String uri,
                        java.io.OutputStream out)

#### getMOF

    public abstract ASMModel getMOF()

#### getATL

    public abstract ASMModel getATL()

#### getBuiltInMetaModel

    public abstract ASMModel getBuiltInMetaModel​(java.lang.String name)

#### unload

    public abstract void unload​(ASMModel model)