This project has retired. For details please refer to its Attic page.
RepositoryRequest

org.apache.maven.archiva.repository.content
Class RepositoryRequest

Package class diagram package RepositoryRequest
java.lang.Object
  extended by org.apache.maven.archiva.repository.content.RepositoryRequest

public class RepositoryRequest
extends java.lang.Object

RepositoryRequest is used to determine the type of request that is incoming, and convert it to an appropriate ArtifactReference.


Constructor Summary
RepositoryRequest()
           
 
Method Summary
 boolean isDefault(java.lang.String requestedPath)
           Tests the path to see if it conforms to the expectations of a default layout request.
 boolean isLegacy(java.lang.String requestedPath)
           Tests the path to see if it conforms to the expectations of a legacy layout request.
 boolean isMetadata(java.lang.String requestedPath)
           Tests the path to see if it conforms to the expectations of a metadata request.
 boolean isMetadataSupportFile(java.lang.String requestedPath)
           
 boolean isSupportFile(java.lang.String requestedPath)
           Tests the path to see if it conforms to the expectations of a support file request.
 org.apache.maven.archiva.model.ArtifactReference toArtifactReference(java.lang.String requestedPath)
          Takes an incoming requested path (in "/" format) and gleans the layout and ArtifactReference appropriate for that content.
 java.lang.String toNativePath(java.lang.String requestedPath, ManagedRepositoryContent repository)
          Adjust the requestedPath to conform to the native layout of the provided ManagedRepositoryContent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryRequest

public RepositoryRequest()
Method Detail

toArtifactReference

public org.apache.maven.archiva.model.ArtifactReference toArtifactReference(java.lang.String requestedPath)
                                                                     throws LayoutException
Takes an incoming requested path (in "/" format) and gleans the layout and ArtifactReference appropriate for that content.

Parameters:
requestedPath - the relative path to the content.
Returns:
the ArtifactReference for the requestedPath.
Throws:
LayoutException - if the request path is not layout valid.

isMetadata

public boolean isMetadata(java.lang.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.

Parameters:
requestedPath - the path to test.
Returns:
true if the requestedPath is likely a metadata request.

isSupportFile

public boolean isSupportFile(java.lang.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.

Parameters:
requestedPath - the path to test.
Returns:
true if the requestedPath is likely that of a support file request.

isMetadataSupportFile

public boolean isMetadataSupportFile(java.lang.String requestedPath)

isDefault

public boolean isDefault(java.lang.String requestedPath)

Tests the path to see if it conforms to the expectations of a default layout request.

NOTE: This does a cursory check on the count of path elements only. A result of true from this method is not a guarantee that the path sections are valid and can be resolved to an artifact reference. use toArtifactReference(String) if you want a more complete analysis of the validity of the path.

Parameters:
requestedPath - the path to test.
Returns:
true if the requestedPath is likely that of a default layout request.

isLegacy

public boolean isLegacy(java.lang.String requestedPath)

Tests the path to see if it conforms to the expectations of a legacy layout request.

NOTE: This does a cursory check on the count of path elements only. A result of true from this method is not a guarantee that the path sections are valid and can be resolved to an artifact reference. use toArtifactReference(String) if you want a more complete analysis of the validity of the path.

Parameters:
requestedPath - the path to test.
Returns:
true if the requestedPath is likely that of a legacy layout request.

toNativePath

public java.lang.String toNativePath(java.lang.String requestedPath,
                                     ManagedRepositoryContent repository)
                              throws LayoutException
Adjust the requestedPath to conform to the native layout of the provided ManagedRepositoryContent.

Parameters:
requestedPath - the incoming requested path.
repository - the repository to adjust to.
Returns:
the adjusted (to native) path.
Throws:
LayoutException - if the path cannot be parsed.