diff --git a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/FeatureLauncherConstants.java b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/FeatureLauncherConstants.java index 16425076f9..ae371af1d7 100644 --- a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/FeatureLauncherConstants.java +++ b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/FeatureLauncherConstants.java @@ -18,15 +18,11 @@ package org.osgi.service.featurelauncher; -import java.net.URI; -import java.util.Map; - import org.osgi.service.feature.FeatureConfiguration; import org.osgi.service.feature.FeatureExtension; import org.osgi.service.feature.FeatureExtension.Kind; import org.osgi.service.feature.FeatureExtension.Type; import org.osgi.service.feature.ID; -import org.osgi.service.featurelauncher.repository.ArtifactRepository; /** * Defines standard constants for the Feature Launcher specification. @@ -108,67 +104,4 @@ private FeatureLauncherConstants() { * defines the start level configuration for the bundles in the feature */ public static final String BUNDLE_START_LEVELS = "bundle-start-levels"; - - /** - * The configuration property key used to set the repository name when - * creating an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_NAME = "name"; - - /** - * The configuration property key used to set the repository user when - * creating an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_USER = "user"; - - /** - * The configuration property key used to set the repository password when - * creating an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_PASSWORD = "password"; - - /** - * The configuration property key used to set the bearer token when creating - * an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_BEARER_TOKEN = "token"; - - /** - * The configuration property key used to set that SNAPSHOT release versions - * are enabled for an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_SNAPSHOTS_ENABLED = "snapshot"; - - /** - * The configuration property key used to set that release versions are - * enabled for an {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_RELEASES_ENABLED = "release"; - - /** - * The configuration property key used to set the trust store to be used - * when accessing a remote {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_TRUST_STORE = "truststore"; - - /** - * The configuration property key used to set the trust store format to be - * used when accessing a remote {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_TRUST_STORE_FORMAT = "truststoreFormat"; - - /** - * The configuration property key used to set the trust store password to be - * used when accessing a remote {@link ArtifactRepository} using - * {@link FeatureLauncher#createRepository(URI, Map)} - */ - public static final String REMOTE_ARTIFACT_REPOSITORY_TRUST_STORE_PASSWORD = "truststorePassword"; } diff --git a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/repository/ArtifactRepositoryConstants.java b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/repository/ArtifactRepositoryConstants.java new file mode 100644 index 0000000000..e7fdbbbabc --- /dev/null +++ b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/repository/ArtifactRepositoryConstants.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.service.featurelauncher.repository; + +import java.net.URI; +import java.util.Map; + +/** + * Defines standard constants for creating {@link ArtifactRepository} instances + * using the {@link ArtifactRepositoryFactory} + * + * @author $Id$ + */ +public final class ArtifactRepositoryConstants { + private ArtifactRepositoryConstants() { + // non-instantiable + } + + /** + * The configuration property key used to set the repository name when + * creating an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_NAME = "name"; + + /** + * The configuration property key used to set the repository user when + * creating an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_USER = "user"; + + /** + * The configuration property key used to set the repository password when + * creating an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_PASSWORD = "password"; + + /** + * The configuration property key used to set the bearer token when creating + * an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_BEARER_TOKEN = "token"; + + /** + * The configuration property key used to set that SNAPSHOT release versions + * are enabled for an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_SNAPSHOTS_ENABLED = "snapshot"; + + /** + * The configuration property key used to set that release versions are + * enabled for an {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_RELEASES_ENABLED = "release"; + + /** + * The configuration property key used to set the trust store to be used + * when accessing a remote {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_TRUST_STORE = "truststore"; + + /** + * The configuration property key used to set the trust store format to be + * used when accessing a remote {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_TRUST_STORE_FORMAT = "truststoreFormat"; + + /** + * The configuration property key used to set the trust store password to be + * used when accessing a remote {@link ArtifactRepository} using + * {@link ArtifactRepositoryFactory#createRepository(URI, Map)} + */ + public static final String ARTIFACT_REPOSITORY_TRUST_STORE_PASSWORD = "truststorePassword"; +} diff --git a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/FeatureRuntime.java b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/FeatureRuntime.java index 43220764e6..da1b4a9b7e 100644 --- a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/FeatureRuntime.java +++ b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/FeatureRuntime.java @@ -127,6 +127,10 @@ public interface OperationBuilder> { * is already set for the given name then it will be replaced. Passing a * null {@link ArtifactRepository} will remove the * repository from this operation. + *

+ * {@link ArtifactRepository} instances are stored in the order that + * they are added, and this order defines the order in which they will + * be queried. * * @param name the name to use for this repository * @param repository the repository @@ -143,6 +147,10 @@ T addRepository(String name, * {@link #addRepository(String, ArtifactRepository)} has the same name * as a default repository then the added repository will override the * default repository. + *

+ * Default repositories are always added after any added by + * {@link #addRepository(String, ArtifactRepository)}, and are therefore + * the last to be queried. * * @param include * @return this diff --git a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/InstalledFeature.java b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/InstalledFeature.java index 8c416dba28..93e5f2f8bf 100644 --- a/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/InstalledFeature.java +++ b/org.osgi.service.featurelauncher/src/org/osgi/service/featurelauncher/runtime/InstalledFeature.java @@ -20,7 +20,7 @@ import java.util.List; import org.osgi.annotation.versioning.ProviderType; -import org.osgi.service.feature.ID; +import org.osgi.service.feature.Feature; import org.osgi.service.featurelauncher.FeatureLauncher; /** @@ -35,9 +35,30 @@ public interface InstalledFeature { /** - * @return The {@link ID} of the installed feature + * @return The {@link Feature} that was installed. This will be identical to + * {@link #getOriginalFeature()} unless the feature was decorated + * during installation. If decoration did occur then + * {@link #isDecorated()} will return true and this + * method will return the decorated feature. */ - public ID getFeatureId(); + public Feature getFeature(); + + /** + * @return The undecorated {@link Feature} that was originally used in the + * operation. If no decoration occurred then {@link #isDecorated()} + * will return false and this method will return the + * same value as {@link #getFeature()}; + */ + public Feature getOriginalFeature(); + + /** + * @return true if the original feature was decorated by one or + * more decorators. If true then the undecorated + * feature will be available from {@link #getOriginalFeature()} and + * the actual feature used will be available from + * {@link #getFeature()}. + */ + public boolean isDecorated(); /** * Is this a feature installed by {@link FeatureLauncher} diff --git a/osgi.specs/docbook/160/service.feature.launcher.xml b/osgi.specs/docbook/160/service.feature.launcher.xml index fb2573affc..a7db50d613 100644 --- a/osgi.specs/docbook/160/service.feature.launcher.xml +++ b/osgi.specs/docbook/160/service.feature.launcher.xml @@ -303,51 +303,51 @@ - The name for this repository - The user name to use for authenticating with this repository - The password to use for authenticating with this repository - A bearer token to use when authenticating with this repository - A Boolean indicating that SNAPSHOT versions are supported. Defaults to true - A Boolean indicating that release versions are supported. Defaults to true - A trust store to use when validating a server certificate. May be a file system path or a data URI as defined by . - The format of the trust store to use when validating a server certificate. - The password to use when validating the trust store integrity. @@ -849,7 +849,7 @@ fw.waitForStop(0); -d--decorator - A class name + A class name[,<class name>] Provides the name of a decorator class that should be used when launching the feature. The decorator class must be public, available on the classpath, and have a @@ -860,8 +860,9 @@ fw.waitForStop(0); -e--extension-handler - <extension name>, - <class name> + <extension name>= + <class name>[,<extension name>= + <class name>] Provides the name of an extension, and the extension handler class that should be used to handle the extension when launching the feature. The extension handler class must @@ -1187,10 +1188,23 @@ fw.waitForStop(0); - The of the - Feature from The installed from . This will include any decoration as described in + + + + The original undecorated from + + + + Whether this installed feature was decorated using