[osgi-compendium] 02/16: New upstream version 6.0.0
Kai-Chung Yan
seamlik-guest at moszumanska.debian.org
Thu Mar 1 09:45:57 UTC 2018
This is an automated email from the git hooks/post-receive script.
seamlik-guest pushed a commit to branch master
in repository osgi-compendium.
commit ba164d64ac77ce7e927e5d7c5f3559230d169bb2
Author: 殷啟聰 | Kai-Chung Yan <seamlikok at gmail.com>
Date: Tue Feb 27 21:27:18 2018 +0800
New upstream version 6.0.0
---
LICENSE | 202 +++++++
META-INF/MANIFEST.MF | 4 -
about.html | 38 ++
org/osgi/application/ApplicationContext.java | 10 +-
org/osgi/application/ApplicationServiceEvent.java | 6 +-
org/osgi/namespace/contract/ContractNamespace.java | 4 +-
org/osgi/namespace/contract/package-info.java | 8 +-
org/osgi/namespace/extender/ExtenderNamespace.java | 17 +-
org/osgi/namespace/extender/package-info.java | 8 +-
org/osgi/namespace/extender/packageinfo | 2 +-
.../implementation/ImplementationNamespace.java | 64 +++
.../{contract => implementation}/package-info.java | 12 +-
.../{extender => implementation}/packageinfo | 0
org/osgi/namespace/service/ServiceNamespace.java | 4 +-
org/osgi/namespace/service/package-info.java | 8 +-
.../application/ApplicationAdminPermission.java | 16 +-
.../service/application/ApplicationDescriptor.java | 12 +-
org/osgi/service/async/Async.java | 199 +++++++
org/osgi/service/async/delegate/AsyncDelegate.java | 101 ++++
.../async/delegate}/package-info.java | 17 +-
.../async/delegate}/packageinfo | 0
.../service/{event => async}/package-info.java | 16 +-
.../extender => service/async}/packageinfo | 0
.../blueprint/container/BlueprintContainer.java | 5 +-
.../blueprint/container/BlueprintEvent.java | 4 +-
.../blueprint/container/BlueprintListener.java | 5 +-
.../service/blueprint/container/Converter.java | 5 +-
.../service/blueprint/container/package-info.java | 8 +-
.../service/blueprint/reflect/BeanArgument.java | 5 +-
.../service/blueprint/reflect/BeanMetadata.java | 4 +-
.../service/blueprint/reflect/BeanProperty.java | 5 +-
.../blueprint/reflect/CollectionMetadata.java | 5 +-
.../blueprint/reflect/ComponentMetadata.java | 4 +-
.../service/blueprint/reflect/IdRefMetadata.java | 5 +-
org/osgi/service/blueprint/reflect/MapEntry.java | 5 +-
.../service/blueprint/reflect/MapMetadata.java | 4 +-
org/osgi/service/blueprint/reflect/Metadata.java | 9 +-
.../service/blueprint/reflect/NonNullMetadata.java | 5 +-
.../service/blueprint/reflect/NullMetadata.java | 5 +-
.../service/blueprint/reflect/PropsMetadata.java | 4 +-
.../service/blueprint/reflect/RefMetadata.java | 5 +-
.../blueprint/reflect/ReferenceListMetadata.java | 5 +-
.../blueprint/reflect/ReferenceListener.java | 5 +-
.../blueprint/reflect/ReferenceMetadata.java | 11 +-
.../blueprint/reflect/RegistrationListener.java | 5 +-
.../service/blueprint/reflect/ServiceMetadata.java | 4 +-
.../reflect/ServiceReferenceMetadata.java | 4 +-
org/osgi/service/blueprint/reflect/Target.java | 5 +-
.../service/blueprint/reflect/ValueMetadata.java | 5 +-
.../service/blueprint/reflect/package-info.java | 8 +-
org/osgi/service/cm/Configuration.java | 33 +-
org/osgi/service/cm/ConfigurationAdmin.java | 10 +-
org/osgi/service/cm/ConfigurationEvent.java | 5 +-
org/osgi/service/cm/ConfigurationException.java | 4 +-
org/osgi/service/cm/ConfigurationListener.java | 8 +-
org/osgi/service/cm/ConfigurationPermission.java | 14 +-
org/osgi/service/cm/ConfigurationPlugin.java | 5 +-
org/osgi/service/cm/ManagedService.java | 13 +-
org/osgi/service/cm/ManagedServiceFactory.java | 5 +-
.../cm/SynchronousConfigurationListener.java | 10 +-
org/osgi/service/cm/package-info.java | 8 +-
org/osgi/service/component/ComponentConstants.java | 34 +-
org/osgi/service/component/ComponentContext.java | 65 ++-
org/osgi/service/component/ComponentException.java | 8 +-
org/osgi/service/component/ComponentFactory.java | 11 +-
org/osgi/service/component/ComponentInstance.java | 6 +-
.../service/component/ComponentServiceObjects.java | 95 ++++
.../service/component/annotations/Activate.java | 10 +-
.../service/component/annotations/Component.java | 138 ++++-
.../service/component/annotations/Deactivate.java | 10 +-
.../service/component/annotations/FieldOption.java | 53 ++
.../service/component/annotations/Modified.java | 10 +-
.../service/component/annotations/Reference.java | 265 +++++++--
.../component/annotations/ReferenceScope.java | 57 ++
.../component/annotations/ServiceScope.java | 63 +++
.../component/annotations/package-info.java | 10 +-
org/osgi/service/component/annotations/packageinfo | 2 +-
org/osgi/service/component/package-info.java | 14 +-
org/osgi/service/component/packageinfo | 2 +-
.../component/runtime/ServiceComponentRuntime.java | 165 ++++++
.../runtime/dto/ComponentConfigurationDTO.java | 113 ++++
.../runtime/dto/ComponentDescriptionDTO.java | 171 ++++++
.../component/runtime/dto/ReferenceDTO.java | 148 +++++
.../runtime/dto/SatisfiedReferenceDTO.java | 62 +++
.../runtime/dto/UnsatisfiedReferenceDTO.java | 64 +++
.../component/{ => runtime/dto}/package-info.java | 16 +-
.../{event => component/runtime/dto}/packageinfo | 0
.../component/{ => runtime}/package-info.java | 16 +-
.../{event => component/runtime}/packageinfo | 0
org/osgi/service/coordinator/Coordination.java | 12 +-
.../coordinator/CoordinationPermission.java | 20 +-
org/osgi/service/coordinator/Coordinator.java | 5 +-
org/osgi/service/coordinator/Participant.java | 5 +-
.../service/coordinator/SingletonException.java | 60 ++
org/osgi/service/coordinator/package-info.java | 8 +-
org/osgi/service/coordinator/packageinfo | 2 +-
.../service/deploymentadmin/DeploymentPackage.java | 4 +-
.../spi/DeploymentCustomizerPermission.java | 6 +-
.../service/deploymentadmin/spi/package-info.java | 6 +-
org/osgi/service/dmt/DmtConstants.java | 6 +-
org/osgi/service/dmt/DmtException.java | 10 +-
org/osgi/service/dmt/DmtSession.java | 8 +-
org/osgi/service/dmt/MetaNode.java | 8 +-
org/osgi/service/dmt/Uri.java | 6 +-
org/osgi/service/dmt/notification/AlertItem.java | 11 +-
.../dmt/notification/NotificationService.java | 10 +-
org/osgi/service/dmt/package-info.java | 6 +-
org/osgi/service/dmt/security/DmtPermission.java | 8 +-
org/osgi/service/dmt/spi/ExecPlugin.java | 6 +-
org/osgi/service/dmt/spi/MountPoint.java | 6 +-
org/osgi/service/dmt/spi/ReadableDataSession.java | 6 +-
.../service/dmt/spi/TransactionalDataSession.java | 6 +-
org/osgi/service/event/Event.java | 20 +-
org/osgi/service/event/EventAdmin.java | 6 +-
org/osgi/service/event/EventConstants.java | 5 +-
org/osgi/service/event/EventHandler.java | 5 +-
org/osgi/service/event/EventProperties.java | 5 +-
org/osgi/service/event/TopicPermission.java | 15 +-
org/osgi/service/event/package-info.java | 8 +-
org/osgi/service/event/packageinfo | 2 +-
org/osgi/service/http/HttpContext.java | 59 +-
.../service/http/context/ServletContextHelper.java | 310 +++++++++++
.../{event => http/context}/package-info.java | 16 +-
.../extender => service/http/context}/packageinfo | 0
org/osgi/service/http/package-info.java | 6 +-
.../service/http/runtime/HttpServiceRuntime.java | 56 ++
.../http/runtime/HttpServiceRuntimeConstants.java | 66 +++
.../service/http/runtime/dto/BaseServletDTO.java | 70 +++
.../service/http/runtime/dto/DTOConstants.java | 76 +++
.../runtime/dto/ErrorPageDTO.java} | 30 +-
.../http/runtime/dto/FailedErrorPageDTO.java | 44 ++
.../service/http/runtime/dto/FailedFilterDTO.java | 44 ++
.../http/runtime/dto/FailedListenerDTO.java | 44 ++
.../http/runtime/dto/FailedResourceDTO.java | 44 ++
.../http/runtime/dto/FailedServletContextDTO.java | 51 ++
.../service/http/runtime/dto/FailedServletDTO.java | 43 ++
org/osgi/service/http/runtime/dto/FilterDTO.java | 99 ++++
org/osgi/service/http/runtime/dto/ListenerDTO.java | 49 ++
.../service/http/runtime/dto/RequestInfoDTO.java | 60 ++
org/osgi/service/http/runtime/dto/ResourceDTO.java | 57 ++
org/osgi/service/http/runtime/dto/RuntimeDTO.java | 86 +++
.../http/runtime/dto/ServletContextDTO.java | 130 +++++
.../runtime/dto/ServletDTO.java} | 27 +-
.../{event => http/runtime/dto}/package-info.java | 16 +-
.../http/runtime/dto}/packageinfo | 0
.../{event => http/runtime}/package-info.java | 16 +-
.../extender => service/http/runtime}/packageinfo | 0
.../http/whiteboard/HttpWhiteboardConstants.java | 465 ++++++++++++++++
.../{event => http/whiteboard}/package-info.java | 16 +-
.../http/whiteboard}/packageinfo | 0
org/osgi/service/io/ConnectionFactory.java | 6 +-
org/osgi/service/jpa/package-info.java | 8 +-
org/osgi/service/metatype/AttributeDefinition.java | 143 ++---
org/osgi/service/metatype/MetaTypeInformation.java | 5 +-
org/osgi/service/metatype/MetaTypeProvider.java | 5 +-
org/osgi/service/metatype/MetaTypeService.java | 23 +-
.../service/metatype/ObjectClassDefinition.java | 12 +-
.../metatype/annotations/AttributeDefinition.java | 216 ++++++++
.../metatype/annotations/AttributeType.java | 141 +++++
.../service/metatype/annotations/Designate.java | 68 +++
org/osgi/service/metatype/annotations/Icon.java | 58 ++
.../annotations/ObjectClassDefinition.java | 155 ++++++
org/osgi/service/metatype/annotations/Option.java | 53 ++
.../annotations}/package-info.java | 18 +-
.../{event => metatype/annotations}/packageinfo | 0
org/osgi/service/metatype/package-info.java | 14 +-
org/osgi/service/metatype/packageinfo | 2 +-
org/osgi/service/prefs/Preferences.java | 6 +-
org/osgi/service/prefs/package-info.java | 6 +-
.../service/provisioning/ProvisioningService.java | 8 +-
.../remoteserviceadmin/EndpointDescription.java | 46 +-
.../service/remoteserviceadmin/EndpointEvent.java | 141 +++++
.../remoteserviceadmin/EndpointEventListener.java | 111 ++++
.../remoteserviceadmin/EndpointListener.java | 13 +-
.../remoteserviceadmin/EndpointPermission.java | 14 +-
.../remoteserviceadmin/ExportReference.java | 7 +-
.../remoteserviceadmin/ExportRegistration.java | 47 +-
.../remoteserviceadmin/ImportReference.java | 7 +-
.../remoteserviceadmin/ImportRegistration.java | 32 +-
.../remoteserviceadmin/RemoteServiceAdmin.java | 30 +-
.../RemoteServiceAdminEvent.java | 44 +-
.../RemoteServiceAdminListener.java | 6 +-
.../namespace/DiscoveryNamespace.java | 49 ++
.../namespace/DistributionNamespace.java | 49 ++
.../namespace/TopologyNamespace.java | 66 +++
.../namespace}/package-info.java | 11 +-
.../remoteserviceadmin/namespace/packageinfo | 1 +
.../service/remoteserviceadmin/package-info.java | 15 +-
org/osgi/service/remoteserviceadmin/packageinfo | 2 +-
org/osgi/service/repository/AndExpression.java | 41 ++
.../service/repository/ExpressionCombiner.java | 107 ++++
.../IdentityExpression.java} | 24 +-
.../NotExpression.java} | 25 +-
org/osgi/service/repository/OrExpression.java | 40 ++
org/osgi/service/repository/Repository.java | 62 ++-
org/osgi/service/repository/RepositoryContent.java | 16 +-
.../service/repository/RequirementBuilder.java | 94 ++++
.../RequirementExpression.java} | 22 +-
org/osgi/service/repository/package-info.java | 14 +-
org/osgi/service/repository/packageinfo | 2 +-
org/osgi/service/resolver/HostedCapability.java | 5 +-
org/osgi/service/resolver/ResolutionException.java | 3 +-
org/osgi/service/resolver/ResolveContext.java | 18 +-
org/osgi/service/resolver/Resolver.java | 5 +-
org/osgi/service/resolver/package-info.java | 8 +-
org/osgi/service/rest/RestApiExtension.java | 80 +++
org/osgi/service/rest/client/RestClient.java | 404 ++++++++++++++
.../service/rest/client/RestClientFactory.java | 47 ++
.../client/package-info.java} | 24 +-
org/osgi/service/rest/client/packageinfo | 1 +
.../Metadata.java => rest/package-info.java} | 24 +-
org/osgi/service/rest/packageinfo | 1 +
.../serviceloader/ServiceLoaderNamespace.java | 6 +-
org/osgi/service/serviceloader/package-info.java | 8 +-
org/osgi/service/subsystem/Subsystem.java | 67 ++-
org/osgi/service/subsystem/SubsystemConstants.java | 70 ++-
.../service/subsystem/SubsystemPermission.java | 17 +-
org/osgi/service/subsystem/package-info.java | 14 +-
org/osgi/service/subsystem/packageinfo | 2 +-
org/osgi/service/upnp/UPnPEventListener.java | 8 +-
org/osgi/service/wireadmin/Consumer.java | 6 +-
org/osgi/service/wireadmin/Producer.java | 10 +-
org/osgi/service/wireadmin/WireConstants.java | 8 +-
org/osgi/service/wireadmin/WirePermission.java | 6 +-
org/osgi/service/wireadmin/package-info.java | 6 +-
org/osgi/util/function/Function.java | 43 ++
org/osgi/util/function/Predicate.java | 43 ++
.../util/{position => function}/package-info.java | 18 +-
.../extender => util/function}/packageinfo | 0
org/osgi/util/measurement/package-info.java | 6 +-
org/osgi/util/position/package-info.java | 6 +-
org/osgi/util/promise/Deferred.java | 142 +++++
org/osgi/util/promise/FailedPromisesException.java | 55 ++
org/osgi/util/promise/Failure.java | 61 ++
org/osgi/util/promise/Promise.java | 403 ++++++++++++++
org/osgi/util/promise/PromiseImpl.java | 615 +++++++++++++++++++++
org/osgi/util/promise/Promises.java | 180 ++++++
org/osgi/util/promise/Success.java | 69 +++
.../util/{position => promise}/package-info.java | 18 +-
.../extender => util/promise}/packageinfo | 0
org/osgi/util/xml/package-info.java | 6 +-
241 files changed, 8647 insertions(+), 837 deletions(-)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 8fcdf49..58630c0 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -1,6 +1,2 @@
Manifest-Version: 1.0
-Built-By: mcculls
-Build-Jdk: 1.6.0_51
-Created-By: Apache Maven
-Archiver-Version: Plexus Archiver
diff --git a/about.html b/about.html
new file mode 100644
index 0000000..ed7d94c
--- /dev/null
+++ b/about.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<h3>Copyright</h3>
+<p>Copyright © OSGi Alliance (2000, 2015). All Rights Reserved.</p>
+
+<p>OSGi Alliance<br/>
+Bishop Ranch 6<br/>
+2400 Camino Ramon, Suite 375<br/>
+San Ramon, CA 94583 USA
+</p>
+
+<h3>License</h3>
+<p>The OSGi Alliance makes available all content in this jar ("Work"). Unless otherwise indicated below, the Work is provided to you under the terms and conditions of the
+Apache License, Version 2.0 (the "License"). A copy of the License is available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.</p>
+
+<h3>Notices</h3>
+<p>Implementation of certain elements of the Content may be subject to third party
+intellectual property rights, including without limitation, patent rights (such a third party may
+or may not be a member of the OSGi Alliance). The OSGi Alliance and its members are not responsible
+and shall not be held responsible in any manner for identifying or failing to identify any or
+all such third party intellectual property rights.</p>
+
+<p>OSGi™ is a trademark, registered trademark, or service mark
+of The OSGi Alliance in the US and other countries. Java is a trademark,
+registered trademark, or service mark of Sun Microsystems, Inc. in the US
+and other countries. All other trademarks, registered trademarks, or
+service marks used in the Content are the property of their respective
+owners and are hereby recognized.</p>
+
+</body>
+</html>
diff --git a/org/osgi/application/ApplicationContext.java b/org/osgi/application/ApplicationContext.java
index 7549ae4..e5dfe40 100644
--- a/org/osgi/application/ApplicationContext.java
+++ b/org/osgi/application/ApplicationContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -40,7 +40,7 @@ import org.osgi.framework.ServiceRegistration;
*
* @see org.osgi.application.Framework
*
- * @author $Id: 51dddaaacd80155f9c1b38fefd6211a466447d4a $
+ * @author $Id: 52873b2fa5bea7b8b2cc73755b627fda9fa54cac $
*/
public interface ApplicationContext {
@@ -100,7 +100,7 @@ public interface ApplicationContext {
/**
* Removes the specified
* {@link org.osgi.application.ApplicationServiceListener} object from this
- * context application instances's list of listeners.
+ * context application instance's list of listeners.
* <p>
* If {@code listener} is not contained in this context application
* instance's list of listeners, this method does nothing.
@@ -153,7 +153,7 @@ public interface ApplicationContext {
* service that was registered first is returned.
*
* @param referenceName The name of a reference as specified in a reference
- * element in this context applications's description. It must not be
+ * element in this context application's description. It must not be
* {@code null}
* @return A service object for the referenced service or {@code null} if
* the reference cardinality is 0..1 or 0..n and no bound service is
@@ -172,7 +172,7 @@ public interface ApplicationContext {
* {@code referenceName}.
*
* @param referenceName The name of a reference as specified in a reference
- * element in this context applications's description. It must not be
+ * element in this context application's description. It must not be
* {@code null}.
* @return An array of service object for the referenced service or
* {@code null} if the reference cardinality is 0..1 or 0..n and no
diff --git a/org/osgi/application/ApplicationServiceEvent.java b/org/osgi/application/ApplicationServiceEvent.java
index e4f5154..eaba318 100644
--- a/org/osgi/application/ApplicationServiceEvent.java
+++ b/org/osgi/application/ApplicationServiceEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -39,7 +39,7 @@ import org.osgi.framework.ServiceReference;
* @see org.osgi.framework.ServiceEvent
* @see ApplicationServiceListener
*
- * @author $Id: feb6a13123707549d3efdb5f06ba69ee82368cb9 $
+ * @author $Id: 12deb9591065e87b87978084f573db1d4011124a $
*/
public class ApplicationServiceEvent extends ServiceEvent {
@@ -53,7 +53,7 @@ public class ApplicationServiceEvent extends ServiceEvent {
* {@link org.osgi.framework.ServiceEvent}
* @param reference A {@code ServiceReference} object to the service that
* had a lifecycle change. This reference will be used as the
- * {@code source} in the {@link java.util.EventObject} baseclass,
+ * {@code source} in the {@link java.util.EventObject} base class,
* therefore, it must not be null.
* @param serviceObject The service object bound to this application
* instance. It can be {@code null} if this application is not bound
diff --git a/org/osgi/namespace/contract/ContractNamespace.java b/org/osgi/namespace/contract/ContractNamespace.java
index 768034e..c2e87c6 100644
--- a/org/osgi/namespace/contract/ContractNamespace.java
+++ b/org/osgi/namespace/contract/ContractNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -29,7 +29,7 @@ import org.osgi.resource.Namespace;
* {@code String}, unless otherwise indicated.
*
* @Immutable
- * @author $Id: e7a56de69908c72e3c8749a8f1f8c74cb21198ed $
+ * @author $Id: ec9abdeffbc9303bcb01b108faef41ee4cfb6b41 $
*/
public final class ContractNamespace extends Namespace {
diff --git a/org/osgi/namespace/contract/package-info.java b/org/osgi/namespace/contract/package-info.java
index 65bc68f..6a8a9d8 100644
--- a/org/osgi/namespace/contract/package-info.java
+++ b/org/osgi/namespace/contract/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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,9 +22,11 @@
* the types in this package just contain constants for capability and
* requirement namespaces specified by the OSGi Alliance.
*
- * @version 1.0
- * @author $Id: 7f138e3ac58ce6b65c444fd7e035c4756ff4e657 $
+ * @author $Id: c2b71e96e49fa126d1d403462151b8891fd9ddce $
*/
+ at Version("1.0")
package org.osgi.namespace.contract;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/namespace/extender/ExtenderNamespace.java b/org/osgi/namespace/extender/ExtenderNamespace.java
index 343b21f..64e4cec 100644
--- a/org/osgi/namespace/extender/ExtenderNamespace.java
+++ b/org/osgi/namespace/extender/ExtenderNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -29,7 +29,7 @@ import org.osgi.resource.Namespace;
* {@code String}, unless otherwise indicated.
*
* @Immutable
- * @author $Id: fe63b5bbba781062586546e3ee5a980323648746 $
+ * @author $Id: 382b1f4aeae204895851c141f2f77d5723a7c3e7 $
*/
public final class ExtenderNamespace extends Namespace {
@@ -48,19 +48,6 @@ public final class ExtenderNamespace extends Namespace {
*/
public final static String CAPABILITY_VERSION_ATTRIBUTE = "version";
- /**
- * The capability attribute contains the {@code Version} of the bundle
- * implementing the extender if one is specified or {@code 0.0.0} if not
- * specified. The value of this attribute must be of type {@code Version}.
- */
- public static final String CAPABILITY_BUNDLE_VERSION_ATTRIBUTE = "bundle-version";
-
- /**
- * The capability attribute contains the symbolic name of the bundle
- * providing the extender.
- */
- public final static String CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE = "bundle-symbolic-name";
-
private ExtenderNamespace() {
// empty
}
diff --git a/org/osgi/namespace/extender/package-info.java b/org/osgi/namespace/extender/package-info.java
index 438bbaf..14bf1cf 100644
--- a/org/osgi/namespace/extender/package-info.java
+++ b/org/osgi/namespace/extender/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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,9 +22,11 @@
* the types in this package just contain constants for capability and
* requirement namespaces specified by the OSGi Alliance.
*
- * @version 1.0
- * @author $Id: 681ae8cdba8a5f98df11a7624d044f250632d6c7 $
+ * @author $Id: 46d56d4e91d22cb4e5f50b930b07b3e00cf1a5b3 $
*/
+ at Version("1.0.1")
package org.osgi.namespace.extender;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/namespace/extender/packageinfo
index 7c8de03..b3d1f97 100644
--- a/org/osgi/namespace/extender/packageinfo
+++ b/org/osgi/namespace/extender/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.0.1
diff --git a/org/osgi/namespace/implementation/ImplementationNamespace.java b/org/osgi/namespace/implementation/ImplementationNamespace.java
new file mode 100644
index 0000000..8cfc4f5
--- /dev/null
+++ b/org/osgi/namespace/implementation/ImplementationNamespace.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) OSGi Alliance (2015). 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.namespace.implementation;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Implementation Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * 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
+ * @author $Id: 2a1d64588fef287902e7503c87bb2bd797a314a1 $
+ */
+public final class ImplementationNamespace extends Namespace {
+
+ /**
+ * Namespace name for "implementation" capabilities and requirements.
+ *
+ * This is also the capability attribute used to specify the name of the
+ * specification or contract being implemented.
+ *
+ * <p>
+ * A {@code ImplementationNamespace} capability should express a
+ * {@link Namespace#CAPABILITY_USES_DIRECTIVE uses constraint} for the
+ * appropriate packages defined by the specification/contract the packages
+ * mentioned in the value of this attribute.
+ */
+ public static final String IMPLEMENTATION_NAMESPACE = "osgi.implementation";
+
+ /**
+ * The capability attribute contains the {@code Version} of the
+ * specification or contract being implemented. The value of this attribute
+ * must be of type {@code Version}.
+ */
+ public static final String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ private ImplementationNamespace() {
+ // empty
+ }
+}
diff --git a/org/osgi/namespace/contract/package-info.java b/org/osgi/namespace/implementation/package-info.java
similarity index 74%
copy from org/osgi/namespace/contract/package-info.java
copy to org/osgi/namespace/implementation/package-info.java
index 65bc68f..1759604 100644
--- a/org/osgi/namespace/contract/package-info.java
+++ b/org/osgi/namespace/implementation/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2015). 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,16 +15,18 @@
*/
/**
- * Contract Namespace Package Version 1.0.
+ * Implementation Namespace Package Version 1.0.
*
* <p>
* Bundles should not need to import this package at runtime since all
* the types in this package just contain constants for capability and
* requirement namespaces specified by the OSGi Alliance.
*
- * @version 1.0
- * @author $Id: 7f138e3ac58ce6b65c444fd7e035c4756ff4e657 $
+ * @author $Id: ec97755230e132b588a3ec903c80591ae1f70164 $
*/
-package org.osgi.namespace.contract;
+ at Version("1.0")
+package org.osgi.namespace.implementation;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/namespace/implementation/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/namespace/implementation/packageinfo
diff --git a/org/osgi/namespace/service/ServiceNamespace.java b/org/osgi/namespace/service/ServiceNamespace.java
index bc7c045..e2ccc34 100644
--- a/org/osgi/namespace/service/ServiceNamespace.java
+++ b/org/osgi/namespace/service/ServiceNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -42,7 +42,7 @@ import org.osgi.resource.Namespace;
* {@code String}, unless otherwise indicated.
*
* @Immutable
- * @author $Id: 8cb2c663d0a04d53e48f57457f0cce4fb0d1eb42 $
+ * @author $Id: b8a17850ffda896054607169eafabed4d14240f8 $
*/
public final class ServiceNamespace extends Namespace {
diff --git a/org/osgi/namespace/service/package-info.java b/org/osgi/namespace/service/package-info.java
index 5ca673e..50d3293 100644
--- a/org/osgi/namespace/service/package-info.java
+++ b/org/osgi/namespace/service/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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,9 +22,11 @@
* the types in this package just contain constants for capability and
* requirement namespaces specified by the OSGi Alliance.
*
- * @version 1.0
- * @author $Id: 4acec73d0eeb7aab73bf6e9f951c6c6ff538c715 $
+ * @author $Id: dac399397078f566be0fd1f3fa44386a46f3b715 $
*/
+ at Version("1.0")
package org.osgi.namespace.service;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/application/ApplicationAdminPermission.java b/org/osgi/service/application/ApplicationAdminPermission.java
index ba50251..c0d0d72 100644
--- a/org/osgi/service/application/ApplicationAdminPermission.java
+++ b/org/osgi/service/application/ApplicationAdminPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -35,7 +35,7 @@ import org.osgi.framework.InvalidSyntaxException;
* {@code lifecycle}, {@code schedule} and {@code lock}. The permission
* {@code schedule} implies the permission {@code lifecycle}.
*
- * @author $Id: c8c799ae29ff5bb6095e22d201b47a3445eb42cb $
+ * @author $Id: 19f488667e2aee41cb81c79154de452919562b93 $
*/
public class ApplicationAdminPermission extends Permission {
private static final long serialVersionUID = 1L;
@@ -108,14 +108,14 @@ public class ApplicationAdminPermission extends Permission {
}
/**
- * This contructor should be used when creating
+ * This constructor should be used when creating
* {@code ApplicationAdminPermission} instance for {@code checkPermission}
* call.
*
- * @param application the tareget of the operation, it must not be
- * {@code null}
- * @param actions the required operation. it must not be {@code null}
- * @throws NullPointerException if any of the arguments is null.
+ * @param application The target of the operation, it must not be
+ * {@code null}.
+ * @param actions The required operation, it must not be {@code null}.
+ * @throws NullPointerException If any of the arguments is null.
*/
public ApplicationAdminPermission(ApplicationDescriptor application, String actions) {
super(application.getApplicationId());
@@ -165,7 +165,7 @@ public class ApplicationAdminPermission extends Permission {
* <li>The implied {@code otherPermission} was created for a particular
* {@link ApplicationDescriptor} (see
* {@link #ApplicationAdminPermission(ApplicationDescriptor, String)})</li>
- * <li>The {@code filter} of this permission mathes the
+ * <li>The {@code filter} of this permission matches the
* {@code ApplicationDescriptor} specified in the {@code otherPermission}.
* If the filter in this permission is the {@code <<SELF>>} pseudo target,
* then the currentApplicationId set in the {@code otherPermission} is
diff --git a/org/osgi/service/application/ApplicationDescriptor.java b/org/osgi/service/application/ApplicationDescriptor.java
index 7ce258d..dc68028 100644
--- a/org/osgi/service/application/ApplicationDescriptor.java
+++ b/org/osgi/service/application/ApplicationDescriptor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -30,7 +30,7 @@ import org.osgi.framework.InvalidSyntaxException;
* information about it. The application descriptor can be used for instance
* creation.
*
- * @author $Id: 991343b4701de961cbb87126ededcc00685811f0 $
+ * @author $Id: 39d1c46cc361e49b0cddddbc3b5f9be6bf84ca43 $
*/
public abstract class ApplicationDescriptor {
@@ -335,10 +335,10 @@ public abstract class ApplicationDescriptor {
/**
* Called by launch() to create and start a new instance in an application
- * model specific way. It also creates and registeres the application handle
- * to represent the newly created and started instance and registeres it.
- * The method is synchronous, it return only when the application instance
- * was successfully started or the attempt to start it failed.
+ * model specific way. It also creates and registers the application handle
+ * to represent the newly created and started instance and registers it. The
+ * method is synchronous, it return only when the application instance was
+ * successfully started or the attempt to start it failed.
* <p>
* This method must not return {@code null}. If launching the application
* failed, and exception must be thrown.
diff --git a/org/osgi/service/async/Async.java b/org/osgi/service/async/Async.java
new file mode 100644
index 0000000..62b7fd4
--- /dev/null
+++ b/org/osgi/service/async/Async.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) OSGi Alliance (2014, 2015). 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.service.async;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.promise.Promise;
+
+/**
+ * The Asynchronous Execution Service. This can be used to make asynchronous
+ * invocations on OSGi services and objects through the use of a mediator
+ * object.
+ *
+ * <p>
+ * Typical usage:
+ *
+ * <pre>
+ * Async async = ctx.getService(asyncRef);
+ *
+ * ServiceReference<MyService> ref = ctx.getServiceReference(MyService.class);
+ *
+ * MyService mediator = async.mediate(ref, MyService.class);
+ *
+ * Promise<BigInteger> result = async.call(mediator.getSumOverAllValues());
+ * </pre>
+ *
+ * <p>
+ * The {@link Promise} API allows callbacks to be made when asynchronous tasks
+ * complete, and can be used to chain Promises.
+ *
+ * <p>
+ * Multiple asynchronous tasks can be started concurrently, and will run in
+ * parallel if the Async Service has threads available.
+ */
+ at ProviderType
+public interface Async {
+
+ /**
+ * Create a mediator for the specified object. The mediator is a generated
+ * object that registers the method calls made against it. The registered
+ * method calls can then be run asynchronously using either the
+ * {@link #call(Object)}, {@link #call()}, or {@link #execute()} method.
+ *
+ * <p>
+ * The values returned by method calls made on a mediated object are opaque
+ * and should not be interpreted.
+ *
+ * <p>
+ * Normal usage:
+ *
+ * <pre>
+ * I s = ...;
+ * I i = async.mediate(s, I.class);
+ * Promise<String> p = async.call(i.foo());
+ * </pre>
+ *
+ * @param target The service object to mediate.
+ * @param iface The type that the mediated object should provide.
+ * @return A mediator for the service object.
+ * @throws IllegalArgumentException If the type represented by iface cannot
+ * be mediated.
+ */
+ <T> T mediate(T target, Class<T> iface);
+
+ /**
+ * Create a mediator for the specified service. The mediator is a generated
+ * object that registers the method calls made against it. The registered
+ * method calls can then be run asynchronously using either the
+ * {@link #call(Object)}, {@link #call()}, or {@link #execute()} method.
+ *
+ * <p>
+ * The values returned by method calls made on a mediated object are opaque
+ * and should not be interpreted.
+ *
+ * <p>
+ * This method differs from {@link #mediate(Object, Class)} in that it can
+ * track the availability of the specified service. This is recommended as
+ * the preferred option for mediating OSGi services as asynchronous tasks
+ * may not start executing until some time after they are requested.
+ * Tracking the validity of the {@link ServiceReference} for the service
+ * ensures that these tasks do not proceed with an invalid object.
+ *
+ * <p>
+ * Normal usage:
+ *
+ * <pre>
+ * ServiceReference<I> s = ...;
+ * I i = async.mediate(s, I.class);
+ * Promise<String> p = async.call(i.foo());
+ * </pre>
+ *
+ * @param target The service reference to mediate.
+ * @param iface The type that the mediated object should provide.
+ * @return A mediator for the service object.
+ * @throws IllegalArgumentException If the type represented by iface cannot
+ * be mediated.
+ */
+ <T> T mediate(ServiceReference<? extends T> target, Class<T> iface);
+
+ /**
+ * Invoke the last method call registered by a mediated object as an
+ * asynchronous task. The result of the task can be obtained using the
+ * returned Promise.
+ *
+ * <p>
+ * Typically the parameter for this method will be supplied inline like
+ * this:
+ *
+ * <pre>
+ * ServiceReference<I> s = ...;
+ * I i = async.mediate(s, I.class);
+ * Promise<String> p = async.call(i.foo());
+ * </pre>
+ *
+ * @param r The return value of the mediated call, used for type
+ * information.
+ * @return A Promise which can be used to retrieve the result of the
+ * asynchronous task.
+ */
+ <R> Promise<R> call(R r);
+
+ /**
+ * Invoke the last method call registered by a mediated object as an
+ * asynchronous task. The result of the task can be obtained using the
+ * returned Promise.
+ *
+ * <p>
+ * Generally it is preferable to use {@link #call(Object)} like this:
+ *
+ * <pre>
+ * ServiceReference<I> s = ...;
+ * I i = async.mediate(s, I.class);
+ * Promise<String> p = async.call(i.foo());
+ * </pre>
+ *
+ * <p>
+ * However this pattern does not work for void methods. Void methods can
+ * therefore be handled like this:
+ *
+ * <pre>
+ * ServiceReference<I> s = ...;
+ * I i = async.mediate(s, I.class);
+ * i.voidMethod()
+ * Promise<?> p = async.call();
+ * </pre>
+ *
+ * @return A Promise which can be used to retrieve the result of the
+ * asynchronous task.
+ */
+ Promise<?> call();
+
+ /**
+ * Invoke the last method call registered by a mediated object as a
+ * "fire-and-forget" asynchronous task. This method should be used by
+ * clients in preference to {@link #call()} and {@link #call(Object)} when
+ * no callbacks, or other features of {@link Promise}, are needed.
+ *
+ * <p>
+ * The advantage of this method is that it allows for greater optimization
+ * of the underlying asynchronous task. Clients are therefore likely to see
+ * better performance when using this method compared to using
+ * {@link #call(Object)} or {@link #call()} and ignoring the returned
+ * Promise. The {@link Promise} returned by this method is different from
+ * the Promise returned by {@link #call(Object)} or {@link #call()}, in that
+ * the returned Promise will resolve when the fire-and-forget task is
+ * successfully started, or fail if the task cannot be started. Note that
+ * there is no <i>happens-before</i> relationship and the returned Promise
+ * may resolve before or after the fire-and-forget task starts, or
+ * completes.
+ *
+ * <p>
+ * Typically this method is used like {@link #call()}:
+ *
+ * <pre>
+ * ServiceReference<I> s = ...;
+ * I i = async.mediate(s, I.class);
+ * i.someMethod()
+ * Promise<Void> p = async.execute();
+ * </pre>
+ *
+ * @return A Promise representing whether the fire-and-forget task was able
+ * to start.
+ */
+ Promise<Void> execute();
+}
diff --git a/org/osgi/service/async/delegate/AsyncDelegate.java b/org/osgi/service/async/delegate/AsyncDelegate.java
new file mode 100644
index 0000000..620e30d
--- /dev/null
+++ b/org/osgi/service/async/delegate/AsyncDelegate.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) OSGi Alliance (2014, 2015). 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.service.async.delegate;
+
+import java.lang.reflect.Method;
+import org.osgi.annotation.versioning.ConsumerType;
+import org.osgi.util.promise.Promise;
+
+/**
+ * This interface is used by services to allow them to optimize Asynchronous
+ * calls where they are capable of executing more efficiently.
+ *
+ * <p>
+ * This may mean that the service has access to its own thread pool, or that it
+ * can delegate work to a remote node, or act in some other way to reduce the
+ * load on the Asynchronous Services implementation when making an asynchronous
+ * call.
+ */
+ at ConsumerType
+public interface AsyncDelegate {
+ /**
+ * Invoke the specified method as an asynchronous task with the specified
+ * arguments.
+ *
+ * <p>
+ * This method can be used by clients, or the Async Service, to optimize
+ * Asynchronous execution of methods.
+ *
+ * <p>
+ * When called, this method should invoke the supplied method using the
+ * supplied arguments asynchronously, returning a Promise that can be used
+ * to access the result.
+ *
+ * <p>
+ * If the method cannot be executed asynchronously by this method then
+ * {@code null} must be returned.
+ *
+ * @param m The method to be asynchronously invoked.
+ * @param args The arguments to be used to invoke the method.
+ * @return A Promise representing the asynchronous result, or {@code null}
+ * if this method cannot be asynchronously invoked.
+ * @throws Exception An exception should be thrown only if there was a
+ * serious error that prevented the asynchronous task from starting.
+ * For example, the specified method does not exist on this object.
+ * Exceptions must not be thrown to indicate that the call does not
+ * support asynchronous invocation. Instead this method must return
+ * {@code null}. Exceptions must also not be thrown to indicate a
+ * failure from the execution of the underlying method. This must be
+ * handled by failing the returned Promise.
+ */
+ Promise<?> async(Method m, Object[] args) throws Exception;
+
+ /**
+ * Invoke the specified method as a "fire-and-forget" asynchronous task with
+ * the specified arguments.
+ *
+ * <p>
+ * This method can be used by clients, or the Async Service, to optimize
+ * Asynchronous execution of methods.
+ *
+ * <p>
+ * When called, this method should invoke the specified method using the
+ * specified arguments asynchronously. This method differs from
+ * {@link #async(Method, Object[])} in that it does not return a Promise.
+ * This method therefore allows the implementation to perform more
+ * aggressive optimizations because the end result of the invocation does
+ * not need to be returned to the caller.
+ *
+ * <p>
+ * If the method cannot be executed asynchronously by this method then
+ * {@code false} must be returned.
+ *
+ * @param m The method to be asynchronously invoked.
+ * @param args The arguments to be used to invoke the method.
+ * @return {@code true} if the asynchronous execution request has been
+ * accepted, or {@code false} if this method cannot be
+ * asynchronously invoked by the AsyncDelegate.
+ * @throws Exception An exception should be thrown only if there was a
+ * serious error that prevented the asynchronous task from starting.
+ * For example, the specified method does not exist on this object.
+ * Exceptions must not be thrown to indicate that the call does not
+ * support asynchronous invocation. Instead this method must return
+ * {@code false}. Exceptions must also not be thrown to indicate a
+ * failure from the execution of the underlying method.
+ */
+ boolean execute(Method m, Object[] args) throws Exception;
+}
diff --git a/org/osgi/util/position/package-info.java b/org/osgi/service/async/delegate/package-info.java
similarity index 60%
copy from org/osgi/util/position/package-info.java
copy to org/osgi/service/async/delegate/package-info.java
index 06eeb68..923573b 100644
--- a/org/osgi/util/position/package-info.java
+++ b/org/osgi/service/async/delegate/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2015). 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,20 +15,23 @@
*/
/**
- * Position Package Version 1.0.
+ * Asynchronous Services Delegation Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
- * Import-Package header of the bundle's manifest.
+ * Import-Package header of the bundle's manifest. This package contains only
+ * interfaces that are implemented by consumers.
*
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.util.position; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.service.async.delegate; version="[1.0,2.0)"}
*
- * @version 1.0
- * @author $Id: d3a19f2ae25abe3997c9501497d933a608f7e49e $
+ * @author $Id: ccfc6589a7b3ace7ba2246dd8151f0e8a1c01e72 $
*/
-package org.osgi.util.position;
+ at Version("1.0")
+package org.osgi.service.async.delegate;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/async/delegate/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/async/delegate/packageinfo
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/async/package-info.java
similarity index 72%
copy from org/osgi/service/event/package-info.java
copy to org/osgi/service/async/package-info.java
index 68f2821..9a12696 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/async/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2015). 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,7 +15,7 @@
*/
/**
- * Event Admin Package Version 1.3.
+ * Asynchronous Services Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.async; version="[1.0,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.async; version="[1.0,1.1)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: 99617e1fd60e7c0722a35b601bbb68ece9781ab6 $
*/
-package org.osgi.service.event;
+ at Version("1.0")
+package org.osgi.service.async;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/async/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/async/packageinfo
diff --git a/org/osgi/service/blueprint/container/BlueprintContainer.java b/org/osgi/service/blueprint/container/BlueprintContainer.java
index a4aff5d..d85f413 100644
--- a/org/osgi/service/blueprint/container/BlueprintContainer.java
+++ b/org/osgi/service/blueprint/container/BlueprintContainer.java
@@ -18,6 +18,7 @@ package org.osgi.service.blueprint.container;
import java.util.Collection;
import java.util.Set;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.ReferenceListMetadata;
@@ -39,9 +40,9 @@ import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
* registered as a service and its managed components can be queried.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: f557311df439793513b9e15fc066d7b6ccedebeb $
+ * @author $Id: c450a3fc5cf7282f93cdd0d15ab0b5cf8a59328c $
*/
+ at ProviderType
public interface BlueprintContainer {
/**
* Returns the set of component ids managed by this Blueprint Container.
diff --git a/org/osgi/service/blueprint/container/BlueprintEvent.java b/org/osgi/service/blueprint/container/BlueprintEvent.java
index ae7cc54..81658e3 100644
--- a/org/osgi/service/blueprint/container/BlueprintEvent.java
+++ b/org/osgi/service/blueprint/container/BlueprintEvent.java
@@ -60,7 +60,7 @@ import org.osgi.framework.Bundle;
* @see BlueprintListener
* @see EventConstants
* @Immutable
- * @author $Id: 6155890329cf5bb2593958ad07bbb6ff9b161bc5 $
+ * @author $Id: ebfb3422a27688252ca9ea3473b4944324fb5bc5 $
*/
public class BlueprintEvent {
@@ -223,7 +223,7 @@ public class BlueprintEvent {
this.timestamp = System.currentTimeMillis();
this.bundle = bundle;
this.extenderBundle = extenderBundle;
- this.dependencies = dependencies == null ? null : (String[]) dependencies.clone();;
+ this.dependencies = dependencies == null ? null : (String[]) dependencies.clone();
this.cause = cause;
this.replay = false;
if (bundle == null) {
diff --git a/org/osgi/service/blueprint/container/BlueprintListener.java b/org/osgi/service/blueprint/container/BlueprintListener.java
index 5d563ae..6c0cbc4 100644
--- a/org/osgi/service/blueprint/container/BlueprintListener.java
+++ b/org/osgi/service/blueprint/container/BlueprintListener.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.container;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A {@code BlueprintEvent} Listener.
*
@@ -38,8 +40,9 @@ package org.osgi.service.blueprint.container;
*
* @see BlueprintEvent
* @ThreadSafe
- * @author $Id: d86b4e08b710e0929acd80dd9742dedeb35e2c0f $
+ * @author $Id: 80562f9e101ece4f572073d81436bf0b4c5651e2 $
*/
+ at ConsumerType
public interface BlueprintListener {
/**
diff --git a/org/osgi/service/blueprint/container/Converter.java b/org/osgi/service/blueprint/container/Converter.java
index 7be4a65..3d02107 100644
--- a/org/osgi/service/blueprint/container/Converter.java
+++ b/org/osgi/service/blueprint/container/Converter.java
@@ -16,12 +16,15 @@
package org.osgi.service.blueprint.container;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Type converter to convert an object to a target type.
*
* @ThreadSafe
- * @author $Id: baf2391dfd6e84d36ca0a50d4743da4dd62e5f41 $
+ * @author $Id: a12c2cac2cedf170b178c557ec719b753580569b $
*/
+ at ConsumerType
public interface Converter {
/**
diff --git a/org/osgi/service/blueprint/container/package-info.java b/org/osgi/service/blueprint/container/package-info.java
index 69c5bc9..78e4e66 100644
--- a/org/osgi/service/blueprint/container/package-info.java
+++ b/org/osgi/service/blueprint/container/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -42,9 +42,11 @@
* <p>
* {@code Import-Package: org.osgi.service.blueprint.container; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: 5634fcb81d94a2134051808fc7d726baff5bb4f2 $
+ * @author $Id: 9b898765467c66542967b11f829c52f2196a8873 $
*/
+ at Version("1.0.2")
package org.osgi.service.blueprint.container;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/blueprint/reflect/BeanArgument.java b/org/osgi/service/blueprint/reflect/BeanArgument.java
index 5c2262e..28f46b0 100644
--- a/org/osgi/service/blueprint/reflect/BeanArgument.java
+++ b/org/osgi/service/blueprint/reflect/BeanArgument.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a factory method or constructor argument of a bean. The
* arguments of a bean are obtained from {@link BeanMetadata#getArguments()}.
@@ -23,8 +25,9 @@ package org.osgi.service.blueprint.reflect;
* This is specified by the {@code argument} elements of a bean.
*
* @ThreadSafe
- * @author $Id: 523de7bd6539ff62ab33d50f15a22c8579deb5c4 $
+ * @author $Id: eecdcb6ce14c42d47dc725a15f02d24a3d22b5b0 $
*/
+ at ConsumerType
public interface BeanArgument {
/**
diff --git a/org/osgi/service/blueprint/reflect/BeanMetadata.java b/org/osgi/service/blueprint/reflect/BeanMetadata.java
index 1280c7e..72bc7f6 100644
--- a/org/osgi/service/blueprint/reflect/BeanMetadata.java
+++ b/org/osgi/service/blueprint/reflect/BeanMetadata.java
@@ -17,6 +17,7 @@
package org.osgi.service.blueprint.reflect;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a Bean component.
@@ -25,8 +26,9 @@ import java.util.List;
* This is specified by the {@code bean} element.
*
* @ThreadSafe
- * @author $Id: 725928b126cb26462428e32024f18af7a0a40a4e $
+ * @author $Id: 232caebbf07a2c51cb20942ff9afa3a10114c005 $
*/
+ at ConsumerType
public interface BeanMetadata extends Target, ComponentMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/BeanProperty.java b/org/osgi/service/blueprint/reflect/BeanProperty.java
index fc4ffc2..c136811 100644
--- a/org/osgi/service/blueprint/reflect/BeanProperty.java
+++ b/org/osgi/service/blueprint/reflect/BeanProperty.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a property to be injected into a bean. The properties of a bean
* are obtained from {@link BeanMetadata#getProperties()}.
@@ -24,8 +26,9 @@ package org.osgi.service.blueprint.reflect;
* defined according to the Java Beans conventions.
*
* @ThreadSafe
- * @author $Id: 698d624c9385b8c80d7f8d977cf4f710c0e1864b $
+ * @author $Id: 3b7a752235b469f86423c24ffd9798f5b5a5a720 $
*/
+ at ConsumerType
public interface BeanProperty {
/**
diff --git a/org/osgi/service/blueprint/reflect/CollectionMetadata.java b/org/osgi/service/blueprint/reflect/CollectionMetadata.java
index dda740f..2e4852c 100644
--- a/org/osgi/service/blueprint/reflect/CollectionMetadata.java
+++ b/org/osgi/service/blueprint/reflect/CollectionMetadata.java
@@ -17,6 +17,7 @@
package org.osgi.service.blueprint.reflect;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a collection based value. Values of the collection are defined
@@ -24,9 +25,9 @@ import java.util.List;
* collection to a specific type.
*
* @ThreadSafe
- * @author $Id: 4f230604fc391b46ac1dda9ab5c2dec14a2a1aa0 $
+ * @author $Id: 6c263e48e9a599887f0e97707fc44d19ae2ca489 $
*/
-
+ at ConsumerType
public interface CollectionMetadata extends NonNullMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/ComponentMetadata.java b/org/osgi/service/blueprint/reflect/ComponentMetadata.java
index 5d5a2d3..7760efc 100644
--- a/org/osgi/service/blueprint/reflect/ComponentMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ComponentMetadata.java
@@ -17,6 +17,7 @@
package org.osgi.service.blueprint.reflect;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for managed components. This is the base type for
@@ -24,8 +25,9 @@ import java.util.List;
* {@link ServiceReferenceMetadata}.
*
* @ThreadSafe
- * @author $Id: 5c09016d7b238d1a3bc94216dd58d2e3d5909288 $
+ * @author $Id: ee0576a4d6f979a87365374f10d8538f48279acf $
*/
+ at ConsumerType
public interface ComponentMetadata extends NonNullMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/IdRefMetadata.java b/org/osgi/service/blueprint/reflect/IdRefMetadata.java
index 0a59db2..9bff0ee 100644
--- a/org/osgi/service/blueprint/reflect/IdRefMetadata.java
+++ b/org/osgi/service/blueprint/reflect/IdRefMetadata.java
@@ -16,14 +16,17 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for the verified id of another component managed by the Blueprint
* Container. The id itself will be injected, not the component to which the id
* refers. No implicit dependency is created.
*
* @ThreadSafe
- * @author $Id: 9903067b9248e6f6ba2431c5cb166bc9833fc3e1 $
+ * @author $Id: 21fe592cd49e0151d95901d3bca4941f32759413 $
*/
+ at ConsumerType
public interface IdRefMetadata extends NonNullMetadata {
/**
* Return the id of the referenced component.
diff --git a/org/osgi/service/blueprint/reflect/MapEntry.java b/org/osgi/service/blueprint/reflect/MapEntry.java
index 799a755..80f2a87 100644
--- a/org/osgi/service/blueprint/reflect/MapEntry.java
+++ b/org/osgi/service/blueprint/reflect/MapEntry.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a map entry.
*
@@ -23,8 +25,9 @@ package org.osgi.service.blueprint.reflect;
* {@link ServiceMetadata}.
*
* @ThreadSafe
- * @author $Id: 0148e116bfa36331c0a9a309509e80fd4f8635a4 $
+ * @author $Id: c46fbe6a5c2bb81f6f2cc5f76f08aa9ced5deb2b $
*/
+ at ConsumerType
public interface MapEntry {
/**
* Return the Metadata for the key of the map entry.
diff --git a/org/osgi/service/blueprint/reflect/MapMetadata.java b/org/osgi/service/blueprint/reflect/MapMetadata.java
index cada646..afcfc1b 100644
--- a/org/osgi/service/blueprint/reflect/MapMetadata.java
+++ b/org/osgi/service/blueprint/reflect/MapMetadata.java
@@ -17,6 +17,7 @@
package org.osgi.service.blueprint.reflect;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a Map based value.
@@ -25,8 +26,9 @@ import java.util.List;
* This is specified by the {@code map} element.
*
* @ThreadSafe
- * @author $Id: 36d46242e900e276b1b9996ab3332bfb1ca412d2 $
+ * @author $Id: 8636f9875e3ab1c0d03d2aeb6abb31cfcf4f48ac $
*/
+ at ConsumerType
public interface MapMetadata extends NonNullMetadata {
/**
* Return the name of the type of the map keys.
diff --git a/org/osgi/service/blueprint/reflect/Metadata.java b/org/osgi/service/blueprint/reflect/Metadata.java
index e11c83f..09c8f03 100644
--- a/org/osgi/service/blueprint/reflect/Metadata.java
+++ b/org/osgi/service/blueprint/reflect/Metadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2015). 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.
@@ -16,12 +16,15 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
- * Top level Metadata type. All Metdata types extends this base type.
+ * Top level Metadata type. All Metadata types extends this base type.
*
* @ThreadSafe
- * @author $Id: ad96fa92753e9aaada5b1b8c5fae694e60c60186 $
+ * @author $Id: 074799a5dd453950d0b14c8612912b7c839858d6 $
*/
+ at ConsumerType
public interface Metadata {
// marker interface
}
diff --git a/org/osgi/service/blueprint/reflect/NonNullMetadata.java b/org/osgi/service/blueprint/reflect/NonNullMetadata.java
index efac6a3..382e26d 100644
--- a/org/osgi/service/blueprint/reflect/NonNullMetadata.java
+++ b/org/osgi/service/blueprint/reflect/NonNullMetadata.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a value that cannot {@code null}. All Metadata subtypes extend
* this type except for {@link NullMetadata}.
@@ -25,8 +27,9 @@ package org.osgi.service.blueprint.reflect;
* {@code null}.
*
* @ThreadSafe
- * @author $Id: 6fcc7f5dcba22f41efc2e6985b42735aade73a41 $
+ * @author $Id: 4c9fab2aad74af7e399ebd57adf3acbd705a81c1 $
*/
+ at ConsumerType
public interface NonNullMetadata extends Metadata {
// marker interface
}
diff --git a/org/osgi/service/blueprint/reflect/NullMetadata.java b/org/osgi/service/blueprint/reflect/NullMetadata.java
index f39ef7d..e5fc83e 100644
--- a/org/osgi/service/blueprint/reflect/NullMetadata.java
+++ b/org/osgi/service/blueprint/reflect/NullMetadata.java
@@ -16,13 +16,16 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a value specified to be {@code null} via the <null>
* element.
*
* @ThreadSafe
- * @author $Id: a77a51450e907a2160d116af1bcba04efda6c05b $
+ * @author $Id: 43f4d33a2b0fc7126742f6d2f4287b73af4573ad $
*/
+ at ConsumerType
public interface NullMetadata extends Metadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/PropsMetadata.java b/org/osgi/service/blueprint/reflect/PropsMetadata.java
index dd09fb0..9dddee4 100644
--- a/org/osgi/service/blueprint/reflect/PropsMetadata.java
+++ b/org/osgi/service/blueprint/reflect/PropsMetadata.java
@@ -17,6 +17,7 @@
package org.osgi.service.blueprint.reflect;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a {@code java.util.Properties} based value.
@@ -29,8 +30,9 @@ import java.util.List;
* This is specified by the {@code props} element.
*
* @ThreadSafe
- * @author $Id: ae35d411f96d63b1f3cd3e48c33ed6d99ea722b1 $
+ * @author $Id: 43b12dd13c2aa4ac8f9b9b73e54fe1300ce1faca $
*/
+ at ConsumerType
public interface PropsMetadata extends NonNullMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/RefMetadata.java b/org/osgi/service/blueprint/reflect/RefMetadata.java
index a3187ab..aaf93f5 100644
--- a/org/osgi/service/blueprint/reflect/RefMetadata.java
+++ b/org/osgi/service/blueprint/reflect/RefMetadata.java
@@ -16,13 +16,16 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a reference to another component managed by the Blueprint
* Container.
*
* @ThreadSafe
- * @author $Id: a67274cc8e5033dddc8477a046d116d511c1a4d3 $
+ * @author $Id: 86f3b89d543e2fd199b0e193b8fc645adc6570fa $
*/
+ at ConsumerType
public interface RefMetadata extends Target, NonNullMetadata {
/**
* Return the id of the referenced component.
diff --git a/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java b/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java
index de8d8af..a6b743a 100644
--- a/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a list of service references.
*
@@ -23,8 +25,9 @@ package org.osgi.service.blueprint.reflect;
* This is specified by the {@code reference-list} element.
*
* @ThreadSafe
- * @author $Id: 00698e01d2281bdcabfc7f1cf9f7ede1900b7b97 $
+ * @author $Id: 5e419704f2238329e54fe8173f756c271b706268 $
*/
+ at ConsumerType
public interface ReferenceListMetadata extends ServiceReferenceMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/ReferenceListener.java b/org/osgi/service/blueprint/reflect/ReferenceListener.java
index 4633724..82d76f6 100644
--- a/org/osgi/service/blueprint/reflect/ReferenceListener.java
+++ b/org/osgi/service/blueprint/reflect/ReferenceListener.java
@@ -16,13 +16,16 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a reference listener interested in the reference bind and unbind
* events for a service reference.
*
* @ThreadSafe
- * @author $Id: 837a8107787f9db89c8cbe20549d93c03889f1dc $
+ * @author $Id: 09a44faa9684988621ae47a481d32d4e6c029ec2 $
*/
+ at ConsumerType
public interface ReferenceListener {
/**
diff --git a/org/osgi/service/blueprint/reflect/ReferenceMetadata.java b/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
index ac7d1d4..74c2b72 100644
--- a/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2015). 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.
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a reference that will bind to a single matching service in the
* service registry.
@@ -24,18 +26,19 @@ package org.osgi.service.blueprint.reflect;
* This is specified by the {@code reference} element.
*
* @ThreadSafe
- * @author $Id: ceeaf4e28c32d8e774886ae796d15c0a424f6024 $
+ * @author $Id: c10843ee7b5fe6672185437f47ff222717f6997b $
*/
+ at ConsumerType
public interface ReferenceMetadata extends Target, ServiceReferenceMetadata {
/**
- * Return the timeout for service invocations when a backing service is is
+ * Return the timeout for service invocations when a backing service is
* unavailable.
*
* This is specified by the {@code timeout} attribute of the reference.
*
* @return The timeout, in milliseconds, for service invocations when a
- * backing service is is unavailable.
+ * backing service is unavailable.
*/
long getTimeout();
}
diff --git a/org/osgi/service/blueprint/reflect/RegistrationListener.java b/org/osgi/service/blueprint/reflect/RegistrationListener.java
index cd5351e..0b31cb3 100644
--- a/org/osgi/service/blueprint/reflect/RegistrationListener.java
+++ b/org/osgi/service/blueprint/reflect/RegistrationListener.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a registration listener interested in service registration and
* unregistration events for a service.
@@ -25,8 +27,9 @@ package org.osgi.service.blueprint.reflect;
* when the registration listener is actuated.
*
* @ThreadSafe
- * @author $Id: 37201a5d7a1bf70ed4c3a7430cc619a41efc0458 $
+ * @author $Id: c99c78fd1e9e0a241bc7136ecbc53075885184c9 $
*/
+ at ConsumerType
public interface RegistrationListener {
/**
diff --git a/org/osgi/service/blueprint/reflect/ServiceMetadata.java b/org/osgi/service/blueprint/reflect/ServiceMetadata.java
index ff0f05e..561b79c 100644
--- a/org/osgi/service/blueprint/reflect/ServiceMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ServiceMetadata.java
@@ -18,6 +18,7 @@ package org.osgi.service.blueprint.reflect;
import java.util.Collection;
import java.util.List;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a service to be registered by the Blueprint Container when
@@ -27,8 +28,9 @@ import java.util.List;
* This is specified by the {@code service} element.
*
* @ThreadSafe
- * @author $Id: 6fee125cb89facf4f1680a3b4043c06a50aab2e1 $
+ * @author $Id: 8c4ddb6239c2247906ceeb2b61226be64dfc24ab $
*/
+ at ConsumerType
public interface ServiceMetadata extends ComponentMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java b/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
index ac879ce..4b6342f 100644
--- a/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
@@ -17,14 +17,16 @@
package org.osgi.service.blueprint.reflect;
import java.util.Collection;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Metadata for a reference to an OSGi service. This is the base type for
* {@link ReferenceListMetadata} and {@link ReferenceMetadata}.
*
* @ThreadSafe
- * @author $Id: 9aeb2ae92d89c4d0e82ba9a87c049adaa35df845 $
+ * @author $Id: 059d8f84a3078bbba9cba14f4d5ac2546d509d29 $
*/
+ at ConsumerType
public interface ServiceReferenceMetadata extends ComponentMetadata {
/**
diff --git a/org/osgi/service/blueprint/reflect/Target.java b/org/osgi/service/blueprint/reflect/Target.java
index 3e96c9e..845a6df 100644
--- a/org/osgi/service/blueprint/reflect/Target.java
+++ b/org/osgi/service/blueprint/reflect/Target.java
@@ -16,6 +16,8 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A common interface for managed components that can be used as a direct target
* for method calls. These are {@code bean}, {@code reference}, and {@code ref},
@@ -25,8 +27,9 @@ package org.osgi.service.blueprint.reflect;
* @see ReferenceMetadata
* @see RefMetadata
* @ThreadSafe
- * @author $Id: eaf6c93e05710d4aa1d90937da77ab0e33f9bdcb $
+ * @author $Id: c1f6e5601b1af84122418e0f475f6e0f53cf9cb5 $
*/
+ at ConsumerType
public interface Target extends NonNullMetadata {
// marker interface
}
diff --git a/org/osgi/service/blueprint/reflect/ValueMetadata.java b/org/osgi/service/blueprint/reflect/ValueMetadata.java
index 552062d..9d41cb0 100644
--- a/org/osgi/service/blueprint/reflect/ValueMetadata.java
+++ b/org/osgi/service/blueprint/reflect/ValueMetadata.java
@@ -16,13 +16,16 @@
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Metadata for a simple {@code String} value that will be type-converted if
* necessary before injecting.
*
* @ThreadSafe
- * @author $Id: 69bf6aaf988e94fe8769f3d21cdb45a6534714e2 $
+ * @author $Id: 9d09b60f215657d44853344212aed6ef56e28129 $
*/
+ at ConsumerType
public interface ValueMetadata extends NonNullMetadata {
/**
* Return the unconverted string representation of the value.
diff --git a/org/osgi/service/blueprint/reflect/package-info.java b/org/osgi/service/blueprint/reflect/package-info.java
index 4279b6e..b12afa2 100644
--- a/org/osgi/service/blueprint/reflect/package-info.java
+++ b/org/osgi/service/blueprint/reflect/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.blueprint.reflect; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: 5fcd0d6594f33b7cef53586cc9e5b01f44a0a6a7 $
+ * @author $Id: 7370ea796ad9cc02c63528a339864baa3d6aaafc $
*/
+ at Version("1.0.1")
package org.osgi.service.blueprint.reflect;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/cm/Configuration.java b/org/osgi/service/cm/Configuration.java
index c103378..d1dfd3f 100644
--- a/org/osgi/service/cm/Configuration.java
+++ b/org/osgi/service/cm/Configuration.java
@@ -18,6 +18,7 @@ package org.osgi.service.cm;
import java.io.IOException;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Filter;
/**
@@ -70,9 +71,10 @@ import org.osgi.framework.Filter;
* Service Factory and a Managed Service. When it is important to differentiate
* between these two the term "factory configuration" is used.
*
- * @noimplement
- * @author $Id: bc83a488c091cf0fbeb90e2c013f637bc82f2a26 $
+ * @author $Id: b9057fdde860ef0f0cd1cea06d1ba83da7498d52 $
+ * @ThreadSafe
*/
+ at ProviderType
public interface Configuration {
/**
* Get the PID for this {@code Configuration} object.
@@ -120,8 +122,8 @@ public interface Configuration {
* callback is delayed until aforementioned registration occurs.
*
* <p>
- * Also initiates an asynchronous call to all {@link ConfigurationListener}s
- * with a {@link ConfigurationEvent#CM_UPDATED} event.
+ * Also notifies all Configuration Listeners with a
+ * {@link ConfigurationEvent#CM_UPDATED} event.
*
* @param properties the new set of properties for this configuration
* @throws IOException if update cannot be made persistent
@@ -143,8 +145,8 @@ public interface Configuration {
* {@code deleted} method.
*
* <p>
- * Also initiates an asynchronous call to all {@link ConfigurationListener}s
- * with a {@link ConfigurationEvent#CM_DELETED} event.
+ * Also notifies all Configuration Listeners with a
+ * {@link ConfigurationEvent#CM_DELETED} event.
*
* @throws IOException If delete fails.
* @throws IllegalStateException If this configuration has been deleted.
@@ -200,8 +202,8 @@ public interface Configuration {
* visible then they must be updated with this configuration.
*
* <p>
- * Also initiates an asynchronous call to all {@link ConfigurationListener}s
- * with a {@link ConfigurationEvent#CM_LOCATION_CHANGED} event.
+ * Also notifies all Configuration Listeners with a
+ * {@link ConfigurationEvent#CM_LOCATION_CHANGED} event.
*
* @param location a location, region, or {@code null}
* @throws IllegalStateException If this configuration has been deleted.
@@ -238,15 +240,14 @@ public interface Configuration {
/**
* Get the change count.
*
- * The Configuration must maintain a change counter that every time when
- * this configuration is updated and its properties are stored is
- * incremented with a positive value. The counter must be changed after the
- * properties are persisted but before the targets are updated and events
- * are sent out.
- *
- * @return A monotonously increasing value reflecting changes in this
- * Configuration
+ * Each Configuration must maintain a change counter that is incremented
+ * with a positive value every time the configuration is updated and its
+ * properties are stored. The counter must be incremented before the targets
+ * are updated and events are sent out.
*
+ * @return A monotonically increasing value reflecting changes in this
+ * Configuration.
+ * @throws IllegalStateException If this configuration has been deleted.
* @since 1.5
*/
public long getChangeCount();
diff --git a/org/osgi/service/cm/ConfigurationAdmin.java b/org/osgi/service/cm/ConfigurationAdmin.java
index 0c81240..fb9e4ae 100644
--- a/org/osgi/service/cm/ConfigurationAdmin.java
+++ b/org/osgi/service/cm/ConfigurationAdmin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.
@@ -18,6 +18,7 @@ package org.osgi.service.cm;
import java.io.IOException;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
@@ -114,9 +115,10 @@ import org.osgi.framework.InvalidSyntaxException;
* {@code ConfigurationAdmin} must use a
* {@link org.osgi.framework.ServiceFactory} to support this concept.
*
- * @noimplement
- * @author $Id: cf748cd876c4ff2f88ca7f88ca0030cd1ce94bef $
+ * @author $Id: caf295a2ac110db508f132cafbb97ae3f404cd59 $
+ * @ThreadSafe
*/
+ at ProviderType
public interface ConfigurationAdmin {
/**
* Configuration property naming the Factory PID in the configuration
@@ -127,7 +129,7 @@ public interface ConfigurationAdmin {
public final static String SERVICE_FACTORYPID = "service.factoryPid";
/**
* Configuration property naming the location of the bundle that is
- * associated with a a {@code Configuration} object. This property can be
+ * associated with a {@code Configuration} object. This property can be
* searched for but must not appear in the configuration dictionary for
* security reason. The property's value is of type {@code String}.
*
diff --git a/org/osgi/service/cm/ConfigurationEvent.java b/org/osgi/service/cm/ConfigurationEvent.java
index 6d1086e..62a0653 100644
--- a/org/osgi/service/cm/ConfigurationEvent.java
+++ b/org/osgi/service/cm/ConfigurationEvent.java
@@ -25,8 +25,7 @@ import org.osgi.framework.ServiceReference;
* <p>
* {@code ConfigurationEvent} objects are delivered to all registered
* {@code ConfigurationListener} service objects. ConfigurationEvents must be
- * asynchronously delivered in chronological order with respect to each
- * listener.
+ * delivered in chronological order with respect to each listener.
*
* <p>
* A type code is used to identify the type of event. The following event types
@@ -47,7 +46,7 @@ import org.osgi.framework.ServiceReference;
*
* @see ConfigurationListener
* @Immutable
- * @author $Id: b6e83bbc54df92df81679969a438545d8161978f $
+ * @author $Id: d0c13bb6c11ff90250da4bcfa51cfe8891b148ba $
* @since 1.2
*/
public class ConfigurationEvent {
diff --git a/org/osgi/service/cm/ConfigurationException.java b/org/osgi/service/cm/ConfigurationException.java
index c02ff60..16a116e 100644
--- a/org/osgi/service/cm/ConfigurationException.java
+++ b/org/osgi/service/cm/ConfigurationException.java
@@ -20,7 +20,7 @@ package org.osgi.service.cm;
* An {@code Exception} class to inform the Configuration Admin service of
* problems with configuration data.
*
- * @author $Id: 373726d3395eb6d9c163fd5d7cfec8bb032a6627 $
+ * @author $Id: d4646fc2a8227d38ee0815407ee3578de0188541 $
*/
public class ConfigurationException extends Exception {
static final long serialVersionUID = -1690090413441769377L;
@@ -81,6 +81,7 @@ public class ConfigurationException extends Exception {
* @return The cause of this exception or {@code null} if no cause was set.
* @since 1.2
*/
+ @Override
public Throwable getCause() {
return super.getCause();
}
@@ -96,6 +97,7 @@ public class ConfigurationException extends Exception {
* been set.
* @since 1.2
*/
+ @Override
public Throwable initCause(Throwable cause) {
return super.initCause(cause);
}
diff --git a/org/osgi/service/cm/ConfigurationListener.java b/org/osgi/service/cm/ConfigurationListener.java
index f3a8535..5dead01 100644
--- a/org/osgi/service/cm/ConfigurationListener.java
+++ b/org/osgi/service/cm/ConfigurationListener.java
@@ -16,9 +16,11 @@
package org.osgi.service.cm;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Listener for Configuration Events. When a {@code ConfigurationEvent} is
- * fired, it is asynchronously delivered to a {@code ConfigurationListener}.
+ * fired, it is asynchronously delivered to all {@code ConfigurationListener}s.
*
* <p>
* {@code ConfigurationListener} objects are registered with the Framework
@@ -35,9 +37,11 @@ package org.osgi.service.cm;
* require {@code ServicePermission[ConfigurationListener,REGISTER]} to register
* a {@code ConfigurationListener} service.
*
- * @author $Id: b21e83c93cdb61cfd63205eec28b0baf36fd5da2 $
+ * @author $Id: ee8427b3dbab7f15dddfd9a2506f779c028117f9 $
* @since 1.2
+ * @ThreadSafe
*/
+ at ConsumerType
public interface ConfigurationListener {
/**
* Receives notification of a Configuration that has changed.
diff --git a/org/osgi/service/cm/ConfigurationPermission.java b/org/osgi/service/cm/ConfigurationPermission.java
index af4cffb..9f52375 100644
--- a/org/osgi/service/cm/ConfigurationPermission.java
+++ b/org/osgi/service/cm/ConfigurationPermission.java
@@ -37,7 +37,7 @@ import org.osgi.framework.Filter;
* Configuration Admin.
*
* @ThreadSafe
- * @author $Id: 8d063b34f0b7e467b8bf7ecd8b8e6d42384fdcb7 $
+ * @author $Id: ea3f7764e8cd7a47e98218a2f9938cc94ca73b2b $
* @since 1.2
*/
@@ -278,6 +278,7 @@ public final class ConfigurationPermission extends BasicPermission {
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof ConfigurationPermission)) {
return false;
@@ -359,6 +360,7 @@ public final class ConfigurationPermission extends BasicPermission {
* @return {@code true} if {@code obj} is equivalent to this
* {@code ConfigurationPermission}; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -379,6 +381,7 @@ public final class ConfigurationPermission extends BasicPermission {
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -396,6 +399,7 @@ public final class ConfigurationPermission extends BasicPermission {
* @return Canonical string representation of the
* {@code ConfigurationPermission} actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -426,6 +430,7 @@ public final class ConfigurationPermission extends BasicPermission {
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new ConfigurationPermissionCollection();
}
@@ -502,6 +507,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
* object has been marked read-only.
*/
+ @Override
public void add(Permission permission) {
if (!(permission instanceof ConfigurationPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -542,6 +548,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (!(permission instanceof ConfigurationPermission)) {
return false;
@@ -580,6 +587,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
*
* @return Enumeration of all {@code ConfigurationPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -605,7 +613,9 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
permissions.put("*", new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE));
all_allowed = true;
} else {
- permissions = (HashMap<String, ConfigurationPermission>) gfields.get("permissions", new HashMap<String, ConfigurationPermission>());
+ @SuppressWarnings("unchecked")
+ HashMap<String, ConfigurationPermission> p = (HashMap<String, ConfigurationPermission>) gfields.get("permissions", new HashMap<String, ConfigurationPermission>());
+ permissions = p;
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/org/osgi/service/cm/ConfigurationPlugin.java b/org/osgi/service/cm/ConfigurationPlugin.java
index c2c4b0d..04210d7 100644
--- a/org/osgi/service/cm/ConfigurationPlugin.java
+++ b/org/osgi/service/cm/ConfigurationPlugin.java
@@ -17,6 +17,7 @@
package org.osgi.service.cm;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.framework.ServiceReference;
/**
@@ -67,8 +68,10 @@ import org.osgi.framework.ServiceReference;
* the {@code cm.target} registration property means that the plugin is called
* for all configuration updates.
*
- * @author $Id: 36cd6f091c1bb1726305702c57845ba419ca0a49 $
+ * @author $Id: a3c11ec22796b4b6d1dca2a272da39272d0d7517 $
+ * @ThreadSafe
*/
+ at ConsumerType
public interface ConfigurationPlugin {
/**
* A service property to limit the Managed Service or Managed Service
diff --git a/org/osgi/service/cm/ManagedService.java b/org/osgi/service/cm/ManagedService.java
index 0c1bf36..f61ea0e 100644
--- a/org/osgi/service/cm/ManagedService.java
+++ b/org/osgi/service/cm/ManagedService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.cm;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* A service that can receive configuration data from a Configuration Admin
@@ -106,8 +107,10 @@ import java.util.Dictionary;
* registering bundle. However, when security is on, a Managed Service can have
* Configuration Permission to also be updated for other locations.
*
- * @author $Id: 396a171acbab5e3842ae9d927ab8b3dbd4126f30 $
+ * @author $Id: b85f71d92a690750642b08ea54ca873ea94a5357 $
+ * @ThreadSafe
*/
+ at ConsumerType
public interface ManagedService {
/**
* Update the configuration for a Managed Service.
@@ -130,9 +133,9 @@ public interface ManagedService {
* method.
*
* <p>
- * If the the location allows multiple managed services to be called back
- * for a single configuration then the callbacks must occur in service
- * ranking order. Changes in the location must be reflected by deleting the
+ * If the location allows multiple managed services to be called back for a
+ * single configuration then the callbacks must occur in service ranking
+ * order. Changes in the location must be reflected by deleting the
* configuration if the configuration is no longer visible and updating when
* it becomes visible.
*
diff --git a/org/osgi/service/cm/ManagedServiceFactory.java b/org/osgi/service/cm/ManagedServiceFactory.java
index 39b724a..176a073 100644
--- a/org/osgi/service/cm/ManagedServiceFactory.java
+++ b/org/osgi/service/cm/ManagedServiceFactory.java
@@ -17,6 +17,7 @@
package org.osgi.service.cm;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Manage multiple service instances.
@@ -92,8 +93,10 @@ import java.util.Dictionary;
*
* </pre>
*
- * @author $Id: d91f9771b95e91e371aaccf4811fc1e463cbdade $
+ * @author $Id: 97807d23ba5c5814c2665d28776fd1eaa44ed4ec $
+ * @ThreadSafe
*/
+ at ConsumerType
public interface ManagedServiceFactory {
/**
* Return a descriptive name of this factory.
diff --git a/org/osgi/service/cm/SynchronousConfigurationListener.java b/org/osgi/service/cm/SynchronousConfigurationListener.java
index fc652a1..36a9d19 100644
--- a/org/osgi/service/cm/SynchronousConfigurationListener.java
+++ b/org/osgi/service/cm/SynchronousConfigurationListener.java
@@ -16,10 +16,12 @@
package org.osgi.service.cm;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Synchronous Listener for Configuration Events. When a
- * {@code ConfigurationEvent} is fired, it is synchronously delivered to a
- * {@code SynchronousConfigurationListener}.
+ * {@code ConfigurationEvent} is fired, it is synchronously delivered to all
+ * {@code SynchronousConfigurationListener}s.
*
* <p>
* {@code SynchronousConfigurationListener} objects are registered with the
@@ -37,9 +39,11 @@ package org.osgi.service.cm;
* {@code ServicePermission[SynchronousConfigurationListener,REGISTER]} to
* register a {@code SynchronousConfigurationListener} service.
*
- * @author $Id: 1e33d313c85d3b758ef95f68ae351561cad33b1a $
+ * @author $Id: 6eb8494c350a23abd9ae448970a27e14c1922f63 $
* @since 1.5
+ * @ThreadSafe
*/
+ at ConsumerType
public interface SynchronousConfigurationListener extends ConfigurationListener {
// Marker interface
}
diff --git a/org/osgi/service/cm/package-info.java b/org/osgi/service/cm/package-info.java
index ef0dc0d..ccb7111 100644
--- a/org/osgi/service/cm/package-info.java
+++ b/org/osgi/service/cm/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.cm; version="[1.5,1.6)"}
*
- * @version 1.5
- * @author $Id: fa6f244e37c800f507228bcb610a8f281bf960af $
+ * @author $Id: f83587772d1dc5abb674571906fa1d52b8c53488 $
*/
+ at Version("1.5")
package org.osgi.service.cm;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/component/ComponentConstants.java b/org/osgi/service/component/ComponentConstants.java
index f6d342b..de3a41a 100644
--- a/org/osgi/service/component/ComponentConstants.java
+++ b/org/osgi/service/component/ComponentConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -16,12 +16,14 @@
package org.osgi.service.component;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* Defines standard names for Service Component constants.
*
- * @noimplement
- * @author $Id: 1ddceb7233809be3141c5d3fa9efc027e68b1fdf $
+ * @author $Id: 624eb5610c2127d24ce76f16b3cc146cbcf6db57 $
*/
+ at ProviderType
public interface ComponentConstants {
/**
* Manifest header specifying the XML documents within a bundle that contain
@@ -45,11 +47,11 @@ public interface ComponentConstants {
* configuration. The value of this property must be of type {@code Long}.
*
* <p>
- * The value of this property is assigned by the Service Component Runtime
- * when a component configuration is created. The Service Component Runtime
- * assigns a unique value that is larger than all previously assigned values
- * since the Service Component Runtime was started. These values are NOT
- * persistent across restarts of the Service Component Runtime.
+ * The value of this property is assigned by Service Component Runtime when
+ * a component configuration is created. Service Component Runtime assigns a
+ * unique value that is larger than all previously assigned values since
+ * Service Component Runtime was started. These values are NOT persistent
+ * across restarts of Service Component Runtime.
*/
public final static String COMPONENT_ID = "component.id";
@@ -121,4 +123,20 @@ public interface ComponentConstants {
* @since 1.1
*/
public static final int DEACTIVATION_REASON_BUNDLE_STOPPED = 6;
+
+ /**
+ * 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)))"
+ * </pre>
+ *
+ * @since 1.3
+ */
+ public static final String COMPONENT_CAPABILITY_NAME = "osgi.component";
}
diff --git a/org/osgi/service/component/ComponentContext.java b/org/osgi/service/component/ComponentContext.java
index b3f3777..4e0c4a1 100644
--- a/org/osgi/service/component/ComponentContext.java
+++ b/org/osgi/service/component/ComponentContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2014). 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;
import org.osgi.framework.ServiceReference;
@@ -27,31 +28,13 @@ import org.osgi.framework.ServiceReference;
* component instance has a unique Component Context.
*
* <p>
- * A component instance may have an activate method. If a component instance has
- * a suitable and accessible activate method, this method will be called when a
- * component configuration is activated. If the activate method takes a
- * {@code ComponentContext} argument, it will be passed the component instance's
- * Component Context object. If the activate method takes a
- * {@code BundleContext} argument, it will be passed the component instance's
- * Bundle Context object. If the activate method takes a {@code Map} argument,
- * it will be passed an unmodifiable Map containing the component properties.
- *
- * <p>
- * A component instance may have a deactivate method. If a component instance
- * has a suitable and accessible deactivate method, this method will be called
- * when the component configuration is deactivated. If the deactivate method
- * takes a {@code ComponentContext} argument, it will be passed the component
- * instance's Component Context object. If the deactivate method takes a
- * {@code BundleContext} argument, it will be passed the component instance's
- * Bundle Context object. If the deactivate method takes a {@code Map} argument,
- * it will be passed an unmodifiable Map containing the component properties. If
- * the deactivate method takes an {@code int} or {@code Integer} argument, it
- * will be passed the reason code for the component instance's deactivation.
+ * A component instance may obtain its Component Context object through its
+ * activate, modified, and deactivate methods.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 4f87f06a8d2bcbda855799d0323582eb6164f99b $
+ * @author $Id: 5499691841bcfbb0d35222564785af1a5a530c7f $
*/
+ at ProviderType
public interface ComponentContext {
/**
* Returns the component properties for this Component Context.
@@ -69,7 +52,7 @@ public interface ComponentContext {
* multiple services are bound to the reference, the service with the
* highest ranking (as specified in its {@code Constants.SERVICE_RANKING}
* property) is returned. If there is a tie in ranking, the service with the
- * lowest service ID (as specified in its {@code Constants.SERVICE_ID}
+ * lowest service id (as specified in its {@code Constants.SERVICE_ID}
* property); that is, the service that was registered first is returned.
*
* @param name The name of a reference as specified in a {@code reference}
@@ -77,7 +60,7 @@ public interface ComponentContext {
* @return A service object for the referenced service or {@code null} if
* the reference cardinality is {@code 0..1} or {@code 0..n} and no
* bound service is available.
- * @throws ComponentException If the Service Component Runtime catches an
+ * @throws ComponentException If Service Component Runtime catches an
* exception while activating the bound service.
*/
public Object locateService(String name);
@@ -86,6 +69,7 @@ public interface ComponentContext {
* Returns the service object for the specified reference name and
* {@code ServiceReference}.
*
+ * @param <S> Type of Service.
* @param name The name of a reference as specified in a {@code reference}
* element in this component's description.
* @param reference The {@code ServiceReference} to a bound service. This
@@ -94,10 +78,10 @@ public interface ComponentContext {
* @return A service object for the referenced service or {@code null} if
* the specified {@code ServiceReference} is not a bound service for
* the specified reference name.
- * @throws ComponentException If the Service Component Runtime catches an
+ * @throws ComponentException If Service Component Runtime catches an
* exception while activating the bound service.
*/
- public Object locateService(String name, ServiceReference reference);
+ public <S> S locateService(String name, ServiceReference<S> reference);
/**
* Returns the service objects for the specified reference name.
@@ -109,7 +93,7 @@ public interface ComponentContext {
* {@code 0..n} and no bound service is available. If the reference
* cardinality is {@code 0..1} or {@code 1..1} and a bound service
* is available, the array will have exactly one element.
- * @throws ComponentException If the Service Component Runtime catches an
+ * @throws ComponentException If Service Component Runtime catches an
* exception while activating a bound service.
*/
public Object[] locateServices(String name);
@@ -125,17 +109,18 @@ public interface ComponentContext {
/**
* If the component instance is registered as a service using the
- * {@code servicefactory="true"} attribute, then this method returns the
- * bundle using the service provided by the component instance.
+ * {@code servicescope="bundle"} or {@code servicescope="prototype"}
+ * attribute, then this method returns the bundle using the service provided
+ * by the component instance.
* <p>
* This method will return {@code null} if:
* <ul>
* <li>The component instance is not a service, then no bundle can be using
* it as a service.</li>
* <li>The component instance is a service but did not specify the
- * {@code servicefactory="true"} attribute, then all bundles using the
- * service provided by the component instance will share the same component
- * instance.</li>
+ * {@code servicescope="bundle"} or {@code servicescope="prototype"}
+ * attribute, then all bundles using the service provided by the component
+ * instance will share the same component instance.</li>
* <li>The service provided by the component instance is not currently being
* used by any bundle.</li>
* </ul>
@@ -157,6 +142,12 @@ public interface ComponentContext {
* Enables the specified component name. The specified component name must
* be in the same bundle as this component.
*
+ * <p>
+ * This method must return after changing the enabled state of the specified
+ * component name. Any actions that result from this, such as activating or
+ * deactivating a component configuration, must occur asynchronously to this
+ * method call.
+ *
* @param name The name of a component or {@code null} to indicate all
* components in the bundle.
*/
@@ -166,6 +157,12 @@ public interface ComponentContext {
* Disables the specified component name. The specified component name must
* be in the same bundle as this component.
*
+ * <p>
+ * This method must return after changing the enabled state of the specified
+ * component name. Any actions that result from this, such as activating or
+ * deactivating a component configuration, must occur asynchronously to this
+ * method call.
+ *
* @param name The name of a component.
*/
public void disableComponent(String name);
@@ -182,5 +179,5 @@ public interface ComponentContext {
* {@code null} if the component instance is not registered as a
* service.
*/
- public ServiceReference getServiceReference();
+ public ServiceReference<?> getServiceReference();
}
diff --git a/org/osgi/service/component/ComponentException.java b/org/osgi/service/component/ComponentException.java
index a6133d9..8b2aaab 100644
--- a/org/osgi/service/component/ComponentException.java
+++ b/org/osgi/service/component/ComponentException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2014). 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,9 +17,9 @@
package org.osgi.service.component;
/**
- * Unchecked exception which may be thrown by the Service Component Runtime.
+ * Unchecked exception which may be thrown by Service Component Runtime.
*
- * @author $Id: 86b3c4ee6ae880dac98ba734556bbe6d2fbed971 $
+ * @author $Id: 6b47774608ff37a2076b9f58090509093314a67a $
*/
public class ComponentException extends RuntimeException {
static final long serialVersionUID = -7438212656298726924L;
@@ -57,6 +57,7 @@ public class ComponentException extends RuntimeException {
*
* @return The cause of this exception or {@code null} if no cause was set.
*/
+ @Override
public Throwable getCause() {
return super.getCause();
}
@@ -71,6 +72,7 @@ public class ComponentException extends RuntimeException {
* @throws IllegalStateException If the cause of this exception has already
* been set.
*/
+ @Override
public Throwable initCause(Throwable cause) {
return super.initCause(cause);
}
diff --git a/org/osgi/service/component/ComponentFactory.java b/org/osgi/service/component/ComponentFactory.java
index 99bbab8..ca74a7a 100644
--- a/org/osgi/service/component/ComponentFactory.java
+++ b/org/osgi/service/component/ComponentFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2014). 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,18 +17,19 @@
package org.osgi.service.component;
import java.util.Dictionary;
+import org.osgi.annotation.versioning.ProviderType;
/**
* When a component is declared with the {@code factory} attribute on its
- * {@code component} element, the Service Component Runtime will register a
+ * {@code component} element, Service Component Runtime will register a
* Component Factory service to allow new component configurations to be created
* and activated rather than automatically creating and activating component
* configuration as necessary.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 659fb05e2876297c27589e9007fd327f1d87fd90 $
+ * @author $Id: a6422fc517a31533b1188d5ab9d9ee95a7a52c8a $
*/
+ at ProviderType
public interface ComponentFactory {
/**
* Create and activate a new component configuration. Additional properties
@@ -41,7 +42,7 @@ public interface ComponentFactory {
* configuration has been activated and, if the component specifies
* a {@code service} element, the component instance has been
* registered as a service.
- * @throws ComponentException If the Service Component Runtime is unable to
+ * @throws ComponentException If Service Component Runtime is unable to
* activate the component configuration.
*/
public ComponentInstance newInstance(Dictionary<String, ?> properties);
diff --git a/org/osgi/service/component/ComponentInstance.java b/org/osgi/service/component/ComponentInstance.java
index 586b982..c45e075 100644
--- a/org/osgi/service/component/ComponentInstance.java
+++ b/org/osgi/service/component/ComponentInstance.java
@@ -16,6 +16,8 @@
package org.osgi.service.component;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* A ComponentInstance encapsulates a component instance of an activated
* component configuration. ComponentInstances are created whenever a component
@@ -26,9 +28,9 @@ package org.osgi.service.component;
* created when the component configuration is activated again.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: ea48ee21ed7e44d2a4c30a7fa9dba327139827bf $
+ * @author $Id: 8078babdd771f18831a54bfaa407e4edd2781552 $
*/
+ at ProviderType
public interface ComponentInstance {
/**
* Dispose of the component configuration for this component instance. The
diff --git a/org/osgi/service/component/ComponentServiceObjects.java b/org/osgi/service/component/ComponentServiceObjects.java
new file mode 100644
index 0000000..62cabcb
--- /dev/null
+++ b/org/osgi/service/component/ComponentServiceObjects.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.component;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceObjects;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Allows multiple service objects for a service to be obtained.
+ *
+ * <p>
+ * A component instance can receive a {@code ComponentServiceObjects} object via
+ * a reference that is typed {@code ComponentServiceObjects}.
+ *
+ * <p>
+ * For services with {@link Constants#SCOPE_PROTOTYPE prototype} scope, multiple
+ * service objects for the service can be obtained. For services with
+ * {@link Constants#SCOPE_SINGLETON singleton} or {@link Constants#SCOPE_BUNDLE
+ * bundle} scope, only one, use-counted service object is available.
+ *
+ * <p>
+ * Any unreleased service objects obtained from this
+ * {@code ComponentServiceObjects} object are automatically released by Service
+ * Component Runtime when the service becomes unbound.
+ *
+ * @param <S> Type of Service
+ * @ThreadSafe
+ * @since 1.3
+ * @see ServiceObjects
+ * @author $Id: 49fc5e86384324c73b412d8b733f715f8b55d4d6 $
+ */
+ at ProviderType
+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.
+ *
+ * @return A service object for the associated service or {@code null} if
+ * the service is unbound, the customized service object returned by
+ * 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.
+ * @see #ungetService(Object)
+ */
+ public S getService();
+
+ /**
+ * 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 IllegalArgumentException If the specified service object was not
+ * provided by this {@code ComponentServiceObjects} object.
+ * @see #getService()
+ */
+ public void ungetService(S service);
+
+ /**
+ * Returns the {@link ServiceReference} for the service associated with this
+ * {@code ComponentServiceObjects} object.
+ *
+ * @return The {@link ServiceReference} for the service associated with this
+ * {@code ComponentServiceObjects} object.
+ */
+ public ServiceReference<S> getServiceReference();
+}
diff --git a/org/osgi/service/component/annotations/Activate.java b/org/osgi/service/component/annotations/Activate.java
index 7ba13af..b00227b 100644
--- a/org/osgi/service/component/annotations/Activate.java
+++ b/org/osgi/service/component/annotations/Activate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2014). 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.
@@ -29,12 +29,12 @@ import java.lang.annotation.Target;
* The annotated method is the activate method of the Component.
*
* <p>
- * This annotation is not processed at runtime by a Service Component Runtime
- * implementation. It must be processed by tools and used to add a Component
- * Description to the bundle.
+ * This annotation is not processed at runtime by Service Component Runtime. It
+ * must be processed by tools and used to add a Component Description to the
+ * bundle.
*
* @see "The activate attribute of the component element of a Component Description."
- * @author $Id: e24a899f70a9f7ec19b85b9e046471dc15236294 $
+ * @author $Id: 6e320f37190ea29c600d8b8716052efcdcb6e856 $
* @since 1.1
*/
@Retention(RetentionPolicy.CLASS)
diff --git a/org/osgi/service/component/annotations/Component.java b/org/osgi/service/component/annotations/Component.java
index 7897838..2a51a37 100644
--- a/org/osgi/service/component/annotations/Component.java
+++ b/org/osgi/service/component/annotations/Component.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2015). 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.
@@ -28,12 +28,12 @@ import java.lang.annotation.Target;
* The annotated class is the implementation class of the Component.
*
* <p>
- * This annotation is not processed at runtime by a Service Component Runtime
- * implementation. It must be processed by tools and used to add a Component
- * Description to the bundle.
+ * This annotation is not processed at runtime by Service Component Runtime. It
+ * must be processed by tools and used to add a Component Description to the
+ * bundle.
*
* @see "The component element of a Component Description."
- * @author $Id: e7f072364b225694797ebf97067fd6aecd297b5f $
+ * @author $Id: d44af93dcb1a5e97ef594074d075c86f68f3b3b7 $
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
@@ -82,11 +82,16 @@ public @interface Component {
* component instance.
*
* <p>
- * If {@code true}, this Component uses the OSGi ServiceFactory concept. If
- * {@code false} or not specified, this Component does not use the OSGi
- * ServiceFactory concept.
+ * This element is ignored when the {@link #scope()} element does not have
+ * the default value. If {@code true}, this Component uses
+ * {@link ServiceScope#BUNDLE bundle} service scope. If {@code false} or not
+ * specified, this Component uses {@link ServiceScope#SINGLETON singleton}
+ * service scope. If the {@link #factory()} element is specified or the
+ * {@link #immediate()} element is specified with {@code true}, this element
+ * can only be specified with {@code false}.
*
- * @see "The servicefactory attribute of the service element of a Component Description."
+ * @see "The scope attribute of the service element of a Component Description."
+ * @deprecated Since 1.3. Replaced by {@link #scope()}.
*/
boolean servicefactory() default false;
@@ -95,8 +100,8 @@ public @interface Component {
* is started.
*
* <p>
- * If {@code true}, this Component is enabled. If {@code false} or not
- * specified, this Component is disabled.
+ * If {@code true} or not specified, this Component is enabled. If
+ * {@code false}, this Component is disabled.
*
* @see "The enabled attribute of the component element of a Component Description."
*/
@@ -110,13 +115,13 @@ public @interface Component {
* If {@code true}, this Component must be immediately activated upon
* becoming satisfied. If {@code false}, activation of this Component is
* delayed. If this property is specified, its value must be {@code false}
- * if the {@link #factory} property is also specified or must be
- * {@code true} if the {@link #service} property is specified with an empty
- * value.
+ * if the {@link #factory()} property is also specified or must be
+ * {@code true} if the {@link #service()} property is specified with an
+ * empty value.
*
* <p>
- * If not specified, the default is {@code false} if the {@link #factory}
- * property is specified or the {@link #service} property is not specified
+ * If not specified, the default is {@code false} if the {@link #factory()}
+ * property is specified or the {@link #service()} property is not specified
* or specified with a non-empty value and {@code true} otherwise.
*
* @see "The immediate attribute of the component element of a Component Description."
@@ -127,13 +132,14 @@ public @interface Component {
* Properties for this Component.
*
* <p>
- * Each property string is specified as {@code "key=value"}. The type of the
- * property value can be specified in the key as {@code key:type=value}. The
- * type must be one of the property types supported by the type attribute of
- * the property element of a Component Description.
+ * Each property string is specified as {@code "name=value"}. The type of
+ * the property value can be specified in the name as
+ * {@code name:type=value}. The type must be one of the property types
+ * supported by the type attribute of the property element of a Component
+ * Description.
*
* <p>
- * To specify a property with multiple values, use multiple key, value
+ * To specify a property with multiple values, use multiple name, value
* pairs. For example, {@code "foo=bar", "foo=baz"}.
*
* @see "The property element of a Component Description."
@@ -174,8 +180,18 @@ public @interface Component {
* Configuration object where the PID equals the name of the component.
*
* <p>
- * If not specified, the {@link ConfigurationPolicy#OPTIONAL OPTIONAL}
- * configuration policy is used.
+ * If not specified, the configuration policy is based upon whether the
+ * component is also annotated with the Meta Type
+ * {@link org.osgi.service.metatype.annotations.Designate Designate}
+ * annotation.
+ * <ul>
+ * <li>Not annotated with {@code Designate} - The configuration policy is
+ * {@link ConfigurationPolicy#OPTIONAL OPTIONAL}.</li>
+ * <li>Annotated with {@code Designate(factory=false)} - The configuration
+ * policy is {@link ConfigurationPolicy#OPTIONAL OPTIONAL}.</li>
+ * <li>Annotated with {@code Designate(factory=true)} - The configuration
+ * policy is {@link ConfigurationPolicy#REQUIRE REQUIRE}.</li>
+ * </ul>
*
* @see "The configuration-policy attribute of the component element of a Component Description."
* @since 1.1
@@ -183,18 +199,82 @@ public @interface Component {
ConfigurationPolicy configurationPolicy() default ConfigurationPolicy.OPTIONAL;
/**
- * The configuration PID for the configuration of this Component.
+ * The configuration PIDs for the configuration of this Component.
*
* <p>
- * Allows the configuration PID for this Component to be different than the
- * name of this Component.
+ * Each value specifies a configuration PID for this Component.
*
* <p>
- * If not specified, the name of this Component is used as the configuration
- * PID of this Component.
+ * If no value is specified, the name of this Component is used as the
+ * configuration PID of this Component.
+ *
+ * <p>
+ * A special string (<code>{@value #NAME}</code>) can be used to specify the
+ * name of the component as a configuration PID. The {@code NAME} constant
+ * holds this special string. For example:
+ *
+ * <pre>
+ * @Component(configurationPid={"com.acme.system", Component.NAME})
+ * </pre>
+ *
+ * Tools creating a Component Description from this annotation must replace
+ * the special string with the actual name of this Component.
*
* @see "The configuration-pid attribute of the component element of a Component Description."
* @since 1.2
*/
- String configurationPid() default "";
+ String[] configurationPid() default NAME;
+
+ /**
+ * Special string representing the name of this Component.
+ *
+ * <p>
+ * This string can be used in {@link #configurationPid()} to specify the
+ * name of the component as a configuration PID. For example:
+ *
+ * <pre>
+ * @Component(configurationPid={"com.acme.system", Component.NAME})
+ * </pre>
+ *
+ * Tools creating a Component Description from this annotation must replace
+ * the special string with the actual name of this Component.
+ *
+ * @since 1.3
+ */
+ String NAME = "$";
+
+ /**
+ * The service scope for the service of this Component.
+ *
+ * <p>
+ * If not specified (and the deprecated {@link #servicefactory()} element is
+ * not specified), the {@link ServiceScope#SINGLETON singleton} service
+ * scope is used. If the {@link #factory()} element is specified or the
+ * {@link #immediate()} element is specified with {@code true}, this element
+ * can only be specified with the {@link ServiceScope#SINGLETON singleton}
+ * service scope.
+ *
+ * @see "The scope attribute of the service element of a Component Description."
+ * @since 1.3
+ */
+ ServiceScope scope() default ServiceScope.DEFAULT;
+
+ /**
+ * The lookup strategy references of this Component.
+ *
+ * <p>
+ * To access references using the lookup strategy, {@link Reference}
+ * annotations are specified naming the reference and declaring the type of
+ * the referenced service. The referenced service can be accessed using one
+ * of the {@code locateService} methods of {@code ComponentContext}.
+ *
+ * <p>
+ * To access references using the event strategy, bind methods are annotated
+ * with {@link Reference}. To access references using the field strategy,
+ * fields are annotated with {@link Reference}.
+ *
+ * @see "The reference element of a Component Description."
+ * @since 1.3
+ */
+ Reference[] reference() default {};
}
diff --git a/org/osgi/service/component/annotations/Deactivate.java b/org/osgi/service/component/annotations/Deactivate.java
index db33b01..261e156 100644
--- a/org/osgi/service/component/annotations/Deactivate.java
+++ b/org/osgi/service/component/annotations/Deactivate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2014). 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.
@@ -29,12 +29,12 @@ import java.lang.annotation.Target;
* The annotated method is the deactivate method of the Component.
*
* <p>
- * This annotation is not processed at runtime by a Service Component Runtime
- * implementation. It must be processed by tools and used to add a Component
- * Description to the bundle.
+ * This annotation is not processed at runtime by Service Component Runtime. It
+ * must be processed by tools and used to add a Component Description to the
+ * bundle.
*
* @see "The deactivate attribute of the component element of a Component Description."
- * @author $Id: 1809c70ebf50ecdb649b1804bcd48d21a626fa37 $
+ * @author $Id: 78bb6b4feabd4061ead2e7fa08b7e97c98c9498e $
* @since 1.1
*/
@Retention(RetentionPolicy.CLASS)
diff --git a/org/osgi/service/component/annotations/FieldOption.java b/org/osgi/service/component/annotations/FieldOption.java
new file mode 100644
index 0000000..cf77020
--- /dev/null
+++ b/org/osgi/service/component/annotations/FieldOption.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) OSGi Alliance (2014, 2015). 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.service.component.annotations;
+
+/**
+ * Field options for the {@link Reference} annotation.
+ *
+ * @since 1.3
+ * @author $Id: 35bfd6c67110ff6c5cd5c9c1764398e4024dbb59 $
+ */
+public enum FieldOption {
+
+ /**
+ * The update field option is used to update the collection referenced by
+ * the field when there are changes to the bound services.
+ *
+ * <p>
+ * This field option can only be used when the field reference has dynamic
+ * policy and multiple cardinality.
+ */
+ UPDATE("update"),
+
+ /**
+ * The replace field option is used to replace the field value with a new
+ * value when there are changes to the bound services.
+ */
+ REPLACE("replace");
+
+ private final String value;
+
+ FieldOption(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/org/osgi/service/component/annotations/Modified.java b/org/osgi/service/component/annotations/Modified.java
index b2865b4..bd10114 100644
--- a/org/osgi/service/component/annotations/Modified.java
+++ b/org/osgi/service/component/annotations/Modified.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2014). 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.
@@ -29,12 +29,12 @@ import java.lang.annotation.Target;
* The annotated method is the modified method of the Component.
*
* <p>
- * This annotation is not processed at runtime by a Service Component Runtime
- * implementation. It must be processed by tools and used to add a Component
- * Description to the bundle.
+ * This annotation is not processed at runtime by Service Component Runtime. It
+ * must be processed by tools and used to add a Component Description to the
+ * bundle.
*
* @see "The modified attribute of the component element of a Component Description."
- * @author $Id: fd9f97d2f8498aeefc84a6bbed1dccb0dce90d09 $
+ * @author $Id: c4d0c68f20f6237ebd97ae7199394fb5240870d4 $
* @since 1.1
*/
@Retention(RetentionPolicy.CLASS)
diff --git a/org/osgi/service/component/annotations/Reference.java b/org/osgi/service/component/annotations/Reference.java
index f2da9c8..d6eddec 100644
--- a/org/osgi/service/component/annotations/Reference.java
+++ b/org/osgi/service/component/annotations/Reference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2014). 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,17 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Identify the annotated method as a {@code bind} method of a Service
- * Component.
+ * Identify the annotated member as a reference of a Service Component.
*
* <p>
- * The annotated method is a bind method of the Component.
+ * When the annotation is applied to a method, the method is the bind method of
+ * the reference. When the annotation is applied to a field, the field will
+ * contain the bound service(s) of the reference.
*
* <p>
- * This annotation is not processed at runtime by a Service Component Runtime
- * implementation. It must be processed by tools and used to add a Component
- * Description to the bundle.
+ * This annotation is not processed at runtime by Service Component Runtime. It
+ * must be processed by tools and used to add a Component Description to the
+ * bundle.
*
* <p>
* In the generated Component Description for a component, the references must
@@ -39,114 +40,276 @@ import java.lang.annotation.Target;
* ) of the reference {@link #name() name}s.
*
* @see "The reference element of a Component Description."
- * @author $Id: 9887c51c74905b29393f0b2fe7cf5f9a40eb3d72 $
+ * @author $Id: b13bbef27d561774539baec5c5120b20255f72ad $
*/
@Retention(RetentionPolicy.CLASS)
- at Target(ElementType.METHOD)
+ at Target({ElementType.METHOD, ElementType.FIELD})
public @interface Reference {
/**
* The name of this reference.
*
* <p>
- * If not specified, the name of this reference is based upon the name of
- * the method being annotated. If the method name begins with {@code bind},
- * {@code set} or {@code add}, that is removed.
+ * The name of this reference must be specified when using this annotation
+ * in the {@link Component#reference()} element since there is no annotated
+ * member from which the name can be determined.
+ *
+ * If not specified, the name of this reference is based upon how this
+ * annotation is used:
+ * <ul>
+ * <li>Annotated method - If the method name begins with {@code bind},
+ * {@code set} or {@code add}, that prefix is removed to create the name of
+ * the reference. Otherwise, the name of the reference is the method name.</li>
+ * <li>Annotated field - The name of the reference is the field name.</li>
+ * </ul>
*
* @see "The name attribute of the reference element of a Component Description."
*/
String name() default "";
/**
- * The type of the service to bind to this reference.
+ * The type of the service for this reference.
+ *
+ * <p>
+ * The type of the service for this reference must be specified when using
+ * this annotation in the {@link Component#reference()} element since there
+ * is no annotated member from which the type of the service can be
+ * determined.
*
* <p>
- * If not specified, the type of the service to bind is based upon the type
- * of the first argument of the method being annotated.
+ * If not specified, the type of the service for this reference is based
+ * upon how this annotation is used:
+ * <ul>
+ * <li>Annotated method - The type of the service is the type of the first
+ * argument of the method.</li>
+ * <li>Annotated field - The type of the service is based upon the type of
+ * the field being annotated and the cardinality of the reference. If the
+ * cardinality is either {@link ReferenceCardinality#MULTIPLE 0..n}, or
+ * {@link ReferenceCardinality#AT_LEAST_ONE 1..n}, the type of the field
+ * must be one of {@code java.util.Collection}, {@code java.util.List}, or a
+ * subtype of {@code java.util.Collection} so the type of the service is the
+ * generic type of the collection. Otherwise, the type of the service is the
+ * type of the field.</li>
+ * </ul>
*
* @see "The interface attribute of the reference element of a Component Description."
*/
Class<?> service() default Object.class;
/**
- * The cardinality of the reference.
+ * The cardinality of this reference.
*
* <p>
- * If not specified, the reference has a
- * {@link ReferenceCardinality#MANDATORY 1..1} cardinality.
+ * If not specified, the cardinality of this reference is based upon how
+ * this annotation is used:
+ * <ul>
+ * <li>Annotated method - The cardinality is
+ * {@link ReferenceCardinality#MANDATORY 1..1}.</li>
+ * <li>Annotated field - The cardinality is based on the type of the field.
+ * If the type is either {@code java.util.Collection},
+ * {@code java.util.List}, or a subtype of {@code java.util.Collection}, the
+ * cardinality is {@link ReferenceCardinality#MULTIPLE 0..n}. Otherwise the
+ * cardinality is {@link ReferenceCardinality#MANDATORY 1..1}.</li>
+ * <li>{@link Component#reference()} element - The cardinality is
+ * {@link ReferenceCardinality#MANDATORY 1..1}.</li>
+ * </ul>
*
* @see "The cardinality attribute of the reference element of a Component Description."
*/
ReferenceCardinality cardinality() default ReferenceCardinality.MANDATORY;
/**
- * The policy for the reference.
+ * The policy for this reference.
*
* <p>
- * If not specified, the {@link ReferencePolicy#STATIC STATIC} reference
- * policy is used.
+ * If not specified, the policy of this reference is based upon how this
+ * annotation is used:
+ * <ul>
+ * <li>Annotated method - The policy is {@link ReferencePolicy#STATIC
+ * STATIC}.</li>
+ * <li>Annotated field - The policy is based on the modifiers of the field.
+ * If the field is declared {@code volatile}, the policy is
+ * {@link ReferencePolicy#DYNAMIC}. Otherwise the policy is
+ * {@link ReferencePolicy#STATIC STATIC}.</li>
+ * <li>{@link Component#reference()} element - The policy is
+ * {@link ReferencePolicy#STATIC STATIC}.</li>
+ * </ul>
*
* @see "The policy attribute of the reference element of a Component Description."
*/
ReferencePolicy policy() default ReferencePolicy.STATIC;
/**
- * The target filter for the reference.
+ * The target property for this reference.
+ *
+ * <p>
+ * If not specified, no target property is set.
*
* @see "The target attribute of the reference element of a Component Description."
*/
String target() default "";
/**
- * The name of the unbind method which is associated with the annotated bind
- * method.
+ * The policy option for this reference.
*
* <p>
- * To declare no unbind method, the value {@code "-"} must be used.
+ * If not specified, the {@link ReferencePolicyOption#RELUCTANT RELUCTANT}
+ * reference policy option is used.
+ *
+ * @see "The policy-option attribute of the reference element of a Component Description."
+ * @since 1.2
+ */
+ ReferencePolicyOption policyOption() default ReferencePolicyOption.RELUCTANT;
+
+ /**
+ * The reference scope for this reference.
*
* <p>
- * If not specified, the name of the unbind method is derived from the name
- * of the annotated bind method. If the annotated method name begins with
- * {@code bind}, {@code set} or {@code add}, that is replaced with
- * {@code unbind}, {@code unset} or {@code remove}, respectively, to derive
- * the unbind method name. Otherwise, {@code un} is prefixed to the
- * annotated method name to derive the unbind method name. The unbind method
- * is only set if the component type contains a method with the derived
- * name.
+ * If not specified, the {@link ReferenceScope#BUNDLE bundle} reference
+ * scope is used.
*
- * @see "The unbind attribute of the reference element of a Component Description."
+ * @see "The scope attribute of the reference element of a Component Description."
+ * @since 1.3
*/
- String unbind() default "";
+ ReferenceScope scope() default ReferenceScope.BUNDLE;
+
+ /* Method injection elements */
/**
- * The policy option for the reference.
+ * The name of the bind method for this reference.
*
* <p>
- * If not specified, the {@link ReferencePolicyOption#RELUCTANT RELUCTANT}
- * reference policy option is used.
+ * If specified and this reference annotates a method, the specified name
+ * must match the name of the annotated method.
*
- * @see "The policy-option attribute of the reference element of a Component Description."
- * @since 1.2
+ * <p>
+ * If not specified, the name of the bind method is based upon how this
+ * annotation is used:
+ * <ul>
+ * <li>Annotated method - The name of the annotated method is the name of
+ * the bind method.</li>
+ * <li>Annotated field - There is no bind method name.</li>
+ * <li>{@link Component#reference()} element - There is no bind method name.
+ * </li>
+ * </ul>
+ *
+ * <p>
+ * If there is a bind method name, the component must contain a method with
+ * that name.
+ *
+ * @see "The bind attribute of the reference element of a Component Description."
+ * @since 1.3
*/
- ReferencePolicyOption policyOption() default ReferencePolicyOption.RELUCTANT;
+ String bind() default "";
/**
- * The name of the updated method which is associated with the annotated
- * bind method.
+ * The name of the updated method for this reference.
*
* <p>
- * To declare no updated method, the value {@code "-"} must be used.
+ * If not specified, the name of the updated method is based upon how this
+ * annotation is used:
+ * <ul>
+ * <li>Annotated method - The name of the updated method is created from the
+ * name of the annotated method. If the name of the annotated method begins
+ * with {@code bind}, {@code set} or {@code add}, that prefix is replaced
+ * with {@code updated} to create the name candidate for the updated method.
+ * Otherwise, {@code updated} is prefixed to the name of the annotated
+ * method to create the name candidate for the updated method. If the
+ * component type contains a method with the candidate name, the candidate
+ * name is used as the name of the updated method. To declare no updated
+ * method when the component type contains a method with the candidate name,
+ * the value {@code "-"} must be used.</li>
+ * <li>Annotated field - There is no updated method name.</li>
+ * <li>{@link Component#reference()} element - There is no updated method
+ * name.</li>
+ * </ul>
*
* <p>
- * If not specified, the name of the updated method is derived from the name
- * of the annotated bind method. If the annotated method name begins with
- * {@code bind}, {@code set} or {@code add}, that is replaced with
- * {@code updated} to derive the updated method name. Otherwise,
- * {@code updated} is prefixed to the annotated method name to derive the
- * updated method name. The updated method is only set if the component type
- * contains a method with the derived name.
+ * If there is an updated method name, the component must contain a method
+ * with that name.
*
* @see "The updated attribute of the reference element of a Component Description."
* @since 1.2
*/
String updated() default "";
+
+ /**
+ * The name of the unbind method for this reference.
+ *
+ * <p>
+ * If not specified, the name of the unbind method is based upon how this
+ * annotation is used:
+ * <ul>
+ * <li>Annotated method - The name of the unbind method is created from the
+ * name of the annotated method. If the name of the annotated method begins
+ * with {@code bind}, {@code set} or {@code add}, that prefix is replaced
+ * with {@code unbind}, {@code unset} or {@code remove}, respectively, to
+ * create the name candidate for the unbind method. Otherwise, {@code un} is
+ * prefixed to the name of the annotated method to create the name candidate
+ * for the unbind method. If the component type contains a method with the
+ * candidate name, the candidate name is used as the name of the unbind
+ * method. To declare no unbind method when the component type contains a
+ * method with the candidate name, the value {@code "-"} must be used.</li>
+ * <li>Annotated field - There is no unbind method name.</li>
+ * <li>{@link Component#reference()} element - There is no unbind method
+ * name.</li>
+ * </ul>
+ *
+ * <p>
+ * If there is an unbind method name, the component must contain a method
+ * with that name.
+ *
+ * @see "The unbind attribute of the reference element of a Component Description."
+ */
+ String unbind() default "";
+
+ /* Field injection elements */
+
+ /**
+ * The name of the field for this reference.
+ *
+ * <p>
+ * If specified and this reference annotates a field, the specified name
+ * must match the name of the annotated field.
+ *
+ * <p>
+ * If not specified, the name of the field is based upon how this annotation
+ * is used:
+ * <ul>
+ * <li>Annotated method - There is no field name.</li>
+ * <li>Annotated field - The name of the annotated field is the name of the
+ * field.</li>
+ * <li>{@link Component#reference()} element - There is no field name.</li>
+ * </ul>
+ *
+ * <p>
+ * If there is a field name, the component must contain a field with that
+ * name.
+ *
+ * @see "The field attribute of the reference element of a Component Description."
+ * @since 1.3
+ */
+ String field() default "";
+
+ /**
+ * The field option for this reference.
+ *
+ * <p>
+ * If not specified, the field option is based upon how this annotation is
+ * used:
+ * <ul>
+ * <li>Annotated method - There is no field option.</li>
+ * <li>Annotated field - The field option is based upon the policy and
+ * cardinality of the reference and the modifiers of the field. If the
+ * policy is {@link ReferencePolicy#DYNAMIC}, the cardinality is
+ * {@link ReferenceCardinality#MULTIPLE 0..n} or
+ * {@link ReferenceCardinality#AT_LEAST_ONE 1..n}, and the field is declared
+ * {@code final}, the field option is {@link FieldOption#UPDATE}. Otherwise,
+ * the field option is {@link FieldOption#REPLACE}</li>
+ * <li>{@link Component#reference()} element - There is no field option.</li>
+ * </ul>
+ *
+ * @see "The field-option attribute of the reference element of a Component Description."
+ * @since 1.3
+ */
+ FieldOption fieldOption() default FieldOption.REPLACE;
}
diff --git a/org/osgi/service/component/annotations/ReferenceScope.java b/org/osgi/service/component/annotations/ReferenceScope.java
new file mode 100644
index 0000000..1ad4425
--- /dev/null
+++ b/org/osgi/service/component/annotations/ReferenceScope.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.annotations;
+
+/**
+ * Reference scope for the {@link Reference} annotation.
+ *
+ * @author $Id: 2a61ef265cfb7a771bd86710e2319a49ae548f3e $
+ * @since 1.3
+ */
+public enum ReferenceScope {
+ /**
+ * A single service object is used for all references to the service in this
+ * bundle.
+ */
+ BUNDLE("bundle"),
+
+ /**
+ * If the bound service has prototype service scope, then each instance of
+ * the component with this reference can receive a unique instance of the
+ * service. If the bound service does not have prototype service scope, then
+ * this reference scope behaves the same as {@link #BUNDLE}.
+ */
+ PROTOTYPE("prototype"),
+
+ /**
+ * Bound services must have prototype service scope. Each instance of the
+ * component with this reference can receive a unique instance of the
+ * service.
+ */
+ PROTOTYPE_REQUIRED("prototype_required");
+
+ private final String value;
+
+ ReferenceScope(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/org/osgi/service/component/annotations/ServiceScope.java b/org/osgi/service/component/annotations/ServiceScope.java
new file mode 100644
index 0000000..aa2c77f
--- /dev/null
+++ b/org/osgi/service/component/annotations/ServiceScope.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2014). 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.service.component.annotations;
+
+/**
+ * Service scope for the {@link Component} annotation.
+ *
+ * @author $Id: 3c43d5feab4f5f8782acd72b0461feab464db2f8 $
+ * @since 1.3
+ */
+public enum ServiceScope {
+ /**
+ * When the component is registered as a service, it must be registered as a
+ * bundle scope service but only a single instance of the component must be
+ * used for all bundles using the service.
+ */
+ SINGLETON("singleton"),
+
+ /**
+ * When the component is registered as a service, it must be registered as a
+ * bundle scope service and an instance of the component must be created for
+ * each bundle using the service.
+ */
+ BUNDLE("bundle"),
+
+ /**
+ * When the component is registered as a service, it must be registered as a
+ * prototype scope service and an instance of the component must be created
+ * for each distinct request for the service.
+ */
+ PROTOTYPE("prototype"),
+
+ /**
+ * Default element value for annotation. This is used to distinguish the
+ * default value for an element and should not otherwise be used.
+ */
+ DEFAULT("<<default>>");
+
+ private final String value;
+
+ ServiceScope(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/org/osgi/service/component/annotations/package-info.java b/org/osgi/service/component/annotations/package-info.java
index 566a59d..8c55c2b 100644
--- a/org/osgi/service/component/annotations/package-info.java
+++ b/org/osgi/service/component/annotations/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2013). 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,15 +15,17 @@
*/
/**
- * Service Component Annotations Package Version 1.2.
+ * Service Component Annotations Package Version 1.3.
*
* <p>
* This package is not used at runtime. Annotated classes are processed by
* tools to generate Component Descriptions which are used at runtime.
*
- * @version 1.2
- * @author $Id: 1c1692cdece9bfcb6aa2ba7992f7ce77d6c0e926 $
+ * @author $Id: bcb93c6d8ba44a16451c4e5455038376b074b914 $
*/
+ at Version("1.3")
package org.osgi.service.component.annotations;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/component/annotations/packageinfo b/org/osgi/service/component/annotations/packageinfo
index ef7df68..0117a56 100644
--- a/org/osgi/service/component/annotations/packageinfo
+++ b/org/osgi/service/component/annotations/packageinfo
@@ -1 +1 @@
-version 1.2
+version 1.3
diff --git a/org/osgi/service/component/package-info.java b/org/osgi/service/component/package-info.java
index fa71e71..010a246 100644
--- a/org/osgi/service/component/package-info.java
+++ b/org/osgi/service/component/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,7 +15,7 @@
*/
/**
- * Service Component Package Version 1.2.
+ * Service Component Package Version 1.3.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.component; version="[1.3,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.component; version="[1.3,1.4)"}
*
- * @version 1.2
- * @author $Id: 7ae23aa9383d8a902f757289733bebef44c41a58 $
+ * @author $Id: 9c158e8fb0f0512b3fbfb759fc06ed54afc0d8b0 $
*/
+ at Version("1.3")
package org.osgi.service.component;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/component/packageinfo b/org/osgi/service/component/packageinfo
index 6ebb891..0117a56 100644
--- a/org/osgi/service/component/packageinfo
+++ b/org/osgi/service/component/packageinfo
@@ -1 +1 @@
-version 1.2.1
+version 1.3
diff --git a/org/osgi/service/component/runtime/ServiceComponentRuntime.java b/org/osgi/service/component/runtime/ServiceComponentRuntime.java
new file mode 100644
index 0000000..d71024c
--- /dev/null
+++ b/org/osgi/service/component/runtime/ServiceComponentRuntime.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.runtime;
+
+import java.util.Collection;
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.Bundle;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+import org.osgi.util.promise.Promise;
+
+/**
+ * The {@code ServiceComponentRuntime} service represents the Declarative
+ * Services actor, known as Service Component Runtime (SCR), that manages the
+ * 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
+ * representation of a declared component description. A
+ * {@link ComponentConfigurationDTO} is a representation of an actual instance
+ * of a declared component description parameterized by component properties.
+ * <p>
+ *
+ * Access to this service requires the
+ * {@code ServicePermission[ServiceComponentRuntime, GET]} permission. It is
+ * intended that only administrative bundles should be granted this permission
+ * to limit access to the potentially intrusive methods provided by this
+ * service.
+ *
+ * @ThreadSafe
+ * @since 1.3
+ * @author $Id: 59760dcd57f2162574cfd0c7f3a393825566e78f $
+ */
+ at ProviderType
+public interface ServiceComponentRuntime {
+
+ /**
+ * Returns the component descriptions declared by the specified active
+ * bundles.
+ *
+ * <p>
+ * Only component descriptions from active bundles are returned. If the
+ * specified bundles have no declared components or are not active, an empty
+ * collection is returned.
+ *
+ * @param bundles The bundles whose declared component descriptions are to
+ * be returned. Specifying no bundles, or the equivalent of an empty
+ * {@code Bundle} array, will return the declared component
+ * descriptions from all active bundles.
+ * @return The declared component descriptions of the specified active
+ * {@code bundles}. An empty collection is returned if there are no
+ * component descriptions for the specified active bundles.
+ */
+ Collection<ComponentDescriptionDTO> getComponentDescriptionDTOs(Bundle... bundles);
+
+ /**
+ * Returns the {@link ComponentDescriptionDTO} declared with the specified name
+ * by the specified bundle.
+ *
+ * <p>
+ * Only component descriptions from active bundles are returned.
+ * {@code null} if no such component is declared by the given {@code bundle}
+ * or the bundle is not active.
+ *
+ * @param bundle The bundle declaring the component description. Must not be
+ * {@code null}.
+ * @param name The name of the component description. Must not be
+ * {@code null}.
+ * @return The declared component description or {@code null} if the
+ * specified bundle is not active or does not declare a component
+ * description with the specified name.
+ */
+ ComponentDescriptionDTO getComponentDescriptionDTO(Bundle bundle, String name);
+
+ /**
+ * Returns the component configurations for the specified component
+ * description.
+ *
+ * @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<ComponentConfigurationDTO> getComponentConfigurationDTOs(ComponentDescriptionDTO description);
+
+ /**
+ * Returns whether the specified component description is currently enabled.
+ *
+ * <p>
+ * The enabled state of a component description is initially set by the
+ * {@link ComponentDescriptionDTO#defaultEnabled enabled} attribute of the
+ * component description.
+ *
+ * @param description The component description. Must not be {@code null}.
+ * @return {@code true} if the specified component description is currently
+ * enabled. Otherwise, {@code false}.
+ * @see #enableComponent(ComponentDescriptionDTO)
+ * @see #disableComponent(ComponentDescriptionDTO)
+ * @see ComponentContext#disableComponent(String)
+ * @see ComponentContext#enableComponent(String)
+ */
+ boolean isComponentEnabled(ComponentDescriptionDTO description);
+
+ /**
+ * 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
+ * activating or deactivating a component configuration, must occur
+ * asynchronously to this method call.
+ *
+ * @param description The component description to enable. Must not be
+ * {@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.
+ * @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
+ * activating or deactivating a component configuration, must occur
+ * asynchronously to this method call.
+ *
+ * @param description The component description to disable. Must not be
+ * {@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.
+ * @see #isComponentEnabled(ComponentDescriptionDTO)
+ */
+ Promise<Void> disableComponent(ComponentDescriptionDTO description);
+}
diff --git a/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java b/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java
new file mode 100644
index 0000000..dc3227d
--- /dev/null
+++ b/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * A representation of an actual instance of a declared component description
+ * parameterized by component properties.
+ *
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: a3e98bbac97a1d79805f9be0ed7f2ae811f112d0 $
+ */
+public class ComponentConfigurationDTO extends DTO {
+ /**
+ * The component configuration is unsatisfied due to a missing required
+ * configuration.
+ */
+ public static final int UNSATISFIED_CONFIGURATION = 1;
+
+ /**
+ * The component configuration is unsatisfied due to an unsatisfied
+ * reference.
+ */
+ public static final int UNSATISFIED_REFERENCE = 2;
+
+ /**
+ * The component configuration is satisfied.
+ *
+ * <p>
+ * Any {@link ComponentDescriptionDTO#serviceInterfaces services} declared
+ * by the component description are registered.
+ */
+ public static final int SATISFIED = 4;
+
+ /**
+ * The component configuration is active.
+ *
+ * <p>
+ * This is the normal operational state of a component configuration.
+ */
+ public static final int ACTIVE = 8;
+
+ /**
+ * The representation of the component configuration's component
+ * description.
+ */
+ public ComponentDescriptionDTO description;
+
+ /**
+ * The current state of the component configuration.
+ *
+ * <p>
+ * This is one of {@link #UNSATISFIED_CONFIGURATION},
+ * {@link #UNSATISFIED_REFERENCE}, {@link #SATISFIED} or {@link #ACTIVE}.
+ */
+ public int state;
+
+ /**
+ * The id of the component configuration.
+ *
+ * <p>
+ * The id is a non-persistent, unique value assigned at runtime. The id is
+ * also available as the {@code component.id} component property. The value
+ * of this field is unspecified if the state of this component configuration
+ * is unsatisfied.
+ */
+ public long id;
+
+ /**
+ * The component properties for the component configuration.
+ *
+ * @see ComponentContext#getProperties()
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The satisfied references.
+ *
+ * <p>
+ * Each {@link SatisfiedReferenceDTO} in the array represents a satisfied
+ * reference of the component configuration. The array must be empty if the
+ * component configuration has no satisfied references.
+ */
+ public SatisfiedReferenceDTO[] satisfiedReferences;
+
+ /**
+ * The unsatisfied references.
+ *
+ * <p>
+ * Each {@link UnsatisfiedReferenceDTO} in the array represents an
+ * unsatisfied reference of the component configuration. The array must be
+ * empty if the component configuration has no unsatisfied references.
+ */
+ public UnsatisfiedReferenceDTO[] unsatisfiedReferences;
+}
diff --git a/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java b/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java
new file mode 100644
index 0000000..8e50ca3
--- /dev/null
+++ b/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.BundleDTO;
+
+/**
+ * A representation of a declared component description.
+ *
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: 9f098a6edef3359b4dbd21e1e58bbad01b89b995 $
+ */
+public class ComponentDescriptionDTO extends DTO {
+ /**
+ * The name of the component.
+ *
+ * <p>
+ * This is declared in the {@code name} attribute of the {@code component}
+ * element. This must be the default name if the component description does
+ * not declare a name.
+ */
+ public String name;
+
+ /**
+ * The bundle declaring the component description.
+ */
+ public BundleDTO bundle;
+
+ /**
+ * The component factory name.
+ *
+ * <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.
+ */
+ public String factory;
+
+ /**
+ * The service scope.
+ *
+ * <p>
+ * This is declared in the {@code scope} attribute of the {@code service}
+ * element. This must be {@code null} if the component description does not
+ * declare any service interfaces.
+ */
+ public String scope;
+
+ /**
+ * The fully qualified name of the implementation class.
+ *
+ * <p>
+ * This is declared in the {@code class} attribute of the
+ * {@code implementation} element.
+ */
+ public String implementationClass;
+
+ /**
+ * The initial enabled state.
+ *
+ * <p>
+ * This is declared in the {@code enabled} attribute of the
+ * {@code component} element.
+ */
+ public boolean defaultEnabled;
+
+ /**
+ * The immediate state.
+ *
+ * <p>
+ * This is declared in the {@code immediate} attribute of the
+ * {@code component} element.
+ */
+ public boolean immediate;
+
+ /**
+ * The fully qualified names of the service interfaces.
+ *
+ * <p>
+ * These are declared in the {@code interface} attribute of the
+ * {@code provide} elements. The array must be empty if the component
+ * description does not declare any service interfaces.
+ */
+ public String[] serviceInterfaces;
+
+ /**
+ * The declared component properties.
+ *
+ * <p>
+ * These are declared in the {@code property} and {@code properties}
+ * elements.
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The referenced services.
+ *
+ * <p>
+ * These are declared in the {@code reference} elements. The array must be
+ * empty if the component description does not declare references to any
+ * services.
+ */
+ public ReferenceDTO[] references;
+
+ /**
+ * The name of the activate method.
+ *
+ * <p>
+ * This is declared in the {@code activate} attribute of the
+ * {@code component} element. This must be {@code null} if the component
+ * description does not declare an activate method name.
+ */
+ public String activate;
+
+ /**
+ * The name of the deactivate method.
+ *
+ * <p>
+ * This is declared in the {@code deactivate} attribute of the
+ * {@code component} element. This must be {@code null} if the component
+ * description does not declare a deactivate method name.
+ */
+ public String deactivate;
+
+ /**
+ * The name of the modified method.
+ *
+ * <p>
+ * This is declared in the {@code modified} attribute of the
+ * {@code component} element. This must be {@code null} if the component
+ * description does not declare a modified method name.
+ */
+ public String modified;
+
+ /**
+ * The configuration policy.
+ *
+ * <p>
+ * This is declared in the {@code configuration-policy} attribute of the
+ * {@code component} element. This must be the default configuration policy
+ * if the component description does not declare a configuration policy.
+ */
+ public String configurationPolicy;
+
+ /**
+ * The configuration pids.
+ *
+ * <p>
+ * These are declared in the {@code configuration-pid} attribute of the
+ * {@code component} element. This must contain the default configuration
+ * pid if the component description does not declare a configuration pid.
+ */
+ public String[] configurationPid;
+}
diff --git a/org/osgi/service/component/runtime/dto/ReferenceDTO.java b/org/osgi/service/component/runtime/dto/ReferenceDTO.java
new file mode 100644
index 0000000..8f7c5b1
--- /dev/null
+++ b/org/osgi/service/component/runtime/dto/ReferenceDTO.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.component.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * A representation of a declared reference to a service.
+ *
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: fca2413271fcded16b4ebe3c6628fe8660e2575e $
+ */
+public class ReferenceDTO extends DTO {
+
+ /**
+ * The name of the reference.
+ *
+ * <p>
+ * This is declared in the {@code name} attribute of the {@code reference}
+ * element. This must be the default name if the component description does
+ * not declare a name for the reference.
+ */
+ public String name;
+
+ /**
+ * The service interface of the reference.
+ *
+ * <p>
+ * This is declared in the {@code interface} attribute of the
+ * {@code reference} element.
+ */
+ public String interfaceName;
+
+ /**
+ * The cardinality of the reference.
+ *
+ * <p>
+ * This is declared in the {@code cardinality} attribute of the
+ * {@code reference} element. This must be the default cardinality if the
+ * component description does not declare a cardinality for the reference.
+ */
+ public String cardinality;
+
+ /**
+ * The policy of the reference.
+ *
+ * <p>
+ * This is declared in the {@code policy} attribute of the {@code reference}
+ * element. This must be the default policy if the component description
+ * does not declare a policy for the reference.
+ */
+ public String policy;
+
+ /**
+ * The policy option of the reference.
+ *
+ * <p>
+ * This is declared in the {@code policy-option} attribute of the
+ * {@code reference} element. This must be the default policy option if the
+ * component description does not declare a policy option for the reference.
+ */
+ public String policyOption;
+
+ /**
+ * The target of the reference.
+ *
+ * <p>
+ * This is declared in the {@code target} attribute of the {@code reference}
+ * element. This must be {@code null} if the component description does not
+ * declare a target for the reference.
+ */
+ public String target;
+
+ /**
+ * The name of the bind method of the reference.
+ *
+ * <p>
+ * This is declared in the {@code bind} attribute of the {@code reference}
+ * element. This must be {@code null} if the component description does not
+ * declare a bind method for the reference.
+ */
+ public String bind;
+
+ /**
+ * The name of the unbind method of the reference.
+ *
+ * <p>
+ * This is declared in the {@code unbind} attribute of the {@code reference}
+ * element. This must be {@code null} if the component description does not
+ * declare an unbind method for the reference.
+ */
+ public String unbind;
+
+ /**
+ * The name of the updated method of the reference.
+ *
+ * <p>
+ * This is declared in the {@code updated} attribute of the
+ * {@code reference} element. This must be {@code null} if the component
+ * description does not declare an updated method for the reference.
+ */
+ public String updated;
+
+ /**
+ * The name of the field of the reference.
+ *
+ * <p>
+ * This is declared in the {@code field} attribute of the {@code reference}
+ * element. This must be {@code null} if the component description does not
+ * declare a field for the reference.
+ */
+ public String field;
+
+ /**
+ * The field option of the reference.
+ *
+ * <p>
+ * This is declared in the {@code field-option} attribute of the
+ * {@code reference} element. This must be {@code null} if the component
+ * description does not declare a field for the reference.
+ */
+ public String fieldOption;
+
+ /**
+ * The scope of the reference.
+ *
+ * <p>
+ * This is declared in the {@code scope} attribute of the {@code reference}
+ * element. This must be the default scope if the component description does
+ * not declare a scope for the reference.
+ */
+ public String scope;
+}
diff --git a/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java b/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java
new file mode 100644
index 0000000..3bfc082
--- /dev/null
+++ b/org/osgi/service/component/runtime/dto/SatisfiedReferenceDTO.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.runtime.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+
+/**
+ * A representation of a satisfied reference.
+ *
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: 20de229ef78ffbfd603b62d4534721e2f2b17922 $
+ */
+public class SatisfiedReferenceDTO extends DTO {
+ /**
+ * The name of the declared reference.
+ *
+ * <p>
+ * This is declared in the {@code name} attribute of the {@code reference}
+ * element of the component description.
+ *
+ * @see ReferenceDTO#name
+ */
+ public String name;
+
+ /**
+ * The target property of the satisfied reference.
+ *
+ * <p>
+ * This is the value of the {@link ComponentConfigurationDTO#properties
+ * component property} whose name is the concatenation of the
+ * {@link ReferenceDTO#name declared reference name} and
+ * ".target". This must be {@code null} if no target property is
+ * set for the reference.
+ */
+ public String target;
+
+ /**
+ * The bound services.
+ *
+ * <p>
+ * Each {@link ServiceReferenceDTO} in the array represents a service bound
+ * to the satisfied reference. The array must be empty if there are no bound
+ * services.
+ */
+ public ServiceReferenceDTO[] boundServices;
+}
diff --git a/org/osgi/service/component/runtime/dto/UnsatisfiedReferenceDTO.java b/org/osgi/service/component/runtime/dto/UnsatisfiedReferenceDTO.java
new file mode 100644
index 0000000..870c5c3
--- /dev/null
+++ b/org/osgi/service/component/runtime/dto/UnsatisfiedReferenceDTO.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.component.runtime.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+
+/**
+ * A representation of an unsatisfied reference.
+ *
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: 20ce77a3dbc307be592c86bf7b5eddacfe77e21b $
+ */
+public class UnsatisfiedReferenceDTO extends DTO {
+ /**
+ * The name of the declared reference.
+ *
+ * <p>
+ * This is declared in the {@code name} attribute of the {@code reference}
+ * element of the component description.
+ *
+ * @see ReferenceDTO#name
+ */
+ public String name;
+
+ /**
+ * The target property of the unsatisfied reference.
+ *
+ * <p>
+ * This is the value of the {@link ComponentConfigurationDTO#properties
+ * component property} whose name is the concatenation of the
+ * {@link ReferenceDTO#name declared reference name} and
+ * ".target". This must be {@code null} if no target property is
+ * set for the reference.
+ */
+ public String target;
+
+ /**
+ * The target services.
+ *
+ * <p>
+ * Each {@link ServiceReferenceDTO} in the array represents a target service
+ * for the reference. The array must be empty if there are no target
+ * services. The upper bound on the number of target services in the array
+ * is the upper bound on the {@link ReferenceDTO#cardinality cardinality} of
+ * the reference.
+ */
+ public ServiceReferenceDTO[] targetServices;
+}
diff --git a/org/osgi/service/component/package-info.java b/org/osgi/service/component/runtime/dto/package-info.java
similarity index 68%
copy from org/osgi/service/component/package-info.java
copy to org/osgi/service/component/runtime/dto/package-info.java
index fa71e71..75c3b78 100644
--- a/org/osgi/service/component/package-info.java
+++ b/org/osgi/service/component/runtime/dto/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014). 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,7 +15,7 @@
*/
/**
- * Service Component Package Version 1.2.
+ * Service Component Runtime Data Transfer Objects Package Version 1.3.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,1.4)"}
*
- * @version 1.2
- * @author $Id: 7ae23aa9383d8a902f757289733bebef44c41a58 $
+ * @author $Id: d7d82da09d67a3ce4274ad8554966c1952a2b4de $
*/
-package org.osgi.service.component;
+ at Version("1.3")
+package org.osgi.service.component.runtime.dto;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/service/event/packageinfo b/org/osgi/service/component/runtime/dto/packageinfo
similarity index 100%
copy from org/osgi/service/event/packageinfo
copy to org/osgi/service/component/runtime/dto/packageinfo
diff --git a/org/osgi/service/component/package-info.java b/org/osgi/service/component/runtime/package-info.java
similarity index 69%
copy from org/osgi/service/component/package-info.java
copy to org/osgi/service/component/runtime/package-info.java
index fa71e71..1dd3488 100644
--- a/org/osgi/service/component/package-info.java
+++ b/org/osgi/service/component/runtime/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2013). 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,7 +15,7 @@
*/
/**
- * Service Component Package Version 1.2.
+ * Service Component Runtime Package Version 1.3.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.component.runtime; version="[1.3,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.component.runtime; version="[1.3,1.4)"}
*
- * @version 1.2
- * @author $Id: 7ae23aa9383d8a902f757289733bebef44c41a58 $
+ * @author $Id: 3d4fa42ce33a4682cbaeee3f094b558e6ea6080f $
*/
-package org.osgi.service.component;
+ at Version("1.3")
+package org.osgi.service.component.runtime;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/service/event/packageinfo b/org/osgi/service/component/runtime/packageinfo
similarity index 100%
copy from org/osgi/service/event/packageinfo
copy to org/osgi/service/component/runtime/packageinfo
diff --git a/org/osgi/service/coordinator/Coordination.java b/org/osgi/service/coordinator/Coordination.java
index d8e6e77..01000a7 100644
--- a/org/osgi/service/coordinator/Coordination.java
+++ b/org/osgi/service/coordinator/Coordination.java
@@ -18,6 +18,7 @@ package org.osgi.service.coordinator;
import java.util.List;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
/**
@@ -62,30 +63,29 @@ import org.osgi.framework.Bundle;
* </pre>
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 67f67b5265cec7f5b33b1bde74cf93b578debcf7 $
+ * @author $Id: 9b7da14f4dac30c9a1cb8b2f411887b0f58de94b $
*/
-
+ at ProviderType
public interface Coordination {
/**
* A singleton exception that will be the failure cause when a Coordination
* times out.
*/
- Exception TIMEOUT = new Exception("TIMEOUT");
+ Exception TIMEOUT = new SingletonException("TIMEOUT");
/**
* A singleton exception that will be the failure cause when the
* Coordinations created by a bundle are terminated because the bundle
* released the Coordinator service.
*/
- Exception RELEASED = new Exception("RELEASED");
+ Exception RELEASED = new SingletonException("RELEASED");
/**
* A singleton exception that will be the failure cause when a Coordination
* has been orphaned.
*/
- Exception ORPHANED = new Exception("ORPHANED");
+ Exception ORPHANED = new SingletonException("ORPHANED");
/**
* Returns the id assigned to this Coordination.
diff --git a/org/osgi/service/coordinator/CoordinationPermission.java b/org/osgi/service/coordinator/CoordinationPermission.java
index 2b2b273..1cde4ce 100644
--- a/org/osgi/service/coordinator/CoordinationPermission.java
+++ b/org/osgi/service/coordinator/CoordinationPermission.java
@@ -47,7 +47,7 @@ import org.osgi.framework.InvalidSyntaxException;
* {@code participate} and {@code admin}.
*
* @ThreadSafe
- * @author $Id: 13aa34eaea5f268a315be475fa8bb7b2718415bd $
+ * @author $Id: 7892b43ca8617d1a0437fc5efe9c6f083ee6bf89 $
*/
public final class CoordinationPermission extends BasicPermission {
@@ -337,6 +337,7 @@ public final class CoordinationPermission extends BasicPermission {
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof CoordinationPermission)) {
return false;
@@ -390,6 +391,7 @@ public final class CoordinationPermission extends BasicPermission {
* @return Canonical string representation of the
* {@code CoordinationPermission} actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -427,6 +429,7 @@ public final class CoordinationPermission extends BasicPermission {
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new CoordinationPermissionCollection();
}
@@ -444,6 +447,7 @@ public final class CoordinationPermission extends BasicPermission {
* and has the same name and actions as this
* {@code CoordinationPermission} object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -463,6 +467,7 @@ public final class CoordinationPermission extends BasicPermission {
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -512,8 +517,8 @@ public final class CoordinationPermission extends BasicPermission {
final Map<String, Object> map = new HashMap<String, Object>(5);
map.put("coordination.name", getName());
if (bundle != null) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
map.put("id", new Long(bundle.getBundleId()));
map.put("location", bundle.getLocation());
String name = bundle.getSymbolicName();
@@ -574,6 +579,7 @@ final class SignerProperty {
* @param o SignerProperty to compare against.
* @return true if the DN name chain matches the pattern.
*/
+ @Override
public boolean equals(Object o) {
if (!(o instanceof SignerProperty))
return false;
@@ -601,6 +607,7 @@ final class SignerProperty {
* Since the equals method does not obey the general equals contract, this
* method cannot generate hash codes which obey the equals contract.
*/
+ @Override
public int hashCode() {
return 31;
}
@@ -664,6 +671,7 @@ final class CoordinationPermissionCollection extends PermissionCollection {
* {@code CoordinationPermissionCollection} object has been marked
* read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof CoordinationPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -709,6 +717,7 @@ final class CoordinationPermissionCollection extends PermissionCollection {
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(final Permission permission) {
if (!(permission instanceof CoordinationPermission)) {
return false;
@@ -752,6 +761,7 @@ final class CoordinationPermissionCollection extends PermissionCollection {
*
* @return Enumeration of all {@code CoordinationPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -769,7 +779,9 @@ final class CoordinationPermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- permissions = (HashMap<String, CoordinationPermission>) gfields.get("permissions", null);
+ @SuppressWarnings("unchecked")
+ HashMap<String, CoordinationPermission> p = (HashMap<String, CoordinationPermission>) gfields.get("permissions", null);
+ permissions = p;
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/org/osgi/service/coordinator/Coordinator.java b/org/osgi/service/coordinator/Coordinator.java
index 06dc86f..6ee1e34 100644
--- a/org/osgi/service/coordinator/Coordinator.java
+++ b/org/osgi/service/coordinator/Coordinator.java
@@ -17,6 +17,7 @@
package org.osgi.service.coordinator;
import java.util.Collection;
+import org.osgi.annotation.versioning.ProviderType;
/**
* A Coordinator service coordinates activities between different parties.
@@ -81,9 +82,9 @@ import java.util.Collection;
* </pre>
*
* @ThreadSafe
- * @noimplement
- * @author $Id: e2e1850c645234dd7a546a2f6a77ba6fc8d3c73b $
+ * @author $Id: f27e3bdcd6e0af5974bb4f57f86f1e3c4bef7aec $
*/
+ at ProviderType
public interface Coordinator {
/**
diff --git a/org/osgi/service/coordinator/Participant.java b/org/osgi/service/coordinator/Participant.java
index 6603ed0..4e4a7b1 100644
--- a/org/osgi/service/coordinator/Participant.java
+++ b/org/osgi/service/coordinator/Participant.java
@@ -16,6 +16,8 @@
package org.osgi.service.coordinator;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A Participant participates in a Coordination.
*
@@ -46,8 +48,9 @@ package org.osgi.service.coordinator;
* returns.
*
* @ThreadSafe
- * @author $Id: 6bef92f858270876b0d23bfb8b797b970bca2a27 $
+ * @author $Id: 7c958674f4263c811c1b24995f6cedee50e75815 $
*/
+ at ConsumerType
public interface Participant {
/**
* Notification that a Coordination has terminated
diff --git a/org/osgi/service/coordinator/SingletonException.java b/org/osgi/service/coordinator/SingletonException.java
new file mode 100644
index 0000000..5b67f54
--- /dev/null
+++ b/org/osgi/service/coordinator/SingletonException.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.coordinator;
+
+/**
+ * Package private singleton exception class.
+ *
+ * @author $Id: 8b838204740f535c63300dfbee69e063a1e14124 $
+ */
+class SingletonException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Create a singleton exception with the specified message and no cause.
+ *
+ * @param message The message for the singleton exception.
+ */
+ public SingletonException(String message) {
+ super(message, null);
+ }
+
+ /**
+ * The stack trace cannot be filled in.
+ *
+ * @return this
+ */
+ @Override
+ public Throwable fillInStackTrace() {
+ return this;
+ }
+
+ /**
+ * The stack trace cannot be set.
+ *
+ * @param stackTrace Must not be {@code null} or contain any {@code null}
+ * elements; otherwise ignored.
+ */
+ @Override
+ public void setStackTrace(StackTraceElement[] stackTrace) {
+ for (StackTraceElement e : stackTrace) {
+ if (e == null) {
+ throw new NullPointerException();
+ }
+ }
+ }
+}
diff --git a/org/osgi/service/coordinator/package-info.java b/org/osgi/service/coordinator/package-info.java
index bb292e3..544f929 100644
--- a/org/osgi/service/coordinator/package-info.java
+++ b/org/osgi/service/coordinator/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.coordinator; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: a386002885af4ee4c783b2005c9ae9fd0c05304b $
+ * @author $Id: 4d74592145700f592bc248c132ab46fb188ce57c $
*/
+ at Version("1.0.2")
package org.osgi.service.coordinator;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/coordinator/packageinfo b/org/osgi/service/coordinator/packageinfo
index b3d1f97..2ac11b7 100644
--- a/org/osgi/service/coordinator/packageinfo
+++ b/org/osgi/service/coordinator/packageinfo
@@ -1 +1 @@
-version 1.0.1
+version 1.0.2
diff --git a/org/osgi/service/deploymentadmin/DeploymentPackage.java b/org/osgi/service/deploymentadmin/DeploymentPackage.java
index eb19639..ca66fa7 100644
--- a/org/osgi/service/deploymentadmin/DeploymentPackage.java
+++ b/org/osgi/service/deploymentadmin/DeploymentPackage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -159,7 +159,7 @@ public interface DeploymentPackage {
* Returns a URL pointing to an image that represents the icon for this
* Deployment Package.
*
- * The {@code DeploymentPackage-Icon} header can set an icon for the the
+ * The {@code DeploymentPackage-Icon} header can set an icon for the
* deployment package. This method returns an absolute URL that is defined
* by this header. The Deployment Admin service must provide this icon as a
* local resource. That is, the Deployment Admin must make a local copy of
diff --git a/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java b/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java
index ab58a87..0d929f6 100644
--- a/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java
+++ b/org/osgi/service/deploymentadmin/spi/DeploymentCustomizerPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -38,8 +38,8 @@ import org.osgi.service.deploymentadmin.DeploymentAdminPermission;
* {@link DeploymentSession}). After the session ends the FilePermissions are
* withdrawn. The Resource Processor will have {@code FilePermission} with
* "read", "write" and "delete" actions for the returned {@link java.io.File}
- * that represents the the base directory of the persistent storage area and for
- * its subdirectories.
+ * that represents the base directory of the persistent storage area and for its
+ * subdirectories.
* <p>
*
* The actions string is converted to lowercase before processing.
diff --git a/org/osgi/service/deploymentadmin/spi/package-info.java b/org/osgi/service/deploymentadmin/spi/package-info.java
index fe4098f..f4f8976 100644
--- a/org/osgi/service/deploymentadmin/spi/package-info.java
+++ b/org/osgi/service/deploymentadmin/spi/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -33,8 +33,8 @@
* <p>
* {@code Import-Package: org.osgi.service.deploymentadmin.spi; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: 393a106a36d0d37d5cdfeabf1c69d79c2640824b $
+ * @version 1.0.1
+ * @author $Id: 2e10a094e20b101049d7f563a26327ef9a37fe3d $
*/
package org.osgi.service.deploymentadmin.spi;
diff --git a/org/osgi/service/dmt/DmtConstants.java b/org/osgi/service/dmt/DmtConstants.java
index 3fd38df..496d2a2 100644
--- a/org/osgi/service/dmt/DmtConstants.java
+++ b/org/osgi/service/dmt/DmtConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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.
@@ -19,7 +19,7 @@ package org.osgi.service.dmt;
/**
* Defines standard names for {@code DmtAdmin}.
*
- * @author $Id: f20702406eba3843afe619eb5fa19c8591dae239 $
+ * @author $Id: 53f8dc08c1dc71bc6415cdb2b82b0cc24a5aa703 $
* @since 2.0
*/
public class DmtConstants {
@@ -39,7 +39,7 @@ public class DmtConstants {
public static final String DDF_SCAFFOLD = "org.osgi/1.0/SCAFFOLD";
/**
- * A string defining a DDF URI, indicating that the node is a MAP node node.
+ * A string defining a DDF URI, indicating that the node is a MAP node.
*/
public static final String DDF_MAP = "org.osgi/1.0/MAP";
diff --git a/org/osgi/service/dmt/DmtException.java b/org/osgi/service/dmt/DmtException.java
index 72f3dea..495350c 100644
--- a/org/osgi/service/dmt/DmtException.java
+++ b/org/osgi/service/dmt/DmtException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -45,7 +45,7 @@ import java.util.Vector;
* parameters, and the {@code printStackTrace(PrintWriter)} method is extended
* to print the stack trace of all causing throwables as well.
*
- * @author $Id: d56c95a49eed00fce7fd6eadb7b6f5c41ae18588 $
+ * @author $Id: 34a69b2b65f7e9455c9f98a0e23113c681b00cea $
*/
public class DmtException extends Exception {
private static final long serialVersionUID = -63006267148118655L;
@@ -552,9 +552,9 @@ public class DmtException extends Exception {
}
/**
- * Prints the exception and its backtrace to the specified print stream. Any
- * causes that were specified for this exception are also printed, together
- * with their backtraces.
+ * Prints the exception and its stacktrace to the specified print stream.
+ * Any causes that were specified for this exception are also printed,
+ * together with their stacktraces.
*
* @param s {@code PrintStream} to use for output
*/
diff --git a/org/osgi/service/dmt/DmtSession.java b/org/osgi/service/dmt/DmtSession.java
index 05be92c..0871e11 100644
--- a/org/osgi/service/dmt/DmtSession.java
+++ b/org/osgi/service/dmt/DmtSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -43,7 +43,7 @@ import java.util.Date;
* invalidated (due to timeout, fatal exceptions, or unexpectedly unregistered
* plugins).
*
- * @author $Id: 8c7d14df8af76b1b07c75690a292aa8ec7b78eb1 $
+ * @author $Id: 8a52c7344f465e2cf9fb68f24c5d46c865501f34 $
*/
public interface DmtSession {
/**
@@ -147,7 +147,7 @@ public interface DmtSession {
* mechanism in the underlying plugins. As an example, if plugin A has
* committed successfully but plugin B failed, the whole session must fail,
* but there is no way to undo the commit performed by A. To provide
- * predictable behaviour, the commit operation should continue with the
+ * predictable behavior, the commit operation should continue with the
* remaining plugins even after detecting a failure. All exceptions received
* from failed commits are aggregated into one {@code TRANSACTION_ERROR}
* exception thrown by this method.
@@ -247,6 +247,7 @@ public interface DmtSession {
* <li> {@code PERMISSION_DENIED} if the session is associated with
* a principal and the ACL of the node does not allow the
* {@code Execute} operation for the associated principal</li><li>
+ * {@code COMMAND_NOT_ALLOWED} if the specified node is a scaffold node</li><li>
* {@code METADATA_MISMATCH} if the node cannot be executed
* according to the meta-data (does not have
* {@code MetaNode.CMD_EXECUTE} access type)</li><li>
@@ -295,6 +296,7 @@ public interface DmtSession {
* <li>{@code PERMISSION_DENIED} if the session is associated with a
* principal and the ACL of the node does not allow the
* {@code Execute} operation for the associated principal</li><li>
+ * {@code COMMAND_NOT_ALLOWED} if the specified node is a scaffold node</li><li>
* {@code METADATA_MISMATCH} if the node cannot be executed
* according to the meta-data (does not have
* {@code MetaNode.CMD_EXECUTE} access type)</li><li>
diff --git a/org/osgi/service/dmt/MetaNode.java b/org/osgi/service/dmt/MetaNode.java
index 683bb53..ca7f243 100644
--- a/org/osgi/service/dmt/MetaNode.java
+++ b/org/osgi/service/dmt/MetaNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -24,7 +24,7 @@ package org.osgi.service.dmt;
* The interface has several types of functions to describe the nodes in the
* DMT. Some methods can be used to retrieve standard OMA DM metadata such as
* access type, cardinality, default, etc., others are for data extensions such
- * as valid names and values. In some cases the standard behaviour has been
+ * as valid names and values. In some cases the standard behavior has been
* extended, for example it is possible to provide several valid MIME types, or
* to differentiate between normal and automatic dynamic nodes.
* <p>
@@ -54,7 +54,7 @@ package org.osgi.service.dmt;
* meta information is not defined for the node or providing this information is
* not supported. Methods of this class do not throw exceptions.
*
- * @author $Id: 257646110da999053cc1cb95d8f07f550794a9a5 $
+ * @author $Id: 37dac4313a4306bbf8eae3f3ba4eda0e4e51f065 $
*/
public interface MetaNode {
@@ -204,7 +204,7 @@ public interface MetaNode {
* Get the maximum allowed value associated with a node of numeric format.
* If no meta-data is provided for a node, there is no upper limit to its
* value. This method is only meaningful if the node has one of the numeric
- * formats: integer, float, or long. format. The returned limit has
+ * formats: integer, float, or long format. The returned limit has
* {@code double} type, as this can be used to denote all numeric limits
* with full precision. The actual maximum should be the largest integer,
* float or long number that does not exceed the returned value.
diff --git a/org/osgi/service/dmt/Uri.java b/org/osgi/service/dmt/Uri.java
index 7f00791..2d0c3cc 100644
--- a/org/osgi/service/dmt/Uri.java
+++ b/org/osgi/service/dmt/Uri.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -48,7 +48,7 @@ import java.util.List;
* anywhere else but in the beginning of a URI.</li>
* </ul>
*
- * @author $Id: 6cc99c9a05cf3d1aa6735bac6e9f1b78cba761ed $
+ * @author $Id: 7ab4cc1cb063d03c00a40ca138697a922905368f $
*/
public final class Uri {
@@ -319,7 +319,7 @@ public final class Uri {
}
/**
- * Decode the node name so that back slash and forward slash are un-escaped
+ * Decode the node name so that back slash and forward slash are unescaped
* from a back slash.
*
* @param nodeName the node name to be decoded
diff --git a/org/osgi/service/dmt/notification/AlertItem.java b/org/osgi/service/dmt/notification/AlertItem.java
index 682c692..5ae99ed 100644
--- a/org/osgi/service/dmt/notification/AlertItem.java
+++ b/org/osgi/service/dmt/notification/AlertItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -16,7 +16,8 @@
package org.osgi.service.dmt.notification;
-import org.osgi.service.dmt.*;
+import org.osgi.service.dmt.DmtData;
+import org.osgi.service.dmt.Uri;
/**
* Immutable data structure carried in an alert (client initiated notification).
@@ -37,7 +38,7 @@ import org.osgi.service.dmt.*;
* format. {@link NotificationService} implementations on other management
* protocols should map these constructs to the underlying protocol.
*
- * @author $Id: 1d9aa0c02d665ba439ee3e4e3fcffdae065b4102 $
+ * @author $Id: 0fe38540d8096d2c0cf4fc5b6da55b133d9cee0f $
*/
public class AlertItem {
@@ -117,8 +118,8 @@ public class AlertItem {
* (returned by {@link #getData()}). There might be no type associated with
* the alert item.
*
- * @return the type type associated with the alert item, or {@code null} if
- * there is no type
+ * @return the type associated with the alert item, or {@code null} if there
+ * is no type
*/
public String getType() {
return type;
diff --git a/org/osgi/service/dmt/notification/NotificationService.java b/org/osgi/service/dmt/notification/NotificationService.java
index 2e86e19..ae99800 100644
--- a/org/osgi/service/dmt/notification/NotificationService.java
+++ b/org/osgi/service/dmt/notification/NotificationService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -20,11 +20,11 @@ import org.osgi.service.dmt.DmtException;
import org.osgi.service.dmt.DmtSession;
/**
- * NotificationService enables sending aynchronous notifications to a management
- * server. The implementation of {@code NotificationService} should register
- * itself in the OSGi service registry as a service.
+ * NotificationService enables sending asynchronous notifications to a
+ * management server. The implementation of {@code NotificationService} should
+ * register itself in the OSGi service registry as a service.
*
- * @author $Id: 26ffdcfc2533479d2d48a1c570be3e67f43073eb $
+ * @author $Id: 29ffa1e003814b8061c8709076a9cd27e149a922 $
*/
public interface NotificationService {
diff --git a/org/osgi/service/dmt/package-info.java b/org/osgi/service/dmt/package-info.java
index 8f5c639..f276435 100644
--- a/org/osgi/service/dmt/package-info.java
+++ b/org/osgi/service/dmt/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -39,8 +39,8 @@
* <p>
* {@code Import-Package: org.osgi.service.dmt; version="[2.0,2.1)"}
*
- * @version 2.0
- * @author $Id: 251fab772a3219261f0a123908d6a2261b52c3d8 $
+ * @version 2.0.1
+ * @author $Id: 3d6c54209b4a08b90d55681f247b5a8f3953223e $
*/
package org.osgi.service.dmt;
diff --git a/org/osgi/service/dmt/security/DmtPermission.java b/org/osgi/service/dmt/security/DmtPermission.java
index 33bc222..4af6d6b 100644
--- a/org/osgi/service/dmt/security/DmtPermission.java
+++ b/org/osgi/service/dmt/security/DmtPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -47,7 +47,7 @@ import org.osgi.service.dmt.Uri;
* </pre>
*
* This means that owner of this permission has Get access on every child node
- * of ./OSGi/bundles. The asterix does not necessarily have to follow a '/'
+ * of ./OSGi/bundles. The asterisk does not necessarily have to follow a '/'
* character. For example the {@code "./OSGi/a*"} target matches the
* {@code ./OSGi/applications} subtree.
* <p>
@@ -57,7 +57,7 @@ import org.osgi.service.dmt.Uri;
* returned by {@link #getActions()} uses the forms defined by the action
* constants.
*
- * @author $Id: 5fc6f3d37c4fac64313f532ad9bd9f07bc48dc39 $
+ * @author $Id: add8bc456d13fd836ff4af4e2dbb49fa3953c81a $
*/
public class DmtPermission extends Permission {
private static final long serialVersionUID = -1910969921419407809L;
@@ -133,7 +133,7 @@ public class DmtPermission extends Permission {
* Since the {@code *} character is itself a valid URI character, it can
* appear as the last character of a valid absolute URI. To distinguish this
* case from using {@code *} as a wildcard, the {@code *} character at the
- * end of the URI must be escaped with the {@code \} charater. For example
+ * end of the URI must be escaped with the {@code \} character. For example
* the URI {@code "./a*"} matches {@code "./a"}, {@code "./aa"},
* {@code "./a/b"} etc. while {@code "./a\*"} matches {@code "./a*"} only.
* <p>
diff --git a/org/osgi/service/dmt/spi/ExecPlugin.java b/org/osgi/service/dmt/spi/ExecPlugin.java
index 1dbffb2..f9795e5 100644
--- a/org/osgi/service/dmt/spi/ExecPlugin.java
+++ b/org/osgi/service/dmt/spi/ExecPlugin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -21,14 +21,14 @@ import org.osgi.service.dmt.DmtSession;
/**
* An implementation of this interface takes the responsibility of handling node
- * execute requests requests in a subtree of the DMT.
+ * execute requests in a subtree of the DMT.
* <p>
* In an OSGi environment such implementations should be registered at the OSGi
* service registry specifying the list of root node URIs in a {@code String}
* array or in case of a single value as {@code String} in the
* {@code execRootURIs} registration parameter.
*
- * @author $Id: b18683f61ddf6b3618719620382983d109ce39ed $
+ * @author $Id: 959b9f9e10f172edcb159af99344f8a8b391d0c3 $
*/
public interface ExecPlugin {
/**
diff --git a/org/osgi/service/dmt/spi/MountPoint.java b/org/osgi/service/dmt/spi/MountPoint.java
index d9ff7a6..364a910 100644
--- a/org/osgi/service/dmt/spi/MountPoint.java
+++ b/org/osgi/service/dmt/spi/MountPoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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.
@@ -24,7 +24,7 @@ import java.util.Dictionary;
* It provides function to get the absolute mounted uri and a shortcut method to
* post events via the DmtAdmin.
*
- * @author $Id: 6d6910e16554d58dfca19741425f6b314091865d $
+ * @author $Id: 61dc84e7afbaa405ee43e4de525d2ec87a264b41 $
* @since 2.0
*/
public interface MountPoint {
@@ -97,7 +97,7 @@ public interface MountPoint {
* permitted. In both cases the value of the events
* {@code EVENT_PROPERTY_NODES} property will be set to an empty
* array.
- * @param newRelativeURIs an array of affected node {@code URI}'s.The value
+ * @param newRelativeURIs an array of affected node {@code URI}'s. The value
* of this parameter determines the value of the event property
* {@code EVENT_PROPERTY_NEW_NODES}. An empty array or {@code null}
* is permitted. In both cases the value of the events
diff --git a/org/osgi/service/dmt/spi/ReadableDataSession.java b/org/osgi/service/dmt/spi/ReadableDataSession.java
index aa83b39..ac6b678 100644
--- a/org/osgi/service/dmt/spi/ReadableDataSession.java
+++ b/org/osgi/service/dmt/spi/ReadableDataSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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.
@@ -29,7 +29,7 @@ import org.osgi.service.dmt.MetaNode;
* interfaces inherit from this interface, some of the method descriptions do
* not apply for an instance that is only a {@code ReadableDataSession}. For
* example, the {@link #close()} method description also contains information
- * about its behaviour when invoked as part of a transactional session.
+ * about its behavior when invoked as part of a transactional session.
* <p>
* The {@code nodePath} parameters appearing in this interface always contain an
* array of path segments identifying a node in the subtree of this plugin. This
@@ -66,7 +66,7 @@ import org.osgi.service.dmt.MetaNode;
* fit into any other category, the {@link DmtException#COMMAND_FAILED} code
* should be used.
*
- * @author $Id: 127f2bfbfa19d4bafbddfb1c8c6b8fb76138ef5f $
+ * @author $Id: 6d3a6a20d1f1f993740ed1ce8387c4c1eaa7e9b3 $
*/
public interface ReadableDataSession {
/**
diff --git a/org/osgi/service/dmt/spi/TransactionalDataSession.java b/org/osgi/service/dmt/spi/TransactionalDataSession.java
index 59f2149..6bfa19a 100644
--- a/org/osgi/service/dmt/spi/TransactionalDataSession.java
+++ b/org/osgi/service/dmt/spi/TransactionalDataSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2015). 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,7 +22,7 @@ import org.osgi.service.dmt.DmtException;
* Provides atomic read-write access to the part of the tree handled by the
* plugin that created this session.
*
- * @author $Id: 14e5b379945c794fbb29c0c369e1f652795cf46a $
+ * @author $Id: d2b1128d31de8dafa562053345252527268c456c $
*/
public interface TransactionalDataSession extends ReadWriteDataSession {
@@ -41,7 +41,7 @@ public interface TransactionalDataSession extends ReadWriteDataSession {
* <p>
* In many cases the tree is not the only way to manage a given part of the
* system. It may happen that while modifying some nodes in an atomic
- * session, the underlying settings are modified parallelly outside the
+ * session, the underlying settings are modified in parallel outside the
* scope of the DMT. If this is detected during commit, an exception with
* the code {@code CONCURRENT_ACCESS} is thrown.
*
diff --git a/org/osgi/service/event/Event.java b/org/osgi/service/event/Event.java
index 94e53f5..777ccb9 100644
--- a/org/osgi/service/event/Event.java
+++ b/org/osgi/service/event/Event.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2014). 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.
@@ -33,7 +33,7 @@ import org.osgi.framework.Filter;
* subscribe to the topic of the event.
*
* @Immutable
- * @author $Id: 3bf75bd699b03fc379fa0e620045936d110f3546 $
+ * @author $Id: fd99f31520f5b39b2b2eaa6a0fd5f743bf0c0615 $
*/
public class Event {
/**
@@ -52,6 +52,9 @@ public class Event {
* @param topic The topic of the event.
* @param properties The event's properties (may be {@code null}). A
* property whose key is not of type {@code String} will be ignored.
+ * If the specified properties is an {@link EventProperties} object,
+ * then it will be directly used. Otherwise, a copy of the specified
+ * properties is made.
* @throws IllegalArgumentException If topic is not a valid topic name.
* @since 1.2
*/
@@ -68,6 +71,7 @@ public class Event {
* @param topic The topic of the event.
* @param properties The event's properties (may be {@code null}). A
* property whose key is not of type {@code String} will be ignored.
+ * A copy of the specified properties is made.
* @throws IllegalArgumentException If topic is not a valid topic name.
*/
public Event(String topic, Dictionary<String, ?> properties) {
@@ -156,6 +160,7 @@ public class Event {
* @return {@code true} if {@code object} is a {@code Event} and is equal to
* this object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object object) {
if (object == this) { // quick test
return true;
@@ -174,6 +179,7 @@ public class Event {
*
* @return An integer which is a hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + topic.hashCode();
h = 31 * h + properties.hashCode();
@@ -185,8 +191,9 @@ public class Event {
*
* @return The string representation of this event.
*/
+ @Override
public String toString() {
- return getClass().getName() + " [topic=" + topic + "]";
+ return getClass().getName() + " [topic=" + topic + "] " + properties.toString();
}
/**
@@ -242,6 +249,7 @@ public class Event {
this.properties = properties;
}
+ @Override
public Enumeration<Object> elements() {
Collection<Object> values = properties.values();
List<Object> result = new ArrayList<Object>(values.size() + 1);
@@ -250,6 +258,7 @@ public class Event {
return Collections.enumeration(result);
}
+ @Override
public Object get(Object key) {
if (EVENT_TOPIC.equals(key)) {
return topic;
@@ -257,10 +266,12 @@ public class Event {
return properties.get(key);
}
+ @Override
public boolean isEmpty() {
return false;
}
+ @Override
public Enumeration<String> keys() {
Collection<String> keys = properties.keySet();
List<String> result = new ArrayList<String>(keys.size() + 1);
@@ -269,14 +280,17 @@ public class Event {
return Collections.enumeration(result);
}
+ @Override
public Object put(String key, Object value) {
throw new UnsupportedOperationException();
}
+ @Override
public Object remove(Object key) {
throw new UnsupportedOperationException();
}
+ @Override
public int size() {
return properties.size() + 1;
}
diff --git a/org/osgi/service/event/EventAdmin.java b/org/osgi/service/event/EventAdmin.java
index e3a299c..e351ccb 100644
--- a/org/osgi/service/event/EventAdmin.java
+++ b/org/osgi/service/event/EventAdmin.java
@@ -16,14 +16,16 @@
package org.osgi.service.event;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* The Event Admin service. Bundles wishing to publish events must obtain the
* Event Admin service and call one of the event delivery methods.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 9a845e5269829c3f713d43391364f6c9097fd342 $
+ * @author $Id: 529f0431b3cb8f682c95107b2b7d0bc255a968dd $
*/
+ at ProviderType
public interface EventAdmin {
/**
* Initiate asynchronous, ordered delivery of an event. This method returns
diff --git a/org/osgi/service/event/EventConstants.java b/org/osgi/service/event/EventConstants.java
index c14bc38..24153fb 100644
--- a/org/osgi/service/event/EventConstants.java
+++ b/org/osgi/service/event/EventConstants.java
@@ -16,6 +16,7 @@
package org.osgi.service.event;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.Filter;
@@ -25,9 +26,9 @@ import org.osgi.framework.Version;
/**
* Defines standard names for {@code EventHandler} properties.
*
- * @noimplement
- * @author $Id: 2d17e377cae498017ad739d27ff6972357e50ee3 $
+ * @author $Id: d002775d379d8da871d588ce6a6591e9089c3d09 $
*/
+ at ProviderType
public interface EventConstants {
/**
diff --git a/org/osgi/service/event/EventHandler.java b/org/osgi/service/event/EventHandler.java
index 7daf089..acbeb41 100644
--- a/org/osgi/service/event/EventHandler.java
+++ b/org/osgi/service/event/EventHandler.java
@@ -16,6 +16,8 @@
package org.osgi.service.event;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Listener for Events.
*
@@ -56,8 +58,9 @@ package org.osgi.service.event;
* @see Event
*
* @ThreadSafe
- * @author $Id: 44528634004c1b036551712f94703a8b5a55cba4 $
+ * @author $Id: 996c63cec877a390c66a1602fd706c3a1ba66df9 $
*/
+ at ConsumerType
public interface EventHandler {
/**
* Called by the {@link EventAdmin} service to notify the listener of an
diff --git a/org/osgi/service/event/EventProperties.java b/org/osgi/service/event/EventProperties.java
index 55e365f..fd28e78 100644
--- a/org/osgi/service/event/EventProperties.java
+++ b/org/osgi/service/event/EventProperties.java
@@ -42,7 +42,7 @@ import java.util.Set;
*
* @Immutable
* @since 1.3
- * @author $Id: 8e4c47e16aca69e725321223fcd388ee7e3ee7ba $
+ * @author $Id: 548895a006a37a393ae418947e62d179b0b777b3 $
*/
public class EventProperties implements Map<String, Object> {
/**
@@ -227,6 +227,7 @@ public class EventProperties implements Map<String, Object> {
* @return {@code true} if {@code object} is a {@code EventProperties} and
* is equal to this object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object object) {
if (this == object) {
return true;
@@ -243,6 +244,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return An integer which is a hash code value for this object.
*/
+ @Override
public int hashCode() {
return properties.hashCode();
}
@@ -252,6 +254,7 @@ public class EventProperties implements Map<String, Object> {
*
* @return The string representation of this object.
*/
+ @Override
public String toString() {
return properties.toString();
}
diff --git a/org/osgi/service/event/TopicPermission.java b/org/osgi/service/event/TopicPermission.java
index b1b7cb7..57dbf18 100644
--- a/org/osgi/service/event/TopicPermission.java
+++ b/org/osgi/service/event/TopicPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -47,7 +47,7 @@ import java.util.Map;
* {@code subscribe}.
*
* @ThreadSafe
- * @author $Id: f20bc549a406856113998df2068c0fb3e8c0be88 $
+ * @author $Id: dbe0829e70f9bc9d24550eb49e3ef436f118a4bc $
*/
public final class TopicPermission extends Permission {
static final long serialVersionUID = -5855563886961618300L;
@@ -81,7 +81,7 @@ public final class TopicPermission extends Permission {
private volatile String actions = null;
/**
- * Defines the authority to publich and/or subscribe to a topic within the
+ * Defines the authority to publish and/or subscribe to a topic within the
* EventAdmin service.
* <p>
* The name is specified as a slash-separated string. Wildcards may be used.
@@ -256,6 +256,7 @@ public final class TopicPermission extends Permission {
* @return {@code true} if the specified {@code TopicPermission} action is
* implied by this object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (p instanceof TopicPermission) {
TopicPermission requested = (TopicPermission) p;
@@ -284,6 +285,7 @@ public final class TopicPermission extends Permission {
* @return Canonical string representation of the {@code TopicPermission}
* actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -310,6 +312,7 @@ public final class TopicPermission extends Permission {
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new TopicPermissionCollection();
}
@@ -326,6 +329,7 @@ public final class TopicPermission extends Permission {
* the same topic name and actions as this {@code TopicPermission}
* object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -342,6 +346,7 @@ public final class TopicPermission extends Permission {
*
* @return A hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -416,6 +421,7 @@ final class TopicPermissionCollection extends PermissionCollection {
* @throws SecurityException If this {@code TopicPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof TopicPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -454,6 +460,7 @@ final class TopicPermissionCollection extends PermissionCollection {
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(final Permission permission) {
if (!(permission instanceof TopicPermission)) {
return false;
@@ -514,6 +521,7 @@ final class TopicPermissionCollection extends PermissionCollection {
*
* @return Enumeration of all {@code TopicPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -532,6 +540,7 @@ final class TopicPermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
Hashtable<String, TopicPermission> hashtable = (Hashtable<String, TopicPermission>) gfields.get("permissions", null);
permissions = new HashMap<String, TopicPermission>(hashtable);
all_allowed = gfields.get("all_allowed", false);
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/event/package-info.java
index 68f2821..582b1e5 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/event/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2014). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: 90332d68d6f984f3e4be6bd0dc19dd36059d9258 $
*/
+ at Version("1.3.1")
package org.osgi.service.event;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/event/packageinfo b/org/osgi/service/event/packageinfo
index 0117a56..6435862 100644
--- a/org/osgi/service/event/packageinfo
+++ b/org/osgi/service/event/packageinfo
@@ -1 +1 @@
-version 1.3
+version 1.3.1
diff --git a/org/osgi/service/http/HttpContext.java b/org/osgi/service/http/HttpContext.java
index c59b24d..d376e24 100644
--- a/org/osgi/service/http/HttpContext.java
+++ b/org/osgi/service/http/HttpContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2014). 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,19 +22,37 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
- * This interface defines methods that the Http Service may call to get
- * information about a registration.
+ * Context for HTTP Requests.
*
* <p>
- * Servlets and resources may be registered with an {@code HttpContext} object;
- * if no {@code HttpContext} object is specified, a default {@code HttpContext}
- * object is used. Servlets that are registered using the same
- * {@code HttpContext} object will share the same {@code ServletContext} object.
+ * This service defines methods that the Http Service may call to get
+ * information for a request.
*
* <p>
- * This interface is implemented by users of the {@code HttpService}.
+ * Servlets may be associated with an {@code HttpContext} service. Servlets that
+ * are associated using the same {@code HttpContext} object will share the same
+ * {@code ServletContext} object.
*
- * @author $Id: d8c0c4b76891e6be64354967fc984b407bc970ef $
+ * <p>
+ * If no {@code HttpContext} service is associated, a default
+ * {@code HttpContext} is used. The behavior of the methods on the default
+ * {@code HttpContext} is defined as follows:
+ * <ul>
+ * <li>{@code getMimeType} - Does not define any customized MIME types for the
+ * {@code Content-Type} header in the response, and always returns {@code null}.
+ * </li>
+ * <li>{@code handleSecurity} - Performs implementation-defined authentication
+ * on the request.</li>
+ * <li>{@code getResource} - Assumes the named resource is in the bundle of the
+ * servlet service. This method calls the servlet bundle's
+ * {@code Bundle.getResource} method, and returns the appropriate URL to access
+ * the resource. On a Java runtime environment that supports permissions, the
+ * Http Service needs to be granted
+ * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * </ul>
+ *
+ *
+ * @author $Id: 5b4612284fec298a580e76da4ed9ec6297caec51 $
*/
public interface HttpContext {
/**
@@ -114,8 +132,8 @@ public interface HttpContext {
* {@code getAuthType} and {@code getRemoteUser} methods, respectively, on
* the request.
*
- * @param request the HTTP request
- * @param response the HTTP response
+ * @param request The HTTP request.
+ * @param response The HTTP response.
* @return {@code true} if the request should be serviced, {@code false} if
* the request should not be serviced and Http Service will send the
* response back to the client.
@@ -147,16 +165,17 @@ public interface HttpContext {
/**
* Maps a name to a MIME type.
*
- * Called by the Http Service to determine the MIME type for the name. For
- * servlet registrations, the Http Service will call this method to support
- * the {@code ServletContext} method {@code getMimeType}. For resource
- * registrations, the Http Service will call this method to determine the
- * MIME type for the Content-Type header in the response.
+ * <p>
+ * Called by the Http Service to determine the MIME type for the specified
+ * name. For servlets, the Http Service will call this method to support the
+ * {@code ServletContext} method {@code getMimeType}. For resources, the
+ * Http Service will call this method to determine the MIME type for the
+ * {@code Content-Type} header in the response.
*
- * @param name determine the MIME type for this name.
- * @return MIME type (e.g. text/html) of the name or {@code null} to
- * indicate that the Http Service should determine the MIME type
- * itself.
+ * @param name The name for which to determine the MIME type.
+ * @return The MIME type (e.g. text/html) of the specified name or
+ * {@code null} to indicate that the Http Service should determine
+ * the MIME type itself.
*/
public String getMimeType(String name);
}
diff --git a/org/osgi/service/http/context/ServletContextHelper.java b/org/osgi/service/http/context/ServletContextHelper.java
new file mode 100644
index 0000000..b322e5f
--- /dev/null
+++ b/org/osgi/service/http/context/ServletContextHelper.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright (c) OSGi Alliance (2000, 2015). 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.service.http.context;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.osgi.annotation.versioning.ConsumerType;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
+
+/**
+ * Helper service for a servlet context used by a Http Whiteboard implementation
+ * to serve HTTP requests.
+ *
+ * <p>
+ * This service defines methods that the Http Whiteboard implementation may call
+ * to get information for a request when dealing with whiteboard services.
+ *
+ * <p>
+ * Each {@code ServletContextHelper} is registered with a
+ * {@link HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME
+ * "osgi.http.whiteboard.context.name"} service property containing a name to
+ * reference by servlets, servlet filters, resources, and listeners. If there is
+ * more than one {@code ServletContextHelper} registered with the same context
+ * name, the one with the highest service ranking is active, the others are
+ * inactive.
+ *
+ * <p>
+ * A context is registered with the
+ * {@link HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH
+ * "osgi.http.whiteboard.context.path"} service property to define a path under
+ * which all services registered with this context are reachable. If there is
+ * more than one {@code ServletContextHelper} registered with the same path,
+ * each duplicate context path is searched by service ranking order according to
+ * {@link org.osgi.framework.ServiceReference#compareTo(Object)} until a
+ * matching servlet or resource is found.
+ *
+ * <p>
+ * Servlets, servlet filters, resources, and listeners services may be
+ * associated with a {@code ServletContextHelper} service with the
+ * {@link HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_SELECT
+ * "osgi.http.whiteboard.context.select"} service property. If the referenced
+ * {@code ServletContextHelper} service does not exist or is currently not
+ * active, the whiteboard services for that {@code ServletContextHelper} are not
+ * active either.
+ *
+ * <p>
+ * If no {@code ServletContextHelper} service is associated, that is no
+ * {@link HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_SELECT
+ * "osgi.http.whiteboard.context.select"} service property is configured for a
+ * whiteboard service, a default {@code ServletContextHelper} is used.
+ *
+ * <p>
+ * Those whiteboard services that are associated with the same
+ * {@code ServletContextHelper} object will share the same
+ * {@code ServletContext} object.
+ *
+ * <p>
+ * The behavior of the methods on the default {@code ServletContextHelper} is
+ * defined as follows:
+ * <ul>
+ * <li>{@link #getMimeType(String) getMimeType} - Always returns {@code null}.</li>
+ * <li>{@link #handleSecurity(HttpServletRequest, HttpServletResponse)
+ * handleSecurity} - Always returns {@code true}.</li>
+ * <li>{@link #getResource(String) getResource} - Assumes the named resource is
+ * in the bundle of the whiteboard service, addressed from the root. This method
+ * calls the whiteboard service bundle's {@code Bundle.getEntry} method, and
+ * returns the appropriate URL to access the resource. On a Java runtime
+ * environment that supports permissions, the Http Whiteboard implementation
+ * needs to be granted {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * <li>{@link #getResourcePaths(String) getResourcePaths} - Assumes that the
+ * resources are in the bundle of the whiteboard service. This method calls
+ * {@code Bundle.findEntries} method, and returns the found entries. On a Java
+ * runtime environment that supports permissions, the Http Whiteboard
+ * implementation needs to be granted
+ * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.</li>
+ * <li>{@link #getRealPath(String) getRealPath} - Always returns {@code null}.</li>
+ * </ul>
+ *
+ * @ThreadSafe
+ * @author $Id: 9e6f2e833fda12929a871ac5aebdcf0a5658b007 $
+ * @see HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH
+ */
+ at ConsumerType
+public abstract class ServletContextHelper {
+ /**
+ * {@code HttpServletRequest} attribute specifying the name of the
+ * authenticated user. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getRemoteUser}.
+ */
+ public static final String REMOTE_USER = "org.osgi.service.http.authentication.remote.user";
+ /**
+ * {@code HttpServletRequest} attribute specifying the scheme used in
+ * authentication. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getAuthType}.
+ */
+ public static final String AUTHENTICATION_TYPE = "org.osgi.service.http.authentication.type";
+ /**
+ * {@code HttpServletRequest} attribute specifying the {@code Authorization}
+ * object obtained from the {@code org.osgi.service.useradmin.UserAdmin}
+ * service. The value of the attribute can be retrieved by
+ * {@code HttpServletRequest.getAttribute(ServletContextHelper.AUTHORIZATION)}
+ * .
+ */
+ public static final String AUTHORIZATION = "org.osgi.service.useradmin.authorization";
+
+ /** Bundle associated with this context. */
+ private final Bundle bundle;
+
+ /**
+ * Construct a new context helper.
+ *
+ * <p>
+ * If needed, the subclass will have to handle the association with a
+ * specific bundle.
+ */
+ public ServletContextHelper() {
+ this(null);
+ }
+
+ /**
+ * Construct a new context helper associated with the specified bundle.
+ *
+ * @param bundle The bundle to be associated with this context helper.
+ */
+ public ServletContextHelper(final Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ /**
+ * Handles security for the specified request.
+ *
+ * <p>
+ * The Http Whiteboard implementation calls this method prior to servicing
+ * the specified request. This method controls whether the request is
+ * processed in the normal manner or an error is returned.
+ *
+ * <p>
+ * If the request requires authentication and the {@code Authorization}
+ * header in the request is missing or not acceptable, then this method
+ * should set the {@code WWW-Authenticate} header in the response object,
+ * set the status in the response object to Unauthorized(401) and return
+ * {@code false}. See also <a href="http://www.ietf.org/rfc/rfc2617.txt">RFC
+ * 2617: HTTP Authentication: Basic and Digest Access Authentication</a>.
+ *
+ * <p>
+ * If the request requires a secure connection and the {@code getScheme}
+ * method in the request does not return 'https' or some other acceptable
+ * secure protocol, then this method should set the status in the response
+ * object to Forbidden(403) and return {@code false}.
+ *
+ * <p>
+ * When this method returns {@code false}, the Http Whiteboard
+ * implementation will send the response back to the client, thereby
+ * completing the request. When this method returns {@code true}, the Http
+ * Whiteboard implementation will proceed with servicing the request.
+ *
+ * <p>
+ * If the specified request has been authenticated, this method must set the
+ * {@link #AUTHENTICATION_TYPE} request attribute to the type of
+ * authentication used, and the {@link #REMOTE_USER} request attribute to
+ * the remote user (request attributes are set using the
+ * {@code setAttribute} method on the request). If this method does not
+ * perform any authentication, it must not set these attributes.
+ *
+ * <p>
+ * If the authenticated user is also authorized to access certain resources,
+ * this method must set the {@link #AUTHORIZATION} request attribute to the
+ * {@code Authorization} object obtained from the
+ * {@code org.osgi.service.useradmin.UserAdmin} service.
+ *
+ * <p>
+ * The servlet responsible for servicing the specified request determines
+ * the authentication type and remote user by calling the
+ * {@code getAuthType} and {@code getRemoteUser} methods, respectively, on
+ * the request.
+ *
+ * @param request The HTTP request.
+ * @param response The HTTP response.
+ * @return {@code true} if the request should be serviced, {@code false} if
+ * the request should not be serviced and Http Whiteboard
+ * implementation will send the response back to the client.
+ * @throws java.io.IOException May be thrown by this method. If this occurs,
+ * the Http Whiteboard implementation will terminate the request and
+ * close the socket.
+ */
+ public boolean handleSecurity(final HttpServletRequest request,
+ final HttpServletResponse response)
+ throws IOException {
+ return true;
+ }
+
+ /**
+ * Maps a resource name to a URL.
+ *
+ * <p>
+ * Called by the Http Whiteboard implementation to map the specified
+ * resource name to a URL. For servlets, the Http Whiteboard implementation
+ * will call this method to support the {@code ServletContext} methods
+ * {@code getResource} and {@code getResourceAsStream}. For resources, the
+ * Http Whiteboard implementation will call this method to locate the named
+ * resource.
+ *
+ * <p>
+ * The context can control from where resources come. For example, the
+ * resource can be mapped to a file in the bundle's persistent storage area
+ * via {@code BundleContext.getDataFile(name).toURI().toURL()} or to a
+ * resource in the context's bundle via {@code getClass().getResource(name)}
+ *
+ * @param name The name of the requested resource.
+ * @return A URL that a Http Whiteboard implementation can use to read the
+ * resource or {@code null} if the resource does not exist.
+ */
+ public URL getResource(String name) {
+ if ((name != null) && (bundle != null)) {
+ if (name.startsWith("/")) {
+ name = name.substring(1);
+ }
+
+ return bundle.getEntry(name);
+ }
+ return null;
+ }
+
+ /**
+ * Maps a name to a MIME type.
+ *
+ * <p>
+ * Called by the Http Whiteboard implementation to determine the MIME type
+ * for the specified name. For whiteboard services, the Http Whiteboard
+ * implementation will call this method to support the
+ * {@code ServletContext} method {@code getMimeType}. For resource servlets,
+ * the Http Whiteboard implementation will call this method to determine the
+ * MIME type for the {@code Content-Type} header in the response.
+ *
+ * @param name The name for which to determine the MIME type.
+ * @return The MIME type (e.g. text/html) of the specified name or
+ * {@code null} to indicate that the Http Whiteboard implementation
+ * should determine the MIME type itself.
+ */
+ public String getMimeType(final String name) {
+ return null;
+ }
+
+ /**
+ * Returns a directory-like listing of all the paths to resources within the
+ * web application whose longest sub-path matches the supplied path
+ * argument.
+ *
+ * <p>
+ * Called by the Http Whiteboard implementation to support the
+ * {@code ServletContext} method {@code getResourcePaths} for whiteboard
+ * services.
+ *
+ * @param path The partial path used to match the resources, which must
+ * start with a /.
+ * @return A Set containing the directory listing, or {@code null} if there
+ * are no resources in the web application whose path begins with
+ * the supplied path.
+ */
+ public Set<String> getResourcePaths(final String path) {
+ if ((path != null) && (bundle != null)) {
+ final Enumeration<URL> e = bundle.findEntries(path, null, false);
+ if (e != null) {
+ final Set<String> result = new LinkedHashSet<String>();
+ while (e.hasMoreElements()) {
+ result.add(e.nextElement().getPath());
+ }
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the real path corresponding to the given virtual path.
+ *
+ * <p>
+ * Called by the Http Whiteboard implementation to support the
+ * {@code ServletContext} method {@code getRealPath} for whiteboard
+ * services.
+ *
+ * @param path The virtual path to be translated to a real path.
+ * @return The real path, or {@code null} if the translation cannot be
+ * performed.
+ */
+ public String getRealPath(final String path) {
+ return null;
+ }
+}
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/http/context/package-info.java
similarity index 70%
copy from org/osgi/service/event/package-info.java
copy to org/osgi/service/http/context/package-info.java
index 68f2821..51f4ddd 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/http/context/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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,7 +15,7 @@
*/
/**
- * Event Admin Package Version 1.3.
+ * Http Whiteboard Context Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,1.1)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: b6795f2687019412714e6e734cc44cbc564f566a $
*/
-package org.osgi.service.event;
+ at Version("1.0")
+package org.osgi.service.http.context;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/http/context/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/http/context/packageinfo
diff --git a/org/osgi/service/http/package-info.java b/org/osgi/service/http/package-info.java
index 7a777b2..2ed676e 100644
--- a/org/osgi/service/http/package-info.java
+++ b/org/osgi/service/http/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,8 +32,8 @@
* <p>
* {@code Import-Package: org.osgi.service.http; version="[1.2,1.3)"}
*
- * @version 1.2
- * @author $Id: 84960f4f32b8d9c064e48d55366bc40e0f359657 $
+ * @version 1.2.1
+ * @author $Id: 349de707c066c9b515005332b73ea1e30ee62d07 $
*/
package org.osgi.service.http;
diff --git a/org/osgi/service/http/runtime/HttpServiceRuntime.java b/org/osgi/service/http/runtime/HttpServiceRuntime.java
new file mode 100644
index 0000000..d724de5
--- /dev/null
+++ b/org/osgi/service/http/runtime/HttpServiceRuntime.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.runtime;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.service.http.runtime.dto.RequestInfoDTO;
+import org.osgi.service.http.runtime.dto.RuntimeDTO;
+
+/**
+ * The HttpServiceRuntime service represents the runtime information of an Http
+ * Whiteboard implementation.
+ *
+ * <p>
+ * It provides access to DTOs representing the current state of the service.
+ * <p>
+ * The HttpServiceRuntime service must be registered with the
+ * {@link HttpServiceRuntimeConstants#HTTP_SERVICE_ENDPOINT} service
+ * property.
+ *
+ * @ThreadSafe
+ * @author $Id: 09d6cb78e28a702cd213eec8aca9115f9c21e235 $
+ */
+ at ProviderType
+public interface HttpServiceRuntime {
+
+ /**
+ * Return the runtime DTO representing the current state.
+ *
+ * @return The runtime DTO.
+ */
+ public RuntimeDTO getRuntimeDTO();
+
+ /**
+ * Return a request info DTO containing the services involved with
+ * processing a request for the specified path.
+ *
+ * @param path The request path, relative to the root of the Http Whiteboard
+ * implementation.
+ * @return The request info DTO for the specified path.
+ */
+ public RequestInfoDTO calculateRequestInfoDTO(String path);
+}
diff --git a/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java b/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java
new file mode 100644
index 0000000..14e9143
--- /dev/null
+++ b/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.runtime;
+
+/**
+ * Defines standard names for Http Runtime Service constants.
+ *
+ * @author $Id: 264c3ae61bad6b31f6d1349c721193bbad07e582 $
+ */
+public final class HttpServiceRuntimeConstants {
+ private HttpServiceRuntimeConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * Http Runtime Service service property specifying the endpoints upon which
+ * the Http Whiteboard implementation is listening.
+ *
+ * <p>
+ * An endpoint value is a URL or a relative path, to which the Http
+ * Whiteboard implementation is listening. For example,
+ * {@code http://192.168.1.10:8080/} or {@code /myapp/}. A relative path may
+ * be used if the scheme and authority parts of the URL are not known, e.g.
+ * in a bridged Http Whiteboard implementation. If the Http Whiteboard
+ * implementation is serving the root context and neither scheme nor
+ * authority is known, the value of the property is "/". Both, a URL and a
+ * relative path, must end with a slash.
+ * <p>
+ * An Http Whiteboard implementation can be listening on multiple endpoints.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_SERVICE_ENDPOINT = "osgi.http.endpoint";
+
+ /**
+ * Http Runtime Service service property to associate the Http Runtime
+ * Service with one or more HttpService services.
+ *
+ * <p>
+ * If this Http Whiteboard implementation also implements the Http Service
+ * Specification, this service property is set to a collection of
+ * {@code service.id} for the {@code HttpService} services registered by
+ * this implementation.
+ *
+ * <p>
+ * The value of this service property must be of type
+ * {@code Collection<Long>}.
+ */
+ public static final String HTTP_SERVICE_ID = "osgi.http.service.id";
+}
diff --git a/org/osgi/service/http/runtime/dto/BaseServletDTO.java b/org/osgi/service/http/runtime/dto/BaseServletDTO.java
new file mode 100644
index 0000000..3331d14
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/BaseServletDTO.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents common information about a {@code javax.servlet.Servlet} service.
+ *
+ * @NotThreadSafe
+ * @author $Id: 1bca590bf82ec4cfb6613b2a2475544f2ec1e980 $
+ */
+public abstract class BaseServletDTO extends DTO {
+ /**
+ * The name of the servlet. This value is never {@code null}.
+ */
+ public String name;
+
+ /**
+ * The information string from the servlet.
+ * <p>
+ * This is the value returned by the {@code Servlet.getServletInfo()}
+ * method.
+ */
+ public String servletInfo;
+
+ /**
+ * Specifies whether the servlet supports asynchronous processing.
+ */
+ public boolean asyncSupported;
+
+ /**
+ * The servlet initialization parameters as provided during registration of
+ * the servlet. Additional parameters like the Http Service Runtime
+ * attributes are not included. If the service has no initialization
+ * parameters, the map is empty.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * The service id of the servlet context for the servlet represented by this
+ * DTO.
+ */
+ public long servletContextId;
+
+ /**
+ * Service property identifying the servlet. In the case of a servlet
+ * registered in the service registry and picked up by a Http Whiteboard
+ * Implementation, this value is not negative and corresponds to the service
+ * id in the registry. If the servlet has not been registered in the service
+ * registry, the value is negative and a unique negative value is generated
+ * by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+}
diff --git a/org/osgi/service/http/runtime/dto/DTOConstants.java b/org/osgi/service/http/runtime/dto/DTOConstants.java
new file mode 100644
index 0000000..52e5fed
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/DTOConstants.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.runtime.dto;
+
+/**
+ * Defines standard constants for the DTOs.
+ */
+public final class DTOConstants {
+ private DTOConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * Failure reason is unknown.
+ */
+ public static final int FAILURE_REASON_UNKNOWN = 0;
+
+ /**
+ * No matching {@code ServletContextHelper}.
+ **/
+ public static final int FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING = 1;
+
+ /**
+ * Matching {@code ServletContextHelper}, but the context is not used due to
+ * a problem with the context.
+ */
+ public static final int FAILURE_REASON_SERVLET_CONTEXT_FAILURE = 2;
+
+ /**
+ * Service is shadowed by another service.
+ * <p>
+ * For example, a service with the same service properties but a higher
+ * service ranking.
+ */
+ public static final int FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE = 3;
+
+ /**
+ * An exception occurred during initializing of the service.
+ * <p>
+ * This reason can only happen for servlets and servlet filters.
+ */
+ public static final int FAILURE_REASON_EXCEPTION_ON_INIT = 4;
+
+ /**
+ * The service is registered in the service registry but getting the service
+ * fails as it returns {@code null}.
+ */
+ public static final int FAILURE_REASON_SERVICE_NOT_GETTABLE = 5;
+
+ /**
+ * The service is registered in the service registry but the service
+ * properties are invalid.
+ */
+ public static final int FAILURE_REASON_VALIDATION_FAILED = 6;
+
+ /**
+ * The service is not registered as a prototype scoped service and is
+ * already in use with a servlet context and therefore can't be used with
+ * another servlet context.
+ */
+ public static final int FAILURE_REASON_SERVICE_IN_USE = 7;
+}
diff --git a/org/osgi/service/blueprint/reflect/NullMetadata.java b/org/osgi/service/http/runtime/dto/ErrorPageDTO.java
similarity index 50%
copy from org/osgi/service/blueprint/reflect/NullMetadata.java
copy to org/osgi/service/http/runtime/dto/ErrorPageDTO.java
index f39ef7d..1fc8682 100644
--- a/org/osgi/service/blueprint/reflect/NullMetadata.java
+++ b/org/osgi/service/http/runtime/dto/ErrorPageDTO.java
@@ -1,6 +1,6 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2012, 2014). 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
@@ -14,21 +14,25 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
+package org.osgi.service.http.runtime.dto;
/**
- * Metadata for a value specified to be {@code null} via the <null>
- * element.
- *
- * @ThreadSafe
- * @author $Id: a77a51450e907a2160d116af1bcba04efda6c05b $
+ * Represents a {@code javax.servlet.Servlet} for handling errors and currently
+ * being used by a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 80437fba4d7a9afa4e8aefb92fb5e60df06c2c3c $
*/
-public interface NullMetadata extends Metadata {
+public class ErrorPageDTO extends BaseServletDTO {
+ /**
+ * The exceptions the error page is used for. This array might be
+ * empty.
+ */
+ public String[] exceptions;
/**
- * Singleton instance of {@code NullMetadata}.
+ * The error codes the error page is used for. This array might be
+ * empty.
*/
- static final NullMetadata NULL = new NullMetadata() {
- // empty body
- };
+ public long[] errorCodes;
}
diff --git a/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java b/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java
new file mode 100644
index 0000000..53f0a41
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.Servlet} service registered as an error
+ * page but currently not being used by a servlet context due to a problem.
+ * <p>
+ * As the servlet represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing {@code ServletContextHelper}.
+ *
+ * @NotThreadSafe
+ * @author $Id: ac6a6c0be11a9fd8fb88ff9b1ff2673d88ea19a2 $
+ */
+public class FailedErrorPageDTO extends ErrorPageDTO {
+
+ /**
+ * The reason why the servlet represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/org/osgi/service/http/runtime/dto/FailedFilterDTO.java b/org/osgi/service/http/runtime/dto/FailedFilterDTO.java
new file mode 100644
index 0000000..76fa564
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedFilterDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a servlet {@code Filter} service which is currently not being used
+ * by a servlet context due to a problem.
+ * <p>
+ * As the service represented by this DTO is not used due to a failure, the
+ * field {@link FailedFilterDTO#servletContextId} always returns {@code 0} and
+ * does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: e1016e9e398c63bd029922cbf562c8f0e935489f $
+ */
+public class FailedFilterDTO extends FilterDTO {
+
+ /**
+ * The reason why the servlet filter represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/org/osgi/service/http/runtime/dto/FailedListenerDTO.java b/org/osgi/service/http/runtime/dto/FailedListenerDTO.java
new file mode 100644
index 0000000..db03527
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedListenerDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a listener service which is currently not being used by a servlet
+ * context due to a problem.
+ * <p>
+ * As the listener represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 5e2130cba40664c54b4b8d0915bad2676e512abe $
+ */
+public class FailedListenerDTO extends ListenerDTO {
+
+ /**
+ * The reason why the listener represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/org/osgi/service/http/runtime/dto/FailedResourceDTO.java b/org/osgi/service/http/runtime/dto/FailedResourceDTO.java
new file mode 100644
index 0000000..588f778
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedResourceDTO.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a resource definition which is currently not being used by a
+ * servlet context due to a problem.
+ * <p>
+ * As the resource represented by this DTO is not used due to a failure, the
+ * field {@link FailedResourceDTO#servletContextId} always returns {@code 0} and
+ * does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 2f8ab091c70a62ecddb98df9e182e40f0454cd2c $
+ */
+public class FailedResourceDTO extends ResourceDTO {
+
+ /**
+ * The reason why the resource represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+
+}
diff --git a/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java b/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java
new file mode 100644
index 0000000..12d0d42
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a servlet context that is currently not used due to some problem.
+ *
+ * The following fields return an empty array for a
+ * {@code FailedServletContextDTO}:
+ * <ul>
+ * <li>{@link ServletContextDTO#servletDTOs}</li>
+ * <li>{@link ServletContextDTO#resourceDTOs}</li>
+ * <li>{@link ServletContextDTO#filterDTOs}</li>
+ * <li>{@link ServletContextDTO#errorPageDTOs}</li>
+ * <li>{@link ServletContextDTO#listenerDTOs}</li>
+ * </ul>
+ * <p>
+ * The method {@link ServletContextDTO#attributes} returns an empty map for a
+ * {@code FailedServletContextDTO}.
+ *
+ * @NotThreadSafe
+ * @author $Id: 40beb08058efdf42c41b052463430a720b2f8602 $
+ */
+public class FailedServletContextDTO extends ServletContextDTO {
+
+ /**
+ * The reason why the servlet context represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+}
diff --git a/org/osgi/service/http/runtime/dto/FailedServletDTO.java b/org/osgi/service/http/runtime/dto/FailedServletDTO.java
new file mode 100644
index 0000000..1b05613
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FailedServletDTO.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+/**
+ * Represents a {@code javax.servlet.Servlet} service which is currently not
+ * being used by a servlet context due to a problem.
+ * <p>
+ * As the servlet represented by this DTO is not used due to a failure, the
+ * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0}
+ * and does not point to an existing servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 7fa7499d9f84a5d2ce942eaff234d2a56bcd3a3b $
+ */
+public class FailedServletDTO extends ServletDTO {
+
+ /**
+ * The reason why the servlet represented by this DTO is not used.
+ *
+ * @see DTOConstants#FAILURE_REASON_UNKNOWN
+ * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT
+ * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING
+ * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE
+ * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE
+ * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE
+ */
+ public int failureReason;
+}
diff --git a/org/osgi/service/http/runtime/dto/FilterDTO.java b/org/osgi/service/http/runtime/dto/FilterDTO.java
new file mode 100644
index 0000000..b415e8a
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/FilterDTO.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a servlet {@code javax.servlet.Filter} service currently being
+ * used for by a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: d9df0a9aab39e5e584c988a710b33bb753a97205 $
+ */
+public class FilterDTO extends DTO {
+ /**
+ * The name of the servlet filter. This field is never {@code null}.
+ */
+ public String name;
+
+ /**
+ * The request mappings for the servlet filter.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request is mapped
+ * to the servlet filter. This array might be empty.
+ */
+ public String[] patterns;
+
+ /**
+ * The servlet names for the servlet filter.
+ *
+ * <p>
+ * The specified names are used to determine the servlets whose requests are
+ * mapped to the servlet filter. This array might be empty.
+ */
+ public String[] servletNames;
+
+ /**
+ * The request mappings for the servlet filter.
+ *
+ * <p>
+ * The specified regular expressions are used to determine whether a request
+ * is mapped to the servlet filter. This array might be empty.
+ */
+ public String[] regexs;
+
+ /**
+ * Specifies whether the servlet filter supports asynchronous processing.
+ */
+ public boolean asyncSupported;
+
+ /**
+ * The dispatcher associations for the servlet filter.
+ *
+ * <p>
+ * The specified names are used to determine in what occasions the servlet
+ * filter is called. This array is never {@code null}.
+ */
+ public String[] dispatcher;
+
+ /**
+ * The servlet filter initialization parameters as provided during
+ * registration of the servlet filter. Additional parameters like the Http
+ * Service Runtime attributes are not included. If the servlet filter has
+ * not initialization parameters, this map is empty.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * Service property identifying the servlet filter. In the case of a servlet
+ * filter registered in the service registry and picked up by a Http
+ * Whiteboard Implementation, this value is not negative and corresponds to
+ * the service id in the registry. If the servlet filter has not been
+ * registered in the service registry, the value is negative and a unique
+ * negative value is generated by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the servlet context for the servlet filter represented
+ * by this DTO.
+ */
+ public long servletContextId;
+}
diff --git a/org/osgi/service/http/runtime/dto/ListenerDTO.java b/org/osgi/service/http/runtime/dto/ListenerDTO.java
new file mode 100644
index 0000000..d15cf58
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/ListenerDTO.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a listener currently being used by a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 6122537f65ed33a40072a2982eeaa874dcce5e7e $
+ */
+public class ListenerDTO extends DTO {
+
+ /**
+ * The fully qualified type names the listener. This array is never empty.
+ */
+ public String[] types;
+
+ /**
+ * Service property identifying the listener. In the case of a Listener
+ * registered in the service registry and picked up by a Http Whiteboard
+ * Implementation, this value is not negative and corresponds to the service
+ * id in the registry. If the listener has not been registered in the
+ * service registry, the value is negative and a unique negative value is
+ * generated by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the servlet context for the listener represented by
+ * this DTO.
+ */
+ public long servletContextId;
+}
diff --git a/org/osgi/service/http/runtime/dto/RequestInfoDTO.java b/org/osgi/service/http/runtime/dto/RequestInfoDTO.java
new file mode 100644
index 0000000..58713c5
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/RequestInfoDTO.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents the services used to process a specific request.
+ *
+ * @NotThreadSafe
+ * @author $Id: bea86cedc367007acbbfd6d9eaa8df8551b315db $
+ */
+public class RequestInfoDTO extends DTO {
+ /**
+ * The path of the request relative to the root.
+ */
+ public String path;
+
+ /**
+ * The service id of the servlet context processing the request represented
+ * by this DTO.
+ */
+ public long servletContextId;
+
+ /**
+ * The servlet filters processing this request. If no servlet filters are
+ * called for processing this request, an empty array is returned.
+ */
+ public FilterDTO[] filterDTOs;
+
+ /**
+ * The servlet processing this request. If the request is processed by a
+ * servlet, this field points to the DTO of the servlet. If the request is
+ * processed by another type of component like a resource, this field is
+ * {@code null}.
+ */
+ public ServletDTO servletDTO;
+
+ /**
+ * The resource processing this request. If the request is processed by a
+ * resource, this field points to the DTO of the resource. If the request is
+ * processed by another type of component like a servlet, this field is
+ * {@code null}.
+ */
+ public ResourceDTO resourceDTO;
+}
diff --git a/org/osgi/service/http/runtime/dto/ResourceDTO.java b/org/osgi/service/http/runtime/dto/ResourceDTO.java
new file mode 100644
index 0000000..ed5f4b7
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/ResourceDTO.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a resource definition currently being used by a servlet context.
+ *
+ * @NotThreadSafe
+ * @author $Id: 9bf52d592ce2a10d452fea8066ffe580fb3c5237 $
+ */
+public class ResourceDTO extends DTO {
+ /**
+ * The request mappings for the resource.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request is mapped
+ * to the resource. This value is never {@code null}.
+ */
+ public String[] patterns;
+
+ /**
+ * The prefix of the resource.
+ */
+ public String prefix;
+
+ /**
+ * Service property identifying the resource. In the case of a resource
+ * registered in the service registry and picked up by a Http Whiteboard
+ * Implementation, this value is not negative and corresponds to the service
+ * id in the registry. If the resource has not been registered in the
+ * service registry, the value is negative and a unique negative value is
+ * generated by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+
+ /**
+ * The service id of the servlet context for the resource represented by
+ * this DTO.
+ */
+ public long servletContextId;
+}
diff --git a/org/osgi/service/http/runtime/dto/RuntimeDTO.java b/org/osgi/service/http/runtime/dto/RuntimeDTO.java
new file mode 100644
index 0000000..9ccb8ad
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/RuntimeDTO.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.runtime.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+
+/**
+ * Represents the state of a Http Service Runtime.
+ *
+ * @NotThreadSafe
+ * @author $Id: 549bf4354e07c6b96552a42d8f15afc3ce7f759b $
+ */
+public class RuntimeDTO extends DTO {
+
+ /**
+ * The DTO for the corresponding
+ * {@code org.osgi.service.http.runtime.HttpServiceRuntime}. This value is
+ * never {@code null}.
+ */
+ public ServiceReferenceDTO serviceDTO;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.ServletContext}
+ * objects used by the Http Service Runtime. The returned array may be empty
+ * if the Http Service Runtime is currently not using any
+ * {@code javax.servlet.ServletContext} objects.
+ */
+ public ServletContextDTO[] servletContextDTOs;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.ServletContext} objects
+ * currently not used by the Http service runtime due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedServletContextDTO[] failedServletContextDTOs;
+
+ /**
+ * Returns the representations of the {@code javax.servlet.Servlet} services
+ * associated with this runtime but currently not used due to some problem.
+ * The returned array may be empty.
+ */
+ public FailedServletDTO[] failedServletDTOs;
+
+ /**
+ * Returns the representations of the resources associated with this runtime
+ * but currently not used due to some problem. The returned array may be
+ * empty.
+ */
+ public FailedResourceDTO[] failedResourceDTOs;
+
+ /**
+ * Returns the representations of the servlet {@code javax.servlet.Filter}
+ * services associated with this runtime but currently not used due to some
+ * problem. The returned array may be empty.
+ */
+ public FailedFilterDTO[] failedFilterDTOs;
+
+ /**
+ * Returns the representations of the error page
+ * {@code javax.servlet.Servlet} services associated with this runtime but
+ * currently not used due to some problem. The returned array may be empty.
+ */
+ public FailedErrorPageDTO[] failedErrorPageDTOs;
+
+ /**
+ * Returns the representations of the listeners associated with this runtime
+ * but currently not used due to some problem. The returned array may be
+ * empty.
+ */
+ public FailedListenerDTO[] failedListenerDTOs;
+}
diff --git a/org/osgi/service/http/runtime/dto/ServletContextDTO.java b/org/osgi/service/http/runtime/dto/ServletContextDTO.java
new file mode 100644
index 0000000..22d2d09
--- /dev/null
+++ b/org/osgi/service/http/runtime/dto/ServletContextDTO.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Represents a {@code javax.servlet.ServletContext} created for servlets,
+ * resources, servlet Filters, and listeners associated with that servlet
+ * context. The Servlet Context is usually backed by a
+ * {@link org.osgi.service.http.context.ServletContextHelper} service.
+ *
+ * @NotThreadSafe
+ * @author $Id: 51af19570314a4a82955a22f78f059680d896e49 $
+ */
+public class ServletContextDTO extends DTO {
+ /**
+ * The name of the servlet context.
+ * The name of the corresponding
+ * {@link org.osgi.service.http.context.ServletContextHelper}.
+ * <p>
+ * This is the value returned by the
+ * {@code ServletContext.getServletContextName()} method.
+ */
+ public String name;
+
+ /**
+ * The servlet context path.
+ *
+ * This is the value returned by the {@code ServletContext.getContextPath()}
+ * method.
+ */
+ public String contextPath;
+
+ /**
+ * The servlet context initialization parameters. This is the set of
+ * parameters provided when registering this context. Additional parameters
+ * like the Http Service Runtime attributes are not included. If the context
+ * has no initialization parameters, this map is empty.
+ */
+ public Map<String, String> initParams;
+
+ /**
+ * The servlet context attributes.
+ *
+ * <p>
+ * The value type must be a numerical type, {@code Boolean}, {@code String},
+ * {@code DTO} or an array of any of the former. Therefore this method will
+ * only return the attributes of the servlet context conforming to this
+ * constraint. Other attributes are omitted. If there are no attributes
+ * conforming to the constraint, an empty map is returned.
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * Service property identifying the servlet context. In the case of a
+ * servlet context backed by a {@code ServletContextHelper} registered in
+ * the service registry and picked up by a Http Whiteboard Implementation,
+ * this value is not negative and corresponds to the service id in the
+ * registry. If the servlet context is not backed by a service registered in
+ * the service registry, the value is negative and a unique negative value
+ * is generated by the Http Service Runtime in this case.
+ */
+ public long serviceId;
+
+ /**
+ * Returns the representations of the {@code Servlet} services associated
+ * with this context.
+ *
+ * The representations of the {@code Servlet} services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any {@code Servlet} services.
+ */
+ public ServletDTO[] servletDTOs;
+
+ /**
+ * Returns the representations of the resource services associated with this
+ * context.
+ *
+ * The representations of the resource services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any resource services.
+ */
+ public ResourceDTO[] resourceDTOs;
+
+ /**
+ * Returns the representations of the servlet {@code Filter} services
+ * associated with this context.
+ *
+ * The representations of the servlet {@code Filter} services associated
+ * with this context. The returned array may be empty if this context is
+ * currently not associated with any servlet {@code Filter} services.
+ */
+ public FilterDTO[] filterDTOs;
+
+ /**
+ * Returns the representations of the error page {@code Servlet} services
+ * associated with this context.
+ *
+ * The representations of the error page {@code Servlet} services associated
+ * with this context. The returned array may be empty if this context is
+ * currently not associated with any error pages.
+ */
+ public ErrorPageDTO[] errorPageDTOs;
+
+ /**
+ * Returns the representations of the listener services associated with this
+ * context.
+ *
+ * The representations of the listener services associated with this
+ * context. The returned array may be empty if this context is currently not
+ * associated with any listener services.
+ */
+ public ListenerDTO[] listenerDTOs;
+}
diff --git a/org/osgi/service/blueprint/reflect/RefMetadata.java b/org/osgi/service/http/runtime/dto/ServletDTO.java
similarity index 52%
copy from org/osgi/service/blueprint/reflect/RefMetadata.java
copy to org/osgi/service/http/runtime/dto/ServletDTO.java
index a3187ab..47fc2f0 100644
--- a/org/osgi/service/blueprint/reflect/RefMetadata.java
+++ b/org/osgi/service/http/runtime/dto/ServletDTO.java
@@ -1,6 +1,6 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2012, 2014). 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
@@ -14,22 +14,23 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
+package org.osgi.service.http.runtime.dto;
+
/**
- * Metadata for a reference to another component managed by the Blueprint
- * Container.
+ * Represents a {@code javax.servlet.Servlet} currently being used by a servlet
+ * context.
*
- * @ThreadSafe
- * @author $Id: a67274cc8e5033dddc8477a046d116d511c1a4d3 $
+ * @NotThreadSafe
+ * @author $Id: 4b078f335cc57226a758012e797af8a25b2bc1ef $
*/
-public interface RefMetadata extends Target, NonNullMetadata {
+public class ServletDTO extends BaseServletDTO {
/**
- * Return the id of the referenced component.
- *
- * This is specified by the {@code component-id} attribute of a component.
+ * The request mappings for the servlet.
*
- * @return The id of the referenced component.
+ * <p>
+ * The specified patterns are used to determine whether a request is mapped
+ * to the servlet. This array is never empty.
*/
- String getComponentId();
+ public String[] patterns;
}
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/http/runtime/dto/package-info.java
similarity index 70%
copy from org/osgi/service/event/package-info.java
copy to org/osgi/service/http/runtime/dto/package-info.java
index 68f2821..b398bbb 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/http/runtime/dto/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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,7 +15,7 @@
*/
/**
- * Event Admin Package Version 1.3.
+ * Http Runtime DTO Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,1.1)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: f1721da508d2b3259b6fb4bf6aa142ac2c65369e $
*/
-package org.osgi.service.event;
+ at Version("1.0")
+package org.osgi.service.http.runtime.dto;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/http/runtime/dto/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/http/runtime/dto/packageinfo
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/http/runtime/package-info.java
similarity index 70%
copy from org/osgi/service/event/package-info.java
copy to org/osgi/service/http/runtime/package-info.java
index 68f2821..f4252e8 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/http/runtime/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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,7 +15,7 @@
*/
/**
- * Event Admin Package Version 1.3.
+ * Http Runtime Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,1.1)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: 77af772c119a7debb33e9db4c600fb7dad33db13 $
*/
-package org.osgi.service.event;
+ at Version("1.0")
+package org.osgi.service.http.runtime;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/http/runtime/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/http/runtime/packageinfo
diff --git a/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java b/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java
new file mode 100644
index 0000000..63bc14c
--- /dev/null
+++ b/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2015). 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.service.http.whiteboard;
+
+import javax.servlet.Servlet;
+import org.osgi.framework.Filter;
+import org.osgi.service.http.context.ServletContextHelper;
+import org.osgi.service.http.runtime.HttpServiceRuntimeConstants;
+
+/**
+ * Defines standard constants for the Http Whiteboard services.
+ *
+ * @author $Id: b82e6f543251635445a30cf17e0d2e10477d4cd6 $
+ */
+public final class HttpWhiteboardConstants {
+ private HttpWhiteboardConstants() {
+ // non-instantiable
+ }
+
+ /**
+ * Service property specifying the name of an {@link ServletContextHelper}
+ * service.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services, this service property must be
+ * specified. Context services without this service property are ignored.
+ *
+ * <p>
+ * Servlet, listener, servlet filter, and resource services might refer to a
+ * specific {@link ServletContextHelper} service referencing the name with
+ * the {@link #HTTP_WHITEBOARD_CONTEXT_SELECT} property.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services, the value of this service
+ * property must be of type {@code String}. The value must follow the
+ * "symbolic-name" specification from Section 1.3.2 of the OSGi Core
+ * Specification.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_PATH
+ * @see #HTTP_WHITEBOARD_CONTEXT_SELECT
+ * @see #HTTP_WHITEBOARD_DEFAULT_CONTEXT_NAME
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_NAME = "osgi.http.whiteboard.context.name";
+
+ /**
+ * The name of the default {@link ServletContextHelper}. If a service is
+ * registered with this property, it is overriding the default context with
+ * a custom provided context.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ */
+ public static final String HTTP_WHITEBOARD_DEFAULT_CONTEXT_NAME = "default";
+
+ /**
+ * Service property specifying the path of an {@link ServletContextHelper}
+ * service.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services this service property is
+ * required. Context services without this service property are ignored.
+ *
+ * <p>
+ * This property defines a context path under which all whiteboard services
+ * associated with this context are registered. Having different contexts
+ * with different paths allows to separate the URL space.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services, the value of this service
+ * property must be of type {@code String}. The value is either a slash for
+ * the root or it must start with a slash but not end with a slash. Valid
+ * characters are defined in rfc3986#section-3.3. Contexts with an invalid
+ * path are ignored.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see #HTTP_WHITEBOARD_CONTEXT_SELECT
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_PATH = "osgi.http.whiteboard.context.path";
+
+ /**
+ * Service property prefix referencing a {@link ServletContextHelper}
+ * service.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services this prefix can be used for
+ * service properties to mark them as initialization parameters which can be
+ * retrieved from the associated servlet context. The prefix is removed from
+ * the service property name to build the initialization parameter name.
+ *
+ * <p>
+ * For {@link ServletContextHelper} services, the value of each
+ * initialization parameter service property must be of type {@code String}.
+ *
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_INIT_PARAM_PREFIX = "context.init.";
+
+ /**
+ * Service property referencing a {@link ServletContextHelper} service.
+ *
+ * <p>
+ * For servlet, listener, servlet filter, or resource services, this service
+ * property refers to the associated {@code ServletContextHelper} service.
+ * The value of this property is a filter expression which is matched
+ * against the service registration properties of the
+ * {@code ServletContextHelper} service. If this service property is not
+ * specified, the default context is used. If there is no context service
+ * matching, the servlet, listener, servlet filter, or resource service is
+ * ignored.
+ * <p>
+ * For example, if a whiteboard service wants to select a servlet context
+ * helper with the name "Admin" the expression would be
+ * "(osgi.http.whiteboard.context.name=Admin)". Selecting all
+ * contexts could be done with
+ * "(osgi.http.whiteboard.context.name=*)".
+ * <p>
+ * For servlet, listener, servlet filter, or resource services, the value of
+ * this service property must be of type {@code String}.
+ *
+ * @see #HTTP_WHITEBOARD_CONTEXT_NAME
+ * @see #HTTP_WHITEBOARD_CONTEXT_PATH
+ */
+ public static final String HTTP_WHITEBOARD_CONTEXT_SELECT = "osgi.http.whiteboard.context.select";
+
+ /**
+ * Service property specifying the servlet name of a {@code Servlet}
+ * service.
+ *
+ * <p>
+ * This name is used as the value for the
+ * {@code ServletConfig.getServletName()} method. If this service property
+ * is not specified, the fully qualified name of the service object's class
+ * is used as the servlet name. Filter services may refer to servlets by
+ * this name in their {@link #HTTP_WHITEBOARD_FILTER_SERVLET} service
+ * property to apply the filter to the servlet.
+ *
+ * <p>
+ * Servlet names should be unique among all servlet services associated with
+ * a single {@link ServletContextHelper}.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_NAME = "osgi.http.whiteboard.servlet.name";
+
+ /**
+ * Service property specifying the request mappings for a {@code Servlet}
+ * service.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request should be
+ * mapped to the servlet. Servlet services without this service property or
+ * {@link #HTTP_WHITEBOARD_SERVLET_ERROR_PAGE} are ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 12.2 Specification of Mappings"
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_PATTERN = "osgi.http.whiteboard.servlet.pattern";
+
+ /**
+ * Service property specifying whether a {@code Servlet} service acts as an
+ * error page.
+ *
+ * <p>
+ * The service property values may be the name of a fully qualified
+ * exception class, a three digit HTTP status code, the value "4xx" for all
+ * error codes in the 400 range, or the value "5xx" for all error codes in
+ * the 500 range. Any value that is not a three digit number, or one of the
+ * two special values is considered to be the name of a fully qualified
+ * exception class.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_ERROR_PAGE = "osgi.http.whiteboard.servlet.errorPage";
+
+ /**
+ * Service property specifying whether a {@code Servlet} service supports
+ * asynchronous processing.
+ *
+ * <p>
+ * By default servlet services do not support asynchronous processing.
+ *
+ * <p>
+ * The value of this service property must be of type {@code Boolean}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 2.3.3.3 Asynchronous Processing"
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED = "osgi.http.whiteboard.servlet.asyncSupported";
+
+ /**
+ * Service property prefix referencing a {@link Servlet} service.
+ *
+ * <p>
+ * For {@link Servlet} services this prefix can be used for service
+ * properties to mark them as initialization parameters which can be
+ * retrieved from the associated servlet config. The prefix is removed from
+ * the service property name to build the initialization parameter name.
+ *
+ * <p>
+ * For {@link Servlet} services, the value of each initialization parameter
+ * service property must be of type {@code String}.
+ *
+ */
+ public static final String HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX = "servlet.init.";
+
+ /**
+ * Service property specifying the servlet filter name of a {@code Filter}
+ * service.
+ *
+ * <p>
+ * This name is used as the value for the
+ * {@code FilterConfig.getFilterName()} method. If this service property is
+ * not specified, the fully qualified name of the service object's class is
+ * used as the servlet filter name.
+ *
+ * <p>
+ * Servlet filter names should be unique among all servlet filter services
+ * associated with a single {@link ServletContextHelper}.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_NAME = "osgi.http.whiteboard.filter.name";
+
+ /**
+ * Service property specifying the request mappings for a {@code Filter}
+ * service.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request should be
+ * mapped to the servlet filter. Filter services without this service
+ * property or the {@link #HTTP_WHITEBOARD_FILTER_SERVLET} or the
+ * {@link #HTTP_WHITEBOARD_FILTER_REGEX} service property are ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 12.2 Specification of Mappings"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_PATTERN = "osgi.http.whiteboard.filter.pattern";
+
+ /**
+ * Service property specifying the {@link #HTTP_WHITEBOARD_SERVLET_NAME
+ * servlet names} for a servlet {@code Filter} service.
+ *
+ * <p>
+ * The specified names are used to determine the servlets whose requests
+ * should be mapped to the servlet filter. Servlet filter services without
+ * this service property or the {@link #HTTP_WHITEBOARD_FILTER_PATTERN} or
+ * the {@link #HTTP_WHITEBOARD_FILTER_REGEX} service property are ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_SERVLET = "osgi.http.whiteboard.filter.servlet";
+
+ /**
+ * Service property specifying the request mappings for a servlet
+ * {@code Filter} service.
+ *
+ * <p>
+ * The specified regular expressions are used to determine whether a request
+ * should be mapped to the servlet filter. The regular expressions must
+ * follow the syntax defined in {@code java.util.regex.Pattern}. Servlet
+ * filter services without this service property or the
+ * {@link #HTTP_WHITEBOARD_FILTER_SERVLET} or the
+ * {@link #HTTP_WHITEBOARD_FILTER_PATTERN} service property are ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "java.util.regex.Pattern"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_REGEX = "osgi.http.whiteboard.filter.regex";
+
+ /**
+ * Service property specifying whether a servlet {@code Filter} service
+ * supports asynchronous processing.
+ *
+ * <p>
+ * By default servlet filters services do not support asynchronous
+ * processing.
+ *
+ * <p>
+ * The value of this service property must be of type {@code Boolean}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 2.3.3.3 Asynchronous Processing"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED = "osgi.http.whiteboard.filter.asyncSupported";
+
+ /**
+ * Service property specifying the dispatcher handling of a servlet
+ * {@code Filter}.
+ *
+ * <p>
+ * By default servlet filter services are associated with client requests
+ * only (see value {@link #DISPATCHER_REQUEST}).
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}. Allowed values are
+ * {@link #DISPATCHER_ASYNC}, {@link #DISPATCHER_ERROR},
+ * {@link #DISPATCHER_FORWARD}, {@link #DISPATCHER_INCLUDE},
+ * {@link #DISPATCHER_REQUEST}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_DISPATCHER = "osgi.http.whiteboard.filter.dispatcher";
+
+ /**
+ * Service property prefix referencing a {@link Filter} service.
+ *
+ * <p>
+ * For {@link Filter} services this prefix can be used for service
+ * properties to mark them as initialization parameters which can be
+ * retrieved from the associated filter config. The prefix is removed from
+ * the service property name to build the initialization parameter name.
+ *
+ * <p>
+ * For {@link Filter} services, the value of each initialization parameter
+ * service property must be of type {@code String}.
+ *
+ */
+ public static final String HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX = "filter.init.";
+
+ /**
+ * Service property to mark a Listener service as a Whiteboard service.
+ * Listener services with this property set to the string value "true" will
+ * be treated as Whiteboard services opting in to being handled by the Http
+ * Whiteboard implementation. If the value "false" is specified, the service
+ * is opting out and this case is treated exactly the same as if this
+ * property is missing. If an invalid value is specified this is treated as
+ * a failure.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}. Valid
+ * values are "true" and "false" ignoring case.
+ */
+ public static final String HTTP_WHITEBOARD_LISTENER = "osgi.http.whiteboard.listener";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the servlet filter is applied to client requests.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_REQUEST = "REQUEST";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the servlet filter is applied to include calls to the
+ * dispatcher.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_INCLUDE = "INCLUDE";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the servlet filter is applied to forward calls to the
+ * dispatcher.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_FORWARD = "FORWARD";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the servlet filter is applied in the asynchronous
+ * context.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_ASYNC = "ASYNC";
+
+ /**
+ * Possible value for the {@link #HTTP_WHITEBOARD_FILTER_DISPATCHER}
+ * property indicating the servlet filter is applied when an error page is
+ * called.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 6.2.5 Filters and the RequestDispatcher"
+ */
+ public static final String DISPATCHER_ERROR = "ERROR";
+
+ /**
+ * Service property specifying the request mappings for resources.
+ *
+ * <p>
+ * The specified patterns are used to determine whether a request should be
+ * mapped to resources. Resource services without this service property are
+ * ignored.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String},
+ * {@code String[]}, or {@code Collection<String>}.
+ *
+ * @see "Java Servlet Specification Version 3.0, Section 12.2 Specification of Mappings"
+ * @see #HTTP_WHITEBOARD_RESOURCE_PREFIX
+ */
+ public static final String HTTP_WHITEBOARD_RESOURCE_PATTERN = "osgi.http.whiteboard.resource.pattern";
+
+ /**
+ * Service property specifying the resource entry prefix for a resource
+ * service.
+ *
+ * <p>
+ * If a resource service is registered with this property, requests are
+ * served with bundle resources.
+ *
+ * <p>
+ * This prefix is used to map a requested resource to the bundle's entries.
+ * The value must not end with slash ("/") with the exception that
+ * a name of the form "/" is used to denote the root of the
+ * bundle. See the specification text for details on how HTTP requests are
+ * mapped.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String}.
+ *
+ * @see #HTTP_WHITEBOARD_RESOURCE_PATTERN
+ */
+ public static final String HTTP_WHITEBOARD_RESOURCE_PREFIX = "osgi.http.whiteboard.resource.prefix";
+
+ /**
+ * Service property specifying the target filter to select the Http
+ * Whiteboard implementation to process the service.
+ *
+ * <p>
+ * An Http Whiteboard implementation can define any number of service
+ * properties which can be referenced by the target filter. The service
+ * properties should always include the
+ * {@link HttpServiceRuntimeConstants#HTTP_SERVICE_ENDPOINT
+ * osgi.http.endpoint} service property if the endpoint information is
+ * known.
+ *
+ * <p>
+ * If this service property is not specified, then all Http Whiteboard
+ * implementations can process the service.
+ *
+ * <p>
+ * The value of this service property must be of type {@code String} and be
+ * a valid {@link Filter filter string}.
+ */
+ public static final String HTTP_WHITEBOARD_TARGET = "osgi.http.whiteboard.target";
+}
diff --git a/org/osgi/service/event/package-info.java b/org/osgi/service/http/whiteboard/package-info.java
similarity index 70%
copy from org/osgi/service/event/package-info.java
copy to org/osgi/service/http/whiteboard/package-info.java
index 68f2821..0a74c6c 100644
--- a/org/osgi/service/event/package-info.java
+++ b/org/osgi/service/http/whiteboard/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2015). 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,7 +15,7 @@
*/
/**
- * Event Admin Package Version 1.3.
+ * Http Whiteboard Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,2.0)"}
+ * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.event; version="[1.3,1.4)"}
+ * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,1.1)"}
*
- * @version 1.3
- * @author $Id: 11bbb27d13a54a406b55338df71482d0360daaba $
+ * @author $Id: 033e5c048ef8f94e8575449b78c64e66a4e68cf5 $
*/
-package org.osgi.service.event;
+ at Version("1.0")
+package org.osgi.service.http.whiteboard;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/service/http/whiteboard/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/service/http/whiteboard/packageinfo
diff --git a/org/osgi/service/io/ConnectionFactory.java b/org/osgi/service/io/ConnectionFactory.java
index 17de30a..e332905 100644
--- a/org/osgi/service/io/ConnectionFactory.java
+++ b/org/osgi/service/io/ConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -32,7 +32,7 @@ import javax.microedition.io.Connection;
* selected Connection Factory will then be called to create the actual
* {@code Connection} object.
*
- * @author $Id: 9f6aae71e9b0b65afb94f94a8c0493a96d925558 $
+ * @author $Id: 864b1ce026449e89af9459baec11c7147c792a34 $
*/
public interface ConnectionFactory {
/**
@@ -53,7 +53,7 @@ public interface ConnectionFactory {
* {@code ConnectorService.open} method
* @return A new {@code javax.microedition.io.Connection} object.
* @throws IOException If a {@code javax.microedition.io.Connection} object
- * can not not be created.
+ * cannot be created.
*/
public Connection createConnection(String name, int mode, boolean timeouts) throws IOException;
}
diff --git a/org/osgi/service/jpa/package-info.java b/org/osgi/service/jpa/package-info.java
index 334c540..9218e18 100644
--- a/org/osgi/service/jpa/package-info.java
+++ b/org/osgi/service/jpa/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.jpa; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: b22cf584afd6ca67dd1e27e239f03636335cf01d $
+ * @author $Id: f6b696aead9ab46f353159c5f4d0c9e4b7fd3dde $
*/
+ at Version("1.0")
package org.osgi.service.jpa;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/metatype/AttributeDefinition.java b/org/osgi/service/metatype/AttributeDefinition.java
index 7c47818..5f43192 100644
--- a/org/osgi/service/metatype/AttributeDefinition.java
+++ b/org/osgi/service/metatype/AttributeDefinition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.
@@ -16,6 +16,8 @@
package org.osgi.service.metatype;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* An interface to describe an attribute.
*
@@ -24,111 +26,112 @@ package org.osgi.service.metatype;
* of a property/attribute.
*
* @ThreadSafe
- * @author $Id: f2aa9ead0136d63493a5025892bdf80efa2e9019 $
+ * @author $Id: 057587a3ca5e0610db4c85d33c84eb614c3d2718 $
*/
+ at ConsumerType
public interface AttributeDefinition {
/**
- * The {@code STRING} (1) type.
+ * The {@code STRING} type.
*
* <p>
* Attributes of this type should be stored as {@code String},
- * {@code Vector} with {@code String} or {@code String[]} objects, depending
- * on the {@code getCardinality()} value.
+ * {@code List<String>} or {@code String[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int STRING = 1;
/**
- * The {@code LONG} (2) type.
+ * The {@code LONG} type.
*
- * Attributes of this type should be stored as {@code Long}, {@code Vector}
- * with {@code Long} or {@code long[]} objects, depending on the
- * {@code getCardinality()} value.
+ * Attributes of this type should be stored as {@code Long},
+ * {@code List<Long>} or {@code long[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int LONG = 2;
/**
- * The {@code INTEGER} (3) type.
+ * The {@code INTEGER} type.
*
* Attributes of this type should be stored as {@code Integer},
- * {@code Vector} with {@code Integer} or {@code int[]} objects, depending
- * on the {@code getCardinality()} value.
+ * {@code List<Integer>} or {@code int[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int INTEGER = 3;
/**
- * The {@code SHORT} (4) type.
+ * The {@code SHORT} type.
*
- * Attributes of this type should be stored as {@code Short}, {@code Vector}
- * with {@code Short} or {@code short[]} objects, depending on the
- * {@code getCardinality()} value.
+ * Attributes of this type should be stored as {@code Short},
+ * {@code List<Short>} or {@code short[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int SHORT = 4;
/**
- * The {@code CHARACTER} (5) type.
+ * The {@code CHARACTER} type.
*
* Attributes of this type should be stored as {@code Character},
- * {@code Vector} with {@code Character} or {@code char[]} objects,
- * depending on the {@code getCardinality()} value.
+ * {@code List<Character>} or {@code char[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int CHARACTER = 5;
/**
- * The {@code BYTE} (6) type.
+ * The {@code BYTE} type.
*
- * Attributes of this type should be stored as {@code Byte}, {@code Vector}
- * with {@code Byte} or {@code byte[]} objects, depending on the
- * {@code getCardinality()} value.
+ * Attributes of this type should be stored as {@code Byte},
+ * {@code List<Byte>} or {@code byte[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int BYTE = 6;
/**
- * The {@code DOUBLE} (7) type.
+ * The {@code DOUBLE} type.
*
* Attributes of this type should be stored as {@code Double},
- * {@code Vector} with {@code Double} or {@code double[]} objects, depending
- * on the {@code getCardinality()} value.
+ * {@code List<Double>} or {@code double[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int DOUBLE = 7;
/**
- * The {@code FLOAT} (8) type.
+ * The {@code FLOAT} type.
*
- * Attributes of this type should be stored as {@code Float}, {@code Vector}
- * with {@code Float} or {@code float[]} objects, depending on the
- * {@code getCardinality()} value.
+ * Attributes of this type should be stored as {@code Float},
+ * {@code List<Float>} or {@code float[]} objects, depending on the
+ * {@link #getCardinality()} value.
*/
int FLOAT = 8;
/**
- * The {@code BIGINTEGER} (9) type.
+ * The {@code BIGINTEGER} type.
*
* Attributes of this type should be stored as {@code BigInteger},
- * {@code Vector} with {@code BigInteger} or {@code BigInteger[]} objects,
- * depending on the {@code getCardinality()} value.
+ * {@code List<BigInteger>} or {@code BigInteger[]} objects, depending on
+ * the {@link #getCardinality()} value.
*
* @deprecated As of 1.1.
*/
int BIGINTEGER = 9;
/**
- * The {@code BIGDECIMAL} (10) type.
+ * The {@code BIGDECIMAL} type.
*
* Attributes of this type should be stored as {@code BigDecimal},
- * {@code Vector} with {@code BigDecimal} or {@code BigDecimal[]} objects
- * depending on {@code getCardinality()}.
+ * {@code List<BigDecimal>} or {@code BigDecimal[]} objects depending on
+ * {@link #getCardinality()}.
*
* @deprecated As of 1.1.
*/
int BIGDECIMAL = 10;
/**
- * The {@code BOOLEAN} (11) type.
+ * The {@code BOOLEAN} type.
*
* Attributes of this type should be stored as {@code Boolean},
- * {@code Vector} with {@code Boolean} or {@code boolean[]} objects
- * depending on {@code getCardinality()}.
+ * {@code List<Boolean>} or {@code boolean[]} objects depending on
+ * {@link #getCardinality()}.
*/
int BOOLEAN = 11;
/**
- * The {@code PASSWORD} (12) type.
+ * The {@code PASSWORD} type.
*
- * Attributes of this type must be stored as {@code String}, {@code Vector}
- * with {@code String} or {@code String[]} objects depending on {link
- * getCardinality()}. A {@code PASSWORD} must be treated as a string but the
- * type can be used to disguise the information when displayed to a user to
- * prevent others from seeing it.
+ * Attributes of this type must be stored as {@code String},
+ * {@code List<String>} or {@code String[]} objects depending on
+ * {@link #getCardinality()}. A {@code PASSWORD} must be treated as a string
+ * but the type can be used to disguise the information when displayed to a
+ * user to prevent others from seeing it.
*
* @since 1.2
*/
@@ -144,18 +147,19 @@ public interface AttributeDefinition {
/**
* Unique identity for this attribute.
*
- * Attributes share a global namespace in the registry. E.g. an attribute
- * {@code cn} or {@code commonName} must always be a {@code String} and the
- * semantics are always a name of some object. They share this aspect with
- * LDAP/X.500 attributes. In these standards the OSI Object Identifier (OID)
- * is used to uniquely identify an attribute. If such an OID exists, (which
- * can be requested at several standard organisations and many companies
- * already have a node in the tree) it can be returned here. Otherwise, a
- * unique id should be returned which can be a Java class name (reverse
- * domain name) or generated with a GUID algorithm. Note that all LDAP
- * defined attributes already have an OID. It is strongly advised to define
- * the attributes from existing LDAP schemes which will give the OID. Many
- * such schemes exist ranging from postal addresses to DHCP parameters.
+ * Attributes share a global namespace in the registry. For example, an
+ * attribute {@code cn} or {@code commonName} must always be a
+ * {@code String} and the semantics are always a name of some object. They
+ * share this aspect with LDAP/X.500 attributes. In these standards the OSI
+ * Object Identifier (OID) is used to uniquely identify an attribute. If
+ * such an OID exists, (which can be requested at several standard
+ * organizations and many companies already have a node in the tree) it can
+ * be returned here. Otherwise, a unique id should be returned which can be
+ * a Java class name (reverse domain name) or generated with a GUID
+ * algorithm. Note that all LDAP defined attributes already have an OID. It
+ * is strongly advised to define the attributes from existing LDAP schemes
+ * which will give the OID. Many such schemes exist ranging from postal
+ * addresses to DHCP parameters.
*
* @return The id or oid
*/
@@ -175,12 +179,12 @@ public interface AttributeDefinition {
* Return the cardinality of this attribute.
*
* The OSGi environment handles multi valued attributes in arrays ([]) or in
- * {@code Vector} objects. The return value is defined as follows:
+ * {@code List} objects. The return value is defined as follows:
*
* <pre>
*
- * x = Integer.MIN_VALUE no limit, but use Vector
- * x < 0 -x = max occurrences, store in Vector
+ * x = Integer.MIN_VALUE no limit, but use List
+ * x < 0 -x = max occurrences, store in List
* x > 0 x = max occurrences, store in array []
* x = Integer.MAX_VALUE no limit, but use array []
* x = 0 1 occurrence required
@@ -196,8 +200,9 @@ public interface AttributeDefinition {
*
* <p>
* Defined in the following constants which map to the appropriate Java
- * type. {@code STRING},{@code LONG},{@code INTEGER}, {@code CHAR},
- * {@code BYTE},{@code DOUBLE},{@code FLOAT}, {@code BOOLEAN}.
+ * type. {@link #STRING},{@link #LONG},{@link #INTEGER}, {@link #SHORT},
+ * {@link #CHARACTER}, {@link #BYTE},{@link #DOUBLE},{@link #FLOAT},
+ * {@link #BOOLEAN}, {@link #PASSWORD}.
*
* @return The type for this attribute.
*/
@@ -216,8 +221,8 @@ public interface AttributeDefinition {
* getType() for this attribute.
*
* <p>
- * This list must be in the same sequence as {@code getOptionLabels()}. I.e.
- * for each index i in {@code getOptionValues}, i in
+ * This list must be in the same sequence as {@code getOptionLabels()}. That
+ * is, for each index i in {@code getOptionValues}, i in
* {@code getOptionLabels()} should be the label.
*
* <p>
@@ -242,7 +247,7 @@ public interface AttributeDefinition {
* available.
* <p>
* This list must be in the same sequence as the {@code getOptionValues()}
- * method. I.e. for each index i in {@code getOptionLabels}, i in
+ * method. That is, for each index i in {@code getOptionLabels}, i in
* {@code getOptionValues()} should be the associated value.
*
* <p>
@@ -291,12 +296,12 @@ public interface AttributeDefinition {
* The object must be of the appropriate type as defined by the cardinality
* and {@code getType()}. The return type is a list of {@code String}
* objects that can be converted to the appropriate type. The cardinality of
- * the return array must follow the absolute cardinality of this type. E.g.
- * if the cardinality = 0, the array must contain 1 element. If the
+ * the return array must follow the absolute cardinality of this type. For
+ * example, if the cardinality = 0, the array must contain 1 element. If the
* cardinality is 1, it must contain 0 or 1 elements. If it is -5, it must
* contain from 0 to max 5 elements. Note that the special case of a 0
- * cardinality, meaning a single value, does not allow arrays or vectors of
- * 0 elements.
+ * cardinality, meaning a single value, does not allow arrays or lists of 0
+ * elements.
*
* @return Return a default value or {@code null} if no default exists.
*/
diff --git a/org/osgi/service/metatype/MetaTypeInformation.java b/org/osgi/service/metatype/MetaTypeInformation.java
index 3acde45..7523c53 100644
--- a/org/osgi/service/metatype/MetaTypeInformation.java
+++ b/org/osgi/service/metatype/MetaTypeInformation.java
@@ -16,6 +16,7 @@
package org.osgi.service.metatype;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
/**
@@ -23,10 +24,10 @@ import org.osgi.framework.Bundle;
* meta type information for a specific bundle.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 5d795691070f69f49d88c1930f811b7b90210848 $
+ * @author $Id: 0097616119994d574d3c2d83459c996e02cb1aa2 $
* @since 1.1
*/
+ at ProviderType
public interface MetaTypeInformation extends MetaTypeProvider {
/**
* Return the PIDs (for ManagedServices) for which ObjectClassDefinition
diff --git a/org/osgi/service/metatype/MetaTypeProvider.java b/org/osgi/service/metatype/MetaTypeProvider.java
index 2405b15..7d160cf 100644
--- a/org/osgi/service/metatype/MetaTypeProvider.java
+++ b/org/osgi/service/metatype/MetaTypeProvider.java
@@ -16,6 +16,8 @@
package org.osgi.service.metatype;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* Provides access to metatypes. This interface can be implemented on a Managed
* Service or Managed Service Factory as well as registered as a service. When
@@ -25,8 +27,9 @@ package org.osgi.service.metatype;
* argument to the {@link #getObjectClassDefinition(String, String)} method.
*
* @ThreadSafe
- * @author $Id: 44778640e90b3772c21a48d64f611730e0f911d1 $
+ * @author $Id: 2812fb7a59609de7804d2e48bef61beefc8c0cee $
*/
+ at ConsumerType
public interface MetaTypeProvider {
/**
diff --git a/org/osgi/service/metatype/MetaTypeService.java b/org/osgi/service/metatype/MetaTypeService.java
index 6fb8c2c..f1b5cba 100644
--- a/org/osgi/service/metatype/MetaTypeService.java
+++ b/org/osgi/service/metatype/MetaTypeService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2015). 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.
@@ -16,6 +16,7 @@
package org.osgi.service.metatype;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.Bundle;
/**
@@ -33,10 +34,10 @@ import org.osgi.framework.Bundle;
* {@code MetaTypeProvider} objects.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: e4733d8f8582979167831670b84f2e9965e97e28 $
+ * @author $Id: 3a507c14a83c95e92bfd5d4714928ec949fb8a14 $
* @since 1.1
*/
+ at ProviderType
public interface MetaTypeService {
/**
* Return the MetaType information for the specified bundle.
@@ -51,4 +52,20 @@ public interface MetaTypeService {
* entry in the meta type documents directory.
*/
public final static String METATYPE_DOCUMENTS_LOCATION = "OSGI-INF/metatype";
+
+ /**
+ * Capability name for meta type document processors.
+ *
+ * <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.metatype)(version>=1.3)(!(version>=2.0)))"
+ * </pre>
+ *
+ * @since 1.3
+ */
+ public static final String METATYPE_CAPABILITY_NAME = "osgi.metatype";
}
diff --git a/org/osgi/service/metatype/ObjectClassDefinition.java b/org/osgi/service/metatype/ObjectClassDefinition.java
index e3ccec1..be5711a 100644
--- a/org/osgi/service/metatype/ObjectClassDefinition.java
+++ b/org/osgi/service/metatype/ObjectClassDefinition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.
@@ -18,13 +18,15 @@ package org.osgi.service.metatype;
import java.io.IOException;
import java.io.InputStream;
+import org.osgi.annotation.versioning.ConsumerType;
/**
* Description for the data type information of an objectclass.
*
* @ThreadSafe
- * @author $Id: f65f64dbce209cf7f7418be8c812cd2162ac7835 $
+ * @author $Id: 0db886aca46e5a482b52263f1dbfdd3cc27f0179 $
*/
+ at ConsumerType
public interface ObjectClassDefinition {
/**
* Argument for {@code getAttributeDefinitions(int)}.
@@ -65,7 +67,7 @@ public interface ObjectClassDefinition {
* They share this aspect with LDAP/X.500 attributes. In these standards the
* OSI Object Identifier (OID) is used to uniquely identify object classes.
* If such an OID exists, (which can be requested at several standard
- * organisations and many companies already have a node in the tree) it can
+ * organizations and many companies already have a node in the tree) it can
* be returned here. Otherwise, a unique id should be returned which can be
* a java class name (reverse domain name) or generated with a GUID
* algorithm. Note that all LDAP defined object classes already have an OID
@@ -110,8 +112,8 @@ public interface ObjectClassDefinition {
* <p>
* The icon may depend on the localization.
*
- * @param size Requested size of an icon, e.g. a 16x16 pixels icon then size
- * = 16
+ * @param size Requested size of an icon. For example, a 16x16 pixel icon
+ * has a size of 16
* @return An InputStream representing an icon or {@code null}
* @throws IOException If the {@code InputStream} cannot be returned.
*/
diff --git a/org/osgi/service/metatype/annotations/AttributeDefinition.java b/org/osgi/service/metatype/annotations/AttributeDefinition.java
new file mode 100644
index 0000000..4f0c62b
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/AttributeDefinition.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.metatype.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * {@code AttributeDefinition} information for the annotated method.
+ *
+ * <p>
+ * Each method of a type annotated by {@link ObjectClassDefinition} has an
+ * implied AttributeDefinition annotation. This annotation is only used to
+ * specify non-default AttributeDefinition information.
+ *
+ * <p>
+ * The {@code id} of this AttributeDefinition is generated from the name of the
+ * annotated method. The annotated method name is processed from left to right
+ * changing each character as follows:
+ * <ul>
+ * <li>A dollar sign ({@code '$'} \u0024) is removed unless it is followed
+ * by another dollar sign in which case the two consecutive dollar signs (
+ * {@code '$$'}) are changed to a single dollar sign.</li>
+ * <li>A low line ({@code '_'} \u005F) is changed to a full stop (
+ * {@code '.'} \u002E) unless is it followed by another low line in which
+ * case the two consecutive low lines ({@code '__'}) are changed to a single low
+ * line.</li>
+ * <li>All other characters are unchanged.</li>
+ * </ul>
+ * This id is the value of the id attribute of the generate AD element and is
+ * used as the name of the corresponding configuration property.
+ *
+ * <p>
+ * This annotation is not processed at runtime. It must be processed by tools
+ * and used to contribute to a Meta Type Resource document for the bundle.
+ *
+ * @see "The AD element of a Meta Type Resource."
+ * @author $Id: 366d21759b5562656dc97a391f61181970d71ec7 $
+ */
+ at Retention(RetentionPolicy.CLASS)
+ at Target(ElementType.METHOD)
+public @interface AttributeDefinition {
+ /**
+ * The human readable name of this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, the name of this AttributeDefinition is derived from
+ * the name of the annotated method. For example, low line ({@code '_'}
+ * \u005F) and dollar sign ({@code '$'} \u0024) are replaced with
+ * space ({@code ' '} \u0020) and space is inserted between camel case
+ * words.
+ *
+ * <p>
+ * If the name begins with the percent sign ({@code '%'} \u0025), the
+ * name can be {@link ObjectClassDefinition#localization() localized}.
+ *
+ * @see "The name attribute of the AD element of a Meta Type Resource."
+ */
+ String name() default "";
+
+ /**
+ * The human readable description of this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, the description of this AttributeDefinition is the
+ * empty string.
+ *
+ * <p>
+ * If the description begins with the percent sign ({@code '%'} \u0025),
+ * the description can be {@link ObjectClassDefinition#localization()
+ * localized}.
+ *
+ * @see "The description attribute of the AD element of a Meta Type Resource."
+ */
+ String description() default "";
+
+ /**
+ * The type of this AttributeDefinition.
+ *
+ * <p>
+ * This must be one of the defined {@link AttributeType attributes types}.
+ *
+ * <p>
+ * If not specified, the type is derived from the return type of the
+ * annotated method. Return types of {@code Class} and {@code Enum} are
+ * mapped to {@link AttributeType#STRING STRING}. If the return type is
+ * {@code List}, {@code Set}, {@code Collection}, {@code Iterable} or some
+ * type which can be determined at annotation processing time to
+ * <ol>
+ * <li>be a subtype of {@code Collection} and</li>
+ * <li>have a public no argument constructor,</li>
+ * </ol>
+ * then the type is derived from the generic type. For example, a return
+ * type of {@code List<String>} will be mapped to
+ * {@link AttributeType#STRING STRING}. A return type of a single
+ * dimensional array is supported and the type is the component type of the
+ * array. Multi dimensional arrays are not supported. Annotation return
+ * types are not supported. Any unrecognized type is mapped to
+ * {@link AttributeType#STRING STRING}. A tool processing the annotation
+ * should declare an error for unsupported return types.
+ *
+ * @see "The type attribute of the AD element of a Meta Type Resource."
+ */
+ AttributeType type() default AttributeType.STRING;
+
+ /**
+ * The cardinality of this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, the cardinality is derived from the return type of the
+ * annotated method. For an array return type, the cardinality is a large
+ * positive value. If the return type is {@code List}, {@code Set},
+ * {@code Collection}, {@code Iterable} or some type which can be determined
+ * at annotation processing time to
+ * <ol>
+ * <li>be a subtype of {@code Collection} and</li>
+ * <li>have a public no argument constructor,</li>
+ * </ol>
+ * the cardinality is a large negative value. Otherwise, the cardinality is
+ * 0.
+ *
+ * @see "The cardinality attribute of the AD element of a Meta Type Resource."
+ */
+ int cardinality() default 0;
+
+ /**
+ * The minimum value for this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, there is no minimum value.
+ *
+ * @see "The min attribute of the AD element of a Meta Type Resource."
+ */
+ String min() default "";
+
+ /**
+ * The maximum value for this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, there is no maximum value.
+ *
+ * @see "The max attribute of the AD element of a Meta Type Resource."
+ */
+ String max() default "";
+
+ /**
+ * The default value for this AttributeDefinition.
+ *
+ * <p>
+ * The specified values are concatenated into a comma delimited list to
+ * become the value of the {@code default} attribute of the generated
+ * {@code AD} element.
+ *
+ * <p>
+ * If not specified and the annotated method is an annotation element that
+ * has a {@code default} value, then the value of this element is the
+ * {@code default} value of the annotated element. Otherwise, there is no
+ * default value.
+ *
+ * @see "The default attribute of the AD element of a Meta Type Resource."
+ */
+ String[] defaultValue() default {};
+
+ /**
+ * The required value for this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, the value is {@code true}.
+ *
+ * @see "The required attribute of the AD element of a Meta Type Resource."
+ */
+ boolean required() default true;
+
+ /**
+ * The option information for this AttributeDefinition.
+ *
+ * <p>
+ * For each specified {@link Option}, an {@code Option} element is generated
+ * for this AttributeDefinition.
+ *
+ * <p>
+ * If not specified, the option information is derived from the return type
+ * of the annotated method. If the return type is an {@code enum}, a single
+ * dimensional array of an {@code enum}, or a {@code List}, {@code Set},
+ * {@code Collection}, {@code Iterable} or some type which can be determined
+ * at annotation processing time to
+ * <ol>
+ * <li>be a subtype of {@code Collection} and</li>
+ * <li>have a public no argument constructor,</li>
+ * </ol>
+ * with a generic type of an {@code enum}, then the value of this element
+ * has an {@link Option} for each value of the {@code enum}. The label and
+ * value of each {@link Option} are set to the name of the corresponding
+ * {@code enum} value. Otherwise, no {@code Option} elements will be
+ * generated.
+ *
+ * @see "The Option element of a Meta Type Resource."
+ */
+ Option[] options() default {};
+}
diff --git a/org/osgi/service/metatype/annotations/AttributeType.java b/org/osgi/service/metatype/annotations/AttributeType.java
new file mode 100644
index 0000000..3a5c6f6
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/AttributeType.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.metatype.annotations;
+
+/**
+ * Attribute types for the {@link AttributeDefinition} annotation.
+ *
+ * @see AttributeDefinition#type()
+ * @author $Id: 9ab62c08937c0f76ba6465cb95e4cd5cf6ca8e8f $
+ */
+public enum AttributeType {
+ /**
+ * The {@code String} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code String},
+ * {@code List<String>} or {@code String[]} objects, depending on the
+ * {@link AttributeDefinition#cardinality() cardinality} value.
+ */
+ STRING("String"),
+
+ /**
+ * The {@code Long} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Long},
+ * {@code List<Long>} or {@code long[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ LONG("Long"),
+
+ /**
+ * The {@code Integer} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Integer},
+ * {@code List<Integer>} or {@code int[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ INTEGER("Integer"),
+
+ /**
+ * The {@code Short} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Short},
+ * {@code List<Short>} or {@code short[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ SHORT("Short"),
+
+ /**
+ * The {@code Character} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Character},
+ * {@code List<Character>} or {@code char[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ CHARACTER("Character"),
+
+ /**
+ * The {@code Byte} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Byte},
+ * {@code List<Byte>} or {@code byte[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ BYTE("Byte"),
+
+ /**
+ * The {@code Double} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Double},
+ * {@code List<Double>} or {@code double[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ DOUBLE("Double"),
+
+ /**
+ * The {@code Float} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Float},
+ * {@code List<Float>} or {@code float[]} objects, depending on the
+ * {@code AttributeDefinition#cardinality() cardinality} value.
+ */
+ FLOAT("Float"),
+
+ /**
+ * The {@code Boolean} type.
+ *
+ * <p>
+ * Attributes of this type should be stored as {@code Boolean},
+ * {@code List<Boolean>} or {@code boolean[]} objects depending on
+ * {@code AttributeDefinition#cardinality() cardinality}.
+ */
+ BOOLEAN("Boolean"),
+
+ /**
+ * The {@code Password} type.
+ *
+ * <p>
+ * Attributes of this type must be stored as {@code String},
+ * {@code List<String>} or {@code String[]} objects depending on
+ * {@link AttributeDefinition#cardinality() cardinality}.
+ *
+ * <p>
+ * A {@code Password} must be treated as a {@code String} but the type can
+ * be used to disguise the information when displayed to a user to prevent
+ * it from being seen.
+ */
+ PASSWORD("Password");
+
+ private final String value;
+
+ AttributeType(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+}
diff --git a/org/osgi/service/metatype/annotations/Designate.java b/org/osgi/service/metatype/annotations/Designate.java
new file mode 100644
index 0000000..175dff6
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/Designate.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.service.metatype.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Generate a {@code Designate} element in the Meta Type Resource for an
+ * {@link ObjectClassDefinition} using the annotated Declarative Services
+ * component.
+ *
+ * <p>
+ * This annotation must be used on a type that is also annotated with the
+ * Declarative Services {@link org.osgi.service.component.annotations.Component
+ * Component} annotation. The component must only have a single PID which is
+ * used for the generated {@code Designate} element.
+ *
+ * <p>
+ * This annotation is not processed at runtime. It must be processed by tools
+ * and used to contribute to a Meta Type Resource document for the bundle.
+ *
+ * @see "The Designate element of a Meta Type Resource."
+ * @author $Id: 99cf054e1e37e4114494d492910fc2a2dc57ab0a $
+ */
+ at Retention(RetentionPolicy.CLASS)
+ at Target(ElementType.TYPE)
+public @interface Designate {
+ /**
+ * The type of the {@link ObjectClassDefinition} for this Designate.
+ *
+ * <p>
+ * The specified type must be annotated with {@link ObjectClassDefinition}.
+ *
+ * @see "The ocdref attribute of the Designate element of a Meta Type Resource."
+ */
+ Class<?> ocd();
+
+ /**
+ * Specifies whether this Designate is for a factory PID.
+ *
+ * <p>
+ * If {@code false}, then the PID value from the annotated component will be
+ * used in the {@code pid} attribute of the generated {@code Designate}
+ * element. If {@code true}, then the PID value from the annotated component
+ * will be used in the {@code factoryPid} attribute of the generated
+ * {@code Designate} element.
+ *
+ * @see "The pid and factoryPid attributes of the Designate element of a Meta Type Resource."
+ */
+ boolean factory() default false;
+}
diff --git a/org/osgi/service/metatype/annotations/Icon.java b/org/osgi/service/metatype/annotations/Icon.java
new file mode 100644
index 0000000..f1cf40c
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/Icon.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.metatype.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * {@code Icon} information for an {@link ObjectClassDefinition}.
+ *
+ * @see ObjectClassDefinition#icon()
+ * @author $Id: e9e89ed20e3fc24a1f1e74324fe2b717ebecad45 $
+ */
+ at Retention(RetentionPolicy.CLASS)
+ at Target({})
+public @interface Icon {
+
+ /**
+ * The resource name for this Icon.
+ *
+ * <p>
+ * The resource is a URL. The resource URL can be relative to the root of
+ * the bundle containing the Meta Type Resource.
+ *
+ * <p>
+ * If the resource begins with the percent sign ({@code '%'} \u0025),
+ * the resource can be {@link ObjectClassDefinition#localization()
+ * localized}.
+ *
+ * @see "The resource attribute of the Icon element of a Meta Type Resource."
+ */
+ String resource();
+
+ /**
+ * The pixel size of this Icon.
+ *
+ * <p>
+ * For example, 32 represents a 32x32 icon.
+ *
+ * @see "The size attribute of the Icon element of a Meta Type Resource."
+ */
+ int size();
+}
diff --git a/org/osgi/service/metatype/annotations/ObjectClassDefinition.java b/org/osgi/service/metatype/annotations/ObjectClassDefinition.java
new file mode 100644
index 0000000..f9ea29c
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/ObjectClassDefinition.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.service.metatype.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Generate a Meta Type Resource using the annotated type.
+ *
+ * <p>
+ * This annotation can be used without defining any element values since
+ * defaults can be generated from the annotated type. Each method of the
+ * annotated type has an implied {@link AttributeDefinition} annotation if not
+ * explicitly annotated.
+ *
+ * <p>
+ * This annotation may only be used on annotation types and interface types. Use
+ * on concrete or abstract class types is unsupported. If applied to an
+ * interface then all methods inherited from super types are included as
+ * attributes.
+ *
+ * <p>
+ * This annotation is not processed at runtime. It must be processed by tools
+ * and used to generate a Meta Type Resource document for the bundle.
+ *
+ * @see "The OCD element of a Meta Type Resource."
+ * @author $Id: fa6a22c95ba6d3a19845177e3b8375c4064ded9a $
+ */
+ at Retention(RetentionPolicy.CLASS)
+ at Target(ElementType.TYPE)
+public @interface ObjectClassDefinition {
+ /**
+ * The id of this ObjectClassDefinition.
+ *
+ * <p>
+ * If not specified, the id of this ObjectClassDefinition is the fully
+ * qualified name of the annotated type using the dollar sign ({@code '$'}
+ * \u0024) to separate nested class names from the name of their
+ * enclosing class. The id is not to be confused with a PID which can be
+ * specified by the {@link #pid()} or {@link #factoryPid()} element.
+ *
+ * @see "The id attribute of the OCD element of a Meta Type Resource."
+ */
+ String id() default "";
+
+ /**
+ * The human readable name of this ObjectClassDefinition.
+ *
+ * <p>
+ * If not specified, the name of this ObjectClassDefinition is derived from
+ * the {@link #id()}. For example, low line ({@code '_'} \u005F) and
+ * dollar sign ({@code '$'} \u0024) are replaced with space ({@code ' '}
+ * \u0020) and space is inserted between camel case words.
+ *
+ * <p>
+ * If the name begins with the percent sign ({@code '%'} \u0025), the
+ * name can be {@link #localization() localized}.
+ *
+ * @see "The name attribute of the OCD element of a Meta Type Resource."
+ */
+ String name() default "";
+
+ /**
+ * The human readable description of this ObjectClassDefinition.
+ *
+ * <p>
+ * If not specified, the description of this ObjectClassDefinition is the
+ * empty string.
+ *
+ * <p>
+ * If the description begins with the percent sign ({@code '%'} \u0025),
+ * the description can be {@link #localization() localized}.
+ *
+ * @see "The description attribute of the OCD element of a Meta Type Resource."
+ */
+ String description() default "";
+
+ /**
+ * The localization resource of this ObjectClassDefinition.
+ *
+ * <p>
+ * This refers to a resource property entry in the bundle that can be
+ * augmented with locale information. If not specified, the localization
+ * resource for this ObjectClassDefinition is the string
+ * "OSGI-INF/l10n/" followed by the {@link #id()}.
+ *
+ * @see "The localization attribute of the MetaData element of a Meta Type Resource."
+ */
+ String localization() default "";
+
+ /**
+ * The PIDs associated with this ObjectClassDefinition.
+ *
+ * <p>
+ * For each specified PID, a {@code Designate} element with a pid attribute
+ * is generated that {@link #id() references} this ObjectClassDefinition.
+ *
+ * <p>
+ * The {@link Designate} annotation can also be used to associate a
+ * Declarative Services component with an ObjectClassDefinition and generate
+ * a {@code Designate} element.
+ *
+ * @see "The pid attribute of the Designate element of a Meta Type Resource."
+ * @see Designate
+ */
+ String[] pid() default {};
+
+ /**
+ * The factory PIDs associated with this ObjectClassDefinition.
+ *
+ * <p>
+ * For each specified factory PID, a {@code Designate} element with a
+ * factoryPid attribute is generated that {@link #id() references} this
+ * ObjectClassDefinition.
+ *
+ * <p>
+ * The {@link Designate} annotation can also be used to associate a
+ * Declarative Services component with an ObjectClassDefinition and generate
+ * a {@code Designate} element.
+ *
+ *
+ * @see "The factoryPid attribute of the Designate element of a Meta Type Resource."
+ * @see Designate
+ */
+ String[] factoryPid() default {};
+
+ /**
+ * The icon resources associated with this ObjectClassDefinition.
+ *
+ * <p>
+ * For each specified {@link Icon}, an {@code Icon} element is generated for
+ * this ObjectClassDefinition. If not specified, no {@code Icon} elements
+ * will be generated.
+ *
+ * @see "The Icon element of a Meta Type Resource."
+ */
+ Icon[] icon() default {};
+}
diff --git a/org/osgi/service/metatype/annotations/Option.java b/org/osgi/service/metatype/annotations/Option.java
new file mode 100644
index 0000000..61c97e3
--- /dev/null
+++ b/org/osgi/service/metatype/annotations/Option.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.metatype.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * {@code Option} information for an {@link AttributeDefinition}.
+ *
+ * @see AttributeDefinition#options()
+ * @author $Id: 62ba7da6da943cb1b3d124a36c9861277c93a740 $
+ */
+ at Retention(RetentionPolicy.CLASS)
+ at Target({})
+public @interface Option {
+
+ /**
+ * The human readable label of this Option.
+ *
+ * <p>
+ * If not specified, the label of this Option is the empty string.
+ *
+ * <p>
+ * If the label begins with the percent sign ({@code '%'} \u0025), the
+ * label can be {@link ObjectClassDefinition#localization() localized}.
+ *
+ * @see "The label attribute of the Option element of a Meta Type Resource."
+ */
+ String label() default "";
+
+ /**
+ * The value of this Option.
+ *
+ * @see "The value attribute of the Option element of a Meta Type Resource."
+ */
+ String value();
+}
diff --git a/org/osgi/service/component/package-info.java b/org/osgi/service/metatype/annotations/package-info.java
similarity index 69%
copy from org/osgi/service/component/package-info.java
copy to org/osgi/service/metatype/annotations/package-info.java
index fa71e71..87e9511 100644
--- a/org/osgi/service/component/package-info.java
+++ b/org/osgi/service/metatype/annotations/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2013). 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,26 +15,28 @@
*/
/**
- * Service Component Package Version 1.2.
+ * Metatype Annotations Package Version 1.3.
*
* <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.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.metatype.annotations; version="[1.3,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.component; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.metatype.annotations; version="[1.3,1.4)"}
*
- * @version 1.2
- * @author $Id: 7ae23aa9383d8a902f757289733bebef44c41a58 $
+ * @author $Id: 0aa9d039f10b307e88417d6ca25579fad58452d6 $
*/
-package org.osgi.service.component;
+ at Version("1.3")
+package org.osgi.service.metatype.annotations;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/service/event/packageinfo b/org/osgi/service/metatype/annotations/packageinfo
similarity index 100%
copy from org/osgi/service/event/packageinfo
copy to org/osgi/service/metatype/annotations/packageinfo
diff --git a/org/osgi/service/metatype/package-info.java b/org/osgi/service/metatype/package-info.java
index a365ab7..125c33d 100644
--- a/org/osgi/service/metatype/package-info.java
+++ b/org/osgi/service/metatype/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,7 +15,7 @@
*/
/**
- * Metatype Package Version 1.2.
+ * Metatype Package Version 1.3.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.metatype; version="[1.2,2.0)"}
+ * {@code Import-Package: org.osgi.service.metatype; version="[1.3,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.metatype; version="[1.2,1.3)"}
+ * {@code Import-Package: org.osgi.service.metatype; version="[1.3,1.4)"}
*
- * @version 1.2
- * @author $Id: 3be55f7d312797b3e8fd1c7dbc47ee1725947caf $
+ * @author $Id: ca1a06007029e90eed59e0e11b015deba717452c $
*/
+ at Version("1.3")
package org.osgi.service.metatype;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/metatype/packageinfo b/org/osgi/service/metatype/packageinfo
index ef7df68..0117a56 100644
--- a/org/osgi/service/metatype/packageinfo
+++ b/org/osgi/service/metatype/packageinfo
@@ -1 +1 @@
-version 1.2
+version 1.3
diff --git a/org/osgi/service/prefs/Preferences.java b/org/osgi/service/prefs/Preferences.java
index bd85f62..eb40d9d 100644
--- a/org/osgi/service/prefs/Preferences.java
+++ b/org/osgi/service/prefs/Preferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2015). 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.
@@ -109,7 +109,7 @@ package org.osgi.service.prefs;
* preference data.
*
* @noimplement
- * @author $Id: faefeec3c75c0a45324035226f71728f69358cd4 $
+ * @author $Id: c4075de1ffb1ccb4b0f7c9f933ed79ef6bc25661 $
*/
public interface Preferences {
/**
@@ -442,7 +442,7 @@ public interface Preferences {
* associated value does not exist or cannot be interpreted as a
* {@code double} type.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the the {@link #removeNode()} method.
+ * removed with the {@link #removeNode()} method.
* @throws NullPointerException if {@code key} is {@code null}.
* @see #putDouble(String,double)
* @see #get(String,String)
diff --git a/org/osgi/service/prefs/package-info.java b/org/osgi/service/prefs/package-info.java
index 1aa84f5..42bf5f3 100644
--- a/org/osgi/service/prefs/package-info.java
+++ b/org/osgi/service/prefs/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,8 +32,8 @@
* <p>
* {@code Import-Package: org.osgi.service.prefs; version="[1.1,1.2)"}
*
- * @version 1.1
- * @author $Id: c213e1585157d63872197eda9aa384a7781fcb84 $
+ * @version 1.1.1
+ * @author $Id: 4d2e6c63b2267f28d8da59f255469e8ddd0437ba $
*/
package org.osgi.service.prefs;
diff --git a/org/osgi/service/provisioning/ProvisioningService.java b/org/osgi/service/provisioning/ProvisioningService.java
index aa42aa9..1d56c40 100644
--- a/org/osgi/service/provisioning/ProvisioningService.java
+++ b/org/osgi/service/provisioning/ProvisioningService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -58,7 +58,7 @@ import java.util.zip.ZipInputStream;
* Dictionary received from {@code getInformation} method.
*
* @noimplement
- * @author $Id: 50e49f069860a3a994a5c0124b613888e95887e0 $
+ * @author $Id: 47510611332882de430d558af19a1056f91ec5f6 $
*/
public interface ProvisioningService {
/**
@@ -115,8 +115,8 @@ public interface ProvisioningService {
public final static String MIME_STRING = "text/plain;charset=utf-8";
/**
- * MIME type to be stored stored in the extra field of a {@code ZipEntry}
- * object for {@code byte[]} data.
+ * MIME type to be stored in the extra field of a {@code ZipEntry} object
+ * for {@code byte[]} data.
*/
public final static String MIME_BYTE_ARRAY = "application/octet-stream";
diff --git a/org/osgi/service/remoteserviceadmin/EndpointDescription.java b/org/osgi/service/remoteserviceadmin/EndpointDescription.java
index 7094097..db32f48 100644
--- a/org/osgi/service/remoteserviceadmin/EndpointDescription.java
+++ b/org/osgi/service/remoteserviceadmin/EndpointDescription.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2015). 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.
@@ -16,13 +16,7 @@
package org.osgi.service.remoteserviceadmin;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_PACKAGE_VERSION_;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS;
-import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -62,7 +56,7 @@ import org.osgi.framework.Version;
* provider. Qualified intents appear fully expanded on this property.
*
* @Immutable
- * @author $Id: 535d484835c708e62f9f52f4facbda354e85664a $
+ * @author $Id: a5371a48ad089d08cafc0792f93b8dfe8be33e43 $
*/
public class EndpointDescription {
@@ -107,10 +101,11 @@ public class EndpointDescription {
interfaces = verifyObjectClassProperty();
serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
- id = verifyStringProperty(ENDPOINT_ID).trim();
- if (id == null) {
+ String endpointId = verifyStringProperty(ENDPOINT_ID);
+ if (endpointId == null) {
throw new IllegalArgumentException(ENDPOINT_ID + " property must be set");
}
+ id = endpointId.trim();
if (getConfigurationTypes().isEmpty()) {
throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS + " property must be set and non-empty");
}
@@ -141,7 +136,7 @@ public class EndpointDescription {
* @throws IllegalArgumentException When the properties are not proper for
* an Endpoint Description
*/
- public EndpointDescription(final ServiceReference reference, final Map<String, ?> properties) {
+ public EndpointDescription(final ServiceReference<?> reference, final Map<String, ?> properties) {
Map<String, Object> props = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
if (properties != null) {
@@ -187,10 +182,11 @@ public class EndpointDescription {
interfaces = verifyObjectClassProperty();
serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
- id = verifyStringProperty(ENDPOINT_ID).trim();
- if (id == null) {
+ String endpointId = verifyStringProperty(ENDPOINT_ID);
+ if (endpointId == null) {
throw new IllegalArgumentException(ENDPOINT_ID + " property must be set");
}
+ id = endpointId.trim();
if (getConfigurationTypes().isEmpty()) {
throw new IllegalArgumentException(SERVICE_IMPORTED_CONFIGS + " property must be set and non-empty");
}
@@ -430,7 +426,7 @@ public class EndpointDescription {
private List<String> getStringPlusProperty(String key) {
Object value = properties.get(key);
if (value == null) {
- return Collections.EMPTY_LIST;
+ return emptyList();
}
if (value instanceof String) {
@@ -460,17 +456,22 @@ public class EndpointDescription {
return Collections.unmodifiableList(result);
}
+ return emptyList();
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> List<T> emptyList() {
return Collections.EMPTY_LIST;
}
/**
* Return the framework UUID for the remote service, if present.
*
- * The value of the remote framework uuid is stored in the
+ * The value of the remote framework UUID is stored in the
* {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID} endpoint property.
*
* @return Remote Framework UUID, or {@code null} if this endpoint is not
- * associated with an OSGi framework having a framework uuid.
+ * associated with an OSGi framework having a framework UUID.
*/
public String getFrameworkUUID() {
return frameworkUUID;
@@ -514,6 +515,7 @@ public class EndpointDescription {
*
* @return An integer which is a hash code value for this object.
*/
+ @Override
public int hashCode() {
return getId().hashCode();
}
@@ -529,6 +531,7 @@ public class EndpointDescription {
* @return {@code true} if {@code object} is a {@code EndpointDescription}
* and is equal to this object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object other) {
if (this == other) {
return true;
@@ -572,6 +575,7 @@ public class EndpointDescription {
*
* @return String form of this EndpointDescription.
*/
+ @Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append('{');
@@ -632,34 +636,42 @@ public class EndpointDescription {
this.wrapped = wrapped;
}
+ @Override
public Enumeration<V> elements() {
return Collections.enumeration(wrapped.values());
}
+ @Override
public V get(Object key) {
return wrapped.get(key);
}
+ @Override
public boolean isEmpty() {
return wrapped.isEmpty();
}
+ @Override
public Enumeration<K> keys() {
return Collections.enumeration(wrapped.keySet());
}
+ @Override
public V put(K key, V value) {
throw new UnsupportedOperationException();
}
+ @Override
public V remove(Object key) {
throw new UnsupportedOperationException();
}
+ @Override
public int size() {
return wrapped.size();
}
+ @Override
public String toString() {
return wrapped.toString();
}
diff --git a/org/osgi/service/remoteserviceadmin/EndpointEvent.java b/org/osgi/service/remoteserviceadmin/EndpointEvent.java
new file mode 100644
index 0000000..3a78104
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/EndpointEvent.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.remoteserviceadmin;
+
+/**
+ * An Endpoint Event.
+ * <p/>
+ *
+ * {@code EndpointEvent} objects are delivered to all registered
+ * {@link EndpointEventListener} services where the {@link EndpointDescription}
+ * properties match one of the filters specified in the
+ * {@link EndpointEventListener#ENDPOINT_LISTENER_SCOPE} registration properties
+ * of the Endpoint Event Listener.
+ * <p/>
+ *
+ * A type code is used to identify the type of event. The following event types
+ * are defined:
+ * <ul>
+ * <li>{@link #ADDED}</li>
+ * <li>{@link #REMOVED}</li>
+ * <li>{@link #MODIFIED}</li>
+ * <li>{@link #MODIFIED_ENDMATCH}</li>
+ * </ul>
+ * Additional event types may be defined in the future.
+ * <p/>
+ *
+ * @see EndpointEventListener
+ * @Immutable
+ * @since 1.1
+ */
+public class EndpointEvent {
+ /**
+ * An endpoint has been added.
+ * <p/>
+ *
+ * This {@code EndpointEvent} type indicates that a new endpoint has been
+ * added. The endpoint is represented by the associated
+ * {@link EndpointDescription} object.
+ */
+ public static final int ADDED = 0x00000001;
+
+ /**
+ * An endpoint has been removed.
+ * <p/>
+ *
+ * This {@code EndpointEvent} type indicates that an endpoint has been
+ * removed. The endpoint is represented by the associated
+ * {@link EndpointDescription} object.
+ */
+ public static final int REMOVED = 0x00000002;
+
+ /**
+ * The properties of an endpoint have been modified.
+ * <p/>
+ *
+ * This {@code EndpointEvent} type indicates that the properties of an
+ * existing endpoint have been modified. The endpoint is represented by the
+ * associated {@link EndpointDescription} object and its properties can be
+ * obtained via {@link EndpointDescription#getProperties()}. The endpoint
+ * properties still match the filters as specified in the
+ * {@link EndpointEventListener#ENDPOINT_LISTENER_SCOPE} filter.
+ */
+ public static final int MODIFIED = 0x00000004;
+
+ /**
+ * The properties of an endpoint have been modified and the new properties
+ * no longer match the listener's filter.
+ * <p/>
+ *
+ * This {@code EndpointEvent} type indicates that the properties of an
+ * existing endpoint have been modified and no longer match the filter. The
+ * endpoint is represented by the associated {@link EndpointDescription}
+ * object and its properties can be obtained via
+ * {@link EndpointDescription#getProperties()}. As a consequence of the
+ * modification the filters as specified in the
+ * {@link EndpointEventListener#ENDPOINT_LISTENER_SCOPE} do not match any
+ * more.
+ */
+ public static final int MODIFIED_ENDMATCH = 0x00000008;
+
+ /**
+ * Reference to the associated endpoint description.
+ */
+ private final EndpointDescription endpoint;
+
+ /**
+ * Type of the event.
+ */
+ private final int type;
+
+ /**
+ * Constructs a {@code EndpointEvent} object from the given arguments.
+ *
+ * @param type The event type. See {@link #getType()}.
+ * @param endpoint The endpoint associated with the event.
+ */
+ public EndpointEvent(int type, EndpointDescription endpoint) {
+ this.endpoint = endpoint;
+ this.type = type;
+ }
+
+ /**
+ * Return the endpoint associated with this event.
+ *
+ * @return The endpoint associated with the event.
+ */
+ public EndpointDescription getEndpoint() {
+ return endpoint;
+ }
+
+ /**
+ * Return the type of this event.
+ * <p/>
+ * The type values are:
+ * <ul>
+ * <li>{@link #ADDED}</li>
+ * <li>{@link #REMOVED}</li>
+ * <li>{@link #MODIFIED}</li>
+ * <li>{@link #MODIFIED_ENDMATCH}</li>
+ * </ul>
+ *
+ * @return The type of this event.
+ */
+ public int getType() {
+ return type;
+ }
+}
diff --git a/org/osgi/service/remoteserviceadmin/EndpointEventListener.java b/org/osgi/service/remoteserviceadmin/EndpointEventListener.java
new file mode 100644
index 0000000..738b446
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/EndpointEventListener.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.remoteserviceadmin;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * A white board service that represents a listener for endpoints.
+ *
+ * An Endpoint Event Listener represents a participant in the distributed model
+ * that is interested in Endpoint Descriptions.
+ *
+ * This white board service can be used in many different scenarios. However,
+ * the primary use case is to allow a remote manager to be informed of Endpoint
+ * Descriptions available in the network and inform the network about available
+ * Endpoint Descriptions.
+ *
+ * Both the network bundle and the manager bundle register an Endpoint Event
+ * Listener service. The manager informs the network bundle about Endpoints that
+ * it creates. The network bundles then uses a protocol like SLP to announce
+ * these local end-points to the network.
+ *
+ * If the network bundle discovers a new Endpoint through its discovery
+ * protocol, then it sends an Endpoint Description to all the Endpoint Listener
+ * services that are registered (except its own) that have specified an interest
+ * in that endpoint.
+ *
+ * Endpoint Event Listener services can express their <i>scope</i> with the
+ * service property {@link #ENDPOINT_LISTENER_SCOPE}. This service property is a
+ * list of filters. An Endpoint Description should only be given to a Endpoint
+ * Event Listener when there is at least one filter that matches the Endpoint
+ * Description properties.
+ *
+ * This filter model is quite flexible. For example, a discovery bundle is only
+ * interested in locally originating Endpoint Descriptions. The following filter
+ * ensures that it only sees local endpoints.
+ *
+ * <pre>
+ * (org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72)
+ * </pre>
+ *
+ * In the same vein, a manager that is only interested in remote Endpoint
+ * Descriptions can use a filter like:
+ *
+ * <pre>
+ * (!(org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72))
+ * </pre>
+ *
+ * Where in both cases, the given UUID is the UUID of the local framework that
+ * can be found in the Framework properties.
+ *
+ * The Endpoint Event Listener's scope maps very well to the service hooks. A
+ * manager can just register all filters found from the Listener Hook as its
+ * scope. This will automatically provide it with all known endpoints that match
+ * the given scope, without having to inspect the filter string.
+ *
+ * In general, when an Endpoint Description is discovered, it should be
+ * dispatched to all registered Endpoint Event Listener services. If a new
+ * Endpoint Event Listener is registered, it should be informed about all
+ * currently known Endpoints that match its scope. If a getter of the Endpoint
+ * Listener service is unregistered, then all its registered Endpoint
+ * Description objects must be removed.
+ *
+ * The Endpoint Event Listener models a <i>best effort</i> approach.
+ * Participating bundles should do their utmost to keep the listeners up to
+ * date, but implementers should realize that many endpoints come through
+ * unreliable discovery processes.
+ *
+ * The Endpoint Event Listener supersedes the {@link EndpointListener} interface
+ * as it also supports notifications around modifications of endpoints.
+ *
+ * @ThreadSafe
+ * @since 1.1
+ */
+ at ConsumerType
+public interface EndpointEventListener {
+ /**
+ * Specifies the interest of this listener with filters. This listener is
+ * only interested in Endpoint Descriptions where its properties match the
+ * given filter. The type of this property must be {@code String+}.
+ */
+ String ENDPOINT_LISTENER_SCOPE = "endpoint.listener.scope";
+
+ /**
+ * Notification that an endpoint has changed.
+ *
+ * Details of the change is captured in the Endpoint Event provided. This
+ * could be that an endpoint was added, removed or modified.
+ *
+ * @param event The event containing the details about the change.
+ * @param filter The filter from the {@link #ENDPOINT_LISTENER_SCOPE} that
+ * matches (or for {@link EndpointEvent#MODIFIED_ENDMATCH} and
+ * {@link EndpointEvent#REMOVED} used to match) the endpoint, must
+ * not be {@code null}.
+ */
+ void endpointChanged(EndpointEvent event, String filter);
+}
diff --git a/org/osgi/service/remoteserviceadmin/EndpointListener.java b/org/osgi/service/remoteserviceadmin/EndpointListener.java
index 968303c..add4f20 100644
--- a/org/osgi/service/remoteserviceadmin/EndpointListener.java
+++ b/org/osgi/service/remoteserviceadmin/EndpointListener.java
@@ -16,12 +16,19 @@
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
- * A white board service that represents a listener for endpoints.
+ * Deprecated white board service that represents a listener for endpoints.
*
* An Endpoint Listener represents a participant in the distributed model that
* is interested in Endpoint Descriptions.
*
+ * The Endpoint Listener is called back when matching endpoints are added or
+ * removed. Consumers interested in the modification of endpoints, when
+ * associated service properties are changed, should use an
+ * {@link EndpointEventListener} instead.
+ *
* This white board service can be used in many different scenarios. However,
* the primary use case is to allow a remote manager to be informed of Endpoint
* Descriptions available in the network and inform the network about available
@@ -79,8 +86,10 @@ package org.osgi.service.remoteserviceadmin;
* discovery processes.
*
* @ThreadSafe
- * @author $Id: 2749054493a841c445c5b0006a0d002fa48bf3a1 $
+ * @deprecated As of 1.1. Replaced by EndpointEventListener.
+ * @author $Id: c3888f065479eba89af59c52eb1c29b319097397 $
*/
+ at ConsumerType
public interface EndpointListener {
/**
* Specifies the interest of this listener with filters. This listener is
diff --git a/org/osgi/service/remoteserviceadmin/EndpointPermission.java b/org/osgi/service/remoteserviceadmin/EndpointPermission.java
index 9b215fe..441e42f 100644
--- a/org/osgi/service/remoteserviceadmin/EndpointPermission.java
+++ b/org/osgi/service/remoteserviceadmin/EndpointPermission.java
@@ -54,7 +54,7 @@ import org.osgi.framework.InvalidSyntaxException;
* {@code EndpointPermission} to read the specific service.
*
* @ThreadSafe
- * @author $Id: 60ecb3f4ed224d9dc02c95ee9ce4e4786b4ff126 $
+ * @author $Id: bce27511ebaee16bccf0e7dbb5a12986958e9e88 $
*/
public final class EndpointPermission extends Permission {
@@ -327,6 +327,7 @@ public final class EndpointPermission extends Permission {
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof EndpointPermission)) {
return false;
@@ -376,6 +377,7 @@ public final class EndpointPermission extends Permission {
*
* @return The canonical string representation of the actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -413,6 +415,7 @@ public final class EndpointPermission extends Permission {
* @return A new {@code PermissionCollection} object suitable for storing
* {@code EndpointPermission} objects.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new EndpointPermissionCollection();
}
@@ -428,6 +431,7 @@ public final class EndpointPermission extends Permission {
* name, actions and endpoint as this {@code EndpointPermission}
* object; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -447,6 +451,7 @@ public final class EndpointPermission extends Permission {
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -534,6 +539,7 @@ final class EndpointPermissionCollection extends PermissionCollection {
* @throws SecurityException If this {@code EndpointPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(final Permission permission) {
if (!(permission instanceof EndpointPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -579,6 +585,7 @@ final class EndpointPermissionCollection extends PermissionCollection {
* @return {@code true} if {@code permission} is a proper subset of a
* permission in the set; {@code false} otherwise.
*/
+ @Override
public boolean implies(final Permission permission) {
if (!(permission instanceof EndpointPermission)) {
return false;
@@ -620,6 +627,7 @@ final class EndpointPermissionCollection extends PermissionCollection {
*
* @return Enumeration of all the EndpointPermission objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -637,7 +645,9 @@ final class EndpointPermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- permissions = (HashMap<String, EndpointPermission>) gfields.get("permissions", new HashMap<String, EndpointPermission>());
+ @SuppressWarnings("unchecked")
+ HashMap<String, EndpointPermission> p = (HashMap<String, EndpointPermission>) gfields.get("permissions", new HashMap<String, EndpointPermission>());
+ permissions = p;
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/org/osgi/service/remoteserviceadmin/ExportReference.java b/org/osgi/service/remoteserviceadmin/ExportReference.java
index d169b20..35347eb 100644
--- a/org/osgi/service/remoteserviceadmin/ExportReference.java
+++ b/org/osgi/service/remoteserviceadmin/ExportReference.java
@@ -16,6 +16,7 @@
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.ServiceReference;
/**
@@ -25,9 +26,9 @@ import org.osgi.framework.ServiceReference;
* service is no longer exported, all methods must return {@code null}.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: e5e04f861e76c575accaf34089ca0ec7deb004a2 $
+ * @author $Id: c6b452b40c0356b3c5a9f4b0a1e0654512733494 $
*/
+ at ProviderType
public interface ExportReference {
/**
* Return the service being exported.
@@ -35,7 +36,7 @@ public interface ExportReference {
* @return The service being exported. Must be {@code null} when the service
* is no longer exported.
*/
- ServiceReference getExportedService();
+ ServiceReference<?> getExportedService();
/**
* Return the Endpoint Description for the local endpoint.
diff --git a/org/osgi/service/remoteserviceadmin/ExportRegistration.java b/org/osgi/service/remoteserviceadmin/ExportRegistration.java
index 5fb2c70..776547c 100644
--- a/org/osgi/service/remoteserviceadmin/ExportRegistration.java
+++ b/org/osgi/service/remoteserviceadmin/ExportRegistration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2014). 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.remoteserviceadmin;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.ServiceReference;
/**
@@ -30,20 +31,58 @@ import org.osgi.framework.ServiceReference;
* {@code null}.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 64285705bd33387e990c67c3555f9d80e8a7bfb9 $
+ * @author $Id: 322d7ced307aa3ec6bf05041e1a50375e0763722 $
*/
+ at ProviderType
public interface ExportRegistration {
/**
* Return the Export Reference for the exported service.
*
- * @return The Export Reference for this registration.
+ * @return The Export Reference for this registration, or <code>null</code>
+ * if this Import Registration is closed.
* @throws IllegalStateException When this registration was not properly
* initialized. See {@link #getException()}.
*/
ExportReference getExportReference();
/**
+ * Update the endpoint represented by this {@link ExportRegistration} and
+ * return an updated {@link EndpointDescription}. If this method returns an
+ * updated {@link EndpointDescription}, then the object returned via
+ * {@link #getExportReference()} must also have been updated to return this
+ * new object. If this method does not return an updated
+ * {@link EndpointDescription} then the object returned via
+ * {@link #getExportReference()} should remain unchanged.
+ *
+ * When creating the updated {@link EndpointDescription} the
+ * {@link ServiceReference} originally passed to
+ * {@link RemoteServiceAdmin#exportService(ServiceReference, Map)} must be
+ * queried to pick up any changes to its service properties.
+ *
+ * If this argument is null then the original properties passed when
+ * creating this ExportRegistration should be used when constructing the
+ * updated {@link EndpointDescription}. Otherwise the new properties should
+ * be used, and replace the original properties for subsequent calls to the
+ * update method.
+ *
+ * @param properties properties to be merged with the current service
+ * properties for the {@link ServiceReference} represented by this
+ * {@link ExportRegistration}. If null is passed then the original
+ * properties passed to
+ * {@link RemoteServiceAdmin#exportService(ServiceReference, Map)}
+ * will be used.
+ * @return The updated {@link EndpointDescription} for this registration or
+ * null if there was a failure updating the endpoint. If a failure
+ * occurs then it can be accessed using {@link #getException()}.
+ * @throws IllegalStateException If this registration is closed, or when
+ * this registration was not properly initialized. See
+ * {@link #getException()}.
+ *
+ * @since 1.1
+ */
+ EndpointDescription update(Map<String, ?> properties);
+
+ /**
* Delete the local endpoint and disconnect any remote distribution
* providers. After this method returns, all methods must return
* {@code null}.
diff --git a/org/osgi/service/remoteserviceadmin/ImportReference.java b/org/osgi/service/remoteserviceadmin/ImportReference.java
index 829e251..2e4e258 100644
--- a/org/osgi/service/remoteserviceadmin/ImportReference.java
+++ b/org/osgi/service/remoteserviceadmin/ImportReference.java
@@ -16,6 +16,7 @@
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.ServiceReference;
/**
@@ -25,9 +26,9 @@ import org.osgi.framework.ServiceReference;
* service is no longer imported, all methods must return {@code null}.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 6520fe480629836e0b4c77e9cac6d3a32ebc9be0 $
+ * @author $Id: e94afd28cf670b9558aed85f5345e798746aa902 $
*/
+ at ProviderType
public interface ImportReference {
/**
* Return the Service Reference for the proxy for the endpoint.
@@ -35,7 +36,7 @@ public interface ImportReference {
* @return The Service Reference to the proxy for the endpoint. Must be
* {@code null} when the service is no longer imported.
*/
- ServiceReference getImportedService();
+ ServiceReference<?> getImportedService();
/**
* Return the Endpoint Description for the remote endpoint.
diff --git a/org/osgi/service/remoteserviceadmin/ImportRegistration.java b/org/osgi/service/remoteserviceadmin/ImportRegistration.java
index c65091f..1475550 100644
--- a/org/osgi/service/remoteserviceadmin/ImportRegistration.java
+++ b/org/osgi/service/remoteserviceadmin/ImportRegistration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2014). 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.
@@ -16,6 +16,8 @@
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.ProviderType;
+
/**
* An Import Registration associates an active proxy service to a remote
* endpoint.
@@ -28,20 +30,42 @@ package org.osgi.service.remoteserviceadmin;
* {@code null}.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: dfb4c09f4398cc377c7cdabd1c3a01ca2094199f $
+ * @author $Id: 4dfea3f10524d18ba3b46176b9df33e7de0e7176 $
*/
+ at ProviderType
public interface ImportRegistration {
/**
* Return the Import Reference for the imported service.
*
- * @return The Import Reference for this registration.
+ * @return The Import Reference for this registration, or <code>null</code>
+ * if this Import Registration is closed.
* @throws IllegalStateException When this registration was not properly
* initialized. See {@link #getException()}.
*/
ImportReference getImportReference();
/**
+ * Update the local service represented by this {@link ImportRegistration}.
+ * After this method returns the {@link EndpointDescription} returned via
+ * {@link #getImportReference()} must have been updated.
+ *
+ * @param endpoint The updated endpoint
+ *
+ * @return <code>true</code> if the endpoint was successfully updated,
+ * <code>false</code> otherwise. If the update fails then the
+ * failure can be retrieved from {@link #getException()}.
+ *
+ * @throws IllegalStateException When this registration is closed, or if it
+ * was not properly initialized. See {@link #getException()}.
+ * @throws IllegalArgumentException When the supplied
+ * {@link EndpointDescription} does not represent the same endpoint
+ * as this {@link ImportRegistration}.
+ *
+ * @since 1.1
+ */
+ boolean update(EndpointDescription endpoint);
+
+ /**
* Close this Import Registration. This must close the connection to the
* endpoint and unregister the proxy. After this method returns, all other
* methods must return {@code null}.
diff --git a/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java b/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
index 621e8e7..4c82520 100644
--- a/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
+++ b/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2015). 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.
@@ -18,6 +18,7 @@ package org.osgi.service.remoteserviceadmin;
import java.util.Collection;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.ServiceReference;
/**
@@ -30,9 +31,9 @@ import org.osgi.framework.ServiceReference;
* and find out about the current imports and exports.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: b80a55cef13e0c0af6782d364f70f953f4dbbe53 $
+ * @author $Id: 49d931591212a8f81060c6721589fd058374f11e $
*/
+ at ProviderType
public interface RemoteServiceAdmin {
/**
@@ -70,18 +71,19 @@ public interface RemoteServiceAdmin {
* specified Service Reference and properties. Multiple Export
* Registrations may be returned because a single service can be
* exported to multiple Endpoints depending on the available
- * configuration type properties. The result is never {@code null}
- * but may be empty if this Remove Service Admin does not recognize
- * any of the configuration types.
- * @throws IllegalArgumentException If any of the properties has a value
- * that is not syntactically correct or if the service properties
- * and the overlaid properties do not contain a
- * {@link RemoteConstants#SERVICE_EXPORTED_INTERFACES} entry.
- * @throws UnsupportedOperationException If any of the intents expressed
- * through the properties is not supported by the distribution
- * provider.
+ * configuration type properties and the intents that they support.
+ * The result is never {@code null} but may be empty if this Remove
+ * Service Admin does not recognize any of the configuration types,
+ * or if they Remote Service Admin cannot support the relevant
+ * intents.
+ * @throws IllegalArgumentException If any of the properties for this
+ * configuration type has a value that is not syntactically correct,
+ * or if the service properties and the overlaid properties do not
+ * contain a {@link RemoteConstants#SERVICE_EXPORTED_INTERFACES}
+ * entry. This means that implementations must not ignore invalid
+ * values for property names that they recognize.
*/
- Collection<ExportRegistration> exportService(ServiceReference reference, Map<String, ?> properties);
+ Collection<ExportRegistration> exportService(ServiceReference<?> reference, Map<String, ?> properties);
/**
* Import a service from an Endpoint. The Remote Service Admin must use the
diff --git a/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java b/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java
index c0ec222..1ee1e03 100644
--- a/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java
+++ b/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2015). 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,36 +22,36 @@ import org.osgi.framework.Bundle;
* Provides the event information for a Remote Service Admin event.
*
* @Immutable
- * @author $Id: 1162a4c558a7b4424ae05864767cf7877789d2da $
+ * @author $Id: a2eb40665605a6955a0109d0eaf48773498eb027 $
*/
public class RemoteServiceAdminEvent {
/**
- * Add an import registration. The Remote Service Admin will call this
- * method when it imports a service. When this service is registered, the
- * Remote Service Admin must notify the listener of all existing Import
- * Registrations.
+ * Add an import registration. The Remote Service Admin will send this event
+ * when it imports a service. When the {@link RemoteServiceAdminListener}
+ * service is registered, the Remote Service Admin must notify the listener
+ * of all existing Import Registrations.
*
*/
public static final int IMPORT_REGISTRATION = 1;
/**
- * Add an export registration. The Remote Service Admin will call this
- * method when it exports a service. When this service is registered, the
- * Remote Service Admin must notify the listener of all existing Export
- * Registrations.
+ * Add an export registration. The Remote Service Admin will send this event
+ * when it exports a service. When the {@link RemoteServiceAdminListener}
+ * service is registered, the Remote Service Admin must notify the listener
+ * of all existing Export Registrations.
*/
public static final int EXPORT_REGISTRATION = 2;
/**
- * Remove an export registration. The Remote Service Admin will call this
- * method when it removes the export of a service.
+ * Remove an export registration. The Remote Service Admin will send this
+ * event when it removes the export of a service.
*
*/
public static final int EXPORT_UNREGISTRATION = 3;
/**
- * Remove an import registration. The Remote Service Admin will call this
- * method when it removes the import of a service.
+ * Remove an import registration. The Remote Service Admin will send this
+ * event when it removes the import of a service.
*
*/
public static final int IMPORT_UNREGISTRATION = 4;
@@ -77,6 +77,22 @@ public class RemoteServiceAdminEvent {
*/
public static final int IMPORT_WARNING = 8;
+ /**
+ * Update an import registration. The Remote Service Admin will send this
+ * event when it updates a service.
+ *
+ * @since 1.1
+ */
+ public static final int IMPORT_UPDATE = 9;
+
+ /**
+ * Update an export registration. The Remote Service Admin will send this
+ * event when it exports a service.
+ *
+ * @since 1.1
+ */
+ public static final int EXPORT_UPDATE = 10;
+
private final ImportReference importReference;
private final ExportReference exportReference;
private final Throwable exception;
diff --git a/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java b/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
index c3ab451..54c0ebe 100644
--- a/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
+++ b/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
@@ -16,6 +16,8 @@
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.ConsumerType;
+
/**
* A {@link RemoteServiceAdminEvent} listener is notified synchronously of any
* export or import registrations and unregistrations.
@@ -30,9 +32,9 @@ package org.osgi.service.remoteserviceadmin;
*
* @see RemoteServiceAdminEvent
* @ThreadSafe
- * @author $Id: d67af164f7d89d6237f71dba09aedc21ac4d72ba $
+ * @author $Id: c5c7ce06a2f2964f5821c764cb99c21607263b6a $
*/
-
+ at ConsumerType
public interface RemoteServiceAdminListener {
/**
* Receive notification of any export or import registrations and
diff --git a/org/osgi/service/remoteserviceadmin/namespace/DiscoveryNamespace.java b/org/osgi/service/remoteserviceadmin/namespace/DiscoveryNamespace.java
new file mode 100644
index 0000000..788f86f
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/namespace/DiscoveryNamespace.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.service.remoteserviceadmin.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Remote Services Discovery Provider Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace.
+ *
+ * @Immutable
+ * @author $Id: f6542b65b245aec17bbe3a9770e389771bc60df2 $
+ */
+public final class DiscoveryNamespace extends Namespace {
+
+ /**
+ * Namespace name for Remote Services discovery provider capabilities and
+ * requirements.
+ */
+ public static final String DISCOVERY_NAMESPACE = "osgi.remoteserviceadmin.discovery";
+
+ /**
+ * The capability attribute used to specify the discovery protocols
+ * supported by this discovery provider. The value of this attribute must be
+ * of type {@code String} or {@code List<String>}.
+ */
+ public static final String CAPABILITY_PROTOCOLS_ATTRIBUTE = "protocols";
+
+ private DiscoveryNamespace() {
+ // empty
+ }
+}
diff --git a/org/osgi/service/remoteserviceadmin/namespace/DistributionNamespace.java b/org/osgi/service/remoteserviceadmin/namespace/DistributionNamespace.java
new file mode 100644
index 0000000..fd04265
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/namespace/DistributionNamespace.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.service.remoteserviceadmin.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Remote Services Distribution Provider Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace.
+ *
+ * @Immutable
+ * @author $Id: e87df13b4a2cc069621bf286945b66eac1ab072b $
+ */
+public final class DistributionNamespace extends Namespace {
+
+ /**
+ * Namespace name for Remote Services distribution provider capabilities and
+ * requirements.
+ */
+ public static final String DISTRIBUTION_NAMESPACE = "osgi.remoteserviceadmin.distribution";
+
+ /**
+ * The capability attribute used to specify the config types supported by
+ * this distribution provider. The value of this attribute must be of type
+ * {@code String} or {@code List<String>}.
+ */
+ public static final String CAPABILITY_CONFIGS_ATTRIBUTE = "configs";
+
+ private DistributionNamespace() {
+ // empty
+ }
+}
diff --git a/org/osgi/service/remoteserviceadmin/namespace/TopologyNamespace.java b/org/osgi/service/remoteserviceadmin/namespace/TopologyNamespace.java
new file mode 100644
index 0000000..98137e4
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/namespace/TopologyNamespace.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.service.remoteserviceadmin.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Remote Services Topology Manager Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace.
+ *
+ * @Immutable
+ * @author $Id: de8a882b8294162d9ab573ee1debe8bb038c0246 $
+ */
+public final class TopologyNamespace extends Namespace {
+
+ /**
+ * Namespace name for Remote Services topology manager capabilities and
+ * requirements.
+ */
+ public static final String TOPOLOGY_NAMESPACE = "osgi.remoteserviceadmin.topology";
+
+ /**
+ * The capability attribute used to specify the policy or policies supported
+ * by this topology manager. The value of this attribute must be of type
+ * {@code String} or {@code List<String>}. Policy names are typically
+ * implementation specific, however the Remote Services Specification
+ * defines the <em>promiscuous</em> and <em>fail-over</em> policies for
+ * common use cases.
+ */
+ public static final String CAPABILITY_POLICY_ATTRIBUTE = "policy";
+
+ /**
+ * The attribute value for Topology managers with a promiscuous policy
+ *
+ * @see TopologyNamespace#CAPABILITY_POLICY_ATTRIBUTE
+ */
+ public static final String PROMISCUOUS_POLICY = "promiscuous";
+
+ /**
+ * The attribute value for Topology managers with a fail-over policy
+ *
+ * @see TopologyNamespace#CAPABILITY_POLICY_ATTRIBUTE
+ */
+ public static final String FAIL_OVER_POLICY = "fail-over";
+
+ private TopologyNamespace() {
+ // empty
+ }
+}
diff --git a/org/osgi/namespace/contract/package-info.java b/org/osgi/service/remoteserviceadmin/namespace/package-info.java
similarity index 73%
copy from org/osgi/namespace/contract/package-info.java
copy to org/osgi/service/remoteserviceadmin/namespace/package-info.java
index 65bc68f..8308207 100644
--- a/org/osgi/namespace/contract/package-info.java
+++ b/org/osgi/service/remoteserviceadmin/namespace/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014). 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,7 +15,7 @@
*/
/**
- * Contract Namespace Package Version 1.0.
+ * Remote Service Admin Namespaces Version 1.0.
*
* <p>
* Bundles should not need to import this package at runtime since all
@@ -23,8 +23,11 @@
* requirement namespaces specified by the OSGi Alliance.
*
* @version 1.0
- * @author $Id: 7f138e3ac58ce6b65c444fd7e035c4756ff4e657 $
+ * @author $Id: 5318b11c8b12656e33f6dc42b410c8d7cce69b3b $
*/
-package org.osgi.namespace.contract;
+ at Version("1.0.0")
+package org.osgi.service.remoteserviceadmin.namespace;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/service/remoteserviceadmin/namespace/packageinfo b/org/osgi/service/remoteserviceadmin/namespace/packageinfo
new file mode 100644
index 0000000..9ad81f6
--- /dev/null
+++ b/org/osgi/service/remoteserviceadmin/namespace/packageinfo
@@ -0,0 +1 @@
+version 1.0.0
diff --git a/org/osgi/service/remoteserviceadmin/package-info.java b/org/osgi/service/remoteserviceadmin/package-info.java
index e2d15c5..f05fa44 100644
--- a/org/osgi/service/remoteserviceadmin/package-info.java
+++ b/org/osgi/service/remoteserviceadmin/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,7 +15,7 @@
*/
/**
- * Remote Service Admin Package Version 1.0.
+ * Remote Service Admin Package Version 1.1.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,18 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.1,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.0,1.1)"}
+ * {@code Import-Package: org.osgi.service.remoteserviceadmin; version="[1.1,1.2)"}
*
- * @version 1.0
- * @author $Id: 36efdee7e86d53c3f063fef7ef827b78df06c9c8 $
+ * @version 1.1
+ * @author $Id: 0581bb37a078f9e6e76f04e1db32b1734fd0db7e $
*/
+ at Version("1.1.0")
package org.osgi.service.remoteserviceadmin;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/remoteserviceadmin/packageinfo b/org/osgi/service/remoteserviceadmin/packageinfo
index b3d1f97..e39f616 100644
--- a/org/osgi/service/remoteserviceadmin/packageinfo
+++ b/org/osgi/service/remoteserviceadmin/packageinfo
@@ -1 +1 @@
-version 1.0.1
+version 1.1.0
diff --git a/org/osgi/service/repository/AndExpression.java b/org/osgi/service/repository/AndExpression.java
new file mode 100644
index 0000000..10b6300
--- /dev/null
+++ b/org/osgi/service/repository/AndExpression.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.repository;
+
+import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * A {@link RequirementExpression} representing the {@code and} of a number of
+ * requirement expressions.
+ *
+ * @ThreadSafe
+ * @since 1.1
+ */
+ at ProviderType
+public interface AndExpression extends RequirementExpression {
+ /**
+ * Return the requirement expressions that are combined by this
+ * {@code AndExpression}.
+ *
+ * @return An unmodifiable list of requirement expressions that are combined
+ * by this {@code AndExpression}. The list contains the requirement
+ * expressions in the order they were specified when this
+ * requirement expression was created.
+ */
+ List<RequirementExpression> getRequirementExpressions();
+}
diff --git a/org/osgi/service/repository/ExpressionCombiner.java b/org/osgi/service/repository/ExpressionCombiner.java
new file mode 100644
index 0000000..9dc8246
--- /dev/null
+++ b/org/osgi/service/repository/ExpressionCombiner.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.repository;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.resource.Requirement;
+
+/**
+ * An {@code ExpressionCombiner} can be used to combine requirement expressions
+ * into a single complex requirement expression using the {@code and},
+ * {@code or} and {@code not} operators.
+ *
+ * @ThreadSafe
+ * @since 1.1
+ */
+ at ProviderType
+public interface ExpressionCombiner {
+ /**
+ * Combine two {@link RequirementExpression}s into a requirement expression
+ * using the {@code and} operator.
+ *
+ * @param expr1 The first requirement expression to combine into the
+ * returned requirement expression.
+ * @param expr2 The second requirement expression to combine into the
+ * returned requirement expression
+ * @return An {@link AndExpression} representing an {@code and} of the
+ * specified requirement expressions.
+ */
+ AndExpression and(RequirementExpression expr1, RequirementExpression expr2);
+
+ /**
+ * Combine multiple {@link RequirementExpression}s into a requirement
+ * expression using the {@code and} operator.
+ *
+ * @param expr1 The first requirement expression to combine into the
+ * returned requirement expression.
+ * @param expr2 The second requirement expression to combine into the
+ * returned requirement expression
+ * @param moreExprs Optional, additional requirement expressions to combine
+ * into the returned requirement expression.
+ * @return An {@link AndExpression} representing an {@code and} of the
+ * specified requirement expressions.
+ */
+ AndExpression and(RequirementExpression expr1, RequirementExpression expr2, RequirementExpression... moreExprs);
+
+ /**
+ * Wrap a {@link Requirement} in an {@link IdentityExpression}. This can be
+ * useful when working with a combination of {@code Requirement}s and
+ * {@code RequirementExpresion}s.
+ *
+ * @param req The requirement to wrap in a requirement expression.
+ * @return An {@link IdentityExpression} representing the specified
+ * requirement.
+ */
+ IdentityExpression identity(Requirement req);
+
+ /**
+ * Return the negation of a {@link RequirementExpression}.
+ *
+ * @param expr The requirement expression to negate.
+ * @return A {@link NotExpression} representing the {@code not} of the
+ * specified requirement expression.
+ */
+ NotExpression not(RequirementExpression expr);
+
+ /**
+ * Combine two {@link RequirementExpression}s into a requirement expression
+ * using the {@code or} operator.
+ *
+ * @param expr1 The first requirement expression to combine into the
+ * returned requirement expression.
+ * @param expr2 The second requirement expression to combine into the
+ * returned requirement expression
+ * @return An {@link OrExpression} representing an {@code or} of the
+ * specified requirement expressions.
+ */
+ OrExpression or(RequirementExpression expr1, RequirementExpression expr2);
+
+ /**
+ * Combine multiple {@link RequirementExpression}s into a requirement
+ * expression using the {@code or} operator.
+ *
+ * @param expr1 The first requirement expression to combine into the
+ * returned requirement expression.
+ * @param expr2 The second requirement expression to combine into the
+ * returned requirement expression
+ * @param moreExprs Optional, additional requirement expressions to combine
+ * into the returned requirement expression.
+ * @return An {@link OrExpression} representing an {@code or} of the
+ * specified requirement expressions.
+ */
+ OrExpression or(RequirementExpression expr1, RequirementExpression expr2, RequirementExpression... moreExprs);
+}
diff --git a/org/osgi/service/blueprint/reflect/RefMetadata.java b/org/osgi/service/repository/IdentityExpression.java
similarity index 53%
copy from org/osgi/service/blueprint/reflect/RefMetadata.java
copy to org/osgi/service/repository/IdentityExpression.java
index a3187ab..ba86305 100644
--- a/org/osgi/service/blueprint/reflect/RefMetadata.java
+++ b/org/osgi/service/repository/IdentityExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2013). 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.
@@ -14,22 +14,24 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
+package org.osgi.service.repository;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.resource.Requirement;
/**
- * Metadata for a reference to another component managed by the Blueprint
- * Container.
+ * A {@link RequirementExpression} representing a requirement.
*
* @ThreadSafe
- * @author $Id: a67274cc8e5033dddc8477a046d116d511c1a4d3 $
+ * @since 1.1
*/
-public interface RefMetadata extends Target, NonNullMetadata {
+ at ProviderType
+public interface IdentityExpression extends RequirementExpression {
/**
- * Return the id of the referenced component.
- *
- * This is specified by the {@code component-id} attribute of a component.
+ * Return the {@link Requirement} contained in this
+ * {@code IdentityExpression}.
*
- * @return The id of the referenced component.
+ * @return The requirement contained in this {@code IdentityExpression}.
*/
- String getComponentId();
+ Requirement getRequirement();
}
diff --git a/org/osgi/service/blueprint/reflect/RefMetadata.java b/org/osgi/service/repository/NotExpression.java
similarity index 51%
copy from org/osgi/service/blueprint/reflect/RefMetadata.java
copy to org/osgi/service/repository/NotExpression.java
index a3187ab..af0503a 100644
--- a/org/osgi/service/blueprint/reflect/RefMetadata.java
+++ b/org/osgi/service/repository/NotExpression.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2013). 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.
@@ -14,22 +14,25 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
+package org.osgi.service.repository;
+
+import org.osgi.annotation.versioning.ProviderType;
/**
- * Metadata for a reference to another component managed by the Blueprint
- * Container.
+ * A {@link RequirementExpression} representing the {@code not} (negation) of a
+ * requirement expression.
*
* @ThreadSafe
- * @author $Id: a67274cc8e5033dddc8477a046d116d511c1a4d3 $
+ * @since 1.1
*/
-public interface RefMetadata extends Target, NonNullMetadata {
+ at ProviderType
+public interface NotExpression extends RequirementExpression {
/**
- * Return the id of the referenced component.
- *
- * This is specified by the {@code component-id} attribute of a component.
+ * Return the requirement expression that is negated by this
+ * {@code NotExpression}.
*
- * @return The id of the referenced component.
+ * @return The requirement expression that is negated by this
+ * {@code NotExpression}.
*/
- String getComponentId();
+ RequirementExpression getRequirementExpression();
}
diff --git a/org/osgi/service/repository/OrExpression.java b/org/osgi/service/repository/OrExpression.java
new file mode 100644
index 0000000..34663ab
--- /dev/null
+++ b/org/osgi/service/repository/OrExpression.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.service.repository;
+
+import java.util.List;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * A {@link RequirementExpression} representing the {@code or} of a number of
+ * requirement expressions.
+ *
+ * @ThreadSafe
+ * @since 1.1
+ */
+ at ProviderType
+public interface OrExpression extends RequirementExpression {
+ /**
+ * Return the requirement expressions that are combined by this
+ * {@code OrExpression}.
+ *
+ * @return An unmodifiable list of requirement expressions that are combined
+ * by this {@code OrExpression}. The list contains the requirement
+ * expressions in the order they were specified when this
+ * requirement expression was created.
+ */
+ List<RequirementExpression> getRequirementExpressions();
+}
diff --git a/org/osgi/service/repository/Repository.java b/org/osgi/service/repository/Repository.java
index b79dab9..571ad99 100644
--- a/org/osgi/service/repository/Repository.java
+++ b/org/osgi/service/repository/Repository.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2006, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2006, 2014). 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.
@@ -14,17 +14,15 @@
* limitations under the License.
*/
-// This document is an experimental draft to enable interoperability
-// between bundle repositories. There is currently no commitment to
-// turn this draft into an official specification.
-
package org.osgi.service.repository;
import java.util.Collection;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Capability;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
+import org.osgi.util.promise.Promise;
/**
* A repository service that contains {@link Resource resources}.
@@ -38,9 +36,9 @@ import org.osgi.resource.Resource;
* properties.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 0ce322be0d7242d30e47b7f972057d90e9b57c5e $
+ * @author $Id: be8094486733aaf1e15921123391477eedf6d752 $
*/
+ at ProviderType
public interface Repository {
/**
* Service property to provide URLs related to this repository.
@@ -61,7 +59,55 @@ public interface Repository {
* there are no matching capabilities for a specified requirement,
* then the value in the map for the specified requirement must be
* an empty collection. The returned map is the property of the
- * caller and can be modified by the caller.
+ * caller and can be modified by the caller. The returned map may be
+ * lazily populated, so calling {@code size()} may result in a long
+ * running operation.
*/
Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements);
+
+ /**
+ * Find the resources that match the specified requirement expression.
+ *
+ * @param expression The {@code RequirementExpression} for which matching
+ * capabilities should be returned. Must not be {@code null}.
+ * @return A promise to a collection of matching {@code Resource}s. If there
+ * are no matching resources, an empty collection is returned. The
+ * returned collection is the property of the caller and can be
+ * modified by the caller. The returned collection may be lazily
+ * populated, so calling {@code size()} may result in a long running
+ * operation.
+ * @since 1.1
+ */
+ Promise<Collection<Resource>> findProviders(RequirementExpression expression);
+
+ /**
+ * Return an expression combiner. An expression combiner can be used to
+ * combine multiple requirement expressions into more complex requirement
+ * expressions using {@link AndExpression and}, {@link OrExpression or} and
+ * {@link NotExpression not} operators.
+ *
+ * @return An {@code ExpressionCombiner}.
+ * @since 1.1
+ */
+ ExpressionCombiner getExpressionCombiner();
+
+ /**
+ * Return a new {@code RequirementBuilder} which provides a convenient way
+ * to create a requirement.
+ *
+ * <p>
+ * For example:
+ *
+ * <pre>
+ * Requirement myReq = repository.newRequirementBuilder("org.foo.ns1").
+ * addDirective("filter", "(org.foo.ns1=val1)").
+ * addDirective("cardinality", "multiple").build();
+ * </pre>
+ *
+ * @param namespace The namespace for the requirement to be created.
+ * @return A new requirement builder for a requirement in the specified
+ * namespace.
+ * @since 1.1
+ */
+ RequirementBuilder newRequirementBuilder(String namespace);
}
diff --git a/org/osgi/service/repository/RepositoryContent.java b/org/osgi/service/repository/RepositoryContent.java
index a2acaf0..32648b3 100644
--- a/org/osgi/service/repository/RepositoryContent.java
+++ b/org/osgi/service/repository/RepositoryContent.java
@@ -17,26 +17,30 @@
package org.osgi.service.repository;
import java.io.InputStream;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Resource;
/**
- * An accessor for the default content of a resource.
+ * An accessor for the content of a resource.
*
* All {@link Resource} objects which represent resources in a
* {@link Repository} must implement this interface. A user of the resource can
* then cast the {@link Resource} object to this type and then obtain an
- * {@code InputStream} to the default content of the resource.
+ * {@code InputStream} to the content of the resource.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 1a2e5af4f60929137fbc0b1806103f4b5c17f8b7 $
+ * @author $Id: 786e99d180fe847e7f9cbd2c9fd2667fc18ee7bd $
*/
+ at ProviderType
public interface RepositoryContent {
/**
- * Returns a new input stream to the default format of this resource.
+ * Returns a new input stream to the content of this resource. The content
+ * is represented on the resource through the {@code osgi.content}
+ * capability. If more than one such capability is associated with the
+ * resource, the first such capability is returned.
*
- * @return A new input stream for associated resource.
+ * @return A new input stream for associated content.
*/
InputStream getContent();
}
diff --git a/org/osgi/service/repository/RequirementBuilder.java b/org/osgi/service/repository/RequirementBuilder.java
new file mode 100644
index 0000000..6024872
--- /dev/null
+++ b/org/osgi/service/repository/RequirementBuilder.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.repository;
+
+import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
+
+/**
+ * A builder for requirements.
+ *
+ * @since 1.1
+ */
+ at ProviderType
+public interface RequirementBuilder {
+ /**
+ * Add an attribute to the set of attributes.
+ *
+ * @param name The attribute name.
+ * @param value The attribute value.
+ * @return This requirement builder.
+ */
+ RequirementBuilder addAttribute(String name, Object value);
+
+ /**
+ * Add a directive to the set of directives.
+ *
+ * @param name The directive name.
+ * @param value The directive value.
+ * @return This requirement builder.
+ */
+ RequirementBuilder addDirective(String name, String value);
+
+ /**
+ * Replace all attributes with the attributes in the specified map.
+ *
+ * @param attributes The map of attributes.
+ * @return This requirement builder.
+ */
+ RequirementBuilder setAttributes(Map<String, Object> attributes);
+
+ /**
+ * Replace all directives with the directives in the specified map.
+ *
+ * @param directives The map of directives.
+ * @return This requirement builder.
+ */
+ RequirementBuilder setDirectives(Map<String, String> directives);
+
+ /**
+ * Set the {@code Resource}.
+ *
+ * <p>
+ * A resource is optional. This method will replace any previously set
+ * resource.
+ *
+ * @param resource The resource.
+ * @return This requirement builder.
+ */
+ RequirementBuilder setResource(Resource resource);
+
+ /**
+ * Create a requirement based upon the values set in this requirement
+ * builder.
+ *
+ * @return A requirement created based upon the values set in this
+ * requirement builder.
+ */
+ Requirement build();
+
+ /**
+ * Create a requirement expression for a requirement based upon the values
+ * set in this requirement builder.
+ *
+ * @return A requirement expression created for a requirement based upon the
+ * values set in this requirement builder.
+ */
+ IdentityExpression buildExpression();
+}
diff --git a/org/osgi/service/blueprint/reflect/Metadata.java b/org/osgi/service/repository/RequirementExpression.java
similarity index 61%
copy from org/osgi/service/blueprint/reflect/Metadata.java
copy to org/osgi/service/repository/RequirementExpression.java
index e11c83f..1b69867 100644
--- a/org/osgi/service/blueprint/reflect/Metadata.java
+++ b/org/osgi/service/repository/RequirementExpression.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2013). 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.
@@ -14,14 +14,18 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
+package org.osgi.service.repository;
+
+import org.osgi.annotation.versioning.ProviderType;
/**
- * Top level Metadata type. All Metdata types extends this base type.
+ * The super interface for all requirement expressions. All requirement
+ * expressions must extend this interface.
*
* @ThreadSafe
- * @author $Id: ad96fa92753e9aaada5b1b8c5fae694e60c60186 $
+ * @since 1.1
*/
-public interface Metadata {
- // marker interface
+ at ProviderType
+public interface RequirementExpression {
+ // Marker interface.
}
diff --git a/org/osgi/service/repository/package-info.java b/org/osgi/service/repository/package-info.java
index 545eda2..5a2f968 100644
--- a/org/osgi/service/repository/package-info.java
+++ b/org/osgi/service/repository/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,7 +15,7 @@
*/
/**
- * Repository Service Package Version 1.0.
+ * Repository Service Package Version 1.1.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.repository; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.service.repository; version="[1.1,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.repository; version="[1.0,1.1)"}
+ * {@code Import-Package: org.osgi.service.repository; version="[1.1,1.2)"}
*
- * @version 1.0
- * @author $Id: 965c449ee85b1b1181af48f28cd0424ced33770f $
+ * @author $Id: 108024a32a1e0ccd17a73d8540c7c5087dd8a430 $
*/
+ at Version("1.1")
package org.osgi.service.repository;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/repository/packageinfo b/org/osgi/service/repository/packageinfo
index 7c8de03..3987f9c 100644
--- a/org/osgi/service/repository/packageinfo
+++ b/org/osgi/service/repository/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1
diff --git a/org/osgi/service/resolver/HostedCapability.java b/org/osgi/service/resolver/HostedCapability.java
index a1992c5..e8d5b9a 100644
--- a/org/osgi/service/resolver/HostedCapability.java
+++ b/org/osgi/service/resolver/HostedCapability.java
@@ -16,6 +16,7 @@
package org.osgi.service.resolver;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Capability;
import org.osgi.resource.Resource;
@@ -32,9 +33,9 @@ import org.osgi.resource.Resource;
* capability can actually be hosted multiple times.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: ef2183bdd379da6d1a2adc6f6c4719b847c279d2 $
+ * @author $Id: b25092b5ec6b66c7766a255a3a3452bb576609c5 $
*/
+ at ProviderType
public interface HostedCapability extends Capability {
/**
diff --git a/org/osgi/service/resolver/ResolutionException.java b/org/osgi/service/resolver/ResolutionException.java
index 7ff5268..9dd01a0 100644
--- a/org/osgi/service/resolver/ResolutionException.java
+++ b/org/osgi/service/resolver/ResolutionException.java
@@ -34,7 +34,7 @@ import org.osgi.resource.Requirement;
* Resolver implementations may extend this class to provide extra state
* information about the reason for the resolution failure.
*
- * @author $Id: 7e9dcb8cd9bd8e69ddfd27f13e7046df346c5f00 $
+ * @author $Id: 2bcc0ac8ebfaf169dd301493303d23ce613ac8b9 $
*/
public class ResolutionException extends Exception {
@@ -81,6 +81,7 @@ public class ResolutionException extends Exception {
unresolvedRequirements = null;
}
+ @SuppressWarnings("unchecked")
private static Collection<Requirement> emptyCollection() {
return Collections.EMPTY_LIST;
}
diff --git a/org/osgi/service/resolver/ResolveContext.java b/org/osgi/service/resolver/ResolveContext.java
index 5e3faf5..8269e06 100644
--- a/org/osgi/service/resolver/ResolveContext.java
+++ b/org/osgi/service/resolver/ResolveContext.java
@@ -20,6 +20,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import org.osgi.annotation.versioning.ConsumerType;
import org.osgi.resource.Capability;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
@@ -58,8 +59,9 @@ import org.osgi.resource.Wiring;
* return a consistent set of capabilities, wires and effective requirements.
*
* @ThreadSafe
- * @author $Id: 31e6bd75deae054742a168e7d5b76915b07cbb54 $
+ * @author $Id: 39b26f1a37b74ecd67dad0e4e89f1dded54366b5 $
*/
+ at ConsumerType
public abstract class ResolveContext {
/**
* Return the resources that must be resolved for this resolve context.
@@ -67,8 +69,9 @@ public abstract class ResolveContext {
* <p>
* The default implementation returns an empty collection.
*
- * @return The resources that must be resolved for this resolve context. May
- * be empty if there are no mandatory resources.
+ * @return A collection of the resources that must be resolved for this
+ * resolve context. May be empty if there are no mandatory
+ * resources. The returned collection may be unmodifiable.
*/
public Collection<Resource> getMandatoryResources() {
return emptyCollection();
@@ -82,14 +85,15 @@ public abstract class ResolveContext {
* <p>
* The default implementation returns an empty collection.
*
- * @return The resources that the resolver should attempt to resolve for
- * this resolve context. May be empty if there are no mandatory
- * resources.
+ * @return A collection of the resources that the resolver should attempt to
+ * resolve for this resolve context. May be empty if there are no
+ * optional resources. The returned collection may be unmodifiable.
*/
public Collection<Resource> getOptionalResources() {
return emptyCollection();
}
+ @SuppressWarnings("unchecked")
private static <T> Collection<T> emptyCollection() {
return Collections.EMPTY_LIST;
}
@@ -115,7 +119,7 @@ public abstract class ResolveContext {
* that must originate from an attached host.
*
* <p>
- * Each returned Capability must match the given Requirement. This implies
+ * Each returned Capability must match the given Requirement. This means
* that the filter in the Requirement must match as well as any namespace
* specific directives. For example, the mandatory attributes for the
* {@code osgi.wiring.package} namespace.
diff --git a/org/osgi/service/resolver/Resolver.java b/org/osgi/service/resolver/Resolver.java
index 60f06a3..aac029a 100644
--- a/org/osgi/service/resolver/Resolver.java
+++ b/org/osgi/service/resolver/Resolver.java
@@ -22,6 +22,7 @@ package org.osgi.service.resolver;
import java.util.List;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.resource.Resource;
import org.osgi.resource.Wire;
@@ -30,9 +31,9 @@ import org.osgi.resource.Wire;
* by the caller.
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 809049a3954e50f9abbfca24fa4fda0d77d4f5b3 $
+ * @author $Id: 367c005c1a4b487bb6512c13c6348e343cefcfe5 $
*/
+ at ProviderType
public interface Resolver {
/**
* Resolve the specified resolve context and return any new resources and
diff --git a/org/osgi/service/resolver/package-info.java b/org/osgi/service/resolver/package-info.java
index 7b514d7..781467e 100644
--- a/org/osgi/service/resolver/package-info.java
+++ b/org/osgi/service/resolver/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.resolver; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: 61f84b52813faae6c80625cfa0dba1f7b51f73d2 $
+ * @author $Id: 4fab41bbdf232d40360ee52e0c8f6ddb1f206082 $
*/
+ at Version("1.0.1")
package org.osgi.service.resolver;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/rest/RestApiExtension.java b/org/osgi/service/rest/RestApiExtension.java
new file mode 100644
index 0000000..aada8b7
--- /dev/null
+++ b/org/osgi/service/rest/RestApiExtension.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.rest;
+
+/**
+ * Marker interface for registering extensions to the Rest API service.
+ *
+ * <p>
+ * The REST service provides a RESTful interface to clients that need to manage
+ * an OSGi framework through a network connection. Other components running
+ * on the same framework can contribute their own specific REST
+ * interface and make it available and discoverable by registering this marker
+ * service using the Whiteboard pattern.
+ * </p>
+ * <p>
+ * Integration of third-party REST interfaces with the framework REST service on
+ * the implementation level might not always be possible since it requires
+ * knowledge about the underlying implementation and an extension mechanism on
+ * that level. Specific technologies such as servlets might support
+ * this but the REST service could as well be implemented without the use of a
+ * supporting abstraction layer and not offer extensibility.
+ * </p>
+ * <p>
+ * Using this marker service, the REST service includes the advertised service
+ * in the Extensions Resource, allowing clients to discover it and
+ * use the extension's functionality.
+ * </p>
+ *
+ * @author $Id: 01d6a64b074ab98dcb676ea771c152b0d8f40b69 $
+ */
+public interface RestApiExtension {
+
+ /**
+ * This service property describes a URI to the REST extension on this local
+ * machine. It is either an fully qualified URI with a different port if no
+ * integration with the framework REST service is possible or a relative URI
+ * implicitly using the same port if integration is possible.
+ * The type of this property is
+ * <code>java.lang.String</code> and the property is mandatory.
+ */
+ public static final String URI_PATH = "org.osgi.rest.uri.path";
+
+ /**
+ * This service property describes the package name of the technology
+ * manageable by this REST API extension. Services specified in OSGi
+ * specifications must use their canonical package name as the name.
+ * Third-party technologies should also use their package names. The type of this
+ * property is <code>java.lang.String</code> and the property is mandatory.
+ */
+ public static final String NAME = "org.osgi.rest.name";
+
+ /**
+ * This service property refers to the id of the service the REST API
+ * extension provides management capabilities for. This can be useful if more
+ * than one service of a given type is present in the framework. For example
+ * if more than one Http Service is available this property is used to
+ * associate a REST extension managing the Http Service with a specific
+ * service instance.
+ * The type of the property is
+ * <code>java.lang.Long</code> and the property is optional; if the REST
+ * extension is not directly associated with a service in the service
+ * registry, the property should not be set.
+ */
+ public static final String SERVICE = "org.osgi.rest.service";
+
+}
diff --git a/org/osgi/service/rest/client/RestClient.java b/org/osgi/service/rest/client/RestClient.java
new file mode 100644
index 0000000..aa7ab9a
--- /dev/null
+++ b/org/osgi/service/rest/client/RestClient.java
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.rest.client;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.dto.BundleDTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+import org.osgi.framework.startlevel.dto.BundleStartLevelDTO;
+import org.osgi.framework.startlevel.dto.FrameworkStartLevelDTO;
+
+/**
+ * A Java client API for a REST service endpoint.
+ *
+ * <p>
+ * Provides a Java client API for accessing and managing a remote OSGi framework
+ * through the REST API. Implementations of this interface will usually take the
+ * URL to the remote REST Management Service instance as an argument in their
+ * constructor. Further arguments might be needed, for example, if the cloud
+ * provider requires URL signing.
+ *
+ * @author $Id: d9d76beee113e88629a436c0545dc31e6c47787f $
+ */
+ at ProviderType
+public interface RestClient {
+ /**
+ * Retrieves the current framework start level.
+ *
+ * @return Returns the current framework start level in the form of a
+ * {@link FrameworkStartLevelDTO}.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ FrameworkStartLevelDTO getFrameworkStartLevel() throws Exception;
+
+ /**
+ * Sets the current framework start level.
+ *
+ * @param startLevel set the framework start level to this target.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void setFrameworkStartLevel(FrameworkStartLevelDTO startLevel) throws Exception;
+
+ /**
+ * Get the bundles currently installed on the managed framework.
+ *
+ * @return Returns a collection of the bundle URIs in the form of Strings.
+ * The URIs are relative to the REST API root URL and can be used to
+ * retrieve bundle representations.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Collection<String> getBundlePaths() throws Exception;
+
+ /**
+ * Get the bundle representations for all bundles currently installed in the
+ * managed framework.
+ *
+ * @return Returns a collection of BundleDTO objects.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Collection<BundleDTO> getBundles() throws Exception;
+
+ /**
+ * Retrieve the bundle representation for a given bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return A {@link BundleDTO} for the requested bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO getBundle(long id) throws Exception;
+
+ /**
+ * Retrieve the bundle representation for a given bundle path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @return A {@link BundleDTO} for the requested bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO getBundle(String bundlePath) throws Exception;
+
+ /**
+ * Get the state for a given bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return Returns the current bundle state as defined in (@link
+ * org.osgi.framework.Bundle}.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ int getBundleState(long id) throws Exception;
+
+ /**
+ * Get the state for a given bundle path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @return Returns the current bundle state as defined in (@link
+ * org.osgi.framework.Bundle}.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ int getBundleState(String bundlePath) throws Exception;
+
+ /**
+ * Start a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void startBundle(long id) throws Exception;
+
+ /**
+ * Start a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void startBundle(String bundlePath) throws Exception;
+
+ /**
+ * Start a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @param options Passes additional options as defined in
+ * {@link org.osgi.framework.Bundle#start(int)}
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void startBundle(long id, int options) throws Exception;
+
+ /**
+ * Start a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @param options Passes additional options as defined in
+ * {@link org.osgi.framework.Bundle#start(int)}
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void startBundle(String bundlePath, int options) throws Exception;
+
+ /**
+ * Stop a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void stopBundle(long id) throws Exception;
+
+ /**
+ * Stop a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void stopBundle(String bundlePath) throws Exception;
+
+ /**
+ * Stop a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @param options Passes additional options as defined in
+ * {@link org.osgi.framework.Bundle#stop(int)}
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void stopBundle(long id, int options) throws Exception;
+
+ /**
+ * Stop a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @param options Passes additional options as defined in
+ * {@link org.osgi.framework.Bundle#stop(int)}
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void stopBundle(String bundlePath, int options) throws Exception;
+
+ /**
+ * Get the header for a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return Returns the map of headers entries.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Map<String, String> getBundleHeaders(long id) throws Exception;
+
+ /**
+ * Get the header for a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @return Returns the map of headers entries.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Map<String, String> getBundleHeaders(String bundlePath) throws Exception;
+
+ /**
+ * Get the start level for a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return Returns a {@link BundleStartLevelDTO} describing the current
+ * start level of the bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleStartLevelDTO getBundleStartLevel(long id) throws Exception;
+
+ /**
+ * Get the start level for a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @return Returns a {@link BundleStartLevelDTO} describing the current
+ * start level of the bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleStartLevelDTO getBundleStartLevel(String bundlePath) throws Exception;
+
+ /**
+ * Set the start level for a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @param startLevel The target start level.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void setBundleStartLevel(long id, int startLevel) throws Exception;
+
+ /**
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @param startLevel The target start level.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ void setBundleStartLevel(String bundlePath, int startLevel) throws Exception;
+
+ /**
+ * Install a new bundle given by an externally reachable location string,
+ * typically describing a URL.
+ *
+ * @param location Passes the location string to retrieve the bundle content
+ * from.
+ * @return Returns the {@link BundleDTO} of the newly installed bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO installBundle(String location) throws Exception;
+
+ /**
+ * Install a new bundle given by an {@link InputStream} to a bundle content.
+ *
+ * @param location Passes the location string to be used to install the new
+ * bundle.
+ * @param in Passes the input stream to a bundle.
+ * @return Returns the {@link BundleDTO} of the newly installed bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO installBundle(String location, InputStream in) throws Exception;
+
+ /**
+ * Uninstall a bundle given by its bundle Id.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return Returns the {@link BundleDTO} of the uninstalled bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO uninstallBundle(long id) throws Exception;
+
+ /**
+ * Uninstall a bundle given by its URI path.
+ *
+ * @param bundlePath Addresses the bundle by its URI path.
+ * @return Returns the {@link BundleDTO} of the uninstalled bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO uninstallBundle(String bundlePath) throws Exception;
+
+ /**
+ * Updates a bundle given by its bundle Id using the bundle-internal update
+ * location.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @return Returns the {@link BundleDTO} of the updated bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO updateBundle(long id) throws Exception;
+
+ /**
+ * Updates a bundle given by its URI path using the content at the specified
+ * URL.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @param url The URL whose content is to be used to update the bundle.
+ * @return Returns the {@link BundleDTO} of the updated bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO updateBundle(long id, String url) throws Exception;
+
+ /**
+ * Updates a bundle given by its bundle Id and passing the new bundle
+ * content in the form of an {@link InputStream}.
+ *
+ * @param id Addresses the bundle by its identifier.
+ * @param in Passes an input stream to the new bundle content.
+ * @return Returns the {@link BundleDTO} of the updated bundle.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ BundleDTO updateBundle(long id, InputStream in) throws Exception;
+
+ /**
+ * Gets a collection of URI paths to all installed services.
+ *
+ * @return Returns a collection of URI paths to the installed services.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Collection<String> getServicePaths() throws Exception;
+
+ /**
+ * Gets a collection of URI paths to all installed services.
+ *
+ * @param filter Passes a filter to restrict the result set.
+ * @return Returns a collection of URI paths to the installed services.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ *
+ */
+ Collection<String> getServicePaths(String filter) throws Exception;
+
+ /**
+ * Get the service representations for all services.
+ *
+ * @return Returns the service representations in the form of
+ * {@link ServiceReferenceDTO} objects.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Collection<ServiceReferenceDTO> getServiceReferences() throws Exception;
+
+ /**
+ * Get the service representations for all services.
+ *
+ * @param filter Passes a filter to restrict the result set.
+ * @return Returns the service representations in the form of
+ * {@link ServiceReferenceDTO} objects.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ Collection<ServiceReferenceDTO> getServiceReferences(String filter) throws Exception;
+
+ /**
+ * Get the service representation for a service given by its service Id.
+ *
+ * @param id Addresses the service by its identifier.
+ * @return The service representation as {@link ServiceReferenceDTO}.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ ServiceReferenceDTO getServiceReference(long id) throws Exception;
+
+ /**
+ * Get the service representation for a service given by its URI path.
+ *
+ * @param servicePath Addresses the service by its URI path.
+ * @return The service representation as {@link ServiceReferenceDTO}.
+ * @throws Exception An exception representing a failure in the underlying
+ * REST call.
+ */
+ ServiceReferenceDTO getServiceReference(String servicePath) throws Exception;
+}
diff --git a/org/osgi/service/rest/client/RestClientFactory.java b/org/osgi/service/rest/client/RestClientFactory.java
new file mode 100644
index 0000000..dbacf7d
--- /dev/null
+++ b/org/osgi/service/rest/client/RestClientFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2015). 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.service.rest.client;
+
+import java.net.URI;
+import org.osgi.annotation.versioning.ProviderType;
+
+/**
+ * Factory to construct new REST client instances. Each instance is specific to
+ * a REST service endpoint.
+ *
+ * <p>
+ * Implementations can choose to extend this interface to add additional
+ * creation methods, where additional arguments are needed for request signing,
+ * etc.
+ *
+ * <p>
+ * In OSGi environments, this factory is registered as a service.
+ *
+ * @author $Id: 1aa3ae8437aa1ed55bbbd0233edbd085f962c3c5 $
+ */
+ at ProviderType
+public interface RestClientFactory {
+
+ /**
+ * Create a new REST client instance.
+ *
+ * @param uri The URI to the REST service endpoint.
+ * @return A new REST client instance for the specified REST service
+ * endpoint.
+ */
+ RestClient createRestClient(URI uri);
+}
diff --git a/org/osgi/service/blueprint/reflect/Metadata.java b/org/osgi/service/rest/client/package-info.java
similarity index 64%
copy from org/osgi/service/blueprint/reflect/Metadata.java
copy to org/osgi/service/rest/client/package-info.java
index e11c83f..ede3d3b 100644
--- a/org/osgi/service/blueprint/reflect/Metadata.java
+++ b/org/osgi/service/rest/client/package-info.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2010, 2014). 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.
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
-
/**
- * Top level Metadata type. All Metdata types extends this base type.
+ * Rest Service Client Package Version 1.0.
*
- * @ThreadSafe
- * @author $Id: ad96fa92753e9aaada5b1b8c5fae694e60c60186 $
+ * @author $Id: a8f2c7bc6969d859205579b05f4183a5fa348df1 $
*/
-public interface Metadata {
- // marker interface
-}
+
+ at Version("1.0.0")
+package org.osgi.service.rest.client;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/rest/client/packageinfo b/org/osgi/service/rest/client/packageinfo
new file mode 100644
index 0000000..9ad81f6
--- /dev/null
+++ b/org/osgi/service/rest/client/packageinfo
@@ -0,0 +1 @@
+version 1.0.0
diff --git a/org/osgi/service/blueprint/reflect/Metadata.java b/org/osgi/service/rest/package-info.java
similarity index 64%
copy from org/osgi/service/blueprint/reflect/Metadata.java
copy to org/osgi/service/rest/package-info.java
index e11c83f..b0e6ad4 100644
--- a/org/osgi/service/blueprint/reflect/Metadata.java
+++ b/org/osgi/service/rest/package-info.java
@@ -1,12 +1,12 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
- *
+ * Copyright (c) OSGi Alliance (2010, 2014). 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.
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package org.osgi.service.blueprint.reflect;
-
/**
- * Top level Metadata type. All Metdata types extends this base type.
+ * Rest Service Package Version 1.0.
*
- * @ThreadSafe
- * @author $Id: ad96fa92753e9aaada5b1b8c5fae694e60c60186 $
+ * @author $Id: 61c49891b145b2f1400f217d3ee91fc6e4143358 $
*/
-public interface Metadata {
- // marker interface
-}
+
+ at Version("1.0.0")
+package org.osgi.service.rest;
+
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/rest/packageinfo b/org/osgi/service/rest/packageinfo
new file mode 100644
index 0000000..9ad81f6
--- /dev/null
+++ b/org/osgi/service/rest/packageinfo
@@ -0,0 +1 @@
+version 1.0.0
diff --git a/org/osgi/service/serviceloader/ServiceLoaderNamespace.java b/org/osgi/service/serviceloader/ServiceLoaderNamespace.java
index 64274f8..43e1556 100644
--- a/org/osgi/service/serviceloader/ServiceLoaderNamespace.java
+++ b/org/osgi/service/serviceloader/ServiceLoaderNamespace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -43,11 +43,11 @@ import org.osgi.resource.Namespace;
*
* <p>
* All unspecified capability attributes, unless the attribute name starts with
- * dot ({@code '.'} \u002E), are also used as service properties when
+ * full stop ({@code '.'} \u002E), are also used as service properties when
* registering a Service Provider as a service.
*
* @Immutable
- * @author $Id: 14423da88868681498b290691894d2d7eb8f5d5a $
+ * @author $Id: dc10ac5db968434a8af4d141e8d5e6b424b3cd49 $
*/
public final class ServiceLoaderNamespace extends Namespace {
diff --git a/org/osgi/service/serviceloader/package-info.java b/org/osgi/service/serviceloader/package-info.java
index aa5d08d..dfce96a 100644
--- a/org/osgi/service/serviceloader/package-info.java
+++ b/org/osgi/service/serviceloader/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2013). 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.
@@ -32,9 +32,11 @@
* <p>
* {@code Import-Package: org.osgi.service.serviceloader; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: 5f0cd51164ec98bc2b98437f50c44f777d168c33 $
+ * @author $Id: 893b956b26cdaf6866304338f288f1d54d55704c $
*/
+ at Version("1.0")
package org.osgi.service.serviceloader;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/subsystem/Subsystem.java b/org/osgi/service/subsystem/Subsystem.java
index f0bcd9a..d1ea9b3 100644
--- a/org/osgi/service/subsystem/Subsystem.java
+++ b/org/osgi/service/subsystem/Subsystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
@@ -20,6 +20,7 @@ import java.io.InputStream;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
+import org.osgi.annotation.versioning.ProviderType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Version;
import org.osgi.framework.namespace.IdentityNamespace;
@@ -157,9 +158,9 @@ import org.osgi.resource.Resource;
* </ul>
*
* @ThreadSafe
- * @noimplement
- * @author $Id: 98c29e1bfd80828ab025a1aa0530019184185242 $
+ * @author $Id: da3cdfb53ed089e0dbb0f971bc7404262d30ac76 $
*/
+ at ProviderType
public interface Subsystem {
/**
* An enumeration of the possible states of a subsystem.
@@ -202,9 +203,8 @@ public interface Subsystem {
/**
* The subsystem is in the process of resolving.
* <p>
- * A subsystem is in the {@code RESOLVING} state when the
- * {@link Subsystem#start() start} method is active, and attempts are
- * being made to resolve its content resources. If the resolve method
+ * A subsystem is in the {@code RESOLVING} state when attempts are being
+ * made to resolve its content resources. If the resolve process
* completes without exception, then the subsystem has successfully
* resolved and must move to the {@link #RESOLVED} state. Otherwise, the
* subsystem has failed to resolve and must move to the INSTALLED state.
@@ -375,6 +375,28 @@ public interface Subsystem {
public Collection<Resource> getConstituents();
/**
+ * Returns the headers for this subsystem's deployment manifest.
+ * <p>
+ * Each key in the map is a header name and the value of the key is the
+ * corresponding header value. Because header names are case-insensitive,
+ * the methods of the map must treat the keys in a case-insensitive manner.
+ * If the header name is not found, {@code null} is returned. Both original
+ * and derived headers will be included in the map.
+ * <p>
+ * This method must continue to return the headers while this subsystem is
+ * in the {@link State#INSTALL_FAILED INSTALL_FAILED} or
+ * {@link State#UNINSTALLED UNINSTALLED} states.
+ *
+ * @return The headers for this subsystem's deployment manifest. The
+ * returned map is unmodifiable.
+ * @throws SecurityException If the caller does not have the appropriate
+ * {@link SubsystemPermission}[this,METADATA], and the runtime
+ * supports permissions.
+ * @since 1.1
+ */
+ public Map<String, String> getDeploymentHeaders();
+
+ /**
* Returns the current state of this subsystem.
* <p>
* This method must continue to return this subsystem's state while this
@@ -586,6 +608,39 @@ public interface Subsystem {
public Subsystem install(String location, InputStream content);
/**
+ * Installs a subsystem from the specified content according to the
+ * specified deployment manifest.
+ * <p>
+ * This method installs a subsystem using the provided deployment manifest
+ * instead of the one in the archive, if any, or a computed one. If the
+ * deployment manifest is {@code null}, the behavior is exactly the same as
+ * in the {@link #install(String, InputStream)} method. Implementations must
+ * support deployment manifest input streams in the format described by
+ * section 134.2 of the Subsystem Service Specification. If the deployment
+ * manifest does not conform to the subsystem manifest (see 134.15.2), the
+ * installation fails.
+ *
+ * @param location The location identifier of the subsystem to be installed.
+ * @param content The input stream from which this subsystem will be read or
+ * {@code null} to indicate the input stream must be created from the
+ * specified location identifier. The input stream will always be
+ * closed when this method completes, even if an exception is thrown.
+ * @param deploymentManifest The deployment manifest to use in lieu of the
+ * one in the archive, if any, or a computed one.
+ * @return The installed subsystem.
+ * @throws IllegalStateException If this subsystem's state is in
+ * {@link State#INSTALLING INSTALLING}, {@link State#INSTALL_FAILED
+ * INSTALL_FAILED}, {@link State#UNINSTALLING UNINSTALLING},
+ * {@link State#UNINSTALLED UNINSTALLED}.
+ * @throws SubsystemException If the installation failed.
+ * @throws SecurityException If the caller does not have the appropriate
+ * {@link SubsystemPermission}[installed subsystem,LIFECYCLE], and
+ * the runtime supports permissions.
+ * @since 1.1
+ */
+ public Subsystem install(String location, InputStream content, InputStream deploymentManifest);
+
+ /**
* Starts this subsystem.
* <p>
* The following table shows which actions are associated with each state.
diff --git a/org/osgi/service/subsystem/SubsystemConstants.java b/org/osgi/service/subsystem/SubsystemConstants.java
index 7f5a2e2..26be06b 100644
--- a/org/osgi/service/subsystem/SubsystemConstants.java
+++ b/org/osgi/service/subsystem/SubsystemConstants.java
@@ -25,7 +25,7 @@ package org.osgi.service.subsystem;
* otherwise indicated.
*
* @Immutable
- * @author $Id: 706d2fcc446d056e9d5af4239e75090ea0692379 $
+ * @author $Id: 36e2190a16d3bd0e4ed0e34799286284c0986974 $
*/
public class SubsystemConstants {
private SubsystemConstants() {
@@ -91,22 +91,60 @@ public class SubsystemConstants {
public static final String START_ORDER_DIRECTIVE = "start-order";
/**
+ * Manifest header identifying the categories of a subsystem as a
+ * comma-delimited list.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_CATEGORY = "Subsystem-Category";
+
+ /**
+ * Manifest header identifying the contact address where problems with a
+ * subsystem may be reported; for example, an email address.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_CONTACTADDRESS = "Subsystem-ContactAddress";
+
+ /**
* Manifest header identifying the list of subsystem contents identified by
* a symbolic name and version.
*/
public static final String SUBSYSTEM_CONTENT = "Subsystem-Content";
/**
+ * Manifest header identifying a subsystem's copyright information.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_COPYRIGHT = "Subsystem-Copyright";
+
+ /**
* Manifest header identifying the human readable description.
*/
public static final String SUBSYSTEM_DESCRIPTION = "Subsystem-Description";
/**
+ * Manifest header identifying a subsystem's documentation URL, from which
+ * further information about the subsystem may be obtained.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_DOCURL = "Subsystem-DocURL";
+
+ /**
* Manifest header identifying services offered for export.
*/
public static final String SUBSYSTEM_EXPORTSERVICE = "Subsystem-ExportService";
/**
+ * Manifest header identifying the icon URL for the subsystem.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_ICON = "Subsystem-Icon";
+
+ /**
* The name of the service property for the
* {@link Subsystem#getSubsystemId() subsystem ID}. The value of this
* property must be of type {@code Long}.
@@ -119,6 +157,29 @@ public class SubsystemConstants {
public static final String SUBSYSTEM_IMPORTSERVICE = "Subsystem-ImportService";
/**
+ * Manifest header identifying a subsystem's license.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_LICENSE = "Subsystem-License";
+
+ /**
+ * Manifest header identifying the base name of a subsystem's localization
+ * entries.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_LOCALIZATION = "Subsystem-Localization";
+
+ /**
+ * Default value for the {@link #SUBSYSTEM_LOCALIZATION
+ * Subsystem-Localization} manifest header.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_LOCALIZATION_DEFAULT_BASENAME = "OSGI-INF/l10n/subsystem";
+
+ /**
* Manifest header identifying the subsystem manifest version. If not
* present, the default value is {@code 1}.
*/
@@ -203,6 +264,13 @@ public class SubsystemConstants {
public static final String SUBSYSTEM_TYPE_FEATURE = "osgi.subsystem.feature";
/**
+ * Manifest header identifying a subsystem's vendor.
+ *
+ * @since 1.1
+ */
+ public static final String SUBSYSTEM_VENDOR = "Subsystem-Vendor";
+
+ /**
* Manifest header value identifying the version of the subsystem. If not
* present, the default value is {@code 0.0.0}.
*/
diff --git a/org/osgi/service/subsystem/SubsystemPermission.java b/org/osgi/service/subsystem/SubsystemPermission.java
index c68b038..c907f6f 100644
--- a/org/osgi/service/subsystem/SubsystemPermission.java
+++ b/org/osgi/service/subsystem/SubsystemPermission.java
@@ -49,7 +49,7 @@ import org.osgi.framework.InvalidSyntaxException;
* Subsystem.stop
* lifecycle Subsystem.install
* Subsystem.uninstall
- * metadata Subsystem.getHeaders
+ * metadata Subsystem.getSubsystemHeaders
* Subsystem.getLocation
* </pre>
*
@@ -64,7 +64,7 @@ import org.osgi.framework.InvalidSyntaxException;
* Filter attribute names are processed in a case sensitive manner.
*
* @ThreadSafe
- * @author $Id: 29c3097457160250e064b8c44696dbe86240c0ca $
+ * @author $Id: 5c71d73cc6a3e8b2c2a7a3f188ebcf79b5ef7888 $
*/
public final class SubsystemPermission extends BasicPermission {
@@ -373,6 +373,7 @@ public final class SubsystemPermission extends BasicPermission {
* @return {@code true} if the specified permission is implied by this
* object; {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission p) {
if (!(p instanceof SubsystemPermission)) {
return false;
@@ -442,6 +443,7 @@ public final class SubsystemPermission extends BasicPermission {
* @return Canonical string representation of the
* {@code SubsystemPermission} actions.
*/
+ @Override
public String getActions() {
String result = actions;
if (result == null) {
@@ -485,6 +487,7 @@ public final class SubsystemPermission extends BasicPermission {
*
* @return A new {@code PermissionCollection} object.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new SubsystemPermissionCollection();
}
@@ -496,6 +499,7 @@ public final class SubsystemPermission extends BasicPermission {
* @return {@code true} if {@code obj} is equivalent to this
* {@code SubsystemPermission}; {@code false} otherwise.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -516,6 +520,7 @@ public final class SubsystemPermission extends BasicPermission {
*
* @return Hash code value for this object.
*/
+ @Override
public int hashCode() {
int h = 31 * 17 + getName().hashCode();
h = 31 * h + getActions().hashCode();
@@ -579,8 +584,8 @@ public final class SubsystemPermission extends BasicPermission {
recurse.set(subsystem);
try {
final Map<String, Object> map = new HashMap<String, Object>(4);
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
map.put("id", new Long(subsystem.getSubsystemId()));
map.put("location", subsystem.getLocation());
map.put("name", subsystem.getSymbolicName());
@@ -632,6 +637,7 @@ final class SubsystemPermissionCollection extends PermissionCollection {
* @throws SecurityException If this {@code SubsystemPermissionCollection}
* object has been marked read-only.
*/
+ @Override
public void add(Permission permission) {
if (!(permission instanceof SubsystemPermission)) {
throw new IllegalArgumentException("invalid permission: " + permission);
@@ -675,6 +681,7 @@ final class SubsystemPermissionCollection extends PermissionCollection {
* {@code SubsystemPermission} in this collection, {@code false}
* otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (!(permission instanceof SubsystemPermission)) {
return false;
@@ -718,6 +725,7 @@ final class SubsystemPermissionCollection extends PermissionCollection {
*
* @return Enumeration of all {@code SubsystemPermission} objects.
*/
+ @Override
public synchronized Enumeration<Permission> elements() {
List<Permission> all = new ArrayList<Permission>(permissions.values());
return Collections.enumeration(all);
@@ -735,6 +743,7 @@ final class SubsystemPermissionCollection extends PermissionCollection {
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
+ @SuppressWarnings("unchecked")
HashMap<String, SubsystemPermission> p = (HashMap<String, SubsystemPermission>) gfields.get("permissions", null);
permissions = p;
all_allowed = gfields.get("all_allowed", false);
diff --git a/org/osgi/service/subsystem/package-info.java b/org/osgi/service/subsystem/package-info.java
index 4e15fd1..d4f66a0 100644
--- a/org/osgi/service/subsystem/package-info.java
+++ b/org/osgi/service/subsystem/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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,7 +15,7 @@
*/
/**
- * Subsystem Service Package Version 1.0.
+ * Subsystem Service Package Version 1.1.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -26,15 +26,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.subsystem; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.service.subsystem; version="[1.1,2.0)"}
* <p>
* Example import for providers implementing the API in this package:
* <p>
- * {@code Import-Package: org.osgi.service.subsystem; version="[1.0,1.1)"}
+ * {@code Import-Package: org.osgi.service.subsystem; version="[1.1,1.2)"}
*
- * @version 1.0
- * @author $Id: f4eda6fd56dfe4f8186cf8917ff42bfa1a6bd11f $
+ * @author $Id: ef9042c42a3fbb135031bf4446e4e0fa0a579d22 $
*/
+ at Version("1.1")
package org.osgi.service.subsystem;
+import org.osgi.annotation.versioning.Version;
+
diff --git a/org/osgi/service/subsystem/packageinfo b/org/osgi/service/subsystem/packageinfo
index 7c8de03..3987f9c 100644
--- a/org/osgi/service/subsystem/packageinfo
+++ b/org/osgi/service/subsystem/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1
diff --git a/org/osgi/service/upnp/UPnPEventListener.java b/org/osgi/service/upnp/UPnPEventListener.java
index 53b6bf6..f2db3f8 100644
--- a/org/osgi/service/upnp/UPnPEventListener.java
+++ b/org/osgi/service/upnp/UPnPEventListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -40,8 +40,8 @@ import java.util.Dictionary;
* The filter is specified in a property named "upnp.filter" and has as a value
* an object of type {@code org.osgi.framework.Filter}.
* <p>
- * When the Filter is evaluated, the folowing keywords are recognized as defined
- * as literal constants in the {@code UPnPDevice} class.
+ * When the Filter is evaluated, the following keywords are recognized as
+ * defined as literal constants in the {@code UPnPDevice} class.
* <p>
* The valid subset of properties for the registration of UPnP Event Listener
* services are:
@@ -55,7 +55,7 @@ import java.util.Dictionary;
* events.</li>
* </ul>
*
- * @author $Id: 0daf43c61659b736b6d83fd3c8126fd7ef955ba6 $
+ * @author $Id: 80582d96d7a175bdc866166b386a38e2a8fe9e64 $
*/
public interface UPnPEventListener {
/**
diff --git a/org/osgi/service/wireadmin/Consumer.java b/org/osgi/service/wireadmin/Consumer.java
index 6a676ff..de803d0 100644
--- a/org/osgi/service/wireadmin/Consumer.java
+++ b/org/osgi/service/wireadmin/Consumer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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,7 @@
package org.osgi.service.wireadmin;
/**
- * Data Consumer, a service that can receive udpated values from
+ * Data Consumer, a service that can receive updated values from
* {@link Producer} services.
*
* <p>
@@ -52,7 +52,7 @@ package org.osgi.service.wireadmin;
* different types of objects from the Producer service. The Consumer service
* should have {@code WirePermission} for each of these scope names.
*
- * @author $Id: 3363ead47a7767d56aa9199473ef4c529e9672eb $
+ * @author $Id: 2f7f64f305e997fa2c381842b037057116dc3e07 $
*/
public interface Consumer {
/**
diff --git a/org/osgi/service/wireadmin/Producer.java b/org/osgi/service/wireadmin/Producer.java
index b40faff..df170c3 100644
--- a/org/osgi/service/wireadmin/Producer.java
+++ b/org/osgi/service/wireadmin/Producer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -65,7 +65,7 @@ package org.osgi.service.wireadmin;
* different types of objects (composite) to the Consumer service. The Producer
* service should have {@code WirePermission} for each of these scope names.
*
- * @author $Id: a65183e1ec8667a73d8ac177bcffbe627a36db65 $
+ * @author $Id: 670e883c51c4e2672be860b67e6348c19cbb3932 $
*/
public interface Producer {
/**
@@ -76,7 +76,7 @@ public interface Producer {
* Consumer service calling the {@code Wire} object's {@code poll} method.
* The Producer should coerce the value to be an instance of one of the
* types specified by {@link Wire#getFlavors()}. The types are specified in
- * order of of preference. The returned value should be as new or newer than
+ * order of preference. The returned value should be as new or newer than
* the last value furnished by this object.
*
* <p>
@@ -85,8 +85,8 @@ public interface Producer {
* (via the {@link #consumersConnected(Wire[])} method).
* <p>
* If the Producer service returns an {@code Envelope} object that has an
- * unpermitted scope name, then the Wire object must ignore (or remove) the
- * transfer.
+ * impermissible scope name, then the Wire object must ignore (or remove)
+ * the transfer.
* <p>
* If the {@code Wire} object has a scope set, the return value must be an
* array of {@code Envelope} objects ({@code Envelope[]}). The {@code Wire}
diff --git a/org/osgi/service/wireadmin/WireConstants.java b/org/osgi/service/wireadmin/WireConstants.java
index 5a1d0bc..3801c60 100644
--- a/org/osgi/service/wireadmin/WireConstants.java
+++ b/org/osgi/service/wireadmin/WireConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -21,7 +21,7 @@ package org.osgi.service.wireadmin;
* Consumer and Producer service properties.
*
* @noimplement
- * @author $Id: 12b9e446d1b40aa4f333b5a065eb4edc92dd304a $
+ * @author $Id: 6c5f7a39c33377956b8953b44597ac255ddffb75 $
*/
public interface WireConstants {
/**
@@ -118,9 +118,9 @@ public interface WireConstants {
* same rate that the Producer service can generate data. This property can
* be used to control the delivery rate.
* <p>
- * The filter can use a number of pre-defined attributes that can be used to
+ * The filter can use a number of predefined attributes that can be used to
* control the delivery of new data values. If the filter produces a match
- * upon the wire filter attributes, the Consumer service should be notifed
+ * upon the wire filter attributes, the Consumer service should be notified
* of the updated data value.
* <p>
* If the Producer service was registered with the
diff --git a/org/osgi/service/wireadmin/WirePermission.java b/org/osgi/service/wireadmin/WirePermission.java
index dd6e4ed..d6fa623 100644
--- a/org/osgi/service/wireadmin/WirePermission.java
+++ b/org/osgi/service/wireadmin/WirePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2015). 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.
@@ -37,7 +37,7 @@ import java.util.Hashtable;
* to the implementations of the {@code BasicPermission} class.
*
* @ThreadSafe
- * @author $Id: 99a7e308be87b5c34045f4d0ab6f2dd1bf3cd425 $
+ * @author $Id: ecf1b5fa83469af0568192d53250f6c491ca5bc8 $
*/
final public class WirePermission extends BasicPermission {
static final long serialVersionUID = -5583709391516569321L;
@@ -238,7 +238,7 @@ final public class WirePermission extends BasicPermission {
}
/**
- * Determines the equalty of two {@code WirePermission} objects.
+ * Determines the equality of two {@code WirePermission} objects.
*
* Checks that specified object has the same name and actions as this
* {@code WirePermission} object.
diff --git a/org/osgi/service/wireadmin/package-info.java b/org/osgi/service/wireadmin/package-info.java
index e9fac80..8756c80 100644
--- a/org/osgi/service/wireadmin/package-info.java
+++ b/org/osgi/service/wireadmin/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -32,8 +32,8 @@
* <p>
* {@code Import-Package: org.osgi.service.wireadmin; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: fc7b37f8b61d83f66fd1df8cc50a3534b24dbb56 $
+ * @version 1.0.1
+ * @author $Id: b5af96bb0efa30657f384694823c759b07046850 $
*/
package org.osgi.service.wireadmin;
diff --git a/org/osgi/util/function/Function.java b/org/osgi/util/function/Function.java
new file mode 100644
index 0000000..313d772
--- /dev/null
+++ b/org/osgi/util/function/Function.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.function;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * A function that accepts a single argument and produces a result.
+ *
+ * <p>
+ * This is a functional interface and can be used as the assignment target for a
+ * lambda expression or method reference.
+ *
+ * @param <T> The type of the function input.
+ * @param <R> The type of the function output.
+ *
+ * @ThreadSafe
+ * @author $Id: 5d812f75c0b4f88f01083189babb3ef7476b5ced $
+ */
+ at ConsumerType
+public interface Function<T, R> {
+ /**
+ * Applies this function to the specified argument.
+ *
+ * @param t The input to this function.
+ * @return The output of this function.
+ */
+ R apply(T t);
+}
diff --git a/org/osgi/util/function/Predicate.java b/org/osgi/util/function/Predicate.java
new file mode 100644
index 0000000..8b4c695
--- /dev/null
+++ b/org/osgi/util/function/Predicate.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.function;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * A predicate that accepts a single argument and produces a boolean result.
+ *
+ * <p>
+ * This is a functional interface and can be used as the assignment target for a
+ * lambda expression or method reference.
+ *
+ * @param <T> The type of the predicate input.
+ *
+ * @ThreadSafe
+ * @author $Id: 0c2c61f78bede4e2afc4278af4f5e4b873769347 $
+ */
+ at ConsumerType
+public interface Predicate<T> {
+ /**
+ * Evaluates this predicate on the specified argument.
+ *
+ * @param t The input to this predicate.
+ * @return {@code true} if the specified argument is accepted by this
+ * predicate; {@code false} otherwise.
+ */
+ boolean test(T t);
+}
diff --git a/org/osgi/util/position/package-info.java b/org/osgi/util/function/package-info.java
similarity index 63%
copy from org/osgi/util/position/package-info.java
copy to org/osgi/util/function/package-info.java
index 06eeb68..6dcf3b8 100644
--- a/org/osgi/util/position/package-info.java
+++ b/org/osgi/util/function/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014). 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,7 +15,7 @@
*/
/**
- * Position Package Version 1.0.
+ * Function Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -24,11 +24,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.util.position; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.util.function; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.util.function; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: d3a19f2ae25abe3997c9501497d933a608f7e49e $
+ * @author $Id: 899d786b27012f55ed87b4c872a6ab2087a20a39 $
*/
-package org.osgi.util.position;
+ at Version("1.0")
+package org.osgi.util.function;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/util/function/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/util/function/packageinfo
diff --git a/org/osgi/util/measurement/package-info.java b/org/osgi/util/measurement/package-info.java
index fc87ba6..0bee507 100644
--- a/org/osgi/util/measurement/package-info.java
+++ b/org/osgi/util/measurement/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -26,8 +26,8 @@
* <p>
* {@code Import-Package: org.osgi.util.measurement; version="[1.0,2.0)"}
*
- * @version 1.0
- * @author $Id: 6ea8b4c26bb929485152bac4b631983e65b2fc90 $
+ * @version 1.0.1
+ * @author $Id: 7603bac0b6ec5e4d091d31a4a6b70ab15503eb77 $
*/
package org.osgi.util.measurement;
diff --git a/org/osgi/util/position/package-info.java b/org/osgi/util/position/package-info.java
index 06eeb68..80c0797 100644
--- a/org/osgi/util/position/package-info.java
+++ b/org/osgi/util/position/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -26,8 +26,8 @@
* <p>
* {@code Import-Package: org.osgi.util.position; version="[1.0,2.0)"}
*
- * @version 1.0
- * @author $Id: d3a19f2ae25abe3997c9501497d933a608f7e49e $
+ * @version 1.0.1
+ * @author $Id: 63af1b6e6a689ec920ddf16dac4031eab5b5f8f6 $
*/
package org.osgi.util.position;
diff --git a/org/osgi/util/promise/Deferred.java b/org/osgi/util/promise/Deferred.java
new file mode 100644
index 0000000..6fd4532
--- /dev/null
+++ b/org/osgi/util/promise/Deferred.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import static org.osgi.util.promise.PromiseImpl.requireNonNull;
+
+/**
+ * A Deferred Promise resolution.
+ *
+ * <p>
+ * Instances of this class can be used to create a {@link Promise} that can be
+ * resolved in the future. The {@link #getPromise() associated} Promise can be
+ * successfully resolved with {@link #resolve(Object)} or resolved with a
+ * failure with {@link #fail(Throwable)}. It can also be resolved with the
+ * resolution of another promise using {@link #resolveWith(Promise)}.
+ *
+ * <p>
+ * The associated Promise can be provided to any one, but the Deferred object
+ * should be made available only to the party that will responsible for
+ * resolving the Promise.
+ *
+ * @param <T> The value type associated with the created Promise.
+ *
+ * @Immutable
+ * @author $Id: e9ff0a6fa2189934a38d3cf210d5418f8cfaeac7 $
+ */
+public class Deferred<T> {
+ private final PromiseImpl<T> promise;
+
+ /**
+ * Create a new Deferred with an associated Promise.
+ */
+ public Deferred() {
+ promise = new PromiseImpl<T>();
+ }
+
+ /**
+ * Returns the Promise associated with this Deferred.
+ *
+ * @return The Promise associated with this Deferred.
+ */
+ public Promise<T> getPromise() {
+ return promise;
+ }
+
+ /**
+ * Successfully resolve the Promise associated with this Deferred.
+ *
+ * <p>
+ * After the associated Promise is resolved with the specified value, all
+ * registered {@link Promise#onResolve(Runnable) callbacks} are called and
+ * any {@link Promise#then(Success, Failure) chained} Promises are resolved.
+ *
+ * <p>
+ * Resolving the associated Promise <i>happens-before</i> any registered
+ * callback is called. That is, in a registered callback,
+ * {@link Promise#isDone()} must return {@code true} and
+ * {@link Promise#getValue()} and {@link Promise#getFailure()} must not
+ * block.
+ *
+ * @param value The value of the resolved Promise.
+ * @throws IllegalStateException If the associated Promise was already
+ * resolved.
+ */
+ public void resolve(T value) {
+ promise.resolve(value, null);
+ }
+
+ /**
+ * Fail the Promise associated with this Deferred.
+ *
+ * <p>
+ * After the associated Promise is resolved with the specified failure, all
+ * registered {@link Promise#onResolve(Runnable) callbacks} are called and
+ * any {@link Promise#then(Success, Failure) chained} Promises are resolved.
+ *
+ * <p>
+ * Resolving the associated Promise <i>happens-before</i> any registered
+ * callback is called. That is, in a registered callback,
+ * {@link Promise#isDone()} must return {@code true} and
+ * {@link Promise#getValue()} and {@link Promise#getFailure()} must not
+ * block.
+ *
+ * @param failure The failure of the resolved Promise. Must not be
+ * {@code null}.
+ * @throws IllegalStateException If the associated Promise was already
+ * resolved.
+ */
+ public void fail(Throwable failure) {
+ promise.resolve(null, requireNonNull(failure));
+ }
+
+ /**
+ * Resolve the Promise associated with this Deferred with the specified
+ * Promise.
+ *
+ * <p>
+ * If the specified Promise is successfully resolved, the associated Promise
+ * is resolved with the value of the specified Promise. If the specified
+ * Promise is resolved with a failure, the associated Promise is resolved
+ * with the failure of the specified Promise.
+ *
+ * <p>
+ * After the associated Promise is resolved with the specified Promise, all
+ * registered {@link Promise#onResolve(Runnable) callbacks} are called and
+ * any {@link Promise#then(Success, Failure) chained} Promises are resolved.
+ *
+ * <p>
+ * Resolving the associated Promise <i>happens-before</i> any registered
+ * callback is called. That is, in a registered callback,
+ * {@link Promise#isDone()} must return {@code true} and
+ * {@link Promise#getValue()} and {@link Promise#getFailure()} must not
+ * block.
+ *
+ * @param with A Promise whose value or failure must be used to resolve the
+ * associated Promise. Must not be {@code null}.
+ * @return A Promise that is resolved only when the associated Promise is
+ * resolved by the specified Promise. The returned Promise must be
+ * successfully resolved with the value {@code null}, if the
+ * associated Promise was resolved by the specified Promise. The
+ * returned Promise must be resolved with a failure of
+ * {@link IllegalStateException}, if the associated Promise was
+ * already resolved when the specified Promise was resolved.
+ */
+ public Promise<Void> resolveWith(Promise<? extends T> with) {
+ return promise.resolveWith(with);
+ }
+}
diff --git a/org/osgi/util/promise/FailedPromisesException.java b/org/osgi/util/promise/FailedPromisesException.java
new file mode 100644
index 0000000..6d9c472
--- /dev/null
+++ b/org/osgi/util/promise/FailedPromisesException.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * Promise failure exception for a collection of failed Promises.
+ *
+ * @author $Id: 95546abe53fcca0c3daa3d2847a915fe94b9cef8 $
+ */
+public class FailedPromisesException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+ private final Collection<Promise<?>> failed;
+
+ /**
+ * Create a new FailedPromisesException with the specified Promises.
+ *
+ * @param failed A collection of Promises that have been resolved with a
+ * failure. Must not be {@code null}, must not be empty and all of
+ * the elements in the collection must not be {@code null}.
+ * @param cause The cause of this exception. This is typically the failure
+ * of the first Promise in the specified collection.
+ */
+ public FailedPromisesException(Collection<Promise<?>> failed, Throwable cause) {
+ super(cause);
+ this.failed = Collections.unmodifiableCollection(failed);
+ }
+
+ /**
+ * Returns the collection of Promises that have been resolved with a
+ * failure.
+ *
+ * @return The collection of Promises that have been resolved with a
+ * failure. The returned collection is unmodifiable.
+ */
+ public Collection<Promise<?>> getFailedPromises() {
+ return failed;
+ }
+}
diff --git a/org/osgi/util/promise/Failure.java b/org/osgi/util/promise/Failure.java
new file mode 100644
index 0000000..4297e09
--- /dev/null
+++ b/org/osgi/util/promise/Failure.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Failure callback for a Promise.
+ *
+ * <p>
+ * A Failure callback is registered with a {@link Promise} using the
+ * {@link Promise#then(Success, Failure)} method and is called if the Promise is
+ * resolved with a failure.
+ *
+ * <p>
+ * This is a functional interface and can be used as the assignment target for a
+ * lambda expression or method reference.
+ *
+ * @ThreadSafe
+ * @author $Id: 4e6a178846eef72f2ca385de547d3c13787c0986 $
+ */
+ at ConsumerType
+public interface Failure {
+ /**
+ * Failure callback for a Promise.
+ *
+ * <p>
+ * This method is called if the Promise with which it is registered resolves
+ * with a failure.
+ *
+ * <p>
+ * In the remainder of this description we will refer to the Promise
+ * returned by {@link Promise#then(Success, Failure)} when this Failure
+ * callback was registered as the chained Promise.
+ *
+ * <p>
+ * If this methods completes normally, the chained Promise must be failed
+ * with the same exception which failed the resolved Promise. If this method
+ * throws an exception, the chained Promise must be failed with the thrown
+ * exception.
+ *
+ * @param resolved The failed resolved {@link Promise}.
+ * @throws Exception The chained Promise must be failed with the thrown
+ * exception.
+ */
+ void fail(Promise<?> resolved) throws Exception;
+}
diff --git a/org/osgi/util/promise/Promise.java b/org/osgi/util/promise/Promise.java
new file mode 100644
index 0000000..77d8d7e
--- /dev/null
+++ b/org/osgi/util/promise/Promise.java
@@ -0,0 +1,403 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import java.lang.reflect.InvocationTargetException;
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.util.function.Function;
+import org.osgi.util.function.Predicate;
+
+/**
+ * A Promise of a value.
+ *
+ * <p>
+ * A Promise represents a future value. It handles the interactions for
+ * asynchronous processing. A {@link Deferred} object can be used to create a
+ * Promise and later resolve the Promise. A Promise is used by the caller of an
+ * asynchronous function to get the result or handle the error. The caller can
+ * either get a callback when the Promise is resolved with a value or an error,
+ * or the Promise can be used in chaining. In chaining, callbacks are provided
+ * that receive the resolved Promise, and a new Promise is generated that
+ * resolves based upon the result of a callback.
+ *
+ * <p>
+ * Both {@link #onResolve(Runnable) callbacks} and
+ * {@link #then(Success, Failure) chaining} can be repeated any number of times,
+ * even after the Promise has been resolved.
+ * <p>
+ * Example callback usage:
+ *
+ * <pre>
+ * final Promise<String> foo = foo();
+ * foo.onResolve(new Runnable() {
+ * public void run() {
+ * System.out.println(foo.getValue());
+ * }
+ * });
+ * </pre>
+ *
+ * Example chaining usage;
+ *
+ * <pre>
+ * Success<String,String> doubler = new Success<String,String>() {
+ * public Promise<String> call(Promise<String> p) throws Exception {
+ * return Promises.resolved(p.getValue()+p.getValue());
+ * }
+ * };
+ * final Promise<String> foo = foo().then(doubler).then(doubler);
+ * foo.onResolve(new Runnable() {
+ * public void run() {
+ * System.out.println(foo.getValue());
+ * }
+ * });
+ * </pre>
+ *
+ * @param <T> The value type associated with this Promise.
+ *
+ * @ThreadSafe
+ * @author $Id: ffa193393576e4940a9b38635c5900ddf9067ce2 $
+ */
+ at ProviderType
+public interface Promise<T> {
+
+ /**
+ * Returns whether this Promise has been resolved.
+ *
+ * <p>
+ * This Promise may be successfully resolved or resolved with a failure.
+ *
+ * @return {@code true} if this Promise was resolved either successfully or
+ * with a failure; {@code false} if this Promise is unresolved.
+ */
+ boolean isDone();
+
+ /**
+ * Returns the value of this Promise.
+ *
+ * <p>
+ * If this Promise is not {@link #isDone() resolved}, this method must block
+ * and wait for this Promise to be resolved before completing.
+ *
+ * <p>
+ * If this Promise was successfully resolved, this method returns with the
+ * value of this Promise. If this Promise was resolved with a failure, this
+ * method must throw an {@code InvocationTargetException} with the
+ * {@link #getFailure() failure exception} as the cause.
+ *
+ * @return The value of this resolved Promise.
+ * @throws InvocationTargetException If this Promise was resolved with a
+ * failure. The cause of the {@code InvocationTargetException} is
+ * the failure exception.
+ * @throws InterruptedException If the current thread was interrupted while
+ * waiting.
+ */
+ T getValue() throws InvocationTargetException, InterruptedException;
+
+ /**
+ * Returns the failure of this Promise.
+ *
+ * <p>
+ * If this Promise is not {@link #isDone() resolved}, this method must block
+ * and wait for this Promise to be resolved before completing.
+ *
+ * <p>
+ * If this Promise was resolved with a failure, this method returns with the
+ * failure of this Promise. If this Promise was successfully resolved, this
+ * method must return {@code null}.
+ *
+ * @return The failure of this resolved Promise or {@code null} if this
+ * Promise was successfully resolved.
+ * @throws InterruptedException If the current thread was interrupted while
+ * waiting.
+ */
+ Throwable getFailure() throws InterruptedException;
+
+ /**
+ * Register a callback to be called when this Promise is resolved.
+ *
+ * <p>
+ * The specified callback is called when this Promise is resolved either
+ * successfully or with a failure.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * <p>
+ * Resolving this Promise <i>happens-before</i> any registered callback is
+ * called. That is, in a registered callback, {@link #isDone()} must return
+ * {@code true} and {@link #getValue()} and {@link #getFailure()} must not
+ * block.
+ *
+ * <p>
+ * A callback may be called on a different thread than the thread which
+ * registered the callback. So the callback must be thread safe but can rely
+ * upon that the registration of the callback <i>happens-before</i> the
+ * registered callback is called.
+ *
+ * @param callback A callback to be called when this Promise is resolved.
+ * Must not be {@code null}.
+ * @return This Promise.
+ */
+ Promise<T> onResolve(Runnable callback);
+
+ /**
+ * Chain a new Promise to this Promise with Success and Failure callbacks.
+ *
+ * <p>
+ * The specified {@link Success} callback is called when this Promise is
+ * successfully resolved and the specified {@link Failure} callback is
+ * called when this Promise is resolved with a failure.
+ *
+ * <p>
+ * This method returns a new Promise which is chained to this Promise. The
+ * returned Promise must be resolved when this Promise is resolved after the
+ * specified Success or Failure callback is executed. The result of the
+ * executed callback must be used to resolve the returned Promise. Multiple
+ * calls to this method can be used to create a chain of promises which are
+ * resolved in sequence.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the Success callback is
+ * executed and the result Promise, if any, or thrown exception is used to
+ * resolve the returned Promise from this method. If this Promise is
+ * resolved with a failure, the Failure callback is executed and the
+ * returned Promise from this method is failed.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * <p>
+ * Resolving this Promise <i>happens-before</i> any registered callback is
+ * called. That is, in a registered callback, {@link #isDone()} must return
+ * {@code true} and {@link #getValue()} and {@link #getFailure()} must not
+ * block.
+ *
+ * <p>
+ * A callback may be called on a different thread than the thread which
+ * registered the callback. So the callback must be thread safe but can rely
+ * upon that the registration of the callback <i>happens-before</i> the
+ * registered callback is called.
+ *
+ * @param <R> The value type associated with the returned Promise.
+ * @param success A Success callback to be called when this Promise is
+ * successfully resolved. May be {@code null} if no Success callback
+ * is required. In this case, the returned Promise must be resolved
+ * with the value {@code null} when this Promise is successfully
+ * resolved.
+ * @param failure A Failure callback to be called when this Promise is
+ * resolved with a failure. May be {@code null} if no Failure
+ * callback is required.
+ * @return A new Promise which is chained to this Promise. The returned
+ * Promise must be resolved when this Promise is resolved after the
+ * specified Success or Failure callback, if any, is executed.
+ */
+ <R> Promise<R> then(Success<? super T, ? extends R> success, Failure failure);
+
+ /**
+ * Chain a new Promise to this Promise with a Success callback.
+ *
+ * <p>
+ * This method performs the same function as calling
+ * {@link #then(Success, Failure)} with the specified Success callback and
+ * {@code null} for the Failure callback.
+ *
+ * @param <R> The value type associated with the returned Promise.
+ * @param success A Success callback to be called when this Promise is
+ * successfully resolved. May be {@code null} if no Success callback
+ * is required. In this case, the returned Promise must be resolved
+ * with the value {@code null} when this Promise is successfully
+ * resolved.
+ * @return A new Promise which is chained to this Promise. The returned
+ * Promise must be resolved when this Promise is resolved after the
+ * specified Success, if any, is executed.
+ * @see #then(Success, Failure)
+ */
+ <R> Promise<R> then(Success<? super T, ? extends R> success);
+
+ /**
+ * Filter the value of this Promise.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must
+ * either be resolved with the value of this Promise, if the specified
+ * Predicate accepts that value, or failed with a
+ * {@code NoSuchElementException}, if the specified Predicate does not
+ * accept that value. If the specified Predicate throws an exception, the
+ * returned Promise must be failed with the exception.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the returned Promise must be
+ * failed with that failure.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param predicate The Predicate to evaluate the value of this Promise.
+ * Must not be {@code null}.
+ * @return A Promise that filters the value of this Promise.
+ */
+ Promise<T> filter(Predicate<? super T> predicate);
+
+ /**
+ * Map the value of this Promise.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must be
+ * resolved with the value of specified Function as applied to the value of
+ * this Promise. If the specified Function throws an exception, the returned
+ * Promise must be failed with the exception.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the returned Promise must be
+ * failed with that failure.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param <R> The value type associated with the returned Promise.
+ * @param mapper The Function that must map the value of this Promise to the
+ * value that must be used to resolve the returned Promise. Must not
+ * be {@code null}.
+ * @return A Promise that returns the value of this Promise as mapped by the
+ * specified Function.
+ */
+ <R> Promise<R> map(Function<? super T, ? extends R> mapper);
+
+ /**
+ * FlatMap the value of this Promise.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must be
+ * resolved with the Promise from the specified Function as applied to the
+ * value of this Promise. If the specified Function throws an exception, the
+ * returned Promise must be failed with the exception.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the returned Promise must be
+ * failed with that failure.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param <R> The value type associated with the returned Promise.
+ * @param mapper The Function that must flatMap the value of this Promise to
+ * a Promise that must be used to resolve the returned Promise. Must
+ * not be {@code null}.
+ * @return A Promise that returns the value of this Promise as mapped by the
+ * specified Function.
+ */
+ <R> Promise<R> flatMap(Function<? super T, Promise<? extends R>> mapper);
+
+ /**
+ * Recover from a failure of this Promise with a recovery value.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must be
+ * resolved with the value of this Promise.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the specified Function is
+ * applied to this Promise to produce a recovery value.
+ * <ul>
+ * <li>If the recovery value is not {@code null}, the returned Promise must
+ * be resolved with the recovery value.</li>
+ * <li>If the recovery value is {@code null}, the returned Promise must be
+ * failed with the failure of this Promise.</li>
+ * <li>If the specified Function throws an exception, the returned Promise
+ * must be failed with that exception.</li>
+ * </ul>
+ *
+ * <p>
+ * To recover from a failure of this Promise with a recovery value of
+ * {@code null}, the {@link #recoverWith(Function)} method must be used. The
+ * specified Function for {@link #recoverWith(Function)} can return
+ * {@code Promises.resolved(null)} to supply the desired {@code null} value.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param recovery If this Promise resolves with a failure, the specified
+ * Function is called to produce a recovery value to be used to
+ * resolve the returned Promise. Must not be {@code null}.
+ * @return A Promise that resolves with the value of this Promise or
+ * recovers from the failure of this Promise.
+ */
+ Promise<T> recover(Function<Promise<?>, ? extends T> recovery);
+
+ /**
+ * Recover from a failure of this Promise with a recovery Promise.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must be
+ * resolved with the value of this Promise.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the specified Function is
+ * applied to this Promise to produce a recovery Promise.
+ * <ul>
+ * <li>If the recovery Promise is not {@code null}, the returned Promise
+ * must be resolved with the recovery Promise.</li>
+ * <li>If the recovery Promise is {@code null}, the returned Promise must be
+ * failed with the failure of this Promise.</li>
+ * <li>If the specified Function throws an exception, the returned Promise
+ * must be failed with that exception.</li>
+ * </ul>
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param recovery If this Promise resolves with a failure, the specified
+ * Function is called to produce a recovery Promise to be used to
+ * resolve the returned Promise. Must not be {@code null}.
+ * @return A Promise that resolves with the value of this Promise or
+ * recovers from the failure of this Promise.
+ */
+ Promise<T> recoverWith(Function<Promise<?>, Promise<? extends T>> recovery);
+
+ /**
+ * Fall back to the value of the specified Promise if this Promise fails.
+ *
+ * <p>
+ * If this Promise is successfully resolved, the returned Promise must be
+ * resolved with the value of this Promise.
+ *
+ * <p>
+ * If this Promise is resolved with a failure, the successful result of the
+ * specified Promise is used to resolve the returned Promise. If the
+ * specified Promise is resolved with a failure, the returned Promise must
+ * be failed with the failure of this Promise rather than the failure of the
+ * specified Promise.
+ *
+ * <p>
+ * This method may be called at any time including before and after this
+ * Promise has been resolved.
+ *
+ * @param fallback The Promise whose value must be used to resolve the
+ * returned Promise if this Promise resolves with a failure. Must not
+ * be {@code null}.
+ * @return A Promise that returns the value of this Promise or falls back to
+ * the value of the specified Promise.
+ */
+ Promise<T> fallbackTo(Promise<? extends T> fallback);
+}
diff --git a/org/osgi/util/promise/PromiseImpl.java b/org/osgi/util/promise/PromiseImpl.java
new file mode 100644
index 0000000..610a1de
--- /dev/null
+++ b/org/osgi/util/promise/PromiseImpl.java
@@ -0,0 +1,615 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.NoSuchElementException;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import org.osgi.util.function.Function;
+import org.osgi.util.function.Predicate;
+
+/**
+ * Promise implementation.
+ *
+ * <p>
+ * This class is not used directly by clients. Clients should use
+ * {@link Deferred} to create a resolvable {@link Promise}.
+ *
+ * @param <T> The result type associated with the Promise.
+ *
+ * @ThreadSafe
+ * @author $Id: ca2be5e80ac61cca849ae7373d42bde4fade7466 $
+ */
+final class PromiseImpl<T> implements Promise<T> {
+ /**
+ * A ConcurrentLinkedQueue to hold the callbacks for this Promise, so no
+ * additional synchronization is required to write to or read from the
+ * queue.
+ */
+ private final ConcurrentLinkedQueue<Runnable> callbacks;
+ /**
+ * A CountDownLatch to manage the resolved state of this Promise.
+ *
+ * <p>
+ * This object is used as the synchronizing object to provide a critical
+ * section in {@link #resolve(Object, Throwable)} so that only a single
+ * thread can write the resolved state variables and open the latch.
+ *
+ * <p>
+ * The resolved state variables, {@link #value} and {@link #fail}, must only
+ * be written when the latch is closed (getCount() != 0) and must only be
+ * read when the latch is open (getCount() == 0). The latch state must
+ * always be checked before writing or reading since the resolved state
+ * variables' memory consistency is guarded by the latch.
+ */
+ private final CountDownLatch resolved;
+ /**
+ * The value of this Promise if successfully resolved.
+ *
+ * @GuardedBy("resolved")
+ * @see #resolved
+ */
+ private T value;
+ /**
+ * The failure of this Promise if resolved with a failure or {@code null} if
+ * successfully resolved.
+ *
+ * @GuardedBy("resolved")
+ * @see #resolved
+ */
+ private Throwable fail;
+
+ /**
+ * Initialize this Promise.
+ */
+ PromiseImpl() {
+ callbacks = new ConcurrentLinkedQueue<Runnable>();
+ resolved = new CountDownLatch(1);
+ }
+
+ /**
+ * Initialize and resolve this Promise.
+ *
+ * @param v The value of this resolved Promise.
+ * @param f The failure of this resolved Promise.
+ */
+ PromiseImpl(T v, Throwable f) {
+ value = v;
+ fail = f;
+ callbacks = new ConcurrentLinkedQueue<Runnable>();
+ resolved = new CountDownLatch(0);
+ }
+
+ /**
+ * Resolve this Promise.
+ *
+ * @param v The value of this Promise.
+ * @param f The failure of this Promise.
+ */
+ void resolve(T v, Throwable f) {
+ // critical section: only one resolver at a time
+ synchronized (resolved) {
+ if (resolved.getCount() == 0) {
+ throw new IllegalStateException("Already resolved");
+ }
+ /*
+ * The resolved state variables must be set before opening the
+ * latch. This safely publishes them to be read by other threads
+ * that must verify the latch is open before reading.
+ */
+ value = v;
+ fail = f;
+ resolved.countDown();
+ }
+ notifyCallbacks(); // call any registered callbacks
+ }
+
+ /**
+ * Call any registered callbacks if this Promise is resolved.
+ */
+ private void notifyCallbacks() {
+ if (resolved.getCount() != 0) {
+ return; // return if not resolved
+ }
+
+ /*
+ * Note: multiple threads can be in this method removing callbacks from
+ * the queue and calling them, so the order in which callbacks are
+ * called cannot be specified.
+ */
+ for (Runnable callback = callbacks.poll(); callback != null; callback = callbacks.poll()) {
+ try {
+ callback.run();
+ } catch (Throwable t) {
+ Logger.logCallbackException(t);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDone() {
+ return resolved.getCount() == 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public T getValue() throws InvocationTargetException, InterruptedException {
+ resolved.await();
+ if (fail == null) {
+ return value;
+ }
+ throw new InvocationTargetException(fail);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Throwable getFailure() throws InterruptedException {
+ resolved.await();
+ return fail;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Promise<T> onResolve(Runnable callback) {
+ callbacks.offer(callback);
+ notifyCallbacks(); // call any registered callbacks
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <R> Promise<R> then(Success<? super T, ? extends R> success, Failure failure) {
+ PromiseImpl<R> chained = new PromiseImpl<R>();
+ onResolve(new Then<R>(chained, success, failure));
+ return chained;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <R> Promise<R> then(Success<? super T, ? extends R> success) {
+ return then(success, null);
+ }
+
+ /**
+ * A callback used to chain promises for the {@link #then(Success, Failure)}
+ * method.
+ *
+ * @Immutable
+ */
+ private final class Then<R> implements Runnable {
+ private final PromiseImpl<R> chained;
+ private final Success<T, ? extends R> success;
+ private final Failure failure;
+
+ @SuppressWarnings("unchecked")
+ Then(PromiseImpl<R> chained, Success<? super T, ? extends R> success, Failure failure) {
+ this.chained = chained;
+ this.success = (Success<T, ? extends R>) success;
+ this.failure = failure;
+ }
+
+ public void run() {
+ Throwable f;
+ final boolean interrupted = Thread.interrupted();
+ try {
+ f = getFailure();
+ } catch (Throwable e) {
+ f = e; // propagate new exception
+ } finally {
+ if (interrupted) { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
+ if (f != null) {
+ if (failure != null) {
+ try {
+ failure.fail(PromiseImpl.this);
+ } catch (Throwable e) {
+ f = e; // propagate new exception
+ }
+ }
+ // fail chained
+ chained.resolve(null, f);
+ return;
+ }
+ Promise<? extends R> returned = null;
+ if (success != null) {
+ try {
+ returned = success.call(PromiseImpl.this);
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ }
+ if (returned == null) {
+ // resolve chained with null value
+ chained.resolve(null, null);
+ } else {
+ // resolve chained when returned promise is resolved
+ returned.onResolve(new Chain<R>(chained, returned));
+ }
+ }
+ }
+
+ /**
+ * A callback used to resolve the chained Promise when the Promise promise
+ * is resolved.
+ *
+ * @Immutable
+ */
+ private final static class Chain<R> implements Runnable {
+ private final PromiseImpl<R> chained;
+ private final Promise<? extends R> promise;
+ private final Throwable failure;
+
+ Chain(PromiseImpl<R> chained, Promise<? extends R> promise) {
+ this.chained = chained;
+ this.promise = promise;
+ this.failure = null;
+ }
+
+ Chain(PromiseImpl<R> chained, Promise<? extends R> promise, Throwable failure) {
+ this.chained = chained;
+ this.promise = promise;
+ this.failure = failure;
+ }
+
+ public void run() {
+ R value = null;
+ Throwable f;
+ final boolean interrupted = Thread.interrupted();
+ try {
+ f = promise.getFailure();
+ if (f == null) {
+ value = promise.getValue();
+ } else if (failure != null) {
+ f = failure;
+ }
+ } catch (Throwable e) {
+ f = e; // propagate new exception
+ } finally {
+ if (interrupted) { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
+ chained.resolve(value, f);
+ }
+ }
+
+ /**
+ * Resolve this Promise with the specified Promise.
+ *
+ * <p>
+ * If the specified Promise is successfully resolved, this Promise is
+ * resolved with the value of the specified Promise. If the specified
+ * Promise is resolved with a failure, this Promise is resolved with the
+ * failure of the specified Promise.
+ *
+ * @param with A Promise whose value or failure must be used to resolve this
+ * Promise. Must not be {@code null}.
+ * @return A Promise that is resolved only when this Promise is resolved by
+ * the specified Promise. The returned Promise must be successfully
+ * resolved with the value {@code null}, if this Promise was
+ * resolved by the specified Promise. The returned Promise must be
+ * resolved with a failure of {@link IllegalStateException}, if this
+ * Promise was already resolved when the specified Promise was
+ * resolved.
+ */
+ Promise<Void> resolveWith(Promise<? extends T> with) {
+ PromiseImpl<Void> chained = new PromiseImpl<Void>();
+ ResolveWith resolveWith = new ResolveWith(chained);
+ with.then(resolveWith, resolveWith);
+ return chained;
+ }
+
+ /**
+ * A callback used to resolve this Promise with another Promise for the
+ * {@link PromiseImpl#resolveWith(Promise)} method.
+ *
+ * @Immutable
+ */
+ private final class ResolveWith implements Success<T, Void>, Failure {
+ private final PromiseImpl<Void> chained;
+
+ ResolveWith(PromiseImpl<Void> chained) {
+ this.chained = chained;
+ }
+
+ public Promise<Void> call(Promise<T> with) throws Exception {
+ try {
+ resolve(with.getValue(), null);
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return null;
+ }
+ chained.resolve(null, null);
+ return null;
+ }
+
+ public void fail(Promise<?> with) throws Exception {
+ try {
+ resolve(null, with.getFailure());
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ chained.resolve(null, null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Promise<T> filter(Predicate<? super T> predicate) {
+ return then(new Filter<T>(predicate));
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#filter(Predicate)} method.
+ *
+ * @Immutable
+ */
+ private static final class Filter<T> implements Success<T, T> {
+ private final Predicate<? super T> predicate;
+
+ Filter(Predicate<? super T> predicate) {
+ this.predicate = requireNonNull(predicate);
+ }
+
+ public Promise<T> call(Promise<T> resolved) throws Exception {
+ if (predicate.test(resolved.getValue())) {
+ return resolved;
+ }
+ throw new NoSuchElementException();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <R> Promise<R> map(Function<? super T, ? extends R> mapper) {
+ return then(new Map<T, R>(mapper));
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#map(Function)} method.
+ *
+ * @Immutable
+ */
+ private static final class Map<T, R> implements Success<T, R> {
+ private final Function<? super T, ? extends R> mapper;
+
+ Map(Function<? super T, ? extends R> mapper) {
+ this.mapper = requireNonNull(mapper);
+ }
+
+ public Promise<R> call(Promise<T> resolved) throws Exception {
+ return new PromiseImpl<R>(mapper.apply(resolved.getValue()), null);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <R> Promise<R> flatMap(Function<? super T, Promise<? extends R>> mapper) {
+ return then(new FlatMap<T, R>(mapper));
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#flatMap(Function)} method.
+ *
+ * @Immutable
+ */
+ private static final class FlatMap<T, R> implements Success<T, R> {
+ private final Function<? super T, Promise<? extends R>> mapper;
+
+ FlatMap(Function<? super T, Promise<? extends R>> mapper) {
+ this.mapper = requireNonNull(mapper);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Promise<R> call(Promise<T> resolved) throws Exception {
+ return (Promise<R>) mapper.apply(resolved.getValue());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Promise<T> recover(Function<Promise<?>, ? extends T> recovery) {
+ PromiseImpl<T> chained = new PromiseImpl<T>();
+ Recover<T> recover = new Recover<T>(chained, recovery);
+ then(recover, recover);
+ return chained;
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#recover(Function)} method.
+ *
+ * @Immutable
+ */
+ private static final class Recover<T> implements Success<T, Void>, Failure {
+ private final PromiseImpl<T> chained;
+ private final Function<Promise<?>, ? extends T> recovery;
+
+ Recover(PromiseImpl<T> chained, Function<Promise<?>, ? extends T> recovery) {
+ this.chained = chained;
+ this.recovery = requireNonNull(recovery);
+ }
+
+ public Promise<Void> call(Promise<T> resolved) throws Exception {
+ T value;
+ try {
+ value = resolved.getValue();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return null;
+ }
+ chained.resolve(value, null);
+ return null;
+ }
+
+ public void fail(Promise<?> resolved) throws Exception {
+ T recovered;
+ Throwable failure;
+ try {
+ recovered = recovery.apply(resolved);
+ failure = resolved.getFailure();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ if (recovered == null) {
+ chained.resolve(null, failure);
+ } else {
+ chained.resolve(recovered, null);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Promise<T> recoverWith(Function<Promise<?>, Promise<? extends T>> recovery) {
+ PromiseImpl<T> chained = new PromiseImpl<T>();
+ RecoverWith<T> recoverWith = new RecoverWith<T>(chained, recovery);
+ then(recoverWith, recoverWith);
+ return chained;
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#recoverWith(Function)} method.
+ *
+ * @Immutable
+ */
+ private static final class RecoverWith<T> implements Success<T, Void>, Failure {
+ private final PromiseImpl<T> chained;
+ private final Function<Promise<?>, Promise<? extends T>> recovery;
+
+ RecoverWith(PromiseImpl<T> chained, Function<Promise<?>, Promise<? extends T>> recovery) {
+ this.chained = chained;
+ this.recovery = requireNonNull(recovery);
+ }
+
+ public Promise<Void> call(Promise<T> resolved) throws Exception {
+ T value;
+ try {
+ value = resolved.getValue();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return null;
+ }
+ chained.resolve(value, null);
+ return null;
+ }
+
+ public void fail(Promise<?> resolved) throws Exception {
+ Promise<? extends T> recovered;
+ Throwable failure;
+ try {
+ recovered = recovery.apply(resolved);
+ failure = resolved.getFailure();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ if (recovered == null) {
+ chained.resolve(null, failure);
+ } else {
+ recovered.onResolve(new Chain<T>(chained, recovered));
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Promise<T> fallbackTo(Promise<? extends T> fallback) {
+ PromiseImpl<T> chained = new PromiseImpl<T>();
+ FallbackTo<T> fallbackTo = new FallbackTo<T>(chained, fallback);
+ then(fallbackTo, fallbackTo);
+ return chained;
+ }
+
+ /**
+ * A callback used by the {@link PromiseImpl#fallbackTo(Promise)} method.
+ *
+ * @Immutable
+ */
+ private static final class FallbackTo<T> implements Success<T, Void>, Failure {
+ private final PromiseImpl<T> chained;
+ private final Promise<? extends T> fallback;
+
+ FallbackTo(PromiseImpl<T> chained, Promise<? extends T> fallback) {
+ this.chained = chained;
+ this.fallback = requireNonNull(fallback);
+ }
+
+ public Promise<Void> call(Promise<T> resolved) throws Exception {
+ T value;
+ try {
+ value = resolved.getValue();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return null;
+ }
+ chained.resolve(value, null);
+ return null;
+ }
+
+ public void fail(Promise<?> resolved) throws Exception {
+ Throwable failure;
+ try {
+ failure = resolved.getFailure();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ fallback.onResolve(new Chain<T>(chained, fallback, failure));
+ }
+ }
+
+ static <V> V requireNonNull(V value) {
+ if (value != null) {
+ return value;
+ }
+ throw new NullPointerException();
+ }
+
+ /**
+ * Use the lazy initialization holder class idiom to delay creating a Logger
+ * until we actually need it.
+ */
+ private static final class Logger {
+ private final static java.util.logging.Logger LOGGER;
+ static {
+ LOGGER = java.util.logging.Logger.getLogger(PromiseImpl.class.getName());
+ }
+
+ static void logCallbackException(Throwable t) {
+ LOGGER.log(java.util.logging.Level.WARNING, "Exception from Promise callback", t);
+ }
+ }
+}
diff --git a/org/osgi/util/promise/Promises.java b/org/osgi/util/promise/Promises.java
new file mode 100644
index 0000000..afd8384
--- /dev/null
+++ b/org/osgi/util/promise/Promises.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import static org.osgi.util.promise.PromiseImpl.requireNonNull;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Static helper methods for {@link Promise}s.
+ *
+ * @ThreadSafe
+ * @author $Id: 06d5066753909c09410f6544115df01c970265b2 $
+ */
+public class Promises {
+ private Promises() {
+ // disallow object creation
+ }
+
+ /**
+ * Create a new Promise that has been resolved with the specified value.
+ *
+ * @param <T> The value type associated with the returned Promise.
+ * @param value The value of the resolved Promise.
+ * @return A new Promise that has been resolved with the specified value.
+ */
+ public static <T> Promise<T> resolved(T value) {
+ return new PromiseImpl<T>(value, null);
+ }
+
+ /**
+ * Create a new Promise that has been resolved with the specified failure.
+ *
+ * @param <T> The value type associated with the returned Promise.
+ * @param failure The failure of the resolved Promise. Must not be
+ * {@code null}.
+ * @return A new Promise that has been resolved with the specified failure.
+ */
+ public static <T> Promise<T> failed(Throwable failure) {
+ return new PromiseImpl<T>(null, requireNonNull(failure));
+ }
+
+ /**
+ * Create a new Promise that is a latch on the resolution of the specified
+ * Promises.
+ *
+ * <p>
+ * The new Promise acts as a gate and must be resolved after all of the
+ * specified Promises are resolved.
+ *
+ * @param <T> The value type of the List value associated with the returned
+ * Promise.
+ * @param <S> A subtype of the value type of the List value associated with
+ * the returned Promise.
+ * @param promises The Promises which must be resolved before the returned
+ * Promise must be resolved. Must not be {@code null} and all of the
+ * elements in the collection must not be {@code null}.
+ * @return A Promise that is resolved only when all the specified Promises
+ * are resolved. The returned Promise must be successfully resolved
+ * with a List of the values in the order of the specified Promises
+ * if all the specified Promises are successfully resolved. The List
+ * in the returned Promise is the property of the caller and is
+ * modifiable. The returned Promise must be resolved with a failure
+ * of {@link FailedPromisesException} if any of the specified
+ * Promises are resolved with a failure. The failure
+ * {@link FailedPromisesException} must contain all of the specified
+ * Promises which resolved with a failure.
+ */
+ public static <T, S extends T> Promise<List<T>> all(Collection<Promise<S>> promises) {
+ if (promises.isEmpty()) {
+ List<T> result = new ArrayList<T>();
+ return resolved(result);
+ }
+ /* make a copy and capture the ordering */
+ List<Promise<? extends T>> list = new ArrayList<Promise<? extends T>>(promises);
+ PromiseImpl<List<T>> chained = new PromiseImpl<List<T>>();
+ All<T> all = new All<T>(chained, list);
+ for (Promise<? extends T> promise : list) {
+ promise.onResolve(all);
+ }
+ return chained;
+ }
+
+ /**
+ * Create a new Promise that is a latch on the resolution of the specified
+ * Promises.
+ *
+ * <p>
+ * The new Promise acts as a gate and must be resolved after all of the
+ * specified Promises are resolved.
+ *
+ * @param <T> The value type associated with the specified Promises.
+ * @param promises The Promises which must be resolved before the returned
+ * Promise must be resolved. Must not be {@code null} and all of the
+ * arguments must not be {@code null}.
+ * @return A Promise that is resolved only when all the specified Promises
+ * are resolved. The returned Promise must be successfully resolved
+ * with a List of the values in the order of the specified Promises
+ * if all the specified Promises are successfully resolved. The List
+ * in the returned Promise is the property of the caller and is
+ * modifiable. The returned Promise must be resolved with a failure
+ * of {@link FailedPromisesException} if any of the specified
+ * Promises are resolved with a failure. The failure
+ * {@link FailedPromisesException} must contain all of the specified
+ * Promises which resolved with a failure.
+ */
+ public static <T> Promise<List<T>> all(Promise<? extends T>... promises) {
+ @SuppressWarnings("unchecked")
+ List<Promise<T>> list = Arrays.asList((Promise<T>[]) promises);
+ return all(list);
+ }
+
+ /**
+ * A callback used to resolve a Promise when the specified list of Promises
+ * are resolved for the {@link Promises#all(Collection)} method.
+ *
+ * @ThreadSafe
+ */
+ private static final class All<T> implements Runnable {
+ private final PromiseImpl<List<T>> chained;
+ private final List<Promise<? extends T>> promises;
+ private final AtomicInteger promiseCount;
+
+ All(PromiseImpl<List<T>> chained, List<Promise<? extends T>> promises) {
+ this.chained = chained;
+ this.promises = promises;
+ this.promiseCount = new AtomicInteger(promises.size());
+ }
+
+ public void run() {
+ if (promiseCount.decrementAndGet() != 0) {
+ return;
+ }
+ List<T> result = new ArrayList<T>(promises.size());
+ List<Promise<?>> failed = new ArrayList<Promise<?>>(promises.size());
+ Throwable cause = null;
+ for (Promise<? extends T> promise : promises) {
+ Throwable failure;
+ T value;
+ try {
+ failure = promise.getFailure();
+ value = (failure != null) ? null : promise.getValue();
+ } catch (Throwable e) {
+ chained.resolve(null, e);
+ return;
+ }
+ if (failure != null) {
+ failed.add(promise);
+ if (cause == null) {
+ cause = failure;
+ }
+ } else {
+ result.add(value);
+ }
+ }
+ if (failed.isEmpty()) {
+ chained.resolve(result, null);
+ } else {
+ chained.resolve(null, new FailedPromisesException(failed, cause));
+ }
+ }
+ }
+}
diff --git a/org/osgi/util/promise/Success.java b/org/osgi/util/promise/Success.java
new file mode 100644
index 0000000..86d85ce
--- /dev/null
+++ b/org/osgi/util/promise/Success.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.util.promise;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Success callback for a Promise.
+ *
+ * <p>
+ * A Success callback is registered with a {@link Promise} using the
+ * {@link Promise#then(Success)} method and is called if the Promise is resolved
+ * successfully.
+ *
+ * <p>
+ * This is a functional interface and can be used as the assignment target for a
+ * lambda expression or method reference.
+ *
+ * @param <T> The value type of the resolved Promise passed as input to this
+ * callback.
+ * @param <R> The value type of the returned Promise from this callback.
+ *
+ * @ThreadSafe
+ * @author $Id: c29fc4fb6df284dd08c4a18e231fe626e820ffab $
+ */
+ at ConsumerType
+public interface Success<T, R> {
+ /**
+ * Success callback for a Promise.
+ *
+ * <p>
+ * This method is called if the Promise with which it is registered resolves
+ * successfully.
+ *
+ * <p>
+ * In the remainder of this description we will refer to the Promise
+ * returned by this method as the returned Promise and the Promise returned
+ * by {@link Promise#then(Success)} when this Success callback was
+ * registered as the chained Promise.
+ *
+ * <p>
+ * If the returned Promise is {@code null} then the chained Promise must
+ * resolve immediately with a successful value of {@code null}. If the
+ * returned Promise is not {@code null} then the chained Promise must be
+ * resolved when the returned Promise is resolved.
+ *
+ * @param resolved The successfully resolved {@link Promise}.
+ * @return The Promise to use to resolve the chained Promise, or
+ * {@code null} if the chained Promise is to be resolved immediately
+ * with the value {@code null}.
+ * @throws Exception The chained Promise must be failed with the thrown
+ * exception.
+ */
+ Promise<R> call(Promise<T> resolved) throws Exception;
+}
diff --git a/org/osgi/util/position/package-info.java b/org/osgi/util/promise/package-info.java
similarity index 62%
copy from org/osgi/util/position/package-info.java
copy to org/osgi/util/promise/package-info.java
index 06eeb68..054282c 100644
--- a/org/osgi/util/position/package-info.java
+++ b/org/osgi/util/promise/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014). 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,7 +15,7 @@
*/
/**
- * Position Package Version 1.0.
+ * Promise Package Version 1.0.
*
* <p>
* Bundles wishing to use this package must list the package in the
@@ -24,11 +24,17 @@
* <p>
* Example import for consumers using the API in this package:
* <p>
- * {@code Import-Package: org.osgi.util.position; version="[1.0,2.0)"}
+ * {@code Import-Package: org.osgi.util.promise; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.util.promise; version="[1.0,1.1)"}
*
- * @version 1.0
- * @author $Id: d3a19f2ae25abe3997c9501497d933a608f7e49e $
+ * @author $Id: 5a3ec65d3b7e7ebdd2278d75675b8a808e6cb2bf $
*/
-package org.osgi.util.position;
+ at Version("1.0")
+package org.osgi.util.promise;
+
+import org.osgi.annotation.versioning.Version;
diff --git a/org/osgi/namespace/extender/packageinfo b/org/osgi/util/promise/packageinfo
similarity index 100%
copy from org/osgi/namespace/extender/packageinfo
copy to org/osgi/util/promise/packageinfo
diff --git a/org/osgi/util/xml/package-info.java b/org/osgi/util/xml/package-info.java
index 1463961..0c0fcde 100644
--- a/org/osgi/util/xml/package-info.java
+++ b/org/osgi/util/xml/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2013). 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.
@@ -26,8 +26,8 @@
* <p>
* {@code Import-Package: org.osgi.util.xml; version="[1.0,2.0)"}
*
- * @version 1.0
- * @author $Id: 5692f7a8c81b2bc10e7cd8a8fb849f91e930d565 $
+ * @version 1.0.1
+ * @author $Id: 8d3c57bb571e385d704a2dc58ac8d9553b8e0724 $
*/
package org.osgi.util.xml;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/osgi-compendium.git
More information about the pkg-java-commits
mailing list