Search in sources :

Example 16 with GAV

use of org.eclipse.tycho.p2.repository.GAV in project tycho by eclipse.

the class FileBasedTychoRepositoryIndex method read.

private Set<GAV> read(InputStream inStream) throws IOException {
    LinkedHashSet<GAV> result = new LinkedHashSet<>();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, ENCODING));
    try {
        String line;
        while ((line = reader.readLine()) != null) {
            if (line.trim().length() == 0) {
                continue;
            }
            try {
                GAV parsedGAV = GAV.parse(line);
                result.add(parsedGAV);
            } catch (IllegalArgumentException e) {
                logger.warn("Ignoring invalid line '" + line + "' in " + indexFile);
            }
        }
    } finally {
        reader.close();
    }
    return result;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) GAV(org.eclipse.tycho.p2.repository.GAV)

Example 17 with GAV

use of org.eclipse.tycho.p2.repository.GAV 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

GAV (org.eclipse.tycho.p2.repository.GAV)15 IOException (java.io.IOException)6 File (java.io.File)5 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)5 FileInputStream (java.io.FileInputStream)4 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)4 TychoRepositoryIndex (org.eclipse.tycho.p2.repository.TychoRepositoryIndex)4 Test (org.junit.Test)4 ArtifactsIO (org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO)3 BufferedOutputStream (java.io.BufferedOutputStream)2 InputStream (java.io.InputStream)2 HashSet (java.util.HashSet)2 MetadataIO (org.eclipse.tycho.p2.maven.repository.xmlio.MetadataIO)2 MavenRepositoryCoordinates (org.eclipse.tycho.p2.repository.MavenRepositoryCoordinates)2 BufferedReader (java.io.BufferedReader)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1