Search in sources :

Example 1 with ModuleArtifactDescriptor

use of org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor in project tycho by eclipse.

the class ModuleArtifactRepository method createArtifactDescriptor.

public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key, WriteSessionContext writeSession) {
    ClassifierAndExtension additionalProperties = writeSession.getClassifierAndExtensionForNewKey(key);
    MavenRepositoryCoordinates mavenCoordinates = new MavenRepositoryCoordinates(moduleGAV, additionalProperties.classifier, additionalProperties.fileExtension);
    return new ModuleArtifactDescriptor(key, mavenCoordinates);
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) ClassifierAndExtension(org.eclipse.tycho.repository.publishing.WriteSessionContext.ClassifierAndExtension) ModuleArtifactDescriptor(org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor)

Example 2 with ModuleArtifactDescriptor

use of org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor in project tycho by eclipse.

the class ModuleArtifactRepository method getInternalDescriptorForAdding.

@Override
protected ModuleArtifactDescriptor getInternalDescriptorForAdding(IArtifactDescriptor descriptor) throws IllegalArgumentException {
    if (descriptor == null) {
        throw new NullPointerException();
    } else if (!(descriptor instanceof ModuleArtifactDescriptor) || descriptor.getRepository() != this) {
        throw new IllegalArgumentException("Cannot add artifact descriptor which has not been created by this repository");
    }
    ModuleArtifactDescriptor internalDescriptor = (ModuleArtifactDescriptor) descriptor;
    try {
        MavenRepositoryCoordinates coordinates = internalDescriptor.getMavenCoordinates();
        artifactsMap.addToAutomaticLocation(coordinates.getClassifier(), coordinates.getExtension());
    } catch (ProvisionException e) {
        // TODO 393004 Revise exception handling
        throw new RuntimeException(e);
    }
    return internalDescriptor;
}
Also used : MavenRepositoryCoordinates(org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates) ProvisionException(org.eclipse.equinox.p2.core.ProvisionException) ModuleArtifactDescriptor(org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor)

Example 3 with ModuleArtifactDescriptor

use of org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor in project tycho by eclipse.

the class ModuleArtifactRepository method load.

private void load() throws ProvisionException {
    try {
        FileInputStream p2DataFileStream = new FileInputStream(p2DataFile);
        try {
            Set<IArtifactDescriptor> descriptors = new ArtifactsIO().readXML(p2DataFileStream);
            for (IArtifactDescriptor descriptor : descriptors) {
                ModuleArtifactDescriptor internalDescriptor = getInternalDescriptorFromLoadedDescriptor(descriptor, p2DataFile);
                // TODO check that GAV properties match module GAV
                internalAddInternalDescriptor(internalDescriptor);
            }
        } finally {
            p2DataFileStream.close();
        }
    } catch (IOException e) {
        throw failedReadException(p2DataFile, null, e);
    }
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArtifactsIO(org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) ModuleArtifactDescriptor(org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor)

Aggregations

ModuleArtifactDescriptor (org.eclipse.tycho.repository.module.ModuleArtifactRepository.ModuleArtifactDescriptor)3 MavenRepositoryCoordinates (org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)1 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)1 ArtifactsIO (org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO)1 ClassifierAndExtension (org.eclipse.tycho.repository.publishing.WriteSessionContext.ClassifierAndExtension)1