Kieker 1.9

kieker.analysis.model
Class MetaModelHandler

java.lang.Object
  extended by kieker.analysis.model.MetaModelHandler

public final class MetaModelHandler
extends Object

This is a helper class for the AnalysisController, which manages the handling of the meta model instances.

Since:
1.8
Author:
Andre van Hoorn, Nils Christian Ehmke, Jan Waller

Nested Class Summary
static class MetaModelHandler.PluginConnection
           
static class MetaModelHandler.RepositoryConnection
           
 
Method Summary
static void checkPorts(MIPlugin mPlugin, AbstractPlugin plugin)
          This method checks the ports of the given model plugin against the ports of the actual plugin.
static List<MIProperty> convertProperties(Configuration configuration, MAnalysisMetaModelFactory factory)
          Converts the given configuration into a list of MIPropertys using the given factory.
static MIInputPort findInputPort(MIFilter mPlugin, String name)
          Searches for an input port within the given plugin with the given name.
static MIOutputPort findOutputPort(MIPlugin mPlugin, String name)
          Searches for an output port within the given plugin with the given name.
static MIProject javaToMetaModel(Collection<AbstractReaderPlugin> readers, Collection<AbstractFilterPlugin> filters, Collection<AbstractRepository> repositories, Collection<MIDependency> dependencies, String projectName, Configuration globalConfiguration)
          This method can be used to convert the current analysis configuration (which is represented by Java objects) into a meta model.
static MIProject loadProjectFromFile(File file)
          Loads a meta model project instance from the given file.
static void metaModelToJava(MIProject mProject, AnalysisController ac, Collection<MetaModelHandler.PluginConnection> pluginConnections, Collection<MetaModelHandler.RepositoryConnection> repositoryConnections, Collection<MIDependency> dependencies, ClassLoader classLoader, Configuration globalConfiguration, Map<MIRepository,AbstractRepository> repositoryMap, Map<MIPlugin,AbstractPlugin> pluginMap)
          This method can be used to convert a given analysis meta model instance to the actual java instances.
static Configuration modelPropertiesToConfiguration(org.eclipse.emf.common.util.EList<MIProperty> mProperties)
          This method can be used to convert a given list of MIProperty to a configuration object.
static void saveProjectToFile(File file, MIProject project)
          Saves the given meta model project to the given file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

saveProjectToFile

public static final void saveProjectToFile(File file,
                                           MIProject project)
                                    throws IOException
Saves the given meta model project to the given file.

Parameters:
file - The file in which the project will be stored.
project - The meta model project.
Throws:
IOException - If something went wrong during the saving.

loadProjectFromFile

public static final MIProject loadProjectFromFile(File file)
                                           throws IOException
Loads a meta model project instance from the given file.

Parameters:
file - The file to load the model from.
Returns:
The meta model instance.
Throws:
IOException - If something went wrong during the loading.

modelPropertiesToConfiguration

public static final Configuration modelPropertiesToConfiguration(org.eclipse.emf.common.util.EList<MIProperty> mProperties)
This method can be used to convert a given list of MIProperty to a configuration object.

Parameters:
mProperties - The properties to be converted.
Returns:
A filled configuration object.

checkPorts

public static void checkPorts(MIPlugin mPlugin,
                              AbstractPlugin plugin)
                       throws AnalysisConfigurationException
This method checks the ports of the given model plugin against the ports of the actual plugin. If there are ports which are in the model instance, but not in the "real" plugin, an exception is thrown. This method should be called during the creation of an AnalysisController via a configuration file to find invalid (outdated) ports.

Parameters:
mPlugin - The model instance of the plugin.
plugin - The corresponding "real" plugin.
Throws:
AnalysisConfigurationException - If an invalid port has been detected.

convertProperties

public static List<MIProperty> convertProperties(Configuration configuration,
                                                 MAnalysisMetaModelFactory factory)
Converts the given configuration into a list of MIPropertys using the given factory.

Parameters:
configuration - The configuration to be converted.
factory - The factory to be used to create the model instances.
Returns:
A list of model instances.

findInputPort

public static final MIInputPort findInputPort(MIFilter mPlugin,
                                              String name)
Searches for an input port within the given plugin with the given name.

Parameters:
mPlugin - The plugin which will be searched through.
name - The name of the searched input port.
Returns:
The searched port or null, if it is not available.

findOutputPort

public static final MIOutputPort findOutputPort(MIPlugin mPlugin,
                                                String name)
Searches for an output port within the given plugin with the given name.

Parameters:
mPlugin - The plugin which will be searched through.
name - The name of the searched output port.
Returns:
The searched port or null, if it is not available.

javaToMetaModel

public static final MIProject javaToMetaModel(Collection<AbstractReaderPlugin> readers,
                                              Collection<AbstractFilterPlugin> filters,
                                              Collection<AbstractRepository> repositories,
                                              Collection<MIDependency> dependencies,
                                              String projectName,
                                              Configuration globalConfiguration)
                                       throws AnalysisConfigurationException
This method can be used to convert the current analysis configuration (which is represented by Java objects) into a meta model.

Parameters:
readers - The readers within the analysis.
filters - The filters within the analysis.
repositories - The repositories within the analysis.
dependencies - The dependencies of the analysis.
projectName - The name of the project.
globalConfiguration - The global project configuration.
Returns:
A meta model instance, representing the given analysis.
Throws:
AnalysisConfigurationException - If the given analysis components are somehow invalid connected.

metaModelToJava

public static final void metaModelToJava(MIProject mProject,
                                         AnalysisController ac,
                                         Collection<MetaModelHandler.PluginConnection> pluginConnections,
                                         Collection<MetaModelHandler.RepositoryConnection> repositoryConnections,
                                         Collection<MIDependency> dependencies,
                                         ClassLoader classLoader,
                                         Configuration globalConfiguration,
                                         Map<MIRepository,AbstractRepository> repositoryMap,
                                         Map<MIPlugin,AbstractPlugin> pluginMap)
                                  throws AnalysisConfigurationException
This method can be used to convert a given analysis meta model instance to the actual java instances.

Parameters:
mProject - The meta model project.
ac - The analysis controller which will be the parent of the new analysis.
pluginConnections - The connections between the plugins (this object will be filled by the method).
repositoryConnections - The connections between filters and repositories (this object will be filled by the method).
dependencies - The dependencies of the analysis (this object will be filled by the method).
classLoader - The class loader which will be used to create the analysis components.
globalConfiguration - The global project configuration (this object will be filled by the method).
repositoryMap - The mapping between the created repositories and the meta model instances (this object will be filled by the method).
pluginMap - The mapping between the created plugins and the meta model instances (this object will be filled by the method).
Throws:
AnalysisConfigurationException - If the given meta model instance is somehow invalid configured.

Kieker 1.9

Copyright 2014 Kieker Project, http://kieker-monitoring.net