Search in sources :

Example 26 with Files

use of java.nio.file.Files in project archiva by apache.

the class Maven2RepositoryStorage method readArtifactsMetadata.

@Override
public Collection<ArtifactMetadata> readArtifactsMetadata(ReadMetadataRequest readMetadataRequest) throws RepositoryStorageRuntimeException {
    Path dir = pathTranslator.toFile(getRepositoryBasedir(readMetadataRequest.getRepositoryId()), readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion());
    if (!(Files.exists(dir) && Files.isDirectory(dir))) {
        return Collections.emptyList();
    }
    // all files that are not metadata and not a checksum / signature are considered artifacts
    final Predicate<Path> dFilter = new ArtifactDirectoryFilter(readMetadataRequest.getFilter());
    try (Stream<Path> stream = Files.list(dir)) {
        // Returns a map TRUE -> (success values), FALSE -> (Exceptions)
        Map<Boolean, List<Try<ArtifactMetadata>>> result = stream.filter(dFilter).map(path -> {
            try {
                return Try.success(getArtifactFromFile(readMetadataRequest.getRepositoryId(), readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), readMetadataRequest.getProjectVersion(), path));
            } catch (Exception e) {
                LOGGER.debug("Could not create metadata for {}:  {}", path, e.getMessage(), e);
                return Try.<ArtifactMetadata>failure(e);
            }
        }).collect(Collectors.groupingBy(Try::isSuccess));
        if (result.containsKey(Boolean.FALSE) && result.get(Boolean.FALSE).size() > 0 && (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE).size() == 0)) {
            LOGGER.error("Could not get artifact metadata. Directory: {}. Number of errors {}.", dir, result.get(Boolean.FALSE).size());
            Try<ArtifactMetadata> failure = result.get(Boolean.FALSE).get(0);
            LOGGER.error("Sample exception {}", failure.getError().getMessage(), failure.getError());
            throw new RepositoryStorageRuntimeException(readMetadataRequest.getRepositoryId(), "Could not retrieve metadata of the files");
        } else {
            if (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE) == null) {
                return Collections.emptyList();
            }
            return result.get(Boolean.TRUE).stream().map(tr -> tr.get()).collect(Collectors.toList());
        }
    } catch (IOException e) {
        LOGGER.error("Could not read directory {}: {}", dir, e.getMessage(), e);
    }
    return Collections.emptyList();
}
Also used : Path(java.nio.file.Path) StringUtils(org.apache.commons.lang.StringUtils) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) ArchivaRepositoryMetadata(org.apache.archiva.model.ArchivaRepositoryMetadata) Date(java.util.Date) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) LoggerFactory(org.slf4j.LoggerFactory) RepositoryProxyConnectors(org.apache.archiva.proxy.model.RepositoryProxyConnectors) DefaultModelBuilderFactory(org.apache.maven.model.building.DefaultModelBuilderFactory) XMLException(org.apache.archiva.xml.XMLException) RepositoryProblemFacet(org.apache.archiva.metadata.model.facets.RepositoryProblemFacet) ReleaseScheme(org.apache.archiva.repository.ReleaseScheme) NetworkProxyAdmin(org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin) ModelBuilder(org.apache.maven.model.building.ModelBuilder) PathParser(org.apache.archiva.repository.content.PathParser) Map(java.util.Map) ProjectMetadata(org.apache.archiva.metadata.model.ProjectMetadata) Path(java.nio.file.Path) ProxyConnectorAdmin(org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin) Try(org.apache.archiva.common.Try) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) Predicate(java.util.function.Predicate) Collection(java.util.Collection) RepositoryRegistry(org.apache.archiva.repository.RepositoryRegistry) ProxyDownloadException(org.apache.archiva.policies.ProxyDownloadException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) ProxyConnector(org.apache.archiva.admin.model.beans.ProxyConnector) Filter(org.apache.archiva.metadata.repository.filter.Filter) Reader(java.io.Reader) Collectors(java.util.stream.Collectors) Scm(org.apache.maven.model.Scm) FileNotFoundException(java.io.FileNotFoundException) ManagedRepository(org.apache.archiva.repository.ManagedRepository) Relocation(org.apache.maven.model.Relocation) Organization(org.apache.maven.model.Organization) List(java.util.List) DistributionManagement(org.apache.maven.model.DistributionManagement) Stream(java.util.stream.Stream) ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) ModelBuildingRequest(org.apache.maven.model.building.ModelBuildingRequest) PostConstruct(javax.annotation.PostConstruct) ArtifactReference(org.apache.archiva.model.ArtifactReference) MavenXpp3Reader(org.apache.maven.model.io.xpp3.MavenXpp3Reader) Model(org.apache.maven.model.Model) RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) CiManagement(org.apache.maven.model.CiManagement) NetworkProxy(org.apache.archiva.admin.model.beans.NetworkProxy) RepositoryPathTranslator(org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator) RelocationException(org.apache.archiva.metadata.repository.storage.RelocationException) Dependency(org.apache.maven.model.Dependency) HashMap(java.util.HashMap) WagonFactory(org.apache.archiva.proxy.common.WagonFactory) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) RemoteRepository(org.apache.archiva.repository.RemoteRepository) Charset(java.nio.charset.Charset) Service(org.springframework.stereotype.Service) ChecksumAlgorithm(org.apache.archiva.checksum.ChecksumAlgorithm) MavenMetadataReader(org.apache.archiva.maven2.metadata.MavenMetadataReader) Named(javax.inject.Named) LayoutException(org.apache.archiva.repository.LayoutException) IssueManagement(org.apache.maven.model.IssueManagement) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) SnapshotVersion(org.apache.archiva.model.SnapshotVersion) Logger(org.slf4j.Logger) Files(java.nio.file.Files) ModelBuildingException(org.apache.maven.model.building.ModelBuildingException) VersionUtil(org.apache.archiva.common.utils.VersionUtil) IOException(java.io.IOException) License(org.apache.maven.model.License) ApplicationContext(org.springframework.context.ApplicationContext) ChecksummedFile(org.apache.archiva.checksum.ChecksummedFile) ModelProblem(org.apache.maven.model.building.ModelProblem) RepositoryStorageMetadataInvalidException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException) Paths(java.nio.file.Paths) DefaultModelBuildingRequest(org.apache.maven.model.building.DefaultModelBuildingRequest) MailingList(org.apache.maven.model.MailingList) Collections(java.util.Collections) RepositoryStorage(org.apache.archiva.metadata.repository.storage.RepositoryStorage) ArrayUtils(org.apache.commons.lang.ArrayUtils) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) IOException(java.io.IOException) NoSuchFileException(java.nio.file.NoSuchFileException) RepositoryStorageRuntimeException(org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException) XMLException(org.apache.archiva.xml.XMLException) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) ProxyDownloadException(org.apache.archiva.policies.ProxyDownloadException) XmlPullParserException(org.codehaus.plexus.util.xml.pull.XmlPullParserException) FileNotFoundException(java.io.FileNotFoundException) RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) RelocationException(org.apache.archiva.metadata.repository.storage.RelocationException) LayoutException(org.apache.archiva.repository.LayoutException) ModelBuildingException(org.apache.maven.model.building.ModelBuildingException) IOException(java.io.IOException) RepositoryStorageMetadataInvalidException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException) List(java.util.List) ArrayList(java.util.ArrayList) MailingList(org.apache.maven.model.MailingList) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata)

