blob: 2995a2d54d5cbdcf566734beb4b60874611105f8 (
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
45
46
47
48
49
50
51
52
|
/*******************************************************************************
* Copyright (c) 2003, 2005 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.osgi.internal.resolver;
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleSpecification;
public class BundleSpecificationImpl extends VersionConstraintImpl implements BundleSpecification {
private boolean exported;
private boolean optional;
protected void setExported(boolean exported) {
this.exported = exported;
}
protected void setOptional(boolean optional) {
this.optional = optional;
}
public boolean isExported() {
return exported;
}
public boolean isOptional() {
return optional;
}
public boolean isSatisfiedBy(BaseDescription supplier) {
if (!(supplier instanceof BundleDescription))
return false;
BundleDescription candidate = (BundleDescription) supplier;
if (candidate.getHost() != null)
return false;
if (getName() != null && getName().equals(candidate.getSymbolicName()) &&
(getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion())))
return true;
return false;
}
public String toString() {
return "Require-Bundle: " + getName() + " - version: " + getVersionRange(); //$NON-NLS-1$ //$NON-NLS-2$
}
}
|