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

[#1372] Delete marker interface Gear #1373

Merged
merged 1 commit into from
May 23, 2024
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
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,21 +9,21 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.lbc.internal.base.api;

import java.nio.file.Path;
import java.util.function.Supplier;

import org.eclipse.passage.lic.api.Gear;
import org.eclipse.passage.lic.api.LicensedProduct;
import org.eclipse.passage.lic.api.conditions.mining.ConditionTransport;
import org.eclipse.passage.lic.api.conditions.mining.ContentType;
import org.eclipse.passage.lic.api.io.HashesRegistry;
import org.eclipse.passage.lic.api.io.KeyKeeper;
import org.eclipse.passage.lic.api.io.StreamCodec;

public interface FlsGear extends Gear {
public interface FlsGear {

HashesRegistry hashes();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,17 +9,12 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.lbc.internal.base.api;

import org.eclipse.passage.lic.api.GearSupplier;
import java.util.function.Supplier;

/**
* @since 1.1
*/
public interface FlsGearSupplier extends GearSupplier<FlsGear> {

@Override
FlsGear gear();
public interface FlsGearSupplier extends Supplier<FlsGear> {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.lbc.internal.fls.gear;

Expand All @@ -21,7 +22,7 @@
public final class PassageFlsGearAvailable implements FlsGearSupplier {

@Override
public FlsGear gear() {
public FlsGear get() {
return PassageFlsGear.gear;
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,15 +9,15 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.lic.equinox;

import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import java.util.function.Supplier;

import org.eclipse.passage.lic.api.Gear;
import org.eclipse.passage.lic.api.GearSupplier;
import org.eclipse.passage.lic.api.LicensingException;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
Expand All @@ -29,7 +29,7 @@
/**
* @since 2.1
*/
public abstract class GearAware<G extends Gear, S extends GearSupplier<G>> {
public abstract class GearAware<G, S extends Supplier<G>> {

private final Logger log = LoggerFactory.getLogger(getClass());

Expand All @@ -48,7 +48,7 @@ public final <T> Optional<T> withGear(Unsafe<G, T> with) throws LicensingExcepti
}
ServiceReference<S> any = references.iterator().next();
try {
return with.apply(context.getService(any).gear());
return with.apply(context.getService(any).get());
} catch (Exception e) {
throw new LicensingException("Error on service invocation", e); //$NON-NLS-1$
} finally {
Expand All @@ -59,7 +59,7 @@ public final <T> Optional<T> withGear(Unsafe<G, T> with) throws LicensingExcepti
protected abstract Class<S> supplier();

@FunctionalInterface
public interface Unsafe<G extends Gear, T> {
public interface Unsafe<G, T> {

Optional<T> apply(G gear) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@

import java.util.Optional;

import org.eclipse.passage.lic.api.Gear;
import org.eclipse.passage.lic.api.LicensedProduct;
import org.eclipse.passage.lic.api.inspection.RuntimeEnvironmentRegistry;
import org.eclipse.passage.lic.api.io.HashesRegistry;
import org.eclipse.passage.lic.api.io.StreamCodec;
import org.eclipse.passage.loc.internal.api.workspace.OperatorWorkspace;

public interface OperatorGear extends Gear {
public interface OperatorGear {

Optional<StreamCodec> codec(LicensedProduct product);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,11 +9,12 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.internal.api;

import org.eclipse.passage.lic.api.GearSupplier;
import java.util.function.Supplier;

public interface OperatorGearSupplier extends GearSupplier<OperatorGear> {
public interface OperatorGearSupplier extends Supplier<OperatorGear> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected void activate(Map<String, Object> properties) {
try {
gear.stream()//
.findFirst()//
.map(OperatorGearSupplier::gear)//
.map(OperatorGearSupplier::get)//
.map(OperatorGear::workspace)//
.ifPresent(this::load);
} catch (Exception e) {
Expand Down Expand Up @@ -114,7 +114,7 @@ protected void deactivate(@SuppressWarnings("unused") Map<String, Object> proper
try {
gear.stream()//
.findFirst()//
.map(OperatorGearSupplier::gear)//
.map(OperatorGearSupplier::get)//
.map(OperatorGear::workspace)//
.ifPresent(this::store);
} catch (Exception e) {
Expand All @@ -133,7 +133,7 @@ private void store(OperatorWorkspace workspace) {
@Override
public EditingDomain getEditingDomain() {
if (editingDomain.isEmpty()) {
editingDomain = gear.map(OperatorGearSupplier::gear)//
editingDomain = gear.map(OperatorGearSupplier::get)//
.map(OperatorGear::editingDomainSource)//
.map(EditingDomainSource::create);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 ArSysOp
* Copyright (c) 2021, 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
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.operator.internal.gear;

Expand All @@ -20,7 +21,7 @@
public final class OperatorGearAvailable implements OperatorGearSupplier {

@Override
public OperatorGear gear() {
public OperatorGear get() {
return DefaultGear.gear;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 ArSysOp
* Copyright (c) 2019, 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
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.products.emfforms.renderers;

Expand Down Expand Up @@ -42,7 +43,7 @@ public ProductVersionKeyRenderer(VControl vElement, ViewModelContext viewContext
VTViewTemplateProvider vtViewTemplateProvider, OperatorGearSupplier gear) {
super(vElement, viewContext, reportService, emfFormsDatabinding, emfFormsLabelProvider, vtViewTemplateProvider,
ProductVersion.class);
this.workspace = gear.gear().workspace();
this.workspace = gear.get().workspace();
}

@Override
Expand Down
Loading