From 9547c3323651579b73b55bccef98bd2968917b90 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 12:37:39 +0300 Subject: [PATCH 1/9] #1059 Prepare sourcebase for 2.3.0 release fix typo in error message --- .../src/org/eclipse/passage/lic/api/io/EncryptionKeySize.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/api/io/EncryptionKeySize.java b/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/api/io/EncryptionKeySize.java index b9c5ee8fe..e2c0afe67 100644 --- a/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/api/io/EncryptionKeySize.java +++ b/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/api/io/EncryptionKeySize.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2021 ArSysOp + * Copyright (c) 2020, 2022 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -23,7 +23,7 @@ public abstract class EncryptionKeySize { public EncryptionKeySize(int size) { if (size <= 0) { - throw new IllegalArgumentException("EncryptionKeySize::size must be positiv"); //$NON-NLS-1$ + throw new IllegalArgumentException("EncryptionKeySize::size must be positive"); //$NON-NLS-1$ } this.size = size; } From 4119cfca4f9206ca0e4cb3a60eab64b66ae27dff Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 12:38:33 +0300 Subject: [PATCH 2/9] #1059 Prepare sourcebase for 2.3.0 release propagate usage expectation to documentation --- .../eclipse/passage/lic/internal/base/access/Library.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/access/Library.java b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/access/Library.java index dfd99eae1..03c248692 100644 --- a/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/access/Library.java +++ b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/access/Library.java @@ -86,9 +86,15 @@ public interface Library extends PassageLicenseCoverage { ServiceInvocationResult assess(); /** + *

* For a given {@code agreement} a library should perform an analysis if this * agreement is demanded by it, and in this case supply an instance and * {@linkplain AgreementAcceptanceService} for acceptance. + *

+ *

+ * If the {@code agreement} does not belong to the library, report empty result + * with bearable diagnostic of {@linkplain ForeignLicense} trouble code. + *

