From 3272d9bb6f28aea62477816bae1f002bb2db3fc4 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Tue, 28 May 2024 19:24:45 +0300 Subject: [PATCH] [#1375] Revise public API move KeysResource and Factory to internal package --- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 68 +++++++------- .../model/migration/KeysResourceHandler.java | 91 ++++++++++--------- .../model/util/KeysResourceFactoryImpl.java | 76 +++++++--------- .../keys/model/util/KeysResourceImpl.java | 91 ++++++++----------- 5 files changed, 154 insertions(+), 175 deletions(-) rename bundles/org.eclipse.passage.lic.keys.model/{src-gen/org/eclipse/passage/lic => src/org/eclipse/passage/lic/internal}/keys/model/util/KeysResourceFactoryImpl.java (86%) rename bundles/org.eclipse.passage.lic.keys.model/{src-gen/org/eclipse/passage/lic => src/org/eclipse/passage/lic/internal}/keys/model/util/KeysResourceImpl.java (85%) diff --git a/bundles/org.eclipse.passage.lic.keys.model/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.keys.model/META-INF/MANIFEST.MF index f40257838..e2a7ba60d 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.keys.model/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";resolution:=opti org.eclipse.emf.ecore;bundle-version="0.0.0";visibility:=reexport, org.eclipse.passage.lic.emf;bundle-version="0.0.0", org.eclipse.passage.lic.keys;bundle-version="0.0.0";visibility:=reexport -Export-Package: org.eclipse.passage.lic.keys.model.api, +Export-Package: org.eclipse.passage.lic.internal.keys.model.util;x-internal:=true, + org.eclipse.passage.lic.keys.model.api, org.eclipse.passage.lic.keys.model.impl;x-internal:=true, org.eclipse.passage.lic.keys.model.meta, org.eclipse.passage.lic.keys.model.util diff --git a/bundles/org.eclipse.passage.lic.keys.model/plugin.xml b/bundles/org.eclipse.passage.lic.keys.model/plugin.xml index 3c37e4061..38088af89 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/plugin.xml +++ b/bundles/org.eclipse.passage.lic.keys.model/plugin.xml @@ -1,34 +1,34 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/migration/KeysResourceHandler.java b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/migration/KeysResourceHandler.java index cf2593a76..e168f9c72 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/migration/KeysResourceHandler.java +++ b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/migration/KeysResourceHandler.java @@ -1,45 +1,46 @@ -/******************************************************************************* - * Copyright (c) 2024 ArSysOp - * - * 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 - * - * Contributors: - * ArSysOp - initial API and implementation - *******************************************************************************/ -package org.eclipse.passage.lic.internal.keys.model.migration; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.passage.lic.emf.migration.MigrationRoutes; -import org.eclipse.passage.lic.emf.migration.SimpleMigrationRoutes; -import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; -import org.eclipse.passage.lic.keys.model.meta.KeysPackage; - -public final class KeysResourceHandler extends MigratingResourceHandler { - - @Override - protected void complete(XMLResource resource) { - // do nothing - } - - @Override - protected void register() { - migrate200(); - } - - @Override - protected MigrationRoutes attributes() { - return new SimpleMigrationRoutes(); - } - - private void migrate200() { - String uri = "http://www.eclipse.org/passage/lic/keys/2.0.0"; //$NON-NLS-1$ - KeysPackage delegate = KeysPackage.eINSTANCE; - EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate); - } - -} +/******************************************************************************* + * Copyright (c) 2024 ArSysOp + * + * 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 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.internal.keys.model.migration; + +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.passage.lic.emf.migration.MigrationRoutes; +import org.eclipse.passage.lic.emf.migration.SimpleMigrationRoutes; +import org.eclipse.passage.lic.emf.xmi.MigratingResourceHandler; +import org.eclipse.passage.lic.keys.model.meta.KeysPackage; + +@SuppressWarnings("restriction") +public final class KeysResourceHandler extends MigratingResourceHandler { + + @Override + protected void complete(XMLResource resource) { + // do nothing + } + + @Override + protected void register() { + migrate200(); + } + + @Override + protected MigrationRoutes attributes() { + return new SimpleMigrationRoutes(); + } + + private void migrate200() { + String uri = "http://www.eclipse.org/passage/lic/keys/2.0.0"; //$NON-NLS-1$ + KeysPackage delegate = KeysPackage.eINSTANCE; + EPackage.Registry.INSTANCE.computeIfAbsent(uri, ns -> delegate); + } + +} diff --git a/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceFactoryImpl.java similarity index 86% rename from bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java rename to bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceFactoryImpl.java index 2a7541d04..e5133317c 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java +++ b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceFactoryImpl.java @@ -1,43 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2024 ArSysOp - * - * 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 - * - * Contributors: - * ArSysOp - initial API and implementation - *******************************************************************************/ -package org.eclipse.passage.lic.keys.model.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; -import org.eclipse.passage.lic.emf.resource.BlindResourceFactory; - -/** - * @since 3.0 - * - * @generated NOT - */ -public final class KeysResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory { - - /** - * @generated NOT - */ - @Override - public Resource createResource(URI uri) { - return new KeysResourceImpl(uri); - } - - /** - * @generated NOT - */ - @Override - public Resource createResource() { - return new KeysResourceImpl(); - } - -} +/******************************************************************************* + * Copyright (c) 2024 ArSysOp + * + * 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 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.internal.keys.model.util; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; +import org.eclipse.passage.lic.emf.resource.BlindResourceFactory; + +@SuppressWarnings("restriction") +public final class KeysResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory { + + @Override + public Resource createResource(URI uri) { + return new KeysResourceImpl(uri); + } + + @Override + public Resource createResource() { + return new KeysResourceImpl(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceImpl.java similarity index 85% rename from bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java rename to bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceImpl.java index f15125b51..c58034b99 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java +++ b/bundles/org.eclipse.passage.lic.keys.model/src/org/eclipse/passage/lic/internal/keys/model/util/KeysResourceImpl.java @@ -1,52 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2024 ArSysOp - * - * 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 - * - * Contributors: - * ArSysOp - initial API and implementation - *******************************************************************************/ -package org.eclipse.passage.lic.keys.model.util; - -import java.util.Map; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; -import org.eclipse.passage.lic.internal.keys.model.migration.KeysResourceHandler; - -/** - * @generated NOT - * @since 3.0 - */ -public class KeysResourceImpl extends XMIResourceImpl { - /** - * @generated - */ - public KeysResourceImpl(URI uri) { - super(uri); - } - - /** - * - * @generated NOT - */ - public KeysResourceImpl() { - super(); - } - - /** - * @generated NOT - */ - @Override - protected void init() { - super.init(); - Map options = getDefaultLoadOptions(); - options.put(OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); - options.put(OPTION_RESOURCE_HANDLER, new KeysResourceHandler()); - } - -} +/******************************************************************************* + * Copyright (c) 2024 ArSysOp + * + * 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 + * + * Contributors: + * ArSysOp - initial API and implementation + *******************************************************************************/ +package org.eclipse.passage.lic.internal.keys.model.util; + +import java.util.Map; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; +import org.eclipse.passage.lic.internal.keys.model.migration.KeysResourceHandler; + +public class KeysResourceImpl extends XMIResourceImpl { + + public KeysResourceImpl(URI uri) { + super(uri); + } + + public KeysResourceImpl() { + super(); + } + + @Override + protected void init() { + super.init(); + Map options = getDefaultLoadOptions(); + options.put(OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); + options.put(OPTION_RESOURCE_HANDLER, new KeysResourceHandler()); + } + +}