Search in sources :

Example 46 with EMPTY

use of org.apache.commons.lang3.StringUtils.EMPTY in project azure-gradle-plugins by lenala.

the class AnnotationHandlerImpl method patchStorageBinding.

private void patchStorageBinding(final Method method, final List<BaseBinding> bindings) {
    final Optional<Annotation> storageAccount = Arrays.stream(method.getAnnotations()).filter(a -> a instanceof StorageAccount).findFirst();
    if (storageAccount.isPresent()) {
        logger.quiet("StorageAccount annotation found.");
        final String connectionString = ((StorageAccount) storageAccount.get()).value();
        bindings.stream().forEach(b -> {
            if (b instanceof StorageBaseBinding) {
                final StorageBaseBinding sb = (StorageBaseBinding) b;
                // Override storage bindings with empty connection
                if (StringUtils.isEmpty(sb.getConnection())) {
                    sb.setConnection(connectionString);
                }
            }
        });
    } else {
        logger.quiet("No StorageAccount annotation found.");
    }
}
Also used : StorageBaseBinding(com.microsoft.azure.gradle.functions.bindings.StorageBaseBinding) Arrays(java.util.Arrays) URL(java.net.URL) HttpBinding(com.microsoft.azure.gradle.functions.bindings.HttpBinding) HashMap(java.util.HashMap) Reflections(org.reflections.Reflections) StringUtils(org.apache.commons.lang3.StringUtils) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Logger(org.gradle.api.logging.Logger) ArrayList(java.util.ArrayList) StorageAccount(com.microsoft.azure.serverless.functions.annotation.StorageAccount) URLClassLoader(java.net.URLClassLoader) HttpTrigger(com.microsoft.azure.serverless.functions.annotation.HttpTrigger) Parameter(java.lang.reflect.Parameter) Map(java.util.Map) MethodAnnotationsScanner(org.reflections.scanners.MethodAnnotationsScanner) Method(java.lang.reflect.Method) ConfigurationBuilder(org.reflections.util.ConfigurationBuilder) BaseBinding(com.microsoft.azure.gradle.functions.bindings.BaseBinding) FunctionConfiguration(com.microsoft.azure.gradle.functions.configuration.FunctionConfiguration) Set(java.util.Set) List(java.util.List) FunctionName(com.microsoft.azure.serverless.functions.annotation.FunctionName) Annotation(java.lang.annotation.Annotation) Optional(java.util.Optional) BindingFactory(com.microsoft.azure.gradle.functions.bindings.BindingFactory) StorageAccount(com.microsoft.azure.serverless.functions.annotation.StorageAccount) StorageBaseBinding(com.microsoft.azure.gradle.functions.bindings.StorageBaseBinding) Annotation(java.lang.annotation.Annotation)

Example 47 with EMPTY

use of org.apache.commons.lang3.StringUtils.EMPTY in project codeforces-commons by Codeforces.

the class ZipUtil method formatZipArchiveContentForView.

/**
 * Formats content of the ZIP-archive for view and returns result as UTF-8 bytes. The {@code truncated} flag
 * indicates that the length of returned view was restricted by {@code maxLength} parameter.
 *
 * @param zipFile                              ZIP-archive to format
 * @param maxLength                            maximal allowed length of result
 * @param maxEntryLineCount                    maximal allowed number of content lines to display for a single ZIP-archive entry
 * @param maxEntryLineLength                   maximal allowed length of ZIP-archive entry content line
 * @param entryListHeaderPattern               pattern of entry list header; parameters: {@code fileName}, {@code filePath}, {@code entryCount}
 * @param entryListItemPattern                 pattern of entry list item; parameters: {@code entryName}, {@code entrySize}, {@code entryIndex} (1-based)
 * @param entryListItemSeparatorPattern        pattern of entry list separator
 * @param entryListCloserPattern               pattern of entry list closer; parameters: {@code fileName}, {@code filePath}
 * @param entryContentHeaderPattern            pattern of entry content header; parameters: {@code entryName}, {@code entrySize}
 * @param entryContentLinePattern              pattern of entry content line; parameters: {@code entryLine}
 * @param entryContentLineSeparatorPattern     pattern of entry content separator
 * @param entryContentCloserPattern            pattern of entry content closer; parameters: {@code entryName}
 * @param binaryEntryContentPlaceholderPattern pattern of binary entry content placeholder; parameters: {@code entrySize}
 * @param emptyZipFilePlaceholderPattern       pattern of empty (no entries) ZIP-file placeholder; parameters: {@code fileName}, {@code filePath}
 * @return formatted view of ZIP-archive
 * @throws IOException if {@code zipFile} is not a correct ZIP-archive or any other I/O-error has been occured
 * @see String#format(String, Object...)
 */
