diff options
author | Thomas Watson | 2012-11-09 17:12:51 +0000 |
---|---|---|
committer | Thomas Watson | 2012-11-09 17:12:51 +0000 |
commit | 943def205992206463d1288a1fab3f56d0029fc9 (patch) | |
tree | 23cba92f04cf9449c8e39afe181d1c66c53e5b4f /bundles/org.eclipse.osgi | |
parent | 105e8ecc839d6e9647291dfbc5dfb1b188b3ac58 (diff) | |
download | rt.equinox.framework-943def205992206463d1288a1fab3f56d0029fc9.tar.gz rt.equinox.framework-943def205992206463d1288a1fab3f56d0029fc9.tar.xz rt.equinox.framework-943def205992206463d1288a1fab3f56d0029fc9.zip |
Add NativeNamespace class from osgi
Diffstat (limited to 'bundles/org.eclipse.osgi')
7 files changed, 120 insertions, 103 deletions
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF index 3f4eeb900..599a3289f 100644 --- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF @@ -47,7 +47,7 @@ Export-Package: org.eclipse.core.runtime.adaptor;x-friends:="org.eclipse.core.ru org.osgi.framework.hooks.service;version="1.1", org.osgi.framework.hooks.weaving;version="1.1", org.osgi.framework.launch;version="1.1", - org.osgi.framework.namespace;version="1.0", + org.osgi.framework.namespace;version="1.1", org.osgi.framework.startlevel;version="1.0", org.osgi.framework.wiring;version="1.1", org.osgi.resource;version="1.0", diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java index 1d388021a..a2278b409 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java @@ -11,7 +11,7 @@ package org.eclipse.osgi.container; import java.util.*; -import org.eclipse.osgi.container.namespaces.EquinoxNativeEnvironmentNamespace; +import org.osgi.framework.namespace.NativeNamespace; import org.osgi.framework.wiring.BundleCapability; /** @@ -29,7 +29,7 @@ public final class ModuleCapability implements BundleCapability { this.namespace = namespace; this.directives = directives; this.attributes = attributes; - this.transientAttrs = EquinoxNativeEnvironmentNamespace.NATIVE_ENVIRONMENT_NAMESPACE.equals(namespace) ? new HashMap<String, Object>(0) : null; + this.transientAttrs = NativeNamespace.NATIVE_NAMESPACE.equals(namespace) ? new HashMap<String, Object>(0) : null; this.revision = revision; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java index 108607962..69d800326 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java @@ -14,11 +14,13 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.*; import org.eclipse.osgi.container.ModuleRevisionBuilder; -import org.eclipse.osgi.container.namespaces.*; +import org.eclipse.osgi.container.namespaces.EclipsePlatformNamespace; +import org.eclipse.osgi.container.namespaces.EquinoxModuleDataNamespace; import org.eclipse.osgi.framework.internal.core.Msg; import org.eclipse.osgi.framework.internal.core.Tokenizer; import org.eclipse.osgi.internal.framework.EquinoxContainer; import org.eclipse.osgi.internal.framework.FilterImpl; +import org.eclipse.osgi.storage.NativeCodeFinder; import org.eclipse.osgi.storage.Storage; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; @@ -39,6 +41,8 @@ public final class OSGiManifestBuilderFactory { private static final String ATTR_TYPE_SET = "set"; //$NON-NLS-1$ private static final String ATTR_TYPE_LIST = "List"; //$NON-NLS-1$ private static final String[] DEFINED_OSGI_VALIDATE_HEADERS = {Constants.IMPORT_PACKAGE, Constants.DYNAMICIMPORT_PACKAGE, Constants.EXPORT_PACKAGE, Constants.FRAGMENT_HOST, Constants.BUNDLE_SYMBOLICNAME, Constants.REQUIRE_BUNDLE}; + private static final Collection<String> SYSTEM_CAPABILITIES = Collections.unmodifiableCollection(Arrays.asList(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, NativeNamespace.NATIVE_NAMESPACE)); + private static final Collection<String> PROHIBITED_CAPABILITIES = Collections.unmodifiableCollection(Arrays.asList(IdentityNamespace.IDENTITY_NAMESPACE)); public static ModuleRevisionBuilder createBuilder(Map<String, String> manifest) throws BundleException { return createBuilder(manifest, null, null, null); @@ -63,9 +67,9 @@ public final class OSGiManifestBuilderFactory { getRequireBundle(builder, ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, manifest.get(Constants.REQUIRE_BUNDLE))); - getProvideCapabilities(builder, ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, manifest.get(Constants.PROVIDE_CAPABILITY))); + getProvideCapabilities(builder, ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, manifest.get(Constants.PROVIDE_CAPABILITY)), extraCapabilities == null); if (extraCapabilities != null) { - getProvideCapabilities(builder, ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, extraCapabilities)); + getProvideCapabilities(builder, ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, extraCapabilities), false); } getRequireCapabilities(builder, ManifestElement.parseHeader(Constants.REQUIRE_CAPABILITY, manifest.get(Constants.REQUIRE_CAPABILITY))); @@ -433,7 +437,7 @@ public final class OSGiManifestBuilderFactory { builder.addRequirement(HostNamespace.HOST_NAMESPACE, directives, new HashMap<String, Object>(0)); } - private static void getProvideCapabilities(ModuleRevisionBuilder builder, ManifestElement[] provideElements) throws BundleException { + private static void getProvideCapabilities(ModuleRevisionBuilder builder, ManifestElement[] provideElements, boolean chechSystemCapabilities) throws BundleException { if (provideElements == null) return; for (ManifestElement provideElement : provideElements) { @@ -441,8 +445,10 @@ public final class OSGiManifestBuilderFactory { Map<String, Object> attributes = getAttributes(provideElement); Map<String, String> directives = getDirectives(provideElement); for (String namespace : namespaces) { - if (IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace)) - throw new BundleException("A bundle is not allowed to define a capability in the " + IdentityNamespace.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$ + if (PROHIBITED_CAPABILITIES.contains(namespace) || (chechSystemCapabilities && SYSTEM_CAPABILITIES.contains(namespace))) { + throw new BundleException("A bundle is not allowed to define a capability in the " + namespace + " name space."); //$NON-NLS-1$ //$NON-NLS-2$ + } + builder.addCapability(namespace, directives, attributes); } } @@ -772,21 +778,21 @@ public final class OSGiManifestBuilderFactory { String filterAttribute = attribute; if (Constants.BUNDLE_NATIVECODE_OSNAME.equals(attribute)) { - filterAttribute = EquinoxNativeEnvironmentNamespace.CAPABILITY_OS_NAME_ATTRIBUTE; + filterAttribute = NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE; } else if (Constants.BUNDLE_NATIVECODE_PROCESSOR.equals(attribute)) { - filterAttribute = EquinoxNativeEnvironmentNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE; + filterAttribute = NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE; } else if (Constants.BUNDLE_NATIVECODE_LANGUAGE.equals(attribute)) { - filterAttribute = EquinoxNativeEnvironmentNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE; + filterAttribute = NativeNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE; hasLanguage = attrValues.length > 0; } else if (Constants.BUNDLE_NATIVECODE_OSVERSION.equals(attribute)) { - filterAttribute = EquinoxNativeEnvironmentNamespace.CAPABILITY_OS_VERSION_ATTRIBUTE; + filterAttribute = NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE; } if (attrValues.length > 1) { filter.append("(|"); //$NON-NLS-1$ } for (String attrAlias : attrValues) { - if (EquinoxNativeEnvironmentNamespace.CAPABILITY_OS_VERSION_ATTRIBUTE.equals(filterAttribute)) { + if (NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE.equals(filterAttribute)) { VersionRange range = new VersionRange(attrAlias); if (highestFloor == null || highestFloor.compareTo(range.getLeft()) < 0) { highestFloor = range.getLeft(); @@ -853,20 +859,20 @@ public final class OSGiManifestBuilderFactory { for (int i = 0; i < numNativePaths; i++) { NativeClause nativeClause = nativeClauses.get(i); if (numNativePaths == 1) { - attributes.put(EquinoxNativeEnvironmentNamespace.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE, nativeClause.nativePaths); + attributes.put(NativeCodeFinder.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE, nativeClause.nativePaths); } else { - attributes.put(EquinoxNativeEnvironmentNamespace.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE + '.' + i, nativeClause.nativePaths); + attributes.put(NativeCodeFinder.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE + '.' + i, nativeClause.nativePaths); } allNativeFilters.append(nativeClauses.get(i).filter); } allNativeFilters.append(')'); Map<String, String> directives = new HashMap<String, String>(2); - directives.put(EquinoxNativeEnvironmentNamespace.REQUIREMENT_FILTER_DIRECTIVE, allNativeFilters.toString()); + directives.put(NativeNamespace.REQUIREMENT_FILTER_DIRECTIVE, allNativeFilters.toString()); if (optional) { - directives.put(EquinoxNativeEnvironmentNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, EquinoxNativeEnvironmentNamespace.RESOLUTION_OPTIONAL); + directives.put(NativeNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, NativeNamespace.RESOLUTION_OPTIONAL); } - builder.addRequirement(EquinoxNativeEnvironmentNamespace.NATIVE_ENVIRONMENT_NAMESPACE, directives, attributes); + builder.addRequirement(NativeNamespace.NATIVE_NAMESPACE, directives, attributes); } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxNativeEnvironmentNamespace.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxNativeEnvironmentNamespace.java deleted file mode 100644 index 25ff8c1cd..000000000 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/namespaces/EquinoxNativeEnvironmentNamespace.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 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.container.namespaces; - -import org.osgi.resource.Namespace; - -/** - * Eclipse Platform and Requirement Namespace. - * - * <p> - * This class defines the names for the attributes and directives for this - * namespace. All unspecified capability attributes are of type {@code String} - * and are used as arbitrary matching attributes for the capability. The values - * associated with the specified directive and attribute keys are of type - * {@code String}, unless otherwise indicated. - * - * @Immutable - * @noinstantiate This class is not intended to be instantiated by clients. - * @since 3.10 - */ -public class EquinoxNativeEnvironmentNamespace extends Namespace { - - /** - * Namespace name for native environment. Unlike typical name spaces - * this namespace is not intended to be used as an attribute. - */ - public static final String NATIVE_ENVIRONMENT_NAMESPACE = "equinox.native.environment"; //$NON-NLS-1$ - - /** - * Specifies the supported canonical names for the environment OS. - * All names are lower case. - * The value of this attribute must be of type {@code List<String>}. - */ - public static final String CAPABILITY_OS_NAME_ATTRIBUTE = NATIVE_ENVIRONMENT_NAMESPACE + ".osname"; //$NON-NLS-1$ - - /** - * Specifies the environment OS version. - * The value of this attribute must be of type {@code Version}. - */ - public static final String CAPABILITY_OS_VERSION_ATTRIBUTE = NATIVE_ENVIRONMENT_NAMESPACE + ".osversion"; //$NON-NLS-1$ - - /** - * Specifies the canonical names for the environment processor. The value - * is lower case. - * The value of this attribute must be of type {@code List<String>}. - */ - public static final String CAPABILITY_PROCESSOR_ATTRIBUTE = NATIVE_ENVIRONMENT_NAMESPACE + ".processor"; //$NON-NLS-1$ - - /** - * Specifies the language supported by the environment. The value - * of this attribute must be of type {@code String}. - */ - public static final String CAPABILITY_LANGUAGE_ATTRIBUTE = NATIVE_ENVIRONMENT_NAMESPACE + ".language"; //$NON-NLS-1$ - - /** - * Specifies the paths to the native libraries for the native code requirement. If this - * attribute is not specified then the requirement is an overall requirement for native - * code. Such a requirement is used to or all the other native code requirements together - * to determine if the module is resolved or not. - * The value of this attribute must be of type {@code List<String>}. - */ - public static final String REQUIREMENT_NATIVE_PATHS_ATTRIBUTE = "native.paths"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java index 7bdb62cab..f0aa1c97d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java @@ -14,7 +14,6 @@ package org.eclipse.osgi.storage; import java.io.File; import java.util.*; import org.eclipse.osgi.container.*; -import org.eclipse.osgi.container.namespaces.EquinoxNativeEnvironmentNamespace; import org.eclipse.osgi.internal.debug.Debug; import org.eclipse.osgi.internal.framework.FilterImpl; import org.eclipse.osgi.internal.hookregistry.ClassLoaderHook; @@ -23,9 +22,11 @@ import org.eclipse.osgi.storage.bundlefile.BundleEntry; import org.eclipse.osgi.storage.bundlefile.BundleFile; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.namespace.HostNamespace; +import org.osgi.framework.namespace.NativeNamespace; import org.osgi.framework.wiring.BundleRevision; public class NativeCodeFinder { + public static final String REQUIREMENT_NATIVE_PATHS_ATTRIBUTE = "native.paths"; //$NON-NLS-1$ private static final String[] EMPTY_STRINGS = new String[0]; public static final String EXTERNAL_LIB_PREFIX = "external:"; //$NON-NLS-1$ private final Generation generation; @@ -165,21 +166,21 @@ public class NativeCodeFinder { } } - List<ModuleWire> nativeCode = wiring.getRequiredModuleWires(EquinoxNativeEnvironmentNamespace.NATIVE_ENVIRONMENT_NAMESPACE); + List<ModuleWire> nativeCode = wiring.getRequiredModuleWires(NativeNamespace.NATIVE_NAMESPACE); if (nativeCode.isEmpty()) { return Collections.emptyList(); } - // TODO just taking the first paths for the revision, need to sort correctly + // just taking the first paths for the revision, we sorted correctly when transforming to the requirement for (ModuleWire moduleWire : nativeCode) { if (moduleWire.getRequirement().getRevision().equals(revision)) { @SuppressWarnings("unchecked") - List<String> result = (List<String>) nativeCode.get(0).getRequirement().getAttributes().get(EquinoxNativeEnvironmentNamespace.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE); + List<String> result = (List<String>) nativeCode.get(0).getRequirement().getAttributes().get(REQUIREMENT_NATIVE_PATHS_ATTRIBUTE); if (result != null) return result; // this must be a multi-clause Bundle-NativeCode header, need to check for the correct one in the index try { - FilterImpl filter = FilterImpl.newInstance(moduleWire.getRequirement().getDirectives().get(EquinoxNativeEnvironmentNamespace.REQUIREMENT_FILTER_DIRECTIVE)); + FilterImpl filter = FilterImpl.newInstance(moduleWire.getRequirement().getDirectives().get(NativeNamespace.REQUIREMENT_FILTER_DIRECTIVE)); int index = -1; Map<String, Object> capabilityAttrs = moduleWire.getCapability().getAttributes(); for (FilterImpl child : filter.getChildren()) { @@ -190,7 +191,7 @@ public class NativeCodeFinder { } if (index != -1) { @SuppressWarnings("unchecked") - List<String> indexResult = (List<String>) nativeCode.get(0).getRequirement().getAttributes().get(EquinoxNativeEnvironmentNamespace.REQUIREMENT_NATIVE_PATHS_ATTRIBUTE + '.' + index); + List<String> indexResult = (List<String>) nativeCode.get(0).getRequirement().getAttributes().get(REQUIREMENT_NATIVE_PATHS_ATTRIBUTE + '.' + index); if (indexResult != null) return indexResult; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 6dadcb32c..5a2443a3a 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -20,7 +20,6 @@ import org.eclipse.osgi.container.*; import org.eclipse.osgi.container.ModuleRevisionBuilder.GenericInfo; import org.eclipse.osgi.container.builders.OSGiManifestBuilderFactory; import org.eclipse.osgi.container.namespaces.EclipsePlatformNamespace; -import org.eclipse.osgi.container.namespaces.EquinoxNativeEnvironmentNamespace; import org.eclipse.osgi.framework.log.FrameworkLogEntry; import org.eclipse.osgi.framework.util.*; import org.eclipse.osgi.internal.container.LockSet; @@ -38,6 +37,7 @@ import org.eclipse.osgi.util.ManifestElement; import org.eclipse.osgi.util.NLS; import org.osgi.framework.*; import org.osgi.framework.namespace.HostNamespace; +import org.osgi.framework.namespace.NativeNamespace; import org.osgi.framework.wiring.BundleWiring; public class Storage { @@ -208,7 +208,7 @@ public class Storage { } } ModuleRevision currentRevision = systemModule.getCurrentRevision(); - List<ModuleCapability> nativeEnvironments = currentRevision.getModuleCapabilities(EquinoxNativeEnvironmentNamespace.NATIVE_ENVIRONMENT_NAMESPACE); + List<ModuleCapability> nativeEnvironments = currentRevision.getModuleCapabilities(NativeNamespace.NATIVE_NAMESPACE); Map<String, String> configMap = equinoxContainer.getConfiguration().getInitialConfig(); for (ModuleCapability nativeEnvironment : nativeEnvironments) { nativeEnvironment.setTransientAttrs(configMap); @@ -513,17 +513,17 @@ public class Storage { language = language == null ? null : language.toLowerCase(); result.append(", "); //$NON-NLS-1$ - result.append(EquinoxNativeEnvironmentNamespace.NATIVE_ENVIRONMENT_NAMESPACE).append("; "); //$NON-NLS-1$ + result.append(NativeNamespace.NATIVE_NAMESPACE).append("; "); //$NON-NLS-1$ if (osName != null) { osName = getAliasList(equinoxConfig.getAliasMapper().getOSNameAliases(osName)); - result.append(EquinoxNativeEnvironmentNamespace.CAPABILITY_OS_NAME_ATTRIBUTE).append(":List<String>=").append(osName).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ + result.append(NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE).append(":List<String>=").append(osName).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ } if (processor != null) { processor = getAliasList(equinoxConfig.getAliasMapper().getProcessorAliases(processor)); - result.append(EquinoxNativeEnvironmentNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE).append(":List<String>=").append(processor).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ + result.append(NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE).append(":List<String>=").append(processor).append("; "); //$NON-NLS-1$ //$NON-NLS-2$ } - result.append(EquinoxNativeEnvironmentNamespace.CAPABILITY_OS_VERSION_ATTRIBUTE).append(":Version").append("=\"").append(osVersion).append("\"; "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - result.append(EquinoxNativeEnvironmentNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE).append("=\"").append(language).append('\"'); //$NON-NLS-1$ + result.append(NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE).append(":Version").append("=\"").append(osVersion).append("\"; "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + result.append(NativeNamespace.CAPABILITY_LANGUAGE_ATTRIBUTE).append("=\"").append(language).append('\"'); //$NON-NLS-1$ return result.toString(); } diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/NativeNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/NativeNamespace.java new file mode 100644 index 000000000..516f8642e --- /dev/null +++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/NativeNamespace.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) OSGi Alliance (2012). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.framework.namespace; + +import org.osgi.framework.Constants; +import org.osgi.resource.Namespace; + +/** + * Native Environment Capability and Requirement Namespace. + * + * <p> + * This class defines the names for the attributes and directives for this + * namespace. All unspecified capability attributes are of type {@code String} + * and are used as arbitrary matching attributes for the capability. The values + * associated with the specified directive and attribute keys are of type + * {@code String}, unless otherwise indicated. + * + * @Immutable + * @version $Id$ + */ +public final class NativeNamespace extends Namespace { + + /** + * Namespace name for native environment capabilities and requirements. + */ + public static final String NATIVE_NAMESPACE = "osgi.native"; + + /** + * The capability attribute contains alias values of the + * {@link Constants#FRAMEWORK_OS_NAME org.osgi.framework.os.name} launching + * property value according to the <a + * href="http://www.osgi.org/Specifications/Reference">OSGi Specification + * References</a>. The value of this attribute must be of type + * {@code List<String>}. + */ + public final static String CAPABILITY_OSNAME_ATTRIBUTE = NATIVE_NAMESPACE + ".osname"; + + /** + * The capability attribute contains a {@code Version} parsed from the + * {@link Constants#FRAMEWORK_OS_VERSION org.osgi.framework.os.version} + * launching property value. The value of this attribute must be of type + * {@code Version}. + */ + public final static String CAPABILITY_OSVERSION_ATTRIBUTE = NATIVE_NAMESPACE + ".osversion"; + + /** + * The capability attribute contains alias values of the + * {@link Constants#FRAMEWORK_PROCESSOR org.osgi.framework.processor} + * launching property value according to the <a + * href="http://www.osgi.org/Specifications/Reference">OSGi Specification + * References</a>. The value of this attribute must be of type + * {@code List<String>}. + */ + public final static String CAPABILITY_PROCESSOR_ATTRIBUTE = NATIVE_NAMESPACE + ".processor"; + + /** + * The capability attribute contains the + * {@link Constants#FRAMEWORK_LANGUAGE org.osgi.framework.language} + * launching property value. The value of this attribute must be of type + * {@code String}. + */ + public final static String CAPABILITY_LANGUAGE_ATTRIBUTE = NATIVE_NAMESPACE + ".language"; + + private NativeNamespace() { + // empty + } +} |