From 49a06a3d44b747a17a509276082b9004dc98a0e2 Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Thu, 4 Apr 2024 16:52:18 +0300 Subject: [PATCH] [#1334] Net emf objects transfer should rely on domain resource factory Signed-off-by: eparovyshnaya --- .../lbc/internal/base/DecodedRequest.java | 10 ++-- .../internal/base/acquire/LicensePacks.java | 4 +- .../lbc/internal/base/interaction/Pack.java | 7 +-- .../base/mine/ReassemblingMiningTool.java | 7 +-- .../META-INF/MANIFEST.MF | 2 +- .../lbc/internal/jetty/FlsCommands.java | 1 + .../build.properties | 3 +- .../emf/resource/BlindResourceFactory.java | 9 ++++ .../lic/internal/emf/BlindResource.java | 35 +++++++++++++ .../lic/internal/emf/EObjectFromBytes.java | 7 ++- .../lic/internal/emf/EObjectFromFile.java | 11 ++--- .../lic/internal/emf/EObjectFromStream.java | 20 ++++---- .../lic/internal/emf/EObjectToBytes.java | 11 ++--- .../lic/hc/remote/impl/AccessPacks.java | 5 +- .../remote/impl/EObjectFromXmiResponse.java | 9 ++-- .../hc/remote/impl/acquire/RemoteAcquire.java | 7 +-- .../hc/remote/impl/acquire/RemoteRelease.java | 4 +- .../build.properties | 3 +- .../META-INF/MANIFEST.MF | 3 +- .../plugin.xml | 7 +++ .../model/util/KeysResourceFactoryImpl.java | 38 ++++++++++++++ .../lic/keys/model/util/KeysResourceImpl.java | 49 +++++++++++++++++++ .../build.properties | 3 +- .../util/LicensesResourceFactoryImpl.java | 27 ++++------ .../internal/net/handle/EObjectTransfer.java | 12 ++--- .../build.properties | 3 +- .../build.properties | 3 +- .../edit/ui/DomainRegistryExplorerPart.java | 1 + .../META-INF/MANIFEST.MF | 4 +- .../build.properties | 3 +- .../internal/products/core/KeyPairStored.java | 5 +- .../internal/products/core/ProductKeys.java | 6 +-- .../ui/handlers/ProductExportHandler.java | 1 + .../META-INF/MANIFEST.MF | 2 +- .../workbench/emfforms/parts/DetailsView.java | 1 + .../lbc/base/tests/DecodedResponse.java | 15 +++--- .../lbc/base/tests/FeatureRequest.java | 4 +- .../RequirementsFromManifestTest.java | 1 + 38 files changed, 230 insertions(+), 113 deletions(-) create mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/resource/BlindResourceFactory.java create mode 100644 bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/BlindResource.java create mode 100644 bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java create mode 100644 bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/DecodedRequest.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/DecodedRequest.java index b0ed58063..d104fee24 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/DecodedRequest.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/DecodedRequest.java @@ -16,6 +16,7 @@ import java.util.Collections; import java.util.Map; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.passage.lbc.internal.base.api.RawRequest; import org.eclipse.passage.lic.api.LicensedProduct; @@ -27,7 +28,6 @@ import org.eclipse.passage.lic.internal.net.io.SafePayload; import org.eclipse.passage.lic.licenses.model.api.GrantAcqisition; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; public abstract class DecodedRequest { @@ -41,10 +41,10 @@ protected DecodedRequest(RawRequest request, Map options) { public final T get() throws IOException, LicensingException { // FIXME:AF: should be done via factory - return new EObjectFromBytes<>(decoded(request.content()), target(), LicensesResourceImpl::new).get(options); + return new EObjectFromBytes(decoded(request.content()), target()).get(options); } - protected abstract Class target(); + protected abstract EClass target(); private byte[] decoded(byte[] raw) throws LicensingException { LicensedProduct product = new ProductUserRequest(request).product().get(); @@ -58,8 +58,8 @@ public GrantAck(RawRequest request) { } @Override - protected Class target() { - return GrantAcqisition.class; + protected EClass target() { + return LicensesPackage.eINSTANCE.getGrantAcqisition(); } } diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/acquire/LicensePacks.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/acquire/LicensePacks.java index 6ab7d88d8..647a12b06 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/acquire/LicensePacks.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/acquire/LicensePacks.java @@ -30,7 +30,6 @@ import org.eclipse.passage.lic.internal.emf.EObjectFromBytes; import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,7 +67,8 @@ private Optional pack(Path license) { FloatingLicensePack pack; try { // FIXME:AF: should be done via factory - pack = new EObjectFromBytes<>(decoded(license), FloatingLicensePack.class, LicensesResourceImpl::new)// + pack = new EObjectFromBytes(decoded(license), + LicensesPackage.eINSTANCE.getFloatingLicensePack())// .get(Collections.singletonMap(LicensesPackage.eNS_URI, LicensesPackage.eINSTANCE)); } catch (LicensingException e) { log.error("failed: ", e); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/interaction/Pack.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/interaction/Pack.java index 42b70a56a..0b3917627 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/interaction/Pack.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/interaction/Pack.java @@ -29,7 +29,6 @@ import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; import org.eclipse.passage.lic.licenses.model.api.ProductRef; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; final class Pack { @@ -63,11 +62,9 @@ final class Resolved { } private FloatingLicensePack read(byte[] bytes) throws LicensingException { - // FIXME:AF: should be done via factory - return new EObjectFromBytes<>(// + return new EObjectFromBytes(// bytes, // - FloatingLicensePack.class, // - LicensesResourceImpl::new// + LicensesPackage.eINSTANCE.getFloatingLicensePack()// ).get(Collections.singletonMap(LicensesPackage.eNAME, LicensesPackage.eINSTANCE)); } diff --git a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/ReassemblingMiningTool.java b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/ReassemblingMiningTool.java index 5ff736fae..7f7646a7d 100644 --- a/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/ReassemblingMiningTool.java +++ b/bundles/org.eclipse.passage.lbc.base/src/org/eclipse/passage/lbc/internal/base/mine/ReassemblingMiningTool.java @@ -41,7 +41,6 @@ import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; import org.eclipse.passage.lic.licenses.model.api.ProductRef; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -94,11 +93,9 @@ private boolean productFits(ProductRef ref) { } private FloatingLicensePack pack(Path source) throws LicensingException { - // FIXME:AF: should be done via factory - return new EObjectFromBytes<>(// + return new EObjectFromBytes(// decoded(source), // - FloatingLicensePack.class, // - LicensesResourceImpl::new// + LicensesPackage.eINSTANCE.getFloatingLicensePack()// ).get(Collections.singletonMap(LicensesPackage.eNS_URI, LicensesPackage.eINSTANCE)); } diff --git a/bundles/org.eclipse.passage.lbc.jetty/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lbc.jetty/META-INF/MANIFEST.MF index 990b2bcc7..b51b3cf70 100644 --- a/bundles/org.eclipse.passage.lbc.jetty/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lbc.jetty/META-INF/MANIFEST.MF @@ -15,4 +15,4 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", org.eclipse.passage.lic.net;bundle-version="0.0.0" Bundle-ActivationPolicy: lazy Bundle-Activator: org.eclipse.passage.lbc.internal.jetty.FlsJettyActivator -Export-Package: org.eclipse.passage.lbc.jetty +Export-Package: org.eclipse.passage.lbc.jetty;x-internal:=true diff --git a/bundles/org.eclipse.passage.lbc.jetty/src/org/eclipse/passage/lbc/internal/jetty/FlsCommands.java b/bundles/org.eclipse.passage.lbc.jetty/src/org/eclipse/passage/lbc/internal/jetty/FlsCommands.java index 2d37f0300..addc7c52b 100644 --- a/bundles/org.eclipse.passage.lbc.jetty/src/org/eclipse/passage/lbc/internal/jetty/FlsCommands.java +++ b/bundles/org.eclipse.passage.lbc.jetty/src/org/eclipse/passage/lbc/internal/jetty/FlsCommands.java @@ -15,6 +15,7 @@ import org.eclipse.passage.lic.internal.net.connect.Storage; import org.osgi.framework.BundleContext; +@SuppressWarnings("restriction") public final class FlsCommands { public void register(BundleContext context, String name, Storage storage) { diff --git a/bundles/org.eclipse.passage.lic.agreements.ecore/build.properties b/bundles/org.eclipse.passage.lic.agreements.ecore/build.properties index 77cbf0acb..d75e0a22a 100644 --- a/bundles/org.eclipse.passage.lic.agreements.ecore/build.properties +++ b/bundles/org.eclipse.passage.lic.agreements.ecore/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ OSGI-INF/,\ model/,\ - about.html + about.html,\ + . src.includes = model/ diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/resource/BlindResourceFactory.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/resource/BlindResourceFactory.java new file mode 100644 index 000000000..5f3a3d90c --- /dev/null +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/emf/resource/BlindResourceFactory.java @@ -0,0 +1,9 @@ +package org.eclipse.passage.lic.emf.resource; + +import org.eclipse.emf.ecore.resource.Resource; + +public interface BlindResourceFactory { + + Resource createResource(); + +} diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/BlindResource.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/BlindResource.java new file mode 100644 index 000000000..2001c3cce --- /dev/null +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/BlindResource.java @@ -0,0 +1,35 @@ +package org.eclipse.passage.lic.internal.emf; + +import java.util.Objects; +import java.util.function.Supplier; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; +import org.eclipse.passage.lic.emf.resource.BlindResourceFactory; + +public final class BlindResource implements Supplier { + + private final EClass type; + + public BlindResource(EClass type) { + this.type = Objects.requireNonNull(type); + } + + public BlindResource(EObject source) { + this(Objects.requireNonNull(source).eClass()); + } + + @Override + public Resource get() { + String domain = type.getEPackage().getName(); + Object factory = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().get(domain); + if (factory instanceof BlindResourceFactory) { + return ((BlindResourceFactory) factory).createResource(); + + } + return new XMIResourceImpl(); + } + +} diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromBytes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromBytes.java index 94fc61b63..17d7e0ad9 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromBytes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromBytes.java @@ -16,17 +16,16 @@ import java.io.IOException; import java.io.InputStream; import java.util.Objects; -import java.util.function.Supplier; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; public class EObjectFromBytes extends EObjectFromStream { private final byte[] content; - public EObjectFromBytes(byte[] content, Class expected, Supplier factory) { - super(expected, factory); + public EObjectFromBytes(byte[] content, EClass expected) { + super(expected); Objects.requireNonNull(content, "EObjectFromBytes::content"); //$NON-NLS-1$ this.content = content; diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromFile.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromFile.java index 1e4fba643..742b8e4e1 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromFile.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromFile.java @@ -18,21 +18,20 @@ import java.io.InputStream; import java.nio.file.Path; import java.util.Objects; -import java.util.function.Supplier; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; public class EObjectFromFile extends EObjectFromStream { private final File file; - public EObjectFromFile(Path path, Class expected, Supplier factory) { - this(path.toFile(), expected, factory); + public EObjectFromFile(Path path, EClass expected) { + this(path.toFile(), expected); } - public EObjectFromFile(File file, Class expected, Supplier factory) { - super(expected, factory); + public EObjectFromFile(File file, EClass expected) { + super(expected); Objects.requireNonNull(file, "EObjectFromFile::file"); //$NON-NLS-1$ this.file = file; diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromStream.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromStream.java index 4155ae774..4510aaa3c 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromStream.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectFromStream.java @@ -18,8 +18,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.function.Supplier; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.passage.lic.api.LicensingException; @@ -27,14 +27,11 @@ public abstract class EObjectFromStream { - private final Class expected; - private final Supplier factory; + private final EClass expected; + + public EObjectFromStream(EClass expected) { + this.expected = Objects.requireNonNull(expected, getClass().getSimpleName() + "::expected"); //$NON-NLS-1$ - public EObjectFromStream(Class expected, Supplier factory) { - Objects.requireNonNull(expected, getClass().getSimpleName() + "::expected"); //$NON-NLS-1$ - Objects.requireNonNull(factory, getClass().getSimpleName() + "::factory"); //$NON-NLS-1$ - this.expected = expected; - this.factory = factory; } public T get() throws LicensingException { @@ -48,7 +45,7 @@ public T get(Map options) throws LicensingException { protected abstract InputStream stream() throws IOException; private List content(Map options) throws LicensingException { - Resource resource = factory.get(); + Resource resource = new BlindResource(expected).get(); try (InputStream input = stream()) { resource.load(input, options); } catch (IOException e) { @@ -64,12 +61,13 @@ private EObject only(List contents) throws LicensingException { return contents.get(0); } + @SuppressWarnings("unchecked") private T from(EObject only) throws LicensingException { - if (!expected.isInstance(only)) { + if (expected != only.eClass()) { throw new LicensingException(String.format(EmfMessages.XmiToEObject_unexpected_type, only.getClass().getName(), expected.getName())); } - return expected.cast(only); + return (T) expected.getInstanceClass().cast(only); } } diff --git a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectToBytes.java b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectToBytes.java index a549a1037..4552ed116 100644 --- a/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectToBytes.java +++ b/bundles/org.eclipse.passage.lic.emf/src/org/eclipse/passage/lic/internal/emf/EObjectToBytes.java @@ -17,7 +17,6 @@ import java.util.Collections; import java.util.Map; import java.util.Objects; -import java.util.function.Supplier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; @@ -27,13 +26,9 @@ public final class EObjectToBytes { private final EObject source; - private final Supplier factory; - public EObjectToBytes(EObject source, Supplier factory) { - Objects.requireNonNull(source, getClass().getSimpleName() + "::source"); //$NON-NLS-1$ - Objects.requireNonNull(factory, getClass().getSimpleName() + "::factory"); //$NON-NLS-1$ - this.source = source; - this.factory = factory; + public EObjectToBytes(EObject source) { + this.source = Objects.requireNonNull(source, getClass().getSimpleName() + "::source"); //$NON-NLS-1$ } public byte[] get() throws LicensingException { @@ -41,7 +36,7 @@ public byte[] get() throws LicensingException { } public byte[] get(Map options) throws LicensingException { - Resource resource = factory.get(); + Resource resource = new BlindResource(source).get(); resource.getContents().add(source); try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { resource.save(stream, options); diff --git a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/AccessPacks.java b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/AccessPacks.java index beba53c84..185a8a8d3 100644 --- a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/AccessPacks.java +++ b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/AccessPacks.java @@ -39,7 +39,6 @@ import org.eclipse.passage.lic.internal.hc.i18n.AccessMessages; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; /** * @@ -106,8 +105,8 @@ private byte[] decoded(Path file, KeyKeeper key, StreamCodec codec) throws Licen } private FloatingLicenseAccess from(byte[] content) throws LicensingException { - // FIXME:AF: should be done via factory - return new EObjectFromBytes<>(content, FloatingLicenseAccess.class, LicensesResourceImpl::new)// + return new EObjectFromBytes(content, + LicensesPackage.eINSTANCE.getFloatingLicenseAccess())// .get(Collections.singletonMap(LicensesPackage.eNS_URI, LicensesPackage.eINSTANCE)); } diff --git a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/EObjectFromXmiResponse.java b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/EObjectFromXmiResponse.java index 955b62dc4..265c0a6d0 100644 --- a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/EObjectFromXmiResponse.java +++ b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/EObjectFromXmiResponse.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.passage.lic.hc.remote.impl; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.passage.lic.api.LicensingException; import org.eclipse.passage.lic.api.conditions.mining.ContentType; @@ -20,7 +21,6 @@ import org.eclipse.passage.lic.internal.emf.EObjectFromBytes; import org.eclipse.passage.lic.internal.hc.i18n.AccessMessages; import org.eclipse.passage.lic.internal.net.io.SafePayload; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; /** * @@ -28,10 +28,10 @@ */ public final class EObjectFromXmiResponse implements ResponseHandler { - private final Class expected; + private final EClass expected; private final Equipment equipment; - public EObjectFromXmiResponse(Class expected, Equipment equipment) { + public EObjectFromXmiResponse(EClass expected, Equipment equipment) { this.expected = expected; this.equipment = equipment; } @@ -39,8 +39,7 @@ public EObjectFromXmiResponse(Class expected, Equipment equipment) { @Override public T read(ResultsTransfered results, RequestContext context) throws LicensingException { contentTypeIsExpected(results); - // FIXME:AF: should be done via factory - return new EObjectFromBytes(decoded(results.data(), context), expected, LicensesResourceImpl::new).get(); + return new EObjectFromBytes(decoded(results.data(), context), expected).get(); } private byte[] decoded(byte[] raw, RequestContext context) throws LicensingException { diff --git a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteAcquire.java b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteAcquire.java index dc260d92d..4abaaa2c7 100644 --- a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteAcquire.java +++ b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteAcquire.java @@ -28,12 +28,13 @@ import org.eclipse.passage.lic.hc.remote.impl.Equipment; import org.eclipse.passage.lic.hc.remote.impl.RemoteRequest; import org.eclipse.passage.lic.hc.remote.impl.RemoteServiceData; +import org.eclipse.passage.lic.hc.remote.impl.RemoteServiceData.OfFeature; import org.eclipse.passage.lic.hc.remote.impl.RequestParameters; import org.eclipse.passage.lic.hc.remote.impl.ResultsTransfered; import org.eclipse.passage.lic.hc.remote.impl.ServiceAny; -import org.eclipse.passage.lic.hc.remote.impl.RemoteServiceData.OfFeature; import org.eclipse.passage.lic.internal.licenses.convert.PGrantAcquisition; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; +import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; final class RemoteAcquire extends ServiceAny { @@ -49,8 +50,8 @@ protected RemoteRequest request(OfFeature params, FloatingLicenseAccess acces @Override protected ResponseHandler handler(FloatingLicenseAccess access) { return new Response(// - new EObjectFromXmiResponse<>(// - org.eclipse.passage.lic.licenses.model.api.GrantAcqisition.class, // + new EObjectFromXmiResponse(// + LicensesPackage.eINSTANCE.getGrantAcqisition(), // equipment)); } diff --git a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteRelease.java b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteRelease.java index e88aa2107..bfeba8a0c 100644 --- a/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteRelease.java +++ b/bundles/org.eclipse.passage.lic.hc/src/org/eclipse/passage/lic/hc/remote/impl/acquire/RemoteRelease.java @@ -34,7 +34,6 @@ import org.eclipse.passage.lic.internal.licenses.convert.EGrantAcquisition; import org.eclipse.passage.lic.internal.net.io.SafePayload; import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; final class RemoteRelease extends ServiceAny> { @@ -88,8 +87,7 @@ public RequestParameters parameters() { } private byte[] payload() throws LicensingException { - // FIXME:AF: should be done via factory - return new EObjectToBytes(new EGrantAcquisition(data.payload()).get(), LicensesResourceImpl::new).get(); + return new EObjectToBytes(new EGrantAcquisition(data.payload()).get()).get(); } } diff --git a/bundles/org.eclipse.passage.lic.keys.ecore/build.properties b/bundles/org.eclipse.passage.lic.keys.ecore/build.properties index 77cbf0acb..d75e0a22a 100644 --- a/bundles/org.eclipse.passage.lic.keys.ecore/build.properties +++ b/bundles/org.eclipse.passage.lic.keys.ecore/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ OSGI-INF/,\ model/,\ - about.html + about.html,\ + . src.includes = model/ 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 aa4fc8302..c3c8fee26 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 @@ -8,7 +8,8 @@ Bundle-Vendor: %providerName Bundle-Copyright: %Bundle-Copyright Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-11 -Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";x-installation:=greedy;resolution:=optional, +Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";resolution:=optional;x-installation:=greedy, + org.eclipse.emf.ecore.xmi;bundle-version="0.0.0", 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 diff --git a/bundles/org.eclipse.passage.lic.keys.model/plugin.xml b/bundles/org.eclipse.passage.lic.keys.model/plugin.xml index c26c6dca5..c7a5fb6f3 100644 --- a/bundles/org.eclipse.passage.lic.keys.model/plugin.xml +++ b/bundles/org.eclipse.passage.lic.keys.model/plugin.xml @@ -23,4 +23,11 @@ genModel="model/keys.genmodel"/> + + + + + 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-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java new file mode 100644 index 000000000..00b0afa8f --- /dev/null +++ b/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceFactoryImpl.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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; + +public final class KeysResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory { + + /** + * @generated + */ + @Override + public Resource createResource(URI uri) { + return new KeysResourceImpl(uri); + } + + /** + * @generated NOT + */ + @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-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java new file mode 100644 index 000000000..a06e1d4b4 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.keys.model/src-gen/org/eclipse/passage/lic/keys/model/util/KeysResourceImpl.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2018, 2021 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; + +/** + * @generated NOT + */ +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); + } + +} diff --git a/bundles/org.eclipse.passage.lic.licenses.ecore/build.properties b/bundles/org.eclipse.passage.lic.licenses.ecore/build.properties index 4f0249f51..5ec1bc0ae 100644 --- a/bundles/org.eclipse.passage.lic.licenses.ecore/build.properties +++ b/bundles/org.eclipse.passage.lic.licenses.ecore/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ OSGI-INF/,\ model/,\ - about.html + about.html,\ + . src.includes = model/ diff --git a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceFactoryImpl.java b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceFactoryImpl.java index c95249e1e..fa9424874 100644 --- a/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceFactoryImpl.java +++ b/bundles/org.eclipse.passage.lic.licenses.model/src-gen/org/eclipse/passage/lic/licenses/model/util/LicensesResourceFactoryImpl.java @@ -15,36 +15,29 @@ 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; /** - * The Resource Factory associated with the - * package. - * * @see org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl * @since 2.1 * @generated NOT */ -public class LicensesResourceFactoryImpl extends ResourceFactoryImpl { +public final class LicensesResourceFactoryImpl extends ResourceFactoryImpl implements BlindResourceFactory { + /** - * Creates an instance of the resource factory. - * * @generated */ - public LicensesResourceFactoryImpl() { - super(); + @Override + public Resource createResource(URI uri) { + return new LicensesResourceImpl(uri); } /** - * Creates an instance of the resource. - * - * @generated + * @generated NOT */ @Override - public Resource createResource(URI uri) { - Resource result = new LicensesResourceImpl(uri); - return result; + public Resource createResource() { + return new LicensesResourceImpl(); } -} // LicensesResourceFactoryImpl +} diff --git a/bundles/org.eclipse.passage.lic.net/src/org/eclipse/passage/lic/internal/net/handle/EObjectTransfer.java b/bundles/org.eclipse.passage.lic.net/src/org/eclipse/passage/lic/internal/net/handle/EObjectTransfer.java index 4fef0b508..cf8fa7d6e 100644 --- a/bundles/org.eclipse.passage.lic.net/src/org/eclipse/passage/lic/internal/net/handle/EObjectTransfer.java +++ b/bundles/org.eclipse.passage.lic.net/src/org/eclipse/passage/lic/internal/net/handle/EObjectTransfer.java @@ -12,8 +12,9 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.net.handle; +import java.util.Objects; + import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; import org.eclipse.passage.lic.api.LicensingException; import org.eclipse.passage.lic.api.conditions.mining.ContentType; import org.eclipse.passage.lic.api.io.Hashes; @@ -29,9 +30,9 @@ public final class EObjectTransfer implements NetResponse { private final Hashes hashes; public EObjectTransfer(EObject payload, KeyKeeper key, Hashes hashes) { - this.payload = payload; - this.key = key; - this.hashes = hashes; + this.payload = Objects.requireNonNull(payload); + this.key = Objects.requireNonNull(key); + this.hashes = Objects.requireNonNull(hashes); } @Override @@ -51,8 +52,7 @@ public Error error() { @Override public byte[] payload() throws LicensingException { - // FIXME:AF: should be done via factory - return encode(new EObjectToBytes(payload, XMIResourceImpl::new).get()); + return encode(new EObjectToBytes(payload).get()); } @Override diff --git a/bundles/org.eclipse.passage.lic.products.ecore/build.properties b/bundles/org.eclipse.passage.lic.products.ecore/build.properties index 4f0249f51..5ec1bc0ae 100644 --- a/bundles/org.eclipse.passage.lic.products.ecore/build.properties +++ b/bundles/org.eclipse.passage.lic.products.ecore/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ OSGI-INF/,\ model/,\ - about.html + about.html,\ + . src.includes = model/ diff --git a/bundles/org.eclipse.passage.lic.users.ecore/build.properties b/bundles/org.eclipse.passage.lic.users.ecore/build.properties index 4f0249f51..5ec1bc0ae 100644 --- a/bundles/org.eclipse.passage.lic.users.ecore/build.properties +++ b/bundles/org.eclipse.passage.lic.users.ecore/build.properties @@ -16,5 +16,6 @@ output.. = bin/ bin.includes = META-INF/,\ OSGI-INF/,\ model/,\ - about.html + about.html,\ + . src.includes = model/ diff --git a/bundles/org.eclipse.passage.loc.edit.ui/src/org/eclipse/passage/loc/edit/ui/DomainRegistryExplorerPart.java b/bundles/org.eclipse.passage.loc.edit.ui/src/org/eclipse/passage/loc/edit/ui/DomainRegistryExplorerPart.java index 70c897eee..d9779e21f 100644 --- a/bundles/org.eclipse.passage.loc.edit.ui/src/org/eclipse/passage/loc/edit/ui/DomainRegistryExplorerPart.java +++ b/bundles/org.eclipse.passage.loc.edit.ui/src/org/eclipse/passage/loc/edit/ui/DomainRegistryExplorerPart.java @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbenchActionConstants; +@SuppressWarnings("restriction") public class DomainRegistryExplorerPart { private final LocDomainRegistryAccess access; diff --git a/bundles/org.eclipse.passage.loc.equinox/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.loc.equinox/META-INF/MANIFEST.MF index 8ffdc4668..aa8324ac5 100644 --- a/bundles/org.eclipse.passage.loc.equinox/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.equinox/META-INF/MANIFEST.MF @@ -11,5 +11,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.passage.loc.api;bundle-version="0.0.0";visibility:=reexport, org.eclipse.passage.lic.base;bundle-version="0.0.0";visibility:=reexport, - org.eclipse.passage.lic.emf;bundle-version="0.0.0", - org.eclipse.passage.lic.equinox;bundle-version="0.0.0" + org.eclipse.passage.lic.emf;bundle-version="0.0.0";visibility:=reexport, + org.eclipse.passage.lic.equinox;bundle-version="0.0.0";visibility:=reexport diff --git a/bundles/org.eclipse.passage.loc.operator/build.properties b/bundles/org.eclipse.passage.loc.operator/build.properties index b59d91711..0c4c109e1 100644 --- a/bundles/org.eclipse.passage.loc.operator/build.properties +++ b/bundles/org.eclipse.passage.loc.operator/build.properties @@ -21,6 +21,7 @@ bin.includes = META-INF/,\ about.html,\ about.mappings,\ splash.bmp,\ - licenses/ + licenses/,\ + . generateSourceReferences = true diff --git a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/KeyPairStored.java b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/KeyPairStored.java index 5b48cc39b..8f861d5f7 100644 --- a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/KeyPairStored.java +++ b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/KeyPairStored.java @@ -14,7 +14,6 @@ import java.util.Optional; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; import org.eclipse.passage.lic.api.LicensingException; import org.eclipse.passage.lic.internal.emf.EObjectToBytes; import org.eclipse.passage.lic.keys.model.api.KeyPair; @@ -49,9 +48,7 @@ private Optional store(Keys keys) throws LicensingException { private ResourceHandle storeCoupled(Keys keys, String product, String version) throws LicensingException { ResourceHandle locator = keys.located(product, version); - // FIXME:AF: should be done via factory - // FIXME:AF: generate XMI factory for keys - byte[] content = new EObjectToBytes(pair, XMIResourceImpl::new).get(); + byte[] content = new EObjectToBytes(pair).get(); try { locator.write(content); } catch (Exception e) { diff --git a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductKeys.java b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductKeys.java index dc82bc8ed..e8894f252 100644 --- a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductKeys.java +++ b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductKeys.java @@ -17,12 +17,12 @@ import java.util.Optional; import java.util.function.Function; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; import org.eclipse.passage.lic.api.LicensedProduct; import org.eclipse.passage.lic.api.LicensingException; import org.eclipse.passage.lic.base.BaseLicensedProduct; import org.eclipse.passage.lic.internal.emf.EObjectFromBytes; import org.eclipse.passage.lic.keys.model.api.KeyPair; +import org.eclipse.passage.lic.keys.model.meta.KeysPackage; import org.eclipse.passage.loc.internal.api.workspace.Keys; import org.eclipse.passage.loc.internal.api.workspace.ResourceHandle; import org.eclipse.passage.loc.internal.equinox.OperatorGearAware; @@ -69,9 +69,7 @@ private byte[] getBytes(Function get) throws LicensingException } ResourceHandle source = keys.located(product); try { - // FIXME:AF: should be done via factory - // FIXME:AF: generate XMI factory for keys - KeyPair pair = new EObjectFromBytes(source.content(), KeyPair.class, XMIResourceImpl::new).get(); + KeyPair pair = new EObjectFromBytes(source.content(), KeysPackage.eINSTANCE.getKeyPair()).get(); return get.apply(pair).getBytes(); } catch (Exception e) { throw new LicensingException( diff --git a/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/handlers/ProductExportHandler.java b/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/handlers/ProductExportHandler.java index 824958a6f..511cf0ce4 100644 --- a/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/handlers/ProductExportHandler.java +++ b/bundles/org.eclipse.passage.loc.products.ui/src/org/eclipse/passage/loc/products/ui/handlers/ProductExportHandler.java @@ -27,6 +27,7 @@ import org.eclipse.passage.loc.internal.products.ui.i18n.ProductsUiMessages; import org.eclipse.swt.widgets.Shell; +@SuppressWarnings("restriction") public class ProductExportHandler { @Execute diff --git a/bundles/org.eclipse.passage.loc.users.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.loc.users.core/META-INF/MANIFEST.MF index c9f560b77..5111c861f 100644 --- a/bundles/org.eclipse.passage.loc.users.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.users.core/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.passage.lic.equinox;bundle-version="0.0.0", org.eclipse.passage.lic.emf;bundle-version="0.0.0", org.eclipse.passage.lic.users.model;bundle-version="0.0.0";visibility:=reexport, org.eclipse.passage.loc.api;bundle-version="0.0.0", - org.eclipse.passage.loc.equinox + org.eclipse.passage.loc.equinox;bundle-version="0.0.0" Export-Package: org.eclipse.passage.loc.internal.users; x-friends:="org.eclipse.passage.loc.users.emfforms, org.eclipse.passage.loc.users.ui, diff --git a/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java b/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java index 4b2355802..f96c28c93 100644 --- a/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java +++ b/bundles/org.eclipse.passage.loc.workbench.emfforms/src/org/eclipse/passage/loc/workbench/emfforms/parts/DetailsView.java @@ -72,6 +72,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; +@SuppressWarnings("restriction") public class DetailsView { private final MPart part; diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java index 94d23ec40..e462c1fb6 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/DecodedResponse.java @@ -16,6 +16,7 @@ import java.util.Collections; import java.util.Map; +import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.passage.lbc.internal.base.api.RawRequest; import org.eclipse.passage.lic.api.LicensedProduct; @@ -29,7 +30,6 @@ import org.eclipse.passage.lic.licenses.model.api.GrantAcqisition; import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; @SuppressWarnings("restriction") abstract class DecodedResponse { @@ -45,11 +45,10 @@ abstract class DecodedResponse { } final T get() throws IOException, LicensingException { - // FIXME:AF: should be done via factory - return new EObjectFromBytes<>(decoded(response.payload()), target(), LicensesResourceImpl::new).get(options); + return new EObjectFromBytes(decoded(response.payload()), target()).get(options); } - protected abstract Class target(); + protected abstract EClass target(); private byte[] decoded(byte[] raw) throws LicensingException { LicensedProduct product = new ProductUserRequest(request).product().get(); @@ -63,8 +62,8 @@ static final class License extends DecodedResponse { } @Override - protected Class target() { - return PersonalLicensePack.class; + protected EClass target() { + return LicensesPackage.eINSTANCE.getPersonalLicensePack(); } } @@ -75,8 +74,8 @@ static final class GrantAck extends DecodedResponse { } @Override - protected Class target() { - return GrantAcqisition.class; + protected EClass target() { + return LicensesPackage.eINSTANCE.getGrantAcqisition(); } } diff --git a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FeatureRequest.java b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FeatureRequest.java index 83d83b519..042dfa3dc 100644 --- a/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FeatureRequest.java +++ b/tests/org.eclipse.passage.lbc.base.tests/src/org/eclipse/passage/lbc/base/tests/FeatureRequest.java @@ -29,7 +29,6 @@ import org.eclipse.passage.lic.internal.emf.EObjectToBytes; import org.eclipse.passage.lic.internal.net.LicenseUser; import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage; -import org.eclipse.passage.lic.licenses.model.util.LicensesResourceImpl; @SuppressWarnings("restriction") final class FeatureRequest { @@ -81,8 +80,7 @@ public RawRequest get() throws LicensingException { } private byte[] raw(EObject obj) throws LicensingException { - // FIXME:AF: should be done via factory - return new EObjectToBytes(obj, LicensesResourceImpl::new)// + return new EObjectToBytes(obj)// .get(Collections.singletonMap(LicensesPackage.eNS_URI, LicensesPackage.eINSTANCE)); } diff --git a/tests/org.eclipse.passage.lic.equinox.tests/src/org/eclipse/passage/lic/equinox/requirements/RequirementsFromManifestTest.java b/tests/org.eclipse.passage.lic.equinox.tests/src/org/eclipse/passage/lic/equinox/requirements/RequirementsFromManifestTest.java index d35c1e01e..2e3482131 100644 --- a/tests/org.eclipse.passage.lic.equinox.tests/src/org/eclipse/passage/lic/equinox/requirements/RequirementsFromManifestTest.java +++ b/tests/org.eclipse.passage.lic.equinox.tests/src/org/eclipse/passage/lic/equinox/requirements/RequirementsFromManifestTest.java @@ -28,6 +28,7 @@ import org.junit.Test; import org.osgi.framework.FrameworkUtil; +@SuppressWarnings("restriction") public class RequirementsFromManifestTest { @Test