Merge commit 'e2a536e986f3966d8dd7598e9f0d8c281e41352e' from release-0.9.4-pre-rc
Change-Id: I130fe8651cd3787b588044b35e8f3473350ecb3b
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index 7507118..ee0b669 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -168,6 +168,10 @@
<gav>org.codehaus.mojo.appassembler:appassembler-model:2.0.0</gav>
<url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url>
</override>
+ <override>
+ <gav>io.netty:netty-all:4.1.25.Final</gav>
+ <noticeUrl>https://raw.githubusercontent.com/netty/netty/netty-4.1.25.Final/NOTICE.txt</noticeUrl>
+ </override>
</overrides>
<licenses>
<license>
diff --git a/asterixdb/src/main/appended-resources/supplemental-models.xml b/asterixdb/src/main/appended-resources/supplemental-models.xml
index 56176ec..6708f82 100644
--- a/asterixdb/src/main/appended-resources/supplemental-models.xml
+++ b/asterixdb/src/main/appended-resources/supplemental-models.xml
@@ -162,6 +162,7 @@
<!-- netty is ALv2, and does not contain any embedded LICENSE or NOTICE file -->
<license.ignoreMissingEmbeddedLicense>4.1.25.Final</license.ignoreMissingEmbeddedLicense>
<license.ignoreMissingEmbeddedNotice>4.1.25.Final</license.ignoreMissingEmbeddedNotice>
+ <license.ignoreNoticeOverride>4.1.25.Final</license.ignoreNoticeOverride>
</properties>
</project>
</supplement>
diff --git a/asterixdb/src/main/licenses/content/raw.githubusercontent.com_netty_netty_netty-4.1.25.Final_NOTICE.txt b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_netty_netty_netty-4.1.25.Final_NOTICE.txt
new file mode 100644
index 0000000..f973663
--- /dev/null
+++ b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_netty_netty_netty-4.1.25.Final_NOTICE.txt
@@ -0,0 +1,223 @@
+
+ The Netty Project
+ =================
+
+Please visit the Netty web site for more information:
+
+ * http://netty.io/
+
+Copyright 2014 The Netty Project
+
+The Netty Project licenses this file to you 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.
+
+Also, please refer to each LICENSE.<component>.txt file, which is located in
+the 'license' directory of the distribution file, for the license terms of the
+components that this product depends on.
+
+-------------------------------------------------------------------------------
+This product contains the extensions to Java Collections Framework which has
+been derived from the works by JSR-166 EG, Doug Lea, and Jason T. Greene:
+
+ * LICENSE:
+ * license/LICENSE.jsr166y.txt (Public Domain)
+ * HOMEPAGE:
+ * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/
+ * http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbosscache/experimental/jsr166/
+
+This product contains a modified version of Robert Harder's Public Domain
+Base64 Encoder and Decoder, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.base64.txt (Public Domain)
+ * HOMEPAGE:
+ * http://iharder.sourceforge.net/current/java/base64/
+
+This product contains a modified portion of 'Webbit', an event based
+WebSocket and HTTP server, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.webbit.txt (BSD License)
+ * HOMEPAGE:
+ * https://github.com/joewalnes/webbit
+
+This product contains a modified portion of 'SLF4J', a simple logging
+facade for Java, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.slf4j.txt (MIT License)
+ * HOMEPAGE:
+ * http://www.slf4j.org/
+
+This product contains a modified portion of 'Apache Harmony', an open source
+Java SE, which can be obtained at:
+
+ * NOTICE:
+ * license/NOTICE.harmony.txt
+ * LICENSE:
+ * license/LICENSE.harmony.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * http://archive.apache.org/dist/harmony/
+
+This product contains a modified portion of 'jbzip2', a Java bzip2 compression
+and decompression library written by Matthew J. Francis. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.jbzip2.txt (MIT License)
+ * HOMEPAGE:
+ * https://code.google.com/p/jbzip2/
+
+This product contains a modified portion of 'libdivsufsort', a C API library to construct
+the suffix array and the Burrows-Wheeler transformed string for any input string of
+a constant-size alphabet written by Yuta Mori. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.libdivsufsort.txt (MIT License)
+ * HOMEPAGE:
+ * https://github.com/y-256/libdivsufsort
+
+This product contains a modified portion of Nitsan Wakart's 'JCTools', Java Concurrency Tools for the JVM,
+ which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.jctools.txt (ASL2 License)
+ * HOMEPAGE:
+ * https://github.com/JCTools/JCTools
+
+This product optionally depends on 'JZlib', a re-implementation of zlib in
+pure Java, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.jzlib.txt (BSD style License)
+ * HOMEPAGE:
+ * http://www.jcraft.com/jzlib/
+
+This product optionally depends on 'Compress-LZF', a Java library for encoding and
+decoding data in LZF format, written by Tatu Saloranta. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.compress-lzf.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/ning/compress
+
+This product optionally depends on 'lz4', a LZ4 Java compression
+and decompression library written by Adrien Grand. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.lz4.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/jpountz/lz4-java
+
+This product optionally depends on 'lzma-java', a LZMA Java compression
+and decompression library, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.lzma-java.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/jponge/lzma-java
+
+This product contains a modified portion of 'jfastlz', a Java port of FastLZ compression
+and decompression library written by William Kinney. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.jfastlz.txt (MIT License)
+ * HOMEPAGE:
+ * https://code.google.com/p/jfastlz/
+
+This product contains a modified portion of and optionally depends on 'Protocol Buffers', Google's data
+interchange format, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.protobuf.txt (New BSD License)
+ * HOMEPAGE:
+ * https://github.com/google/protobuf
+
+This product optionally depends on 'Bouncy Castle Crypto APIs' to generate
+a temporary self-signed X.509 certificate when the JVM does not provide the
+equivalent functionality. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.bouncycastle.txt (MIT License)
+ * HOMEPAGE:
+ * http://www.bouncycastle.org/
+
+This product optionally depends on 'Snappy', a compression library produced
+by Google Inc, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.snappy.txt (New BSD License)
+ * HOMEPAGE:
+ * https://github.com/google/snappy
+
+This product optionally depends on 'JBoss Marshalling', an alternative Java
+serialization API, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.jboss-marshalling.txt (GNU LGPL 2.1)
+ * HOMEPAGE:
+ * http://www.jboss.org/jbossmarshalling
+
+This product optionally depends on 'Caliper', Google's micro-
+benchmarking framework, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.caliper.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/google/caliper
+
+This product optionally depends on 'Apache Commons Logging', a logging
+framework, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.commons-logging.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * http://commons.apache.org/logging/
+
+This product optionally depends on 'Apache Log4J', a logging framework, which
+can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.log4j.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * http://logging.apache.org/log4j/
+
+This product optionally depends on 'Aalto XML', an ultra-high performance
+non-blocking XML processor, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.aalto-xml.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * http://wiki.fasterxml.com/AaltoHome
+
+This product contains a modified version of 'HPACK', a Java implementation of
+the HTTP/2 HPACK algorithm written by Twitter. It can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.hpack.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/twitter/hpack
+
+This product contains a modified portion of 'Apache Commons Lang', a Java library
+provides utilities for the java.lang API, which can be obtained at:
+
+ * LICENSE:
+ * license/LICENSE.commons-lang.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://commons.apache.org/proper/commons-lang/
+
+
+This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build.
+
+ * LICENSE:
+ * license/LICENSE.mvn-wrapper.txt (Apache License 2.0)
+ * HOMEPAGE:
+ * https://github.com/takari/maven-wrapper
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
index 25e3255..712d575 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/job/resource/ClusterCapacity.java
@@ -25,6 +25,7 @@
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksException;
+import org.apache.hyracks.util.StorageUtil;
public class ClusterCapacity implements IClusterCapacity {
@@ -118,6 +119,7 @@
@Override
public String toString() {
- return "(memory: " + aggregatedMemoryByteSize + " bytes, CPU cores: " + aggregatedCores + ")";
+ return "(memory: " + StorageUtil.toHumanReadableSize(aggregatedMemoryByteSize) + " bytes, CPU cores: "
+ + aggregatedCores + ")";
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ArtifactSpec.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ArtifactSpec.java
new file mode 100644
index 0000000..606c080
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ArtifactSpec.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.hyracks.maven.license;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArtifactSpec {
+ public static final String BAD_CHARS = "[ \"#$%&'()*+,/:;<=>\\[\\]^`\\{\\|\\}~]";
+ protected String url;
+ protected String contentFile;
+ protected List<String> aliasUrls = new ArrayList<>();
+ protected String content;
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getContentFile() {
+ return getContentFile(true);
+ }
+
+ @SuppressWarnings("squid:S1166")
+ public String getContentFile(boolean fixupExtension) {
+ if (contentFile == null) {
+ String file;
+ try {
+ URI uri = new URI(url);
+ file = ((uri.getHost() != null ? uri.getHost() : "") + uri.getPath()).replaceAll(BAD_CHARS, "_");
+ } catch (URISyntaxException e) {
+ file = url.replaceAll(BAD_CHARS, "_");
+ }
+ return (!fixupExtension || file.endsWith(".txt")) ? file : file + ".txt";
+ } else {
+ return contentFile;
+ }
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public List<String> getAliasUrls() {
+ return aliasUrls;
+ }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
index f61dadf..475ed50 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
@@ -22,6 +22,7 @@
import static org.apache.hyracks.maven.license.ProjectFlag.ALTERNATE_NOTICE_FILE;
import static org.apache.hyracks.maven.license.ProjectFlag.IGNORE_MISSING_EMBEDDED_LICENSE;
import static org.apache.hyracks.maven.license.ProjectFlag.IGNORE_MISSING_EMBEDDED_NOTICE;
+import static org.apache.hyracks.maven.license.ProjectFlag.IGNORE_NOTICE_OVERRIDE;
import java.io.File;
import java.io.FileOutputStream;
@@ -118,8 +119,8 @@
rebuildLicenseContentProjectMap();
combineCommonGavs();
SourcePointerResolver.execute(this);
- persistLicenseMap();
buildNoticeProjectMap();
+ persistLicenseMap();
generateFiles();
if (seenWarning && failOnWarning) {
throw new MojoFailureException(
@@ -137,30 +138,30 @@
}
licenseSpecs.addAll(urlToLicenseMap.values());
for (LicenseSpec license : licenseSpecs) {
- resolveLicenseContent(license, true);
+ resolveArtifactContent(license, true);
}
}
- private String resolveLicenseContent(LicenseSpec license, boolean bestEffort) throws IOException {
- if (license.getContent() == null) {
- getLog().debug("Resolving content for " + license.getUrl() + " (" + license.getContentFile() + ")");
- File cFile = new File(license.getContentFile());
+ private String resolveArtifactContent(ArtifactSpec artifact, boolean bestEffort) throws IOException {
+ if (artifact.getContent() == null) {
+ getLog().debug("Resolving content for " + artifact.getUrl() + " (" + artifact.getContentFile() + ")");
+ File cFile = new File(artifact.getContentFile());
if (!cFile.isAbsolute()) {
- cFile = new File(licenseDirectory, license.getContentFile());
+ cFile = new File(licenseDirectory, artifact.getContentFile());
}
if (!cFile.exists()) {
if (!bestEffort) {
- getLog().warn("MISSING: license content file (" + cFile + ") for url: " + license.getUrl());
- license.setContent("MISSING: " + license.getContentFile() + " (" + license.getUrl() + ")");
+ getLog().warn("MISSING: content file (" + cFile + ") for url: " + artifact.getUrl());
+ artifact.setContent("MISSING: " + artifact.getContentFile() + " (" + artifact.getUrl() + ")");
}
} else {
- getLog().info("Reading license content from file: " + cFile);
+ getLog().info("Reading content from file: " + cFile);
StringWriter sw = new StringWriter();
LicenseUtil.readAndTrim(sw, cFile);
- license.setContent(sw.toString());
+ artifact.setContent(sw.toString());
}
}
- return license.getContent();
+ return artifact.getContent();
}
private void combineCommonGavs() {
@@ -260,7 +261,7 @@
warnUnlessFlag(p.gav(), IGNORE_MISSING_EMBEDDED_LICENSE,
"Using license other than from within artifact: " + p.gav() + " (" + lps.getLicense()
+ ")");
- licenseText = resolveLicenseContent(lps.getLicense(), false);
+ licenseText = resolveArtifactContent(lps.getLicense(), false);
}
LicenseSpec spec = lps.getLicense();
if (spec.getDisplayName() == null) {
@@ -292,11 +293,21 @@
return projects;
}
- private void buildNoticeProjectMap() {
+ private void buildNoticeProjectMap() throws IOException {
noticeMap = new TreeMap<>(WHITESPACE_NORMALIZED_COMPARATOR);
for (Project p : getProjects()) {
+ String noticeText = p.getNoticeText();
+ if (noticeText == null && noticeOverrides.containsKey(p.gav())) {
+ String noticeUrl = noticeOverrides.get(p.gav());
+ warnUnlessFlag(p.gav(), IGNORE_NOTICE_OVERRIDE,
+ "Using notice other than from within artifact: " + p.gav() + " (" + noticeUrl + ")");
+ p.setNoticeText(resolveArtifactContent(new NoticeSpec(noticeUrl), false));
+ } else if (noticeText == null && !noticeOverrides.containsKey(p.gav())
+ && Boolean.TRUE.equals(getProjectFlag(p.gav(), IGNORE_NOTICE_OVERRIDE))) {
+ getLog().warn(p + " has IGNORE_NOTICE_OVERRIDE flag set, but no override defined...");
+ }
prependSourcePointerToNotice(p);
- final String noticeText = p.getNoticeText();
+ noticeText = p.getNoticeText();
if (noticeText == null) {
continue;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
index 55987da..a94727d 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
@@ -20,11 +20,13 @@
import static org.apache.hyracks.maven.license.LicenseUtil.toGav;
import static org.apache.hyracks.maven.license.ProjectFlag.IGNORE_LICENSE_OVERRIDE;
+import static org.apache.hyracks.maven.license.ProjectFlag.IGNORE_NOTICE_OVERRIDE;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -122,6 +124,7 @@
Map<String, LicenseSpec> urlToLicenseMap = new HashMap<>();
Map<String, LicensedProjects> licenseMap = new TreeMap<>();
private Map<Pair<String, ProjectFlag>, Object> projectFlags = new HashMap<>();
+ Map<String, String> noticeOverrides = new HashMap<String, String>();
protected boolean seenWarning;
@@ -180,17 +183,17 @@
}
public void warn(CharSequence charSequence) {
- seenWarning();
+ seenWarning(charSequence);
originalLog.warn(charSequence);
}
public void warn(CharSequence charSequence, Throwable throwable) {
- seenWarning();
+ seenWarning(charSequence, throwable);
originalLog.warn(charSequence, throwable);
}
public void warn(Throwable throwable) {
- seenWarning();
+ seenWarning(throwable);
originalLog.warn(throwable);
}
@@ -199,25 +202,26 @@
}
public void error(CharSequence charSequence) {
- seenWarning();
+ seenWarning(charSequence);
originalLog.error(charSequence);
}
public void error(CharSequence charSequence, Throwable throwable) {
- seenWarning();
+ seenWarning(charSequence, throwable);
originalLog.error(charSequence, throwable);
}
public void error(Throwable throwable) {
- seenWarning();
+ seenWarning(throwable);
originalLog.error(throwable);
}
- private void seenWarning() {
+ private void seenWarning(Object... args) {
seenWarning = true;
if (warningTouchFile != null) {
try {
- FileUtils.touch(warningTouchFile);
+ FileUtils.write(warningTouchFile, String.valueOf(Arrays.asList(args)), StandardCharsets.UTF_8,
+ true);
} catch (IOException e) {
originalLog.error("unable to touch " + warningTouchFile, e);
}
@@ -340,12 +344,16 @@
MavenProject dep = dependencyGavMap.get(gav);
if (dep == null) {
getLog().warn("Unused override dependency " + gav + "; ignoring...");
- } else {
+ } else if (override.getUrl() != null) {
final List<Pair<String, String>> newLicense =
Collections.singletonList(new ImmutablePair<>(override.getUrl(), override.getName()));
List<Pair<String, String>> prevLicense = dependencyLicenseMap.put(dep, newLicense);
- getLog().warn("license list for " + toGav(dep) + " changed with <override>; was: " + prevLicense
- + ", now: " + newLicense);
+ warnUnlessFlag(dep, IGNORE_LICENSE_OVERRIDE, "license list for " + toGav(dep)
+ + " changed with <override>; was: " + prevLicense + ", now: " + newLicense);
+ } else if (override.getNoticeUrl() != null) {
+ noticeOverrides.put(gav, override.getNoticeUrl());
+ warnUnlessFlag(dep, IGNORE_NOTICE_OVERRIDE,
+ "notice for " + toGav(dep) + " changed with <override>; now: " + override.getNoticeUrl());
}
}
return dependencyLicenseMap;
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
index 5ac2392..909014a 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
@@ -18,26 +18,18 @@
*/
package org.apache.hyracks.maven.license;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class LicenseSpec {
+public class LicenseSpec extends ArtifactSpec {
public static final int DEFAULT_METRIC = 100;
public static final int UNDEFINED_LICENSE_METRIC = 999;
- public static final String BAD_CHARS = "[ \"#$%&'()*+,/:;<=>\\[\\]^`\\{\\|\\}~]";
- private String url;
- private String contentFile;
- private List<String> aliasUrls = new ArrayList<>();
private String displayName;
private int metric = DEFAULT_METRIC;
- private String content;
@SuppressWarnings("unused")
public LicenseSpec() {
@@ -63,42 +55,6 @@
}
}
- public String getUrl() {
- return url;
- }
-
- public String getContentFile() {
- return getContentFile(true);
- }
-
- @SuppressWarnings("squid:S1166")
- public String getContentFile(boolean fixupExtension) {
- if (contentFile == null) {
- String file;
- try {
- URI uri = new URI(url);
- file = ((uri.getHost() != null ? uri.getHost() : "") + uri.getPath()).replaceAll(BAD_CHARS, "_");
- } catch (URISyntaxException e) {
- file = url.replaceAll(BAD_CHARS, "_");
- }
- return (!fixupExtension || file.endsWith(".txt")) ? file : file + ".txt";
- } else {
- return contentFile;
- }
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public List<String> getAliasUrls() {
- return aliasUrls;
- }
-
public String getDisplayName() {
return displayName;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/NoticeSpec.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/NoticeSpec.java
new file mode 100644
index 0000000..1a24246
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/NoticeSpec.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.hyracks.maven.license;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class NoticeSpec extends ArtifactSpec {
+
+ @SuppressWarnings("unused")
+ public NoticeSpec() {
+ // called by Maven configuration
+ }
+
+ @JsonCreator
+ public NoticeSpec(@JsonProperty("aliasUrls") List<String> aliasUrls, @JsonProperty("content") String content,
+ @JsonProperty("contentFile") String contentFile, @JsonProperty("url") String url) {
+ this.aliasUrls = aliasUrls;
+ this.content = content;
+ this.contentFile = contentFile;
+ this.url = url;
+ }
+
+ public NoticeSpec(String url) {
+ this.url = url;
+ }
+
+ public String toString() {
+ return getUrl();
+ }
+}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
index aa532e6..0391dfb 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
@@ -29,6 +29,9 @@
@SuppressWarnings("unused") // set by Maven plugin configuration
private String name;
+ @SuppressWarnings("unused") // set by Maven plugin configuration
+ private String noticeUrl;
+
public String getGav() {
return gav;
}
@@ -40,4 +43,8 @@
public String getName() {
return name;
}
+
+ public String getNoticeUrl() {
+ return noticeUrl;
+ }
}
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
index 28b3bbc..dd8fdf7 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
@@ -32,6 +32,7 @@
IGNORE_MISSING_EMBEDDED_LICENSE,
IGNORE_MISSING_EMBEDDED_NOTICE,
IGNORE_LICENSE_OVERRIDE,
+ IGNORE_NOTICE_OVERRIDE,
ALTERNATE_LICENSE_FILE,
ALTERNATE_NOTICE_FILE;
@@ -48,6 +49,7 @@
case IGNORE_MISSING_EMBEDDED_LICENSE:
case IGNORE_MISSING_EMBEDDED_NOTICE:
case IGNORE_LICENSE_OVERRIDE:
+ case IGNORE_NOTICE_OVERRIDE:
if (Stream.of(StringUtils.split(value, ",")).anyMatch(depObj.getVersion()::equals)) {
licenseMojo.getProjectFlags().put(Pair.of(toGav(depObj), this), Boolean.TRUE);
} else {