public class MavenRepositoryRequestInfo extends Object implements RepositoryRequestInfo
Constructor and Description |
---|
MavenRepositoryRequestInfo(ManagedRepository repository) |
Modifier and Type | Method and Description |
---|---|
<T extends RepositoryFeature<T>> |
getFeature(Class<T> clazz)
Extension method that allows to provide different features that are not supported by all
repository types.
|
String |
getLayout(String requestPath)
Returns the likely layout type for the given request.
|
boolean |
isArchetypeCatalog(String requestedPath)
Returns true, if the given request points to a archetype catalog.
|
boolean |
isMetadata(String requestedPath)
Tests the path to see if it conforms to the expectations of a metadata request.
|
boolean |
isMetadataSupportFile(String requestedPath)
Tests the path to see if it conforms to the expectations of a support file request of the metadata file.
|
boolean |
isSupportFile(String requestedPath)
Tests the path to see if it conforms to the expectations of a support file request.
|
<T extends RepositoryFeature<T>> |
supportsFeature(Class<T> clazz)
Returns true, if the requested feature is supported by this repository.
|
ArtifactReference |
toArtifactReference(String requestedPath)
Takes an incoming requested path (in "/" format) and gleans the layout
and ArtifactReference appropriate for that content.
|
String |
toNativePath(String requestedPath)
Adjust the requestedPath to conform to the native layout of the provided
ManagedRepositoryContent . |
public MavenRepositoryRequestInfo(ManagedRepository repository)
public ArtifactReference toArtifactReference(String requestedPath) throws LayoutException
toArtifactReference
in interface RepositoryRequestInfo
requestedPath
- the relative path to the content.LayoutException
- if the request path is not layout valid.public boolean isMetadata(String requestedPath)
Tests the path to see if it conforms to the expectations of a metadata request.
NOTE: This does a cursory check on the path's last element. A result of true from this method is not a guarantee that the metadata is in a valid format, or that it even contains data.
isMetadata
in interface RepositoryRequestInfo
requestedPath
- the path to test.public boolean isArchetypeCatalog(String requestedPath)
RepositoryRequestInfo
isArchetypeCatalog
in interface RepositoryRequestInfo
requestedPath
- public boolean isSupportFile(String requestedPath)
Tests the path to see if it conforms to the expectations of a support file request.
Tests for .sha1
, .md5
, .asc
, and .php
.
NOTE: This does a cursory check on the path's extension only. A result of true from this method is not a guarantee that the support resource is in a valid format, or that it even contains data.
isSupportFile
in interface RepositoryRequestInfo
requestedPath
- the path to test.public boolean isMetadataSupportFile(String requestedPath)
RepositoryRequestInfo
Tests the path to see if it conforms to the expectations of a support file request of the metadata file.
May test for certain extensions like .sha1
, .md5
, .asc
, and .php
.
NOTE: The implementation may do only a cursory check on the path's extension. A result of true from this method is not a guarantee that the support resource is in a valid format, or that it even contains data.
isMetadataSupportFile
in interface RepositoryRequestInfo
requestedPath
- the path to test.public String getLayout(String requestPath)
RepositoryRequestInfo
RepositoryRequestInfo.toArtifactReference(String)
getLayout
in interface RepositoryRequestInfo
public String toNativePath(String requestedPath) throws LayoutException
ManagedRepositoryContent
.toNativePath
in interface RepositoryRequestInfo
requestedPath
- the incoming requested path.LayoutException
- if the path cannot be parsed.public <T extends RepositoryFeature<T>> RepositoryFeature<T> getFeature(Class<T> clazz) throws UnsupportedFeatureException
RepositoryRequestInfo
getFeature
in interface RepositoryRequestInfo
T
- This is the class of the featureclazz
- The feature class that is requestedUnsupportedFeatureException
- if the feature is not supported by this repository typepublic <T extends RepositoryFeature<T>> boolean supportsFeature(Class<T> clazz)
RepositoryRequestInfo
supportsFeature
in interface RepositoryRequestInfo
T
- The requested feature classclazz
- The requested feature classCopyright © 2006–2019 The Apache Software Foundation. All rights reserved.