@SuppressWarnings("OverlyLongMethod")
@Nonnull
public static FileUtil.FirstBytes formatZipArchiveContentForView(File zipFile, int maxLength, int maxEntryLineCount, int maxEntryLineLength, @Nullable String entryListHeaderPattern, @Nullable String entryListItemPattern, @Nullable String entryListItemSeparatorPattern, @Nullable String entryListCloserPattern, @Nullable String entryContentHeaderPattern, @Nullable String entryContentLinePattern, @Nullable String entryContentLineSeparatorPattern, @Nullable String entryContentCloserPattern, @Nullable String binaryEntryContentPlaceholderPattern, @Nullable String emptyZipFilePlaceholderPattern) throws IOException {
    entryListHeaderPattern = StringUtil.nullToDefault(entryListHeaderPattern, "ZIP-file entries {\n");
    entryListItemPattern = StringUtil.nullToDefault(entryListItemPattern, "    %3$03d. %1$s (%2$d B)");
    entryListItemSeparatorPattern = StringUtil.nullToDefault(entryListItemSeparatorPattern, "\n");
    entryListCloserPattern = StringUtil.nullToDefault(entryListCloserPattern, "\n}\n\n");
    entryContentHeaderPattern = StringUtil.nullToDefault(entryContentHeaderPattern, "Entry %1$s (%2$d B) {\n");
    entryContentLinePattern = StringUtil.nullToDefault(entryContentLinePattern, "    %1$s");
    entryContentLineSeparatorPattern = StringUtil.nullToDefault(entryContentLineSeparatorPattern, "\n");
    entryContentCloserPattern = StringUtil.nullToDefault(entryContentCloserPattern, "\n} // %1$s\n\n");
    binaryEntryContentPlaceholderPattern = StringUtil.nullToDefault(binaryEntryContentPlaceholderPattern, "    *** BINARY DATA (%1$d B) ***");
    emptyZipFilePlaceholderPattern = StringUtil.nullToDefault(emptyZipFilePlaceholderPattern, "Empty ZIP-file.");
    try {
        Charset charset = StandardCharsets.UTF_8;
        ZipFile internalZipFile = new ZipFile(zipFile);
        List<?> fileHeaders = internalZipFile.getFileHeaders();
        int headerCount = fileHeaders.size();
        if (headerCount <= 0) {
            return formatEmptyZipFilePlaceholder(zipFile, maxLength, emptyZipFilePlaceholderPattern, charset);
        }
        MutableBoolean truncated = new MutableBoolean(Boolean.FALSE);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        CountingOutputStream countingOutputStream = new CountingOutputStream(byteArrayOutputStream);
        byte[] entryListHeaderBytes = String.format(entryListHeaderPattern, zipFile.getName(), zipFile.getPath(), headerCount).getBytes(charset);
        if (!writeBytesForView(countingOutputStream, entryListHeaderBytes, maxLength, truncated)) {
            throw new IllegalArgumentException(String.format("Argument 'maxLength' (%d) is less than the length of entry list header '%s' (%d bytes).", maxLength, new String(entryListHeaderBytes, charset), entryListHeaderBytes.length));
        }
        fileHeaders.sort(Comparator.comparing(header -> ((FileHeader) header).getFileName()));
        for (int headerIndex = 0; headerIndex < headerCount; ++headerIndex) {
            FileHeader header = (FileHeader) fileHeaders.get(headerIndex);
            String fileName = header.getFileName();
            String entryListItemAppendix = headerIndex == headerCount - 1 ? String.format(entryListCloserPattern, zipFile.getName(), zipFile.getPath()) : entryListItemSeparatorPattern;
            byte[] entryListItemBytes = (String.format(entryListItemPattern, fileName, header.getUncompressedSize(), headerIndex + 1) + entryListItemAppendix).getBytes(charset);
            if (!writeBytesForView(countingOutputStream, entryListItemBytes, maxLength, truncated)) {
                break;
            }
        }
        for (int headerIndex = 0; headerIndex < headerCount; ++headerIndex) {
            FileHeader header = (FileHeader) fileHeaders.get(headerIndex);
            if (header.isDirectory()) {
                continue;
            }
            formatAndAppendEntryContent(countingOutputStream, maxLength, truncated, charset, internalZipFile, header, maxEntryLineCount, maxEntryLineLength, entryContentHeaderPattern, entryContentLinePattern, entryContentLineSeparatorPattern, entryContentCloserPattern, binaryEntryContentPlaceholderPattern);
            if (truncated.booleanValue()) {
                break;
            }
        }
        return new FileUtil.FirstBytes(truncated.booleanValue(), byteArrayOutputStream.toByteArray());
    } catch (ZipException e) {
        throw new IOException("Can't format ZIP-file for view.", e);
    }
}
Also used : ZipArchiveEntry(org.apache.commons.compress.archivers.zip.ZipArchiveEntry) java.util(java.util) IOCase(org.apache.commons.io.IOCase) java.util.zip(java.util.zip) ByteArrayOutputStream(com.codeforces.commons.io.ByteArrayOutputStream) Charset(java.nio.charset.Charset) StringUtil(com.codeforces.commons.text.StringUtil) NameFileFilter(org.apache.commons.io.filefilter.NameFileFilter) Math.max(com.codeforces.commons.math.Math.max) Nonnull(javax.annotation.Nonnull) FileHeader(net.lingala.zip4j.model.FileHeader) Nullable(javax.annotation.Nullable) ZipFile(net.lingala.zip4j.core.ZipFile) ZipParameters(net.lingala.zip4j.model.ZipParameters) ZipArchiveInputStream(org.apache.commons.compress.archivers.zip.ZipArchiveInputStream) com.codeforces.commons.io(com.codeforces.commons.io) StandardCharsets(java.nio.charset.StandardCharsets) ZipException(net.lingala.zip4j.exception.ZipException) IOUtils(org.apache.commons.io.IOUtils) Contract(org.jetbrains.annotations.Contract) FsSyncException(de.schlichtherle.truezip.fs.FsSyncException) java.io(java.io) de.schlichtherle.truezip.file(de.schlichtherle.truezip.file) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean) Patterns(com.codeforces.commons.text.Patterns) MutableBoolean(org.apache.commons.lang3.mutable.MutableBoolean) Charset(java.nio.charset.Charset) ZipException(net.lingala.zip4j.exception.ZipException) ByteArrayOutputStream(com.codeforces.commons.io.ByteArrayOutputStream) ZipFile(net.lingala.zip4j.core.ZipFile) FileHeader(net.lingala.zip4j.model.FileHeader) Nonnull(javax.annotation.Nonnull)

