From 2a9ef641f84e6b92b3625db8fb9bafd0eaeb27fa Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sat, 9 Mar 2024 17:07:34 +0100 Subject: [PATCH] Remove org.openhab.core.model.lazygen No longer in use sind 2017, see eclipse-archived/smarthome#4122. Signed-off-by: Holger Friedrich --- bundles/org.openhab.core.model.item/bnd.bnd | 1 - .../org.openhab.core.model.lazygen/.classpath | 27 ---- .../org.openhab.core.model.lazygen/.project | 23 --- bundles/org.openhab.core.model.lazygen/NOTICE | 14 -- .../model.profile-marker | 0 .../org.openhab.core.model.lazygen/pom.xml | 17 -- .../core/model/lazygen/GlobalResourceSet.java | 29 ---- .../core/model/lazygen/LazyGenerator.java | 47 ------ .../model/lazygen/LazyLanguageConfig.java | 28 ---- .../model/lazygen/LazyStandaloneSetup.java | 153 ------------------ .../bnd.bnd | 1 - bundles/org.openhab.core.model.rule/bnd.bnd | 1 - bundles/org.openhab.core.model.script/bnd.bnd | 1 - .../org.openhab.core.model.sitemap/bnd.bnd | 1 - bundles/org.openhab.core.model.thing/bnd.bnd | 1 - bundles/pom.xml | 1 - 16 files changed, 345 deletions(-) delete mode 100644 bundles/org.openhab.core.model.lazygen/.classpath delete mode 100644 bundles/org.openhab.core.model.lazygen/.project delete mode 100644 bundles/org.openhab.core.model.lazygen/NOTICE delete mode 100644 bundles/org.openhab.core.model.lazygen/model.profile-marker delete mode 100644 bundles/org.openhab.core.model.lazygen/pom.xml delete mode 100644 bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/GlobalResourceSet.java delete mode 100644 bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyGenerator.java delete mode 100644 bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyLanguageConfig.java delete mode 100644 bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyStandaloneSetup.java diff --git a/bundles/org.openhab.core.model.item/bnd.bnd b/bundles/org.openhab.core.model.item/bnd.bnd index 99185bee9c4..d11180b2511 100644 --- a/bundles/org.openhab.core.model.item/bnd.bnd +++ b/bundles/org.openhab.core.model.item/bnd.bnd @@ -38,7 +38,6 @@ Require-Bundle: com.ibm.icu;resolution:=optional,\ org.eclipse.emf.ecore;visibility:=reexport,\ org.eclipse.emf.mwe.utils;resolution:=optional,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext,\ org.eclipse.xtext.common.types,\ diff --git a/bundles/org.openhab.core.model.lazygen/.classpath b/bundles/org.openhab.core.model.lazygen/.classpath deleted file mode 100644 index faeb20a5799..00000000000 --- a/bundles/org.openhab.core.model.lazygen/.classpath +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.openhab.core.model.lazygen/.project b/bundles/org.openhab.core.model.lazygen/.project deleted file mode 100644 index c128caf2917..00000000000 --- a/bundles/org.openhab.core.model.lazygen/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - org.openhab.core.model.lazygen - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/bundles/org.openhab.core.model.lazygen/NOTICE b/bundles/org.openhab.core.model.lazygen/NOTICE deleted file mode 100644 index 6c17d0d8a45..00000000000 --- a/bundles/org.openhab.core.model.lazygen/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ -This content is produced and maintained by the openHAB project. - -* Project home: https://www.openhab.org - -== Declared Project Licenses - -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/. - -== Source Code - -https://github.com/openhab/openhab-core - diff --git a/bundles/org.openhab.core.model.lazygen/model.profile-marker b/bundles/org.openhab.core.model.lazygen/model.profile-marker deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/bundles/org.openhab.core.model.lazygen/pom.xml b/bundles/org.openhab.core.model.lazygen/pom.xml deleted file mode 100644 index d6880a8fca5..00000000000 --- a/bundles/org.openhab.core.model.lazygen/pom.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 4.0.0 - - - org.openhab.core.bundles - org.openhab.core.reactor.bundles - 4.2.0-SNAPSHOT - - - org.openhab.core.model.lazygen - - openHAB Core :: Bundles :: Model Lazy Generation - - diff --git a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/GlobalResourceSet.java b/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/GlobalResourceSet.java deleted file mode 100644 index 729f13df4b1..00000000000 --- a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/GlobalResourceSet.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2010-2024 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.model.lazygen; - -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.xtext.resource.XtextResourceSet; - -/** - * - * @author Holger Schill, Simon Kaufmann - Initial contribution - */ -@NonNullByDefault -public class GlobalResourceSet { - - public static ResourceSet getINSTANCE() { - return new XtextResourceSet(); - } -} diff --git a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyGenerator.java b/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyGenerator.java deleted file mode 100644 index 2403cb42163..00000000000 --- a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyGenerator.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2010-2024 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.model.lazygen; - -import org.eclipse.emf.mwe.core.WorkflowContext; -import org.eclipse.emf.mwe.core.issues.Issues; -import org.eclipse.emf.mwe.core.monitor.ProgressMonitor; -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.xtext.xtext.generator.XtextGenerator; - -/** - * - * @author Holger Schill, Simon Kaufmann - Initial contribution - */ -@NonNullByDefault -public class LazyGenerator extends XtextGenerator { - - @Nullable - LazyLanguageConfig langConfig = null; - - public void addLazyLanguage(LazyLanguageConfig langConfig) { - this.langConfig = langConfig; - super.addLanguage(langConfig); - } - - @Override - protected void invokeInternal(@NonNullByDefault({}) WorkflowContext ctx, - @NonNullByDefault({}) ProgressMonitor monitor, @NonNullByDefault({}) Issues issues) { - super.checkConfigurationInternal(issues); - super.invokeInternal(ctx, monitor, issues); - } - - @Override - protected void checkConfigurationInternal(@NonNullByDefault({}) Issues issues) { - } -} diff --git a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyLanguageConfig.java b/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyLanguageConfig.java deleted file mode 100644 index d2622537020..00000000000 --- a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyLanguageConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2010-2024 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.model.lazygen; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Holger Schill, Simon Kaufmann - Initial contribution - */ -@NonNullByDefault -public class LazyLanguageConfig extends XtextGeneratorLanguage { - - private final Logger logger = LoggerFactory.getLogger(LazyLanguageConfig.class); -} diff --git a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyStandaloneSetup.java b/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyStandaloneSetup.java deleted file mode 100644 index 4a5195f5dde..00000000000 --- a/bundles/org.openhab.core.model.lazygen/src/main/java/org/openhab/core/model/lazygen/LazyStandaloneSetup.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2010-2024 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.model.lazygen; - -import java.io.File; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EPackage.Registry; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.mwe.core.ConfigurationException; -import org.eclipse.emf.mwe.core.WorkflowContext; -import org.eclipse.emf.mwe.core.issues.Issues; -import org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2; -import org.eclipse.emf.mwe.core.monitor.ProgressMonitor; -import org.eclipse.emf.mwe.core.resources.ResourceLoaderFactory; -import org.eclipse.emf.mwe.utils.GenModelHelper; -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Holger Schill, Simon Kaufmann - Initial contribution - */ -@NonNullByDefault -public class LazyStandaloneSetup extends AbstractWorkflowComponent2 { - - private static ResourceSet resourceSet = GlobalResourceSet.getINSTANCE(); - private final Registry registry = EPackage.Registry.INSTANCE; - - Set allgeneratedEPackages = new HashSet<>(); - Set allGenModelFiles = new HashSet<>(); - Set allEcoreFiles = new HashSet<>(); - - public void addGeneratedPackage(String packageName) { - allgeneratedEPackages.add(packageName); - } - - public void addGenModelFile(String modelFile) { - allGenModelFiles.add(modelFile); - } - - public void addEcoreModelFile(String modelFile) { - allEcoreFiles.add(modelFile); - } - - @Override - protected void invokeInternal(@NonNullByDefault({}) WorkflowContext ctx, - @NonNullByDefault({}) ProgressMonitor monitor, @NonNullByDefault({}) Issues issues) { - for (String generatedEPackage : allgeneratedEPackages) { - addRegisterGeneratedEPackage(generatedEPackage); - } - for (String genModelFile : allGenModelFiles) { - addRegisterGenModelFile(genModelFile); - } - for (String ecoreFile : allEcoreFiles) { - addRegisterEcoreFile(ecoreFile); - } - } - - private final Logger logger = LoggerFactory.getLogger(LazyStandaloneSetup.class); - - private void addRegisterGeneratedEPackage(String interfacename) { - Class clazz = ResourceLoaderFactory.createResourceLoader().loadClass(interfacename); - if (clazz == null) { - throw new ConfigurationException("Couldn't find an interface " + interfacename); - } - try { - EPackage pack = (EPackage) clazz.getDeclaredField("eINSTANCE").get(null); - if (registry.get(pack.getNsURI()) == null) { - registry.put(pack.getNsURI(), pack); - logger.info("Adding generated EPackage '{}'", interfacename); - } - } catch (Exception e) { - throw new ConfigurationException("Couldn't register " + interfacename - + ". Is it the generated EPackage interface? : " + e.getMessage()); - } - } - - private void addRegisterEcoreFile(String fileName) throws IllegalArgumentException, SecurityException { - Resource res = resourceSet.getResource(createURI(fileName), true); - if (res == null) { - throw new ConfigurationException("Couldn't find resource under " + fileName); - } - if (!res.isLoaded()) { - try { - res.load(null); - } catch (IOException e) { - throw new ConfigurationException("Couldn't load resource under " + fileName + " : " + e.getMessage()); - } - } - List result = res.getContents(); - for (EObject object : result) { - if (object instanceof EPackage) { - registerPackage(fileName, object); - } - for (final TreeIterator it = object.eAllContents(); it.hasNext();) { - EObject child = it.next(); - if (child instanceof EPackage) { - registerPackage(fileName, child); - } - } - } - } - - private GenModelHelper createGenModelHelper() { - return new GenModelHelper(); - } - - private void addRegisterGenModelFile(String fileName) { - createGenModelHelper().registerGenModel(resourceSet, createURI(fileName)); - } - - private void registerPackage(String fileName, EObject object) { - String nsUri = ((EPackage) object).getNsURI(); - if (registry.get(nsUri) == null) { - registry.put(nsUri, object); - logger.info("Adding dynamic EPackage '{}' from '{}'", nsUri, fileName); - } else if (logger.isDebugEnabled()) { - logger.debug("Dynamic EPackage '{}' from '{}' already in the registry!", nsUri, fileName); - } - } - - private URI createURI(String path) { - if (path == null) { - throw new IllegalArgumentException(); - } - - URI uri = URI.createURI(path); - if (uri.isRelative()) { - return URI.createFileURI(new File(path).getAbsolutePath()); - } - return uri; - } -} diff --git a/bundles/org.openhab.core.model.persistence/bnd.bnd b/bundles/org.openhab.core.model.persistence/bnd.bnd index ede6179639f..23accce9905 100644 --- a/bundles/org.openhab.core.model.persistence/bnd.bnd +++ b/bundles/org.openhab.core.model.persistence/bnd.bnd @@ -38,7 +38,6 @@ Require-Bundle: org.antlr.runtime,\ org.eclipse.emf.mwe.utils;resolution:=optional,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ org.openhab.core.model.item,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext.common.types,\ org.eclipse.xtext.xtext.generator;resolution:=optional,\ diff --git a/bundles/org.openhab.core.model.rule/bnd.bnd b/bundles/org.openhab.core.model.rule/bnd.bnd index c87092755ca..5c6e0030e1a 100644 --- a/bundles/org.openhab.core.model.rule/bnd.bnd +++ b/bundles/org.openhab.core.model.rule/bnd.bnd @@ -43,7 +43,6 @@ Require-Bundle: org.antlr.runtime,\ org.eclipse.emf.ecore,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ org.openhab.core.model.item,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.openhab.core.model.script,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext.common.types,\ diff --git a/bundles/org.openhab.core.model.script/bnd.bnd b/bundles/org.openhab.core.model.script/bnd.bnd index c11be794039..8ea9d5d90be 100644 --- a/bundles/org.openhab.core.model.script/bnd.bnd +++ b/bundles/org.openhab.core.model.script/bnd.bnd @@ -61,7 +61,6 @@ Require-Bundle: org.antlr.runtime,\ org.eclipse.emf.ecore,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ org.openhab.core.model.item,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext.common.types,\ org.eclipse.xtext.xtext.generator;resolution:=optional,\ diff --git a/bundles/org.openhab.core.model.sitemap/bnd.bnd b/bundles/org.openhab.core.model.sitemap/bnd.bnd index 08e327e6b96..08b21881f9e 100644 --- a/bundles/org.openhab.core.model.sitemap/bnd.bnd +++ b/bundles/org.openhab.core.model.sitemap/bnd.bnd @@ -23,7 +23,6 @@ Require-Bundle: org.antlr.runtime,\ org.eclipse.emf.common,\ org.eclipse.emf.ecore,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext,\ org.eclipse.xtext.xtext.generator;resolution:=optional,\ diff --git a/bundles/org.openhab.core.model.thing/bnd.bnd b/bundles/org.openhab.core.model.thing/bnd.bnd index 2e36b812117..c1bfc49cfd8 100644 --- a/bundles/org.openhab.core.model.thing/bnd.bnd +++ b/bundles/org.openhab.core.model.thing/bnd.bnd @@ -40,7 +40,6 @@ Require-Bundle: org.antlr.runtime,\ org.eclipse.emf.ecore,\ org.eclipse.emf.mwe.utils;resolution:=optional,\ org.eclipse.emf.mwe2.launch;resolution:=optional,\ - org.openhab.core.model.lazygen;resolution:=optional,\ org.eclipse.xtend.lib;resolution:=optional,\ org.eclipse.xtext.common.types,\ org.eclipse.xtext.xtext.generator;resolution:=optional,\ diff --git a/bundles/pom.xml b/bundles/pom.xml index de659616c7c..92b8cca3683 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -86,7 +86,6 @@ org.openhab.core.io.transport.upnp org.openhab.core.io.websocket org.openhab.core.io.jetty.certificate - org.openhab.core.model.lazygen org.openhab.core.model.core org.openhab.core.model.item org.openhab.core.model.item.ide