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);
}
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;
}
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);
}
}
Aggregations