diff options
Diffstat (limited to 'bundles')
18 files changed, 327 insertions, 75 deletions
diff --git a/bundles/org.eclipse.osgi.services/.settings/.api_filters b/bundles/org.eclipse.osgi.services/.settings/.api_filters index 7fc488fb5..29ccbab74 100644 --- a/bundles/org.eclipse.osgi.services/.settings/.api_filters +++ b/bundles/org.eclipse.osgi.services/.settings/.api_filters @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <component id="org.eclipse.osgi.services" version="2"> + <resource path="META-INF/MANIFEST.MF"> + <filter comment="Ignore OSGI API" id="923795461"> + <message_arguments> + <message_argument value="3.8.0"/> + <message_argument value="3.7.100"/> + </message_arguments> + </filter> + </resource> <resource path="src/org/osgi/service/cm/Configuration.java" type="org.osgi.service.cm.Configuration"> <filter comment="Ignore OSGi API" id="403804204"> <message_arguments> @@ -129,4 +137,129 @@ </message_arguments> </filter> </resource> + <resource path="src/org/osgi/service/component/ComponentConstants.java" type="org.osgi.service.component.ComponentConstants"> + <filter comment="Ignore OSGI API" id="403767336"> + <message_arguments> + <message_argument value="org.osgi.service.component.ComponentConstants"/> + <message_argument value="COMPONENT_SPECIFICATION_VERSION"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1209008130"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="COMPONENT_SPECIFICATION_VERSION"/> + </message_arguments> + </filter> + </resource> + <resource path="src/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java" type="org.osgi.service.component.runtime.dto.ComponentConfigurationDTO"> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentConfigurationDTO"/> + <message_argument value="FAILED_ACTIVATION"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentConfigurationDTO"/> + <message_argument value="failure"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentConfigurationDTO"/> + <message_argument value="service"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="FAILED_ACTIVATION"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="failure"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="service"/> + </message_arguments> + </filter> + </resource> + <resource path="src/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java" type="org.osgi.service.component.runtime.dto.ComponentDescriptionDTO"> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentDescriptionDTO"/> + <message_argument value="activationFields"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentDescriptionDTO"/> + <message_argument value="factoryProperties"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ComponentDescriptionDTO"/> + <message_argument value="init"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="activationFields"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="factoryProperties"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="init"/> + </message_arguments> + </filter> + </resource> + <resource path="src/org/osgi/service/component/runtime/dto/ReferenceDTO.java" type="org.osgi.service.component.runtime.dto.ReferenceDTO"> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ReferenceDTO"/> + <message_argument value="collectionType"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="336658481"> + <message_arguments> + <message_argument value="org.osgi.service.component.runtime.dto.ReferenceDTO"/> + <message_argument value="parameter"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="collectionType"/> + </message_arguments> + </filter> + <filter comment="Ignore OSGI API" id="1141899266"> + <message_arguments> + <message_argument value="1.4"/> + <message_argument value="3.8"/> + <message_argument value="parameter"/> + </message_arguments> + </filter> + </resource> </component> diff --git a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF index e9d9afb02..cdd7b004d 100644 --- a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF @@ -9,10 +9,10 @@ Bundle-Vendor: %eclipse.org Bundle-DocUrl: http://www.eclipse.org Bundle-ContactAddress: www.eclipse.org Export-Package: org.osgi.service.cm;version="1.6";uses:="org.osgi.framework", - org.osgi.service.component;version="1.3";uses:="org.osgi.framework", + org.osgi.service.component;version="1.4";uses:="org.osgi.framework", org.osgi.service.component.annotations;version="1.3", - org.osgi.service.component.runtime;version="1.3";uses:="org.osgi.framework,org.osgi.util.promise,org.osgi.service.component.runtime.dto", - org.osgi.service.component.runtime.dto;version="1.3";uses:="org.osgi.dto,org.osgi.framework.dto", + org.osgi.service.component.runtime;version="1.4";uses:="org.osgi.framework,org.osgi.util.promise,org.osgi.service.component.runtime.dto", + org.osgi.service.component.runtime.dto;version="1.4";uses:="org.osgi.dto,org.osgi.framework.dto", org.osgi.service.device;version="1.1";uses:="org.osgi.framework", org.osgi.service.event;version="1.4";uses:="org.osgi.framework", org.osgi.service.http;version="1.2.1";uses:="javax.servlet,javax.servlet.http", @@ -32,10 +32,10 @@ Import-Package: javax.servlet;resolution:=optional, org.osgi.framework;version="1.6", org.osgi.framework.dto;version="1.8.0", org.osgi.service.cm;version="[1.6,1.7)", - org.osgi.service.component;version="[1.3,1.4)", + org.osgi.service.component;version="[1.4,1.5)", org.osgi.service.component.annotations;version="[1.3,1.4)", - org.osgi.service.component.runtime; version="[1.3,1.4)", - org.osgi.service.component.runtime.dto; version="[1.3,1.4)", + org.osgi.service.component.runtime; version="[1.4,1.5)", + org.osgi.service.component.runtime.dto; version="[1.4,1.5)", org.osgi.service.device;version="[1.1,1.2)", org.osgi.service.event;version="[1.4,1.5)", org.osgi.service.http;version="[1.2,1.3)", diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentConstants.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentConstants.java index 624eb5610..163866147 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentConstants.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2015). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2017). 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. @@ -126,17 +126,28 @@ public interface ComponentConstants { /** * Capability name for Service Component Runtime. - * * <p> * Used in {@code Provide-Capability} and {@code Require-Capability} * manifest headers with the {@code osgi.extender} namespace. For example: * * <pre> * Require-Capability: osgi.extender; - * filter:="(&(osgi.extender=osgi.component)(version>=1.3)(!(version>=2.0)))" + * filter:="(&(osgi.extender=osgi.component)(version>=1.4)(!(version>=2.0)))" * </pre> * * @since 1.3 */ public static final String COMPONENT_CAPABILITY_NAME = "osgi.component"; + + /** + * Compile time constant for the Specification Version of Declarative + * Services. + * <p> + * Used in {@code Version} and {@code Requirement} annotations. The value of + * this compile time constant will change when the specification version of + * Declarative Services is updated. + * + * @since 1.4 + */ + public static final String COMPONENT_SPECIFICATION_VERSION = "1.4.0"; } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentContext.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentContext.java index 549969184..cdae000a1 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentContext.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2017). 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. @@ -17,6 +17,7 @@ package org.osgi.service.component; import java.util.Dictionary; + import org.osgi.annotation.versioning.ProviderType; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -63,7 +64,7 @@ public interface ComponentContext { * @throws ComponentException If Service Component Runtime catches an * exception while activating the bound service. */ - public Object locateService(String name); + public <S> S locateService(String name); /** * Returns the service object for the specified reference name and @@ -99,11 +100,10 @@ public interface ComponentContext { public Object[] locateServices(String name); /** - * Returns the {@code BundleContext} of the bundle which contains this + * Returns the {@code BundleContext} of the bundle which declares this * component. * - * @return The {@code BundleContext} of the bundle containing this - * component. + * @return The {@code BundleContext} of the bundle declares this component. */ public BundleContext getBundleContext(); @@ -136,7 +136,7 @@ public interface ComponentContext { * * @return The Component Instance object for the component instance. */ - public ComponentInstance getComponentInstance(); + public <S> ComponentInstance<S> getComponentInstance(); /** * Enables the specified component name. The specified component name must diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentFactory.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentFactory.java index a6422fc51..bbe0dd318 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentFactory.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2016). 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. @@ -17,6 +17,7 @@ package org.osgi.service.component; import java.util.Dictionary; + import org.osgi.annotation.versioning.ProviderType; /** @@ -26,11 +27,12 @@ import org.osgi.annotation.versioning.ProviderType; * and activated rather than automatically creating and activating component * configuration as necessary. * + * @param <S> Type of Service * @ThreadSafe * @author $Id$ */ @ProviderType -public interface ComponentFactory { +public interface ComponentFactory<S> { /** * Create and activate a new component configuration. Additional properties * may be provided for the component configuration. @@ -45,5 +47,5 @@ public interface ComponentFactory { * @throws ComponentException If Service Component Runtime is unable to * activate the component configuration. */ - public ComponentInstance newInstance(Dictionary<String, ?> properties); + public ComponentInstance<S> newInstance(Dictionary<String, ? > properties); } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentInstance.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentInstance.java index 8078babdd..4d50902c8 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentInstance.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2004, 2016). 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. @@ -22,16 +22,16 @@ import org.osgi.annotation.versioning.ProviderType; * A ComponentInstance encapsulates a component instance of an activated * component configuration. ComponentInstances are created whenever a component * configuration is activated. - * * <p> * ComponentInstances are never reused. A new ComponentInstance object will be * created when the component configuration is activated again. * + * @param <S> Type of Service * @ThreadSafe * @author $Id$ */ @ProviderType -public interface ComponentInstance { +public interface ComponentInstance<S> { /** * Dispose of the component configuration for this component instance. The * component configuration will be deactivated. If the component @@ -45,5 +45,5 @@ public interface ComponentInstance { * @return The component instance or {@code null} if the component * configuration has been deactivated. */ - public Object getInstance(); + public S getInstance(); } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentServiceObjects.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentServiceObjects.java index 49fc5e863..eef86821b 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentServiceObjects.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/ComponentServiceObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2012, 2016). 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. @@ -50,7 +50,6 @@ public interface ComponentServiceObjects<S> { /** * Returns a service object for the {@link #getServiceReference() * associated} service. - * * <p> * This method will always return {@code null} when the associated service * has been become unbound. @@ -60,8 +59,9 @@ public interface ComponentServiceObjects<S> { * a {@code ServiceFactory} does not implement the classes under * which it was registered or the {@code ServiceFactory} threw an * exception. - * @throws IllegalStateException If the associated service has been become - * unbound. + * @throws IllegalStateException If the component instance that received + * this {@code ComponentServiceObjects} object has been + * deactivated. * @see #ungetService(Object) */ public S getService(); @@ -69,15 +69,15 @@ public interface ComponentServiceObjects<S> { /** * Releases a service object for the {@link #getServiceReference() * associated} service. - * * <p> * The specified service object must no longer be used and all references to * it should be destroyed after calling this method. * * @param service A service object previously provided by this * {@code ComponentServiceObjects} object. - * @throws IllegalStateException If the associated service has been become - * unbound. + * @throws IllegalStateException If the component instance that received + * this {@code ComponentServiceObjects} object has been + * deactivated. * @throws IllegalArgumentException If the specified service object was not * provided by this {@code ComponentServiceObjects} object. * @see #getService() diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/package-info.java index 9c158e8fb..1e5cc0fab 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/package-info.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2010, 2016). 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. @@ -15,28 +15,28 @@ */ /** - * Service Component Package Version 1.3. - * + * Service Component Package Version 1.4. * <p> * Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. This package has two types of * users: the consumers that use the API in this package and the providers that * implement the API in this package. - * * <p> * Example import for consumers using the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component; version="[1.3,2.0)"} + * {@code Import-Package: org.osgi.service.component; version="[1.4,2.0)"} * <p> * Example import for providers implementing the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component; version="[1.3,1.4)"} + * {@code Import-Package: org.osgi.service.component; version="[1.4,1.5)"} * * @author $Id$ */ -@Version("1.3") +@Version(COMPONENT_SPECIFICATION_VERSION) package org.osgi.service.component; +import static org.osgi.service.component.ComponentConstants.COMPONENT_SPECIFICATION_VERSION; + import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/packageinfo deleted file mode 100644 index 0117a56c1..000000000 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.3 diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/ServiceComponentRuntime.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/ServiceComponentRuntime.java index 59760dcd5..5c261c47d 100644..100755 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/ServiceComponentRuntime.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/ServiceComponentRuntime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2013, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2013, 2017). 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. @@ -17,8 +17,10 @@ package org.osgi.service.component.runtime; import java.util.Collection; + import org.osgi.annotation.versioning.ProviderType; import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO; import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO; @@ -30,7 +32,6 @@ import org.osgi.util.promise.Promise; * service components and their life cycle. The {@code ServiceComponentRuntime} * service allows introspection of the components managed by Service Component * Runtime. - * * <p> * This service differentiates between a {@link ComponentDescriptionDTO} and a * {@link ComponentConfigurationDTO}. A {@link ComponentDescriptionDTO} is a @@ -38,7 +39,10 @@ import org.osgi.util.promise.Promise; * {@link ComponentConfigurationDTO} is a representation of an actual instance * of a declared component description parameterized by component properties. * <p> - * + * This service must be registered with a {@link Constants#SERVICE_CHANGECOUNT} + * service property that must be updated each time the SCR DTOs available from + * this service change. + * <p> * Access to this service requires the * {@code ServicePermission[ServiceComponentRuntime, GET]} permission. It is * intended that only administrative bundles should be granted this permission @@ -97,7 +101,8 @@ public interface ServiceComponentRuntime { * @param description The component description. Must not be {@code null}. * @return A collection containing a snapshot of the current component * configurations for the specified component description. An empty - * collection is returned if there are none. + * collection is returned if there are none or if the provided + * component description does not belong to an active bundle. */ Collection<ComponentConfigurationDTO> getComponentConfigurationDTOs(ComponentDescriptionDTO description); @@ -121,11 +126,9 @@ public interface ServiceComponentRuntime { /** * Enables the specified component description. - * * <p> * If the specified component description is currently enabled, this method * has no effect. - * * <p> * This method must return after changing the enabled state of the specified * component description. Any actions that result from this, such as @@ -133,21 +136,20 @@ public interface ServiceComponentRuntime { * asynchronously to this method call. * * @param description The component description to enable. Must not be - * {@code null}. + * {@code null}. * @return A promise that will be resolved when the actions that result from * changing the enabled state of the specified component have - * completed. + * completed. If the provided description does not belong to an + * active bundle, a failed promise is returned. * @see #isComponentEnabled(ComponentDescriptionDTO) */ Promise<Void> enableComponent(ComponentDescriptionDTO description); /** * Disables the specified component description. - * * <p> * If the specified component description is currently disabled, this method * has no effect. - * * <p> * This method must return after changing the enabled state of the specified * component description. Any actions that result from this, such as @@ -155,10 +157,11 @@ public interface ServiceComponentRuntime { * asynchronously to this method call. * * @param description The component description to disable. Must not be - * {@code null}. + * {@code null}. * @return A promise that will be resolved when the actions that result from * changing the enabled state of the specified component have - * completed. + * completed. If the provided description does not belong to an + * active bundle, a failed promise is returned. * @see #isComponentEnabled(ComponentDescriptionDTO) */ Promise<Void> disableComponent(ComponentDescriptionDTO description); diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java index a3e98bbac..aabff50a2 100644..100755 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2013, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2013, 2018). 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. @@ -17,7 +17,9 @@ package org.osgi.service.component.runtime.dto; import java.util.Map; + import org.osgi.dto.DTO; +import org.osgi.framework.dto.ServiceReferenceDTO; import org.osgi.service.component.ComponentContext; /** @@ -59,6 +61,23 @@ public class ComponentConfigurationDTO extends DTO { public static final int ACTIVE = 8; /** + * The component configuration failed to activate. + * <p> + * This means the component configuration is satisfied but that either: + * <ul> + * <li>an exception occurred loading the implementation class,</li> + * <li>the static initializer threw an exception,</li> + * <li>the constructor threw an exception, or</li> + * <li>the activate method threw an exception.</li> + * </ul> + * The failure information from the exception is available from + * {@link #failure}. + * + * @since 1.4 + */ + public static final int FAILED_ACTIVATION = 16; + + /** * The representation of the component configuration's component * description. */ @@ -66,10 +85,10 @@ public class ComponentConfigurationDTO extends DTO { /** * The current state of the component configuration. - * * <p> * This is one of {@link #UNSATISFIED_CONFIGURATION}, - * {@link #UNSATISFIED_REFERENCE}, {@link #SATISFIED} or {@link #ACTIVE}. + * {@link #UNSATISFIED_REFERENCE}, {@link #SATISFIED}, {@link #ACTIVE}, or + * {@link #FAILED_ACTIVATION}. */ public int state; @@ -110,4 +129,33 @@ public class ComponentConfigurationDTO extends DTO { * empty if the component configuration has no unsatisfied references. */ public UnsatisfiedReferenceDTO[] unsatisfiedReferences; + + /** + * The failure information if the component configuration state is + * {@link #FAILED_ACTIVATION}. + * <p> + * This is the failure exception converted to a String using: + * + * <pre> + * StringWriter sw = new StringWriter(); + * exception.printStackTrace(new PrintWriter(sw)); + * sw.toString(); + * </pre> + * + * This must be {@code null} if the component configuration state is not + * {@link #FAILED_ACTIVATION}. + * + * @since 1.4 + */ + public String failure; + + /** + * The registered service of the component configuration. + * <p> + * This must be non-{@code null} if the component configuration is + * registered as a service. Otherwise it must be {@code null}. + * + * @since 1.4 + */ + public ServiceReferenceDTO service; } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java index 9f098a6ed..78df935bf 100644..100755 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2013, 2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2013, 2017). 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. @@ -17,6 +17,7 @@ package org.osgi.service.component.runtime.dto; import java.util.Map; + import org.osgi.dto.DTO; import org.osgi.framework.dto.BundleDTO; @@ -49,7 +50,7 @@ public class ComponentDescriptionDTO extends DTO { * <p> * This is declared in the {@code factory} attribute of the * {@code component} element. This must be {@code null} if the component - * description is not declared as a component factory. + * description is not declared as a factory component. */ public String factory; @@ -101,11 +102,11 @@ public class ComponentDescriptionDTO extends DTO { public String[] serviceInterfaces; /** - * The declared component properties. - * + * The component properties. * <p> - * These are declared in the {@code property} and {@code properties} - * elements. + * These are declared in the component description by the {@code property} + * and {@code properties} elements as well as the {@code target} attribute + * of the {@code reference} elements. */ public Map<String, Object> properties; @@ -168,4 +169,38 @@ public class ComponentDescriptionDTO extends DTO { * pid if the component description does not declare a configuration pid. */ public String[] configurationPid; + + /** + * The factory properties. + * <p> + * These are declared in the component description by the + * {@code factory-property} and {@code factory-properties} elements. This + * must be {@code null} if the component description is not declared as a + * {@link #factory factory component}. + * + * @since 1.4 + */ + public Map<String,Object> factoryProperties; + + /** + * The activation fields. + * <p> + * These are declared in the {@code activation-fields} attribute of the + * {@code component} element. The array must be empty if the component + * description does not declare any activation fields. + * + * @since 1.4 + */ + public String[] activationFields; + + /** + * The constructor parameter count. + * <p> + * This is declared in the {@code init} attribute of the {@code component} + * element. This must be {@code 0} if the component description does not + * declare an {@code init} attribute. + * + * @since 1.4 + */ + public int init; } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ReferenceDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ReferenceDTO.java index fca241327..c806c0a78 100644..100755 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ReferenceDTO.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/ReferenceDTO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2013, 2015). All Rights Reserved. + * Copyright (c) OSGi Alliance (2013, 2017). 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. @@ -145,4 +145,27 @@ public class ReferenceDTO extends DTO { * not declare a scope for the reference. */ public String scope; + + /** + * The zero-based parameter number of the constructor parameter for the + * reference. + * <p> + * This is declared in the {@code parameter} attribute of the + * {@code reference} element. This must be {@code null} if the component + * description does not declare a parameter number for the reference. + * + * @since 1.4 + */ + public Integer parameter; + + /** + * The collection type for the reference. + * <p> + * This is declared in the {@code field-collection-type} attribute of the + * {@code reference} element. This must be {@code null} if the component + * description does not declare a collection type for the reference. + * + * @since 1.4 + */ + public String collectionType; } diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java index 20de229ef..20de229ef 100644..100755 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/package-info.java index d7d82da09..017778a97 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/package-info.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2014). All Rights Reserved. + * Copyright (c) OSGi Alliance (2014, 2016). 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. @@ -15,28 +15,28 @@ */ /** - * Service Component Runtime Data Transfer Objects Package Version 1.3. - * + * Service Component Runtime Data Transfer Objects Package Version 1.4. * <p> * Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. This package has two types of * users: the consumers that use the API in this package and the providers that * implement the API in this package. - * * <p> * Example import for consumers using the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,2.0)"} + * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.4,2.0)"} * <p> * Example import for providers implementing the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,1.4)"} + * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.4,1.5)"} * * @author $Id$ */ -@Version("1.3") +@Version(COMPONENT_SPECIFICATION_VERSION) package org.osgi.service.component.runtime.dto; +import static org.osgi.service.component.ComponentConstants.COMPONENT_SPECIFICATION_VERSION; + import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/packageinfo deleted file mode 100644 index 0117a56c1..000000000 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/dto/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.3 diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/package-info.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/package-info.java index 3d4fa42ce..9265b99eb 100644 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/package-info.java +++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) OSGi Alliance (2013). All Rights Reserved. + * Copyright (c) OSGi Alliance (2013, 2016). 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. @@ -15,28 +15,28 @@ */ /** - * Service Component Runtime Package Version 1.3. - * + * Service Component Runtime Package Version 1.4. * <p> * Bundles wishing to use this package must list the package in the * Import-Package header of the bundle's manifest. This package has two types of * users: the consumers that use the API in this package and the providers that * implement the API in this package. - * * <p> * Example import for consumers using the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component.runtime; version="[1.3,2.0)"} + * {@code Import-Package: org.osgi.service.component.runtime; version="[1.4,2.0)"} * <p> * Example import for providers implementing the API in this package: * <p> - * {@code Import-Package: org.osgi.service.component.runtime; version="[1.3,1.4)"} + * {@code Import-Package: org.osgi.service.component.runtime; version="[1.4,1.5)"} * * @author $Id$ */ -@Version("1.3") +@Version(COMPONENT_SPECIFICATION_VERSION) package org.osgi.service.component.runtime; +import static org.osgi.service.component.ComponentConstants.COMPONENT_SPECIFICATION_VERSION; + import org.osgi.annotation.versioning.Version; diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/packageinfo b/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/packageinfo deleted file mode 100644 index 0117a56c1..000000000 --- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/component/runtime/packageinfo +++ /dev/null @@ -1 +0,0 @@ -version 1.3 |