Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2011-03-04 22:16:42 -0500
committerIan Bull2011-03-04 22:16:42 -0500
commitd826ca961eb560d90c9e8bbb266c06ad9bed8a6d (patch)
tree3687b3f9689ba60904941a51df380557b81095d7 /bundles/org.eclipse.equinox.p2.repository
parent088551f94aa91b7bbe9679da780ec00b548a17ad (diff)
downloadrt.equinox.p2-d826ca961eb560d90c9e8bbb266c06ad9bed8a6d.tar.gz
rt.equinox.p2-d826ca961eb560d90c9e8bbb266c06ad9bed8a6d.tar.xz
rt.equinox.p2-d826ca961eb560d90c9e8bbb266c06ad9bed8a6d.zip
NEW - bug 301903: Consider a file level lock during batch executionv20110305-0130
https://bugs.eclipse.org/bugs/show_bug.cgi?id=301903
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java74
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/AbstractArtifactRepository.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java12
4 files changed, 168 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
index 35a722aa7..1bccddc73 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.repository;
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.query.IQueryable;
@@ -204,4 +205,18 @@ public interface IRepository<T> extends IAdaptable, IQueryable<T> {
* @return The old property value, or <code>null</code> if there was no old value
*/
public String setProperty(String key, String value);
+
+ /**
+ * Sets the value of the property with the given key. Returns the old property
+ * associated with that key, if any. Setting a value of <code>null</code> will
+ * remove the corresponding key from the properties of this repository.
+ *
+ * @param key The property key
+ * @param value The new property value, or <code>null</code> to remove the key
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @return The old property value, or <code>null</code> if there was no old value
+ * @since 2.1
+ */
+ public String setProperty(String key, String value, IProgressMonitor monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
index 3e68f2b16..28180b72a 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/IArtifactRepository.java
@@ -62,15 +62,38 @@ public interface IArtifactRepository extends IRepository<IArtifactKey> {
* content is in this repository and the given descriptor accurately describes
* that content.
* @param descriptor the descriptor to add.
+ * @deprecated See {{@link #addDescriptor(IArtifactDescriptor, IProgressMonitor)}
*/
public void addDescriptor(IArtifactDescriptor descriptor);
/**
+ * 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.
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor);
+
+ /**
* Add the given artifact descriptors to this repository
* @param descriptors the artifact descriptors to add
+ * @deprecated See {{@link #addDescriptors(IArtifactDescriptor[], IProgressMonitor)}
*/
public void addDescriptors(IArtifactDescriptor[] descriptors);
+ /**
+ * Add the given artifact descriptors to this repository
+ * @param descriptors the artifact descriptors to add
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor);
+
/**
* Returns true if this repository contains the given descriptor.
* @param descriptor the descriptor to query
@@ -151,38 +174,89 @@ public interface IArtifactRepository extends IRepository<IArtifactKey> {
/**
* Remove the all keys, descriptors, and contents from this repository.
+ * @deprecated See {@link #removeAll(IProgressMonitor)}
*/
public void removeAll();
/**
+ * Remove the all keys, descriptors, and contents from this repository.
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void removeAll(IProgressMonitor monitor);
+
+ /**
* Remove the given descriptor and its corresponding content in this repository.
* @param descriptor the descriptor to remove.
+ * @deprecated See {@link #removeDescriptor(IArtifactDescriptor, IProgressMonitor)}
*/
public void removeDescriptor(IArtifactDescriptor descriptor);
/**
+ * Remove the given descriptor and its corresponding content in this repository.
+ * @param descriptor the descriptor to remove.
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor);
+
+ /**
* Remove the given key and all related content and descriptors from this repository.
* @param key the key to remove.
+ * @deprecated See {@link #removeDescriptor(IArtifactKey, IProgressMonitor)}
*/
public void removeDescriptor(IArtifactKey key);
/**
+ * Remove the given key and all related content and descriptors from this repository.
+ * @param key the key to remove.
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor);
+
+ /**
* Remove the given list of artifact descriptors and their corresponding content
* in this repository.
* @param descriptors the list of descriptors to remove
* @since 2.1
+ * @deprecated See {@link #removeDescriptors(IArtifactDescriptor[], IProgressMonitor)}
*/
public void removeDescriptors(IArtifactDescriptor[] descriptors);
/**
+ * Remove the given list of artifact descriptors and their corresponding content
+ * in this repository.
+ * @param descriptors the list of descriptors to remove
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor);
+
+ /**
* Remove the given list of keys and all related content and descriptors from this
* repository.
* @param keys
* @since 2.1
+ * @deprecated See {@link #removeDescriptors(IArtifactKey[], IProgressMonitor)}
*/
public void removeDescriptors(IArtifactKey[] keys);
/**
+ * Remove the given list of keys and all related content and descriptors from this
+ * repository.
+ * @param keys
+ * @param monitor A progress monitor use to track progress and cancel the operation. This may
+ * be a long running operation if another process holds the lock on this location
+ * @since 2.1
+ */
+ public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor);
+
+ /**
* Executes a runnable against this repository. It is up to the repository
* implementor to determine what "batch process" means, for example, it may mean
* that the repository index is not stored until after the runnable completes.
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/AbstractArtifactRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/AbstractArtifactRepository.java
index 2bc970d76..a33292d66 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/AbstractArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/spi/AbstractArtifactRepository.java
@@ -50,41 +50,109 @@ public abstract class AbstractArtifactRepository extends AbstractRepository<IArt
public abstract IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor);
public abstract OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException;
+
+ public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
+ assertModifiable();
+ }
+ /**
+ * @deprecated
+ */
public void addDescriptor(IArtifactDescriptor descriptor) {
+ this.addDescriptor(descriptor, new NullProgressMonitor());
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 2.2
+ */
+ public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
assertModifiable();
}
+ /**
+ * @deprecated
+ */
public void addDescriptors(IArtifactDescriptor[] descriptors) {
+ this.addDescriptors(descriptors, new NullProgressMonitor());
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 2.2
+ */
+ public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
assertModifiable();
}
+ /**
+ * @deprecated
+ */
public void removeDescriptor(IArtifactDescriptor descriptor) {
+ this.removeDescriptor(descriptor, new NullProgressMonitor());
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 2.1
+ */
+ public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
assertModifiable();
}
/**
* {@inheritDoc}
* @since 2.1
+ * @deprecated ?? Strange that we added an API and then deprecated it
*/
public void removeDescriptors(IArtifactDescriptor[] descriptors) {
+ this.removeDescriptors(descriptors, new NullProgressMonitor());
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 2.1
+ */
+ public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) {
assertModifiable();
}
+ /**
+ * @deprecated
+ */
public void removeDescriptor(IArtifactKey key) {
+ this.removeDescriptor(key, new NullProgressMonitor());
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 2.1
+ */
+ public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) {
assertModifiable();
}
/**
* {@inheritDoc}
* @since 2.1
+ * @deprecated ?? Strange that we added an API and then deprecated it
*/
public void removeDescriptors(IArtifactKey[] keys) {
+ this.removeDescriptors(keys, new NullProgressMonitor());
+ }
+
+ /**
+ * @since 2.1
+ */
+ public void removeAll(IProgressMonitor monitor) {
assertModifiable();
}
+ /**
+ * @deprecated
+ */
public void removeAll() {
- assertModifiable();
+ this.removeAll(new NullProgressMonitor());
}
public boolean equals(Object o) {
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
index e833c1cb8..cfe629603 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
@@ -12,7 +12,7 @@ package org.eclipse.equinox.p2.repository.spi;
import java.net.URI;
import java.util.Map;
-import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -171,8 +171,9 @@ public abstract class AbstractRepository<T> extends PlatformObject implements IR
/**
* {@inheritDoc}
+ * @since 2.1
*/
- public synchronized String setProperty(String key, String value) {
+ public synchronized String setProperty(String key, String value, IProgressMonitor monitor) {
assertModifiable();
if (key.equals(IRepository.PROP_NAME)) {
String oldName = getName();
@@ -183,6 +184,13 @@ public abstract class AbstractRepository<T> extends PlatformObject implements IR
}
/**
+ * {@inheritDoc}
+ */
+ public final synchronized String setProperty(String key, String value) {
+ return this.setProperty(key, value, new NullProgressMonitor());
+ }
+
+ /**
* Sets the provider of this repository
*
* @param provider the repository provider

Back to the top