Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 848841ba688072b662455fee9c783a623f194e74 (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
/*******************************************************************************
 * Copyright (c) 2004, 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.osgi.internal.module;

import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.osgi.framework.Constants;

/*
 * A companion to ImportPackageSpecification from the state used while resolving
 */
public class ResolverImport extends ResolverConstraint {
	// only used for dynamic imports
	private String name;

	ResolverImport(ResolverBundle bundle, ImportPackageSpecification ips) {
		super(bundle, ips);
	}

	boolean isOptional() {
		return ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(((ImportPackageSpecification) constraint).getDirective(Constants.RESOLUTION_DIRECTIVE));
	}

	boolean isDynamic() {
		return ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(((ImportPackageSpecification) constraint).getDirective(Constants.RESOLUTION_DIRECTIVE));
	}

	public String getName() {
		if (name != null)
			return name; // return the required package set for a dynamic import
		return super.getName();
	}

	// used for dynamic import package when wildcards are used
	void setName(String requestedPackage) {
		this.name = requestedPackage;
	}
}

Back to the top