org.apache.maven.index.artifact
Class M2GavCalculator

java.lang.Object
  extended by org.apache.maven.index.artifact.M2GavCalculator
All Implemented Interfaces:
GavCalculator

@Component(role=GavCalculator.class,
           hint="maven2")
public class M2GavCalculator
extends Object
implements GavCalculator

An M2 GavCalculator.

Author:
Jason van Zyl, Tamas Cservenak

Constructor Summary
M2GavCalculator()
           
 
Method Summary
 String calculateArtifactName(Gav gav)
           
 String gavToPath(Gav gav)
          Reassembles the repository path from the supplied GAV.
 Gav pathToGav(String str)
          Calculates GAV from provided repository path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

M2GavCalculator

public M2GavCalculator()
Method Detail

pathToGav

public Gav pathToGav(String str)
Description copied from interface: GavCalculator
Calculates GAV from provided repository path. The path has to be absolute starting from repository root. If path represents a proper artifact path (conforming to given layout), GAV is "calculated" from it and is returned. If path represents some file that is not an artifact, but is part of the repository layout (like maven-metadata.xml), or in any other case it returns null. TODO: some place for different levels of "validation"?

Specified by:
pathToGav in interface GavCalculator
Parameters:
str - the repository path
Returns:
Gav parsed from the path

gavToPath

public String gavToPath(Gav gav)
Description copied from interface: GavCalculator
Reassembles the repository path from the supplied GAV. It will be an absolute path.

Specified by:
gavToPath in interface GavCalculator
Returns:
the path calculated from GAV, obeying current layout.

calculateArtifactName

public String calculateArtifactName(Gav gav)


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.