Example 27 with Files

use of java.nio.file.Files in project archiva by apache.

the class FileMetadataRepository method getProjects.

@Override
public Collection<String> getProjects(String repoId, String namespace) throws MetadataResolutionException {
    try {
        List<String> projects;
        Path directory = getDirectory(repoId).resolve(namespace);
        if (!(Files.exists(directory) && Files.isDirectory(directory))) {
            return Collections.emptyList();
        }
        final String searchFile = PROJECT_METADATA_KEY + ".properties";
        try (Stream<Path> fs = Files.list(directory)) {
            projects = fs.filter(Files::isDirectory).filter(path -> Files.exists(path.resolve(searchFile))).map(path -> path.getFileName().toString()).collect(Collectors.toList());
        }
        return projects;
    } catch (IOException e) {
        throw new MetadataResolutionException(e.getMessage(), e);
    }
}
Also used : Path(java.nio.file.Path) MetadataFacet(org.apache.archiva.metadata.model.MetadataFacet) MailingList(org.apache.archiva.metadata.model.MailingList) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) StringTokenizer(java.util.StringTokenizer) Map(java.util.Map) ProjectMetadata(org.apache.archiva.metadata.model.ProjectMetadata) Organization(org.apache.archiva.metadata.model.Organization) Scm(org.apache.archiva.metadata.model.Scm) Path(java.nio.file.Path) LinkedHashSet(java.util.LinkedHashSet) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata) OutputStream(java.io.OutputStream) ProjectVersionReference(org.apache.archiva.metadata.model.ProjectVersionReference) Logger(org.slf4j.Logger) Properties(java.util.Properties) Files(java.nio.file.Files) Collection(java.util.Collection) Set(java.util.Set) ManagedRepositoryConfiguration(org.apache.archiva.configuration.ManagedRepositoryConfiguration) CiManagement(org.apache.archiva.metadata.model.CiManagement) IOException(java.io.IOException) IssueManagement(org.apache.archiva.metadata.model.IssueManagement) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) MetadataResolutionException(org.apache.archiva.metadata.repository.MetadataResolutionException) List(java.util.List) Stream(java.util.stream.Stream) FileVisitOption(java.nio.file.FileVisitOption) Paths(java.nio.file.Paths) License(org.apache.archiva.metadata.model.License) Dependency(org.apache.archiva.metadata.model.Dependency) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) Comparator(java.util.Comparator) Collections(java.util.Collections) MetadataRepositoryException(org.apache.archiva.metadata.repository.MetadataRepositoryException) InputStream(java.io.InputStream) IOException(java.io.IOException) Files(java.nio.file.Files) MetadataResolutionException(org.apache.archiva.metadata.repository.MetadataResolutionException)

