Skip to content

Commit

Permalink
Merge pull request #2 from ow2-proactive/master
Browse files Browse the repository at this point in the history
synchronize fork
  • Loading branch information
fviale authored Sep 13, 2019
2 parents 428049d + c3cbfe1 commit e033cec
Show file tree
Hide file tree
Showing 171 changed files with 7,361 additions and 3,464 deletions.
20 changes: 17 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
//Import required to format the license report plugin
import com.github.jk1.license.render.*
import com.github.jk1.license.filter.*

buildscript {
repositories {
if (project.hasProperty('local')) mavenLocal()

mavenCentral()
jcenter()

maven { url "https://plugins.gradle.org/m2/" }
Expand Down Expand Up @@ -31,6 +36,8 @@ buildscript {
classpath "com.diffplug.gradle.spotless:spotless:2.4.0"
classpath "org.ow2.proactive:coding-rules:1.0.0"

classpath 'com.github.jk1:gradle-license-report:1.9'

delete "gradle/ext"
ant.unjar src: configurations.classpath.find { it.name.startsWith("coding-rules") }, dest: 'gradle/ext'
}
Expand Down Expand Up @@ -58,6 +65,7 @@ def custom ={ "$rootDir/gradle/${it}.gradle"}

apply plugin: 'java'
apply plugin: 'org.sonarqube'
apply plugin: 'com.github.jk1.dependency-license-report'
apply from: "$rootDir/gradle/ext/coding-format.gradle"

archivesBaseName = 'scheduling' // in case current folder is not named scheduling
Expand All @@ -79,6 +87,7 @@ configurations {
allprojects {
apply plugin: 'maven'
apply plugin: 'project-report'
apply plugin: 'com.github.jk1.dependency-license-report'


group = 'org.ow2.proactive'
Expand Down Expand Up @@ -112,6 +121,13 @@ allprojects {
}
}
}

licenseReport {
configurations = ['runtime']
excludeGroups = ['org.objectweb.proactive','jsr223']
filters = [new LicenseBundleNormalizer(bundlePath: "$rootDir/config/report/license-normalizer-bundle.json")]
renderers = [new InventoryHtmlReportRenderer()]
}
}

ext.javaSubprojects = subprojects.findAll { new File(it.projectDir, "src").exists() }
Expand Down Expand Up @@ -460,11 +476,9 @@ createGenerateCredentialTask('Scheduler', ['-F', 'config/authentication/keys/pub
'-l', 'scheduler', '-p', 'scheduler_pwd', '-o', 'config/authentication/scheduler.cred'])
createGenerateCredentialTask('Admin', ['-F', 'config/authentication/keys/pub.key',
'-l', 'admin', '-p', 'admin', '-o', 'config/authentication/admin_user.cred'])
createGenerateCredentialTask('Node', ['-F', 'config/authentication/keys/pub.key',
'-l', 'rm', '-p', 'rm_pwd', '-o', 'rm/rm-node/src/main/resources/config/authentication/rm.cred'])

task generateCredentials
generateCredentials.dependsOn generateCredentialsAdmin, generateCredentialsScheduler, generateCredentialsRm, generateCredentialsNode
generateCredentials.dependsOn generateCredentialsAdmin, generateCredentialsScheduler, generateCredentialsRm

def exportedProjects= [
":common:common-api",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public enum OperatingSystem {
HP_UX("HP-UX", OperatingSystemFamily.UNIX),
AIX("AIX", OperatingSystemFamily.UNIX),
OS_390("OS/390", OperatingSystemFamily.UNIX),
zOS("z/OS", OperatingSystemFamily.UNIX),
FREEBSD("FreeBSD", OperatingSystemFamily.UNIX),
IRIX("Irix", OperatingSystemFamily.UNIX),
DIGITAL_UNIX("Digital Unix", OperatingSystemFamily.UNIX),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.*;
import java.util.stream.Collectors;

import org.ow2.proactive.authentication.principals.*;

Expand Down Expand Up @@ -177,6 +178,31 @@ public PermissionCollection newPermissionCollection() {
public boolean hasPrincipal(IdentityPrincipal principal) {
return principals.contains(principal);
}

public void addPermission(IdentityPrincipal tokenPrincipal) {
principals.add(tokenPrincipal);
}

public void removePermission(IdentityPrincipal tokenPrincipal) {
principals.remove(tokenPrincipal);
}

public boolean isAnyToken() {
return principals.stream().anyMatch(p -> p instanceof TokenPrincipal);
}

public List<String> getAllTokens() {
return principals.stream()
.filter(p -> p instanceof TokenPrincipal)
.map(IdentityPrincipal::getName)
.collect(Collectors.toList());
}

public void setAllTokens(List<String> tokens) {
principals.removeIf(p -> p instanceof TokenPrincipal);

tokens.forEach(token -> addPermission(new TokenPrincipal(token)));
}
}

final class PrincipalPermissionCollection extends PermissionCollection implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;

import javax.management.Attribute;
import javax.management.AttributeList;
Expand Down Expand Up @@ -142,19 +144,33 @@ public static String rrdContent(byte[] rrd4j, String newRange, String[] dataSour
result.append("\"").append(dataSource).append("\":[");

double[] values = fetchData.getValues(dataSource);
for (int j = 0; j < values.length; j++) {
if (Double.compare(Double.NaN, values[j]) == 0) {
result.append("null");
} else {
result.append(formatter.format(values[j]));
}
if (j < values.length - 1) {
result.append(',');
}

int nValuesToTake = values.length;
// if the last value is NaN then we decide to not send it to the client
// why? Because when we retrieve from RDD file, somehow the latest is
// always NaN, which is not what we want.
if (Double.compare(values[values.length - 1], Double.NaN) == 0) {
--nValuesToTake;
}

String collect = Arrays.stream(values)
.boxed()
.collect(Collectors.toList())
.subList(0, nValuesToTake)
.stream()
.map(value -> {
if (Double.compare(Double.NaN, value) == 0) {
return "null";
} else {
return formatter.format(value);
}
})
.collect(Collectors.joining(","));
result.append(collect);
result.append(']');
if (i < dataSources.length - 1)
if (i < dataSources.length - 1) {
result.append(',');
}
}
result.append("}");

Expand Down
55 changes: 55 additions & 0 deletions config/report/license-normalizer-bundle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"bundles" : [
{ "bundleName" : "Apache-1.0", "licenseName" : "Apache Software License, Version 1.1", "licenseUrl" : "https://www.apache.org/licenses/LICENSE-1.1" },
{ "bundleName" : "Apache-2.0", "licenseName" : "Apache License, Version 2.0", "licenseUrl" : "https://www.apache.org/licenses/LICENSE-2.0" },
{ "bundleName" : "BSD-2-Clause", "licenseName" : "The 2-Clause BSD License", "licenseUrl" : "https://opensource.org/licenses/BSD-2-Clause" },
{ "bundleName" : "BSD-3-Clause", "licenseName" : "The 3-Clause BSD License", "licenseUrl" : "https://opensource.org/licenses/BSD-3-Clause" },
{ "bundleName" : "CC0-1.0", "licenseName" : "Creative Commons Legal Code", "licenseUrl" : "https://repository.jboss.org/licenses/cc0-1.0.txt" },
{ "bundleName" : "CDDL-1.0", "licenseName" : "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL), Version 1.0", "licenseUrl" : "https://oss.oracle.com/licenses/CDDL" },
{ "bundleName" : "CDDL-1.1", "licenseName" : "COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1", "licenseUrl" : "https://oss.oracle.com/licenses/CDDL-1.1" },
{ "bundleName" : "CPL-1.0", "licenseName" : "Common Public License - v 1.0", "licenseUrl" : "https://www.eclipse.org/legal/cpl-v10.html" },
{ "bundleName" : "EPL-1.0", "licenseName" : "Eclipse Public License - v 1.0", "licenseUrl" : "http://www.eclipse.org/legal/epl-v10.html" },
{ "bundleName" : "EPL-2.0", "licenseName" : "Eclipse Public License - v 2.0", "licenseUrl" : "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt" },
{ "bundleName" : "EDL-1.0", "licenseName" : "Eclipse Distribution License - v 1.0", "licenseUrl" : "https://www.eclipse.org/org/documents/edl-v10.html" },
{ "bundleName" : "GPL-1.0", "licenseName" : "GNU GENERAL PUBLIC LICENSE, Version 1", "licenseUrl" : "https://www.gnu.org/licenses/gpl-1.0" },
{ "bundleName" : "GPL-2.0-only", "licenseName" : "GNU GENERAL PUBLIC LICENSE, Version 2", "licenseUrl" : "https://www.gnu.org/licenses/gpl-2.0" },
{ "bundleName" : "GPL-3.0-only", "licenseName" : "GNU GENERAL PUBLIC LICENSE, Version 3", "licenseUrl" : "https://www.gnu.org/licenses/gpl-3.0" },
{ "bundleName" : "GPL-2.0 WITH Classpath-exception-2.0", "licenseName" : "GNU GENERAL PUBLIC LICENSE, Version 2 + Classpath Exception", "licenseUrl" : "https://openjdk.java.net/legal/gplv2+ce.html" },
{ "bundleName" : "LGPL-2.1-only", "licenseName" : "GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1", "licenseUrl" : "https://www.gnu.org/licenses/lgpl-2.1" },
{ "bundleName" : "LGPL-3.0-only", "licenseName" : "GNU LESSER GENERAL PUBLIC LICENSE, Version 3", "licenseUrl" : "https://www.gnu.org/licenses/lgpl-3.0" },
{ "bundleName" : "MIT", "licenseName" : "MIT License", "licenseUrl" : "https://opensource.org/licenses/MIT" },
{ "bundleName" : "MPL-1.1", "licenseName" : "Mozilla Public License Version 1.1", "licenseUrl" : "https://www.mozilla.org/en-US/MPL/1.1" },
{ "bundleName" : "MPL-2.0", "licenseName" : "Mozilla Public License, Version 2.0", "licenseUrl" : "https://www.mozilla.org/en-US/MPL/2.0" },
{ "bundleName" : "Public-Domain", "licenseName" : "PUBLIC DOMAIN", "licenseUrl" : "" }
],
"transformationRules" : [
{ "bundleName" : "Apache-2.0", "licenseNamePattern" : ".*The Apache Software License, Version 2\\.0.*" },
{ "bundleName" : "Apache-2.0", "licenseNamePattern" : "Apache 2.*" },
{ "bundleName" : "Apache-2.0", "licenseNamePattern" : "ASL 2\\.0" },
{ "bundleName" : "Apache-2.0", "licenseUrlPattern" : ".*www\\.apache\\.org/licenses/LICENSE-2\\.0.*" },
{ "bundleName" : "LGPL-2.1-only", "licenseUrlPattern" : ".*www\\.gnu\\.org/licenses/old-licenses/lgpl-2\\.1\\.html" },
{ "bundleName" : "MIT", "licenseUrlPattern" : ".*www\\.opensource\\.org/licenses/mit-license\\.php" },
{ "bundleName" : "Apache-2.0", "licenseFileContentPattern" : ".*Apache License,?( Version)? 2.*" },
{ "bundleName" : "Apache-1.0", "licenseFileContentPattern" : ".*Apache Software License, Version 1\\.1.*" },
{ "bundleName" : "CDDL-1.0", "licenseFileContentPattern" : ".*CDDL.*1\\.0" },
{ "bundleName" : "BSD-3-Clause", "licenseNamePattern" : "BSD[ |-]3-[c|C]lause.*" },
{ "bundleName" : "BSD-2-Clause", "licenseNamePattern" : "BSD[ |-]2-[c|C]lause.*" },
{ "bundleName" : "CDDL-1.0", "licenseNamePattern" : "Common Development and Distribution( License)?" },
{ "bundleName" : "CDDL-1.0", "licenseNamePattern" : "CDDL 1(\\.0)" },
{ "bundleName" : "CDDL-1.1", "licenseNamePattern" : "CDDL 1\\.1" },
{ "bundleName" : "EPL-1.0", "licenseNamePattern" : "Eclipse Public License.*(v|[v|V]ersion)\\.?\\s?1(\\.0)?" },
{ "bundleName" : "EDL-1.0", "licenseNamePattern" : "Eclipse Distribution License.*(v|[v|V]ersion)\\.?\\s?1(\\.0)?" },
{ "bundleName" : "GPL-2.0 WITH Classpath-exception-2.0", "licenseNamePattern" : "GNU General Public License, [v|V]ersion 2.*[c|C]lasspath [e|E]xception" },
{ "bundleName" : "GPL-2.0 WITH Classpath-exception-2.0", "licenseNamePattern" : "GNU General Public License, [v|V]ersion 2.*[c|C][p|P]?[e|E]" },
{ "bundleName" : "GPL-2.0 WITH Classpath-exception-2.0", "licenseNamePattern" : "GNU General Public License, [v|V]ersion 2.*, with the classpath exception" },
{ "bundleName" : "GPL-2.0 WITH Classpath-exception-2.0", "licenseNamePattern" : "GPL2 w/ CPE" },
{ "bundleName" : "LGPL-2.1-only", "licenseUrlPattern" : ".*www\\.opensource\\.org/licenses/LGPL-2\\.1" },
{ "bundleName" : "LGPL-2.1-only", "licenseUrlPattern" : ".*www\\.gnu\\.org/licenses/lgpl-2\\.1\\.html" },
{ "bundleName" : "LGPL-2.1-only", "licenseNamePattern" : "LGPL 2\\.1" },
{ "bundleName" : "MIT", "licenseNamePattern" : "(The\\s)?MIT(\\s[l|L]icen[c|s]e)?" },
{ "bundleName" : "MPL-1.1", "licenseNamePattern" : "MPL 1\\.1" },
{ "bundleName" : "Public-Domain", "licenseNamePattern" : "(([p|P]ublic|PUBLIC)\\s([d|D]omain|DOMAIN)).*", "transformUrl" : false },
{ "bundleName" : "Public-Domain", "licenseFileContentPattern" : ".*([c|C]reative|CREATIVE)\\s([c|C]ommons|COMMONS).*", "transformUrl" : false },
{ "bundleName" : "Public-Domain", "licenseFileContentPattern" : ".*(([p|P]ublic|PUBLIC)\\s([d|D]omain|DOMAIN)).*", "transformUrl" : false }
]
}
Loading

0 comments on commit e033cec

Please sign in to comment.