KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > internal > module > ResolverImport


1 /*******************************************************************************
2  * Copyright (c) 2004, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.osgi.internal.module;
12
13 import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
14 import org.osgi.framework.Constants;
15
16 /*
17  * A companion to ImportPackageSpecification from the state used while resolving
18  */

19 public class ResolverImport extends ResolverConstraint {
20     // only used for dynamic imports
21
private String JavaDoc name;
22
23     ResolverImport(ResolverBundle bundle, ImportPackageSpecification ips) {
24         super(bundle, ips);
25     }
26
27     boolean isOptional() {
28         return ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(((ImportPackageSpecification) constraint).getDirective(Constants.RESOLUTION_DIRECTIVE));
29     }
30
31     boolean isDynamic() {
32         return ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(((ImportPackageSpecification) constraint).getDirective(Constants.RESOLUTION_DIRECTIVE));
33     }
34
35     public String JavaDoc getName() {
36         if (name != null)
37             return name; // return the required package set for a dynamic import
38
return super.getName();
39     }
40
41     // used for dynamic import package when wildcards are used
42
void setName(String JavaDoc requestedPackage) {
43         this.name = requestedPackage;
44     }
45 }
46
Popular Tags