Example 28 with Files

use of java.nio.file.Files in project archiva by apache.

the class FileMetadataRepository method getMetadataFacets.

@Override
public List<String> getMetadataFacets(String repoId, String facetId) throws MetadataRepositoryException {
    try {
        Path directory = getMetadataDirectory(repoId, facetId);
        if (!(Files.exists(directory) && Files.isDirectory(directory))) {
            return Collections.emptyList();
        }
        List<String> facets;
        final String searchFile = METADATA_KEY + ".properties";
        try (Stream<Path> fs = Files.walk(directory, FileVisitOption.FOLLOW_LINKS)) {
            facets = fs.filter(Files::isDirectory).filter(path -> Files.exists(path.resolve(searchFile))).map(path -> directory.relativize(path).toString()).collect(Collectors.toList());
        }
        return facets;
    } catch (IOException e) {
        throw new MetadataRepositoryException(e.getMessage(), e);
    }
}
Also used : Path(java.nio.file.Path) MetadataFacet(org.apache.archiva.metadata.model.MetadataFacet) MailingList(org.apache.archiva.metadata.model.MailingList) NoSuchFileException(java.nio.file.NoSuchFileException) Arrays(java.util.Arrays) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) StringTokenizer(java.util.StringTokenizer) Map(java.util.Map) ProjectMetadata(org.apache.archiva.metadata.model.ProjectMetadata) Organization(org.apache.archiva.metadata.model.Organization) Scm(org.apache.archiva.metadata.model.Scm) Path(java.nio.file.Path) LinkedHashSet(java.util.LinkedHashSet) ArtifactMetadata(org.apache.archiva.metadata.model.ArtifactMetadata) OutputStream(java.io.OutputStream) ProjectVersionReference(org.apache.archiva.metadata.model.ProjectVersionReference) Logger(org.slf4j.Logger) Properties(java.util.Properties) Files(java.nio.file.Files) Collection(java.util.Collection) Set(java.util.Set) ManagedRepositoryConfiguration(org.apache.archiva.configuration.ManagedRepositoryConfiguration) CiManagement(org.apache.archiva.metadata.model.CiManagement) IOException(java.io.IOException) IssueManagement(org.apache.archiva.metadata.model.IssueManagement) Collectors(java.util.stream.Collectors) FileNotFoundException(java.io.FileNotFoundException) MetadataResolutionException(org.apache.archiva.metadata.repository.MetadataResolutionException) List(java.util.List) Stream(java.util.stream.Stream) FileVisitOption(java.nio.file.FileVisitOption) Paths(java.nio.file.Paths) License(org.apache.archiva.metadata.model.License) Dependency(org.apache.archiva.metadata.model.Dependency) MetadataFacetFactory(org.apache.archiva.metadata.model.MetadataFacetFactory) Comparator(java.util.Comparator) Collections(java.util.Collections) MetadataRepositoryException(org.apache.archiva.metadata.repository.MetadataRepositoryException) InputStream(java.io.InputStream) MetadataRepositoryException(org.apache.archiva.metadata.repository.MetadataRepositoryException) IOException(java.io.IOException) Files(java.nio.file.Files)

