-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add listener for license issuing, call when all license files are successfully persisted
- Loading branch information
1 parent
d507766
commit 3909754
Showing
11 changed files
with
249 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
bundles/org.eclipse.passage.lic.jetty/schema/commands.exsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
bundles/org.eclipse.passage.loc.licenses.core/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<!-- | ||
Copyright (c) 2022 ArSysOp and others | ||
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 | ||
--> | ||
<plugin> | ||
<extension-point id="issue" name="%extension-point.name" schema="schema/issue.exsd"/> | ||
|
||
</plugin> |
114 changes: 114 additions & 0 deletions
114
bundles/org.eclipse.passage.loc.licenses.core/schema/issue.exsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- | ||
Copyright (c) 2022 ArSysOp and others | ||
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 | ||
--> | ||
<!-- Schema file written by PDE --> | ||
<schema targetNamespace="org.eclipse.passage.loc.licenses.core" xmlns="http://www.w3.org/2001/XMLSchema"> | ||
<annotation> | ||
<appinfo> | ||
<meta.schema plugin="org.eclipse.passage.loc.licenses.core" id="issue" name="License Pack issue listener"/> | ||
</appinfo> | ||
<documentation> | ||
instanciated and called on a license pack persistence phase | ||
</documentation> | ||
</annotation> | ||
|
||
<element name="extension"> | ||
<annotation> | ||
<appinfo> | ||
<meta.element /> | ||
</appinfo> | ||
</annotation> | ||
<complexType> | ||
<sequence minOccurs="1" maxOccurs="unbounded"> | ||
<element ref="listener" minOccurs="1" maxOccurs="unbounded"/> | ||
</sequence> | ||
<attribute name="point" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="id" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="name" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
<appinfo> | ||
<meta.attribute translatable="true"/> | ||
</appinfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<element name="listener"> | ||
<complexType> | ||
<attribute name="class" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
<appinfo> | ||
<meta.attribute kind="java" basedOn=":org.eclipse.passage.loc.internal.licenses.core.LicensePackPersistenceListener"/> | ||
</appinfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="since"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter the first release in which this extension point appears.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="examples"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter extension point usage example here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="apiinfo"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter API information here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="implementation"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter information about supplied implementation of this extension point.] | ||
</documentation> | ||
</annotation> | ||
|
||
|
||
</schema> |
55 changes: 55 additions & 0 deletions
55
...c/org/eclipse/passage/loc/internal/licenses/core/ContributedLicensePackIssueListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.eclipse.passage.loc.internal.licenses.core; | ||
|
||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.eclipse.core.runtime.CoreException; | ||
import org.eclipse.core.runtime.IConfigurationElement; | ||
import org.eclipse.core.runtime.IExtension; | ||
import org.eclipse.core.runtime.Platform; | ||
import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; | ||
import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; | ||
import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; | ||
|
||
final class ContributedLicensePackIssueListener implements LicensePackIssueListener { | ||
|
||
private final Logger log = LogManager.getLogger(getClass()); | ||
private final List<LicensePackIssueListener> contributed; | ||
|
||
ContributedLicensePackIssueListener() { | ||
this.contributed = read(); | ||
} | ||
|
||
@Override | ||
public void floating(FloatingLicensePack pack, Collection<FloatingLicenseAccess> configs, Path residence) { | ||
contributed.forEach(listener -> listener.floating(pack, configs, residence)); | ||
|
||
} | ||
|
||
@Override | ||
public void personal(PersonalLicensePack license, Path residence) { | ||
contributed.forEach(listener -> listener.personal(license, residence)); | ||
} | ||
|
||
private List<LicensePackIssueListener> read() { | ||
IExtension[] extensions = Platform.getExtensionRegistry() | ||
.getExtensionPoint("org.eclipse.passage.loc.licenses.core", "issue").getExtensions(); //$NON-NLS-1$//$NON-NLS-2$ | ||
List<LicensePackIssueListener> found = new ArrayList<>(); | ||
for (IExtension extension : extensions) { | ||
for (IConfigurationElement config : extension.getConfigurationElements()) { | ||
try { | ||
found.add((LicensePackIssueListener) config.createExecutableExtension("class")); //$NON-NLS-1$ | ||
} catch (CoreException e) { | ||
log.error("failed to instanciate licence pack issue listener", e); //$NON-NLS-1$ | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
return found; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...ses.core/src/org/eclipse/passage/loc/internal/licenses/core/LicensePackIssueListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************* | ||
* 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.loc.internal.licenses.core; | ||
|
||
import java.nio.file.Path; | ||
import java.util.Collection; | ||
|
||
import org.eclipse.passage.lic.licenses.model.api.FloatingLicenseAccess; | ||
import org.eclipse.passage.lic.licenses.model.api.FloatingLicensePack; | ||
import org.eclipse.passage.lic.licenses.model.api.PersonalLicensePack; | ||
|
||
public interface LicensePackIssueListener { | ||
|
||
void floating(FloatingLicensePack pack, Collection<FloatingLicenseAccess> configs, Path residence); | ||
|
||
void personal(PersonalLicensePack license, Path residence); | ||
|
||
} |