diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata')
4 files changed, 136 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java new file mode 100644 index 000000000..eb55c22fa --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepository.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.repository; + +import java.net.URL; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.equinox.prov.core.repository.IRepositoryInfo; +import org.eclipse.equinox.prov.metadata.IInstallableUnit; +import org.eclipse.equinox.prov.query.IQueryable; + +/** + * A metadata repository stores information about a set of installable units + * <p> + * Clients may implement this interface. + * </p> + * TODO: This should be an abstract class so methods can be added in the future + * without breaking clients. + */ +public interface IMetadataRepository extends IRepositoryInfo, IQueryable { + /** + * Returns all installable units known to this repository. + * @param monitor TODO + * @return the installable units known to this repository + *TODO: Progress monitor? Is the repository expected to be local? + */ + public IInstallableUnit[] getInstallableUnits(IProgressMonitor monitor); + + /** + * Returns the URL of this repository. + * TODO: Should we use URL or URI? URL requires a protocol handler to be installed + * in Java. Can the URL have any protocol? Why are we exposing this at all? + * @return the URL of this repository. + */ + public URL getLocation(); +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java new file mode 100644 index 000000000..e5533326e --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryFactory.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.repository; + +import java.net.URL; + +public interface IMetadataRepositoryFactory { + + public IMetadataRepository load(URL location); + + public IMetadataRepository create(URL location, String name, String type); +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java new file mode 100644 index 000000000..98173d6f6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IMetadataRepositoryManager.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.repository; + +import java.net.URL; +import org.eclipse.core.runtime.IProgressMonitor; + +public interface IMetadataRepositoryManager { + /** + * Adds a new metadata repository to the set of known repositories. + * @param repository + */ + public void addRepository(IMetadataRepository repository); + + /** + * Adds a repository corresponding to the given URL. + * @param url The URL of the repository to add + * @param progress TODO + */ + public IMetadataRepository loadRepository(URL url, IProgressMonitor progress); + + /** + * Creates and returns a metadata repository of the given type at the given location. + * If a repository already exists at that location <code>null</code> is returned. + * @param location the location for the new repository + * @param name the name of the new repo + * @param type the kind of repository to create + * @return the discovered or created repository + */ + public IMetadataRepository createRepository(URL location, String name, String type); + + public IMetadataRepository[] getKnownRepositories(); + + public IMetadataRepository getRepository(URL repo); //TODO Should this throw an exception + + public void removeRepository(IMetadataRepository toRemove); +} diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java new file mode 100644 index 000000000..a22a6e804 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/prov/metadata/repository/IWritableMetadataRepository.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Prashant Deva - Bug 194674 [prov] Provide write access to metadata repository + * IBM Corporation - ongoing development + *******************************************************************************/ +package org.eclipse.equinox.prov.metadata.repository; + +import org.eclipse.equinox.prov.core.repository.IWritableRepositoryInfo; +import org.eclipse.equinox.prov.metadata.IInstallableUnit; + +public interface IWritableMetadataRepository extends IMetadataRepository, IWritableRepositoryInfo { + + void addInstallableUnits(IInstallableUnit[] installableUnit); + + void removeInstallableUnits(IInstallableUnit[] installableUnit); + + /** + * Remove IUs from this repository. + */ + public void removeAll(); + +} |