Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-01-13 12:29:41 -0500
committerPascal Rapicault2010-01-13 12:29:41 -0500
commit18189f0d42f7375660762dc6c885cf31683ae562 (patch)
tree17775d847bed9a33f3c68b74db2df75a2139c0bc /bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2
parentc363f2984a09b73c422e38f4556fd3b23eafe958 (diff)
downloadrt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.gz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.xz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.zip
Merging api branch back to HEADv20100113
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactComparatorFactory.java52
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactDescriptor.java191
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactComparator.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactDescriptor.java62
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java133
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepositoryManager.java149
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRequest.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IFileArtifactRepository.java32
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepDescriptor.java89
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java24
11 files changed, 17 insertions, 785 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactComparatorFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactComparatorFactory.java
deleted file mode 100644
index b9568b02d..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactComparatorFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 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
- * Compeople AG (Stefan Liebig) - various ongoing maintenance
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.artifact.repository;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.RegistryFactory;
-import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
-import org.eclipse.osgi.util.NLS;
-
-public class ArtifactComparatorFactory {
- private static final String comparatorPoint = "org.eclipse.equinox.p2.artifact.repository.artifactComparators"; //$NON-NLS-1$
- private static final String ATTR_ID = "id"; //$NON-NLS-1$
- private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
-
- public static IArtifactComparator getArtifactComparator(String comparatorID) {
- IConfigurationElement[] extensions = RegistryFactory.getRegistry().getConfigurationElementsFor(comparatorPoint);
-
- IConfigurationElement element = null;
- if (comparatorID == null && extensions.length > 0) {
- element = extensions[0]; //just take the first one
- } else {
- for (int i = 0; i < extensions.length; i++) {
- if (extensions[i].getAttribute(ATTR_ID).equals(comparatorID)) {
- element = extensions[i];
- break;
- }
- }
- }
- if (element != null) {
- try {
- Object execExt = element.createExecutableExtension(ATTR_CLASS);
- if (execExt instanceof IArtifactComparator)
- return (IArtifactComparator) execExt;
- } catch (Exception e) {
- //fall through
- }
- }
-
- if (comparatorID != null)
- throw new IllegalArgumentException(NLS.bind(Messages.exception_comparatorNotFound, comparatorID));
- throw new IllegalArgumentException(Messages.exception_noComparators);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactDescriptor.java
deleted file mode 100644
index 33c526325..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/ArtifactDescriptor.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.internal.provisional.p2.artifact.repository;
-
-import java.util.Arrays;
-import java.util.Map;
-import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-
-/**
- * This represents information about a given artifact stored on a particular byte server.
- */
-public class ArtifactDescriptor implements IArtifactDescriptor {
- public static final String ARTIFACT_REFERENCE = "artifact.reference"; //$NON-NLS-1$
-
- private static final ProcessingStepDescriptor[] EMPTY_STEPS = new ProcessingStepDescriptor[0];
-
- protected IArtifactKey key; // The key associated with this artifact
-
- // The list of post processing steps that must be applied one the artifact once it
- // has been downloaded (e.g, unpack, then md5 checksum, then...)
- protected ProcessingStepDescriptor[] processingSteps = EMPTY_STEPS;
-
- protected Map properties = new OrderedProperties();
- protected Map repositoryProperties = new OrderedProperties();
-
- protected transient IArtifactRepository repository;
-
- // QUESTION: Do we need any description or user readable name
-
- public ArtifactDescriptor(IArtifactDescriptor base) {
- super();
- key = base.getArtifactKey();
- processingSteps = base.getProcessingSteps();
- properties.putAll(base.getProperties());
- repository = base.getRepository();
- // TODO this property is hardcoded for the blob store.
- // setProperty("artifact.uuid", base.getProperty("artifact.uuid"));
- }
-
- public ArtifactDescriptor(ArtifactDescriptor base) {
- super();
- key = base.key;
- processingSteps = base.processingSteps;
- properties = base.properties;
- repository = base.repository;
- }
-
- public ArtifactDescriptor(IArtifactKey key) {
- super();
- this.key = key;
- }
-
- public IArtifactKey getArtifactKey() {
- return key;
- }
-
- public String getProperty(String propertyKey) {
- return (String) properties.get(propertyKey);
- }
-
- public void setProperty(String key, String value) {
- if (value == null)
- properties.remove(key);
- else
- properties.put(key, value);
- }
-
- public void addProperties(Map additionalProperties) {
- properties.putAll(additionalProperties);
- }
-
- /**
- * Returns a read-only collection of the properties of the artifact descriptor.
- * @return the properties of this artifact descriptor.
- */
- public Map getProperties() {
- return OrderedProperties.unmodifiableProperties(properties);
- }
-
- public String getRepositoryProperty(String propertyKey) {
- return (String) repositoryProperties.get(propertyKey);
- }
-
- public void setRepositoryProperty(String key, String value) {
- if (value == null)
- repositoryProperties.remove(key);
- else
- repositoryProperties.put(key, value);
- }
-
- public void addRepositoryProperties(Map additionalProperties) {
- repositoryProperties.putAll(additionalProperties);
- }
-
- /**
- * Returns a read-only collection of the repository properties of the artifact descriptor.
- * @return the repository properties of this artifact descriptor.
- */
- public Map getRepositoryProperties() {
- return OrderedProperties.unmodifiableProperties(repositoryProperties);
- }
-
- public ProcessingStepDescriptor[] getProcessingSteps() {
- return processingSteps;
- }
-
- public void setProcessingSteps(ProcessingStepDescriptor[] value) {
- processingSteps = value == null ? EMPTY_STEPS : value;
- }
-
- // Implementation of both equals and hash depends on the implementation of
- // SimpleArtifactRepository#getOutputStream(IArtifactDescriptor)
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- ArtifactDescriptor other = (ArtifactDescriptor) obj;
- if (key == null) {
- if (other.key != null)
- return false;
- } else if (!key.equals(other.key))
- return false;
- if (!Arrays.equals(processingSteps, other.processingSteps))
- return false;
-
- //Properties affecting SimpleArtifactRepository#getLocation
- String locationProperty = getRepositoryProperty(ARTIFACT_REFERENCE);
- String otherProperty = other.getRepositoryProperty(ARTIFACT_REFERENCE);
- // want not null and the same, or both null
- if (locationProperty != null ? !locationProperty.equals(otherProperty) : otherProperty != null)
- return false;
-
- locationProperty = getProperty(FORMAT);
- otherProperty = other.getProperty(FORMAT);
- if (locationProperty != null ? !locationProperty.equals(otherProperty) : otherProperty != null)
- return false;
-
- return true;
- }
-
- private int hashCode(Object[] array) {
- int prime = 31;
- if (array == null)
- return 0;
- int result = 1;
- for (int index = 0; index < array.length; index++) {
- result = prime * result + (array[index] == null ? 0 : array[index].hashCode());
- }
- return result;
- }
-
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((key == null) ? 0 : key.hashCode());
- result = prime * result + hashCode(processingSteps);
-
- String[] hashProperties = new String[] {getRepositoryProperty(ARTIFACT_REFERENCE), getProperty(FORMAT)};
- result = prime * result + hashCode(hashProperties);
- return result;
- }
-
- public IArtifactRepository getRepository() {
- return repository;
- }
-
- public void setRepository(IArtifactRepository value) {
- repository = value;
- }
-
- public String toString() {
- String format = getProperty(IArtifactDescriptor.FORMAT);
- if (format == null)
- return "canonical: " + key.toString(); //$NON-NLS-1$
- return format + ": " + key.toString(); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactComparator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactComparator.java
deleted file mode 100644
index 6ba7d556f..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactComparator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.internal.provisional.p2.artifact.repository;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface IArtifactComparator {
-
- /**
- * Compare 2 equivalent IArtifactDescriptors from different repositories.
- *
- * IArtifactDescriptors with the same id and version should represent the same
- * set of bytes. The comparator should ensure this is true and return an error
- * or warning otherwise.
- *
- * @param source - The source IArtifactRepository
- * @param sourceDescriptor - The IArtifactDescriptor from the source repository
- * @param destination - The target IArtifactRepository
- * @param destDescriptor - The IArtifactDescriptor from the target repository
- *
- * @return IStatus
- */
- public IStatus compare(IArtifactRepository source, IArtifactDescriptor sourceDescriptor, IArtifactRepository destination, IArtifactDescriptor destDescriptor);
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactDescriptor.java
deleted file mode 100644
index 835950693..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactDescriptor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.internal.provisional.p2.artifact.repository;
-
-import java.util.Map;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-
-public interface IArtifactDescriptor {
-
- public static final String DOWNLOAD_SIZE = "download.size"; //$NON-NLS-1$
- public static final String ARTIFACT_SIZE = "artifact.size"; //$NON-NLS-1$
- public static final String DOWNLOAD_MD5 = "download.md5"; //$NON-NLS-1$
- public static final String DOWNLOAD_CONTENTTYPE = "download.contentType"; //$NON-NLS-1$
- public static final String TYPE_ZIP = "application/zip"; //$NON-NLS-1$
- public static final String ARTIFACT_MD5 = "artifact.md5"; //$NON-NLS-1$
- public static final String FORMAT = "format"; //$NON-NLS-1$
-
- /**
- * Return the key for the artifact described by this descriptor.
- * @return the key associated with this descriptor
- */
- public abstract IArtifactKey getArtifactKey();
-
- /**
- * Return the value of the given property in this descriptor <code>null</code>
- * is returned if no such property exists
- * @param key the property key to look for
- * @return the value of the given property or <code>null</code>
- */
- public abstract String getProperty(String key);
-
- /**
- * Returns a read-only collection of the properties of the artifact descriptor.
- * @return the properties of this artifact descriptor.
- */
- public Map getProperties();
-
- /**
- * Return the list of processing steps associated with this descriptor.
- * An empty set of steps implies that this descriptor describes a complete
- * copy of the artifact in its native form.
- * @return the list of processing steps for this descriptor
- */
- public abstract ProcessingStepDescriptor[] getProcessingSteps();
-
- /**
- * Return the artifact repository that holds the artifact described by this descriptor.
- * <code>null</code> is returned if this descriptor is not held in a repository.
- *
- * @return the repository holding this artifact or <code>null</code> if none.
- */
- public abstract IArtifactRepository getRepository();
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java
deleted file mode 100644
index c793545ab..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepository.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.internal.provisional.p2.artifact.repository;
-
-import java.io.OutputStream;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
-
-/**
- * A repository containing artifacts.
- * <p>
- * This interface is not intended to be implemented by clients. Artifact repository
- * implementations must subclass {@link AbstractArtifactRepository} rather than
- * implementing this interface directly.
- * </p>
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IArtifactRepository extends IRepository {
-
- /**
- * The return code to use when a client could/should retry a failed getArtifact() operation.
- * For example, the repository may have additional mirrors that could be consulted.
- */
- public static int CODE_RETRY = 13;
-
- /**
- * Add the given descriptor to the set of descriptors in this repository. This is
- * a relatively low-level operation that should be used only when the actual related
- * content is in this repository and the given descriptor accurately describes
- * that content.
- * @param descriptor the descriptor to add.
- */
- public void addDescriptor(IArtifactDescriptor descriptor);
-
- /**
- * Add the given artifact descriptors to this repository
- * @param descriptors the artifact descriptors to add
- */
- public void addDescriptors(IArtifactDescriptor[] descriptors);
-
- /**
- * Returns true if this repository contains the given descriptor.
- * @param descriptor the descriptor to query
- * @return true if the given descriptor is already in this repository
- */
- public boolean contains(IArtifactDescriptor descriptor);
-
- /**
- * Returns true if this repository contains the given artifact key.
- * @param key the key to query
- * @return true if the given key is already in this repository
- */
- public boolean contains(IArtifactKey key);
-
- /**
- * Write to the given output stream the bytes represented by the artifact descriptor processed by the processing steps of the given descriptor.
- */
- public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor);
-
- /**
- * Write to the given output stream the bytes represented by the artifact descriptor without processing by the steps of the given descriptor.
- */
- public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor);
-
- /**
- * Return the set of artifact descriptors describing the ways that this repository
- * can supply the artifact associated with the given artifact key
- * @param key the artifact key to lookup
- * @return the descriptors associated with the given key
- */
- public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key);
-
- /**
- * Returns the list of artifact keys managed by this repository
- * @return list of artifact keys
- */
- public IArtifactKey[] getArtifactKeys();
-
- /**
- * Executes the given artifact requests on this byte server.
- * @param requests The artifact requests
- * @param monitor
- * @return a status object that is <code>OK</code> if requests were
- * processed successfully. Otherwise, a status indicating information,
- * warnings, or errors that occurred while executing the artifact requests
- */
- public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor);
-
- /**
- * Open an output stream to which a client can write the data for the given
- * artifact descriptor.
- * @param descriptor the descriptor describing the artifact data to be written to the
- * resultant stream
- * @return the stream to which the artifact content can be written. The returned output
- * stream may implement <code>IStateful</code>.
- * @throws ProvisionException if the output stream could not be created. Reasons include:
- * <ul>
- * <li>An I/O exception occurred (@link {@link ProvisionException#REPOSITORY_FAILED_WRITE}) .</li>
- * <li>An artifact already exists at that location ({@link ProvisionException#ARTIFACT_EXISTS}).</li>
- * </ul>
- */
- public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException;
-
- /**
- * Remove the all keys, descriptors, and contents from this repository.
- */
- public void removeAll();
-
- /**
- * Remove the given descriptor and its corresponding content in this repository.
- * @param descriptor the descriptor to remove.
- */
- public void removeDescriptor(IArtifactDescriptor descriptor);
-
- /**
- * Remove the given key and all related content and descriptors from this repository.
- * @param key the key to remove.
- */
- public void removeDescriptor(IArtifactKey key);
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepositoryManager.java
deleted file mode 100644
index c804670f4..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRepositoryManager.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.internal.provisional.p2.artifact.repository;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Properties;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-
-/**
- * A metadata repository manager is used to create, access, and manipulate
- * {@link IArtifactRepository} instances. See {@link IRepositoryManager}
- * for a general description of the characteristics of repository managers.
- *
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IArtifactRepositoryManager extends IRepositoryManager {
- /**
- * The name used for obtaining a reference to the metadata repository manager service
- */
- public static final String SERVICE_NAME = IArtifactRepositoryManager.class.getName();
-
- public static final IArtifactRequest[] NO_ARTIFACT_REQUEST = new IArtifactRequest[0];
-
- /**
- * Repository type for a simple repository based on a URL or local file system location.
- */
- public static final String TYPE_SIMPLE_REPOSITORY = "org.eclipse.equinox.p2.artifact.repository.simpleRepository"; //$NON-NLS-1$
- public static final String TYPE_COMPOSITE_REPOSITORY = "org.eclipse.equinox.p2.artifact.repository.compositeRepository"; //$NON-NLS-1$
-
- /**
- * Return a new request to mirror the given artifact into the destination repository.
- * @param key the artifact to mirror
- * @param destination the destination where the artifact will be mirrored
- * @param destinationDescriptorProperties additional properties for use in creating the repository's ArtifactDescriptor,
- * or <code>null</code> to indicate no additional properties are needed
- * @param destinationRepositoryProperties additional repository specific properties for use in creating the repositor's ArtifactDescriptor,
- * , or <code>null</code> to indicate no additional properties are needed
- * @return the newly created request object
- */
- public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Properties destinationDescriptorProperties, Properties destinationRepositoryProperties);
-
- /**
- * Creates and returns a new empty artifact repository of the given type at
- * the given location.
- * <p>
- * The resulting repository is added to the list of repositories tracked by
- * the repository manager. Clients must make a subsequent call to {@link #removeRepository(URI)}
- * if they do not want the repository manager to remember the repository for subsequent
- * load attempts.
- * </p>
- *
- * @param location the absolute location for the new repository
- * @param name the name of the new repository
- * @param type the kind of repository to create
- * @param properties the properties to set on the repository
- * @return the newly created repository
- * @throws ProvisionException if the repository could not be created. Reasons include:
- * <ul>
- * <li>The repository type is unknown.</li>
- * <li>There was an error writing to the given repository location.</li>
- * <li>A repository already exists at that location.</li>
- * </ul>
- */
- public IArtifactRepository createRepository(URI location, String name, String type, Map properties) throws ProvisionException;
-
- /**
- * Loads the repository at the given location. The location is expected to contain
- * data that describes a valid artifact repository of a known type. If this manager
- * already knows a repository at the given location then that repository is returned.
- * <p>
- * The resulting repository is added to the list of repositories tracked by
- * the repository manager. Clients must make a subsequent call to {@link #removeRepository(URI)}
- * if they do not want the repository manager to remember the repository for subsequent
- * load attempts.
- * </p>
- *
- * @param location the absolute location in which to look for a repository description
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- * @return a repository object for the given location
- * @throws ProvisionException if the repository could not be created. Reasons include:
- * <ul>
- * <li>There is no existing repository at that location.</li>
- * <li>The repository at that location could not be read.</li>
- * </ul>
- */
- public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException;
-
- /**
- * Loads the repository at the given location. The location is expected to contain
- * data that describes a valid artifact repository of a known type. If this manager
- * already knows a repository at the given location then that repository is returned.
- * <p>
- * The resulting repository is added to the list of repositories tracked by
- * the repository manager. Clients must make a subsequent call to {@link #removeRepository(URI)}
- * if they do not want the repository manager to remember the repository for subsequent
- * load attempts.
- * </p>
- * <p>
- * The flags passed in should be taken as a hint for the type of repository to load. If
- * the manager cannot load a repository that satisfies these hints, it can fail fast.
- * </p>
- * @param location the absolute location in which to look for a repository description
- * @param flags - bit-wise or of flags to consider when loading the repository
- * (currently only {@link IRepositoryManager#REPOSITORY_HINT_MODIFIABLE} is supported)
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- * @return a repository object for the given location
- * @throws ProvisionException if the repository could not be created. Reasons include:
- * <ul>
- * <li>There is no existing repository at that location.</li>
- * <li>The repository at that location could not be read.</li>
- * </ul>
- * @see IRepositoryManager#REPOSITORY_HINT_MODIFIABLE
- */
- public IArtifactRepository loadRepository(URI location, int flags, IProgressMonitor monitor) throws ProvisionException;
-
- /**
- * Refreshes the repository corresponding to the given URL. This method discards
- * any cached state held by the repository manager and reloads the repository
- * contents. The provided repository location must already be known to the repository
- * manager.
- *
- * @param location The absolute location of the repository to refresh
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- * @return The refreshed metadata repository
- * @throws ProvisionException if the repository could not be created. Reasons include:
- * <ul>
- * <li>The location is not known to the repository manager.</li>
- * <li>There is no existing repository at that location.</li>
- * <li>The repository at that location could not be read.</li>
- * </ul>
- */
- public IArtifactRepository refreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException;
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRequest.java
deleted file mode 100644
index f68e11d3c..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IArtifactRequest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.internal.provisional.p2.artifact.repository;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRequest;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-
-/**
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IArtifactRequest {
-
- public IArtifactKey getArtifactKey();
-
- /**
- * Returns the result of the previous call to {@link ArtifactRequest#perform(IProgressMonitor)},
- * or <code>null</code> if perform has never been called.
- *
- * @return The result of the previous perform call.
- */
- public IStatus getResult();
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IFileArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IFileArtifactRepository.java
deleted file mode 100644
index 6e6e07be3..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/IFileArtifactRepository.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 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.internal.provisional.p2.artifact.repository;
-
-import java.io.File;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-
-public interface IFileArtifactRepository extends IArtifactRepository {
- /**
- * Return the location of the full local file corresponding to the given
- * artifact key to the given key, or <code>null</code> if not available.
- *
- * @return the location of the requested artifact or<code>null</code> if not available
- */
- public File getArtifactFile(IArtifactKey key);
-
- /**
- * Return the location of the local file corresponding to the given
- * artifact descriptor, or <code>null</code> if not available.
- *
- * @return the location of the requested descriptor or<code>null</code> if not available
- */
- public File getArtifactFile(IArtifactDescriptor descriptor);
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
index 15375f95d..403670e1a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
@@ -11,11 +11,13 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
+
import java.io.IOException;
import java.io.OutputStream;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
/**
* ProcessingSteps process the data written to them and pass the resultant data on
@@ -39,7 +41,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
* @param descriptor description of the step
* @param context the context in which the step is being used
*/
- public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ public void initialize(IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
// nothing to do here!
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepDescriptor.java
deleted file mode 100644
index f7db92d7e..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepDescriptor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007, 2008 compeople AG 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:
-* compeople AG (Stefan Liebig) - initial API and implementation
-*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing;
-
-/**
- * The description of a processor step.
- */
-public class ProcessingStepDescriptor {
-
- private final String processorId; //the operation to be applied (e.g: unpack, md5, signature verification, etc.)
- private final String data; //data requested for the processing (eg. expected checksum)
- private final boolean required; //whether the step is optional or not
-
- /**
- * Create a processing step description.
- *
- * @param processorId
- * @param data
- * @param required
- */
- public ProcessingStepDescriptor(String processorId, String data, boolean required) {
- super();
- this.processorId = processorId;
- this.data = data;
- this.required = required;
- }
-
- public String getProcessorId() {
- return processorId;
- }
-
- public String getData() {
- return data;
- }
-
- public boolean isRequired() {
- return required;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((data == null) ? 0 : data.hashCode());
- result = prime * result + ((processorId == null) ? 0 : processorId.hashCode());
- result = prime * result + (required ? 1231 : 1237);
- return result;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ProcessingStepDescriptor))
- return false;
- final ProcessingStepDescriptor other = (ProcessingStepDescriptor) obj;
- if (data == null) {
- if (other.data != null)
- return false;
- } else if (!data.equals(other.data))
- return false;
- if (processorId == null) {
- if (other.processorId != null)
- return false;
- } else if (!processorId.equals(other.processorId))
- return false;
- if (required != other.required)
- return false;
- return true;
- }
-
- public String toString() {
- return "Processor: " + processorId + (required ? "(req)" : "(notReq)") + " ,data: " + data; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
index 508c46486..0387fcd28 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
@@ -11,13 +11,15 @@
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
+
import java.io.OutputStream;
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.ArtifactOutputStream;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
import org.eclipse.equinox.internal.provisional.p2.repository.IStateful;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.osgi.util.NLS;
/**
@@ -42,7 +44,7 @@ public class ProcessingStepHandler {
IExtensionPoint point = registry.getExtensionPoint(PROCESSING_STEPS_EXTENSION_ID);
if (point == null)
return false;
- ProcessingStepDescriptor[] steps = descriptor.getProcessingSteps();
+ IProcessingStepDescriptor[] steps = descriptor.getProcessingSteps();
for (int i = 0; i < steps.length; i++) {
if (point.getExtension(steps[i].getProcessorId()) == null)
return false;
@@ -60,11 +62,11 @@ public class ProcessingStepHandler {
public static IStatus getStatus(OutputStream stream, boolean deep) {
if (!deep)
return getStatus(stream);
- ArrayList list = new ArrayList();
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
int severity = collectStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
- IStatus[] result = (IStatus[]) list.toArray(new IStatus[list.size()]);
+ IStatus[] result = list.toArray(new IStatus[list.size()]);
return new MultiStatus(Activator.ID, severity, result, Messages.processing_step_results, null);
}
@@ -74,15 +76,15 @@ public class ProcessingStepHandler {
* @return the requested status
*/
public static IStatus getErrorStatus(OutputStream stream) {
- ArrayList list = new ArrayList();
+ ArrayList<IStatus> list = new ArrayList<IStatus>();
int severity = collectErrorStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
- IStatus[] result = (IStatus[]) list.toArray(new IStatus[list.size()]);
+ IStatus[] result = list.toArray(new IStatus[list.size()]);
return new MultiStatus(Activator.ID, 0, result, Messages.processing_step_results, null);
}
- private static int collectErrorStatus(OutputStream stream, ArrayList list) {
+ private static int collectErrorStatus(OutputStream stream, ArrayList<IStatus> list) {
IStatus status = getStatus(stream);
if (!status.isOK())
list.add(status);
@@ -105,7 +107,7 @@ public class ProcessingStepHandler {
return Status.OK_STATUS;
}
- private static int collectStatus(OutputStream stream, ArrayList list) {
+ private static int collectStatus(OutputStream stream, ArrayList<IStatus> list) {
IStatus status = getStatus(stream);
list.add(status);
OutputStream destination = getDestination(stream);
@@ -125,14 +127,14 @@ public class ProcessingStepHandler {
return null;
}
- public ProcessingStep[] create(ProcessingStepDescriptor[] descriptors, IArtifactDescriptor context) {
+ public ProcessingStep[] create(IProcessingStepDescriptor[] descriptors, IArtifactDescriptor context) {
ProcessingStep[] result = new ProcessingStep[descriptors.length];
for (int i = 0; i < descriptors.length; i++)
result[i] = create(descriptors[i], context);
return result;
}
- public ProcessingStep create(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
+ public ProcessingStep create(IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtension extension = registry.getExtension(PROCESSING_STEPS_EXTENSION_ID, descriptor.getProcessorId());
Exception error;
@@ -155,7 +157,7 @@ public class ProcessingStepHandler {
return result;
}
- public OutputStream createAndLink(ProcessingStepDescriptor[] descriptors, IArtifactDescriptor context, OutputStream output, IProgressMonitor monitor) {
+ public OutputStream createAndLink(IProcessingStepDescriptor[] descriptors, IArtifactDescriptor context, OutputStream output, IProgressMonitor monitor) {
if (descriptors == null)
return output;
ProcessingStep[] steps = create(descriptors, context);

Back to the top