|
Added
Link Here
|
| 1 |
/* |
| 2 |
* Copyright (c) OSGi Alliance (2011). 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 |
package org.osgi.framework.wiring; |
| 17 |
|
| 18 |
import org.osgi.framework.Constants; |
| 19 |
import org.osgi.framework.Version; |
| 20 |
|
| 21 |
/** |
| 22 |
* Defines standard names for the attributes, directives and name spaces for |
| 23 |
* resources, capabilities and requirements. |
| 24 |
* |
| 25 |
* <p> |
| 26 |
* The values associated with these keys are of type {@code String}, unless |
| 27 |
* otherwise indicated. |
| 28 |
* |
| 29 |
* @version $Id: 6a0df41f82a587eb72c0c513fdd0411f18564586 $ |
| 30 |
*/ |
| 31 |
public final class ResourceConstants { |
| 32 |
|
| 33 |
private ResourceConstants() { |
| 34 |
// keep others from creating objects of this type. |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Name space for the identity capability. Each {@link Resource resource} |
| 39 |
* should provide an identity capability that can be used to identify the |
| 40 |
* resource. |
| 41 |
* |
| 42 |
* For identity capability attributes the following applies: |
| 43 |
* <ul> |
| 44 |
* <li>The |
| 45 |
* <q>osgi.identity</q> attribute contains the symbolic name of the |
| 46 |
* resource. |
| 47 |
* <li>The {@link #IDENTITY_VERSION_ATTRIBUTE version} attribute contains |
| 48 |
* the {@link Version} of the resource. |
| 49 |
* <li>The {@link #IDENTITY_TYPE_ATTRIBUTE type} attribute contains the |
| 50 |
* resource type. |
| 51 |
* </ul> |
| 52 |
* <p> |
| 53 |
* A resource with a symbolic name provides exactly one <sup>†</sup> identity |
| 54 |
* {@link Resource#getCapabilities(String) capability}. |
| 55 |
* <p> |
| 56 |
* † A resource with no symbolic name must not provide an identity |
| 57 |
* capability. |
| 58 |
*/ |
| 59 |
public static final String IDENTITY_NAMESPACE = "osgi.identity"; |
| 60 |
|
| 61 |
/** |
| 62 |
* An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the |
| 63 |
* {@link Version version} of the resource. This attribute must be set to a value of |
| 64 |
* type {@link Version}. If the resource has no version then the value |
| 65 |
* {@link Version#emptyVersion 0.0.0} must be used for the attribute. |
| 66 |
*/ |
| 67 |
public static final String IDENTITY_VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE; |
| 68 |
|
| 69 |
/** |
| 70 |
* An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the |
| 71 |
* resource type. This attribute must be set to a value of type {@link String}. |
| 72 |
* if the resource has no type then the value |
| 73 |
* {@link ResourceConstants#IDENTITY_TYPE_UNKNOWN unknown} must be used for the |
| 74 |
* attribute. |
| 75 |
*/ |
| 76 |
public static final String IDENTITY_TYPE_ATTRIBUTE = "type"; |
| 77 |
|
| 78 |
/** |
| 79 |
* An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} |
| 80 |
* attribute value identifying the resource type as an OSGi bundle. |
| 81 |
*/ |
| 82 |
public static final String IDENTITY_TYPE_BUNDLE = "osgi.bundle"; |
| 83 |
|
| 84 |
/** |
| 85 |
* An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} |
| 86 |
* attribute value identifying the resource type as an OSGi fragment. |
| 87 |
*/ |
| 88 |
public static final String IDENTITY_TYPE_FRAGMENT = "osgi.fragment"; |
| 89 |
|
| 90 |
/** |
| 91 |
* An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} |
| 92 |
* attribute value identifying the resource type as unknown. |
| 93 |
*/ |
| 94 |
public static final String IDENTITY_TYPE_UNKNOWN = "unknown"; |
| 95 |
|
| 96 |
/** |
| 97 |
* An {@link #IDENTITY_NAMESPACE identity} capability {@link Requirement#getDirectives() directive} |
| 98 |
* identifying if the resource is a singleton. A {@link String} value of "true" indicates |
| 99 |
* the resource is a singleton; any other value or <code>null</code> indicates the resource is not a |
| 100 |
* singleton. |
| 101 |
*/ |
| 102 |
public static final String IDENTITY_SINGLETON_DIRECTIVE = Constants.SINGLETON_DIRECTIVE; |
| 103 |
|
| 104 |
/** |
| 105 |
* Name space for package capabilities and requirements. |
| 106 |
* |
| 107 |
* For capability attributes the following applies: |
| 108 |
* <ul> |
| 109 |
* <li>The |
| 110 |
* <q>osgi.wiring.package</q> attribute contains the name of the package. |
| 111 |
* <li>The {@link Constants#VERSION_ATTRIBUTE version} attribute contains |
| 112 |
* the the {@link Version} of the package if one is specified or |
| 113 |
* {@link Version#emptyVersion} if not specified. |
| 114 |
* <li>The {@link Constants#BUNDLE_SYMBOLICNAME_ATTRIBUTE |
| 115 |
* bundle-symbolic-name} attribute contains the symbolic name of the |
| 116 |
* resource providing the package if one is specified. |
| 117 |
* <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} |
| 118 |
* attribute contains the {@link Version} of resource providing the package |
| 119 |
* if one is specified or {@link Version#emptyVersion} if not specified. |
| 120 |
* <li>All other attributes are of type {@link String} and are used as |
| 121 |
* arbitrary matching attributes for the capability. |
| 122 |
* </ul> |
| 123 |
* <p> |
| 124 |
* A resource provides zero or more package |
| 125 |
* {@link Resource#getCapabilities(String) capabilities} (this is, exported |
| 126 |
* packages) and requires zero or more package |
| 127 |
* {@link Resource#getRequirements(String) requirements} (that is, imported |
| 128 |
* packages). |
| 129 |
*/ |
| 130 |
public static final String WIRING_PACKAGE_NAMESPACE = "osgi.wiring.package"; |
| 131 |
|
| 132 |
/** |
| 133 |
* Name space for bundle capabilities and requirements. |
| 134 |
* |
| 135 |
* For capability attributes the following applies: |
| 136 |
* <ul> |
| 137 |
* <li>The |
| 138 |
* <q>osgi.wiring.bundle</q> attribute contains the symbolic name of the |
| 139 |
* bundle. |
| 140 |
* <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} |
| 141 |
* attribute contains the {@link Version} of the bundle if one is specified |
| 142 |
* or {@link Version#emptyVersion} if not specified. |
| 143 |
* <li>All other attributes are of type {@link String} and are used as |
| 144 |
* arbitrary matching attributes for the capability. |
| 145 |
* </ul> |
| 146 |
* <p> |
| 147 |
* A non-fragment resource with the {@link #IDENTITY_TYPE_BUNDLE |
| 148 |
* osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides |
| 149 |
* exactly one <sup>†</sup> bundle |
| 150 |
* {@link Resource#getCapabilities(String) capability} (that is, the bundle |
| 151 |
* can be required by another bundle). A fragment resource with the |
| 152 |
* {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type |
| 153 |
* {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare |
| 154 |
* a bundle capability. A resource requires zero or more bundle |
| 155 |
* {@link Resource#getRequirements(String) requirements} (that is, required |
| 156 |
* bundles). |
| 157 |
* <p> |
| 158 |
* † A resource with no symbolic name must not provide a bundle |
| 159 |
* capability. |
| 160 |
*/ |
| 161 |
public static final String WIRING_BUNDLE_NAMESPACE = "osgi.wiring.bundle"; |
| 162 |
|
| 163 |
/** |
| 164 |
* Name space for host capabilities and requirements. |
| 165 |
* |
| 166 |
* For capability attributes the following applies: |
| 167 |
* <ul> |
| 168 |
* <li>The |
| 169 |
* <q>osgi.wiring.host</q> attribute contains the symbolic name of the |
| 170 |
* bundle. |
| 171 |
* <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} |
| 172 |
* attribute contains the {@link Version} of the bundle if one is specified |
| 173 |
* or {@link Version#emptyVersion} if not specified. |
| 174 |
* <li>All other attributes are of type {@link String} and are used as |
| 175 |
* arbitrary matching attributes for the capability. |
| 176 |
* </ul> |
| 177 |
* <p> |
| 178 |
* <p> |
| 179 |
* A non-fragment resource with the with the {@link #IDENTITY_TYPE_BUNDLE |
| 180 |
* osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides |
| 181 |
* zero or one <sup>†</sup> host |
| 182 |
* {@link Resource#getCapabilities(String) capabilities}. |
| 183 |
* A fragment resource with the |
| 184 |
* {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type |
| 185 |
* {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare |
| 186 |
* a host capability and must |
| 187 |
* {@link Resource#getRequirements(String) declare} exactly one host |
| 188 |
* requirement. |
| 189 |
* <p> |
| 190 |
* † A resource with no bundle symbolic name must not provide a host |
| 191 |
* capability. |
| 192 |
*/ |
| 193 |
public static final String WIRING_HOST_NAMESPACE = "osgi.wiring.host"; |
| 194 |
|
| 195 |
/** |
| 196 |
* A requirement {@link Requirement#getDirectives() directive} used to |
| 197 |
* specify a capability filter. This filter is used to match against a |
| 198 |
* capability's {@link Capability#getAttributes() attributes}. |
| 199 |
*/ |
| 200 |
public final static String REQUIREMENT_FILTER_DIRECTIVE = Constants.FILTER_DIRECTIVE; |
| 201 |
|
| 202 |
/** |
| 203 |
* A requirement {@link Requirement#getDirectives() directive} used to |
| 204 |
* specify the resolution type for a requirement. The default value is |
| 205 |
* {@link #REQUIREMENT_RESOLUTION_MANDATORY mandatory}. |
| 206 |
* |
| 207 |
* @see #REQUIREMENT_RESOLUTION_MANDATORY mandatory |
| 208 |
* @see #REQUIREMENT_RESOLUTION_OPTIONAL optional |
| 209 |
*/ |
| 210 |
public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE; |
| 211 |
/** |
| 212 |
* A directive value identifying a mandatory |
| 213 |
* {@link Resource#getRequirements(String) requirement} resolution type. A |
| 214 |
* mandatory resolution type indicates that the requirement must be resolved |
| 215 |
* when the {@link Resource resource} is resolved. If such requirement |
| 216 |
* cannot be resolved, the resource fails to resolve. |
| 217 |
* |
| 218 |
* @see #REQUIREMENT_RESOLUTION_DIRECTIVE |
| 219 |
*/ |
| 220 |
public final static String REQUIREMENT_RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY; |
| 221 |
|
| 222 |
/** |
| 223 |
* A directive value identifying an optional |
| 224 |
* {@link Resource#getRequirements(String) requirement} resolution type. An |
| 225 |
* optional resolution type indicates that the requirement is optional and |
| 226 |
* the {@link Resource resource} may be resolved without requirement being |
| 227 |
* resolved. |
| 228 |
* |
| 229 |
* @see #REQUIREMENT_RESOLUTION_DIRECTIVE |
| 230 |
*/ |
| 231 |
public final static String REQUIREMENT_RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL; |
| 232 |
|
| 233 |
/** |
| 234 |
* A requirement {@link Requirement#getDirectives() directive} used to |
| 235 |
* specify the effective time for the requirement. The default value is |
| 236 |
* {@link #EFFECTIVE_RESOLVE resolve}. |
| 237 |
* |
| 238 |
* @see #EFFECTIVE_RESOLVE resolve |
| 239 |
* @see #EFFECTIVE_ACTIVE active |
| 240 |
*/ |
| 241 |
public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; |
| 242 |
|
| 243 |
/** |
| 244 |
* A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE |
| 245 |
* capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that |
| 246 |
* is effective at resolve time. Capabilities and requirements with an |
| 247 |
* effective time of resolve are the only capabilities which are processed |
| 248 |
* while resolving a resource. |
| 249 |
* |
| 250 |
* @see #REQUIREMENT_EFFECTIVE_DIRECTIVE |
| 251 |
* @see #CAPABILITY_EFFECTIVE_DIRECTIVE |
| 252 |
*/ |
| 253 |
public final static String EFFECTIVE_RESOLVE = Constants.EFFECTIVE_RESOLVE; |
| 254 |
|
| 255 |
/** |
| 256 |
* A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE |
| 257 |
* capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that |
| 258 |
* is effective at active time. Capabilities and requirements with an |
| 259 |
* effective time of active are ignored while resolving a resource. |
| 260 |
* |
| 261 |
* @see #REQUIREMENT_EFFECTIVE_DIRECTIVE |
| 262 |
* @see #CAPABILITY_EFFECTIVE_DIRECTIVE |
| 263 |
*/ |
| 264 |
public final static String EFFECTIVE_ACTIVE = Constants.EFFECTIVE_ACTIVE; |
| 265 |
|
| 266 |
/** |
| 267 |
* A requirement {@link Requirement#getDirectives() directive} used to |
| 268 |
* specify the visibility type for a requirement. The default value is |
| 269 |
* {@link #REQUIREMENT_VISIBILITY_PRIVATE private}. This directive must only |
| 270 |
* be used for requirements with the require |
| 271 |
* {@link #WIRING_BUNDLE_NAMESPACE bundle} name space. |
| 272 |
* |
| 273 |
* @see #REQUIREMENT_VISIBILITY_PRIVATE private |
| 274 |
* @see #REQUIREMENT_VISIBILITY_REEXPORT reexport |
| 275 |
*/ |
| 276 |
public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = Constants.VISIBILITY_DIRECTIVE; |
| 277 |
|
| 278 |
/** |
| 279 |
* A directive value identifying a private |
| 280 |
* {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private |
| 281 |
* visibility type indicates that any {@link #WIRING_PACKAGE_NAMESPACE |
| 282 |
* packages} that are exported by the required |
| 283 |
* {@link #WIRING_BUNDLE_NAMESPACE bundle} are not made visible on the |
| 284 |
* export signature of the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle} |
| 285 |
* . |
| 286 |
* |
| 287 |
* @see #REQUIREMENT_VISIBILITY_DIRECTIVE |
| 288 |
*/ |
| 289 |
public final static String REQUIREMENT_VISIBILITY_PRIVATE = Constants.VISIBILITY_PRIVATE; |
| 290 |
|
| 291 |
/** |
| 292 |
* A directive value identifying a reexport |
| 293 |
* {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport |
| 294 |
* visibility type indicates any {@link #WIRING_PACKAGE_NAMESPACE packages} |
| 295 |
* that are exported by the required {@link #WIRING_BUNDLE_NAMESPACE bundle} |
| 296 |
* are re-exported by the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}. |
| 297 |
*/ |
| 298 |
public final static String REQUIREMENT_VISIBILITY_REEXPORT = Constants.VISIBILITY_REEXPORT; |
| 299 |
|
| 300 |
/** |
| 301 |
* A requirement {@link Requirement#getDirectives() directive} used to |
| 302 |
* specify the cardinality for a requirement. The default value is |
| 303 |
* {@link #REQUIREMENT_CARDINALITY_SINGULAR singular}. |
| 304 |
* |
| 305 |
* @see #REQUIREMENT_CARDINALITY_MULTIPLE multiple |
| 306 |
* @see #REQUIREMENT_CARDINALITY_SINGULAR singular |
| 307 |
*/ |
| 308 |
public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality"; |
| 309 |
|
| 310 |
/** |
| 311 |
* A directive value identifying a multiple |
| 312 |
* {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. |
| 313 |
*/ |
| 314 |
public final static String REQUIREMENT_CARDINALITY_MULTIPLE = "multiple"; |
| 315 |
|
| 316 |
/** |
| 317 |
* A directive value identifying a singular |
| 318 |
* {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. |
| 319 |
*/ |
| 320 |
public final static String REQUIREMENT_CARDINALITY_SINGULAR = "singular"; |
| 321 |
|
| 322 |
/** |
| 323 |
* A capability {@link Capability#getDirectives() directive} used to specify |
| 324 |
* the comma separated list of {@link #WIRING_PACKAGE_NAMESPACE package} |
| 325 |
* names a capability uses. |
| 326 |
*/ |
| 327 |
public final static String CAPABILITY_USES_DIRECTIVE = Constants.USES_DIRECTIVE; |
| 328 |
|
| 329 |
/** |
| 330 |
* A capability {@link Capability#getDirectives() directive} used to specify |
| 331 |
* the effective time for the capability. The default value is |
| 332 |
* {@link #EFFECTIVE_RESOLVE resolve}. |
| 333 |
* |
| 334 |
* @see #EFFECTIVE_RESOLVE resolve |
| 335 |
* @see #EFFECTIVE_ACTIVE active |
| 336 |
*/ |
| 337 |
public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; |
| 338 |
|
| 339 |
/** |
| 340 |
* A capability {@link Capability#getDirectives() directive} used to specify |
| 341 |
* the comma separated list of mandatory attributes which must be specified |
| 342 |
* in the {@link #REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in |
| 343 |
* order for the capability to match the requirement. This directive must |
| 344 |
* only be used for capabilities with the {@link #WIRING_PACKAGE_NAMESPACE |
| 345 |
* package} name space. |
| 346 |
*/ |
| 347 |
public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory"; |
| 348 |
|
| 349 |
/** |
| 350 |
* A capability {@link Capability#getDirectives() directive} used to specify |
| 351 |
* the comma separated list of classes which must be allowed to be exported. |
| 352 |
* This directive must only be used for capabilities with the |
| 353 |
* {@link #WIRING_PACKAGE_NAMESPACE package} name space. |
| 354 |
*/ |
| 355 |
public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include"; |
| 356 |
|
| 357 |
/** |
| 358 |
* A capability {@link Capability#getDirectives() directive} used to specify |
| 359 |
* the comma separated list of classes which must not be allowed to be |
| 360 |
* exported. This directive must only be used for capabilities with the |
| 361 |
* {@link #WIRING_PACKAGE_NAMESPACE package} name space. |
| 362 |
*/ |
| 363 |
public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude"; |
| 364 |
} |