Example 48 with EMPTY

use of org.apache.commons.lang3.StringUtils.EMPTY in project nifi-registry by apache.

the class CryptoKeyLoader method extractKeyFromBootstrapFile.

/**
 * Returns the key (if any) used to encrypt sensitive properties.
 * The key extracted from the bootstrap.conf file at the specified location.
 *
 * @param bootstrapPath the path to the bootstrap file
 * @return the key in hexadecimal format, or {@link CryptoKeyProvider#EMPTY_KEY} if the key is null or empty
 * @throws IOException if the file is not readable
 */
public static String extractKeyFromBootstrapFile(String bootstrapPath) throws IOException {
    File bootstrapFile;
    if (StringUtils.isBlank(bootstrapPath)) {
        logger.error("Cannot read from bootstrap.conf file to extract encryption key; location not specified");
        throw new IOException("Cannot read from bootstrap.conf without file location");
    } else {
        bootstrapFile = new File(bootstrapPath);
    }
    String keyValue;
    if (bootstrapFile.exists() && bootstrapFile.canRead()) {
        try (Stream<String> stream = Files.lines(Paths.get(bootstrapFile.getAbsolutePath()))) {
            Optional<String> keyLine = stream.filter(l -> l.startsWith(BOOTSTRAP_KEY_PREFIX)).findFirst();
            if (keyLine.isPresent()) {
                keyValue = keyLine.get().split("=", 2)[1];
                keyValue = checkHexKey(keyValue);
            } else {
                keyValue = CryptoKeyProvider.EMPTY_KEY;
            }
        } catch (IOException e) {
            logger.error("Cannot read from bootstrap.conf file at {} to extract encryption key", bootstrapFile.getAbsolutePath());
            throw new IOException("Cannot read from bootstrap.conf", e);
        }
    } else {
        logger.error("Cannot read from bootstrap.conf file at {} to extract encryption key -- file is missing or permissions are incorrect", bootstrapFile.getAbsolutePath());
        throw new IOException("Cannot read from bootstrap.conf");
    }
    if (CryptoKeyProvider.EMPTY_KEY.equals(keyValue)) {
        logger.info("No encryption key present in the bootstrap.conf file at {}", bootstrapFile.getAbsolutePath());
    }
    return keyValue;
}
Also used : Logger(org.slf4j.Logger) Stream(java.util.stream.Stream) Files(java.nio.file.Files) Paths(java.nio.file.Paths) LoggerFactory(org.slf4j.LoggerFactory) Optional(java.util.Optional) IOException(java.io.IOException) StringUtils(org.apache.commons.lang3.StringUtils) File(java.io.File) IOException(java.io.IOException) File(java.io.File)

