Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions emf/codegen.maven.example/ecore.annotated/model/catalog.ecore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?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="catalog" nsURI="http://daanse.eclipse.org/example/catalog" nsPrefix="catalog">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="basePackage" value="org.eclipse.daanse.example"/>
<details key="prefix" value="Catalog"/>
<details key="fileExtensions" value="catalog"/>
<details key="copyrightText" value="Copyright (c) 2025 Contributors to the Eclipse Foundation.&#xA;&#xA;This program and the accompanying materials are made&#xA;available under the terms of the Eclipse Public License 2.0&#xA;which is available at https://www.eclipse.org/legal/epl-2.0/&#xA;&#xA;SPDX-License-Identifier: EPL-2.0"/>
<details key="documentation" value="Product catalog model demonstrating annotation-based GenModel configuration."/>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="Catalog">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="A catalog containing products organized in categories."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The catalog name."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="categories" upperBound="-1"
eType="#//Category" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Categories in this catalog."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Category">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="A category grouping related products."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The category name."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Optional description of the category."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="products" upperBound="-1"
eType="#//Product" containment="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Products in this category."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Product">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="A product with name, price and availability."/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="sku" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Stock Keeping Unit - unique product identifier."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The product name."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="price" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigDecimal">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The product price."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="inStock" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Whether the product is currently in stock."/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>
110 changes: 110 additions & 0 deletions emf/codegen.maven.example/ecore.annotated/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0"?>
<!--
/*********************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling.emf.codegen.maven.example</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>
org.eclipse.daanse.tooling.emf.codegen.maven.example.ecore.annotated</artifactId>
<packaging>jar</packaging>

<name>Daanse EMF Codegen Example - Ecore Annotated</name>
<description>Ecore model using GenModel annotations for code generation
settings</description>

<dependencies>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>${emf.common.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>${emf.ecore.version}</version>
</dependency>
<!-- Fennec EMF OSGi API (for generated OSGi service code) -->
<dependency>
<groupId>org.eclipse.fennec.emf</groupId>
<artifactId>org.eclipse.fennec.emf.osgi.api</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling.emf.codegen.maven</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!--
This example demonstrates reading GenModel settings from ecore annotations.
The ecore file contains GenModel annotations that specify:
- basePackage
- prefix
- fileExtensions
- copyrightText
- documentation

No Maven configuration needed - all settings come from the ecore file!
-->
<ecoreFile>model/catalog.ecore</ecoreFile>
<outputDirectory>target/generated-sources/emf</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>7.1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/emf</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
17 changes: 17 additions & 0 deletions emf/codegen.maven.example/ecore.copyright/model/vehicle.ecore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="vehicle" nsURI="http://eclipse.org/daanse/example/vehicle" nsPrefix="vehicle">
<eClassifiers xsi:type="ecore:EClass" name="Vehicle" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="manufacturer" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="model" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="year" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Car" eSuperTypes="#//Vehicle">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doors" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="electric" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Motorcycle" eSuperTypes="#//Vehicle">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="engineCC" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="sidecar" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
</ecore:EPackage>
107 changes: 107 additions & 0 deletions emf/codegen.maven.example/ecore.copyright/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0"?>
<!--
/*********************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling.emf.codegen.maven.example</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>
org.eclipse.daanse.tooling.emf.codegen.maven.example.ecore.copyright</artifactId>
<packaging>jar</packaging>

<name>Daanse EMF Codegen Example - Ecore Copyright Options</name>
<description>Ecore model testing copyrightText and rootExtendsClass options</description>

<dependencies>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>${emf.common.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>${emf.ecore.version}</version>
</dependency>
<!-- Fennec EMF OSGi API (for generated OSGi service code) -->
<dependency>
<groupId>org.eclipse.fennec.emf</groupId>
<artifactId>org.eclipse.fennec.emf.osgi.api</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling.emf.codegen.maven</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!--
This example tests copyright and root extends options:
- copyrightText: Custom copyright header in generated files
- rootExtendsClass: Custom base class for generated model objects
-->
<ecoreFile>model/vehicle.ecore</ecoreFile>
<basePackage>org.eclipse.daanse.example</basePackage>
<copyrightText>Copyright (c) 2025 Eclipse Daanse Contributors.
Licensed under EPL-2.0.</copyrightText>
<rootExtendsClass>
org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container</rootExtendsClass>
<outputDirectory>target/generated-sources/emf</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>biz.aQute.bndlib</artifactId>
<version>7.1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/emf</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
18 changes: 18 additions & 0 deletions emf/codegen.maven.example/ecore.dependencies/model/extended.ecore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="extended" nsURI="http://daanse.eclipse.org/example/extended"
nsPrefix="extended">
<eClassifiers xsi:type="ecore:EClass" name="Employee" eSuperTypes="http://daanse.eclipse.org/example/base#//Person">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="employeeId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="department" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="workAddress" eType="ecore:EClass http://daanse.eclipse.org/example/base#//Address"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Company">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="employees" upperBound="-1"
eType="#//Employee" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="headquartersAddress" eType="ecore:EClass http://daanse.eclipse.org/example/base#//Address"
containment="true"/>
</eClassifiers>
</ecore:EPackage>
Loading
Loading