blob: a63f39bc3dee5aca3de27624d3e2de5ff5038b01 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.prov.metadata;
import java.util.Dictionary;
import org.eclipse.equinox.internal.prov.metadata.MetadataActivator;
import org.osgi.framework.InvalidSyntaxException;
public class Selector {
private String id;
private String filter;
private boolean internal;
public Selector(String id, String filter, boolean internal) {
this.id = id;
this.filter = filter;
this.internal = internal;
}
public String getId() {
return id;
}
public boolean eval(Dictionary context) {
try {
return MetadataActivator.context.createFilter(filter).match(context);
} catch (InvalidSyntaxException e) {
//TODO log something. though that should not happen
return false;
}
}
public boolean isInternal() {
return internal;
}
}
|