org.eclipse.m2m.atl.engine.emfvm.launch
Class EMFVMLauncher

java.lang.Object
  extended by org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher
All Implemented Interfaces:
ILauncher
Direct Known Subclasses:
EMFVMUILauncher, ProfilerLauncher

public class EMFVMLauncher
extends java.lang.Object
implements ILauncher

The EMFVM implementation of the ILauncher interface.


Field Summary
static java.lang.String LAUNCHER_NAME
          The ILauncher extension name.
protected  java.util.Map<java.lang.String,ASM> libraries
           
static java.lang.String MODEL_FACTORY_NAME
          The Default model factory name to use.
protected  java.util.Map<java.lang.String,IModel> models
           
 
Fields inherited from interface org.eclipse.m2m.atl.core.launch.ILauncher
DEBUG_MODE, RUN_MODE
 
Constructor Summary
EMFVMLauncher()
           
 
Method Summary
 void addInModel(IModel model, java.lang.String name, java.lang.String referenceModelName)
          Adds an input model to the transformation context.
 void addInOutModel(IModel model, java.lang.String name, java.lang.String referenceModelName)
          Adds an input/output model to the transformation context.
 void addLibrary(java.lang.String name, java.lang.Object library)
          Adds a preloaded library module to the transformation, or an InputStream.
protected  void addModel(IModel model, java.lang.String name, java.lang.String referenceModelName)
          Adds any model to the local map.
 void addOutModel(IModel model, java.lang.String name, java.lang.String referenceModelName)
          Adds an output model to the transformation context.
