processingSteps) {
super(parentHandler, PROCESSING_STEP_ELEMENT);
String[] attributeValues = parseAttributes(attributes, required, optional);
processingSteps.add(new ProcessingStepDescriptor(attributeValues[0], attributeValues[2], checkBoolean(PROCESSING_STEP_ELEMENT, STEP_REQUIRED_ATTRIBUTE, attributeValues[1]).booleanValue()));
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 null
- * is returned if no such property exists
- * @param key the property key to look for
- * @return the value of the given property or null
- */
- 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.
- * null
is returned if this descriptor is not held in a repository.
- *
- * @return the repository holding this artifact or null
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.
- *
- * This interface is not intended to be implemented by clients. Artifact repository
- * implementations must subclass {@link AbstractArtifactRepository} rather than
- * implementing this interface directly.
- *
- * @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 OK
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 IStateful
.
- * @throws ProvisionException if the output stream could not be created. Reasons include:
- *
- * - An I/O exception occurred (@link {@link ProvisionException#REPOSITORY_FAILED_WRITE}) .
- * - An artifact already exists at that location ({@link ProvisionException#ARTIFACT_EXISTS}).
- *
- */
- 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 null
to indicate no additional properties are needed
- * @param destinationRepositoryProperties additional repository specific properties for use in creating the repositor's ArtifactDescriptor,
- * , or null
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.
- *
- * 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.
- *
- *
- * @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:
- *
- * - The repository type is unknown.
- * - There was an error writing to the given repository location.
- * - A repository already exists at that location.
- *
- */
- 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.
- *
- * 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.
- *
- *
- * @param location the absolute location in which to look for a repository description
- * @param monitor a progress monitor, or null
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:
- *
- * - There is no existing repository at that location.
- * - The repository at that location could not be read.
- *
- */
- 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.
- *
- * 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.
- *
- *
- * 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.
- *
- * @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 null
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:
- *
- * - There is no existing repository at that location.
- * - The repository at that location could not be read.
- *
- * @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 null
if progress
- * reporting is not desired
- * @return The refreshed metadata repository
- * @throws ProvisionException if the repository could not be created. Reasons include:
- *
- * - The location is not known to the repository manager.
- * - There is no existing repository at that location.
- * - The repository at that location could not be read.
- *
- */
- 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 null
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 null
if not available.
- *
- * @return the location of the requested artifact ornull
if not available
- */
- public File getArtifactFile(IArtifactKey key);
-
- /**
- * Return the location of the local file corresponding to the given
- * artifact descriptor, or null
if not available.
- *
- * @return the location of the requested descriptor ornull
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 list = new ArrayList();
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 list = new ArrayList();
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 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 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);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java
deleted file mode 100644
index a5b04501b..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/AbstractArtifactRepository.java
+++ /dev/null
@@ -1,78 +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.spi.p2.artifact.repository;
-
-import java.io.OutputStream;
-import java.net.URI;
-import java.util.Map;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
-
-public abstract class AbstractArtifactRepository extends AbstractRepository implements IArtifactRepository {
-
- protected AbstractArtifactRepository(String name, String type, String version, URI location, String description, String provider, Map properties) {
- super(name, type, version, location, description, provider, properties);
- }
-
- public abstract boolean contains(IArtifactDescriptor descriptor);
-
- public abstract boolean contains(IArtifactKey key);
-
- public abstract IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor);
-
- public abstract IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key);
-
- public abstract IArtifactKey[] getArtifactKeys();
-
- public abstract IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor);
-
- public abstract OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException;
-
- public void addDescriptor(IArtifactDescriptor descriptor) {
- assertModifiable();
- }
-
- public void addDescriptors(IArtifactDescriptor[] descriptors) {
- assertModifiable();
- }
-
- public void removeDescriptor(IArtifactDescriptor descriptor) {
- assertModifiable();
- }
-
- public void removeDescriptor(IArtifactKey key) {
- assertModifiable();
- }
-
- public void removeAll() {
- assertModifiable();
- }
-
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof AbstractArtifactRepository)) {
- return false;
- }
- if (URIUtil.sameURI(getLocation(), ((AbstractArtifactRepository) o).getLocation()))
- return true;
- return false;
- }
-
- public int hashCode() {
- return (this.getLocation().toString().hashCode()) * 87;
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
deleted file mode 100644
index fce9f4e85..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
+++ /dev/null
@@ -1,75 +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.spi.p2.artifact.repository;
-
-import java.net.URI;
-import java.util.Map;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-
-/**
- * An artifact repository factory is responsible for creating and loading instances
- * of a particular type of artifact repository. Factories are provided via the
- * org.eclipse.equinox.p2.artifact.repository.artifactRepositories extension point.
- */
-public abstract class ArtifactRepositoryFactory {
-
- /**
- * Creates and returns a new empty artifact repository of the given type at
- * the given location.
- *
- * @param location the 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:
- *
- * - The repository type is unknown.
- * - There was an error writing to the given repository location.
- * - A repository already exists at that location.
- *
- */
- public abstract IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException;
-
- /**
- * Loads and returns the repository of this factory's type at the given location.
- *
- * The error code returned in the case of failure is significant. In particular an
- * error code of {@link ProvisionException#REPOSITORY_FAILED_READ} indicates
- * that the location definitely identifies a repository of this type, but an error occurred
- * while loading the repository. The repository manager will not attempt to load
- * a repository from that location using any other factory. An error code of
- * {@link ProvisionException#REPOSITORY_NOT_FOUND} indicates there is no
- * repository of this type at the given location, and the repository manager is free
- * to try again with a different repository factory.
- *
- *
- * The flags passed in should be taken as a hint for the type of repository to load. If
- * the factory knows it will not load a repository that satisfies these hints, it can fail
- * fast and return null.
- * @see IRepositoryManager#REPOSITORY_HINT_MODIFIABLE
- *
- * @param location the location in which to look for a repository description
- * @param flags to consider while loading the repository
- * @param monitor a progress monitor, or null
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:
- *
- * - There is no existing repository at that location.
- * - The repository at that location could not be read.
- *
- */
- public abstract IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException;
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
deleted file mode 100644
index d9744eadb..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
+++ /dev/null
@@ -1,129 +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.spi.p2.artifact.repository;
-
-import java.io.*;
-import java.net.URI;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
-import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository;
-import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryIO;
-import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
-import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
-import org.eclipse.equinox.internal.p2.repository.Transport;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.osgi.util.NLS;
-
-public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
-
- public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
- final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
- long time = 0;
- final String debugMsg = "Restoring artifact repository "; //$NON-NLS-1$
- if (Tracing.DEBUG_METADATA_PARSING) {
- Tracing.debug(debugMsg + location);
- time = -System.currentTimeMillis();
- }
- File localFile = null;
- boolean local = false;
- try {
- SubMonitor sub = SubMonitor.convert(monitor, 300);
- OutputStream artifacts = null;
- // try with compressed
- boolean compress = true;
- if (PROTOCOL_FILE.equals(location.getScheme())) {
- local = true;
- localFile = URIUtil.toFile(SimpleArtifactRepository.getActualLocation(location, true));
- if (!localFile.exists()) {
- localFile = URIUtil.toFile(SimpleArtifactRepository.getActualLocation(location, false));
- compress = false;
- }
- } else {
- //not local, return null if the caller wanted a modifiable repo
- if ((flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0) {
- return null;
- }
-
- //download to local temp file
- localFile = File.createTempFile("artifacts", ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- artifacts = new BufferedOutputStream(new FileOutputStream(localFile));
- IStatus status = getTransport().download(SimpleArtifactRepository.getActualLocation(location, compress), artifacts, sub.newChild(100));
- if (!status.isOK()) {
- // not meaningful to continue on an authentication exception (user will likely just be prompted again)
- if (status.getCode() == ProvisionException.REPOSITORY_FAILED_AUTHENTICATION)
- throw new ProvisionException(status);
- // retry uncompressed
- compress = false;
- status = getTransport().download(SimpleArtifactRepository.getActualLocation(location, compress), artifacts, sub.newChild(100));
- if (!status.isOK())
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, status.getMessage(), null));
- }
- } finally {
- if (artifacts != null)
- artifacts.close();
- }
- }
- InputStream descriptorStream = null;
- try {
- descriptorStream = new BufferedInputStream(new FileInputStream(localFile));
- if (compress) {
- URI actualLocation = SimpleArtifactRepository.getActualLocation(location, false);
- JarInputStream jInStream = new JarInputStream(descriptorStream);
- JarEntry jarEntry = jInStream.getNextJarEntry();
- String filename = URIUtil.lastSegment(actualLocation);
- while (jarEntry != null && filename != null && !(filename.equals(jarEntry.getName()))) {
- jarEntry = jInStream.getNextJarEntry();
- }
- if (jarEntry == null) {
- //there is a jar but the entry is missing or invalid, so treat this as an invalid repository
- throw new IOException(NLS.bind(Messages.io_invalidLocation, actualLocation.getPath()));
- }
- descriptorStream = jInStream;
- }
- SimpleArtifactRepositoryIO io = new SimpleArtifactRepositoryIO();
- SimpleArtifactRepository result = (SimpleArtifactRepository) io.read(localFile.toURL(), descriptorStream, sub.newChild(100));
- result.initializeAfterLoad(location);
- if (Tracing.DEBUG_METADATA_PARSING) {
- time += System.currentTimeMillis();
- Tracing.debug(debugMsg + "time (ms): " + time); //$NON-NLS-1$
- }
- return result;
- } finally {
- if (descriptorStream != null)
- descriptorStream.close();
- }
- } catch (FileNotFoundException e) {
- String msg = NLS.bind(Messages.io_failedRead, location);
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, e));
- } catch (IOException e) {
- String msg = NLS.bind(Messages.io_failedRead, location);
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, msg, e));
- } finally {
- if (!local && localFile != null && !localFile.delete())
- localFile.deleteOnExit();
- }
- }
-
- public IArtifactRepository create(URI location, String name, String type, Map properties) {
- return new SimpleArtifactRepository(name, location, properties);
- }
-
- private Transport getTransport() {
- return RepositoryTransport.getInstance();
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java
deleted file mode 100644
index a2e122805..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AddChildTask.java
+++ /dev/null
@@ -1,82 +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
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository.ant;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-
-/**
- * Ant task to add a child artifact repository to an already-existing composite artifact repository.
- */
-public class AddChildTask extends Task {
-
- URI location; // location of the composite repository
- URI child; // address of the child to add
- String comparatorID; // comparator to use for compare (optional)
-
- /* (non-Javadoc)
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
- if (manager == null)
- throw new BuildException("Unable to acquire artifact repository manager service.");
-
- // get the composite repository
- CompositeArtifactRepository repo = null;
- try {
- repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
- } catch (ProvisionException e) {
- throw new BuildException("Exception while loading repository.", e);
- }
-
- // just do a straight add if the user didn't specify a comparator.
- if (comparatorID == null) {
- repo.addChild(child);
- return;
- }
-
- // otherwise run the comparator when we try and add the child and print out the result.
- if (repo.addChild(child, comparatorID))
- System.out.println(child + " was added successfully.");
- else
- System.out.println(child + " was not added.");
- }
-
- /*
- * Set the location of the composite repository.
- */
- public void setLocation(String value) throws URISyntaxException {
- location = URIUtil.fromString(value);
- }
-
- /*
- * Set the location of the child repository.
- */
- public void setChild(String value) throws URISyntaxException {
- child = URIUtil.fromString(value);
- }
-
- /*
- * Set the identifier of the comparator to use.
- */
- public void setComparatorID(String value) {
- comparatorID = value;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AntMirrorLog.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AntMirrorLog.java
deleted file mode 100644
index 9d30c11f0..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/AntMirrorLog.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.p2.artifact.repository.ant;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog;
-import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
-
-public class AntMirrorLog implements IArtifactMirrorLog {
-
- private boolean consoleMessage = false;
- private Method log;
- private Object task;
-
- public AntMirrorLog(Object task) throws NoSuchMethodException {
- this.task = task;
- try {
- log = task.getClass().getMethod("log", new Class[] {String.class, int.class}); //$NON-NLS-1$
- } catch (SecurityException e) {
- exceptionOccurred(null, e);
- }
- }
-
- public void log(IArtifactDescriptor descriptor, IStatus status) {
- log(descriptor.toString(), status.getSeverity());
- log(status);
- }
-
- public void log(IStatus status) {
- int severity = status.getSeverity();
- // Log the status message
- log(status.getMessage(), severity);
- // Log the exception if applicable
- if (status.getException() != null)
- log(status.getException().getMessage(), severity);
-
- // Log any children of this status
- IStatus[] nestedStatus = status.getChildren();
- if (nestedStatus != null)
- for (int i = 0; i < nestedStatus.length; i++)
- log(nestedStatus[i]);
- }
-
- public void close() {
- // nothing to do here
- }
-
- /*
- * Log a message to the Ant Task
- */
- private void log(String message, int statusSeverity) {
- try {
- log.invoke(task, new Object[] {message, new Integer(mapLogLevels(statusSeverity))});
- } catch (IllegalArgumentException e) {
- exceptionOccurred(message, e);
- } catch (IllegalAccessException e) {
- exceptionOccurred(message, e);
- } catch (InvocationTargetException e) {
- exceptionOccurred(message, e);
- }
- }
-
- /*
- * Show an error message if this the first time, and print status messages.
- */
- private void exceptionOccurred(String message, Exception e) {
- if (!consoleMessage) {
- System.err.println(Messages.MirrorLog_Exception_Occurred);
- e.printStackTrace(System.err);
- System.err.println(Messages.MirrorLog_Console_Log);
- consoleMessage = true;
- }
- if (message != null)
- System.out.println(message);
- }
-
- /**
- * Copied from AntLogAdapter in pde build.
- */
- private int mapLogLevels(int iStatusLevel) {
- switch (iStatusLevel) {
- case IStatus.ERROR :
- return 0;
- case IStatus.OK :
- return 2;
- case IStatus.INFO :
- return 2;
- case IStatus.WARNING :
- return 1;
- default :
- return 1;
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java
deleted file mode 100644
index a86224e53..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/CreateCompositeArtifactRepositoryTask.java
+++ /dev/null
@@ -1,120 +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
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository.ant;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-
-/**
- * Ant task for creating a new composite artifact repository.
- */
-public class CreateCompositeArtifactRepositoryTask extends Task {
-
- URI location; // desired location of the composite repository
- String name = "Composite Artifact Repository";
- boolean compressed = true;
- boolean failOnExists = false; // should we fail if a repo already exists?
- Map properties = new HashMap();
-
- /* (non-Javadoc)
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
- validate();
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
- if (manager == null)
- throw new BuildException("Unable to aquire artifact repository manager service.");
-
- // remove the repo first.
- manager.removeRepository(location);
-
- // first try and load to see if one already exists at that location.
- // if we have an already existing repository at that location, then throw an error
- // if the user told us to
- try {
- IArtifactRepository repository = manager.loadRepository(location, null);
- if (repository instanceof CompositeArtifactRepository) {
- if (failOnExists)
- throw new BuildException("Composite repository already exists at location: " + location);
- return;
- } else {
- // we have a non-composite repo at this location. that is ok because we can co-exist.
- }
- } catch (ProvisionException e) {
- // re-throw the exception if we got anything other than "repo not found"
- if (e.getStatus().getCode() != ProvisionException.REPOSITORY_NOT_FOUND)
- throw new BuildException("Exception while trying to read repository at: " + location, e);
- }
-
- // set the properties
- if (compressed)
- properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true));
-
- // create the repository
- try {
- manager.createRepository(location, name, IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, properties);
- } catch (ProvisionException e) {
- throw new BuildException("Error occurred while creating composite artifact repository.", e);
- }
- }
-
- /*
- * Perform basic sanity checking of some of the parameters.
- */
- private void validate() {
- if (location == null)
- throw new BuildException("Must specify repository location.");
- if (name == null)
- throw new BuildException("Must specify a repository name.");
- }
-
- /*
- * Set the name of the composite repository.
- */
- public void setName(String value) {
- name = value;
- }
-
- /*
- * Set the location of the repository.
- */
- public void setLocation(String value) throws URISyntaxException {
- location = URIUtil.fromString(value);
- }
-
- /*
- * Set a value indicating whether or not the repository should be compressed.
- */
- public void setCompressed(boolean value) {
- compressed = value;
- }
-
- /*
- * Set whether or not we should fail the operation if a repository
- * already exists at the location.
- */
- public void setFailOnExists(boolean value) {
- failOnExists = value;
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java
deleted file mode 100644
index 5040961cf..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/MirrorApplicationTask.java
+++ /dev/null
@@ -1,221 +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
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository.ant;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.equinox.internal.p2.artifact.mirror.MirrorApplication;
-import org.osgi.framework.Bundle;
-
-/**
- * Ant task for running the artifact repository mirroring application.
- */
-public class MirrorApplicationTask extends Task {
-
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
- private static final String ARG_COMPARATOR = "-comparator"; //$NON-NLS-1$
- private static final String ARG_COMPARE = "-compare"; //$NON-NLS-1$
- private static final String ARG_COMPARE_AGAINST = "-compareAgainst"; //$NON-NLS-1$
- private static final String ARG_COMPARATOR_LOG = "-comparatorLog"; //$NON-NLS-1$
- private static final String ARG_DESTINATION = "-destination"; //$NON-NLS-1$
- private static final String ARG_DESTINATION_NAME = "-destinationName"; //$NON-NLS-1$
- private static final String ARG_IGNORE_ERRORS = "-ignoreErrors"; //$NON-NLS-1$
- private static final String ARG_LOG = "-log"; //$NON-NLS-1$
- private static final String ARG_RAW = "-raw"; //$NON-NLS-1$
- private static final String ARG_SOURCE = "-source"; //$NON-NLS-1$
- private static final String ARG_VERBOSE = "-verbose"; //$NON-NLS-1$
- private static final String ARG_WRITE_MODE = "-writeMode"; //$NON-NLS-1$
-
- URL source;
- URL destination;
- String destinationName;
- URL baseline; // location of known good repository for compare against (optional)
- File mirrorLog; // file to log mirror output to (optional)
- File comparatorLog; // file to comparator output to (optional)
- String comparatorID; // specifies a comparator (optional)
- String writeMode;
- boolean compare = false;
- boolean ignoreErrors = false;
- boolean raw = false; // use raw artifact descriptors?
- boolean verbose = false;
-
- /*
- * Runs the mirror application with the given arguments.
- */
- private void runMirrorApplication(final String[] args) throws Exception {
- MirrorApplication app = new MirrorApplication();
- if (mirrorLog == null)
- app.setLog(new AntMirrorLog(this));
- app.start(new IApplicationContext() {
-
- public void applicationRunning() {
- // nothing to do
- }
-
- public Map getArguments() {
- Map arguments = new HashMap();
- arguments.put(IApplicationContext.APPLICATION_ARGS, args);
- return arguments;
- }
-
- public String getBrandingApplication() {
- return null;
- }
-
- public Bundle getBrandingBundle() {
- return null;
- }
-
- public String getBrandingDescription() {
- return null;
- }
-
- public String getBrandingId() {
- return null;
- }
-
- public String getBrandingName() {
- return null;
- }
-
- public String getBrandingProperty(String key) {
- return null;
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
- // Compare against if baseline specified
- boolean compareAgainst = baseline != null;
- boolean comparator = comparatorID != null;
-
- // create arguments
- String[] args = new String[] { //
- ARG_SOURCE, source.toExternalForm(), //
- ARG_DESTINATION, destination.toExternalForm(), //
- ARG_WRITE_MODE, writeMode == null ? EMPTY_STRING : writeMode, //
- compare ? ARG_COMPARE : EMPTY_STRING, //
- ignoreErrors ? ARG_IGNORE_ERRORS : EMPTY_STRING, //
- raw ? ARG_RAW : EMPTY_STRING, //
- verbose ? ARG_VERBOSE : EMPTY_STRING, //
- compareAgainst ? ARG_COMPARE_AGAINST : EMPTY_STRING, //
- compareAgainst ? baseline.toExternalForm() : EMPTY_STRING, //
- comparator ? ARG_COMPARATOR : EMPTY_STRING, //
- comparator ? comparatorID : EMPTY_STRING, //
- mirrorLog != null ? ARG_LOG : EMPTY_STRING, //
- mirrorLog != null ? mirrorLog.getAbsolutePath() : EMPTY_STRING, //
- comparatorLog != null ? ARG_COMPARATOR_LOG : EMPTY_STRING, //
- comparatorLog != null ? comparatorLog.getAbsolutePath() : EMPTY_STRING, //
- destinationName != null ? ARG_DESTINATION_NAME : EMPTY_STRING, //
- destinationName != null ? destinationName : EMPTY_STRING};
-
- try {
- runMirrorApplication(args);
- } catch (Exception e) {
- throw new BuildException("Exception while running mirror application.", e);
- }
- }
-
- /*
- * Set the location of the source.
- */
- public void setSource(String value) throws MalformedURLException {
- source = new URL(value);
- }
-
- /*
- * Set the location of the destination.
- */
- public void setDestination(String value) throws MalformedURLException {
- destination = new URL(value);
- }
-
- /*
- * Set the name of the destination repository.
- */
- public void setDestinationName(String value) {
- destinationName = value;
- }
-
- /*
- * Set the location of the baseline repository. (used in comparison)
- */
- public void setBaseline(String value) throws MalformedURLException {
- baseline = new URL(value);
- compare = true;
- }
-
- /*
- * Set the identifier of the comparator to use.
- */
- public void setComparatorID(String value) {
- comparatorID = value;
- compare = true;
- }
-
- /*
- * Set the location of the comparator log
- */
- public void setComparatorLog(String value) {
- comparatorLog = new File(value);
- }
-
- /*
- * Set the write mode. (e.g. clean or append)
- */
- public void setWriteMode(String value) {
- writeMode = value;
- }
-
- /*
- * Set the log location if applicable
- */
- public void setLog(String value) {
- mirrorLog = new File(value);
- }
-
- /*
- * Set whether or not the application should be calling a comparator when mirroring.
- */
- public void setCompare(boolean value) {
- compare = value;
- }
-
- /*
- * Set whether or not we should ignore errors when running the mirror application.
- */
- public void setIgnoreErrors(boolean value) {
- ignoreErrors = value;
- }
-
- /*
- * Set whether or not the the artifacts are raw.
- */
- public void setRaw(boolean value) {
- raw = value;
- }
-
- /*
- * Set whether or not the mirror application should be run in verbose mode.
- */
- public void setVerbose(boolean value) {
- verbose = value;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java
deleted file mode 100644
index 2a1212660..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/RemoveChildTask.java
+++ /dev/null
@@ -1,76 +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
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository.ant;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-
-/**
- * Ant task for removing a specific child from a composite artifact repository.
- */
-public class RemoveChildTask extends Task {
-
- URI location; // location of the composite repository
- URI child; // location of child to remove
- boolean allChildren = false; // should we remove all children?
-
- /* (non-Javadoc)
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
- if (manager == null)
- throw new BuildException("Unable to aquire artifact repository manager service.");
-
- // load repository
- CompositeArtifactRepository repo;
- try {
- repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
- } catch (ProvisionException e) {
- throw new BuildException("Error occurred while loading repository.", e);
- }
-
- // remove all children or just a specified child
- if (allChildren)
- repo.removeAllChildren();
- else
- repo.removeChild(child);
- }
-
- /*
- * Set the repository location.
- */
- public void setLocation(String value) throws URISyntaxException {
- location = URIUtil.fromString(value);
- }
-
- /*
- * Set the child repository location.
- */
- public void setChild(String value) throws URISyntaxException {
- child = URIUtil.fromString(value);
- }
-
- /*
- * Set whether or not we want to remove all the children.
- */
- public void setAllChildren(String value) {
- allChildren = Boolean.valueOf(value).booleanValue();
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java
deleted file mode 100644
index 96a4d3a7e..000000000
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src_ant/org/eclipse/equinox/internal/p2/artifact/repository/ant/ValidateTask.java
+++ /dev/null
@@ -1,68 +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
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.artifact.repository.ant;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
-import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-
-/**
- * Ant task for validating the contents of a composite artifact repository.
- */
-public class ValidateTask extends Task {
-
- URI location; // location of the composite repository
- String comparatorID; // specifies the comparator we want to use.
-
- /* (non-Javadoc)
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
- if (manager == null)
- throw new BuildException("Unable to aquire artifact repository manager service.");
-
- // load the repository
- CompositeArtifactRepository repo = null;
- try {
- repo = (CompositeArtifactRepository) manager.loadRepository(location, null);
- } catch (ProvisionException e) {
- throw new BuildException("Exception while loading repository.", e);
- }
-
- // perform the sanity check
- if (repo.validate(comparatorID))
- System.err.println("Valid repository at: " + location);
- else
- System.err.println("Invalid repository at: " + location);
- }
-
- /*
- * Set the repository location.
- */
- public void setLocation(String value) throws URISyntaxException {
- location = URIUtil.fromString(value);
- }
-
- /*
- * Set the ID of the comparator.
- */
- public void setComparatorID(String value) {
- comparatorID = value;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.console/.classpath b/bundles/org.eclipse.equinox.p2.console/.classpath
index 7cdeb7319..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.console/.classpath
+++ b/bundles/org.eclipse.equinox.p2.console/.classpath
@@ -1,7 +1,7 @@
-
-
+
+
diff --git a/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs
index a455b6228..dd9ddfffa 100644
--- a/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.console/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Sep 13 22:02:41 EDT 2007
+#Mon Dec 28 17:08:33 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -81,7 +81,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -153,7 +153,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
index ad704999f..46f109c5d 100644
--- a/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.console/META-INF/MANIFEST.MF
@@ -7,20 +7,23 @@ Bundle-Localization: plugin
Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.console.Activator
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.equinox.internal.p2.console;x-friends:="org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.tools"
+Export-Package: org.eclipse.equinox.internal.p2.console;x-friends:="org.eclipse.equinox.p2.director.app"
Import-Package: org.eclipse.core.runtime;common=split,
org.eclipse.equinox.internal.p2.core.helpers,
- org.eclipse.equinox.internal.provisional.p2.artifact.repository,
- org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.director,
- org.eclipse.equinox.internal.provisional.p2.engine,
org.eclipse.equinox.internal.provisional.p2.metadata,
- org.eclipse.equinox.internal.provisional.p2.metadata.query,
- org.eclipse.equinox.internal.provisional.p2.metadata.repository,
- org.eclipse.equinox.internal.provisional.p2.repository,
+ org.eclipse.equinox.p2.core,
+ org.eclipse.equinox.p2.engine,
+ org.eclipse.equinox.p2.metadata,
+ org.eclipse.equinox.p2.metadata.query,
+ org.eclipse.equinox.p2.query,
+ org.eclipse.equinox.p2.repository,
+ org.eclipse.equinox.p2.repository.artifact,
+ org.eclipse.equinox.p2.repository.metadata,
org.eclipse.osgi.framework.console;version="1.0.0";resolution:=optional,
org.eclipse.osgi.service.environment;version="1.0.0",
org.osgi.framework;version="1.4.0",
org.osgi.util.tracker;version="1.3.0"
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
diff --git a/bundles/org.eclipse.equinox.p2.console/build.properties b/bundles/org.eclipse.equinox.p2.console/build.properties
index a6b8330d2..246ea6cb7 100644
--- a/bundles/org.eclipse.equinox.p2.console/build.properties
+++ b/bundles/org.eclipse.equinox.p2.console/build.properties
@@ -15,3 +15,5 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
index 78398a0b0..42a465ee1 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2008, 2009, IBM Corporation and others. All rights reserved. This
* 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
@@ -7,10 +7,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Composent, Inc. - additions
*******************************************************************************/
package org.eclipse.equinox.internal.p2.console;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
@@ -33,8 +34,8 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
super();
}
- public void start(BundleContext context) throws Exception {
- Activator.context = context;
+ public void start(BundleContext ctxt) throws Exception {
+ Activator.context = ctxt;
boolean registerCommands = true;
try {
Class.forName(PROVIDER_NAME);
@@ -43,12 +44,12 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
}
if (registerCommands) {
- profileTracker = new ServiceTracker(context, IProfileRegistry.class.getName(), this);
+ profileTracker = new ServiceTracker(context, IProfileRegistry.SERVICE_NAME, this);
profileTracker.open();
}
}
- public void stop(BundleContext context) throws Exception {
+ public void stop(BundleContext ctxt) throws Exception {
profileTracker.close();
if (providerRegistration != null)
providerRegistration.unregister();
@@ -57,15 +58,15 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
}
public Object addingService(ServiceReference reference) {
- BundleContext context = Activator.getContext();
- IProfileRegistry registry = (IProfileRegistry) context.getService(reference);
- provider = new ProvCommandProvider(context.getProperty("eclipse.p2.profile"), registry);
- providerRegistration = context.registerService(PROVIDER_NAME, provider, null);
+ BundleContext ctxt = Activator.getContext();
+ IProfileRegistry registry = (IProfileRegistry) ctxt.getService(reference);
+ provider = new ProvCommandProvider(ctxt.getProperty("eclipse.p2.profile"), registry); //$NON-NLS-1$
+ providerRegistration = ctxt.registerService(PROVIDER_NAME, provider, null);
return registry;
}
public void modifiedService(ServiceReference reference, Object service) {
- // TODO Auto-generated method stub
+ // nothing
}
public void removedService(ServiceReference reference, Object service) {
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
index 54b137b8a..83bb98ad9 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
@@ -1,15 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 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
* Band XI - add more commands
+ * Composent, Inc. - command additions
******************************************************************************/
package org.eclipse.equinox.internal.p2.console;
-import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange;
+import org.eclipse.equinox.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.VersionRange;
import java.io.File;
import java.net.URI;
@@ -18,14 +20,17 @@ import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.GroupQuery;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
@@ -55,60 +60,90 @@ public class ProvCommandProvider implements CommandProvider {
}
/**
- * Adds a metadata repository.
+ * Adds both a metadata repository and artifact repository
*/
public void _provaddrepo(CommandInterpreter interpreter) {
String urlString = interpreter.nextArgument();
if (urlString == null) {
- interpreter.print("Repository location must be provided");
- interpreter.println();
+ interpreter.println("Repository location must be provided");
return;
}
- URI repoURL = toURI(interpreter, urlString);
- if (repoURL == null)
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
return;
- if (ProvisioningHelper.addMetadataRepository(repoURL) == null)
- interpreter.println("Unable to add repository: " + repoURL);
+ // add metadata repo
+ if (ProvisioningHelper.addMetadataRepository(repoURI) == null) {
+ interpreter.println("Unable to add metadata repository: " + repoURI);
+ } else // add artifact repo at same URL
+ if (ProvisioningHelper.addArtifactRepository(repoURI) == null) {
+ interpreter.println("Unable to add artifact repository: " + repoURI);
+ }
}
public void _provdelrepo(CommandInterpreter interpreter) {
String urlString = interpreter.nextArgument();
if (urlString == null) {
- interpreter.print("Repository location must be provided");
- interpreter.println();
+ interpreter.println("Repository location must be provided");
return;
}
- URI repoURL = toURI(interpreter, urlString);
- if (repoURL == null)
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
+ return;
+ ProvisioningHelper.removeMetadataRepository(repoURI);
+ ProvisioningHelper.removeArtifactRepository(repoURI);
+ }
+
+ /**
+ * Adds a metadata repository.
+ */
+ public void _provaddmetadatarepo(CommandInterpreter interpreter) {
+ String urlString = interpreter.nextArgument();
+ if (urlString == null) {
+ interpreter.println("Repository location must be provided");
+ return;
+ }
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
return;
- ProvisioningHelper.removeMetadataRepository(repoURL);
+ if (ProvisioningHelper.addMetadataRepository(repoURI) == null)
+ interpreter.println("Unable to add repository: " + repoURI);
+ }
+
+ public void _provdelmetadatarepo(CommandInterpreter interpreter) {
+ String urlString = interpreter.nextArgument();
+ if (urlString == null) {
+ interpreter.println("Repository location must be provided");
+ return;
+ }
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
+ return;
+ ProvisioningHelper.removeMetadataRepository(repoURI);
}
public void _provaddartifactrepo(CommandInterpreter interpreter) {
String urlString = interpreter.nextArgument();
if (urlString == null) {
- interpreter.print("Repository location must be provided");
- interpreter.println();
+ interpreter.println("Repository location must be provided");
return;
}
- URI repoURL = toURI(interpreter, urlString);
- if (repoURL == null)
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
return;
- if (ProvisioningHelper.addArtifactRepository(repoURL) == null)
- interpreter.println("Unable to add repository: " + repoURL);
+ if (ProvisioningHelper.addArtifactRepository(repoURI) == null)
+ interpreter.println("Unable to add repository " + repoURI);
}
public void _provdelartifactrepo(CommandInterpreter interpreter) {
String urlString = interpreter.nextArgument();
if (urlString == null) {
- interpreter.print("Repository location must be provided");
- interpreter.println();
+ interpreter.println("Repository location must be provided");
return;
}
- URI repoURL = toURI(interpreter, urlString);
- if (repoURL == null)
+ URI repoURI = toURI(interpreter, urlString);
+ if (repoURI == null)
return;
- ProvisioningHelper.removeArtifactRepository(repoURL);
+ ProvisioningHelper.removeArtifactRepository(repoURI);
}
/**
@@ -118,24 +153,26 @@ public class ProvCommandProvider implements CommandProvider {
String iu = interpreter.nextArgument();
String version = interpreter.nextArgument();
String profileId = interpreter.nextArgument();
- if (profileId == null || profileId.equals("this"))
+ if (profileId == null || profileId.equals("this")) //$NON-NLS-1$
profileId = IProfileRegistry.SELF;
if (iu == null || version == null || profileId == null) {
- interpreter.println("Installable unit id, version, and profile Id must be provided");
+ interpreter.println("Installable unit id, version, and profileid must be provided");
return;
}
IStatus s = null;
try {
s = ProvisioningHelper.install(iu, version, ProvisioningHelper.getProfile(profileId), new NullProgressMonitor());
} catch (ProvisionException e) {
- interpreter.println("installation failed ");
- e.printStackTrace();
+ interpreter.println("Installation failed with ProvisionException for " + iu + " " + version);
+ interpreter.printStackTrace(e);
return;
}
if (s.isOK())
- interpreter.println("installation complete");
- else
- interpreter.println("installation failed " + s.getMessage());
+ interpreter.println("Installation complete for " + iu + " " + version);
+ else {
+ interpreter.println("Installation failed for " + iu + " " + version);
+ printErrorStatus(interpreter, s);
+ }
}
/**
@@ -150,16 +187,16 @@ public class ProvCommandProvider implements CommandProvider {
return;
}
String environments = interpreter.nextArgument();
- Properties props = new Properties();
- props.setProperty(IProfile.PROP_INSTALL_FOLDER, location);
- props.setProperty(IProfile.PROP_FLAVOR, flavor);
+ Map props = new HashMap();
+ props.put(IProfile.PROP_INSTALL_FOLDER, location);
if (environments != null)
- props.setProperty(IProfile.PROP_ENVIRONMENTS, environments);
+ props.put(IProfile.PROP_ENVIRONMENTS, environments);
try {
ProvisioningHelper.addProfile(profileId, props);
} catch (ProvisionException e) {
- interpreter.println("add profile failed " + e.getMessage());
+ interpreter.println("Add profile failed. " + e.getMessage());
+ interpreter.printStackTrace(e);
}
}
@@ -169,7 +206,7 @@ public class ProvCommandProvider implements CommandProvider {
public void _provdelprofile(CommandInterpreter interpreter) {
String profileId = interpreter.nextArgument();
if (profileId == null) {
- interpreter.println("Id must be provided");
+ interpreter.println("profileid must be provided");
return;
}
ProvisioningHelper.removeProfile(profileId);
@@ -225,9 +262,9 @@ public class ProvCommandProvider implements CommandProvider {
*/
public void _provlg(CommandInterpreter interpreter) {
String urlString = processArgument(interpreter.nextArgument());
- IQueryable queryable = null;
+ IQueryable queryable = null;
if (urlString == null) {
- queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (queryable == null)
return;
} else {
@@ -238,8 +275,7 @@ public class ProvCommandProvider implements CommandProvider {
if (queryable == null)
return;
}
- Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());
- IInstallableUnit[] units = sort(queryable.query(query, new Collector(), null));
+ IInstallableUnit[] units = sort(queryable.query(new GroupQuery(), null));
for (int i = 0; i < units.length; i++)
println(interpreter, units[i]);
}
@@ -264,26 +300,27 @@ public class ProvCommandProvider implements CommandProvider {
if (repoURL == null)
return;
IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(repoURL);
- IArtifactKey[] keys = null;
+ IQueryResult keys = null;
try {
- keys = (repo != null) ? repo.getArtifactKeys() : null;
+ keys = (repo != null) ? repo.query(ArtifactKeyQuery.ALL_KEYS, null) : null;
} catch (UnsupportedOperationException e) {
- interpreter.println("Repository does not support list commands.");
+ interpreter.println("Repository does not support queries.");
return;
}
- if (keys == null || keys.length == 0) {
+ if (keys == null || keys.isEmpty()) {
interpreter.println("Repository has no artifacts");
return;
}
IFileArtifactRepository fileRepo = (IFileArtifactRepository) repo.getAdapter(IFileArtifactRepository.class);
- for (int i = 0; i < keys.length; i++) {
- IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(keys[i]);
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
+ IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(key);
for (int j = 0; j < descriptors.length; j++) {
IArtifactDescriptor descriptor = descriptors[j];
File location = null;
if (fileRepo != null)
location = fileRepo.getArtifactFile(descriptor);
- println(interpreter, keys[i], location);
+ println(interpreter, key, location);
}
}
@@ -326,53 +363,238 @@ public class ProvCommandProvider implements CommandProvider {
}
// determine which profile is to be listed
IProfile target = null;
- if (profileId.equals("this"))
+ if (profileId.equals("this")) //$NON-NLS-1$
profileId = IProfileRegistry.SELF;
target = ProvisioningHelper.getProfile(profileId);
if (target == null)
return;
// list the profile contents
- IInstallableUnit[] result = sort(target.query(new InstallableUnitQuery(id, new VersionRange(range)), new Collector(), null));
+ IInstallableUnit[] result = sort(target.query(new InstallableUnitQuery(id, new VersionRange(range)), null));
for (int i = 0; i < result.length; i++)
interpreter.println(result[i]);
}
- private IInstallableUnit[] sort(Collector collector) {
- IInstallableUnit[] units = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);
- Arrays.sort(units, new Comparator() {
- public int compare(Object arg0, Object arg1) {
+ /**
+ * Lists the profile timestamps for a given profile id, if no profile id, the default profile
+ * is used.
+ *
+ * @param interpreter
+ */
+ public void _provlpts(CommandInterpreter interpreter) {
+ String profileId = processArgument(interpreter.nextArgument());
+ if (profileId == null || profileId.equals("this")) { //$NON-NLS-1$
+ profileId = IProfileRegistry.SELF;
+ }
+ long[] profileTimestamps = ProvisioningHelper.getProfileTimestamps(profileId);
+ // if no profile timestamps for given id, print that out and done
+ if (profileTimestamps == null || profileTimestamps.length == 0) {
+ interpreter.print("No timestamps found for profile ");
+ interpreter.println(profileId);
+ return;
+ }
+ // else if there are some timestamps then print them out on separate line
+ interpreter.print("Timestamps for profile ");
+ interpreter.println(profileId);
+ for (int i = 0; i < profileTimestamps.length; i++) {
+ interpreter.print("\t"); //$NON-NLS-1$
+ interpreter.println(new Long(profileTimestamps[i]));
+ }
+ }
+
+ /**
+ * Revert a profile to a given timestamp
+ */
+ public void _provrevert(CommandInterpreter interpreter) {
+ String timestamp = interpreter.nextArgument();
+ if (timestamp == null) {
+ interpreter.println("Valid timestamp must be provided. Timestamps can be retrieved via 'provlpts' command.");
+ return;
+ }
+ Long ts = null;
+ try {
+ ts = new Long(timestamp);
+ } catch (NumberFormatException e) {
+ interpreter.println("Timestamp " + timestamp + " not valid. Timestamps can be retrieved via 'provlpts' command.");
+ return;
+ }
+ String profileId = interpreter.nextArgument();
+ if (profileId == null || profileId.equals("this"))
+ profileId = IProfileRegistry.SELF;
+
+ IProfile profile = ProvisioningHelper.getProfile(profileId);
+ if (profile == null) {
+ interpreter.println("Profile " + profileId + " not found");
+ return;
+ }
+ IStatus s = null;
+ try {
+ s = ProvisioningHelper.revertToPreviousState(profile, ts.longValue());
+ } catch (ProvisionException e) {
+ interpreter.println("revert failed ");
+ interpreter.printStackTrace(e);
+ return;
+ }
+ if (s.isOK())
+ interpreter.println("revert completed");
+ else {
+ interpreter.println("revert failed ");
+ printErrorStatus(interpreter, s);
+ }
+ }
+
+ private IInstallableUnit[] sort(IQueryResult queryResult) {
+ IInstallableUnit[] units = queryResult.toArray(IInstallableUnit.class);
+ Arrays.sort(units, new Comparator() {
+ public int compare(IInstallableUnit arg0, IInstallableUnit arg1) {
return arg0.toString().compareTo(arg1.toString());
}
});
return units;
}
+ public void _provlgp(CommandInterpreter interpreter) {
+ String profileId = processArgument(interpreter.nextArgument());
+ if (profileId == null || profileId.equals("this")) {
+ profileId = IProfileRegistry.SELF;
+ }
+ IProfile profile = ProvisioningHelper.getProfile(profileId);
+ if (profile == null) {
+ interpreter.println("Profile " + profileId + " not found");
+ return;
+ }
+ IInstallableUnit[] units = sort(profile.query(new GroupQuery(), new NullProgressMonitor()));
+ // Now print out results
+ for (int i = 0; i < units.length; i++)
+ println(interpreter, units[i]);
+
+ }
+
+ public void _provremove(CommandInterpreter interpreter) {
+ String iu = interpreter.nextArgument();
+ String version = interpreter.nextArgument();
+ String profileId = interpreter.nextArgument();
+ if (profileId == null || profileId.equals("this"))
+ profileId = IProfileRegistry.SELF;
+ if (version == null) {
+ version = Version.emptyVersion.toString();
+ }
+ if (iu == null) {
+ interpreter.println("Installable unit id must be provided");
+ return;
+ }
+ IStatus s = null;
+ try {
+ s = ProvisioningHelper.uninstall(iu, version, ProvisioningHelper.getProfile(profileId), new NullProgressMonitor());
+ } catch (ProvisionException e) {
+ interpreter.println("Remove failed with ProvisionException for " + iu + " " + version);
+ interpreter.printStackTrace(e);
+ return;
+ }
+ if (s.isOK())
+ interpreter.println("Remove complete for " + iu + " " + version);
+ else {
+ interpreter.println("Remove failed for " + iu + " " + version);
+ printErrorStatus(interpreter, s);
+ }
+ }
+
+ private void printErrorStatus(CommandInterpreter interpreter, IStatus status) {
+ interpreter.print("--Error status ");
+ interpreter.print("message=" + status.getMessage());
+ interpreter.print(",code=" + status.getCode());
+ String severityString = null;
+ switch (status.getSeverity()) {
+ case IStatus.INFO :
+ severityString = "INFO";
+ break;
+ case IStatus.CANCEL :
+ severityString = "CANCEL";
+ break;
+ case IStatus.WARNING :
+ severityString = "WARNING";
+ break;
+ case IStatus.ERROR :
+ severityString = "ERROR";
+ break;
+ }
+ interpreter.print(",severity=" + severityString);
+ interpreter.print(",bundle=" + status.getPlugin());
+ interpreter.println("--");
+ Throwable t = status.getException();
+ if (t != null)
+ interpreter.printStackTrace(t);
+ IStatus[] children = status.getChildren();
+ if (children != null && children.length > 0) {
+ interpreter.println("Error status children:");
+ for (int i = 0; i < children.length; i++) {
+ printErrorStatus(interpreter, children[i]);
+ }
+ }
+ interpreter.println("--End Error Status--");
+ }
+
public String getHelp() {
StringBuffer help = new StringBuffer();
help.append(NEW_LINE);
- help.append("---"); //$NON-NLS-1$
- help.append("Provisioning Commands");
- help.append("---"); //$NON-NLS-1$
+ help.append("---");
+ help.append("P2 Provisioning Commands");
+ help.append("---");
help.append(NEW_LINE);
- help.append("\tprovlr [ ] - Lists all metadata repositories, or the contents of a given metadata repository");
+
+ help.append("---");
+ help.append("Repository Commands");
+ help.append("---");
help.append(NEW_LINE);
- help.append("\tprovlar [] - Lists all artifact repositories, or the contents of a given artifact repository");
+ help.append("\tprovaddrepo - Adds a both a metadata and artifact repository at URI");
help.append(NEW_LINE);
- help.append("\tprovliu [ ] - Lists the IUs that match the pattern in the given repo. * matches all");
+ help.append("\tprovdelrepo - Deletes a metadata and artifact repository at URI");
help.append(NEW_LINE);
- help.append("\tprovlp [ - Lists all profiles, or the contents of the profile at the given profile");
+ help.append("\tprovaddmetadatarepo - Adds a metadata repository at URI");
help.append(NEW_LINE);
- help.append("\tprovlg [ ] - Lists all IUs with group capabilities in the given repo or in all repos if the URL is omitted");
+ help.append("\tprovdelmetadatarepo - Deletes a metadata repository at URI");
help.append(NEW_LINE);
- help.append("\tprovinstall - Provisions an IU to the profile with the give id");
+ help.append("\tprovaddartifactrepo - Adds an artifact repository at URI");
help.append(NEW_LINE);
- help.append("\tprovaddrepo - Adds a metadata repository");
+ help.append("\tprovdelartifactrepo - Deletes an artifact repository URI");
help.append(NEW_LINE);
- help.append("\tprovaddartifactrepo - Adds an artifact repository");
+ help.append("\tprovlg [ ] - Lists all IUs with group capabilities in the given repo or in all repos if URI is omitted");
help.append(NEW_LINE);
- help.append("\tprovaddprofile - Adds a profile with the given id, location and flavor");
+ help.append("\tprovlr [ ] - Lists all metadata repositories, or the contents of a given metadata repository");
help.append(NEW_LINE);
+ help.append("\tprovlar [] - Lists all artifact repositories, or the contents of a given artifact repository");
+ help.append(NEW_LINE);
+ help.append("\tprovliu [ ] - Lists the IUs that match the pattern in the given repo. * matches all");
+ help.append(NEW_LINE);
+
+ help.append("---");
+ help.append("Profile Registry Commands");
+ help.append("---");
+ help.append(NEW_LINE);
+
+ help.append("\tprovaddprofile - Adds a profile with the given profileid, location and flavor");
+ help.append(NEW_LINE);
+ help.append("\tprovdelprofile - Deletes a profile with the given profileid");
+ help.append(NEW_LINE);
+ help.append("\tprovlp [] - Lists all profiles, or the contents of the profile at the given profile");
+ help.append(NEW_LINE);
+ help.append("\tprovlgp [] - Lists all IUs with group capabilities in the given profile, or current profile if profileid is omitted");
+ help.append(NEW_LINE);
+ help.append("\tprovlpts [] - Lists timestamps for given profile, or if no profileid given then the default profile timestamps are reported");
+ help.append(NEW_LINE);
+
+ help.append("---");
+ help.append("Install Commands");
+ help.append("---");
+ help.append(NEW_LINE);
+
+ help.append("\tprovinstall - installs an IU to the profileid. If no profileid is given, installs into default profile.");
+ help.append(NEW_LINE);
+ help.append("\tprovremove - Removes an IU from the profileid. If no profileid is given, installs into default profile.");
+ help.append(NEW_LINE);
+ help.append("\tprovrevert ] - Reverts to a given profileTimestamp for an optional profileId");
+ help.append(NEW_LINE);
+
return help.toString();
}
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index 730e04c8c..02d9e1091 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -10,31 +10,32 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.console;
-import org.eclipse.equinox.internal.provisional.p2.metadata.Version;
+import org.eclipse.equinox.p2.metadata.Version;
import java.net.URI;
-import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.director.*;
-import org.eclipse.equinox.internal.provisional.p2.engine.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
public class ProvisioningHelper {
public static IMetadataRepository addMetadataRepository(URI location) {
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (manager == null)
- throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$
+ throw new IllegalStateException("No metadata repository manager found");
try {
return manager.loadRepository(location, null);
} catch (ProvisionException e) {
@@ -42,7 +43,7 @@ public class ProvisioningHelper {
}
// for convenience create and add a repository here
- String repositoryName = location + " - metadata"; //$NON-NLS-1$
+ String repositoryName = location + " - metadata";
try {
return manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
} catch (ProvisionException e) {
@@ -51,7 +52,7 @@ public class ProvisioningHelper {
}
public static IMetadataRepository getMetadataRepository(URI location) {
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (manager == null)
throw new IllegalStateException("No metadata repository manager found");
try {
@@ -62,14 +63,14 @@ public class ProvisioningHelper {
}
public static void removeMetadataRepository(URI location) {
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (manager == null)
throw new IllegalStateException("No metadata repository manager found");
manager.removeRepository(location);
}
public static IArtifactRepository addArtifactRepository(URI location) {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
if (manager == null)
// TODO log here
return null;
@@ -79,7 +80,7 @@ public class ProvisioningHelper {
//fall through and create a new repository
}
// could not load a repo at that location so create one as a convenience
- String repositoryName = location + " - artifacts"; //$NON-NLS-1$
+ String repositoryName = location + " - artifacts";
try {
return manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
} catch (ProvisionException e) {
@@ -88,32 +89,26 @@ public class ProvisioningHelper {
}
public static void removeArtifactRepository(URI location) {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
if (manager == null)
// TODO log here
return;
manager.removeRepository(location);
}
- public static IProfile addProfile(String profileId, Properties properties) throws ProvisionException {
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ public static IProfile addProfile(String profileId, Map properties) throws ProvisionException {
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null)
return null;
IProfile profile = profileRegistry.getProfile(profileId);
if (profile != null)
return profile;
- Map profileProperties = new HashMap();
-
- for (Iterator it = properties.keySet().iterator(); it.hasNext();) {
- String key = (String) it.next();
- profileProperties.put(key, properties.getProperty(key));
- }
-
+ Map profileProperties = new HashMap(properties);
if (profileProperties.get(IProfile.PROP_ENVIRONMENTS) == null) {
EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(Activator.getContext(), EnvironmentInfo.class.getName());
if (info != null)
- profileProperties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch());
+ profileProperties.put(IProfile.PROP_ENVIRONMENTS, "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
else
profileProperties.put(IProfile.PROP_ENVIRONMENTS, "");
}
@@ -122,21 +117,21 @@ public class ProvisioningHelper {
}
public static void removeProfile(String profileId) {
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null)
return;
profileRegistry.removeProfile(profileId);
}
public static IProfile[] getProfiles() {
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null)
return new IProfile[0];
return profileRegistry.getProfiles();
}
public static IProfile getProfile(String id) {
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.class.getName());
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
if (profileRegistry == null)
return null;
return profileRegistry.getProfile(id);
@@ -152,24 +147,20 @@ public class ProvisioningHelper {
* @param monitor A progress monitor, or null
* @return The IUs that match the query
*/
- public static Collector getInstallableUnits(URI location, Query query, IProgressMonitor monitor) {
- return getInstallableUnits(location, query, new Collector(), monitor);
- }
-
- public static Collector getInstallableUnits(URI location, Query query, Collector collector, IProgressMonitor monitor) {
- IQueryable queryable = null;
+ public static IQueryResult getInstallableUnits(URI location, IQuery query, IProgressMonitor monitor) {
+ IQueryable queryable = null;
if (location == null) {
- queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
} else {
queryable = getMetadataRepository(location);
}
if (queryable != null)
- return queryable.query(query, collector, monitor);
- return collector;
+ return queryable.query(query, monitor);
+ return Collector.emptyCollector();
}
public static URI[] getMetadataRepositories() {
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (manager == null)
// TODO log here
return null;
@@ -185,7 +176,7 @@ public class ProvisioningHelper {
public static IStatus install(String unitId, String version, IProfile profile, IProgressMonitor progress) throws ProvisionException {
if (profile == null)
return null;
- Collector units = getInstallableUnits(null, new InstallableUnitQuery(unitId, new Version(version)), progress);
+ IQueryResult units = getInstallableUnits((URI) null, new InstallableUnitQuery(unitId, Version.create(version)), progress);
if (units.isEmpty()) {
StringBuffer error = new StringBuffer();
error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
@@ -198,23 +189,22 @@ public class ProvisioningHelper {
throw new ProvisionException(error.toString());
}
- IPlanner planner = (IPlanner) ServiceHelper.getService(Activator.getContext(), IPlanner.class.getName());
+ IPlanner planner = (IPlanner) ServiceHelper.getService(Activator.getContext(), IPlanner.SERVICE_NAME);
if (planner == null)
throw new ProvisionException("No planner service found.");
IEngine engine = (IEngine) ServiceHelper.getService(Activator.getContext(), IEngine.SERVICE_NAME);
if (engine == null)
throw new ProvisionException("No director service found.");
- IInstallableUnit[] toInstall = (IInstallableUnit[]) units.toArray(IInstallableUnit.class);
ProvisioningContext context = new ProvisioningContext();
ProfileChangeRequest request = new ProfileChangeRequest(profile);
- request.addInstallableUnits(toInstall);
- ProvisioningPlan result = planner.getProvisioningPlan(request, context, progress);
+ request.addInstallableUnits(units);
+ IProvisioningPlan result = planner.getProvisioningPlan(request, context, progress);
return PlanExecutionHelper.executePlan(result, engine, context, progress);
}
public static URI[] getArtifactRepositories() {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
if (manager == null)
// TODO log here
return null;
@@ -225,7 +215,7 @@ public class ProvisioningHelper {
}
public static IArtifactRepository getArtifactRepository(URI repoURL) {
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
try {
if (manager != null)
return manager.loadRepository(repoURL, null);
@@ -234,4 +224,82 @@ public class ProvisioningHelper {
}
return null;
}
+
+ public static long[] getProfileTimestamps(String profileId) {
+ if (profileId == null) {
+ profileId = IProfileRegistry.SELF;
+ }
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
+ if (profileRegistry == null)
+ return null;
+ return profileRegistry.listProfileTimestamps(profileId);
+ }
+
+ public static IStatus revertToPreviousState(IProfile profile, long revertToPreviousState) throws ProvisionException {
+ IEngine engine = (IEngine) ServiceHelper.getService(Activator.getContext(), IEngine.SERVICE_NAME);
+ if (engine == null)
+ throw new ProvisionException("No p2 engine found.");
+ IPlanner planner = (IPlanner) ServiceHelper.getService(Activator.getContext(), IPlanner.SERVICE_NAME);
+ if (planner == null)
+ throw new ProvisionException("No planner found.");
+ IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(Activator.getContext(), IProfileRegistry.SERVICE_NAME);
+ if (profileRegistry == null)
+ throw new ProvisionException("profile registry cannot be null");
+ // If given profile is null, then get/use the self profile
+ if (profile == null) {
+ profile = getProfile(IProfileRegistry.SELF);
+ }
+ IProfile targetProfile = null;
+ if (revertToPreviousState == 0) {
+ long[] profiles = profileRegistry.listProfileTimestamps(profile.getProfileId());
+ if (profiles.length == 0)
+ // Nothing to do, as the profile does not have any previous timestamps
+ return Status.OK_STATUS;
+ targetProfile = profileRegistry.getProfile(profile.getProfileId(), profiles[profiles.length - 1]);
+ } else {
+ targetProfile = profileRegistry.getProfile(profile.getProfileId(), revertToPreviousState);
+ }
+ if (targetProfile == null)
+ throw new ProvisionException("target profile with timestamp=" + revertToPreviousState + " not found");
+ URI[] artifactRepos = getArtifactRepositories();
+ URI[] metadataRepos = getMetadataRepositories();
+ IProvisioningPlan plan = planner.getDiffPlan(profile, targetProfile, new NullProgressMonitor());
+ ProvisioningContext context = new ProvisioningContext(metadataRepos);
+ context.setArtifactRepositories(artifactRepos);
+ return PlanExecutionHelper.executePlan(plan, engine, context, new NullProgressMonitor());
+ }
+
+ /**
+ * Install the described IU
+ */
+ public static IStatus uninstall(String unitId, String version, IProfile profile, IProgressMonitor progress) throws ProvisionException {
+ if (profile == null)
+ return null;
+ IQueryResult units = profile.query(new InstallableUnitQuery(unitId, Version.create(version)), progress);
+ if (units.isEmpty()) {
+ StringBuffer error = new StringBuffer();
+ error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
+ error.append("Repositories searched:\n");
+ URI[] repos = getMetadataRepositories();
+ if (repos != null) {
+ for (int i = 0; i < repos.length; i++)
+ error.append(repos[i] + "\n"); //$NON-NLS-1$
+ }
+ throw new ProvisionException(error.toString());
+ }
+
+ IPlanner planner = (IPlanner) ServiceHelper.getService(Activator.getContext(), IPlanner.SERVICE_NAME);
+ if (planner == null)
+ throw new ProvisionException("No planner service found.");
+
+ IEngine engine = (IEngine) ServiceHelper.getService(Activator.getContext(), IEngine.SERVICE_NAME);
+ if (engine == null)
+ throw new ProvisionException("No engine service found.");
+ ProvisioningContext context = new ProvisioningContext();
+ ProfileChangeRequest request = new ProfileChangeRequest(profile);
+ request.removeInstallableUnits(units);
+ IProvisioningPlan result = planner.getProvisioningPlan(request, context, progress);
+ return PlanExecutionHelper.executePlan(result, engine, context, progress);
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.core/.classpath b/bundles/org.eclipse.equinox.p2.core/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.core/.classpath
+++ b/bundles/org.eclipse.equinox.p2.core/.classpath
@@ -1,6 +1,6 @@
-
+
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 327fbe678..000000000
--- a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,346 +0,0 @@
-#Mon Aug 24 11:19:53 EDT 2009
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.lineSplit=800
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.api.tools.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.api.tools.prefs
index 7b4e4a2c4..c97ebe5f5 100644
--- a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.api.tools.prefs
+++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.api.tools.prefs
@@ -1,10 +1,12 @@
-#Wed Dec 03 12:05:24 EST 2008
+#Wed Jan 13 12:12:41 EST 2010
ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
@@ -56,8 +58,8 @@ INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Error
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
LEAK_EXTEND=Warning
LEAK_FIELD_DECL=Warning
LEAK_IMPLEMENT=Warning
@@ -79,6 +81,7 @@ TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
eclipse.preferences.version=1
incompatible_api_component_version=Error
incompatible_api_component_version_include_major_without_breaking_change=Disabled
@@ -86,3 +89,5 @@ incompatible_api_component_version_include_minor_without_api_change=Disabled
invalid_since_tag_version=Error
malformed_since_tag=Error
missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
index de1a72cde..2f2feff92 100644
--- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.core;singleton:=true
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Import-Package: org.eclipse.osgi.framework.eventmgr;version="1.2.0",
org.eclipse.osgi.framework.log;version="1.0.0",
org.eclipse.osgi.service.debug;version="1.0.0",
@@ -25,12 +25,14 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ
org.eclipse.equinox.p2.installer,
org.eclipse.equinox.p2.metadata,
org.eclipse.equinox.p2.metadata.generator,
+ org.eclipse.equinox.p2.operations,
org.eclipse.equinox.frameworkadmin.test,
org.eclipse.equinox.p2.metadata.repository,
org.eclipse.equinox.p2.repositoryoptimizer,
org.eclipse.equinox.p2.touchpoint.eclipse,
org.eclipse.equinox.p2.touchpoint.natives,
org.eclipse.equinox.p2.ui,
+ org.eclipse.equinox.p2.ui.admin,
org.eclipse.equinox.p2.ui.sdk,
org.eclipse.equinox.p2.ui.sdk.scheduler,
org.eclipse.equinox.p2.updatechecker,
@@ -42,7 +44,8 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ
org.eclipse.equinox.p2.extensionlocation,
org.eclipse.equinox.p2.publisher,
org.eclipse.equinox.p2.repository.tools,
- org.eclipse.equinox.p2.repository",
+ org.eclipse.equinox.p2.repository,
+ org.eclipse.equinox.p2.ql",
org.eclipse.equinox.internal.provisional.p2.core;
x-friends:="org.eclipse.equinox.p2.artifact.optimizers,
org.eclipse.equinox.p2.artifact.processors,
@@ -56,6 +59,7 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ
org.eclipse.equinox.p2.installer,
org.eclipse.equinox.p2.metadata.generator,
org.eclipse.equinox.p2.metadata.repository,
+ org.eclipse.equinox.p2.operations,
org.eclipse.equinox.p2.publisher,
org.eclipse.equinox.p2.reconciler.dropins,
org.eclipse.equinox.p2.touchpoint.eclipse,
@@ -86,21 +90,16 @@ Export-Package: org.eclipse.equinox.internal.p2.core;x-friends:="org.eclipse.equ
org.eclipse.equinox.p2.artifact.repository,
org.eclipse.equinox.p2.touchpoint.eclipse,
org.eclipse.equinox.p2.touchpoint.natives,
+ org.eclipse.equinox.p2.operations,
org.eclipse.equinox.p2.publisher,
org.eclipse.equinox.p2.repository",
- org.eclipse.equinox.internal.provisional.p2.core.location;
- x-friends:="org.eclipse.equinox.p2.artifact.repository,
- org.eclipse.equinox.p2.touchpoint.natives,
- org.eclipse.equinox.p2.metadata.repository,
- org.eclipse.equinox.p2.director,
- org.eclipse.equinox.p2.engine,
- org.eclipse.equinox.p2.touchpoint.eclipse",
org.eclipse.equinox.p2.core,
org.eclipse.equinox.p2.core.spi
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Bundle-Activator: org.eclipse.equinox.internal.p2.core.Activator
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)"
Service-Component: OSGI-INF/eventBus.xml, OSGI-INF/agentProvider.xml
diff --git a/bundles/org.eclipse.equinox.p2.core/build.properties b/bundles/org.eclipse.equinox.p2.core/build.properties
index 4f52e07f1..98b717479 100644
--- a/bundles/org.eclipse.equinox.p2.core/build.properties
+++ b/bundles/org.eclipse.equinox.p2.core/build.properties
@@ -16,3 +16,5 @@ bin.includes = META-INF/,\
OSGI-INF/
src.includes = about.html
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
index 8b67449da..45f8a9d66 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/Activator.java
@@ -11,18 +11,19 @@
package org.eclipse.equinox.internal.p2.core;
import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Dictionary;
import java.util.Hashtable;
import org.eclipse.core.runtime.Path;
-import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
public class Activator implements BundleActivator {
- public static AgentLocation agentDataLocation = null;
+ public static IAgentLocation agentDataLocation = null;
public static BundleContext context;
private static final String DEFAULT_AGENT_LOCATION = "../p2"; //$NON-NLS-1$
@@ -51,12 +52,12 @@ public class Activator implements BundleActivator {
* NOTE: This method is copied from LocationHelper in org.eclipse.osgi
* due to access restrictions.
*/
- private static URL adjustTrailingSlash(URL url, boolean trailingSlash) throws MalformedURLException {
- String file = url.getFile();
+ private static URI adjustTrailingSlash(URI url, boolean trailingSlash) throws URISyntaxException {
+ String file = url.toString();
if (trailingSlash == (file.endsWith("/"))) //$NON-NLS-1$
return url;
file = trailingSlash ? file + "/" : file.substring(0, file.length() - 1); //$NON-NLS-1$
- return new URL(url.getProtocol(), url.getHost(), file);
+ return new URI(file);
}
/**
@@ -68,22 +69,22 @@ public class Activator implements BundleActivator {
* @param trailingSlash flag to indicate a trailing slash on the spec
* @return a URL
*/
- private static URL buildURL(String spec, boolean trailingSlash) {
+ private static URI buildURL(String spec, boolean trailingSlash) {
if (spec == null)
return null;
boolean isFile = spec.startsWith("file:"); //$NON-NLS-1$
try {
if (isFile)
- return adjustTrailingSlash(new File(spec.substring(5)).toURL(), trailingSlash);
- return new URL(spec);
- } catch (MalformedURLException e) {
+ return adjustTrailingSlash(new File(spec.substring(5)).toURI(), trailingSlash);
+ return new URI(spec);
+ } catch (URISyntaxException e) {
// if we failed and it is a file spec, there is nothing more we can do
// otherwise, try to make the spec into a file URL.
if (isFile)
return null;
try {
- return adjustTrailingSlash(new File(spec).toURL(), trailingSlash);
- } catch (MalformedURLException e1) {
+ return adjustTrailingSlash(new File(spec).toURI(), trailingSlash);
+ } catch (URISyntaxException e1) {
return null;
}
}
@@ -114,16 +115,16 @@ public class Activator implements BundleActivator {
return value + source.substring(var.length());
}
- private AgentLocation buildLocation(String property, URL defaultLocation, boolean readOnlyDefault, boolean addTrailingSlash) {
+ private IAgentLocation buildLocation(String property, URI defaultLocation, boolean readOnlyDefault, boolean addTrailingSlash) {
String location = Activator.context.getProperty(property);
// if the instance location is not set, predict where the workspace will be and
// put the instance area inside the workspace meta area.
if (location == null)
- return new BasicLocation(defaultLocation);
+ return new AgentLocation(defaultLocation);
if (location.equalsIgnoreCase(NONE))
return null;
if (location.equalsIgnoreCase(NO_DEFAULT))
- return new BasicLocation(null);
+ return new AgentLocation(null);
if (location.startsWith(VAR_USER_HOME)) {
String base = substituteVar(location, VAR_USER_HOME, PROP_USER_HOME);
location = new Path(base).toFile().getAbsolutePath();
@@ -134,10 +135,10 @@ public class Activator implements BundleActivator {
//note the config dir system property is already a URL
location = substituteVar(location, VAR_CONFIG_DIR, PROP_CONFIG_DIR);
}
- URL url = buildURL(location, addTrailingSlash);
- BasicLocation result = null;
+ URI url = buildURL(location, addTrailingSlash);
+ AgentLocation result = null;
if (url != null) {
- result = new BasicLocation(url);
+ result = new AgentLocation(url);
}
return result;
}
@@ -156,12 +157,12 @@ public class Activator implements BundleActivator {
public void start(BundleContext aContext) throws Exception {
instance = this;
Activator.context = aContext;
- URL defaultLocation = new URL(aContext.getProperty(PROP_CONFIG_DIR) + DEFAULT_AGENT_LOCATION + '/');
+ URI defaultLocation = URIUtil.fromString(aContext.getProperty(PROP_CONFIG_DIR) + DEFAULT_AGENT_LOCATION + '/');
agentDataLocation = buildLocation(PROP_AGENT_DATA_AREA, defaultLocation, false, true);
- Dictionary locationProperties = new Hashtable();
+ Dictionary locationProperties = new Hashtable();
if (agentDataLocation != null) {
locationProperties.put("type", PROP_AGENT_DATA_AREA); //$NON-NLS-1$
- agentLocationRegistration = aContext.registerService(AgentLocation.SERVICE_NAME, agentDataLocation, locationProperties);
+ agentLocationRegistration = aContext.registerService(IAgentLocation.SERVICE_NAME, agentDataLocation, locationProperties);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/AgentLocation.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/AgentLocation.java
new file mode 100644
index 000000000..75849e02f
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/AgentLocation.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 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.p2.core;
+
+import java.net.URI;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.equinox.p2.core.IAgentLocation;
+
+/**
+ * Internal class.
+ */
+public class AgentLocation implements IAgentLocation {
+
+ private URI location = null;
+
+ public AgentLocation(URI location) {
+ this.location = location;
+ }
+
+ public synchronized URI getRootLocation() {
+ return location;
+ }
+
+ public URI getDataArea(String touchpointId) {
+ return URIUtil.append(getRootLocation(), touchpointId + '/');
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/BasicLocation.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/BasicLocation.java
deleted file mode 100644
index 327d6a0a1..000000000
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/BasicLocation.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.p2.core;
-
-import java.net.*;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
-
-/**
- * Internal class.
- */
-public class BasicLocation implements AgentLocation {
-
- private URL location = null;
-
- public BasicLocation(URL location) {
- this.location = location;
- }
-
- public synchronized URL getURL() {
- return location;
- }
-
- public URI getArtifactRepositoryURI() {
- //the cache is a co-located repository
- return getMetadataRepositoryURI();
- }
-
- public URI getMetadataRepositoryURI() {
- try {
- return URIUtil.toURI(new URL(getDataArea(Activator.ID), "cache/")); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- } catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- }
- return null;
- }
-
- public URL getDataArea(String touchpointId) {
- try {
- return new URL(getURL(), touchpointId + '/');
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
index 2fd5b8f92..158e28177 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/DefaultAgentProvider.java
@@ -11,9 +11,10 @@
package org.eclipse.equinox.internal.p2.core;
import java.net.URI;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
-import org.osgi.framework.BundleContext;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import org.eclipse.equinox.p2.core.*;
+import org.osgi.framework.*;
/**
* Default implementation of {@link IProvisioningAgentProvider}.
@@ -27,9 +28,19 @@ public class DefaultAgentProvider implements IProvisioningAgentProvider {
public IProvisioningAgent createAgent(URI location) {
ProvisioningAgent result = new ProvisioningAgent();
- result.setLocation(location);
result.setBundleContext(context);
+ result.setLocation(location);
+ IAgentLocation agentLocation = (IAgentLocation) result.getService(IAgentLocation.SERVICE_NAME);
+ Dictionary properties = new Hashtable(5);
+ if (agentLocation != null)
+ properties.put("locationURI", String.valueOf(agentLocation.getRootLocation())); //$NON-NLS-1$
+ //make the currently running system have a higher service ranking
+ if (location == null) {
+ properties.put(Constants.SERVICE_RANKING, new Integer(100));
+ properties.put(IProvisioningAgent.SERVICE_CURRENT, Boolean.TRUE.toString());
+ }
+ ServiceRegistration reg = context.registerService(IProvisioningAgent.SERVICE_NAME, result, properties);
+ result.setServiceRegistration(reg);
return result;
}
-
}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
index aef7146b5..c0fd26504 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
@@ -10,12 +10,9 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.core;
-import java.net.MalformedURLException;
import java.net.URI;
import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
+import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
import org.osgi.framework.*;
@@ -25,14 +22,23 @@ import org.osgi.framework.*;
*/
public class ProvisioningAgent implements IProvisioningAgent {
- private final Map agentServices = Collections.synchronizedMap(new HashMap());
-
+ private final Map agentServices = Collections.synchronizedMap(new HashMap());
private BundleContext context;
+ private boolean stopped = false;
+ private ServiceRegistration reg;
+
+ /**
+ * Instantiates a provisioning agent.
+ */
+ public ProvisioningAgent() {
+ super();
+ }
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.core.IProvisioningAgent#getService(java.lang.String)
*/
public Object getService(String serviceName) {
+ checkRunning();
Object service = agentServices.get(serviceName);
if (service != null)
return service;
@@ -59,7 +65,13 @@ public class ProvisioningAgent implements IProvisioningAgent {
return service;
}
+ private synchronized void checkRunning() {
+ if (stopped)
+ throw new RuntimeException("Attempt to access stopped agent: " + this);
+ }
+
public void registerService(String serviceName, Object service) {
+ checkRunning();
agentServices.put(serviceName, service);
}
@@ -68,18 +80,40 @@ public class ProvisioningAgent implements IProvisioningAgent {
}
public void setLocation(URI location) {
- try {
- AgentLocation agentLocation = new BasicLocation(URIUtil.toURL(location));
- agentServices.put(AgentLocation.SERVICE_NAME, agentLocation);
- } catch (MalformedURLException e) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Invalid agent location", e)); //$NON-NLS-1$
+ //treat a null location as using the currently running platform
+ IAgentLocation agentLocation = null;
+ if (location == null) {
+ ServiceReference ref = context.getServiceReference(IAgentLocation.SERVICE_NAME);
+ if (ref != null) {
+ agentLocation = (IAgentLocation) context.getService(ref);
+ context.ungetService(ref);
+ }
+ } else {
+ agentLocation = new AgentLocation(location);
}
+ agentServices.put(IAgentLocation.SERVICE_NAME, agentLocation);
}
public void unregisterService(String serviceName, Object service) {
+ synchronized (this) {
+ if (stopped)
+ return;
+ }
synchronized (agentServices) {
if (agentServices.get(serviceName) == service)
agentServices.remove(serviceName);
}
}
+
+ public synchronized void stop() {
+ stopped = true;
+ if (reg != null) {
+ reg.unregister();
+ reg = null;
+ }
+ }
+
+ public void setServiceRegistration(ServiceRegistration reg) {
+ this.reg = reg;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
index 930378462..f7ff68cd6 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/StringPool.java
@@ -23,7 +23,7 @@ import java.util.HashMap;
*/
public final class StringPool {
private int savings;
- private final HashMap map = new HashMap();
+ private final HashMap map = new HashMap();
/**
* Creates a new string pool.
@@ -41,11 +41,11 @@ public final class StringPool {
public String add(String string) {
if (string == null)
return string;
- Object result = map.get(string);
+ String result = map.get(string);
if (result != null) {
if (result != string)
savings += 44 + 2 * string.length();
- return (String) result;
+ return result;
}
//explicitly copy the string to trim excess baggage
String trim = new String(string.toCharArray());
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
new file mode 100644
index 000000000..5bea8c961
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Cloudsmith Inc. 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:
+ * Cloudsmith Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.core.helpers;
+
+import java.io.*;
+import java.lang.reflect.Array;
+import java.util.*;
+
+/**
+ * Helper class that provides some useful support when dealing with collections.
+ */
+public class CollectionUtils {
+
+ /**
+ * A unmodifiable {@link List} implementation on top of an object array.
+ * @param The element type.
+ */
+ private static class UnmodifiableArrayList extends AbstractList implements RandomAccess, java.io.Serializable {
+ private static final long serialVersionUID = 7435304230643855579L;
+ final E[] array;
+
+ UnmodifiableArrayList(E[] array) {
+ this.array = array;
+ }
+
+ public boolean contains(Object o) {
+ return indexOf(o) != -1;
+ }
+
+ public E get(int index) {
+ return array[index];
+ }
+
+ public int indexOf(Object o) {
+ int size = array.length;
+ if (o == null) {
+ for (int i = 0; i < size; i++)
+ if (array[i] == null)
+ return i;
+ } else {
+ for (int i = 0; i < size; i++)
+ if (o.equals(array[i]))
+ return i;
+ }
+ return -1;
+ }
+
+ public Iterator iterator() {
+ return listIterator();
+ }
+
+ /**
+ * Rapid iterator, motivated by the fact that we don't need to check
+ * for concurrent modifications.
+ */
+ public ListIterator listIterator() {
+ return new ListIterator() {
+ private int index = 0;
+
+ public boolean hasNext() {
+ return index < array.length;
+ }
+
+ public E next() {
+ if (index >= array.length)
+ throw new NoSuchElementException();
+ return array[index++];
+ }
+
+ public boolean hasPrevious() {
+ return index > 0;
+ }
+
+ public E previous() {
+ if (--index < 0) {
+ ++index;
+ throw new NoSuchElementException();
+ }
+ return array[index];
+ }
+
+ public int nextIndex() {
+ return index;
+ }
+
+ public int previousIndex() {
+ return index - 1;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void set(E e) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void add(E e) {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public int lastIndexOf(Object o) {
+ int idx = array.length;
+ if (o == null) {
+ while (--idx >= 0)
+ if (array[idx] == null)
+ return idx;
+ } else {
+ while (--idx >= 0)
+ if (o.equals(array[idx]))
+ return idx;
+ }
+ return -1;
+ }
+
+ public E set(int index, E element) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int size() {
+ return array.length;
+ }
+
+ public Object[] toArray() {
+ return array.clone();
+ }
+
+ @SuppressWarnings("unchecked")
+ public T[] toArray(T[] a) {
+ int size = array.length;
+ if (a.length < size)
+ a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);
+ System.arraycopy(this.array, 0, a, 0, size);
+ while (size < a.length)
+ a[size++] = null;
+ return a;
+ }
+ }
+
+ /**
+ * Creates a combined hash for an array of objects.
+ * @param objects The objects to hash
+ * @return The combined hashCode of the objects.
+ */
+ public static int hashCode(Object objects[]) {
+ if (objects == null)
+ return 0;
+
+ int result = 1;
+ int idx = objects.length;
+ while (--idx >= 0) {
+ Object object = objects[idx];
+ result = 17 * result + (object == null ? 0 : object.hashCode());
+ }
+ return result;
+ }
+
+ /**
+ * The emptyList() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param The type of the elements
+ * @return An empty list
+ */
+ @SuppressWarnings("unchecked")
+ public static List emptyList() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * The emptySet() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param The type of the elements
+ * @return An empty set
+ */
+ @SuppressWarnings("unchecked")
+ public static Set emptySet() {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * The emptyMap() method was introduced in Java 1.5 so we need this here to be able to
+ * down compile to 1.4.
+ * @param