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

java.lang.Object
  extended by org.apache.archiva.repository.content.maven2.RepositoryRequest

public class RepositoryRequest
extends Object

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


Field Summary
private  PathParser defaultPathParser
           
private  PathParser legacyPathParser
           
 
Constructor Summary
RepositoryRequest(LegacyPathParser legacyPathParser)
           
 
Method Summary
 boolean isArchetypeCatalog(String requestedPath)
           
 boolean isDefault(String requestedPath)
           Tests the path to see if it conforms to the expectations of a default layout request.
 boolean isLegacy(String requestedPath)
           Tests the path to see if it conforms to the expectations of a legacy layout request.
 boolean isMetadata(String requestedPath)
           Tests the path to see if it conforms to the expectations of a metadata request.
 boolean isMetadataSupportFile(String requestedPath)
           
 boolean isSupportFile(String requestedPath)
           Tests the path to see if it conforms to the expectations of a support file request.
 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, 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
 

Field Detail

defaultPathParser

private PathParser defaultPathParser

legacyPathParser

private PathParser legacyPathParser
Constructor Detail

RepositoryRequest

public RepositoryRequest(LegacyPathParser legacyPathParser)
Method Detail

toArtifactReference

public ArtifactReference toArtifactReference(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(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.

isArchetypeCatalog

public boolean isArchetypeCatalog(String requestedPath)
Parameters:
requestedPath -
Returns:
true if the requestedPath is likely an archetype catalog request.

isSupportFile

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.

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

isMetadataSupportFile

public boolean isMetadataSupportFile(String requestedPath)

isDefault

public boolean isDefault(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(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 String toNativePath(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.


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.