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 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
Modifier and Type
Field
Description
`protected Map`
`loadedModels`

## Constructor Summary

Constructors
Constructor
Description
`ModelLoader()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addExtractor(String prefix, Class ext)`
`void`
`addInjector(String prefix, Class inj)`
`void`
`extract(ASMModel model, String kind, String params, String uri, OutputStream out)`
`abstract ASMModel`
`getATL()`
`abstract ASMModel`
`getBuiltInMetaModel(String name)`
`abstract ASMModel`
`getMOF()`
`ASMModelElement`
`inject(ASMModel ret, String kind, String params, String uri, InputStream in)`
`abstract ASMModel`
`loadModel(String name, ASMModel metamodel, InputStream in)`
Loads a model with given name and metamodel from in.
`ASMModel`
`loadModel(String name, ASMModel metamodel, String href)`
Loads a model from the URI represented by href.
`ASMModel`
`newModel(String name, String uri, ASMModel metamodel)`
`abstract ASMModel`
`newModel(String name, ASMModel metamodel)`
Deprecated.
Use `newModel(String, String, ASMModel)` instead
`protected abstract ASMModel`
`realLoadModel(String name, ASMModel metamodel, String href)`
`protected abstract void`
`realSave(ASMModel model, String href)`
`void`
`save(ASMModel model, String href)`
Saves the model to a writable URL.
`protected abstract void`
`setParameter(String name, 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 Details

### loadedModels

protected Map loadedModels

## Constructor Details

### ModelLoader

public ModelLoader()

## Method Details

### addInjector

public void addInjector(String prefix, Class inj)

### addExtractor

public void addExtractor(String prefix, Class ext)

### loadModel

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

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`

### realLoadModel

protected abstract ASMModel realLoadModel(String name, ASMModel metamodel, String href) throws IOException

Throws:
  `IOException`

### loadModel

public ASMModel loadModel(String name, ASMModel metamodel, String href) throws 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:
  `IOException`

### inject

public ASMModelElement inject(ASMModel ret, String kind, String params, String uri, InputStream in)

### newModel

public abstract ASMModel newModel(String name, ASMModel metamodel)
Deprecated.
Use `newModel(String, String, ASMModel)` instead

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

### newModel

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

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

### setParameter

protected abstract void setParameter(String name, Object value)

### realSave

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

Throws:
  `IOException`

### save

public void save(ASMModel model, String href) throws IOException
Saves the model to a writable URL.

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

### extract

public void extract(ASMModel model, String kind, String params, String uri, OutputStream out)

### getMOF

public abstract ASMModel getMOF()

### getATL

public abstract ASMModel getATL()

### getBuiltInMetaModel

public abstract ASMModel getBuiltInMetaModel(String name)

### unload

public abstract void unload(ASMModel model)