Search in sources :

Example 1 with LayoutRuntimeException

use of org.apache.archiva.repository.content.LayoutRuntimeException in project archiva by apache.

the class ManagedDefaultRepositoryContent method createArtifactFromPath.

private Artifact createArtifactFromPath(final StorageAsset artifactPath) throws LayoutRuntimeException {
    if (artifactPath == null) {
        throw new LayoutRuntimeException("Path null is not valid for artifact");
    }
    final Version version;
    try {
        version = getVersionFromArtifactPath(artifactPath);
    } catch (LayoutException e) {
        throw new LayoutRuntimeException(e.getMessage(), e);
    }
    final ArtifactInfo info = getArtifactInfoFromPath(version.getId(), artifactPath);
    return org.apache.archiva.repository.content.base.ArchivaArtifact.withAsset(artifactPath).withVersion(version).withId(info.id).withClassifier(info.classifier).withRemainder(info.remainder).withType(info.type).withArtifactVersion(info.version).withContentType(info.contentType).withArtifactType(info.artifactType).build();
}
Also used : LayoutRuntimeException(org.apache.archiva.repository.content.LayoutRuntimeException) Version(org.apache.archiva.repository.content.Version) ArchivaVersion(org.apache.archiva.repository.content.base.ArchivaVersion) LayoutException(org.apache.archiva.repository.content.LayoutException)

Aggregations

LayoutException (org.apache.archiva.repository.content.LayoutException)1 LayoutRuntimeException (org.apache.archiva.repository.content.LayoutRuntimeException)1 Version (org.apache.archiva.repository.content.Version)1 ArchivaVersion (org.apache.archiva.repository.content.base.ArchivaVersion)1