Search in sources :

Example 1 with MetadataRepositoryIO

use of org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO in project tycho by eclipse.

the class MetadataSerializableImpl method serialize.

@Override
public void serialize(OutputStream stream, Set<?> installableUnits) throws IOException {
    final List<IInstallableUnit> units = toInstallableUnits(installableUnits);
    // TODO check if we can really "reuse" LocalMetadataRepository or should we implement our own Repository
    AbstractMetadataRepository targetRepo = new AbstractMetadataRepository(agent, // $NON-NLS-1$
    "TychoTargetPlatform", // $NON-NLS-1$
    LocalMetadataRepository.class.getName(), // $NON-NLS-1$
    "0.0.1", // $NON-NLS-1$
    null, // $NON-NLS-1$
    null, // $NON-NLS-1$
    null, // $NON-NLS-1$
    null) {

        @Override
        public void initialize(RepositoryState state) {
        }

        @Override
        public Collection<IRepositoryReference> getReferences() {
            return Collections.emptyList();
        }

        @Override
        public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
            return query.perform(units.iterator());
        }
    };
    new MetadataRepositoryIO(agent).write(targetRepo, stream);
}
Also used : IQuery(org.eclipse.equinox.p2.query.IQuery) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) AbstractMetadataRepository(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository) MetadataRepositoryIO(org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO) IRepositoryReference(org.eclipse.equinox.p2.repository.IRepositoryReference) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) LocalMetadataRepository(org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 LocalMetadataRepository (org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository)1 MetadataRepositoryIO (org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryIO)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IQuery (org.eclipse.equinox.p2.query.IQuery)1 IRepositoryReference (org.eclipse.equinox.p2.repository.IRepositoryReference)1 AbstractMetadataRepository (org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository)1