*/ ServiceInvocationResult agreementsService(AgreementToAccept agreement); From 5dfed7931094b8cea0228370b5de90e97e3e62bb Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 12:42:26 +0300 Subject: [PATCH 3/9] #1059 Prepare sourcebase for 2.3.0 release neutralize precise versions --- .../META-INF/MANIFEST.MF | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.execute/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.execute/META-INF/MANIFEST.MF index 192af854e..484c05c78 100644 --- a/bundles/org.eclipse.passage.lic.execute/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.execute/META-INF/MANIFEST.MF @@ -10,12 +10,12 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Require-Bundle: org.apache.logging.log4j;bundle-version="2.17.1", org.eclipse.osgi.services;bundle-version="0.0.0", - org.eclipse.passage.lic.api;bundle-version="2.3.0", - org.eclipse.passage.lic.base;bundle-version="2.3.0", - org.eclipse.passage.lic.bc;bundle-version="1.2.1", - org.eclipse.passage.lic.equinox;bundle-version="2.3.0", - org.eclipse.passage.lic.hc;bundle-version="1.2.1", - org.eclipse.passage.lic.licenses;bundle-version="2.3.0", - org.eclipse.passage.lic.licenses.model;bundle-version="2.3.0", - org.eclipse.passage.lic.oshi;bundle-version="1.2.1" + org.eclipse.passage.lic.api;bundle-version="0.0.0", + org.eclipse.passage.lic.base;bundle-version="0.0.0", + org.eclipse.passage.lic.bc;bundle-version="0.0.0", + org.eclipse.passage.lic.equinox;bundle-version="0.0.0", + org.eclipse.passage.lic.hc;bundle-version="0.0.0", + org.eclipse.passage.lic.licenses;bundle-version="0.0.0", + org.eclipse.passage.lic.licenses.model;bundle-version="0.0.0", + org.eclipse.passage.lic.oshi;bundle-version="0.0.0" Export-Package: org.eclipse.passage.lic.execute From ff1975dcc68b89797b5e7b30acf65d43dd5e1dcb Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 12:45:00 +0300 Subject: [PATCH 4/9] #1059 Prepare sourcebase for 2.3.0 release - put FilteredRequirement utility to proper package - publish FilteredRequirement utility --- bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF | 1 + .../internal/{ => base}/requirements/FilteredRequirements.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/{ => base}/requirements/FilteredRequirements.java (97%) diff --git a/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF index 0a6435299..f636b3ebb 100644 --- a/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF @@ -30,4 +30,5 @@ Export-Package: org.eclipse.passage.lic.base, org.eclipse.passage.lic.internal.base.inspection.hardware;x-friends:="org.eclipse.passage.loc.licenses.core,org.eclipse.passage.lic.oshi", org.eclipse.passage.lic.internal.base.logging;x-friends:="org.eclipse.passage.lic.jetty", org.eclipse.passage.lic.internal.base.observatory;x-internal:=true, + org.eclipse.passage.lic.internal.base.requirements;x-internal:=true, org.eclipse.passage.lic.internal.base.time;x-friends:="org.eclipse.passage.lic.base.tests" diff --git a/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/requirements/FilteredRequirements.java b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/requirements/FilteredRequirements.java similarity index 97% rename from bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/requirements/FilteredRequirements.java rename to bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/requirements/FilteredRequirements.java index ba09b7e5a..d3a13a9be 100644 --- a/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/requirements/FilteredRequirements.java +++ b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/requirements/FilteredRequirements.java @@ -10,7 +10,7 @@ * Contributors: * ArSysOp - initial API and implementation *******************************************************************************/ -package org.eclipse.passage.lic.internal.requirements; +package org.eclipse.passage.lic.internal.base.requirements; import java.util.Collection; import java.util.Objects; From ccd97c316eb93291ce79f407322623bfa85f46e0 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 13:02:26 +0300 Subject: [PATCH 5/9] #1059 Prepare sourcebase for 2.3.0 release supply requirement filtering AC configuration for library scenario --- .../.settings/.api_filters | 9 ++ .../BundleRequirementsForNamespace.java | 36 +++++ .../lic/execute/NamespaceConfiguraton.java | 127 ++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java create mode 100644 bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java diff --git a/bundles/org.eclipse.passage.lic.execute/.settings/.api_filters b/bundles/org.eclipse.passage.lic.execute/.settings/.api_filters index bbec12fcb..b61d39987 100644 --- a/bundles/org.eclipse.passage.lic.execute/.settings/.api_filters +++ b/bundles/org.eclipse.passage.lic.execute/.settings/.api_filters @@ -9,4 +9,13 @@ + + + + + + + + + diff --git a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java new file mode 100644 index 000000000..cec2d87d7 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java @@ -0,0 +1,36 @@ +package org.eclipse.passage.lic.execute; + +import org.eclipse.passage.lic.api.registry.Registry; +import org.eclipse.passage.lic.api.registry.StringServiceId; +import org.eclipse.passage.lic.api.requirements.Requirement; +import org.eclipse.passage.lic.api.requirements.ResolvedRequirements; +import org.eclipse.passage.lic.api.requirements.ResolvedRequirementsRegistry; +import org.eclipse.passage.lic.base.registry.ReadOnlyRegistry; +import org.eclipse.passage.lic.equinox.requirements.BundleRequirements; +import org.eclipse.passage.lic.internal.base.requirements.FilteredRequirements; + +@SuppressWarnings("restriction") +final class BundleRequirementsForNamespace implements ResolvedRequirementsRegistry { + + private final String namespace; + private final Registry delegate; + + BundleRequirementsForNamespace(String namespace) { + this.namespace = namespace; + this.delegate = new ReadOnlyRegistry<>(// + new FilteredRequirements(// + new BundleRequirements(), // + this::declaredByAtlas// + )); + } + + @Override + public Registry get() { + return delegate; + } + + private boolean declaredByAtlas(Requirement requirement) { + return requirement.feature().identifier().startsWith(namespace); + } + +} diff --git a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java new file mode 100644 index 000000000..0ae45241a --- /dev/null +++ b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java @@ -0,0 +1,127 @@ +package org.eclipse.passage.lic.execute; + +import java.util.function.Supplier; + +import org.eclipse.passage.lic.api.AccessCycleConfiguration; +import org.eclipse.passage.lic.api.LicensedProduct; +import org.eclipse.passage.lic.api.acquire.GrantsTraceService; +import org.eclipse.passage.lic.api.acquire.LicenseAcquisitionServicesRegistry; +import org.eclipse.passage.lic.api.agreements.AgreementAcceptanceService; +import org.eclipse.passage.lic.api.conditions.evaluation.ExpressionEvaluatorsRegistry; +import org.eclipse.passage.lic.api.conditions.evaluation.ExpressionPasringRegistry; +import org.eclipse.passage.lic.api.conditions.evaluation.ExpressionTokenAssessorsRegistry; +import org.eclipse.passage.lic.api.conditions.evaluation.PermissionEmittersRegistry; +import org.eclipse.passage.lic.api.conditions.mining.ConditionTransportRegistry; +import org.eclipse.passage.lic.api.conditions.mining.MinedConditionsRegistry; +import org.eclipse.passage.lic.api.conditions.mining.MiningEquipment; +import org.eclipse.passage.lic.api.inspection.RuntimeEnvironmentRegistry; +import org.eclipse.passage.lic.api.io.HashesRegistry; +import org.eclipse.passage.lic.api.io.KeyKeeperRegistry; +import org.eclipse.passage.lic.api.io.StreamCodecRegistry; +import org.eclipse.passage.lic.api.requirements.ResolvedRequirementsRegistry; +import org.eclipse.passage.lic.api.restrictions.PermissionsExaminationServicesRegistry; +import org.osgi.framework.Bundle; + +/** + * @since 2.3 + */ +@SuppressWarnings("restriction") +public final class NamespaceConfiguraton implements AccessCycleConfiguration { + + private final AccessCycleConfiguration delegate; + private final BundleRequirementsForNamespace requirements; + + public NamespaceConfiguraton(String namespace, Supplier product, Supplier bundle) { + this(new FocusedAccessCycleConfiguration.Wide(product, bundle), new BundleRequirementsForNamespace(namespace)); + } + + public NamespaceConfiguraton(String namespace, AccessCycleConfiguration delegate) { + this(delegate, new BundleRequirementsForNamespace(namespace)); + } + + public NamespaceConfiguraton(AccessCycleConfiguration delegate, BundleRequirementsForNamespace requirements) { + this.delegate = delegate; + this.requirements = requirements; + } + + @Override + public ResolvedRequirementsRegistry requirementResolvers() { + return requirements; + } + + @Override + public MinedConditionsRegistry conditionMiners() { + return delegate.conditionMiners(); + } + + @Override + public MiningEquipment miningEquipment() { + return delegate.miningEquipment(); + } + + @Override + public StreamCodecRegistry codecs() { + return delegate.codecs(); + } + + @Override + public KeyKeeperRegistry keyKeepers() { + return delegate.keyKeepers(); + } + + @Override + public ConditionTransportRegistry transports() { + return delegate.transports(); + } + + @Override + public PermissionEmittersRegistry permissionEmitters() { + return delegate.permissionEmitters(); + } + + @Override + public ExpressionPasringRegistry expressionParsers() { + return delegate.expressionParsers(); + } + + @Override + public ExpressionEvaluatorsRegistry expressionEvaluators() { + return delegate.expressionEvaluators(); + } + + @Override + public ExpressionTokenAssessorsRegistry expressionAssessors() { + return delegate.expressionAssessors(); + } + + @Override + public RuntimeEnvironmentRegistry environments() { + return delegate.environments(); + } + + @Override + public PermissionsExaminationServicesRegistry examinators() { + return delegate.examinators(); + } + + @Override + public LicenseAcquisitionServicesRegistry acquirers() { + return delegate.acquirers(); + } + + @Override + public HashesRegistry hashes() { + return delegate.hashes(); + } + + @Override + public AgreementAcceptanceService acceptance() { + return delegate.acceptance(); + } + + @Override + public GrantsTraceService grantsTrace() { + return delegate.grantsTrace(); + } + +} From 3248101838c1a076e97787555f6a2db48db10917 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 13:03:20 +0300 Subject: [PATCH 6/9] #1059 Prepare sourcebase for 2.3.0 release supply requirement filtering AC configuration for library scenario --- .../passage/lic/execute/BundleRequirementsForNamespace.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java index cec2d87d7..f68d41dd9 100644 --- a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java +++ b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java @@ -20,7 +20,7 @@ final class BundleRequirementsForNamespace implements ResolvedRequirementsRegist this.delegate = new ReadOnlyRegistry<>(// new FilteredRequirements(// new BundleRequirements(), // - this::declaredByAtlas// + this::declaredInNamespace// )); } @@ -29,7 +29,7 @@ public Registry get() { return delegate; } - private boolean declaredByAtlas(Requirement requirement) { + private boolean declaredInNamespace(Requirement requirement) { return requirement.feature().identifier().startsWith(namespace); } From 410d6302fcf1f49e8d9b68b4a97fe091e1776011 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 14:13:41 +0300 Subject: [PATCH 7/9] #1059 Prepare sourcebase for 2.3.0 release read product credentials from Framework first --- .../passage/lic/e4/ui/addons/E4LicensingAddon.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.passage.lic.e4.ui/src/org/eclipse/passage/lic/e4/ui/addons/E4LicensingAddon.java b/bundles/org.eclipse.passage.lic.e4.ui/src/org/eclipse/passage/lic/e4/ui/addons/E4LicensingAddon.java index a6584826b..0f3a01f73 100644 --- a/bundles/org.eclipse.passage.lic.e4.ui/src/org/eclipse/passage/lic/e4/ui/addons/E4LicensingAddon.java +++ b/bundles/org.eclipse.passage.lic.e4.ui/src/org/eclipse/passage/lic/e4/ui/addons/E4LicensingAddon.java @@ -19,12 +19,15 @@ import org.eclipse.e4.ui.di.UIEventTopic; import org.eclipse.e4.ui.workbench.UIEvents; import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.passage.lic.api.Framework; +import org.eclipse.passage.lic.api.LicensedProduct; import org.eclipse.passage.lic.api.ServiceInvocationResult; import org.eclipse.passage.lic.api.access.GrantLockAttempt; import org.eclipse.passage.lic.base.diagnostic.DiagnosticExplained; import org.eclipse.passage.lic.base.restrictions.ExaminationExplained; import org.eclipse.passage.lic.equinox.EquinoxPassage; import org.eclipse.passage.lic.equinox.LicensedProductFromContext; +import org.eclipse.passage.lic.equinox.SuppliedFrameworkAware; import org.eclipse.passage.lic.internal.e4.ui.restrictions.WorkbenchShutdown; import org.eclipse.passage.lic.jface.EquinoxPassageUI; import org.eclipse.swt.widgets.Shell; @@ -52,8 +55,7 @@ public void applicationStarted(// @UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) // Event event) { ServiceInvocationResult response = // - new EquinoxPassageUI(this::shell) - .acquireLicense(new LicensedProductFromContext(application).get().identifier()); + new EquinoxPassageUI(this::shell).acquireLicense(product().identifier()); if (grantAcquired(response)) { grant = response.data(); } else { @@ -63,6 +65,11 @@ public void applicationStarted(// } } + private LicensedProduct product() { + return new SuppliedFrameworkAware().withFramework(Framework::product)// + .orElseGet(new LicensedProductFromContext(application)); + } + @Inject @Optional public void applicationFainted(// From c00b2c4af923bf003708f22c541b4d344afe0e39 Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 14:17:18 +0300 Subject: [PATCH 8/9] #1059 Prepare sourcebase for 2.3.0 release license headers for new files --- .../lic/execute/BundleRequirementsForNamespace.java | 12 ++++++++++++ .../passage/lic/execute/NamespaceConfiguraton.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java index f68d41dd9..5ecdf71de 100644 --- a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java +++ b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/BundleRequirementsForNamespace.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2022 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.execute; import org.eclipse.passage.lic.api.registry.Registry; diff --git a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java index 0ae45241a..929d611f4 100644 --- a/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java +++ b/bundles/org.eclipse.passage.lic.execute/src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2022 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.execute; import java.util.function.Supplier; From 11c08777ffc11206784e314919b4590077f8595e Mon Sep 17 00:00:00 2001 From: Elena Parovyshnaia Date: Tue, 8 Mar 2022 15:37:04 +0300 Subject: [PATCH 9/9] #1059 Prepare sourcebase for 2.3.0 release increment bundle version --- bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF index 9e86d0fc5..5a4210fc5 100644 --- a/bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.passage.lic.e4.ui Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.passage.lic.e4.ui -Bundle-Version: 2.1.0.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-Copyright: %Bundle-Copyright Bundle-RequiredExecutionEnvironment: JavaSE-1.8