Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Commit

Permalink
Merge pull request #24 from arsysop/develop
Browse files Browse the repository at this point in the history
0.3.1 to master
  • Loading branch information
Alexander Fedorov authored Dec 4, 2018
2 parents f4fe052 + 40d2ebf commit bba5bb5
Show file tree
Hide file tree
Showing 198 changed files with 8,982 additions and 2,037 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ru.arsysop.passage.lic.root</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jdk:
notifications:
email:
- alexander.fedorov@arsysop.ru
- sergei.kovalchuk@arsysop.ru

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion bundles/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<parent>
<groupId>ru.arsysop.passage.lic</groupId>
<artifactId>ru.arsysop.passage.lic.parent</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>
<relativePath>../releng/ru.arsysop.passage.lic.parent</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
Contributors:
ArSysOp - initial API and implementation
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="ru.arsysop.passage.lic.model.core.XmiLicenseConditionExtractor">
<service>
<provide interface="ru.arsysop.passage.lic.runtime.io.ConditionExtractor"/>
</service>
<implementation class="ru.arsysop.passage.lic.model.core.XmiLicenseConditionExtractor"/>
</scr:component>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
48 changes: 48 additions & 0 deletions bundles/ru.arsysop.passage.lic.base.ui/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018 ArSysOp
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
Contributors:
ArSysOp - initial API and implementation
-->
<projectDescription>
<name>ru.arsysop.passage.lic.base.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
autoEnabled=false
eclipse.preferences.version=1
extraProperties=
fileExclusions=
14 changes: 14 additions & 0 deletions bundles/ru.arsysop.passage.lic.base.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Manifest-Version: 1.0
Automatic-Module-Name: ru.arsysop.passage.lic.base.ui
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ru.arsysop.passage.lic.base.ui
Bundle-Version: 0.3.1.qualifier
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Copyright: %Bundle-Copyright
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: ru.arsysop.passage.lic.runtime;bundle-version="0.0.0";visibility:=reexport,
ru.arsysop.passage.lic.registry;bundle-version="0.0.0",
ru.arsysop.passage.lic.base;bundle-version="0.0.0",
org.eclipse.jface
Export-Package: ru.arsysop.passage.lic.base.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#Properties file for ru.arsysop.passage.lic.base.ui
###############################################################################
# Copyright (c) 2018 ArSysOp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
# Contributors:
# ArSysOp - initial API and implementation
###############################################################################

Bundle-Name = Passage LIC Base
Bundle-Vendor = ArSysOp
Bundle-Copyright = Copyright (c) 2018 ArSysOp
6 changes: 6 additions & 0 deletions bundles/ru.arsysop.passage.lic.base.ui/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
icons/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package ru.arsysop.passage.lic.registry;
package ru.arsysop.passage.lic.base.ui;

public interface BaseDescriptorRegistry<D extends BaseDescriptor> {

void loadSource(String source) throws Exception;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

void unloadSource(String source) throws Exception;
public interface LicensingImages {

D getDescriptor(String identifier);
String IMG_DEFAULT = "IMG_DEFAULT"; //$NON-NLS-1$

Iterable<D> getDescriptors();
String IMG_LEVEL_OK = "IMG_LEVEL_OK"; //$NON-NLS-1$
String IMG_LEVEL_INFO = "IMG_LEVEL_INFO"; //$NON-NLS-1$
String IMG_LEVEL_WARN = "IMG_LEVEL_WARN"; //$NON-NLS-1$
String IMG_LEVEL_ERROR = "IMG_LEVEL_ERROR"; //$NON-NLS-1$
String IMG_LEVEL_FATAL = "IMG_LEVEL_FATAL"; //$NON-NLS-1$

Iterable<D> selectDescriptors(String filter) throws Exception;

void insertDescriptors(Iterable<D> descriptors) throws Exception;
public Image getImage(String identifier);
public ImageDescriptor getImageDescriptor(String identifier);

void updateDescriptors(Iterable<D> descriptors) throws Exception;

void deleteDescriptors(Iterable<D> descriptors) throws Exception;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*******************************************************************************
* Copyright (c) 2018 ArSysOp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package ru.arsysop.passage.lic.base.ui;

import static ru.arsysop.passage.lic.base.LicensingProperties.*;
import static ru.arsysop.passage.lic.base.ui.LicensingImages.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import ru.arsysop.passage.lic.base.RestrictionVerdictComparator;
import ru.arsysop.passage.lic.runtime.RestrictionVerdict;

public class RestrictionVerdictLabels {

public static String resolveImageKey(Iterable<RestrictionVerdict> verdicts) {
RestrictionVerdict last = resolveLastVerdict(verdicts);
return resolveImageKey(last);
}

public static String resolveImageKey(RestrictionVerdict verdict) {
if (verdict == null) {
return IMG_LEVEL_OK;
}
String level = verdict.getRestrictionLevel();
if (level == null) {
level = LICENSING_RESTRICTION_LEVEL_DEFAULT;
}
switch (level) {
case LICENSING_RESTRICTION_LEVEL_WARN:
return IMG_LEVEL_WARN;
case LICENSING_RESTRICTION_LEVEL_ERROR:
return IMG_LEVEL_ERROR;
case LICENSING_RESTRICTION_LEVEL_FATAL:
return IMG_LEVEL_FATAL;
default:
return IMG_LEVEL_WARN;
}
}

public static String resolveLabel(RestrictionVerdict verdict) {
if (verdict == null) {
return "OK";
}
String level = verdict.getRestrictionLevel();
if (level == null) {
level = LICENSING_RESTRICTION_LEVEL_DEFAULT;
}
switch (level) {
case LICENSING_RESTRICTION_LEVEL_WARN:
return "Warning";
case LICENSING_RESTRICTION_LEVEL_ERROR:
return "Error";
case LICENSING_RESTRICTION_LEVEL_FATAL:
return "Fatal";
default:
return "Warning";
}
}

public static String resolveTooltip(RestrictionVerdict verdict) {
if (verdict == null) {
return "The product in licensed properly";
}
return "There are issues with licensing";
}

public static RestrictionVerdict resolveLastVerdict(Iterable<RestrictionVerdict> verdicts) {
List<RestrictionVerdict> list = new ArrayList<>();
verdicts.forEach(list::add);
if (list.isEmpty()) {
return null;
}
Collections.sort(list, new RestrictionVerdictComparator());
RestrictionVerdict last = list.get(list.size()-1);
return last;
}

}
2 changes: 1 addition & 1 deletion bundles/ru.arsysop.passage.lic.base/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: ru.arsysop.passage.lic.runtime.base
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ru.arsysop.passage.lic.base
Bundle-Version: 0.3.0.qualifier
Bundle-Version: 0.3.1.qualifier
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Copyright: %Bundle-Copyright
Expand Down
Loading

0 comments on commit bba5bb5

Please sign in to comment.