protected  ASM getASMFromObject(java.lang.Object module)
          Load a module if necessary.
 java.lang.String getDefaultModelFactoryName()
          Returns the default ModelFactory name.
 java.lang.Object getLibrary(java.lang.String libraryName)
          Returns a previously added library with the given name.
 IModel getModel(java.lang.String modelName)
          Returns a previously added model with the given name.
 java.lang.String[] getModes()
          Returns the supported modes.
 java.lang.String getName()
          Returns the ILauncher name.
 void initialize(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Initialize the launcher.
protected  java.lang.Object internalLaunch(ITool[] tools, org.eclipse.core.runtime.IProgressMonitor monitor, java.util.Map<java.lang.String,java.lang.Object> options, java.lang.Object... modules)
          Launches the transformation with preloaded modules.
 java.lang.Object launch(java.lang.String mode, org.eclipse.core.runtime.IProgressMonitor monitor, java.util.Map<java.lang.String,java.lang.Object> options, java.lang.Object... modules)
          Launches the transformation using the given parameters and the given set of preloaded modules, or InputStream.
 java.lang.Object loadModule(java.io.InputStream inputStream)
          Loads a transformation module from an InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAUNCHER_NAME

public static final java.lang.String LAUNCHER_NAME
The ILauncher extension name.

See Also:
Constant Field Values

MODEL_FACTORY_NAME

public static final java.lang.String MODEL_FACTORY_NAME
The Default model factory name to use.

See Also:
Constant Field Values

models

protected java.util.Map<java.lang.String,IModel> models

libraries

protected java.util.Map<java.lang.String,ASM> libraries
Constructor Detail

EMFVMLauncher

public EMFVMLauncher()
Method Detail

getName

public java.lang.String getName()
Description copied from interface: ILauncher
Returns the ILauncher name.

Specified by:
getName in interface ILauncher
Returns:
the ILauncher name

addModel

protected void addModel(IModel model,
                        java.lang.String name,
                        java.lang.String referenceModelName)
Adds any model to the local map.

Parameters:
model - the IModel
name - the model name
referenceModelName - the model reference model name

addInModel

public void addInModel(IModel model,
                       java.lang.String name,
                       java.lang.String referenceModelName)
Adds an input model to the transformation context. This method is also used to load the metamodels used in this transformation.

Specified by:
addInModel in interface ILauncher
Parameters:
model - the loaded model
name - the name of the model as described in the main module
referenceModelName - the name of the metamodel as described in the main module
See Also:
ILauncher.addInModel(org.eclipse.m2m.atl.core.IModel, java.lang.String, java.lang.String)

addInOutModel

public void addInOutModel(IModel model,
                          java.lang.String name,
                          java.lang.String referenceModelName)
Adds an input/output model to the transformation context.

Specified by:
addInOutModel in interface ILauncher
Parameters:
model - the loaded model
name - the name of the model as described in the main module
referenceModelName - the name of the metamodel as described in the main module
See Also:
ILauncher.addInOutModel(org.eclipse.m2m.atl.core.IModel, java.lang.String, java.lang.String)

addOutModel

public void addOutModel(IModel model,
                        java.lang.String name,
                        java.lang.String referenceModelName)
Adds an output model to the transformation context.

Specified by:
addOutModel in interface ILauncher
Parameters:
model - the loaded model
name - the name of the model as described in the main module
referenceModelName - the name of the metamodel as described in the main module
See Also:
ILauncher.addOutModel(org.eclipse.m2m.atl.core.IModel, java.lang.String, java.lang.String)

addLibrary

public void addLibrary(java.lang.String name,
                       java.lang.Object library)
Adds a preloaded library module to the transformation, or an InputStream.

Specified by:
addLibrary in interface ILauncher
Parameters:
name - the name of the library as described in the main module
library - the loaded library
See Also:
ILauncher.addLibrary(java.lang.String, java.lang.Object)

initialize

public void initialize(java.util.Map<java.lang.String,java.lang.Object> parameters)
Initialize the launcher.

Specified by:
initialize in interface ILauncher
Parameters:
parameters - initialization options
See Also:
ILauncher.initialize(java.util.Map)

launch

public java.lang.Object launch(java.lang.String mode,
                               org.eclipse.core.runtime.IProgressMonitor monitor,
                               java.util.Map<java.lang.String,java.lang.Object> options,
                               java.lang.Object... modules)
Launches the transformation using the given parameters and the given set of preloaded modules, or InputStream.

Specified by:
launch in interface ILauncher
Parameters:
mode - the launching mode
monitor - the progress monitor
options - vm options
modules - single module/ordered module set. A module set is used for superimposition, where the first module of the set is override by the next ones. A module can be passed as an InputStream or directly a module loaded by the loadModule method.
Returns:
the transformation return result
See Also:
ILauncher.launch(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, java.util.Map, java.lang.Object[])

internalLaunch

protected java.lang.Object internalLaunch(ITool[] tools,
                                          org.eclipse.core.runtime.IProgressMonitor monitor,
                                          java.util.Map<java.lang.String,java.lang.Object> options,
                                          java.lang.Object... modules)
Launches the transformation with preloaded modules.

Parameters:
tools - the execution tools
monitor - the progression monitor
options - the launching options
modules - the transformation modules
Returns:
the execution result

loadModule

public java.lang.Object loadModule(java.io.InputStream inputStream)
Loads a transformation module from an InputStream.

Specified by:
loadModule in interface ILauncher
Parameters:
inputStream - the input stream to load
Returns:
the loaded module
See Also:
ILauncher.loadModule(java.io.InputStream)

getASMFromObject

protected ASM getASMFromObject(java.lang.Object module)
Load a module if necessary.

Parameters:
module - the given ASM or InputStream.
Returns:
the ASM

getModel

public IModel getModel(java.lang.String modelName)
Returns a previously added model with the given name.

Specified by:
getModel in interface ILauncher
Parameters:
modelName - the model name
Returns:
a previously added model with the given name
See Also:
ILauncher.getModel(java.lang.String)

getLibrary

public java.lang.Object getLibrary(java.lang.String libraryName)
Returns a previously added library with the given name.

Specified by:
getLibrary in interface ILauncher
Parameters:
libraryName - the library name
Returns:
a previously added library with the given name
See Also:
ILauncher.getLibrary(java.lang.String)

getDefaultModelFactoryName

public java.lang.String getDefaultModelFactoryName()
Returns the default ModelFactory name.

Specified by:
getDefaultModelFactoryName in interface ILauncher
Returns:
the default ModelFactory name
See Also:
ILauncher.getDefaultModelFactoryName()

getModes

public java.lang.String[] getModes()
Returns the supported modes.

Specified by:
getModes in interface ILauncher
Returns:
the supported modes
See Also:
ILauncher.getModes()

Copyright 2007 IBM Corporation and others.
All Rights Reserved.