From 1144a9fbe9641c1c0283cf132381c195040d59bb Mon Sep 17 00:00:00 2001 From: eparovyshnaya Date: Thu, 12 Nov 2020 14:36:45 +0300 Subject: [PATCH] Bug 568632 Implement feature grant acquire/release Spread not-emf GrantAcquisition interface to be used in access cycle. Signed-off-by: eparovyshnaya --- .../META-INF/MANIFEST.MF | 2 +- .../internal/api/acquire/GrantAcqisition.java | 28 ++++++++ .../META-INF/MANIFEST.MF | 1 + .../base/acquire/BaseGrantAcquisition.java | 66 +++++++++++++++++++ .../META-INF/MANIFEST.MF | 10 +-- .../model/convert/PGrantAcquisition.java | 40 +++++++++++ 6 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/internal/api/acquire/GrantAcqisition.java create mode 100644 bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/acquire/BaseGrantAcquisition.java create mode 100644 bundles/org.eclipse.passage.lic.floating.model/src/org/eclipse/passage/lic/floating/model/convert/PGrantAcquisition.java diff --git a/bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF index 7d435db3c..2beea49d3 100644 --- a/bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.api/META-INF/MANIFEST.MF @@ -27,7 +27,7 @@ Export-Package: org.eclipse.passage.lic.internal.api; org.eclipse.passage.lbc.base.tests, org.eclipse.passage.loc.licenses.core, org.eclipse.passage.lic.net", - org.eclipse.passage.lic.internal.api.acquire;x-friends:="org.eclipse.passage.lic.hc", + org.eclipse.passage.lic.internal.api.acquire;x-friends:="org.eclipse.passage.lic.hc,org.eclipse.passage.lic.floating.model,org.eclipse.passage.lic.base", org.eclipse.passage.lic.internal.api.conditions; x-friends:="org.eclipse.passage.lbc.api, org.eclipse.passage.lbc.base, diff --git a/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/internal/api/acquire/GrantAcqisition.java b/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/internal/api/acquire/GrantAcqisition.java new file mode 100644 index 000000000..5834eb97f --- /dev/null +++ b/bundles/org.eclipse.passage.lic.api/src/org/eclipse/passage/lic/internal/api/acquire/GrantAcqisition.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.api.acquire; + +import java.util.Date; + +public interface GrantAcqisition { + + String identifier(); + + String grant(); + + String feature(); + + String user(); + + Date created(); +} 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 6693d9f79..c39127293 100644 --- a/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.base/META-INF/MANIFEST.MF @@ -17,6 +17,7 @@ Export-Package: org.eclipse.passage.lic.internal.base; org.eclipse.passage.loc.licenses.core, org.eclipse.passage.lic.net", org.eclipse.passage.lic.internal.base.access;x-internal:=true, + org.eclipse.passage.lic.internal.base.acquire;x-friends:="org.eclipse.passage.lic.floating.model", org.eclipse.passage.lic.internal.base.conditions; x-friends:="org.eclipse.passage.lbc.base, org.eclipse.passage.lic.json, diff --git a/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/acquire/BaseGrantAcquisition.java b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/acquire/BaseGrantAcquisition.java new file mode 100644 index 000000000..b069d8cce --- /dev/null +++ b/bundles/org.eclipse.passage.lic.base/src/org/eclipse/passage/lic/internal/base/acquire/BaseGrantAcquisition.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * 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.acquire; + +import java.util.Date; +import java.util.Objects; + +import org.eclipse.passage.lic.internal.api.acquire.GrantAcqisition; + +public final class BaseGrantAcquisition implements GrantAcqisition { + + private final String id; + private final String grant; + private final String feature; + private final String user; + private final Date created; + + public BaseGrantAcquisition(String id, String grant, String feature, String user, Date created) { + Objects.requireNonNull(id, "BaseGrantAcquisition::id"); //$NON-NLS-1$ + Objects.requireNonNull(grant, "BaseGrantAcquisition::grant"); //$NON-NLS-1$ + Objects.requireNonNull(feature, "BaseGrantAcquisition::feature"); //$NON-NLS-1$ + Objects.requireNonNull(user, "BaseGrantAcquisition::user"); //$NON-NLS-1$ + Objects.requireNonNull(created, "BaseGrantAcquisition::created"); //$NON-NLS-1$ + this.id = id; + this.grant = grant; + this.feature = feature; + this.user = user; + this.created = created; + } + + @Override + public String identifier() { + return id; + } + + @Override + public String grant() { + return grant; + } + + @Override + public String feature() { + return feature; + } + + @Override + public String user() { + return user; + } + + @Override + public Date created() { + return created; + } + +} diff --git a/bundles/org.eclipse.passage.lic.floating.model/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.lic.floating.model/META-INF/MANIFEST.MF index 6ac316929..5f0b1eba2 100644 --- a/bundles/org.eclipse.passage.lic.floating.model/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.lic.floating.model/META-INF/MANIFEST.MF @@ -8,10 +8,12 @@ Bundle-Vendor: %providerName Bundle-Copyright: %Bundle-Copyright Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";x-installation:=greedy;resolution:=optional, +Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0";resolution:=optional;x-installation:=greedy, org.eclipse.emf.ecore;bundle-version="0.0.0";visibility:=reexport, org.eclipse.passage.lic.emf.meta;bundle-version="0.6.0", - org.eclipse.passage.lic.floating;bundle-version="0.0.0";visibility:=reexport + org.eclipse.passage.lic.floating;bundle-version="0.0.0";visibility:=reexport, + org.eclipse.passage.lic.api;bundle-version="1.0.100", + org.eclipse.passage.lic.base;bundle-version="1.0.100" Export-Package: org.eclipse.passage.lic.floating.model.api; x-friends:="org.eclipse.passage.lic.floating.edit, org.eclipse.passage.loc.dashboard.ui, @@ -19,6 +21,7 @@ Export-Package: org.eclipse.passage.lic.floating.model.api; org.eclipse.passage.loc.licenses.core, org.eclipse.passage.lic.hc, org.eclipse.passage.lic.net", + org.eclipse.passage.lic.floating.model.convert;x-friends:="org.eclipse.passage.lic.hc", org.eclipse.passage.lic.floating.model.impl;x-internal:=true, org.eclipse.passage.lic.floating.model.meta; x-friends:="org.eclipse.passage.lic.floating.e4.ui, @@ -26,7 +29,6 @@ Export-Package: org.eclipse.passage.lic.floating.model.api; org.eclipse.passage.loc.licenses.core, org.eclipse.passage.loc.floating.emfforms, org.eclipse.passage.loc.dashboard.ui", - org.eclipse.passage.lic.floating.model.util; - x-friends:="org.eclipse.passage.lic.floating.edit" + org.eclipse.passage.lic.floating.model.util;x-friends:="org.eclipse.passage.lic.floating.edit" Bundle-ClassPath: . Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.passage.lic.floating.model/src/org/eclipse/passage/lic/floating/model/convert/PGrantAcquisition.java b/bundles/org.eclipse.passage.lic.floating.model/src/org/eclipse/passage/lic/floating/model/convert/PGrantAcquisition.java new file mode 100644 index 000000000..500239636 --- /dev/null +++ b/bundles/org.eclipse.passage.lic.floating.model/src/org/eclipse/passage/lic/floating/model/convert/PGrantAcquisition.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.floating.model.convert; + +import java.util.Objects; +import java.util.function.Supplier; + +import org.eclipse.passage.lic.floating.model.api.GrantAcqisition; +import org.eclipse.passage.lic.internal.base.acquire.BaseGrantAcquisition; + +public final class PGrantAcquisition implements Supplier { + + private final GrantAcqisition source; + + public PGrantAcquisition(GrantAcqisition source) { + Objects.requireNonNull(source, "PGrantAcquisition::source"); //$NON-NLS-1$ + this.source = source; + } + + @Override + public org.eclipse.passage.lic.internal.api.acquire.GrantAcqisition get() { + return new BaseGrantAcquisition(// + source.getIdentifier(), // + source.getGrant(), // + source.getFeature(), // + source.getUser(), // + source.getCreated()); + } + +}