1 /*
2  * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package org.osgi.resource;
18 
19 import org.osgi.annotation.versioning.ConsumerType;
20 
21 /**
22  * Capability and Requirement Namespaces base class.
23  *
24  * <p>
25  * This class is the common class shared by all OSGi defined namespaces. It
26  * defines the names for the common attributes and directives for the OSGi
27  * specified namespaces.
28  *
29  * <p>
30  * The OSGi Alliance reserves the right to extend the set of directives and
31  * attributes which have specified semantics for all of the specified
32  * namespaces.
33  *
34  * <p>
35  * The values associated with these keys are of type {@code String}, unless
36  * otherwise indicated.
37  *
38  * @Immutable
39  * @author $Id: 95a67250528646012b39e8e5a92775fbb635a8c0 $
40  */
41 @ConsumerType
42 public abstract class Namespace {
43 
44 	/**
45 	 * The capability directive used to specify the comma separated list of
46 	 * package names used by a capability.
47 	 */
48 	public final static String	CAPABILITY_USES_DIRECTIVE			= "uses";
49 
50 	/**
51 	 * The capability directive used to specify the effective time for the
52 	 * capability. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
53 	 *
54 	 * @see #EFFECTIVE_RESOLVE resolve
55 	 * @see #EFFECTIVE_ACTIVE active
56 	 */
57 	public final static String	CAPABILITY_EFFECTIVE_DIRECTIVE		= "effective";
58 
59 	/**
60 	 * The requirement directive used to specify a capability filter. This
61 	 * filter is used to match against a capability's attributes.
62 	 */
63 	public final static String	REQUIREMENT_FILTER_DIRECTIVE		= "filter";
64 
65 	/**
66 	 * The requirement directive used to specify the resolution type for a
67 	 * requirement. The default value is {@link #RESOLUTION_MANDATORY mandatory}
68 	 * .
69 	 *
70 	 * @see #RESOLUTION_MANDATORY mandatory
71 	 * @see #RESOLUTION_OPTIONAL optional
72 	 */
73 	public final static String	REQUIREMENT_RESOLUTION_DIRECTIVE	= "resolution";
74 
75 	/**
76 	 * The directive value identifying a mandatory requirement resolution type.
77 	 * A mandatory resolution type indicates that the requirement must be
78 	 * resolved when the resource is resolved. If such a requirement cannot be
79 	 * resolved, the resource fails to resolve.
80 	 *
81 	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
82 	 */
83 	public final static String	RESOLUTION_MANDATORY				= "mandatory";
84 
85 	/**
86 	 * The directive value identifying an optional requirement resolution type.
87 	 * An optional resolution type indicates that the requirement is optional
88 	 * and the resource may be resolved without the requirement being resolved.
89 	 *
90 	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
91 	 */
92 	public final static String	RESOLUTION_OPTIONAL					= "optional";
93 
94 	/**
95 	 * The requirement directive used to specify the effective time for the
96 	 * requirement. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
97 	 *
98 	 * @see #EFFECTIVE_RESOLVE resolve
99 	 * @see #EFFECTIVE_ACTIVE active
100 	 */
101 	public final static String	REQUIREMENT_EFFECTIVE_DIRECTIVE		= "effective";
102 
103 	/**
104 	 * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
105 	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
106 	 * is effective at resolve time. Capabilities and requirements with an
107 	 * effective time of resolve are the only capabilities which are processed
108 	 * while resolving a resource.
109 	 *
110 	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
111 	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
112 	 */
113 	public final static String	EFFECTIVE_RESOLVE					= "resolve";
114 
115 	/**
116 	 * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
117 	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
118 	 * is effective at active time. Capabilities and requirements with an
119 	 * effective time of active are ignored while resolving a resource.
120 	 *
121 	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
122 	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
123 	 */
124 	public final static String	EFFECTIVE_ACTIVE					= "active";
125 
126 	/**
127 	 * The requirement directive used to specify the cardinality for a
128 	 * requirement. The default value is {@link #CARDINALITY_SINGLE single}.
129 	 *
130 	 * @see #CARDINALITY_MULTIPLE multiple
131 	 * @see #CARDINALITY_SINGLE single
132 	 */
133 	public final static String	REQUIREMENT_CARDINALITY_DIRECTIVE	= "cardinality";
134 
135 	/**
136 	 * The directive value identifying a multiple
137 	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
138 	 *
139 	 * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
140 	 */
141 	public final static String	CARDINALITY_MULTIPLE				= "multiple";
142 
143 	/**
144 	 * The directive value identifying a
145 	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type of single.
146 	 *
147 	 * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
148 	 */
149 	public final static String	CARDINALITY_SINGLE					= "single";
150 
151 	/**
152 	 * Protected constructor for Namespace sub-types.
153 	 */
Namespace()154 	protected Namespace() {
155 		// empty
156 	}
157 }
158