Package org.eclipse.m2m.atl.core.emf

# Class EMFExtractor

java.lang.Object
org.eclipse.m2m.atl.core.emf.EMFExtractor

All Implemented Interfaces:
  `IExtractor`

public class EMFExtractor extends Object implements IExtractor
The EMF implementation of the `IExtractor` interface.

## Constructor Summary

Constructors
Constructor
Description
`EMFExtractor()`

## Method Summary

Modifier and Type
Method
Description
`void`
`extract(EMFModel sourceModel, OutputStream target, String fileExtension, Map<String,Object> options)`
Extracts an `EMFModel` to an `OutputStream`.
`void`
`extract(IModel sourceModel, OutputStream target, Map<String,Object> options)`
Extracts an IModel using the given options.
`void`
`extract(IModel sourceModel, String target)`
Extracts an IModel using default options.
`void`
`extract(IModel sourceModel, String target, Map<String,Object> options)`
Extracts an IModel using the given options.
`protected static void`
`recreateResourceIfNeeded(EMFModel model, org.eclipse.emf.common.util.URI uri, String contentType, boolean contentTypeLookup)`
Recreates the resource in order to save in the correct format matching the file extension.

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

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

## Constructor Details

### EMFExtractor

public EMFExtractor()

## Method Details

### extract

public void extract(IModel sourceModel, String target, Map<String,Object> options) throws ATLCoreException
Extracts an IModel using the given options. Below the target parameter semantic.

- File system Resource: `file:/path`
- Workspace Resource: `platform:/resource/path`

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the target indication to extract the targetModel
  `options` - the extraction parameters
Throws:
  `ATLCoreException`
See Also:
  - `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.lang.String, java.util.Map)`

### extract

public void extract(IModel sourceModel, String target) throws ATLCoreException
Extracts an IModel using default options.

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the target indication to extract the targetModel
Throws:
  `ATLCoreException`
See Also:
  - `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.lang.String)`

### extract

public void extract(EMFModel sourceModel, OutputStream target, String fileExtension, Map<String,Object> options) throws ATLCoreException
Extracts an `EMFModel` to an `OutputStream`.

Parameters:
  `sourceModel` - the `EMFModel` to extract
  `target` - the target `OutputStream` to extract the targetModel
  `fileExtension` - the target file extension: defines the output format, default "xmi"
  `options` - the extraction parameters
Throws:
  `ATLCoreException`

### extract

public void extract(IModel sourceModel, OutputStream target, Map<String,Object> options) throws ATLCoreException
Extracts an IModel using the given options.

Specified by:
  `extract` in interface `IExtractor`
Parameters:
  `sourceModel` - the IModel to extract
  `target` - the `OutputStream` where to extract the targetModel
  `options` - the extraction parameters
Throws:
  `ATLCoreException`
See Also:
  - `IExtractor.extract(org.eclipse.m2m.atl.core.IModel, java.io.OutputStream, java.util.Map)`

### recreateResourceIfNeeded

protected static void recreateResourceIfNeeded(EMFModel model, org.eclipse.emf.common.util.URI uri, String contentType, boolean contentTypeLookup) throws ATLCoreException
Recreates the resource in order to save in the correct format matching the file extension.

Parameters:
  `model` - the model to recreate
  `uri` - the target `URI` with the correct extension
  `contentType` - the content type of the resource to save
  `contentTypeLookup` - specify whether the Extractor should automatically resolve the EPackage content type
Throws:
  `ATLCoreException`