Example 49 with EMPTY

use of org.apache.commons.lang3.StringUtils.EMPTY in project timbuctoo by HuygensING.

the class TabularUpload method upload.

@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
@POST
public Response upload(@FormDataParam("file") final InputStream rdfInputStream, @FormDataParam("file") final FormDataBodyPart body, @FormDataParam("file") final FormDataContentDisposition fileInfo, @FormDataParam("fileMimeTypeOverride") final MediaType mimeTypeOverride, FormDataMultiPart formData, @HeaderParam("authorization") final String authHeader, @PathParam("userId") final String ownerId, @PathParam("dataSetId") final String dataSetId, @QueryParam("forceCreation") boolean forceCreation) throws DataStoreCreationException, FileStorageFailedException, ExecutionException, InterruptedException, LogStorageFailedException {
    final Either<Response, Response> result = authCheck.getOrCreate(authHeader, ownerId, dataSetId, forceCreation).flatMap(userAndDs -> authCheck.hasAdminAccess(userAndDs.getLeft(), userAndDs.getRight())).map(userAndDs -> {
        final MediaType mediaType = mimeTypeOverride == null ? body.getMediaType() : mimeTypeOverride;
        Optional<Loader> loader = LoaderFactory.createFor(mediaType.toString(), formData.getFields().entrySet().stream().filter(entry -> entry.getValue().size() > 0).filter(entry -> entry.getValue().get(0) != null).filter(entry -> MediaTypes.typeEqual(MediaType.TEXT_PLAIN_TYPE, entry.getValue().get(0).getMediaType())).collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get(0).getValue())));
        if (!loader.isPresent()) {
            return errorResponseHelper.error(400, "We do not support the mediatype '" + mediaType + "'. Make sure to add the correct mediatype to the file " + "parameter. In curl you'd use `-F \"file=@<filename>;type=<mediatype>\"`. In a webbrowser you probably " + "have no way of setting the correct mimetype. So you can use a special parameter to override it: " + "`formData.append(\"fileMimeTypeOverride\", \"<mimetype>\");`");
        }
        final DataSet dataSet = userAndDs.getRight();
        ImportManager importManager = dataSet.getImportManager();
        if (StringUtils.isBlank(fileInfo.getName())) {
            return Response.status(400).entity("filename cannot be empty.").build();
        }
        try {
            String fileToken = importManager.addFile(rdfInputStream, fileInfo.getFileName(), mediaType);
            Future<ImportStatus> promise = importManager.generateLog(dataSet.getMetadata().getBaseUri(), dataSet.getMetadata().getBaseUri(), new TabularRdfCreator(loader.get(), fileToken, fileInfo.getFileName()));
            return handleImportManagerResult(promise);
        } catch (FileStorageFailedException | LogStorageFailedException e) {
            LOG.error("Tabular upload failed", e);
            return Response.serverError().build();
        }
    });
    if (result.isLeft()) {
        return result.getLeft();
    } else {
        return result.get();
    }
}
Also used : PathParam(javax.ws.rs.PathParam) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) Produces(javax.ws.rs.Produces) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) LoggerFactory(org.slf4j.LoggerFactory) Path(javax.ws.rs.Path) FormDataMultiPart(org.glassfish.jersey.media.multipart.FormDataMultiPart) StringUtils(org.apache.commons.lang3.StringUtils) MediaType(javax.ws.rs.core.MediaType) Future(java.util.concurrent.Future) QueryParam(javax.ws.rs.QueryParam) Consumes(javax.ws.rs.Consumes) Map(java.util.Map) FormDataBodyPart(org.glassfish.jersey.media.multipart.FormDataBodyPart) HeaderParam(javax.ws.rs.HeaderParam) Loader(nl.knaw.huygens.timbuctoo.bulkupload.loaders.Loader) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) AuthCheck(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.auth.AuthCheck) Either(javaslang.control.Either) Logger(org.slf4j.Logger) POST(javax.ws.rs.POST) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataStoreCreationException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.DataStoreCreationException) LoaderFactory(nl.knaw.huygens.timbuctoo.bulkupload.loaders.LoaderFactory) Collectors(java.util.stream.Collectors) ErrorResponseHelper.handleImportManagerResult(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.ErrorResponseHelper.handleImportManagerResult) ExecutionException(java.util.concurrent.ExecutionException) MediaTypes(org.glassfish.jersey.message.internal.MediaTypes) FormDataParam(org.glassfish.jersey.media.multipart.FormDataParam) Response(javax.ws.rs.core.Response) FileStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.FileStorageFailedException) TabularRdfCreator(nl.knaw.huygens.timbuctoo.v5.bulkupload.TabularRdfCreator) Optional(java.util.Optional) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) InputStream(java.io.InputStream) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) Loader(nl.knaw.huygens.timbuctoo.bulkupload.loaders.Loader) FileStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.FileStorageFailedException) Response(javax.ws.rs.core.Response) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) MediaType(javax.ws.rs.core.MediaType) TabularRdfCreator(nl.knaw.huygens.timbuctoo.v5.bulkupload.TabularRdfCreator) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) POST(javax.ws.rs.POST)

