Commit b4d947ce authored by Marco Konersmann's avatar Marco Konersmann

removes outdated examples

parent 23823c7a
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Codeling Component Model</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.sirius.nature.modelingproject</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.objectteams.otdt.compiler.option.pure_java=enabled
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src-lib"/>
<classpathentry kind="src" path="executionRuntime"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>simple-component-model-example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.sirius.nature.modelingproject</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: integration-mechanisms
Bundle-SymbolicName: simple-component-model-example;singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.emf.ecore
This is a project that shows an example of integration mechanisms.
* The *meta model* is in the folder ```model```. It includes the example meta model and a meta model of types.
* The *model* is in the folder ```model-instance```. It includes the example model and a model of default types.
* The *meta model representations* are in the source folder ```src-lib```.
* The *model representations* are in the source folder ```src```.
* The *execution runtime* is in the source folder ```executionRuntime```.
To start the execution runtime, run the class ```rt.ExampleExecutionFramework```.
\ No newline at end of file
package rt;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedList;
import cm.Architecture_Connector;
import cm.Architecture_interfaces;
import cm.Component;
import cm.Components;
import cm.Connector;
import cm.Interface;
import myapp.MyArchitecture;
public class ExampleExecutionFramework {
public static void main(String[] args)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, NoSuchFieldException {
Object arch = initializeArchitecture(MyArchitecture.class);
startArchitecture(arch);
stopArchitecture(arch);
}
private static void startComponent(Component c) {
c.start();
}
private static void stopComponent(Component c) {
c.stop();
}
private static void connectConnector(Connector c) {
c.connect();
}
private static void disconnectConnector(Connector c) {
c.disconnect();
}
private static void startArchitecture(Object arch) throws IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
arch.getClass().getMethod("start", new Class[0]).invoke(arch, new Object[0]);
for (Connector c : getConnectors(arch))
connectConnector(c);
for (Component c : getComponents(arch))
startComponent(c);
}
private static void stopArchitecture(Object arch) throws IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
for (Component c : getComponents(arch))
stopComponent(c);
for (Connector c : getConnectors(arch))
disconnectConnector(c);
arch.getClass().getMethod("stop", new Class[0]).invoke(arch, new Object[0]);
}
private static Object initializeArchitecture(Class<MyArchitecture> clazz)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, NoSuchFieldException {
Object arch = clazz.getConstructor(new Class[0]).newInstance(new Object[0]);
initializeArchitecture_components(arch);
initializeArchitecture_interfaces(arch);
initializeArchitecture_connectors(arch);
return arch;
}
private static Class<? extends Interface>[] initializeArchitecture_interfaces(Object arch)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException {
for (Field f : arch.getClass().getDeclaredFields()) {
Architecture_interfaces annotation = f.getAnnotation(Architecture_interfaces.class);
if (annotation == null)
continue;
Class<? extends Interface>[] interfaceClasses = (Class<? extends Interface>[]) annotation.value();
setField(arch, f, interfaceClasses);
return interfaceClasses;
}
return null;
}
private static Component[] initializeArchitecture_components(Object arch)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException {
for (Field f : arch.getClass().getDeclaredFields()) {
Components annotation = f.getAnnotation(Components.class);
if (annotation == null)
continue;
Class<? extends Component>[] componentClasses = annotation.value();
Component[] components = new Component[componentClasses.length];
for (int i = 0; i < componentClasses.length; i++)
components[i] = (Component) initializeComponent(componentClasses[i]);
setField(arch, f, components);
return components;
}
return null;
}
private static Component initializeComponent(Class<? extends Component> componentClass)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException {
return componentClass.getConstructor(new Class[0]).newInstance(new Object[0]);
}
private static Connector[] initializeArchitecture_connectors(Object arch)
throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, NoSuchFieldException {
LinkedList<Connector> connectors = new LinkedList<>();
for (Field f : arch.getClass().getDeclaredFields()) {
Architecture_Connector annotation = f.getAnnotation(Architecture_Connector.class);
if (annotation == null)
continue;
Class<? extends Component> requirerClass = annotation.requirer();
Class<? extends Component> providerClass = annotation.provider();
Class<? extends Interface> interfaceClass = annotation.iface();
Component requirer = null;
Component provider = null;
for (Component c : getComponents(arch)) {
if (c.getClass() == requirerClass)
requirer = c;
else if (c.getClass() == providerClass)
provider = c;
if (provider != null && requirer != null)
break;
}
Connector o = new Connector();
setField(o, Connector.class.getDeclaredField("requirer"), requirer);
setField(o, Connector.class.getDeclaredField("provider"), provider);
setField(o, Connector.class.getDeclaredField("interfaceClass"), interfaceClass);
setField(arch, f, o);
connectors.add(o);
}
return connectors.toArray(new Connector[connectors.size()]);
}
private static Class<? extends Interface>[] getInterfaces(Object arch) throws IllegalAccessException {
for (Field f : arch.getClass().getDeclaredFields()) {
Architecture_interfaces annotation = f.getAnnotation(Architecture_interfaces.class);
if (annotation == null)
continue;
return (Class<? extends Interface>[]) getField(arch, f);
}
return null;
}
private static Component[] getComponents(Object arch) throws IllegalAccessException {
for (Field f : arch.getClass().getDeclaredFields()) {
Components annotation = f.getAnnotation(Components.class);
if (annotation == null)
continue;
return (Component[]) getField(arch, f);
}
return null;
}
private static Connector[] getConnectors(Object arch) throws IllegalAccessException {
int connectorFieldsSize = 0;
for (Field f : arch.getClass().getDeclaredFields()) {
Architecture_Connector annotation = f.getAnnotation(Architecture_Connector.class);
if (annotation != null)
connectorFieldsSize++;
}
Connector[] connectors = new Connector[connectorFieldsSize];
int currentConnectorFieldIndex = 0;
for (Field f : arch.getClass().getDeclaredFields()) {
Architecture_Connector annotation = f.getAnnotation(Architecture_Connector.class);
if (annotation == null)
continue;
connectors[currentConnectorFieldIndex++] = (Connector) getField(arch, f);
}
return connectors;
}
private static void setField(Object object, Field field, Object value) throws IllegalAccessException {
field.setAccessible(true);
field.set(object, value);
field.setAccessible(false);
}
private static Object getField(Object object, Field field) throws IllegalAccessException {
field.setAccessible(true);
Object o = field.get(object);
field.setAccessible(false);
return o;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:datatypes="http://example.org/datatypes" xsi:schemaLocation="http://example.org/datatypes ../model/datatypes.ecore">
<datatypes:DataType name="string"/>
<datatypes:DataType name="int"/>
<datatypes:DataType name="boolean"/>
<datatypes:DataType name="void"/>
<datatypes:DataType name="any"/>
<datatypes:DataType name="class"/>
</xmi:XMI>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<integration_mechanisms:Architecture
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:integration_mechanisms="http://www.example.org/integration_mechanisms"
xsi:schemaLocation="http://www.example.org/integration_mechanisms ../model/integration_mechanisms.ecore"
name="MyArchitecture"
version="1.0">
<components
name="BarCodeScanner">
<provisions
interface="//@interfaces.0"/>
<operation
operationsignature="//@interfaces.0/@operation.0"/>
</components>
<components
name="CashDesk">
<requirements
interface="//@interfaces.0"/>
</components>
<interfaces
name="IBarCodeScanner">
<operation
name="greet">
<operationparameter
name="word">
<type
href="DataTypes.xmi#/0"/>
</operationparameter>
<returnType
href="DataTypes.xmi#/0"/>
</operation>
</interfaces>
<connectors
provision="//@components.0/@provisions.0"
requirement="//@components.1/@requirements.0"
interface="//@interfaces.0"/>
</integration_mechanisms:Architecture>
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="datatypes" nsURI="http://example.org/datatypes" nsPrefix="datatypes">
<eClassifiers xsi:type="ecore:EClass" name="DataType">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="integration_mechanisms" nsURI="http://www.example.org/integration_mechanisms"
nsPrefix="integration_mechanisms">
<eClassifiers xsi:type="ecore:EClass" name="Architecture">
<eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1"
eType="#//Component" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="interfaces" upperBound="-1"
eType="#//Interface" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="connectors" upperBound="-1"
eType="#//Connector" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="#//String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Interface">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="operation" upperBound="-1"
eType="#//OperationSignature" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Component">
<eStructuralFeatures xsi:type="ecore:EReference" name="provisions" upperBound="-1"
eType="#//Provision" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirements" upperBound="-1"
eType="#//Requirement" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="operation" upperBound="-1"
eType="#//Operation" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Connector">
<eStructuralFeatures xsi:type="ecore:EReference" name="provision" lowerBound="1"
eType="#//Provision"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="requirement" lowerBound="1"
eType="#//Requirement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="interface" lowerBound="1"
eType="#//Interface"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Provision">
<eStructuralFeatures xsi:type="ecore:EReference" name="interface" lowerBound="1"
eType="#//Interface"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Requirement">
<eStructuralFeatures xsi:type="ecore:EReference" name="interface" lowerBound="1"
eType="#//Interface"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operation">
<eStructuralFeatures xsi:type="ecore:EReference" name="operationsignature" lowerBound="1"
eType="#//OperationSignature"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OperationParameter">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="type" lowerBound="1" eType="ecore:EClass datatypes.ecore#//DataType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OperationSignature">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="operationparameter" upperBound="-1"
eType="#//OperationParameter" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="returnType" lowerBound="1"
eType="ecore:EClass datatypes.ecore#//DataType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
</ecore:EPackage>
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/integration-mechanisms/src" modelPluginID="integration-mechanisms"
modelName="Integration_mechanisms" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0" copyrightFields="false"
operationReflection="true" importOrganizing="true">
<foreignModel>integration_mechanisms.ecore</foreignModel>
<genPackages prefix="Integration_mechanisms" disposableProviderFactory="true" ecorePackage="integration_mechanisms.ecore#/">
<genDataTypes ecoreDataType="integration_mechanisms.ecore#//String"/>
<genClasses ecoreClass="integration_mechanisms.ecore#//Architecture">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Architecture/components"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Architecture/interfaces"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Architecture/connectors"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//Architecture/name"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//Architecture/version"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Interface">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//Interface/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Interface/operation"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Component">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Component/provisions"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Component/requirements"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//Component/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Component/operation"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Connector">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Connector/provision"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Connector/requirement"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Connector/interface"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Component/operation"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Provision">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Provision/interface"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Requirement">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Requirement/interface"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//Operation">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//Operation/operationsignature"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//OperationSignature/operationparameter"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//OperationSignature/name"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//OperationParameter">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//OperationParameter/name"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//OperationParameter/type"/>
</genClasses>
<genClasses ecoreClass="integration_mechanisms.ecore#//OperationSignature">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute integration_mechanisms.ecore#//OperationSignature/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//OperationSignature/operationparameter"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference integration_mechanisms.ecore#//OperationSignature/returnType"/>
</genClasses>
</genPackages>
<genPackages prefix="Datatypes" ecorePackage="datatypes.ecore#/">
<genClasses ecoreClas