Example 29 with Files

use of java.nio.file.Files in project archiva by apache.

the class ManagedDefaultRepositoryContent method getVersions.

/**
 * Gather the Available Versions (on disk) for a specific Project Reference, based on filesystem
 * information.
 *
 * @return the Set of available versions, based on the project reference.
 * @throws LayoutException
 * @throws LayoutException
 */
@Override
public Set<String> getVersions(ProjectReference reference) throws ContentNotFoundException, LayoutException {
    String path = toMetadataPath(reference);
    int idx = path.lastIndexOf('/');
    if (idx > 0) {
        path = path.substring(0, idx);
    }
    Path repoDir = PathUtil.getPathFromUri(repository.getLocation()).resolve(path);
    if (!Files.exists(repoDir)) {
        throw new ContentNotFoundException("Unable to get Versions on a non-existant directory: " + repoDir.toAbsolutePath());
    }
    if (!Files.isDirectory(repoDir)) {
        throw new ContentNotFoundException("Unable to get Versions on a non-directory: " + repoDir.toAbsolutePath());
    }
    final String groupId = reference.getGroupId();
    final String artifactId = reference.getArtifactId();
    try (Stream<Path> stream = Files.list(repoDir)) {
        return stream.filter(Files::isDirectory).map(p -> newVersionedRef(groupId, artifactId, p.getFileName().toString())).filter(this::hasArtifact).map(ref -> ref.getVersion()).collect(Collectors.toSet());
    } catch (IOException e) {
        log.error("Could not read directory {}: {}", repoDir, e.getMessage(), e);
    } catch (RuntimeException e) {
        if (e.getCause() != null && e.getCause() instanceof LayoutException) {
            throw (LayoutException) e.getCause();
        } else {
            throw e;
        }
    }
    return Collections.emptySet();
}
Also used : Path(java.nio.file.Path) StringUtils(org.apache.commons.lang.StringUtils) PathUtil(org.apache.archiva.common.utils.PathUtil) ArtifactMappingProvider(org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider) DefaultArtifactMappingProvider(org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider) ProjectReference(org.apache.archiva.model.ProjectReference) HashSet(java.util.HashSet) URI(java.net.URI) LayoutException(org.apache.archiva.repository.LayoutException) Path(java.nio.file.Path) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) VersionedReference(org.apache.archiva.model.VersionedReference) Files(java.nio.file.Files) RepositoryException(org.apache.archiva.repository.RepositoryException) Set(java.util.Set) FileTypes(org.apache.archiva.configuration.FileTypes) IOException(java.io.IOException) ContentNotFoundException(org.apache.archiva.repository.ContentNotFoundException) ArchivaArtifact(org.apache.archiva.model.ArchivaArtifact) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Stream(java.util.stream.Stream) Paths(java.nio.file.Paths) ArtifactReference(org.apache.archiva.model.ArtifactReference) Collections(java.util.Collections) ContentNotFoundException(org.apache.archiva.repository.ContentNotFoundException) LayoutException(org.apache.archiva.repository.LayoutException) IOException(java.io.IOException) Files(java.nio.file.Files)

Example 30 with Files

use of java.nio.file.Files in project archiva by apache.

the class MetadataTools method getFirstArtifact.

/**
 * Get the first Artifact found in the provided VersionedReference location.
 *
 * @param managedRepository the repository to search within.
 * @param reference         the reference to the versioned reference to search within
 * @return the ArtifactReference to the first artifact located within the versioned reference. or null if
 *         no artifact was found within the versioned reference.
 * @throws IOException     if the versioned reference is invalid (example: doesn't exist, or isn't a directory)
 * @throws LayoutException
 */