Example 50 with EMPTY

use of org.apache.commons.lang3.StringUtils.EMPTY in project mule by mulesoft.

the class DefaultArchiveDeployer method deployPackagedArtifact.

@Override
public T deployPackagedArtifact(URI artifactAchivedUri, Optional<Properties> appProperties) throws DeploymentException {
    Optional<T> foundMatchingArtifact = empty();
    try {
        File artifactLocation = installArtifact(artifactAchivedUri);
        T artifact;
        try {
            artifact = createArtifact(artifactLocation, appProperties);
            trackArtifact(artifact);
        } catch (Throwable t) {
            String artifactName = artifactLocation.getName();
            // error text has been created by the deployer already
            logDeploymentFailure(t, artifactName);
            foundMatchingArtifact.ifPresent(a -> deploymentListener.onRedeploymentFailure(a.getArtifactName(), t));
            addZombieFile(artifactName, artifactLocation);
            deploymentListener.onDeploymentFailure(artifactName, t);
            throw t;
        }
        deployArtifact(artifact, appProperties);
        foundMatchingArtifact.ifPresent(a -> deploymentListener.onRedeploymentSuccess(a.getArtifactName()));
        return artifact;
    } catch (Throwable t) {
        foundMatchingArtifact.ifPresent(a -> deploymentListener.onRedeploymentFailure(a.getArtifactName(), t));
        if (t instanceof DeploymentException) {
            // re-throw
            throw ((DeploymentException) t);
        }
        final String msg = "Failed to deploy from URI: " + artifactAchivedUri;
        throw new DeploymentException(createStaticMessage(msg), t);
    }
}
Also used : ObservableList(org.mule.runtime.module.deployment.internal.util.ObservableList) Optional.empty(java.util.Optional.empty) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FileUtils.deleteDirectory(org.apache.commons.io.FileUtils.deleteDirectory) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) ExceptionUtils.containsType(org.mule.runtime.core.api.util.ExceptionUtils.containsType) DeploymentListener(org.mule.runtime.module.deployment.api.DeploymentListener) CollectionUtils.find(org.apache.commons.collections.CollectionUtils.find) URI(java.net.URI) MuleContextListenerFactory(org.mule.runtime.module.deployment.impl.internal.artifact.MuleContextListenerFactory) Properties(java.util.Properties) Logger(org.slf4j.Logger) Optional.ofNullable(java.util.Optional.ofNullable) I18nMessageFactory.createStaticMessage(org.mule.runtime.api.i18n.I18nMessageFactory.createStaticMessage) DeploymentStartException(org.mule.runtime.deployment.model.api.DeploymentStartException) Collection(java.util.Collection) DeploymentException(org.mule.runtime.deployment.model.api.DeploymentException) IOException(java.io.IOException) CollectionUtils.collect(org.apache.commons.collections.CollectionUtils.collect) StringUtils.removeEndIgnoreCase(org.apache.commons.lang3.StringUtils.removeEndIgnoreCase) String.format(java.lang.String.format) File(java.io.File) MuleFoldersUtil.getAppDataFolder(org.mule.runtime.container.api.MuleFoldersUtil.getAppDataFolder) DeploymentPropertiesUtils.resolveDeploymentProperties(org.mule.runtime.module.deployment.impl.internal.util.DeploymentPropertiesUtils.resolveDeploymentProperties) AbstractDeployableArtifactFactory(org.mule.runtime.module.deployment.impl.internal.artifact.AbstractDeployableArtifactFactory) DeployableArtifact(org.mule.runtime.deployment.model.api.DeployableArtifact) List(java.util.List) BeanPropertyValueEqualsPredicate(org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate) Optional(java.util.Optional) ArtifactFactory(org.mule.runtime.module.deployment.impl.internal.artifact.ArtifactFactory) SplashScreen.miniSplash(org.mule.runtime.core.internal.util.splash.SplashScreen.miniSplash) BeanToPropertyValueTransformer(org.apache.commons.beanutils.BeanToPropertyValueTransformer) Arrays.stream(java.util.Arrays.stream) DeploymentException(org.mule.runtime.deployment.model.api.DeploymentException) File(java.io.File)

Aggregations

List (java.util.List)44 Map (java.util.Map)42 ArrayList (java.util.ArrayList)41 StringUtils (org.apache.commons.lang3.StringUtils)38 Collectors (java.util.stream.Collectors)37 HashMap (java.util.HashMap)33 IOException (java.io.IOException)27 Set (java.util.Set)25 HashSet (java.util.HashSet)22 LoggerFactory (org.slf4j.LoggerFactory)22 Pair (org.apache.commons.lang3.tuple.Pair)20 Logger (org.slf4j.Logger)20 Optional (java.util.Optional)19 Collections (java.util.Collections)17 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)17 java.util (java.util)15 Arrays.asList (java.util.Arrays.asList)14 Collection (java.util.Collection)14 Stream (java.util.stream.Stream)14 Arrays (java.util.Arrays)12