Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2010-02-25 12:31:06 -0500
committerThomas Hallgren2010-02-25 12:31:06 -0500
commiteaa7cbe6e5818394bc1673a8babc7d4ebd30ed13 (patch)
tree6bc72abf5945357db9fa97b602b8d4b1ab138243 /bundles/org.eclipse.equinox.p2.repository
parentd3c84a2ee68e14ef740e238f90a214a9b14422e8 (diff)
downloadrt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.tar.gz
rt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.tar.xz
rt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.zip
302201 : Unify the two query approaches used in p2, final step.
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java18
3 files changed, 15 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index 47af929c7..c90b94161 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -1112,7 +1112,7 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
}
}
try {
- CompoundQueryable<T> compoundQueryable = new CompoundQueryable<T>(queryables);
+ IQueryable<T> compoundQueryable = QueryUtil.compoundQueryable(queryables);
return compoundQueryable.query(query, sub.newChild(locations.length * 1));
} finally {
sub.done();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
index f387beb78..56337f1be 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactDescriptorQuery.java
@@ -12,11 +12,12 @@
package org.eclipse.equinox.p2.repository.artifact;
+import org.eclipse.equinox.p2.query.ExpressionMatchQuery;
+
import java.util.*;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.metadata.expression.*;
-import org.eclipse.equinox.p2.metadata.query.ExpressionQuery;
/**
* A general purpose query for matching {@link IArtifactDescriptor} instances
@@ -24,7 +25,7 @@ import org.eclipse.equinox.p2.metadata.query.ExpressionQuery;
*
* @since 2.0
*/
-public class ArtifactDescriptorQuery extends ExpressionQuery<IArtifactDescriptor> {
+public class ArtifactDescriptorQuery extends ExpressionMatchQuery<IArtifactDescriptor> {
private static final IExpression descriptorMatch = ExpressionUtil.parse(//
"artifactKey.id == $0 && artifactKey.version ~= $1 && ($2.empty || $2.all(x | properties[x.key] == x.value))"); //$NON-NLS-1$
@@ -56,7 +57,7 @@ public class ArtifactDescriptorQuery extends ExpressionQuery<IArtifactDescriptor
*/
private ArtifactDescriptorQuery() {
//matches everything
- super(IArtifactDescriptor.class, matchAll());
+ super(IArtifactDescriptor.class, ExpressionUtil.TRUE_EXPRESSION);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
index b093d68cc..02e154322 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/artifact/ArtifactKeyQuery.java
@@ -12,10 +12,12 @@
package org.eclipse.equinox.p2.repository.artifact;
+import org.eclipse.equinox.p2.query.ExpressionMatchQuery;
+
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.VersionRange;
-import org.eclipse.equinox.p2.metadata.expression.*;
-import org.eclipse.equinox.p2.metadata.query.ExpressionQuery;
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
+import org.eclipse.equinox.p2.metadata.expression.IExpression;
/**
* A general purpose query for matching {@link IArtifactKey} instances
@@ -23,22 +25,22 @@ import org.eclipse.equinox.p2.metadata.query.ExpressionQuery;
*
* @since 2.0
*/
-public class ArtifactKeyQuery extends ExpressionQuery<IArtifactKey> {
+public class ArtifactKeyQuery extends ExpressionMatchQuery<IArtifactKey> {
private static final IExpression matchKey = ExpressionUtil.parse("this == $0"); //$NON-NLS-1$
private static final IExpression matchID = ExpressionUtil.parse("id == $0"); //$NON-NLS-1$
private static final IExpression matchIDClassifierRange = ExpressionUtil.parse("id == $0 && version ~= $2 && (null == $1 || classifier == $1)"); //$NON-NLS-1$
- private static IMatchExpression<IArtifactKey> createMatchExpression(IArtifactKey key) {
+ private static IExpression createMatchExpression(IArtifactKey key) {
if (key == null)
- return matchAll();
+ return ExpressionUtil.TRUE_EXPRESSION;
return ExpressionUtil.getFactory().<IArtifactKey> matchExpression(matchKey, key);
}
- private static IMatchExpression<IArtifactKey> createMatchExpression(String classifier, String id, VersionRange range) {
+ private static IExpression createMatchExpression(String classifier, String id, VersionRange range) {
if (range == null) {
if (classifier == null) {
if (id == null)
- return matchAll();
+ return ExpressionUtil.TRUE_EXPRESSION;
return ExpressionUtil.getFactory().<IArtifactKey> matchExpression(matchID, id);
}
range = VersionRange.emptyRange;
@@ -60,7 +62,7 @@ public class ArtifactKeyQuery extends ExpressionQuery<IArtifactKey> {
}
private ArtifactKeyQuery() {
- super(IArtifactKey.class, matchAll());
+ super(IArtifactKey.class, ExpressionUtil.TRUE_EXPRESSION);
}
public ArtifactKeyQuery(IArtifactKey key) {

Back to the top