Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 571254 - [Passage][LA] agent state #664

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
import org.eclipse.passage.lic.internal.equinox.requirements.ComponentRequirements;
import org.eclipse.passage.lic.internal.json.JsonConditionTransport;
import org.eclipse.passage.lic.internal.licenses.migration.tobemoved.UserFilteringConditionTransport;
import org.eclipse.passage.lic.internal.net.api.handle.NetRequest;
import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest;
import org.eclipse.passage.lic.internal.oshi.HardwareAssessmentService;
import org.eclipse.passage.lic.internal.oshi.HardwareEnvironment;

Expand All @@ -82,7 +84,7 @@ public final class RuntimeConfiguration implements AccessCycleConfiguration {
private final Registry<EvaluationType, RuntimeEnvironment> environments;
private final Registry<StringServiceId, PermissionsExaminationService> examinators;

public RuntimeConfiguration(Supplier<Path> source, Supplier<String> user, Supplier<LicensedProduct> product) {
public RuntimeConfiguration(Supplier<Path> source, ProductUserRequest<? extends NetRequest> request) {
requirements = new ReadOnlyRegistry<>(Arrays.asList(//
new BundleRequirements(), //
new ComponentRequirements() //
Expand All @@ -95,10 +97,10 @@ public RuntimeConfiguration(Supplier<Path> source, Supplier<String> user, Suppli
);
transports = new ReadOnlyRegistry<>(Arrays.asList(//
new JsonConditionTransport(), //
new UserFilteringConditionTransport(user) //
new UserFilteringConditionTransport(() -> request.user().get()) //
));
codecs = new ReadOnlyRegistry<>(new BcStreamCodec(product));
keys = new ReadOnlyRegistry<>(new PathKeyKeeper(product.get(), source));
codecs = new ReadOnlyRegistry<>(new BcStreamCodec(() -> request.product().get()));
keys = new ReadOnlyRegistry<>(new PathKeyKeeper(request.product().get(), source));
emitters = new ReadOnlyRegistry<>(Arrays.asList(//
new BasePermissionEmittingService(//
expressionParsers(), //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,32 @@
*******************************************************************************/
package org.eclipse.passage.lac.internal.gear;

import java.util.function.Supplier;

import org.eclipse.passage.lic.internal.api.AccessCycleConfiguration;
import org.eclipse.passage.lic.internal.api.Framework;
import org.eclipse.passage.lic.internal.api.LicensedProduct;
import org.eclipse.passage.lic.internal.api.conditions.mining.LicenseReadingService;
import org.eclipse.passage.lic.internal.api.io.UnemployedCodecs;
import org.eclipse.passage.lic.internal.base.io.UserHomePath;
import org.eclipse.passage.lic.internal.net.api.handle.NetRequest;
import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest;

@SuppressWarnings("restriction")
final class RuntimeFramework implements Framework {

private final Supplier<String> user;
private final Supplier<LicensedProduct> product;

public RuntimeFramework(ProductUserRequest<?> request) {
this(request.user()::get, request.product()::get);
}
private final ProductUserRequest<? extends NetRequest> request;

public RuntimeFramework(Supplier<String> user, Supplier<LicensedProduct> product) {
this.user = user;
this.product = product;
public RuntimeFramework(ProductUserRequest<? extends NetRequest> request) {
this.request = request;
}

@Override
public LicensedProduct product() {
return product.get();
return request.product().get();
}

@Override
public AccessCycleConfiguration accessCycleConfiguration() {
return new RuntimeConfiguration(new UserHomePath(), user, product);
return new RuntimeConfiguration(new UserHomePath(), request);
}

@Override
Expand Down
15 changes: 15 additions & 0 deletions bundles/org.eclipse.passage.lac/.settings/.api_filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,19 @@
</message_arguments>
</filter>
</resource>
<resource path="src/org/eclipse/passage/internal/lac/base/CannotUseFeature.java" type="org.eclipse.passage.internal.lac.base.CannotUseFeature">
<filter id="576720909">
<message_arguments>
<message_argument value="Failure"/>
<message_argument value="CannotUseFeature"/>
</message_arguments>
</filter>
<filter id="643850349">
<message_arguments>
<message_argument value="LicensedProduct"/>
<message_argument value="CannotUseFeature"/>
<message_argument value="CannotUseFeature(String, LicensedProduct, String)"/>
</message_arguments>
</filter>
</resource>
</component>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 ArSysOp
* Copyright (c) 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 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.internal.lac.base.access;

import java.io.InputStream;

import org.eclipse.passage.lic.internal.api.LicensedProduct;
import org.eclipse.passage.lic.internal.api.LicensingException;
import org.eclipse.passage.lic.internal.api.io.KeyKeeper;
import org.eclipse.passage.lic.internal.net.api.handle.NetRequest;
import org.eclipse.passage.lic.internal.net.handle.ProductUserRequest;

final class RequestKeyKeeper<R extends NetRequest> implements KeyKeeper {

// TODO: stated request
private final ProductUserRequest<R> request;

public RequestKeyKeeper(ProductUserRequest<R> request) {
this.request = request;
}

@Override
public LicensedProduct id() {
return request.product().get();
}

@Override
public InputStream productPublicKey() throws LicensingException {
// TODO: read from request.content or state, if already sent
return null;
}

}
3 changes: 2 additions & 1 deletion bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ Export-Package: org.eclipse.passage.lic.internal.api;
org.eclipse.passage.seal.demo,
org.eclipse.passage.lic.bc,
org.eclipse.passage.lic.equinox,
org.eclipse.passage.loc.products.core",
org.eclipse.passage.loc.products.core,
org.eclipse.passage.lac",
org.eclipse.passage.lic.internal.api.observatory;x-friends:="org.eclipse.passage.lic.base",
org.eclipse.passage.lic.internal.api.registry;
x-friends:="org.eclipse.passage.lic.base,
Expand Down