ManagedRepository getRepository(); | ManagedRepository getRepository(); | ||||
/** | |||||
* <p> | |||||
* Given a specific {@link VersionedReference}, return the list of available versions for that | |||||
* versioned reference. | |||||
* </p> | |||||
* <p> | |||||
* <strong>NOTE:</strong> This is really only useful when working with SNAPSHOTs. | |||||
* </p> | |||||
* | |||||
* @param reference the versioned reference to work off of. | |||||
* @return the set of versions found. | |||||
* @throws ContentNotFoundException if the versioned reference does not exist within the repository. | |||||
*/ | |||||
Set<String> getVersions( VersionedReference reference ) | |||||
throws ContentNotFoundException, ContentAccessException, LayoutException; | |||||
/** | /** | ||||
* Determines if the artifact referenced exists in the repository. | * Determines if the artifact referenced exists in the repository. | ||||
* | * |
import java.nio.file.Path; | import java.nio.file.Path; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Set; | |||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
/** | /** | ||||
return repository; | return repository; | ||||
} | } | ||||
@Override | |||||
public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException, LayoutException | |||||
{ | |||||
return null; | |||||
} | |||||
@Override | @Override | ||||
public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | ||||
{ | { |
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | |||||
import java.util.regex.Matcher; | import java.util.regex.Matcher; | ||||
import java.util.regex.Pattern; | import java.util.regex.Pattern; | ||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
return repository; | return repository; | ||||
} | } | ||||
@Override | |||||
public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException, LayoutException | |||||
{ | |||||
return null; | |||||
} | |||||
@Override | @Override | ||||
public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | ||||
{ | { |
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.Set; | |||||
import java.util.regex.Matcher; | import java.util.regex.Matcher; | ||||
import java.util.regex.Pattern; | import java.util.regex.Pattern; | ||||
import java.util.stream.Stream; | import java.util.stream.Stream; | ||||
return repository; | return repository; | ||||
} | } | ||||
@Override | |||||
public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException, LayoutException | |||||
{ | |||||
return null; | |||||
} | |||||
@Override | @Override | ||||
public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | ||||
{ | { |
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
import java.util.Optional; | import java.util.Optional; | ||||
import java.util.Set; | |||||
import java.util.function.Predicate; | import java.util.function.Predicate; | ||||
import java.util.regex.Matcher; | import java.util.regex.Matcher; | ||||
import java.util.regex.Pattern; | import java.util.regex.Pattern; | ||||
return repository; | return repository; | ||||
} | } | ||||
@Override | |||||
public Set<String> getVersions( VersionedReference reference ) | |||||
throws ContentNotFoundException, ContentAccessException, LayoutException | |||||
{ | |||||
try(Stream<ArtifactReference> stream = newArtifactStream( reference )) | |||||
{ | |||||
return stream.filter( Objects::nonNull ) | |||||
.map( ar -> ar.getVersion( ) ) | |||||
.collect( Collectors.toSet( ) ); | |||||
} catch (IOException e) { | |||||
final String path = toPath( reference ); | |||||
log.error("Could not read directory from repository {} - {}: ", getId(), path, e.getMessage(), e); | |||||
throw new ContentAccessException( "Could not read path for repository "+getId()+": "+ path, e ); | |||||
} | |||||
} | |||||
@Override | @Override | ||||
public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | public boolean hasContent( ArtifactReference reference ) throws ContentAccessException | ||||
{ | { |