public ArtifactReference getFirstArtifact(ManagedRepositoryContent managedRepository, VersionedReference reference) throws LayoutException, IOException {
    String path = toPath(reference);
    int idx = path.lastIndexOf('/');
    if (idx > 0) {
        path = path.substring(0, idx);
    }
    Path repoDir = Paths.get(managedRepository.getRepoRoot(), path);
    if (!Files.exists(repoDir)) {
        throw new IOException("Unable to gather the list of snapshot versions on a non-existant directory: " + repoDir.toAbsolutePath());
    }
    if (!Files.isDirectory(repoDir)) {
        throw new IOException("Unable to gather the list of snapshot versions on a non-directory: " + repoDir.toAbsolutePath());
    }
    try (Stream<Path> stream = Files.list(repoDir)) {
        String result = stream.filter(Files::isRegularFile).map(path1 -> PathUtil.getRelative(managedRepository.getRepoRoot(), path1)).filter(filetypes::matchesArtifactPattern).findFirst().orElse(null);
        if (result != null) {
            return managedRepository.toArtifactReference(result);
        }
    }
    // No artifact was found.
    return null;
}
Also used : Path(java.nio.file.Path) StringUtils(org.apache.commons.lang.StringUtils) Arrays(java.util.Arrays) ArchivaRepositoryMetadata(org.apache.archiva.model.ArchivaRepositoryMetadata) PathUtil(org.apache.archiva.common.utils.PathUtil) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) XMLException(org.apache.archiva.xml.XMLException) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) Registry(org.apache.archiva.redback.components.registry.Registry) NumberUtils(org.apache.commons.lang.math.NumberUtils) RegistryListener(org.apache.archiva.redback.components.registry.RegistryListener) Matcher(java.util.regex.Matcher) ProxyConnectorConfiguration(org.apache.archiva.configuration.ProxyConnectorConfiguration) Map(java.util.Map) FileUtils(org.apache.archiva.common.utils.FileUtils) ParseException(java.text.ParseException) Path(java.nio.file.Path) RemoteRepositoryContent(org.apache.archiva.repository.RemoteRepositoryContent) ConfigurationNames(org.apache.archiva.configuration.ConfigurationNames) VersionedReference(org.apache.archiva.model.VersionedReference) Collection(java.util.Collection) Set(java.util.Set) ContentNotFoundException(org.apache.archiva.repository.ContentNotFoundException) Plugin(org.apache.archiva.model.Plugin) List(java.util.List) Stream(java.util.stream.Stream) PostConstruct(javax.annotation.PostConstruct) ArtifactReference(org.apache.archiva.model.ArtifactReference) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) ProjectReference(org.apache.archiva.model.ProjectReference) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) HashSet(java.util.HashSet) DateUtils(org.apache.commons.lang.time.DateUtils) Calendar(java.util.Calendar) Service(org.springframework.stereotype.Service) ChecksumAlgorithm(org.apache.archiva.checksum.ChecksumAlgorithm) MavenMetadataReader(org.apache.archiva.maven2.metadata.MavenMetadataReader) Named(javax.inject.Named) LayoutException(org.apache.archiva.repository.LayoutException) VersionComparator(org.apache.archiva.common.utils.VersionComparator) LinkedHashSet(java.util.LinkedHashSet) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) SnapshotVersion(org.apache.archiva.model.SnapshotVersion) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) Files(java.nio.file.Files) VersionUtil(org.apache.archiva.common.utils.VersionUtil) FileTypes(org.apache.archiva.configuration.FileTypes) IOException(java.io.IOException) ChecksummedFile(org.apache.archiva.checksum.ChecksummedFile) Paths(java.nio.file.Paths) Collections(java.util.Collections) IOException(java.io.IOException) Files(java.nio.file.Files)

Aggregations

Files (java.nio.file.Files)247 IOException (java.io.IOException)213 Path (java.nio.file.Path)199 List (java.util.List)177 Collectors (java.util.stream.Collectors)157 Paths (java.nio.file.Paths)135 File (java.io.File)130 ArrayList (java.util.ArrayList)117 Map (java.util.Map)111 Set (java.util.Set)97 Collections (java.util.Collections)89 Arrays (java.util.Arrays)81 Stream (java.util.stream.Stream)78 HashMap (java.util.HashMap)75 HashSet (java.util.HashSet)58 InputStream (java.io.InputStream)56 Collection (java.util.Collection)55 Logger (org.slf4j.Logger)54 Pattern (java.util.regex.Pattern)53 Optional (java.util.Optional)51