Skip to content

Commit

Permalink
Merge pull request #1060 from eclipse-passage/1059
Browse files Browse the repository at this point in the history
1059 prepare sourcebase for 2.3.0 release
  • Loading branch information
eparovyshnaya authored Mar 8, 2022
2 parents a13acc8 + 11c0877 commit 9b9fcaa
Show file tree
Hide file tree
Showing 10 changed files with 224 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,15 @@ public interface Library extends PassageLicenseCoverage {
ServiceInvocationResult<ExaminationCertificate> assess();

/**
* <p>
* 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.
* </p>
* <p>
* If the {@code agreement} does not belong to the library, report empty result
* with bearable diagnostic of {@linkplain ForeignLicense} trouble code.
* </p>
*/
ServiceInvocationResult<AgreementAcceptanceService> agreementsService(AgreementToAccept agreement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.passage.lic.e4.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,8 +55,7 @@ public void applicationStarted(//
@UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) //
Event event) {
ServiceInvocationResult<GrantLockAttempt> 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 {
Expand All @@ -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(//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/passage/lic/execute/NamespaceConfiguraton.java" type="org.eclipse.passage.lic.execute.NamespaceConfiguraton">
<filter id="643842064">
<message_arguments>
<message_argument value="AgreementAcceptanceService"/>
<message_argument value="NamespaceConfiguraton"/>
<message_argument value="acceptance()"/>
</message_arguments>
</filter>
</resource>
</component>
16 changes: 8 additions & 8 deletions bundles/org.eclipse.passage.lic.execute/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* 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;
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<StringServiceId, ResolvedRequirements> delegate;

BundleRequirementsForNamespace(String namespace) {
this.namespace = namespace;
this.delegate = new ReadOnlyRegistry<>(//
new FilteredRequirements(//
new BundleRequirements(), //
this::declaredInNamespace//
));
}

@Override
public Registry<StringServiceId, ResolvedRequirements> get() {
return delegate;
}

private boolean declaredInNamespace(Requirement requirement) {
return requirement.feature().identifier().startsWith(namespace);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*******************************************************************************
* 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;

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<LicensedProduct> product, Supplier<Bundle> 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();
}

}

0 comments on commit 9b9fcaa

Please sign in to comment.