// we need maven repository for this operation, but we actually don't care is this
// maven2 or mave1 repository! Let's handle this in generic way.
MavenRepository mavenRepository = itemRepository.adaptToFacet(MavenRepository.class);
// use maven repository's corresponding GavCalculator instead of "wired in" one!
Gav gav = mavenRepository.getGavCalculator().pathToGav(itemPath);
if (gav == null || gav.isSignature() || gav.isHash()) {
// if we cannot calculate the gav, it is not a maven artifact (or hash/sig), return null;
return null;
}
// if we are here, we have GAV, so just pack it and send it back
Maven2ArtifactInfoResourceRespose response = new Maven2ArtifactInfoResourceRespose();
Maven2ArtifactInfoResource data = new Maven2ArtifactInfoResource();
response.setData(data);
data.setGroupId(gav.getGroupId());
data.setArtifactId(gav.getArtifactId());
data.setBaseVersion(gav.getBaseVersion());
data.setVersion(gav.getVersion());
data.setExtension(gav.getExtension());
data.setClassifier(gav.getClassifier());
data.setDependencyXmlChunk(generateDependencyXml(gav));
return response;
}