Skip to content

Commit

Permalink
Merge pull request #687 from eclipse-passage/572353
Browse files Browse the repository at this point in the history
572353
  • Loading branch information
eparovyshnaya authored Mar 27, 2021
2 parents 47d4120 + 1cf1ebc commit 2b86b17
Show file tree
Hide file tree
Showing 18 changed files with 148 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bundles/org.eclipse.passage.lbc.seal/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Require-Bundle: org.eclipse.osgi.services;bundle-version="3.8.0",
org.eclipse.passage.lic.licenses.migration;bundle-version="0.5.200",
org.eclipse.passage.lic.oshi;bundle-version="1.0.0"
Service-Component: OSGI-INF/*.xml
Provide-Capability: licensing.feature;licensing.feature="org.eclipse.passage.lbc.server.product";name="Eclipse Passage Floating License Server";version="1.2.1";provider="Eclispe Passage";level="warn"
Provide-Capability: licensing.feature;licensing.feature="org.eclipse.passage.lbc.fls.product";name="Eclipse Passage Floating License Server";version="1.2.1";provider="Eclispe Passage";level="warn"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: BCPG v1.65

mI0EYF79IAEEAJMe6WuKwLbjzTpFaHNuMQy+J0RPjh/2c7HJ0r01SDlmj9jhuiW0
lXZHyzLQrAMOnX6g7ygPq9gksKpXwmwyNFttX2b25+Tn1XjeO0tP4VItP7kyAOLC
hVeemcL3ZRMxqpn50tAwNX82Xz8db31JN3kvm3OrLA7G4yN+jb4aB2NpABEBAAG0
I29yZy5lY2xpcHNlLnBhc3NhZ2UubGJjLmZscy5wcm9kdWN0iKIEEwECAAwFAmBe
/SAFCQAAA+gACgkQYYOi/upUrjP8uwP/UdSbdTGoOX/1tpnqFr4I061T5bfCK0Zo
1hb6OejFmUzvstGftqL4cAPoYs8In4/Exts5Afjd18/Fd20hdQLJeocbU1l6/rw7
RIxkrBIE+rI7tGogbTmbzIU9ZNdPUBV+pNoLjOgKOhyTUVNUXU/8ZYC9HkKHTTIL
hn2oMrhSOTq4jQRgXv0gAQQAkx7pa4rAtuPNOkVoc24xDL4nRE+OH/ZzscnSvTVI
OWaP2OG6JbSVdkfLMtCsAw6dfqDvKA+r2CSwqlfCbDI0W21fZvbn5OfVeN47S0/h
Ui0/uTIA4sKFV56ZwvdlEzGqmfnS0DA1fzZfPx1vfUk3eS+bc6ssDsbjI36NvhoH
Y2kAEQEAAYiiBBgBAgAMBQJgXv0gBQkAAAPoAAoJEGGDov7qVK4zMwID/jeApDO6
lYVnQxQCWFsukHw6G+koq8xDkMgos9Uyv93km7h0zdIvW6XB7Q852iiIIpaDwXp1
AdtgNNYLv3SZQ9WWRONfHj+s61VX3TZjRzfGPWCB+cWQnaZcYlsnUKUl98DmyCUh
oWwJ7N39l69F2YztzgoR5Z5kmNF/TMb7TE6x
=AGPH
-----END PGP PUBLIC KEY BLOCK-----
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.passage.lbc.server
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.passage.lbc.server;singleton:=true
Bundle-Version: 0.5.101.qualifier
Bundle-Version: 1.2.1.qualifier
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Copyright: %Bundle-Copyright
Expand Down
6 changes: 3 additions & 3 deletions bundles/org.eclipse.passage.lbc.server/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension
id="org.eclipse.passage.lbc.server.application"
id="org.eclipse.passage.lbc.fls.application"
point="org.eclipse.core.runtime.applications">
<application
cardinality="1"
Expand All @@ -23,10 +23,10 @@
</application>
</extension>
<extension
id="product"
id="org.eclipse.passage.lbc.fls.product"
point="org.eclipse.core.runtime.products">
<product
application="org.eclipse.passage.lbc.server.application"
application="org.eclipse.passage.lbc.fls.application"
name="%product.name">
<property
name="appName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.Objects;
import java.util.function.Supplier;

Expand All @@ -27,6 +28,8 @@
import org.eclipse.passage.lic.internal.api.conditions.mining.MiningEquipment;
import org.eclipse.passage.lic.internal.api.diagnostic.Trouble;
import org.eclipse.passage.lic.internal.base.BaseServiceInvocationResult;
import org.eclipse.passage.lic.internal.base.diagnostic.BaseDiagnostic;
import org.eclipse.passage.lic.internal.base.diagnostic.code.NoLicenses;
import org.eclipse.passage.lic.internal.base.diagnostic.code.ServiceFailedOnInfrastructureDenial;
import org.eclipse.passage.lic.internal.base.i18n.ConditionMiningMessages;
import org.eclipse.passage.lic.internal.base.io.FileCollection;
Expand Down Expand Up @@ -67,7 +70,11 @@ public final ConditionMiningTarget id() {
@Override
public final ServiceInvocationResult<Collection<ConditionPack>> all(LicensedProduct product) {
try {
return equipment.tool(product, id).mine(licenses(product));
Collection<Path> licenses = licenses(product);
if (licenses.isEmpty()) {
return noLicenses(product);
}
return equipment.tool(product, id).mine(licenses);
} catch (LicensingException e) {
return new BaseServiceInvocationResult<Collection<ConditionPack>>( //
new Trouble(//
Expand All @@ -77,6 +84,17 @@ public final ServiceInvocationResult<Collection<ConditionPack>> all(LicensedProd
}
}

private ServiceInvocationResult<Collection<ConditionPack>> noLicenses(LicensedProduct product) {
return new BaseServiceInvocationResult<Collection<ConditionPack>>(//
new BaseDiagnostic(//
Collections.emptyList(), //
Collections.singletonList(//
new Trouble(new NoLicenses(), base(product).get().toAbsolutePath().toString()))//
), //
Collections.emptyList()//
);
}

private Collection<Path> licenses(LicensedProduct product) throws LicensingException {
return new FileCollection(base(product), scope).get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
import org.eclipse.passage.lic.internal.api.conditions.ConditionMiningTarget;
import org.eclipse.passage.lic.internal.api.conditions.ConditionPack;
import org.eclipse.passage.lic.internal.api.conditions.mining.ConditionTransport;
import org.eclipse.passage.lic.internal.api.diagnostic.Diagnostic;
import org.eclipse.passage.lic.internal.api.diagnostic.Trouble;
import org.eclipse.passage.lic.internal.api.io.KeyKeeper;
import org.eclipse.passage.lic.internal.api.io.StreamCodec;
import org.eclipse.passage.lic.internal.base.BaseServiceInvocationResult;
import org.eclipse.passage.lic.internal.base.SumOfCollections;
import org.eclipse.passage.lic.internal.base.conditions.BaseConditionOrigin;
import org.eclipse.passage.lic.internal.base.conditions.BaseConditionPack;
import org.eclipse.passage.lic.internal.base.diagnostic.BaseDiagnostic;
import org.eclipse.passage.lic.internal.base.diagnostic.code.NoRelevantConditions;
import org.eclipse.passage.lic.internal.base.diagnostic.code.ServiceFailedOnMorsel;
import org.eclipse.passage.lic.internal.base.i18n.BaseMessages;

Expand All @@ -51,10 +54,14 @@ public ServiceInvocationResult<Collection<ConditionPack>> mine(Collection<Path>

private ServiceInvocationResult<Collection<ConditionPack>> mine(Path source) {
try {
return new BaseServiceInvocationResult<>(Collections.singleton(//
new BaseConditionPack(//
new BaseConditionOrigin(miner, source(source)), //
from(decoded(source)))));
Collection<Condition> conditions = from(decoded(source));
return new BaseServiceInvocationResult<>(//
diagnostic(conditions, source), //
Collections.singleton(//
new BaseConditionPack(//
new BaseConditionOrigin(miner, source(source)), //
conditions)//
));
} catch (IOException | LicensingException e) {
return new BaseServiceInvocationResult<>(//
new Trouble(//
Expand All @@ -71,4 +78,15 @@ private Collection<Condition> from(byte[] decoded) throws IOException {
}
}

private Diagnostic diagnostic(Collection<Condition> conditions, Path source) {
if (conditions.isEmpty()) {
return new BaseDiagnostic(//
Collections.emptyList(), //
Collections.singletonList(//
new Trouble(new NoRelevantConditions(), source.toAbsolutePath().toString()))//
);
}
return new BaseDiagnostic();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 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.base.diagnostic.code;

import org.eclipse.passage.lic.internal.api.diagnostic.TroubleCode;
import org.eclipse.passage.lic.internal.base.i18n.DiagnosticCodeMessages;

public final class NoLicenses extends TroubleCode {

public NoLicenses() {
super(410, DiagnosticCodeMessages.getString("NoLicenses.explanation")); //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2020 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.base.diagnostic.code;

import org.eclipse.passage.lic.internal.api.diagnostic.TroubleCode;
import org.eclipse.passage.lic.internal.base.i18n.DiagnosticCodeMessages;

public final class NoRelevantConditions extends TroubleCode {

public NoRelevantConditions() {
super(409, DiagnosticCodeMessages.getString("NoRelevantConditions.explanation")); //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
* conditions found for it), but has not-critical restriction level (for
* instance @{code info}, {@code warning}) and thus can be used without
* license.</li>
* <li>409 - a license source does not provide relevant conditions (info)</li>
* <li>410 - no licenses found in a source directory (info)</li>
* </ul>
* </li>
* <li>5xx - reserved</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ServiceCannotOperate.explanation=Access cycle service cannot operate
NoServices.explanation=No services of type [%s] available
NoRequirements.explanation=No licensing requirements registered
NoFramework.explanation=Passage gains no Framework instance and is completely inoperable. It means either severe lack of configuration or sabotage.
NoRelevantConditions.explanation=License does not supply a relevant condition
NoLicenses.explanation=There are no licenses found under the given source dir
SeveralFrameworks.explanation=Passage finds %s Framework implementations, which means either severe configuration errors or sabotage.
ServiceFailedOnMorsel.explanation=Service failed to evaluate a morsel
ServiceFailedOnInfrastructureDenial.explanation=Service failed severely due to an invoked service denial.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.passage.loc.workbench.emfforms
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.passage.loc.workbench.emfforms;singleton:=true
Bundle-Version: 1.0.200.qualifier
Bundle-Version: 1.0.201.qualifier
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Import-Package: javax.inject,
Expand All @@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.osgi.services;bundle-version="0.0.0",
org.eclipse.e4.ui.model.workbench;bundle-version="0.0.0",
org.eclipse.e4.ui.services;bundle-version="0.0.0",
org.eclipse.emf.ecp.edit.swt;bundle-version="0.0.0",
org.eclipse.emf.ecp.view.model.provider.generator;bundle-version="0.0.0",
org.eclipse.emf.ecp.view.template.model;bundle-version="0.0.0",
org.eclipse.emf.ecp.view.core.swt;bundle-version="0.0.0",
org.eclipse.emf.ecp.view.validation;bundle-version="0.0.0",
Expand All @@ -29,8 +30,8 @@ Require-Bundle: org.eclipse.osgi.services;bundle-version="0.0.0",
org.eclipse.passage.lic.api;bundle-version="1.0.0",
org.eclipse.passage.lic.base;bundle-version="0.0.0",
org.eclipse.passage.lic.emf;bundle-version="0.0.0",
org.eclipse.passage.loc.workbench;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.passage.loc.api;bundle-version="1.0.102"
org.eclipse.passage.loc.api;bundle-version="1.0.102",
org.eclipse.passage.loc.workbench;bundle-version="1.0.0";visibility:=reexport
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.passage.loc.internal.workbench.emfforms;x-internal:=true,
org.eclipse.passage.loc.internal.workbench.emfforms.i18n;x-internal:=true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.passage.lbc.server.product</name>
<name>org.eclipse.passage.lbc.fls.product</name>
<comment></comment>
<projects>
</projects>
Expand Down
20 changes: 20 additions & 0 deletions products/org.eclipse.passage.lbc.fls.product/common-license.licen
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN PGP MESSAGE-----
Version: BCPG v1.65

owJ4nJWTS2gTURSGU20tBmO7KIjQxTB2ZZnJvNImQ2K1pq0RLdoXoli9mXsnuTqP
dO5M0q4UdFFqFRd2JxZcKCi6saiLujBdtS5FcSeCCNWFoQgK4uNOmtZULLYws5n7
/f/555x7roe2BoI14NLtnx8HHso1L4rFdD3OWLaD4NnhH33xjlHTYPLIIdi2EqzI
CyyDLM2G2Mok2AP9B1MptmNfKBi3nQyPNAPnCOJzgBCQQbyBNfUI1pBF0DGgnWdG
TayuWkm+FTW3iEq/J9is6+bUcLhQKPC2meGpX/jE0dQKso79GtnKuS+tMGHK+K8f
gYRper8ohshysY6Rk2DbFEVUojrk5Jgic4qgaFw6DSGXliMxTZQiYlSMUgUhHkoC
F9HYgiRygsxJ7QOipMoxVRb4iCK3CrJArT2CnFSV/Tk7a/HQRvuBZiJes81lpNsz
jF5gUrvDFGCSNmIZB414iLjVaknXYxEZtnExpEBOEUGEA1BLc2JUklBER0CKtrNM
zgBWtepfrdIN4lc3beuMyEu8SFWODT3N/Z/QSGtlcQVf1Q39uRG+Hb0BDBOvNLrH
AZZLNt3mPbR/9J9cz0GbTmUCV8v+lYnJAwPDbsc210xNENTywwuCUJlaGRykFY0y
Ka1ParYFsUuLDIzl6PSywIEF4KCqg67RnIPIcg6b8DowsTGW2MuG/SUJb2BLKDf+
vDZQEwy01m3xV7CleQMtCAS3N64s8fC12sD4SMPrl53c2w/zcvzZ/F3S1HWojsl+
vjr4im1JPPpWzPc0Tj4J7eqLBecm428WJvItizcuXmhwi7+efhos9V+ZGZ57sBSa
wdxppbcTX/6+8GVx+j5z6/iOppvvty0tlh5PzfYFJnYW5959nS/t7r5jnEqW7iVn
p5vN+ikPnoz+BucxgsI=
=0fSN
-----END PGP MESSAGE-----
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Contributors:
ArSysOp - initial API and implementation
-->
<product name="Passage Licensing Data Server" uid="org.eclipse.passage.lbc.server.product" id="org.eclipse.passage.lbc.server.product" application="org.eclipse.passage.lbc.server.application" version="1.2.1.qualifier" useFeatures="true" includeLaunchers="true">
<product name="Passage Licensing Floating License Server" uid="org.eclipse.passage.lbc.fls.product" id="org.eclipse.passage.lbc.fls.product" application="org.eclipse.passage.lbc.fls.application" version="1.2.1.qualifier" useFeatures="true" includeLaunchers="true">

<configIni use="default">
</configIni>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<artifactId>org.eclipse.passage.lbc.server.product</artifactId>
<artifactId>org.eclipse.passage.lbc.fls.product</artifactId>
<packaging>eclipse-repository</packaging>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion releng/org.eclipse.passage.lbc.aggregator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<module>../../features/org.eclipse.passage.lbc.execute.feature</module>
<module>../../features/org.eclipse.passage.lbc.seal.feature</module>
<module>../../releng/org.eclipse.passage.lbc.repository</module>
<module>../../products/org.eclipse.passage.lbc.server.product</module>
<module>../../products/org.eclipse.passage.lbc.fls.product</module>
</modules>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;

import org.eclipse.emf.common.util.EList;
import org.eclipse.passage.lbc.internal.base.api.RawRequest;
import org.eclipse.passage.lbc.internal.base.mine.Conditions;
import org.eclipse.passage.lic.internal.api.LicensingException;
import org.eclipse.passage.lic.internal.base.ProductIdentifier;
Expand Down Expand Up @@ -59,8 +60,8 @@ private List<LicenseGrant> mineForUserAndProduct(String user, String product, in
return grants;
}

private ProductUserRequest request(String user, String product) throws LicensingException {
return new ProductUserRequest(//
private ProductUserRequest<RawRequest> request(String user, String product) throws LicensingException {
return new ProductUserRequest<>(//
new RequestConstructed()//
.withParameters(Arrays.asList(//
new ProductIdentifier(product), new ProductVersion("0.2.1"), //$NON-NLS-1$
Expand Down

0 comments on commit 2b86b17

Please sign in to comment.