You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2023/11/28 06:58:59 UTC
(felix-dev) branch master updated: Revert "Unmaintained code removal - ipojo"
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 32e0e200fc Revert "Unmaintained code removal - ipojo"
32e0e200fc is described below
commit 32e0e200fc9498ffff4c80807a82535d44b49bd0
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue Nov 28 07:58:12 2023 +0100
Revert "Unmaintained code removal - ipojo"
This reverts commit 4887e0856d789c35b82ffb69dab658963d42fe78.
---
ipojo/.gitignore | 4 +
ipojo/arch/changelog.txt | 26 +
ipojo/arch/obr.xml | 24 +
ipojo/arch/pom.xml | 118 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../apache/felix/ipojo/arch/ArchCommandImpl.java | 233 +++
.../handler-tutorial/FooService-And-Impl/pom.xml | 65 +
.../org/apache/felix/ipojo/foo/FooService.java | 29 +
.../felix/ipojo/foo/impl/FooServiceImpl.java | 41 +
.../handler-tutorial/Log-Handler-Consumer/pom.xml | 57 +
.../ipojo/log/handler/example/SimpleComponent.java | 26 +
.../handler-tutorial/Log-Handler-In-Felix/pom.xml | 107 ++
.../handler-tutorial/Log-Handler/pom.xml | 76 +
.../org/apache/felix/ipojo/log/handler/Log.java | 35 +
.../apache/felix/ipojo/log/handler/LogHandler.java | 109 ++
.../Property-Handler-Consumer/pom.xml | 68 +
.../src/main/ipojo/metadata.xml | 9 +
.../properties/example/PropertiesTester.java | 78 +
.../Property-Handler-In-Felix/pom.xml | 120 ++
.../main/resources/props/my-properties.properties | 21 +
.../main/resources/props/properties-i1.properties | 21 +
.../handler-tutorial/Property-Handler/pom.xml | 61 +
.../felix/ipojo/handler/properties/Properties.java | 33 +
.../handler/properties/PropertiesHandler.java | 295 ++++
ipojo/distributions/handler-tutorial/pom.xml | 139 ++
.../ipojo-webconsole-quicktart/pom.xml | 148 ++
.../src/main/assembly/distribution.xml | 59 +
ipojo/distributions/pom.xml | 92 ++
ipojo/handler/eventadmin/changelog.txt | 32 +
.../eventadmin/eventadmin-handler-it/pom.xml | 378 +++++
.../src/it/event-admin-it/pom.xml | 46 +
.../test/donut/AsyncEventProviderImpl.java | 74 +
.../ipojo/handler/eventadmin/test/donut/Donut.java | 100 ++
.../eventadmin/test/donut/DonutConsumer.java | 81 +
.../eventadmin/test/donut/DonutConsumerImpl.java | 194 +++
.../test/donut/DonutEventProviderImpl.java | 74 +
.../eventadmin/test/donut/DonutProvider.java | 35 +
.../eventadmin/test/donut/DonutProviderImpl.java | 76 +
.../eventadmin/test/donut/EventConsumerImpl.java | 199 +++
.../eventadmin/test/donut/EventTracker.java | 63 +
.../eventadmin/test/donut/EventTrackerImpl.java | 152 ++
.../test/donut/SyncEventProviderImpl.java | 74 +
.../event-admin-it/src/main/resources/metadata.xml | 199 +++
.../ipojo/handler/eventadmin/test/Common.java | 76 +
.../handler/eventadmin/test/EahTestUtils.java | 226 +++
.../eventadmin/test/TestBadConfigurations.java | 958 ++++++++++++
.../eventadmin/test/TestEventAdminHandler.java | 714 +++++++++
.../TestEventAdminHandlerWithNewAttributes.java | 715 +++++++++
.../handler/eventadmin/test/TestPublisher.java | 714 +++++++++
.../src/main/appended-resources/META-INF/NOTICE | 0
.../eventadmin/eventadmin-handler/changelog.txt | 32 +
.../eventadmin/eventadmin-handler/metadata.xml | 41 +
.../handler/eventadmin/eventadmin-handler/obr.xml | 31 +
.../handler/eventadmin/eventadmin-handler/pom.xml | 113 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../felix/ipojo/handlers/event/EventUtil.java | 173 ++
.../publisher/EventAdminPublisherHandler.java | 282 ++++
.../EventAdminPublisherHandlerDescription.java | 102 ++
.../publisher/EventAdminPublisherMetadata.java | 242 +++
.../ipojo/handlers/event/publisher/Publisher.java | 70 +
.../event/publisher/PublisherDescription.java | 76 +
.../handlers/event/publisher/PublisherImpl.java | 145 ++
.../subscriber/EventAdminSubscriberHandler.java | 421 +++++
.../EventAdminSubscriberHandlerDescription.java | 61 +
.../subscriber/EventAdminSubscriberMetadata.java | 305 ++++
.../src/main/resources/event-admin.xsd | 90 ++
ipojo/handler/eventadmin/pom.xml | 37 +
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/handler/extender/changelog.txt | 26 +
ipojo/handler/extender/metadata.xml | 24 +
ipojo/handler/extender/obr.xml | 25 +
ipojo/handler/extender/pom.xml | 102 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../ipojo/handler/extender/BundleTracker.java | 157 ++
.../ipojo/handler/extender/ExtenderManager.java | 135 ++
.../handler/extender/ExtenderModelHandler.java | 95 ++
.../src/main/resources/extender-pattern.xsd | 42 +
ipojo/handler/jmx/changelog.txt | 23 +
ipojo/handler/jmx/jmx-handler-it/pom.xml | 389 +++++
.../jmx/jmx-handler-it/src/it/jmx-it/pom.xml | 52 +
.../jmx/components/SimpleManagedComponent.java | 55 +
.../SimpleManagedComponentAnnotated.java | 69 +
.../SimpleManagedComponentAnnotatedDeprecated.java | 70 +
.../src/it/jmx-it/src/main/resources/metadata.xml | 46 +
.../felix/ipojo/handler/jmx/test/Common.java | 216 +++
.../felix/ipojo/handler/jmx/test/TestMBean.java | 224 +++
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/handler/jmx/jmx-handler/changelog.txt | 23 +
ipojo/handler/jmx/jmx-handler/metadata.xml | 22 +
ipojo/handler/jmx/jmx-handler/obr.xml | 30 +
ipojo/handler/jmx/jmx-handler/pom.xml | 105 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../felix/ipojo/handlers/jmx/DynamicMBeanImpl.java | 408 +++++
.../handlers/jmx/DynamicMBeanWRegisterImpl.java | 165 ++
.../ipojo/handlers/jmx/JMXHandlerDescription.java | 71 +
.../ipojo/handlers/jmx/JmxConfigFieldMap.java | 297 ++++
.../felix/ipojo/handlers/jmx/MBeanHandler.java | 664 ++++++++
.../felix/ipojo/handlers/jmx/MethodField.java | 101 ++
.../ipojo/handlers/jmx/NotificationField.java | 69 +
.../felix/ipojo/handlers/jmx/PropertyField.java | 196 +++
.../jmx/jmx-handler/src/main/resources/jmx.xsd | 177 +++
ipojo/handler/jmx/pom.xml | 115 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/handler/temporal/changelog.txt | 42 +
ipojo/handler/temporal/pom.xml | 115 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 17 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 4 +
.../temporal-dependency-handler-it/pom.xml | 390 +++++
.../src/it/temporal-it/pom.xml | 46 +
.../temporal/components/CheckServiceProvider.java | 47 +
.../components/CollectionCheckServiceProvider.java | 58 +
.../handler/temporal/components/FooProvider.java | 55 +
.../components/MultipleCheckServiceProvider.java | 48 +
.../temporal/components/NullableFooProvider.java | 55 +
.../proxy/CheckServiceProviderHelper.java | 64 +
.../CollectionCheckServiceProviderHelper.java | 62 +
.../proxy/HelpedCheckServiceProvider.java | 43 +
.../HelpedCollectionCheckServiceProvider.java | 43 +
.../handler/temporal/services/BarService.java | 29 +
.../handler/temporal/services/CheckService.java | 31 +
.../handler/temporal/services/ChildInterface.java | 25 +
.../handler/temporal/services/FooService.java | 39 +
.../temporal/services/ParentInterface1.java | 25 +
.../temporal/services/ParentInterface2.java | 25 +
.../temporal/services/ParentParentInterface.java | 25 +
.../it/temporal-it/src/main/resources/metadata.xml | 262 ++++
.../felix/ipojo/handler/temporal/test/Common.java | 40 +
.../temporal/test/DefaultImplementationTest.java | 535 +++++++
.../ipojo/handler/temporal/test/DelayTest.java | 494 ++++++
.../handler/temporal/test/DelayedProvider.java | 71 +
.../ipojo/handler/temporal/test/EmptyTest.java | 303 ++++
.../ipojo/handler/temporal/test/FilterTest.java | 264 ++++
.../ipojo/handler/temporal/test/NoDelayTest.java | 146 ++
.../ipojo/handler/temporal/test/NullTest.java | 536 +++++++
.../ipojo/handler/temporal/test/NullableTest.java | 535 +++++++
.../ipojo/handler/temporal/test/TemporalTest.java | 345 ++++
.../src/main/appended-resources/META-INF/NOTICE | 0
.../temporal-dependency-handler/changelog.txt | 42 +
.../temporal/temporal-dependency-handler/obr.xml | 25 +
.../temporal/temporal-dependency-handler/pom.xml | 122 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 17 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 4 +
.../ipojo/handler/temporal/ProxyGenerator.java | 183 +++
.../ipojo/handler/temporal/ServiceCollection.java | 334 ++++
.../felix/ipojo/handler/temporal/ServiceUsage.java | 77 +
.../ipojo/handler/temporal/TemporalDependency.java | 555 +++++++
.../ipojo/handler/temporal/TemporalHandler.java | 317 ++++
.../src/main/resources/metadata.xml | 28 +
.../src/main/resources/temporal.xsd | 63 +
ipojo/handler/transaction/pom.xml | 115 ++
.../transaction/transaction-handler-it/pom.xml | 413 +++++
.../src/it/transaction-it/pom.xml | 52 +
.../components/ComponentUsingAnnotations.java | 53 +
.../transaction/components/FooDelegator.java | 96 ++
.../handler/transaction/components/FooImpl.java | 47 +
.../handler/transaction/services/CheckService.java | 44 +
.../ipojo/handler/transaction/services/Foo.java | 32 +
.../src/main/resources/annotation.xml | 22 +
.../it/transaction-it/src/main/resources/foo.xml | 24 +
.../src/main/resources/mandatory.xml | 44 +
.../it/transaction-it/src/main/resources/never.xml | 44 +
.../src/main/resources/notsupported.xml | 44 +
.../transaction-it/src/main/resources/requires.xml | 44 +
.../src/main/resources/requiresnew.xml | 44 +
.../src/main/resources/supported.xml | 44 +
.../ipojo/handler/transaction/test/Common.java | 217 +++
.../handler/transaction/test/TestAnnotations.java | 138 ++
.../handler/transaction/test/TestInstallation.java | 128 ++
.../handler/transaction/test/TestInvalidation.java | 121 ++
.../handler/transaction/test/TestMandatory.java | 397 +++++
.../ipojo/handler/transaction/test/TestNever.java | 169 ++
.../handler/transaction/test/TestNotSupported.java | 403 +++++
.../handler/transaction/test/TestRequires.java | 406 +++++
.../handler/transaction/test/TestRequiresNew.java | 219 +++
.../handler/transaction/test/TestSupported.java | 411 +++++
.../src/main/appended-resources/META-INF/NOTICE | 0
.../transaction/transaction-handler/pom.xml | 99 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../ipojo/transaction/TransactionHandler.java | 310 ++++
.../ipojo/transaction/TransactionalMethod.java | 306 ++++
.../src/main/resources/metadata.xml | 32 +
ipojo/handler/whiteboard/changelog.txt | 33 +
ipojo/handler/whiteboard/pom.xml | 115 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 12 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../whiteboard/whiteboard-handler-it/pom.xml | 385 +++++
.../src/it/whiteboard-it/pom.xml | 52 +
.../handler/whiteboard/components/FooProvider.java | 36 +
.../components/FooWhiteBoardPattern.java | 94 ++
.../handler/whiteboard/services/FooService.java | 26 +
.../handler/whiteboard/services/Observable.java | 28 +
.../whiteboard-it/src/main/resources/metadata.xml | 65 +
.../ipojo/handler/whiteboard/test/Common.java | 216 +++
.../test/TestWhiteboardPatternHandler.java | 302 ++++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../whiteboard/whiteboard-handler/changelog.txt | 33 +
.../whiteboard/whiteboard-handler/metadata.xml | 30 +
.../handler/whiteboard/whiteboard-handler/obr.xml | 25 +
.../handler/whiteboard/whiteboard-handler/pom.xml | 103 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../felix/ipojo/handler/wbp/WhiteBoardManager.java | 174 +++
.../handler/wbp/WhiteBoardPatternHandler.java | 131 ++
.../src/main/resources/whiteboard-pattern.xsd | 45 +
ipojo/junit4osgi/felix-command/LICENSE | 202 +++
ipojo/junit4osgi/felix-command/NOTICE | 28 +
ipojo/junit4osgi/felix-command/doc/changelog.txt | 3 +
ipojo/junit4osgi/felix-command/metadata.xml | 28 +
ipojo/junit4osgi/felix-command/pom.xml | 111 ++
.../ipojo/junit4osgi/command/JunitCommand.java | 140 ++
ipojo/junit4osgi/immediate-launcher/LICENSE | 202 +++
ipojo/junit4osgi/immediate-launcher/NOTICE | 27 +
ipojo/junit4osgi/immediate-launcher/metadata.xml | 29 +
ipojo/junit4osgi/immediate-launcher/pom.xml | 111 ++
.../ipojo/junit4osgi/command/ImmediateRunner.java | 42 +
ipojo/junit4osgi/junit4osgi/LICENSE | 202 +++
ipojo/junit4osgi/junit4osgi/LICENSE.junit | 86 +
ipojo/junit4osgi/junit4osgi/NOTICE | 27 +
ipojo/junit4osgi/junit4osgi/doc/changelog.txt | 3 +
ipojo/junit4osgi/junit4osgi/metadata.xml | 36 +
ipojo/junit4osgi/junit4osgi/pom.xml | 152 ++
.../org/apache/felix/ipojo/junit4osgi/Helper.java | 58 +
.../felix/ipojo/junit4osgi/OSGiJunitRunner.java | 72 +
.../felix/ipojo/junit4osgi/OSGiTestCase.java | 782 ++++++++++
.../felix/ipojo/junit4osgi/OSGiTestSuite.java | 127 ++
.../ipojo/junit4osgi/helpers/IPOJOHelper.java | 737 +++++++++
.../felix/ipojo/junit4osgi/impl/JunitExtender.java | 399 +++++
.../ipojo/junit4osgi/impl/LogServiceImpl.java | 107 ++
.../felix/ipojo/junit4osgi/impl/ResultPrinter.java | 227 +++
.../ipojo/junit4osgi/test/TestOSGiTestCase.java | 37 +
.../ipojo/junit4osgi/test/TestOSGiTestSuite.java | 48 +
.../felix/ipojo/junit4osgi/test/TestTestCase.java | 49 +
.../felix/ipojo/junit4osgi/test/TestTestSuite.java | 41 +
ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE | 202 +++
ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE | 31 +
.../maven-junit4osgi-plugin/doc/changelog.txt | 3 +
ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml | 113 ++
.../felix/ipojo/junit4osgi/plugin/Installer.java | 207 +++
.../ipojo/junit4osgi/plugin/Junit4osgiPlugin.java | 755 +++++++++
.../felix/ipojo/junit4osgi/plugin/Report.java | 239 +++
.../ipojo/junit4osgi/plugin/ReportPrintStream.java | 101 ++
.../junit4osgi/plugin/StringOutputStream.java | 121 ++
.../felix/ipojo/junit4osgi/plugin/XMLReport.java | 359 +++++
.../junit4osgi/plugin/log/LogServiceImpl.java | 187 +++
ipojo/junit4osgi/pom.xml | 59 +
ipojo/junit4osgi/swing-runner/LICENSE | 202 +++
ipojo/junit4osgi/swing-runner/NOTICE | 27 +
ipojo/junit4osgi/swing-runner/doc/changelog.txt | 3 +
ipojo/junit4osgi/swing-runner/metadata.xml | 28 +
ipojo/junit4osgi/swing-runner/pom.xml | 104 ++
.../junit4osgi/command/ResultCellRenderer.java | 69 +
.../ipojo/junit4osgi/command/ResultTableModel.java | 278 ++++
.../ipojo/junit4osgi/command/SwingRunner.form | 317 ++++
.../ipojo/junit4osgi/command/SwingRunner.java | 543 +++++++
.../ipojo/junit4osgi/command/TestListModel.java | 129 ++
ipojo/manipulator/annotations/changelog.txt | 225 +++
ipojo/manipulator/annotations/pom.xml | 51 +
.../annotations/src/main/appended-resources/NOTICE | 0
.../org/apache/felix/ipojo/annotations/Bind.java | 87 ++
.../felix/ipojo/annotations/BindingPolicy.java | 29 +
.../apache/felix/ipojo/annotations/Component.java | 178 +++
.../apache/felix/ipojo/annotations/Context.java | 54 +
.../apache/felix/ipojo/annotations/Controller.java | 52 +
.../apache/felix/ipojo/annotations/Handler.java | 63 +
.../felix/ipojo/annotations/HandlerBinding.java | 85 +
.../ipojo/annotations/HandlerDeclaration.java | 44 +
.../org/apache/felix/ipojo/annotations/Ignore.java | 42 +
.../felix/ipojo/annotations/Instantiate.java | 55 +
.../apache/felix/ipojo/annotations/Invalidate.java | 38 +
.../apache/felix/ipojo/annotations/Modified.java | 81 +
.../felix/ipojo/annotations/PostRegistration.java | 40 +
.../ipojo/annotations/PostUnregistration.java | 40 +
.../apache/felix/ipojo/annotations/Property.java | 56 +
.../apache/felix/ipojo/annotations/Provides.java | 92 ++
.../apache/felix/ipojo/annotations/Requires.java | 112 ++
.../felix/ipojo/annotations/ServiceController.java | 43 +
.../felix/ipojo/annotations/ServiceProperty.java | 57 +
.../ipojo/annotations/StaticServiceProperty.java | 61 +
.../apache/felix/ipojo/annotations/Stereotype.java | 72 +
.../org/apache/felix/ipojo/annotations/Unbind.java | 88 ++
.../apache/felix/ipojo/annotations/Updated.java | 47 +
.../apache/felix/ipojo/annotations/Validate.java | 38 +
.../org/apache/felix/ipojo/extender/Extender.java | 49 +
.../felix/ipojo/handler/temporal/Requires.java | 70 +
.../felix/ipojo/handler/temporal/Temporal.java | 75 +
.../felix/ipojo/handlers/event/Publisher.java | 69 +
.../felix/ipojo/handlers/event/Publishes.java | 60 +
.../felix/ipojo/handlers/event/Subscriber.java | 83 +
.../apache/felix/ipojo/handlers/jmx/Config.java | 62 +
.../apache/felix/ipojo/handlers/jmx/JMXBean.java | 61 +
.../apache/felix/ipojo/handlers/jmx/JMXMethod.java | 42 +
.../felix/ipojo/handlers/jmx/JMXProperty.java | 55 +
.../apache/felix/ipojo/handlers/jmx/Method.java | 43 +
.../apache/felix/ipojo/handlers/jmx/Property.java | 56 +
.../felix/ipojo/transaction/Transaction.java | 51 +
.../felix/ipojo/transaction/Transactional.java | 56 +
.../org/apache/felix/ipojo/whiteboard/Wbp.java | 54 +
.../apache/felix/ipojo/whiteboard/Whiteboards.java | 38 +
ipojo/manipulator/bnd-ipojo-plugin/changelog.txt | 152 ++
ipojo/manipulator/bnd-ipojo-plugin/pom.xml | 103 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 1 +
.../felix/ipojo/bnd/BndJarResourceStore.java | 243 +++
.../org/apache/felix/ipojo/bnd/BndReporter.java | 84 +
.../apache/felix/ipojo/bnd/ByteArrayResource.java | 43 +
.../java/org/apache/felix/ipojo/bnd/Manifests.java | 56 +
.../apache/felix/ipojo/bnd/PojoizationPlugin.java | 191 +++
.../felix/ipojo/bnd/ResourceMetadataProvider.java | 75 +
.../ipojo/bnd/BndJarResourceStoreTestCase.java | 170 ++
.../org/apache/felix/ipojo/bnd/EmptyComponent.java | 31 +
.../felix/ipojo/bnd/PojoizationPluginTestCase.java | 110 ++
.../src/test/resources/EMBED-MANIFEST-EMPTY.MF | 6 +
.../src/test/resources/EMBED-MANIFEST.MF | 21 +
.../metadata-components-and-instances.xml | 24 +
.../test/resources/metadata-components-only.xml | 22 +
.../src/test/resources/metadata-instances-only.xml | 22 +
.../src/test/resources/metadata-test-component.xml | 22 +
ipojo/manipulator/changelog.txt | 152 ++
ipojo/manipulator/ipojo-ant-task/changelog.txt | 197 +++
ipojo/manipulator/ipojo-ant-task/pom.xml | 166 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 3 +
.../org/apache/felix/ipojo/task/AntReporter.java | 68 +
.../org/apache/felix/ipojo/task/IPojoTask.java | 348 +++++
.../java/org/apache/felix/ipojo/task/IPojoc.java | 247 +++
.../main/resources/META-INF/constants.properties | 22 +
.../org.apache.felix.ipojo.manipulator.spi.Module | 1 +
.../src/main/resources/META-INF/xsd/composite.xsd | 147 ++
.../src/main/resources/META-INF/xsd/core.xsd | 704 +++++++++
.../main/resources/META-INF/xsd/event-admin.xsd | 90 ++
.../resources/META-INF/xsd/extender-pattern.xsd | 42 +
.../src/main/resources/META-INF/xsd/jmx.xsd | 177 +++
.../src/main/resources/META-INF/xsd/temporal.xsd | 61 +
.../resources/META-INF/xsd/whiteboard-pattern.xsd | 45 +
ipojo/manipulator/manipulator-bom/pom.xml | 70 +
.../ipojo-manipulator-creation-test/pom.xml | 33 +
.../core/components/ASimpleParentClass.java | 30 +
.../core/components/CallSuperConstructor.java | 29 +
.../components/CallSuperConstructorWithBC.java | 32 +
.../components/CallSuperConstructorWithNew.java | 29 +
.../CallSuperSuperConstructorWithNew.java | 29 +
.../runtime/core/components/FooProviderType1.java | 118 ++
.../core/components/NoEmptyConstructor.java | 50 +
.../NoEmptyConstructorWithParentClass.java | 46 +
.../ipojo/runtime/core/components/ParentClass.java | 34 +
.../runtime/core/components/ParentClass2.java | 28 +
.../runtime/core/components/ParentClassWithBC.java | 33 +
.../core/components/SeveralConstructors.java | 50 +
.../runtime/core/components/SuperParentClass.java | 36 +
.../runtime/core/services/A123/CheckService2.java | 26 +
.../ipojo/runtime/core/services/BarService.java | 30 +
.../ipojo/runtime/core/services/CheckService.java | 32 +
.../ipojo/runtime/core/services/FooService.java | 40 +
.../felix/ipojo/runtime/core/services/Plop.java | 26 +
.../services/PrimitiveManipulationTestService.java | 76 +
.../src/main/resources/metadata.xml | 95 ++
.../felix/ipojo/runtime/core/TestPOJOCreation.java | 283 ++++
.../ipojo/runtime/core/TestSeveralConstructor.java | 72 +
.../pom.xml | 35 +
.../felix/ipojo/runtime/core/components/Child.java | 28 +
.../core/components/ComponentWithInnerClasses.java | 75 +
.../core/components/FooBarProviderType1.java | 65 +
.../runtime/core/components/FooProviderType1.java | 129 ++
.../core/components/FooProviderTypeDyn.java | 77 +
.../core/components/Manipulation23Tester.java | 189 +++
.../runtime/core/components/Multiconstructor.java | 36 +
.../core/components/MultipleCheckService.java | 159 ++
.../ipojo/runtime/core/components/Parent.java | 34 +
.../runtime/core/services/A123/CheckService2.java | 26 +
.../ipojo/runtime/core/services/BarService.java | 30 +
.../ipojo/runtime/core/services/CheckService.java | 32 +
.../ipojo/runtime/core/services/FooService.java | 40 +
.../felix/ipojo/runtime/core/services/Plop.java | 26 +
.../services/PrimitiveManipulationTestService.java | 76 +
.../src/main/resources/metadata.xml | 76 +
.../runtime/core/TestManipulationMetadata.java | 295 ++++
.../runtime/core/TestManipulationMetadataAPI.java | 330 ++++
.../ipojo-manipulator-manipulation-test/pom.xml | 35 +
.../core/components/A123/Manipulation23Tester.java | 189 +++
.../ipojo/runtime/core/components/Annotation.java | 63 +
.../runtime/core/components/FooProviderType1.java | 129 ++
.../runtime/core/components/FooServiceImpl.java | 63 +
.../components/HandlerBindingTestComponent.java | 61 +
.../core/components/ImmediateComponent.java | 40 +
.../runtime/core/components/InnerClasses.java | 213 +++
.../ipojo/runtime/core/components/Invisible.java | 24 +
.../core/components/Manipulation23Tester.java | 130 ++
.../ipojo/runtime/core/components/Marker.java | 40 +
.../ipojo/runtime/core/components/MultiBind.java | 39 +
.../ipojo/runtime/core/components/PlopImpl.java | 31 +
.../core/components/StereotypedBazComponent.java | 35 +
.../core/components/StereotypedMultiBind.java | 37 +
.../ipojo/runtime/core/components/SubMarker.java | 31 +
.../ipojo/runtime/core/components/Switches.java | 88 ++
.../runtime/core/components/TestTypedList.java | 51 +
.../core/components/nativ/NativeComponent.java | 46 +
.../felix/ipojo/runtime/core/handlers/Foo.java | 39 +
.../ipojo/runtime/core/handlers/FooHandler.java | 84 +
.../ipojo/runtime/core/handlers/IgnoredFoo.java | 40 +
.../runtime/core/services/A123/CheckService2.java | 26 +
.../ipojo/runtime/core/services/BarService.java | 30 +
.../ipojo/runtime/core/services/BazService.java | 29 +
.../ipojo/runtime/core/services/CheckService.java | 32 +
.../felix/ipojo/runtime/core/services/Color.java | 30 +
.../ipojo/runtime/core/services/FooService.java | 40 +
.../core/services/HandlerBindingTestService.java | 29 +
.../felix/ipojo/runtime/core/services/Job.java | 29 +
.../felix/ipojo/runtime/core/services/Plop.java | 26 +
.../services/PrimitiveManipulationTestService.java | 76 +
.../src/main/resources/libs/linux32/libfoo.so | Bin 0 -> 7011 bytes
.../src/main/resources/libs/linux64/libfoo.so | Bin 0 -> 6629 bytes
.../src/main/resources/libs/mac/libfoo.jnilib | Bin 0 -> 8696 bytes
.../src/main/resources/metadata-java5.xml | 50 +
.../src/main/resources/metadata-primitives.xml | 41 +
.../src/main/resources/metadata.xml | 61 +
.../runtime/core/TestAnnotationProcessing.java | 193 +++
.../ipojo/runtime/core/TestDuplicateMethods.java | 51 +
.../ipojo/runtime/core/TestExceptionHandling.java | 100 ++
.../felix/ipojo/runtime/core/TestGenericList.java | 86 +
.../runtime/core/TestGetComponentInstance.java | 112 ++
.../TestHandlerBindingAndIgnoreAnnotation.java | 84 +
.../felix/ipojo/runtime/core/TestNativeMethod.java | 169 ++
.../ipojo/runtime/core/TestNestedClasses.java | 228 +++
.../ipojo/runtime/core/TestPrimitiveTypes.java | 117 ++
.../core/TestPrimitiveTypesWithNumberInNames.java | 121 ++
.../runtime/core/TestStereotypeAnnotation.java | 86 +
.../felix/ipojo/runtime/core/TestSwitches.java | 87 ++
.../felix/ipojo/runtime/core/TestTypeBoxing.java | 84 +
.../manipulator-it/online-manipulator-it/pom.xml | 35 +
.../ipojo/test/online/components/Consumer.java | 36 +
.../test/online/components/FrenchHelloService.java | 40 +
.../test/online/components/GermanHelloService.java | 40 +
.../ipojo/test/online/components/MyProvider.java | 31 +
.../components/MyProviderWithAnnotations.java | 37 +
.../felix/ipojo/test/online/module/Activator.java | 45 +
.../felix/ipojo/test/online/module/Type.java | 36 +
.../felix/ipojo/test/online/module/Type2.java | 38 +
.../felix/ipojo/test/online/module/TypeModule.java | 84 +
.../felix/ipojo/test/online/services/Hello.java | 26 +
.../src/main/resources/consumer.xml | 22 +
.../src/main/resources/provider.xml | 25 +
.../ipojo/test/online/OnlineManipulatorTest.java | 593 +++++++
ipojo/manipulator/manipulator-it/pom.xml | 407 +++++
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/manipulator/manipulator/changelog.txt | 249 +++
ipojo/manipulator/manipulator/pom.xml | 166 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 3 +
.../felix/ipojo/manipulation/ClassChecker.java | 846 ++++++++++
.../manipulation/ClassLoaderAwareClassWriter.java | 92 ++
.../felix/ipojo/manipulation/ClassManipulator.java | 1172 ++++++++++++++
.../ipojo/manipulation/ConstructorCodeAdapter.java | 287 ++++
.../ipojo/manipulation/InnerClassAdapter.java | 341 ++++
.../ipojo/manipulation/InnerClassChecker.java | 61 +
.../ipojo/manipulation/ManipulationProperty.java | 124 ++
.../felix/ipojo/manipulation/Manipulator.java | 304 ++++
.../ipojo/manipulation/MethodCodeAdapter.java | 122 ++
.../felix/ipojo/manipulation/MethodDescriptor.java | 264 ++++
.../ipojo/manipulator/ManifestAttributeFilter.java | 39 +
.../felix/ipojo/manipulator/ManifestProvider.java | 37 +
.../ipojo/manipulator/ManipulationEngine.java | 185 +++
.../manipulator/ManipulationResultVisitor.java | 48 +
.../felix/ipojo/manipulator/ManipulationUnit.java | 70 +
.../ipojo/manipulator/ManipulationVisitor.java | 48 +
.../felix/ipojo/manipulator/MetadataProvider.java | 40 +
.../felix/ipojo/manipulator/Pojoization.java | 388 +++++
.../felix/ipojo/manipulator/QuotedTokenizer.java | 200 +++
.../apache/felix/ipojo/manipulator/Reporter.java | 74 +
.../felix/ipojo/manipulator/ResourceStore.java | 76 +
.../felix/ipojo/manipulator/ResourceVisitor.java | 34 +
.../manifest/DirectManifestProvider.java | 49 +
.../manipulator/manifest/FileManifestProvider.java | 63 +
.../metadata/AnnotationMetadataProvider.java | 126 ++
.../metadata/CacheableMetadataProvider.java | 62 +
.../metadata/CompositeMetadataProvider.java | 99 ++
.../metadata/EmptyMetadataProvider.java | 42 +
.../manipulator/metadata/FileMetadataProvider.java | 109 ++
.../metadata/StreamMetadataProvider.java | 113 ++
.../annotation/ClassMetadataCollector.java | 196 +++
.../metadata/annotation/ComponentWorkbench.java | 176 +++
.../annotation/FieldMetadataCollector.java | 73 +
.../annotation/MethodMetadataCollector.java | 95 ++
.../annotation/model/AnnotationDiscovery.java | 31 +
.../metadata/annotation/model/AnnotationType.java | 54 +
.../metadata/annotation/model/Playback.java | 42 +
.../discovery/ChainedAnnotationDiscovery.java | 57 +
.../model/discovery/HandlerBindingDiscovery.java | 76 +
.../model/discovery/IgnoredDiscovery.java | 48 +
.../model/discovery/StereotypeDiscovery.java | 48 +
.../model/literal/AnnotationPlayback.java | 264 ++++
.../annotation/model/parser/AnnotationParser.java | 38 +
.../model/parser/AnnotationTypeVisitor.java | 58 +
.../model/parser/replay/AnnotationRecorder.java | 68 +
.../parser/replay/AnnotationVisitorPlayback.java | 77 +
.../annotation/model/parser/replay/Replay.java | 31 +
.../annotation/model/parser/replay/Visit.java | 41 +
.../model/parser/replay/VisitAnnotation.java | 46 +
.../annotation/model/parser/replay/VisitArray.java | 44 +
.../annotation/model/parser/replay/VisitEnd.java | 34 +
.../annotation/model/parser/replay/VisitEnum.java | 42 +
.../annotation/module/DefaultBindingModule.java | 290 ++++
.../metadata/annotation/registry/Binding.java | 67 +
.../annotation/registry/BindingRegistry.java | 43 +
.../registry/CompletableBindingRegistry.java | 62 +
.../registry/DefaultBindingRegistry.java | 79 +
.../registry/IgnoreAllBindingRegistry.java | 46 +
.../registry/LegacyGenericBindingRegistry.java | 95 ++
.../registry/MetaAnnotationBindingRegistry.java | 164 ++
.../metadata/annotation/registry/Selection.java | 150 ++
.../annotation/visitor/ComponentVisitor.java | 139 ++
.../annotation/visitor/ControllerVisitor.java | 54 +
.../annotation/visitor/FieldPropertyVisitor.java | 164 ++
.../visitor/HandlerDeclarationVisitor.java | 160 ++
.../annotation/visitor/HandlerVisitor.java | 94 ++
.../annotation/visitor/InstantiateVisitor.java | 71 +
.../annotation/visitor/LifecycleVisitor.java | 58 +
.../annotation/visitor/MethodPropertyVisitor.java | 177 +++
.../visitor/ParameterPropertyVisitor.java | 66 +
.../visitor/PostRegistrationVisitor.java | 52 +
.../visitor/PostUnregistrationVisitor.java | 52 +
.../annotation/visitor/ProvidesVisitor.java | 138 ++
.../annotation/visitor/RequiresVisitor.java | 268 ++++
.../visitor/ServiceControllerVisitor.java | 81 +
.../annotation/visitor/UpdatedVisitor.java | 51 +
.../visitor/bind/AbstractBindVisitor.java | 223 +++
.../metadata/annotation/visitor/bind/Action.java | 27 +
.../annotation/visitor/bind/MethodBindVisitor.java | 89 ++
.../visitor/bind/ParameterBindVisitor.java | 63 +
.../visitor/generic/FieldGenericVisitor.java | 37 +
.../annotation/visitor/generic/GenericVisitor.java | 114 ++
.../visitor/generic/GenericVisitorFactory.java | 70 +
.../visitor/generic/MethodGenericVisitor.java | 39 +
.../visitor/generic/ParameterGenericVisitor.java | 54 +
.../visitor/generic/RootGenericVisitor.java | 109 ++
.../visitor/generic/SubArrayVisitor.java | 130 ++
.../visitor/generic/TypeGenericVisitor.java | 34 +
.../annotation/visitor/ignore/NullBinding.java | 40 +
.../visitor/ignore/NullVisitorFactory.java | 42 +
.../visitor/stereotype/FieldStereotypeVisitor.java | 49 +
.../stereotype/MethodStereotypeVisitor.java | 49 +
.../stereotype/ParameterStereotypeVisitor.java | 53 +
.../stereotype/StereotypeVisitorFactory.java | 68 +
.../visitor/stereotype/TypeStereotypeVisitor.java | 51 +
.../metadata/annotation/visitor/util/Bindings.java | 56 +
.../metadata/annotation/visitor/util/Elements.java | 94 ++
.../metadata/annotation/visitor/util/Names.java | 136 ++
.../render/ManipulatedMetadataFilter.java | 53 +
.../ipojo/manipulator/render/MetadataFilter.java | 39 +
.../ipojo/manipulator/render/MetadataRenderer.java | 140 ++
.../ipojo/manipulator/reporter/EmptyReporter.java | 84 +
.../ipojo/manipulator/reporter/SystemReporter.java | 112 ++
.../ipojo/manipulator/spi/AbsBindingModule.java | 212 +++
.../ipojo/manipulator/spi/AnnotationLiteral.java | 84 +
.../manipulator/spi/AnnotationVisitorFactory.java | 34 +
.../ipojo/manipulator/spi/BindingContext.java | 162 ++
.../apache/felix/ipojo/manipulator/spi/Module.java | 37 +
.../ipojo/manipulator/spi/ModuleProvider.java | 38 +
.../felix/ipojo/manipulator/spi/Predicate.java | 39 +
.../ipojo/manipulator/spi/helper/Predicates.java | 224 +++
.../spi/provider/CompositeModuleProvider.java | 55 +
.../spi/provider/CoreModuleProvider.java | 33 +
.../spi/provider/DefaultModuleProvider.java | 53 +
.../spi/provider/ServiceLoaderModuleProvider.java | 52 +
.../manipulator/store/DirectoryResourceStore.java | 170 ++
.../manipulator/store/JarFileResourceStore.java | 250 +++
.../ipojo/manipulator/store/ManifestBuilder.java | 52 +
.../ipojo/manipulator/store/ResourceMapper.java | 43 +
.../store/builder/DefaultManifestBuilder.java | 262 ++++
.../store/mapper/FileSystemResourceMapper.java | 75 +
.../store/mapper/IdentityResourceMapper.java | 37 +
.../store/mapper/WABResourceMapper.java | 58 +
.../manipulator/util/ChainedAnnotationVisitor.java | 92 ++
.../felix/ipojo/manipulator/util/Classpath.java | 180 +++
.../felix/ipojo/manipulator/util/Collections5.java | 85 +
.../felix/ipojo/manipulator/util/Constants.java | 60 +
.../manipulator/util/IsolatedClassLoader.java | 85 +
.../felix/ipojo/manipulator/util/Metadatas.java | 120 ++
.../felix/ipojo/manipulator/util/Streams.java | 101 ++
.../felix/ipojo/manipulator/util/Strings.java | 55 +
.../manipulator/visitor/ManipulationAdapter.java | 51 +
.../visitor/ManipulationResultAdapter.java | 50 +
.../check/CheckFieldConsistencyResultVisitor.java | 104 ++
.../check/CheckFieldConsistencyVisitor.java | 52 +
.../visitor/writer/ManipulatedResourcesWriter.java | 81 +
.../visitor/writer/ManipulatedResultWriter.java | 60 +
.../felix/ipojo/xml/parser/ParseException.java | 40 +
.../felix/ipojo/xml/parser/SchemaResolver.java | 81 +
.../felix/ipojo/xml/parser/XMLMetadataParser.java | 295 ++++
.../main/resources/META-INF/constants.properties | 22 +
.../org.apache.felix.ipojo.manipulator.spi.Module | 1 +
.../src/main/resources/xsd/composite.xsd | 147 ++
.../manipulator/src/main/resources/xsd/core.xsd | 704 +++++++++
.../src/main/resources/xsd/event-admin.xsd | 90 ++
.../src/main/resources/xsd/extender-pattern.xsd | 42 +
.../manipulator/src/main/resources/xsd/jmx.xsd | 177 +++
.../src/main/resources/xsd/temporal.xsd | 61 +
.../src/main/resources/xsd/whiteboard-pattern.xsd | 45 +
.../org/apache/felix/ipojo/ComponentInstance.java | 31 +
.../org/apache/felix/ipojo/InstanceManager.java | 51 +
.../src/test/java/org/apache/felix/ipojo/Pojo.java | 29 +
.../ipojo/manipulation/ClassCheckerTestCase.java | 129 ++
.../ipojo/manipulation/DirManipulationTest.java | 101 ++
.../ipojo/manipulation/InnerClassAdapterTest.java | 399 +++++
.../ipojo/manipulation/ManipulatedClassLoader.java | 97 ++
.../felix/ipojo/manipulation/ManipulatorTest.java | 460 ++++++
.../felix/ipojo/manipulation/PojoizationTest.java | 65 +
.../ipojo/manipulation/RemanipulationTest.java | 162 ++
.../manipulator/ManipulationEngineTestCase.java | 113 ++
.../manifest/DirectManifestProviderTestCase.java | 33 +
.../manifest/FileManifestProviderTestCase.java | 37 +
.../AnnotationMetadataProviderTestCase.java | 94 ++
.../CacheableMetadataProviderTestCase.java | 46 +
.../CompositeMetadataProviderTestCase.java | 112 ++
.../metadata/EmptyMetadataProviderTestCase.java | 29 +
.../metadata/FileMetadataProviderTestCase.java | 51 +
.../metadata/StreamMetadataProviderTestCase.java | 60 +
.../annotation/ComponentWorkbenchTestCase.java | 90 ++
.../model/literal/AnnotationPlaybackTestCase.java | 196 +++
.../model/literal/types/AnnotationAnnotation.java | 36 +
.../model/literal/types/ArrayAnnotation.java | 40 +
.../model/literal/types/EnumAnnotation.java | 38 +
.../model/literal/types/InnerAnnotation.java | 37 +
.../annotation/model/literal/types/Mode.java | 29 +
.../model/literal/types/SimpleTypes.java | 56 +
.../annotation/model/literal/types/Support.java | 44 +
.../parser/replay/AnnotationRecorderTestCase.java | 92 ++
.../CompletableBindingRegistryTestCase.java | 83 +
.../registry/DefaultBindingRegistryTestCase.java | 82 +
.../registry/IgnoreAllBindingRegistryTestCase.java | 58 +
.../LegacyGenericBindingRegistryTestCase.java | 95 ++
.../MetaAnnotationBindingRegistryTestCase.java | 174 +++
.../annotation/registry/SelectionTestCase.java | 237 +++
.../visitor/ComponentVisitorTestCase.java | 91 ++
.../visitor/HandlerDeclarationVisitorTestCase.java | 103 ++
.../visitor/bind/MethodBindVisitorTestCase.java | 87 ++
.../annotation/visitor/util/NamesTestCase.java | 145 ++
.../render/ManipulatedMetadataFilterTestCase.java | 65 +
.../render/MetadataRendererTestCase.java | 100 ++
.../manipulator/spi/AbsBindingModuleTestCase.java | 259 +++
.../manipulator/spi/AnnotationLiteralTestCase.java | 50 +
.../store/DirectoryResourceStoreTestCase.java | 88 ++
.../store/JarFileResourceStoreTestCase.java | 82 +
.../builder/DefaultManifestBuilderTestCase.java | 99 ++
.../mapper/FileSystemResourceMapperTestCase.java | 75 +
.../mapper/IdentityResourceMapperTestCase.java | 37 +
.../store/mapper/WABResourceMapperTestCase.java | 65 +
.../ipojo/manipulator/util/StreamsTestCase.java | 59 +
.../ipojo/manipulator/util/StringsTestCase.java | 37 +
...CheckFieldConsistencyResultVisitorTestCase.java | 91 ++
.../writer/ManipulatedResourcesWriterTestCase.java | 64 +
.../writer/ManipulatedResultWriterTestCase.java | 56 +
.../src/test/java/test/AnnotatedComponent.java | 39 +
.../manipulator/src/test/java/test/Child.java | 36 +
.../src/test/java/test/ClusterDaemon.java | 41 +
.../src/test/java/test/ConstructorCheck.java | 31 +
.../src/test/java/test/DoubleArray.java | 44 +
.../src/test/java/test/FakeAnnotation.java | 35 +
.../src/test/java/test/NoValidConstructor.java | 34 +
.../src/test/java/test/NonSunClass.java | 38 +
.../manipulator/src/test/java/test/Parent.java | 34 +
.../src/test/java/test/PlentyOfAnnotations.java | 63 +
.../src/test/java/test/PojoWithInner.java | 40 +
.../manipulator/src/test/java/test/SimplePojo.java | 32 +
.../java/test/frames/CryptoServiceSingleton.java | 434 ++++++
.../src/test/java/test/frames/Hash.java | 42 +
.../java/test/inner/ComponentWithInnerClasses.java | 105 ++
.../src/test/java/test/inner/Computation.java | 28 +
.../src/test/java/test/inner/Example.java | 80 +
.../src/test/java/test/ipojo/ExternalHandler.java | 23 +
.../manipulator/src/test/resources/MANIFEST.MF | 19 +
.../src/test/resources/empty-metadata.xml | 23 +
.../manipulator/src/test/resources/metadata.xml | 56 +
.../tests.manipulation-no-annotations.jar | Bin 0 -> 26078 bytes
.../test/resources/tests.manipulation.java5.jar | Bin 0 -> 22366 bytes
.../resources/tests.manipulator-annotations.jar | Bin 0 -> 83285 bytes
ipojo/manipulator/maven-ipojo-plugin/changelog.txt | 203 +++
ipojo/manipulator/maven-ipojo-plugin/pom.xml | 157 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 10 +
.../src/main/appended-resources/META-INF/NOTICE | 1 +
.../apache/felix/ipojo/plugin/ManipulatorMojo.java | 310 ++++
.../apache/felix/ipojo/plugin/MavenReporter.java | 86 +
.../META-INF/maven/archetype-metadata.xml | 45 +
.../archetype-resources/bundle.properties | 4 +
.../src/main/resources/archetype-resources/pom.xml | 75 +
.../src/main/java/HelloComponent.java | 14 +
.../archetype-resources/src/main/java/source.txt | 1 +
.../src/main/resources/metadata.xml | 16 +
ipojo/manipulator/online-manipulator/changelog.txt | 133 ++
ipojo/manipulator/online-manipulator/pom.xml | 189 +++
.../main/appended-resources/META-INF/DEPENDENCIES | 21 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 3 +
.../online/manipulator/BridgeClassLoader.java | 65 +
.../BundleAwareJarFileResourceStore.java | 91 ++
.../felix/ipojo/online/manipulator/Files.java | 54 +
.../ipojo/online/manipulator/IPOJOURLHandler.java | 313 ++++
.../ipojo/online/manipulator/SystemLogService.java | 83 +
.../main/resources/META-INF/constants.properties | 22 +
ipojo/manipulator/pom.xml | 69 +
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/metadata/changelog.txt | 29 +
ipojo/metadata/pom.xml | 67 +
.../main/appended-resources/META-INF/DEPENDENCIES | 10 +
.../org/apache/felix/ipojo/metadata/Attribute.java | 91 ++
.../org/apache/felix/ipojo/metadata/Element.java | 400 +++++
ipojo/pom.xml | 85 +
ipojo/runtime/api/changelog.txt | 219 +++
ipojo/runtime/api/pom.xml | 137 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 16 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 3 +
.../org/apache/felix/ipojo/api/ComponentType.java | 195 +++
.../org/apache/felix/ipojo/api/Dependency.java | 412 +++++
.../felix/ipojo/api/HandlerConfiguration.java | 36 +
.../felix/ipojo/api/PrimitiveComponentType.java | 560 +++++++
.../java/org/apache/felix/ipojo/api/Property.java | 205 +++
.../java/org/apache/felix/ipojo/api/Service.java | 320 ++++
.../apache/felix/ipojo/api/ServiceProperty.java | 192 +++
.../felix/ipojo/api/SingletonComponentType.java | 140 ++
.../apache/felix/ipojo/api/TemporalDependency.java | 195 +++
.../api/composite/CompositeComponentType.java | 329 ++++
.../felix/ipojo/api/composite/ExportedService.java | 188 +++
.../felix/ipojo/api/composite/ImportedService.java | 237 +++
.../apache/felix/ipojo/api/composite/Instance.java | 246 +++
.../ipojo/api/composite/InstantiatedService.java | 362 +++++
.../felix/ipojo/api/composite/ProvidedService.java | 112 ++
.../org/apache/felix/ipojo/api/DependencyTest.java | 149 ++
.../org/apache/felix/ipojo/api/PropertyTest.java | 60 +
.../org/apache/felix/ipojo/api/ServiceTest.java | 81 +
.../ipojo/api/composite/ExportedServiceTest.java | 161 ++
.../ipojo/api/composite/ImportedServiceTest.java | 192 +++
.../felix/ipojo/api/composite/InstanceTest.java | 274 ++++
.../api/composite/InstantiatedServiceTest.java | 210 +++
ipojo/runtime/changelog.txt | 223 +++
.../ipojo-composite-import-export-test/pom.xml | 36 +
.../runtime/core/components/Baz2CheckProvider.java | 81 +
.../runtime/core/components/BazProviderType1.java | 51 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 92 ++
.../core/components/FooProviderTypeDyn.java | 63 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../runtime/core/components/TataProvider.java | 222 +++
.../runtime/core/components/TotoProvider.java | 73 +
.../runtime/core/components/TotoProviderGlue.java | 81 +
.../runtime/core/services/A123/CheckService2.java | 25 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/BazService.java | 39 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../felix/ipojo/runtime/core/services/Tata.java | 62 +
.../felix/ipojo/runtime/core/services/Tota.java | 78 +
.../felix/ipojo/runtime/core/services/Toto.java | 37 +
.../src/main/resources/metadata-import-export.xml | 106 ++
.../src/main/resources/metadata.xml | 131 ++
.../apache/felix/ipojo/runtime/core/Common.java | 61 +
.../runtime/core/exporter/TestFilteredExport.java | 237 +++
.../runtime/core/exporter/TestMultipleExport.java | 260 +++
.../runtime/core/exporter/TestOptionalExport.java | 241 +++
.../core/exporter/TestOptionalMultipleExport.java | 260 +++
.../runtime/core/exporter/TestSimpleExport.java | 241 +++
.../core/importer/TestDelayedFilteredImport.java | 157 ++
.../core/importer/TestDelayedMultipleImport.java | 163 ++
.../core/importer/TestDelayedOptionalImport.java | 163 ++
.../TestDelayedOptionalMultipleImport.java | 169 ++
.../core/importer/TestDelayedSimpleImport.java | 158 ++
.../runtime/core/importer/TestFilteredImport.java | 157 ++
.../runtime/core/importer/TestMultipleImport.java | 199 +++
.../runtime/core/importer/TestOptionalImport.java | 193 +++
.../core/importer/TestOptionalMultipleImport.java | 210 +++
.../runtime/core/importer/TestSimpleImport.java | 193 +++
.../ipojo-composite-instance-test/pom.xml | 36 +
.../runtime/core/components/Baz2CheckProvider.java | 81 +
.../runtime/core/components/BazProviderType1.java | 51 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 92 ++
.../core/components/FooProviderTypeDyn.java | 63 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../runtime/core/components/ServiceConsumer.java | 46 +
.../runtime/core/components/ServiceProvider.java | 34 +
.../runtime/core/components/TataProvider.java | 222 +++
.../runtime/core/components/TotoProvider.java | 73 +
.../runtime/core/components/TotoProviderGlue.java | 81 +
.../runtime/core/services/A123/CheckService2.java | 25 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/BazService.java | 39 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../felix/ipojo/runtime/core/services/Service.java | 26 +
.../felix/ipojo/runtime/core/services/Tata.java | 62 +
.../felix/ipojo/runtime/core/services/Tota.java | 78 +
.../felix/ipojo/runtime/core/services/Toto.java | 37 +
.../src/main/resources/metadata-instance.xml | 108 ++
.../src/main/resources/metadata.xml | 131 ++
.../apache/felix/ipojo/runtime/core/Common.java | 47 +
.../runtime/core/instance/TestInstanceScope.java | 105 ++
.../runtime/core/instance/TestSimpleInstance.java | 279 ++++
.../TestConfigurableInstantiation.java | 112 ++
.../core/instantiator/TestConfiguration.java | 98 ++
.../instantiator/TestMultipleInstantiation.java | 287 ++++
.../instantiator/TestOptionalInstantiation.java | 273 ++++
.../TestOptionalMultipleInstantiation.java | 214 +++
.../core/instantiator/TestSimpleInstantiation.java | 274 ++++
.../ipojo-composite-runtime-test/pom.xml | 36 +
.../runtime/core/components/Baz2CheckProvider.java | 81 +
.../runtime/core/components/BazProviderType1.java | 51 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 92 ++
.../core/components/FooProviderTypeDyn.java | 63 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../runtime/core/components/TataProvider.java | 222 +++
.../runtime/core/components/TotoProvider.java | 73 +
.../runtime/core/components/TotoProviderGlue.java | 81 +
.../runtime/core/services/A123/CheckService2.java | 25 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/BazService.java | 39 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../felix/ipojo/runtime/core/services/Tata.java | 62 +
.../felix/ipojo/runtime/core/services/Tota.java | 78 +
.../felix/ipojo/runtime/core/services/Toto.java | 37 +
.../src/main/resources/metadata.xml | 131 ++
.../apache/felix/ipojo/runtime/core/Common.java | 48 +
.../ipojo/runtime/core/EmptyCompositeTest.java | 228 +++
.../ipojo/runtime/core/FactoryManagementTest.java | 330 ++++
.../felix/ipojo/runtime/core/ServiceRangeTest.java | 510 ++++++
.../ipojo/runtime/core/ServiceRegistryTest.java | 282 ++++
.../ipojo-composite-service-providing-test/pom.xml | 36 +
.../runtime/core/components/Baz2CheckProvider.java | 81 +
.../runtime/core/components/BazProviderType1.java | 51 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 92 ++
.../core/components/FooProviderTypeDyn.java | 63 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../runtime/core/components/ServiceConsumer.java | 46 +
.../runtime/core/components/ServiceProvider.java | 34 +
.../runtime/core/components/TataProvider.java | 222 +++
.../runtime/core/components/TotoProvider.java | 73 +
.../runtime/core/components/TotoProviderGlue.java | 81 +
.../runtime/core/services/A123/CheckService2.java | 25 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/BazService.java | 39 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../felix/ipojo/runtime/core/services/Service.java | 26 +
.../felix/ipojo/runtime/core/services/Tata.java | 62 +
.../felix/ipojo/runtime/core/services/Tota.java | 78 +
.../felix/ipojo/runtime/core/services/Toto.java | 37 +
.../src/main/resources/metadata-providing.xml | 174 +++
.../src/main/resources/metadata.xml | 131 ++
.../apache/felix/ipojo/runtime/core/Common.java | 57 +
.../felix/ipojo/runtime/core/TestCompositeAPI.java | 184 +++
.../ipojo/runtime/core/providing/TestComp0.java | 343 ++++
.../ipojo/runtime/core/providing/TestComp1.java | 341 ++++
.../ipojo/runtime/core/providing/TestComp2.java | 238 +++
.../ipojo/runtime/core/providing/TestComp3.java | 271 ++++
.../ipojo/runtime/core/providing/TestComp4.java | 270 ++++
.../ipojo/runtime/core/providing/TestComp5.java | 272 ++++
.../ipojo/runtime/core/providing/TestComp6.java | 295 ++++
.../ipojo/runtime/core/providing/TestComp7.java | 339 ++++
.../ipojo/runtime/core/providing/TestComp8.java | 369 +++++
ipojo/runtime/composite-it/pom.xml | 354 +++++
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/runtime/composite/changelog.txt | 268 ++++
ipojo/runtime/composite/obr.xml | 40 +
ipojo/runtime/composite/pom.xml | 189 +++
.../main/appended-resources/META-INF/DEPENDENCIES | 16 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 4 +
.../felix/ipojo/composite/CompositeFactory.java | 180 +++
.../felix/ipojo/composite/CompositeHandler.java | 83 +
.../composite/CompositeInstanceDescription.java | 130 ++
.../felix/ipojo/composite/CompositeManager.java | 442 ++++++
.../ipojo/composite/CompositeServiceContext.java | 506 ++++++
.../apache/felix/ipojo/composite/FactoryProxy.java | 189 +++
.../architecture/ArchitectureHandler.java | 111 ++
.../ipojo/composite/instance/InstanceHandler.java | 441 ++++++
.../instance/InstanceHandlerDescription.java | 90 ++
.../instantiator/ServiceDependencyHandler.java | 393 +++++
.../service/instantiator/ServiceImporter.java | 326 ++++
.../ServiceInstantiatorDescription.java | 117 ++
.../service/instantiator/SvcInstance.java | 295 ++++
.../service/provides/CompositionException.java | 44 +
.../service/provides/CompositionMetadata.java | 361 +++++
.../composite/service/provides/FieldMetadata.java | 105 ++
.../composite/service/provides/MethodMetadata.java | 138 ++
.../composite/service/provides/POJOWriter.java | 323 ++++
.../service/provides/ProvidedService.java | 238 +++
.../service/provides/ProvidedServiceHandler.java | 504 ++++++
.../ProvidedServiceHandlerDescription.java | 96 ++
.../service/provides/ServiceExporter.java | 176 +++
.../service/provides/SpecificationMetadata.java | 158 ++
.../felix/ipojo/composite/util/SourceManager.java | 376 +++++
.../composite/src/main/resources/composite.xsd | 147 ++
.../composite/src/main/resources/metadata.xml | 43 +
ipojo/runtime/core-it/ipojo-api-test/pom.xml | 67 +
.../ipojo/runtime/core/api/components/FooImpl.java | 41 +
.../runtime/core/api/components/HostImpl.java | 38 +
.../core/api/components/MyComponentImpl.java | 50 +
.../runtime/core/api/components/MyServiceImpl.java | 28 +
.../core/api/components/PlainHelloImpl.java | 46 +
.../runtime/core/api/services/BarService.java | 27 +
.../felix/ipojo/runtime/core/api/services/Foo.java | 27 +
.../ipojo/runtime/core/api/services/MyService.java | 24 +
.../runtime/core/api/services/PlainHello.java | 24 +
.../felix/ipojo/runtime/core/api/Common.java | 73 +
.../ipojo/runtime/core/api/CompositeTest.java | 247 +++
.../runtime/core/api/ExternalHandlerTest.java | 91 ++
.../runtime/core/api/PrimitiveComponentTest.java | 181 +++
.../runtime/core/api/SingletonComponentTest.java | 177 +++
.../felix/ipojo/runtime/core/api/Whiteboard.java | 90 ++
.../core-it/ipojo-compatibility-test/pom.xml | 35 +
.../compatibility/ipojo/HelloServiceConsumer.java | 50 +
.../compatibility/ipojo/HelloServiceProvider.java | 44 +
.../compatibility/scr/HelloServiceConsumer.java | 67 +
.../compatibility/scr/HelloServiceProvider.java | 41 +
.../test/compatibility/service/CheckService.java | 31 +
.../test/compatibility/service/HelloService.java | 28 +
.../src/main/resources/blueprint/HelloConsumer.xml | 32 +
.../src/main/resources/blueprint/HelloProvider.xml | 29 +
.../src/main/resources/scr/HelloConsumer.xml | 33 +
.../src/main/resources/scr/HelloProvider.xml | 26 +
.../felix/ipojo/test/compatibility/Common.java | 307 ++++
.../TestBeingConsumedByAriesBlueprint1_1_0.java | 60 +
.../TestBeingConsumedByEquinoxSCR1_4_100.java | 66 +
.../TestBeingConsumedByFelixSCR1_6_2.java | 57 +
.../TestBeingConsumedByKnopflerfishSCR4_0_2.java | 65 +
...tConsumingProviderUsingAriesBlueprint1_1_0.java | 61 +
...estConsumingProviderUsingEquinoxSCR1_4_100.java | 68 +
.../TestConsumingProviderUsingFelixSCR1_6_2.java | 58 +
...ConsumingProviderUsingKnopflerfishSCR4_0_2.java | 64 +
.../ipojo/test/compatibility/TestiPOJOOnly.java | 49 +
.../core-it/ipojo-core-annotations-test/pom.xml | 35 +
.../src/main/java/foo/Foo.java | 29 +
.../src/main/java/foo/RGB.java | 28 +
.../src/main/java/foo/ipojo/IPOJOFoo.java | 35 +
.../core/test/components/AggregateDependency.java | 44 +
.../ipojo/runtime/core/test/components/Arch.java | 26 +
.../core/test/components/ComponentTypeVersion.java | 28 +
.../test/components/CustomAnnotationWithEnum.java | 30 +
.../DefaultImplementationDependency.java | 32 +
.../runtime/core/test/components/Dependency.java | 103 ++
.../components/DependencyUsingSpecification.java | 55 +
.../runtime/core/test/components/Factory.java | 26 +
.../core/test/components/FactoryDeprecated.java | 26 +
.../core/test/components/FactoryMethod.java | 30 +
.../test/components/FactoryMethodDeprecated.java | 30 +
.../core/test/components/FilteredDependency.java | 56 +
.../core/test/components/FromDependency.java | 83 +
.../runtime/core/test/components/Immediate.java | 26 +
.../core/test/components/InstantiateSimple.java | 30 +
.../core/test/components/InstantiateWithName.java | 30 +
.../runtime/core/test/components/Lifecycle.java | 41 +
.../core/test/components/ManagedServicePID.java | 93 ++
.../runtime/core/test/components/MyComparator.java | 30 +
.../runtime/core/test/components/NoAnnotation.java | 24 +
.../ipojo/runtime/core/test/components/NoArch.java | 26 +
.../runtime/core/test/components/NoFactory.java | 26 +
.../runtime/core/test/components/NoImmediate.java | 26 +
.../core/test/components/NoPropagation.java | 93 ++
.../core/test/components/NullableDependency.java | 36 +
.../runtime/core/test/components/OnlyFoo.java | 27 +
.../runtime/core/test/components/OnlyiPOJOFoo.java | 27 +
.../core/test/components/OptionalDependency.java | 60 +
.../core/test/components/PIDandPropagation.java | 94 ++
.../core/test/components/PSServiceController.java | 75 +
.../test/components/PSServiceControllerSpec.java | 78 +
.../core/test/components/PolicyDependency.java | 56 +
.../runtime/core/test/components/Propagation.java | 94 ++
.../core/test/components/PropagationandPID.java | 94 ++
.../runtime/core/test/components/Properties.java | 93 ++
.../core/test/components/ProvidesDouble.java | 61 +
.../core/test/components/ProvidesProperties.java | 86 +
.../core/test/components/ProvidesQuatro.java | 77 +
.../core/test/components/ProvidesSimple.java | 70 +
.../test/components/ProvidesStaticProperties.java | 94 ++
.../core/test/components/ProvidesTriple.java | 76 +
.../core/test/components/RankedDependency.java | 69 +
.../test/components/UpdatedWithManagedService.java | 102 ++
.../test/components/UpdatedWithProperties.java | 104 ++
.../components/ComponentWithProperties.java | 79 +
.../components/InstantiatedComponent.java | 33 +
.../components/context/ComponentUsingContext.java | 46 +
.../core/test/components/error/AbstractClass.java | 29 +
.../runtime/core/test/components/event/PubSub.java | 56 +
.../test/components/event/PubSubDeprecated.java | 56 +
.../test/components/event/PubSubWithPublishes.java | 57 +
.../core/test/components/extender/Extender.java | 37 +
.../core/test/components/jmx/JMXDeprecated.java | 44 +
.../core/test/components/jmx/JMXSimple.java | 44 +
.../core/test/components/temporal/Temporal.java | 33 +
.../components/temporal/TemporalCollection.java | 44 +
.../test/components/temporal/TemporalSimple.java | 32 +
.../test/components/temporal/TemporalWithDI.java | 32 +
.../temporal/TemporalWithEmptyArray.java | 32 +
.../components/temporal/TemporalWithFilter.java | 32 +
.../test/components/temporal/TemporalWithNull.java | 32 +
.../components/temporal/TemporalWithNullable.java | 33 +
.../components/temporal/TemporalWithTimeout.java | 35 +
.../whiteboard/WhiteBoardWIModification.java | 44 +
.../whiteboard/WhiteBoardWOModification.java | 37 +
.../test/components/whiteboard/WhiteBoards.java | 46 +
.../runtime/core/test/services/BarService.java | 29 +
.../runtime/core/test/services/CheckService.java | 31 +
.../runtime/core/test/services/ChildInterface.java | 25 +
.../runtime/core/test/services/FooService.java | 39 +
.../core/test/services/ParentInterface1.java | 25 +
.../core/test/services/ParentInterface2.java | 25 +
.../core/test/services/ParentParentInterface.java | 25 +
.../runtime/core/test/annotations/Common.java | 49 +
.../test/annotations/TestAggregateDependency.java | 83 +
.../core/test/annotations/TestArchitecture.java | 50 +
.../runtime/core/test/annotations/TestContext.java | 95 ++
.../test/annotations/TestCustomAnnotations.java | 55 +
.../core/test/annotations/TestDependency.java | 187 +++
.../test/annotations/TestDependencyPolicy.java | 104 ++
.../core/test/annotations/TestEventAdmin.java | 287 ++++
.../core/test/annotations/TestExtender.java | 49 +
.../runtime/core/test/annotations/TestFactory.java | 98 ++
.../test/annotations/TestFilteredDependency.java | 132 ++
.../core/test/annotations/TestInstantiate.java | 128 ++
.../annotations/TestInstantiatedComponent.java | 45 +
.../runtime/core/test/annotations/TestJMX.java | 85 +
.../test/annotations/TestLifecycleCallbacks.java | 74 +
.../test/annotations/TestLifecycleController.java | 42 +
.../test/annotations/TestOptionalDependency.java | 136 ++
.../core/test/annotations/TestProperties.java | 189 +++
.../test/annotations/TestRankedDependency.java | 98 ++
.../test/annotations/TestServiceProviding.java | 204 +++
.../test/annotations/TestTemporalDependencies.java | 197 +++
.../core/test/annotations/TestWhiteBoard.java | 108 ++
.../ipojo-core-bad-configuration-test/pom.xml | 35 +
.../runtime/bad/components/BadConstructors.java | 40 +
.../bad/components/CallbackCheckService.java | 68 +
.../bad/components/CheckProviderParentClass.java | 51 +
.../bad/components/CheckServiceProvider.java | 83 +
.../bad/components/LifecycleControllerTest.java | 49 +
.../ipojo/runtime/bad/components/ParentClass.java | 51 +
.../ipojo/runtime/bad/services/BarService.java | 29 +
.../ipojo/runtime/bad/services/CheckService.java | 31 +
.../ipojo/runtime/bad/services/FooService.java | 39 +
.../src/main/resources/metadata.xml | 71 +
.../felix/ipojo/runtime/bad/test/Common.java | 31 +
.../ipojo/runtime/bad/test/TestBadFactories.java | 140 ++
.../ipojo/runtime/bad/test/TestBadLFCCallback.java | 262 ++++
.../runtime/bad/test/TestBadLFCController.java | 106 ++
.../bad/test/TestBadServiceDependencies.java | 370 +++++
.../src/test/resources/exam.properties | 19 +
.../ipojo-core-configuration-admin-test/pom.xml | 34 +
.../core/components/ConfigurableFooProvider.java | 72 +
.../ConfigurableFooProviderWithPropagation.java | 73 +
.../ImmediateConfigurableFooProvider.java | 87 ++
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../src/main/resources/metadata.xml | 40 +
.../apache/felix/ipojo/runtime/core/Common.java | 59 +
.../TestManagedServiceFactoryTestForImmediate.java | 346 ++++
.../TestManagedServiceFactoryTestForServices.java | 356 +++++
.../core/TestManagedServiceTestForImmediate.java | 368 +++++
.../core/TestManagedServiceTestForService.java | 362 +++++
.../felix/ipojo/runtime/core/TestPropagation.java | 91 ++
.../felix/ipojo/runtime/core/TestUpdated.java | 121 ++
.../pom.xml | 35 +
.../felix/ipojo/runtime/core/components/Bean.java | 46 +
.../core/components/ConfigureAnotherInstance.java | 43 +
.../runtime/core/components/ConfigureNothing.java | 32 +
.../core/components/ConfigureOneInstance.java | 43 +
.../ConfigureThreeInstancesUsingMethods.java | 66 +
.../core/components/ConfigureTwoInstances.java | 53 +
.../ConfigureTwoInstancesWithInheritance.java | 43 +
.../ConfigureTwoInstancesWithOverridding.java | 52 +
.../core/components/MyComplexComponent.java | 106 ++
.../ipojo/runtime/core/components/MyComponent.java | 89 ++
.../core/components/ParentConfiguration.java | 54 +
.../core/components/SimpleConfiguration.java | 38 +
.../configuration/MyComplexConfiguration.java | 77 +
.../components/configuration/MyConfiguration.java | 45 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../apache/felix/ipojo/runtime/core/Common.java | 45 +
.../runtime/core/TestComplexConfigurations.java | 145 ++
.../core/TestConfigurationInAnotherBundle.java | 112 ++
.../core/TestConfigurationOfMyComponent.java | 87 ++
...tConfigurationOfThreeInstancesUsingMethods.java | 99 ++
.../core/TestConfigurationOfTwoInstances.java | 97 ++
.../TestConfigurationWithInheritedInstance.java | 99 ++
.../TestConfigurationWithOverriddenInstance.java | 99 ++
.../ipojo/runtime/core/TestEmptyConfiguration.java | 77 +
.../runtime/core/TestSeveralConfigurations.java | 99 ++
.../runtime/core/TestSimpleConfiguration.java | 80 +
.../core-it/ipojo-core-configuration-test/pom.xml | 34 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/ComplexConfiguration.java | 57 +
.../ConfigurableCheckServiceProvider.java | 223 +++
.../runtime/core/components/FooProviderType1.java | 134 ++
.../runtime/core/components/FooProviderType2.java | 115 ++
.../core/components/FooProviderTypeDyn.java | 83 +
.../ipojo/runtime/core/components/ParentClass.java | 51 +
.../ParentConfigurableCheckServiceProvider.java | 194 +++
.../runtime/core/components/PropertyModifier.java | 60 +
.../components/arch/MyComponentToIntrospect.java | 95 ++
...erviceProviderWithBundleContextAndProperty.java | 54 +
...eckServiceProviderWithDefaultValueProperty.java | 51 +
.../CheckServiceProviderWithNamedProperty.java | 51 +
.../CheckServiceProviderWithTwoProperties.java | 54 +
.../CheckServiceProviderWithUnnamedProperty.java | 51 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../src/main/resources/metadata.xml | 267 ++++
.../src/main/resources/updated.xml | 103 ++
.../apache/felix/ipojo/runtime/core/Common.java | 61 +
.../felix/ipojo/runtime/core/TestArchitecture.java | 236 +++
.../ipojo/runtime/core/TestBothProperties.java | 870 +++++++++++
.../ipojo/runtime/core/TestComplexProperties.java | 234 +++
.../core/TestConstructorInjectionOfProperties.java | 120 ++
...allyConfigurablePropertiesUsingConfigAdmin.java | 399 +++++
.../ipojo/runtime/core/TestFieldProperties.java | 768 +++++++++
.../felix/ipojo/runtime/core/TestListeners.java | 205 +++
.../TestManagedServiceConfigurableProperties.java | 618 ++++++++
.../ipojo/runtime/core/TestMethodProperties.java | 1647 ++++++++++++++++++++
.../ipojo/runtime/core/TestPropertyModifier.java | 108 ++
.../ipojo/runtime/core/TestSimpleProperties.java | 261 ++++
.../runtime/core/TestSuperMethodProperties.java | 631 ++++++++
.../ipojo/runtime/core/TestUpdatedMethod.java | 218 +++
.../core/TestUpdatedMethodAndConfigAdmin.java | 330 ++++
.../core/TestUpdatedMethodAndManagedService.java | 405 +++++
.../core/TestUpdatedNoArgMethodAndConfigAdmin.java | 319 ++++
.../TestUpdatedNoArgMethodAndManagedService.java | 325 ++++
.../ipojo-core-context-injection-test/pom.xml | 35 +
.../core/components/ComponentUsingConstructor.java | 52 +
.../core/components/ComponentUsingField.java | 49 +
.../core/components/ComponentUsingMethod.java | 51 +
...mponentBundleContextInjectionInConstructor.java | 60 +
.../ComponentBundleContextInjectionInField.java | 54 +
.../ComponentBundleContextInjectionInMethod.java | 57 +
.../ComponentWithThreeConstructorParams.java | 69 +
.../ComponentWithTwoConstructorParams.java | 63 +
.../annotations/ComponentWithTwoFields.java | 60 +
.../annotations/ComponentWithTwoSetters.java | 66 +
...nstanceBundleContextInjectionInConstructor.java | 57 +
.../InstanceBundleContextInjectionInField.java | 54 +
.../InstanceBundleContextInjectionInMethod.java | 57 +
.../components/configuration/MyConfiguration.java | 31 +
.../core/components/mix/MixWithProperties1.java | 64 +
.../core/components/mix/MixWithProperties2.java | 64 +
.../ipojo/runtime/core/services/CheckService.java | 29 +
.../src/main/resources/metadata.xml | 65 +
.../apache/felix/ipojo/runtime/core/Common.java | 30 +
.../core/TestContextInjectionFromAnnotations.java | 129 ++
.../runtime/core/TestContextInjectionFromXML.java | 113 ++
.../TestInjectingComponentAndInstanceContext.java | 128 ++
.../core/TestInjectingContextAndProperties.java | 76 +
.../src/test/resources/exam.properties | 19 +
.../core-it/ipojo-core-declaration-test/pom.xml | 47 +
.../core/test/components/EnglishHelloService.java | 43 +
.../core/test/components/EnglishHelloService2.java | 43 +
.../core/test/components/FrenchHelloService.java | 43 +
.../core/test/components/GermanHelloService.java | 40 +
.../runtime/core/test/services/HelloService.java | 29 +
.../runtime/core/test/declaration/Common.java | 45 +
.../declaration/TestDeclarationBuilderService.java | 209 +++
.../ipojo-core-external-handlers-test/pom.xml | 33 +
.../CheckServiceAndFieldInterceptorHandler.java | 131 ++
.../components/CheckServiceHandler.java | 106 ++
.../components/FooProviderType1.java | 74 +
.../externalhandlers/services/CheckService.java | 32 +
.../services/CheckServiceHandlerDescription.java | 38 +
.../externalhandlers/services/FooService.java | 42 +
.../src/main/resources/metadata.xml | 77 +
.../externalhandlers/test/AutoHandlerTest.java | 109 ++
.../runtime/externalhandlers/test/Common.java | 29 +
.../runtime/externalhandlers/test/HandlerTest.java | 213 +++
.../test/HandlerWithFieldInterceptorTest.java | 84 +
.../core-it/ipojo-core-factory-test/pom.xml | 35 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../runtime/core/components/FiveInstances.java | 27 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 117 ++
.../core/components/FooProviderTypeDyn.java | 64 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../ipojo/runtime/core/components/NoInstances.java | 27 +
.../core/components/OneDuplicateInstance.java | 27 +
.../core/components/ReconfigurableSimpleType.java | 63 +
.../ipojo/runtime/core/components/SimpleType.java | 26 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../ipojo/runtime/core/services/NoService.java | 23 +
.../src/main/resources/metadata.xml | 174 +++
.../apache/felix/ipojo/runtime/core/Common.java | 70 +
.../ipojo/runtime/core/TestComponentDesc.java | 345 ++++
.../felix/ipojo/runtime/core/TestConfigAdmin.java | 174 +++
.../ipojo/runtime/core/TestFactoryProperties.java | 86 +
.../felix/ipojo/runtime/core/TestInstances.java | 176 +++
.../felix/ipojo/runtime/core/TestObedience.java | 117 ++
.../ipojo/runtime/core/TestReconfiguration.java | 287 ++++
.../core/TestUnacceptableConfiguration.java | 836 ++++++++++
.../src/test/resources/exam.properties | 19 +
.../ipojo-core-factory-version-test/pom.xml | 33 +
.../ipojo/core/tests/components/MyComponent.java | 30 +
.../felix/ipojo/core/tests/components/MyCons.java | 32 +
.../felix/ipojo/core/tests/services/MyService.java | 26 +
.../src/main/resources/cons.xml | 27 +
.../src/main/resources/instances.xml | 41 +
.../src/main/resources/provider-v1.1.xml | 26 +
.../src/main/resources/provider-v1.xml | 31 +
.../src/main/resources/vprovider-v1.xml | 27 +
.../src/main/resources/vprovider-v2.xml | 28 +
.../org/apache/felix/ipojo/tests/core/Common.java | 91 ++
.../felix/ipojo/tests/core/FactoryVersionTest.java | 176 +++
.../ipojo/tests/core/VersionConflictTest.java | 279 ++++
.../core-it/ipojo-core-handler-test/pom.xml | 35 +
.../ipojo/runtime/core/components/DummyImpl.java | 35 +
.../ipojo/runtime/core/components/MyComponent.java | 30 +
.../ipojo/runtime/core/handlers/DummyHandler.java | 74 +
.../ipojo/runtime/core/handlers/EmptyHandler.java | 46 +
.../felix/ipojo/runtime/core/services/Dummy.java | 24 +
.../ipojo/runtime/core/services/MyService.java | 26 +
.../felix/ipojo/runtime/core/services/User.java | 30 +
.../src/main/resources/dummy-component.xml | 28 +
.../src/main/resources/dummy-handler.xml | 36 +
.../src/main/resources/ignorecase.xml | 39 +
.../apache/felix/ipojo/runtime/core/Common.java | 39 +
.../felix/ipojo/runtime/core/DummyHandlerTest.java | 218 +++
.../core/IgnoreCaseHandlerSelectionTest.java | 159 ++
.../org/apache/felix/ipojo/runtime/core/Tools.java | 51 +
.../ipojo-core-lifecycle-callback-test/pom.xml | 35 +
.../components/CallbackWithErrorCheckService.java | 44 +
.../runtime/core/components/FooProviderType1.java | 109 ++
.../core/components/FooProviderTypeDyn2.java | 58 +
.../core/components/LifecycleControllerTest.java | 49 +
.../ipojo/runtime/core/components/ParentClass.java | 51 +
.../core/services/CallbackCheckService.java | 67 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../src/main/resources/metadata.xml | 108 ++
.../apache/felix/ipojo/runtime/core/Common.java | 30 +
.../felix/ipojo/runtime/core/TestCallback.java | 118 ++
.../ipojo/runtime/core/TestErrorCallback.java | 60 +
.../ipojo/runtime/core/TestImmediateCallback.java | 117 ++
.../TestImmediateCallbackSeveralFactories.java | 124 ++
.../TestImmediateCallbackSingletonFactory.java | 120 ++
.../core/TestImmediateLifeCycleController.java | 114 ++
.../ipojo/runtime/core/TestParentCallback.java | 108 ++
.../src/test/resources/exam.properties | 19 +
.../ipojo-core-lifecycle-controller-test/pom.xml | 35 +
.../ConfigurableLifecycleControllerTest.java | 42 +
.../core/components/LifecycleControllerTest.java | 49 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../src/main/resources/metadata.xml | 54 +
.../apache/felix/ipojo/runtime/core/Common.java | 31 +
.../core/TestConfigurableLifeCycleController.java | 151 ++
.../core/TestImmediateLifeCycleController.java | 118 ++
.../runtime/core/TestLifeCycleController.java | 137 ++
.../src/test/resources/exam.properties | 19 +
.../runtime/core-it/ipojo-core-logger-test/pom.xml | 65 +
.../ipojo/runtime/core/components/MyComponent.java | 30 +
.../core/components/MyErroneousComponent.java | 34 +
.../ipojo/runtime/core/services/MyService.java | 26 +
.../src/main/resources/component.xml | 25 +
.../src/main/resources/erroneous-component.xml | 24 +
.../apache/felix/ipojo/runtime/core/Common.java | 34 +
.../runtime/core/TestBNDManifestLoggerInfo.java | 111 ++
.../felix/ipojo/runtime/core/TestErrorHandler.java | 147 ++
.../ipojo/runtime/core/TestManifestLoggerInfo.java | 127 ++
.../ipojo/runtime/core/TestSystemLoggerInfo.java | 102 ++
.../runtime/core/TestSystemLoggerWarning.java | 102 ++
.../pom.xml | 35 +
.../core/test/components/AdvancedFooConsumer.java | 82 +
.../runtime/core/test/components/FooConsumer.java | 68 +
.../runtime/core/test/components/FooProvider.java | 56 +
.../AddLocationTrackingInterceptor.java | 50 +
.../AdvancedTrackerAndRankerInterceptor.java | 126 ++
.../interceptors/EnhancingBindingInterceptor.java | 77 +
.../interceptors/FilterRankingInterceptor.java | 75 +
.../core/test/interceptors/GradeComparator.java | 37 +
.../interceptors/HidingTrackingInterceptor.java | 60 +
.../interceptors/PropertyTrackingInterceptor.java | 56 +
.../test/interceptors/ProxyBindingInterceptor.java | 100 ++
.../interceptors/TrackerAndRankerInterceptor.java | 146 ++
.../runtime/core/test/services/CheckService.java | 32 +
.../ipojo/runtime/core/test/services/Enhanced.java | 27 +
.../runtime/core/test/services/FooService.java | 32 +
.../ipojo/runtime/core/test/services/Setter.java | 28 +
.../runtime/core/test/dependencies/Common.java | 40 +
.../test/dependencies/TestBindingInterceptors.java | 203 +++
.../TestCombinationOfInterceptors.java | 129 ++
.../core/test/dependencies/TestHidingServices.java | 133 ++
.../TestInterceptorsOnSeveralDependencies.java | 94 ++
.../test/dependencies/TestRankingServices.java | 221 +++
.../dependencies/TestTransformingServices.java | 177 +++
.../pom.xml | 35 +
.../test/components/CheckProviderParentClass.java | 65 +
.../core/test/components/CheckServiceProvider.java | 145 ++
.../test/components/CollectionCheckService.java | 183 +++
.../test/components/DynCheckServiceProvider.java | 97 ++
.../core/test/components/FooProviderType1.java | 109 ++
.../core/test/components/FooProviderType2.java | 68 +
.../test/components/FooServiceDefaultImpl.java | 55 +
.../core/test/components/ListCheckService.java | 184 +++
.../components/MethodCheckServiceProvider.java | 134 ++
.../components/MethodMultipleCheckService.java | 178 +++
.../core/test/components/MultipleCheckService.java | 183 +++
.../components/MultipleFilterCheckSubscriber.java | 56 +
.../runtime/core/test/components/ParentClass.java | 51 +
.../test/components/RankedFooProviderType1.java | 52 +
.../core/test/components/SetCheckService.java | 164 ++
.../core/test/components/VectorCheckService.java | 159 ++
.../comparator/CheckServiceProvider.java | 64 +
.../components/comparator/GradeComparator.java | 50 +
.../comparator/GradedFooServiceProvider.java | 59 +
.../ExceptionAwareCheckServiceProvider.java | 73 +
.../components/exceptions/NoServiceException.java | 31 +
.../components/filter/FilterCheckProvider.java | 90 ++
.../components/filter/FilterCheckSubscriber.java | 56 +
.../filter/MultipleFilterCheckSubscriber.java | 57 +
.../runtime/core/test/components/inner/C1.java | 30 +
.../runtime/core/test/components/inner/C2.java | 32 +
.../runtime/core/test/components/inner/C3.java | 38 +
.../core/test/components/inner/MyFilter.java | 26 +
.../core/test/components/optional/MyComponent.java | 42 +
.../policies/CheckProviderParentClass.java | 51 +
.../components/policies/CheckServiceProvider.java | 91 ++
.../policies/DynCheckServiceProvider.java | 87 ++
.../policies/MethodCheckServiceProvider.java | 123 ++
.../policies/MethodMultipleCheckService.java | 165 ++
.../components/policies/MultipleCheckService.java | 158 ++
.../policies/RankedFooProviderType1.java | 61 +
.../components/proxy/CheckServiceDelegator.java | 50 +
.../proxy/CheckServiceGetAndDelegate.java | 48 +
.../components/proxy/CheckServiceNoDelegate.java | 61 +
.../proxy/CheckServiceUsingStringService.java | 47 +
.../runtime/core/test/components/proxy/Helper.java | 69 +
.../ipojo/runtime/core/test/services/Call.java | 27 +
.../runtime/core/test/services/CheckService.java | 31 +
.../runtime/core/test/services/FooService.java | 39 +
.../src/main/resources/metadata-comparator.xml | 55 +
.../src/main/resources/metadata-filter.xml | 141 ++
.../src/main/resources/metadata-policies.xml | 283 ++++
.../src/main/resources/metadata.xml | 1083 +++++++++++++
.../runtime/core/test/dependencies/Common.java | 59 +
.../di/TestDelayedOptionalDependencies.java | 365 +++++
.../di/TestMethodDelayedOptionalDependencies.java | 235 +++
.../di/TestMethodOptionalDependencies.java | 275 ++++
.../dependencies/di/TestOptionalDependencies.java | 399 +++++
.../exceptions/TestDependenciesWithExceptions.java | 95 ++
.../optional/TestDelayedOptionalDependencies.java | 498 ++++++
.../TestDelayedOptionalMultipleDependencies.java | 368 +++++
.../TestMethodDelayedOptionalDependencies.java | 369 +++++
...tMethodDelayedOptionalMultipleDependencies.java | 215 +++
.../optional/TestMethodOptionalDependencies.java | 436 ++++++
.../TestMethodOptionalMultipleDependencies.java | 288 ++++
.../TestNullableTransitiveClassloading.java | 41 +
.../optional/TestOptionalDependencies.java | 551 +++++++
.../optional/TestOptionalMultipleDependencies.java | 485 ++++++
.../TestOptionalNoNullableDependencies.java | 550 +++++++
.../TestProxiedDelayedOptionalDependencies.java | 498 ++++++
...ProxiedDelayedOptionalMultipleDependencies.java | 364 +++++
.../optional/TestProxiedOptionalDependencies.java | 554 +++++++
.../ipojo-core-service-dependency-policies/pom.xml | 35 +
.../test/components/CheckProviderParentClass.java | 65 +
.../core/test/components/CheckServiceProvider.java | 145 ++
.../test/components/CollectionCheckService.java | 183 +++
.../test/components/DynCheckServiceProvider.java | 97 ++
.../core/test/components/FooProviderType1.java | 109 ++
.../core/test/components/FooProviderType2.java | 68 +
.../test/components/FooServiceDefaultImpl.java | 55 +
.../core/test/components/ListCheckService.java | 184 +++
.../components/MethodCheckServiceProvider.java | 134 ++
.../components/MethodMultipleCheckService.java | 178 +++
.../core/test/components/MultipleCheckService.java | 183 +++
.../components/MultipleFilterCheckSubscriber.java | 56 +
.../runtime/core/test/components/ParentClass.java | 51 +
.../test/components/RankedFooProviderType1.java | 52 +
.../core/test/components/SetCheckService.java | 164 ++
.../core/test/components/VectorCheckService.java | 159 ++
.../comparator/CheckServiceProvider.java | 64 +
.../components/comparator/GradeComparator.java | 50 +
.../comparator/GradedFooServiceProvider.java | 59 +
.../components/filter/FilterCheckProvider.java | 90 ++
.../components/filter/FilterCheckSubscriber.java | 56 +
.../filter/MultipleFilterCheckSubscriber.java | 57 +
.../runtime/core/test/components/inner/C1.java | 30 +
.../runtime/core/test/components/inner/C2.java | 32 +
.../runtime/core/test/components/inner/C3.java | 38 +
.../core/test/components/inner/MyFilter.java | 26 +
.../core/test/components/optional/MyComponent.java | 42 +
.../policies/CheckProviderParentClass.java | 51 +
.../components/policies/CheckServiceProvider.java | 91 ++
.../policies/DynCheckServiceProvider.java | 87 ++
.../policies/MethodCheckServiceProvider.java | 123 ++
.../policies/MethodMultipleCheckService.java | 165 ++
.../components/policies/MultipleCheckService.java | 158 ++
.../policies/RankedFooProviderType1.java | 61 +
.../components/proxy/CheckServiceDelegator.java | 50 +
.../proxy/CheckServiceGetAndDelegate.java | 48 +
.../components/proxy/CheckServiceNoDelegate.java | 61 +
.../proxy/CheckServiceUsingStringService.java | 47 +
.../runtime/core/test/components/proxy/Helper.java | 69 +
.../ipojo/runtime/core/test/services/Call.java | 27 +
.../runtime/core/test/services/CheckService.java | 31 +
.../runtime/core/test/services/FooService.java | 39 +
.../src/main/resources/metadata-comparator.xml | 55 +
.../src/main/resources/metadata-filter.xml | 141 ++
.../src/main/resources/metadata-policies.xml | 283 ++++
.../src/main/resources/metadata.xml | 1083 +++++++++++++
.../runtime/core/test/dependencies/Common.java | 60 +
.../dependencies/comparator/TestComparator.java | 159 ++
.../dependencies/policies/TestDynamicPriority.java | 165 ++
.../TestStaticMethodOptionalDependencies.java | 275 ++++
.../TestStaticMethodSimpleDependencies.java | 198 +++
.../policies/TestStaticMultipleDependencies.java | 325 ++++
.../policies/TestStaticOptionalDependencies.java | 521 +++++++
.../policies/TestStaticSimpleDependencies.java | 351 +++++
.../ipojo-core-service-dependency-proxies/pom.xml | 35 +
.../test/components/CheckProviderParentClass.java | 65 +
.../core/test/components/CheckServiceProvider.java | 145 ++
.../test/components/CollectionCheckService.java | 183 +++
.../test/components/DynCheckServiceProvider.java | 97 ++
.../core/test/components/FooProviderType1.java | 109 ++
.../core/test/components/FooProviderType2.java | 68 +
.../test/components/FooServiceDefaultImpl.java | 55 +
.../core/test/components/ListCheckService.java | 184 +++
.../components/MethodCheckServiceProvider.java | 134 ++
.../components/MethodMultipleCheckService.java | 178 +++
.../core/test/components/MultipleCheckService.java | 183 +++
.../components/MultipleFilterCheckSubscriber.java | 56 +
.../runtime/core/test/components/ParentClass.java | 51 +
.../test/components/RankedFooProviderType1.java | 52 +
.../core/test/components/SetCheckService.java | 164 ++
.../core/test/components/VectorCheckService.java | 159 ++
.../comparator/CheckServiceProvider.java | 64 +
.../components/comparator/GradeComparator.java | 50 +
.../comparator/GradedFooServiceProvider.java | 59 +
.../components/filter/FilterCheckProvider.java | 90 ++
.../components/filter/FilterCheckSubscriber.java | 56 +
.../filter/MultipleFilterCheckSubscriber.java | 57 +
.../runtime/core/test/components/inner/C1.java | 30 +
.../runtime/core/test/components/inner/C2.java | 32 +
.../runtime/core/test/components/inner/C3.java | 38 +
.../core/test/components/inner/MyFilter.java | 26 +
.../core/test/components/optional/MyComponent.java | 42 +
.../policies/CheckProviderParentClass.java | 51 +
.../components/policies/CheckServiceProvider.java | 91 ++
.../policies/DynCheckServiceProvider.java | 87 ++
.../policies/MethodCheckServiceProvider.java | 123 ++
.../policies/MethodMultipleCheckService.java | 165 ++
.../components/policies/MultipleCheckService.java | 158 ++
.../policies/RankedFooProviderType1.java | 61 +
.../components/proxy/CheckServiceDelegator.java | 50 +
.../proxy/CheckServiceGetAndDelegate.java | 48 +
.../components/proxy/CheckServiceNoDelegate.java | 61 +
.../proxy/CheckServiceUsingStringService.java | 47 +
.../runtime/core/test/components/proxy/Helper.java | 68 +
.../ipojo/runtime/core/test/services/Call.java | 27 +
.../runtime/core/test/services/CheckService.java | 31 +
.../runtime/core/test/services/FooService.java | 39 +
.../src/main/resources/metadata-comparator.xml | 55 +
.../src/main/resources/metadata-filter.xml | 141 ++
.../src/main/resources/metadata-policies.xml | 283 ++++
.../src/main/resources/metadata.xml | 1083 +++++++++++++
.../runtime/core/test/dependencies/Common.java | 59 +
.../TestProxiedCollectionMultipleDependencies.java | 256 +++
.../TestProxiedDelayedMultipleDependencies.java | 525 +++++++
.../TestProxiedDelayedSimpleDependencies.java | 374 +++++
.../TestProxiedListMultipleDependencies.java | 256 +++
.../TestProxiedSetMultipleDependencies.java | 256 +++
.../proxies/TestProxiedSimpleDependencies.java | 418 +++++
.../test/dependencies/proxies/TestProxyTest.java | 270 ++++
.../ipojo-core-service-dependency-test/pom.xml | 35 +
.../test/components/CheckProviderParentClass.java | 65 +
.../core/test/components/CheckServiceProvider.java | 145 ++
.../test/components/CollectionCheckService.java | 183 +++
.../test/components/DynCheckServiceProvider.java | 97 ++
.../core/test/components/FooProviderType1.java | 109 ++
.../core/test/components/FooProviderType2.java | 68 +
.../test/components/FooServiceDefaultImpl.java | 55 +
.../core/test/components/ListCheckService.java | 184 +++
.../components/MethodCheckServiceProvider.java | 134 ++
.../components/MethodMultipleCheckService.java | 178 +++
.../core/test/components/MultipleCheckService.java | 183 +++
.../components/MultipleFilterCheckSubscriber.java | 56 +
.../runtime/core/test/components/ParentClass.java | 51 +
.../test/components/RankedFooProviderType1.java | 52 +
.../core/test/components/SetCheckService.java | 164 ++
.../core/test/components/VectorCheckService.java | 159 ++
.../comparator/CheckServiceProvider.java | 64 +
.../components/comparator/GradeComparator.java | 50 +
.../comparator/GradedFooServiceProvider.java | 59 +
.../context/ContextualFilterConsumer.java | 53 +
.../core/test/components/context/Provider1.java | 75 +
.../core/test/components/context/Provider2.java | 75 +
.../error/NullPointerExceptionBinder.java | 37 +
.../components/filter/FilterCheckProvider.java | 90 ++
.../components/filter/FilterCheckSubscriber.java | 56 +
.../filter/MultipleFilterCheckSubscriber.java | 57 +
.../identification/ComponentWithCustomMethods.java | 64 +
.../runtime/core/test/components/inner/C1.java | 30 +
.../runtime/core/test/components/inner/C2.java | 32 +
.../runtime/core/test/components/inner/C3.java | 38 +
.../core/test/components/inner/MyFilter.java | 26 +
.../test/components/leak/DefaultHelloService.java | 39 +
.../components/leak/DefaultLeakingService.java | 63 +
.../core/test/components/optional/MyComponent.java | 42 +
.../policies/CheckProviderParentClass.java | 51 +
.../components/policies/CheckServiceProvider.java | 91 ++
.../policies/DynCheckServiceProvider.java | 87 ++
.../policies/MethodCheckServiceProvider.java | 123 ++
.../policies/MethodMultipleCheckService.java | 165 ++
.../components/policies/MultipleCheckService.java | 158 ++
.../policies/RankedFooProviderType1.java | 61 +
.../components/proxy/CheckServiceDelegator.java | 50 +
.../proxy/CheckServiceGetAndDelegate.java | 48 +
.../components/proxy/CheckServiceNoDelegate.java | 61 +
.../proxy/CheckServiceUsingStringService.java | 47 +
.../runtime/core/test/components/proxy/Helper.java | 69 +
.../ipojo/runtime/core/test/services/Call.java | 27 +
.../runtime/core/test/services/CheckService.java | 31 +
.../runtime/core/test/services/FooService.java | 39 +
.../runtime/core/test/services/HelloService.java | 28 +
.../runtime/core/test/services/LeakingService.java | 29 +
.../ipojo/runtime/core/test/services/Listener.java | 28 +
.../src/main/resources/metadata-comparator.xml | 55 +
.../src/main/resources/metadata-filter.xml | 141 ++
.../src/main/resources/metadata.xml | 519 ++++++
.../runtime/core/test/dependencies/Common.java | 52 +
.../TestCollectionMultipleDependencies.java | 245 +++
.../TestDelayedMultipleDependencies.java | 507 ++++++
.../TestDelayedSimpleDependencies.java | 373 +++++
.../dependencies/TestDependencyArchitecture.java | 702 +++++++++
.../dependencies/TestListMultipleDependencies.java | 255 +++
.../TestMethodDelayedMultipleDependencies.java | 397 +++++
.../TestMethodDelayedSimpleDependencies.java | 286 ++++
.../TestMethodMultipleDependencies.java | 512 ++++++
.../dependencies/TestMethodSimpleDependencies.java | 286 ++++
.../test/dependencies/TestModifyDependencies.java | 411 +++++
.../dependencies/TestMultipleDependencies.java | 389 +++++
.../TestNonProxiedNotInterfaceDependencies.java | 66 +
.../dependencies/TestSetMultipleDependencies.java | 255 +++
.../test/dependencies/TestSimpleDependencies.java | 422 +++++
.../TestVectorMultipleDependencies.java | 255 +++
.../context/TestContextualFilters.java | 200 +++
.../TestContextualFiltersAndExternalSources.java | 208 +++
.../dependencies/error/TestNPEInBindMethod.java | 46 +
.../dependencies/filter/TestFromDependencies.java | 320 ++++
.../filter/TestMultipleFilterDependencies.java | 595 +++++++
.../TestOptionalMultipleFilterDependencies.java | 621 ++++++++
.../TestOptionalSimpleFilterDependencies.java | 591 +++++++
.../filter/TestSimpleFilterDependencies.java | 526 +++++++
.../identification/TestDependencyIdDetection.java | 108 ++
.../test/dependencies/inner/TestInnerProxyMix.java | 85 +
.../dependencies/leak/ListenerStyleLeakTest.java | 106 ++
.../pom.xml | 33 +
.../timeout/components/CheckServiceProvider.java | 44 +
.../components/CollectionCheckServiceProvider.java | 56 +
.../timeout/components/FooProvider.java | 56 +
.../components/MultipleCheckServiceProvider.java | 48 +
.../timeout/components/NullableFooProvider.java | 56 +
.../timeout/services/CheckService.java | 30 +
.../dependencies/timeout/services/FooService.java | 40 +
.../src/main/resources/metadata.xml | 142 ++
.../runtime/test/dependencies/timeout/Common.java | 31 +
.../timeout/DefaultImplementationTest.java | 111 ++
.../test/dependencies/timeout/DelayTest.java | 228 +++
.../test/dependencies/timeout/DelayedProvider.java | 74 +
.../test/dependencies/timeout/EmptyTest.java | 232 +++
.../test/dependencies/timeout/NullTest.java | 71 +
.../test/dependencies/timeout/NullableTest.java | 110 ++
.../test/dependencies/timeout/TimeoutTest.java | 128 ++
.../ipojo-core-service-providing-test/pom.xml | 35 +
.../core/components/CheckProviderParentClass.java | 51 +
.../core/components/CheckServiceProvider.java | 83 +
.../core/components/FooBarProviderType1.java | 54 +
.../runtime/core/components/FooProviderType1.java | 117 ++
.../core/components/FooProviderTypeDyn.java | 64 +
.../core/components/FooProviderTypeDyn2.java | 58 +
.../components/FooProviderWithAnonymousClass.java | 114 ++
.../core/components/NullCheckServiceProvider.java | 76 +
.../ipojo/runtime/core/components/SimpleClass.java | 30 +
.../callbacks/CallbacksCheckService.java | 111 ++
.../controller/ControllerCheckService.java | 75 +
.../controller/DoubleControllerCheckService.java | 85 +
.../runtime/core/components/inheritance/a/IA.java | 26 +
.../runtime/core/components/inheritance/b/IB.java | 27 +
.../runtime/core/components/inheritance/c/C.java | 38 +
.../runtime/core/components/inheritance/d/D.java | 59 +
.../inherited/ProcessImplementation1.java | 45 +
.../inherited/ProcessImplementation2.java | 44 +
.../inherited/ProcessImplementation3.java | 82 +
.../inherited/ProcessImplementation4.java | 82 +
.../inherited/ProcessParentImplementation.java | 46 +
.../core/components/strategies/BarConsumer.java | 42 +
.../core/components/strategies/Consumer.java | 42 +
.../strategies/DummyCreationStrategy.java | 191 +++
.../strategies/DummyCreationStrategy2.java | 34 +
.../components/strategies/DummyServiceFactory.java | 80 +
.../components/strategies/FooBarProviderType1.java | 86 +
.../components/strategies/FooProviderType1.java | 86 +
.../ipojo/runtime/core/services/BarService.java | 29 +
.../ipojo/runtime/core/services/CheckService.java | 31 +
.../runtime/core/services/ChildInterface.java | 25 +
.../ipojo/runtime/core/services/FooService.java | 39 +
.../runtime/core/services/ParentInterface1.java | 25 +
.../runtime/core/services/ParentInterface2.java | 25 +
.../core/services/ParentParentInterface.java | 25 +
.../src/main/resources/basics.xml | 140 ++
.../src/main/resources/callbacks/callbacks.xml | 60 +
.../src/main/resources/concrete-abstract.xml | 52 +
.../resources/controller/service-controller.xml | 105 ++
.../src/main/resources/inheritance/cons.xml | 22 +
.../src/main/resources/inheritance/inheritance.xml | 64 +
.../src/main/resources/inheritance/provider.xml | 22 +
.../resources/strategies/metadata-strategies.xml | 77 +
.../apache/felix/ipojo/runtime/core/Common.java | 60 +
.../felix/ipojo/runtime/core/TestCallbacks.java | 174 +++
.../apache/felix/ipojo/runtime/core/TestClass.java | 93 ++
.../felix/ipojo/runtime/core/TestDynamicProps.java | 294 ++++
.../core/TestDynamicPropsReconfiguration.java | 758 +++++++++
.../felix/ipojo/runtime/core/TestExposition.java | 159 ++
.../ipojo/runtime/core/TestInheritedClasses.java | 204 +++
.../felix/ipojo/runtime/core/TestListeners.java | 272 ++++
.../felix/ipojo/runtime/core/TestNullCheck.java | 77 +
.../ipojo/runtime/core/TestOSGiProperties.java | 85 +
.../core/TestPropertiesInAnonymousClass.java | 166 ++
.../core/TestProvidedServiceArchitecture.java | 231 +++
.../ipojo/runtime/core/TestServiceController.java | 260 +++
.../felix/ipojo/runtime/core/TestSimplePS.java | 81 +
.../felix/ipojo/runtime/core/TestStaticProps.java | 115 ++
.../core/TestStaticPropsReconfiguration.java | 349 +++++
.../runtime/core/inheritence/InheritanceTest.java | 170 ++
.../core/strategies/CustomStrategy2Test.java | 228 +++
.../core/strategies/CustomStrategyTest.java | 229 +++
.../core/strategies/PerInstanceStrategyTest.java | 227 +++
ipojo/runtime/core-it/pom.xml | 430 +++++
.../src/main/appended-resources/META-INF/NOTICE | 0
ipojo/runtime/core/changelog.txt | 398 +++++
ipojo/runtime/core/obr.xml | 44 +
ipojo/runtime/core/pom.xml | 375 +++++
.../main/appended-resources/META-INF/DEPENDENCIES | 21 +
.../src/main/appended-resources/META-INF/LICENSE | 42 +
.../src/main/appended-resources/META-INF/NOTICE | 8 +
.../org/apache/felix/ipojo/ComponentFactory.java | 461 ++++++
.../org/apache/felix/ipojo/ComponentInstance.java | 128 ++
.../apache/felix/ipojo/ConfigurationException.java | 81 +
.../apache/felix/ipojo/ConfigurationTracker.java | 327 ++++
.../apache/felix/ipojo/ConstructorInjector.java | 53 +
.../org/apache/felix/ipojo/ContextListener.java | 38 +
.../java/org/apache/felix/ipojo/ContextSource.java | 58 +
.../java/org/apache/felix/ipojo/ErrorHandler.java | 45 +
.../org/apache/felix/ipojo/EventDispatcher.java | 181 +++
.../main/java/org/apache/felix/ipojo/Factory.java | 205 +++
.../org/apache/felix/ipojo/FactoryClassloader.java | 88 ++
.../apache/felix/ipojo/FactoryStateListener.java | 36 +
.../org/apache/felix/ipojo/FieldInterceptor.java | 49 +
.../main/java/org/apache/felix/ipojo/Handler.java | 264 ++++
.../org/apache/felix/ipojo/HandlerFactory.java | 65 +
.../org/apache/felix/ipojo/HandlerManager.java | 244 +++
.../apache/felix/ipojo/HandlerManagerFactory.java | 223 +++
.../apache/felix/ipojo/IPOJOServiceFactory.java | 43 +
.../java/org/apache/felix/ipojo/IPojoContext.java | 511 ++++++
.../java/org/apache/felix/ipojo/IPojoFactory.java | 1184 ++++++++++++++
.../org/apache/felix/ipojo/InstanceManager.java | 1578 +++++++++++++++++++
.../apache/felix/ipojo/InstanceStateListener.java | 43 +
.../org/apache/felix/ipojo/MethodInterceptor.java | 80 +
.../felix/ipojo/MissingHandlerException.java | 65 +
.../main/java/org/apache/felix/ipojo/Nullable.java | 33 +
.../src/main/java/org/apache/felix/ipojo/Pojo.java | 35 +
.../apache/felix/ipojo/PolicyServiceContext.java | 498 ++++++
.../org/apache/felix/ipojo/PrimitiveHandler.java | 257 +++
.../felix/ipojo/PrimitiveInstanceDescription.java | 178 +++
.../felix/ipojo/PrimitiveTypeDescription.java | 228 +++
.../org/apache/felix/ipojo/ServiceContext.java | 149 ++
.../felix/ipojo/UnacceptableConfiguration.java | 47 +
.../felix/ipojo/architecture/Architecture.java | 40 +
.../architecture/ComponentTypeDescription.java | 318 ++++
.../ipojo/architecture/CustomHandlerInfo.java | 37 +
.../ipojo/architecture/HandlerDescription.java | 86 +
.../ipojo/architecture/InstanceDescription.java | 203 +++
.../ipojo/architecture/PropertyDescription.java | 215 +++
.../felix/ipojo/configuration/Configuration.java | 32 +
.../apache/felix/ipojo/configuration/Instance.java | 189 +++
.../felix/ipojo/context/ServiceReferenceImpl.java | 156 ++
.../ipojo/context/ServiceRegistrationImpl.java | 272 ++++
.../felix/ipojo/context/ServiceRegistry.java | 346 ++++
.../org/apache/felix/ipojo/context/StringMap.java | 148 ++
.../ComparatorBasedServiceRankingInterceptor.java | 65 +
.../dependency/impl/DependencyProperties.java | 109 ++
.../impl/EmptyBasedServiceRankingInterceptor.java | 56 +
.../FilterBasedServiceTrackingInterceptor.java | 63 +
.../dependency/impl/ServiceReferenceManager.java | 982 ++++++++++++
.../dependency/impl/ServiceReferenceUtils.java | 145 ++
.../impl/TransformedServiceReferenceImpl.java | 170 ++
.../interceptors/DefaultDependencyInterceptor.java | 59 +
.../DefaultServiceRankingInterceptor.java | 71 +
.../DefaultServiceTrackingInterceptor.java | 65 +
.../interceptors/DependencyInterceptor.java | 56 +
.../interceptors/ServiceBindingInterceptor.java | 70 +
.../interceptors/ServiceRankingInterceptor.java | 81 +
.../interceptors/ServiceTrackingInterceptor.java | 64 +
.../interceptors/TransformedServiceReference.java | 88 ++
.../felix/ipojo/extender/ConfigurationBuilder.java | 61 +
.../apache/felix/ipojo/extender/Declaration.java | 57 +
.../ipojo/extender/DeclarationBuilderService.java | 127 ++
.../felix/ipojo/extender/DeclarationHandle.java | 50 +
.../felix/ipojo/extender/ExtensionDeclaration.java | 48 +
.../felix/ipojo/extender/InstanceBuilder.java | 105 ++
.../felix/ipojo/extender/InstanceDeclaration.java | 80 +
.../org/apache/felix/ipojo/extender/Status.java | 49 +
.../felix/ipojo/extender/TypeDeclaration.java | 63 +
.../ipojo/extender/builder/FactoryBuilder.java | 41 +
.../extender/builder/FactoryBuilderException.java | 46 +
.../ipojo/extender/internal/AbstractService.java | 104 ++
.../ipojo/extender/internal/BundleProcessor.java | 45 +
.../felix/ipojo/extender/internal/DefaultJob.java | 67 +
.../felix/ipojo/extender/internal/Extender.java | 340 ++++
.../felix/ipojo/extender/internal/Lifecycle.java | 36 +
.../extender/internal/LifecycleQueueService.java | 29 +
.../internal/builder/ReflectiveFactoryBuilder.java | 75 +
.../internal/declaration/AbstractDeclaration.java | 148 ++
.../declaration/DefaultExtensionDeclaration.java | 64 +
.../declaration/DefaultInstanceDeclaration.java | 107 ++
.../declaration/DefaultTypeDeclaration.java | 96 ++
.../service/DeclarationServiceFactory.java | 65 +
.../service/DefaultConfigurationBuilder.java | 60 +
.../service/DefaultDeclarationBuilderService.java | 60 +
.../service/DefaultInstanceBuilder.java | 114 ++
.../internal/linker/DeclarationLinker.java | 109 ++
.../linker/InstanceBundleContextAware.java | 44 +
.../extender/internal/linker/ManagedType.java | 384 +++++
.../internal/processor/ChainedBundleProcessor.java | 127 ++
.../processor/ComponentsBundleProcessor.java | 231 +++
.../processor/ConfigurationAnnotationScanner.java | 71 +
.../internal/processor/ConfigurationProcessor.java | 331 ++++
.../processor/ExtensionBundleProcessor.java | 176 +++
.../processor/ForwardingBundleProcessor.java | 52 +
.../processor/QueuingActivationProcessor.java | 83 +
.../internal/processor/ReverseBundleProcessor.java | 96 ++
.../internal/queue/AbstractQueueService.java | 86 +
.../internal/queue/ExecutorQueueService.java | 250 +++
.../internal/queue/GroupThreadFactory.java | 67 +
.../extender/internal/queue/JobInfoCallable.java | 198 +++
.../internal/queue/NamingThreadFactory.java | 92 ++
.../internal/queue/PrefixedThreadFactory.java | 74 +
.../extender/internal/queue/QueueNotifier.java | 32 +
.../ipojo/extender/internal/queue/Statistic.java | 70 +
.../internal/queue/SynchronousQueueService.java | 131 ++
.../queue/debug/ReplayQueueEventProxy.java | 157 ++
.../queue/pref/HeaderPreferenceSelection.java | 55 +
.../extender/internal/queue/pref/Preference.java | 36 +
.../queue/pref/PreferenceQueueService.java | 167 ++
.../internal/queue/pref/PreferenceSelection.java | 29 +
.../queue/pref/enforce/EnforcedQueueService.java | 131 ++
.../queue/pref/enforce/ForwardingQueueService.java | 82 +
.../felix/ipojo/extender/queue/Callback.java | 42 +
.../org/apache/felix/ipojo/extender/queue/Job.java | 36 +
.../apache/felix/ipojo/extender/queue/JobInfo.java | 74 +
.../felix/ipojo/extender/queue/QueueListener.java | 67 +
.../felix/ipojo/extender/queue/QueueService.java | 125 ++
.../extender/queue/debug/QueueEventProxy.java | 42 +
.../handlers/architecture/ArchitectureHandler.java | 116 ++
.../configuration/ConfigurationHandler.java | 909 +++++++++++
.../ConfigurationHandlerDescription.java | 152 ++
.../configuration/ConfigurationListener.java | 38 +
.../handlers/context/BundleContextHandler.java | 192 +++
.../AggregateDependencyInjectionType.java | 41 +
.../ipojo/handlers/dependency/Dependency.java | 1259 +++++++++++++++
.../handlers/dependency/DependencyCallback.java | 319 ++++
.../dependency/DependencyConfigurationChecker.java | 465 ++++++
.../handlers/dependency/DependencyDescription.java | 174 +++
.../handlers/dependency/DependencyHandler.java | 558 +++++++
.../dependency/DependencyHandlerDescription.java | 208 +++
.../ipojo/handlers/dependency/NullableObject.java | 94 ++
.../ipojo/handlers/dependency/ProxyGenerator.java | 213 +++
.../ipojo/handlers/dependency/ServiceList.java | 456 ++++++
.../ipojo/handlers/dependency/ServiceSet.java | 453 ++++++
.../ipojo/handlers/dependency/ServiceUsage.java | 100 ++
.../lifecycle/callback/LifecycleCallback.java | 101 ++
.../callback/LifecycleCallbackHandler.java | 178 +++
.../lifecycle/controller/ControllerHandler.java | 162 ++
.../handlers/providedservice/CreationStrategy.java | 76 +
.../handlers/providedservice/ProvidedService.java | 1160 ++++++++++++++
.../ProvidedServiceDescription.java | 195 +++
.../providedservice/ProvidedServiceHandler.java | 682 ++++++++
.../ProvidedServiceHandlerDescription.java | 119 ++
.../providedservice/ProvidedServiceListener.java | 52 +
.../strategy/ConfigurableCreationStrategy.java | 142 ++
.../strategy/ErrorPrintingServiceFactoryProxy.java | 109 ++
.../strategy/ServiceObjectFactory.java | 36 +
.../apache/felix/ipojo/parser/FieldMetadata.java | 159 ++
.../felix/ipojo/parser/ManifestMetadataParser.java | 561 +++++++
.../apache/felix/ipojo/parser/MethodMetadata.java | 246 +++
.../apache/felix/ipojo/parser/ParseException.java | 40 +
.../org/apache/felix/ipojo/parser/ParseUtils.java | 85 +
.../apache/felix/ipojo/parser/PojoMetadata.java | 306 ++++
.../java/org/apache/felix/ipojo/util/Callback.java | 278 ++++
.../felix/ipojo/util/ContextSourceManager.java | 332 ++++
.../felix/ipojo/util/DependencyMetadataHelper.java | 109 ++
.../apache/felix/ipojo/util/DependencyModel.java | 1277 +++++++++++++++
.../felix/ipojo/util/DependencyModelListener.java | 40 +
.../felix/ipojo/util/DependencyStateListener.java | 39 +
.../java/org/apache/felix/ipojo/util/Fields.java | 134 ++
.../ipojo/util/InstanceConfigurationSource.java | 115 ++
.../apache/felix/ipojo/util/InvocationResult.java | 76 +
.../main/java/org/apache/felix/ipojo/util/Log.java | 47 +
.../java/org/apache/felix/ipojo/util/Logger.java | 318 ++++
.../java/org/apache/felix/ipojo/util/Methods.java | 189 +++
.../java/org/apache/felix/ipojo/util/Property.java | 689 ++++++++
.../org/apache/felix/ipojo/util/Reflection.java | 35 +
.../apache/felix/ipojo/util/SecurityHelper.java | 218 +++
.../apache/felix/ipojo/util/ServiceLocator.java | 63 +
.../util/ServiceReferenceRankingComparator.java | 90 ++
.../org/apache/felix/ipojo/util/StreamUtils.java | 43 +
.../felix/ipojo/util/SystemPropertiesSource.java | 47 +
.../java/org/apache/felix/ipojo/util/Tracker.java | 753 +++++++++
.../apache/felix/ipojo/util/TrackerCustomizer.java | 69 +
ipojo/runtime/core/src/main/resources/core.xsd | 704 +++++++++
ipojo/runtime/core/src/main/resources/metadata.xml | 49 +
.../apache/felix/ipojo/IPojoFactoryTestCase.java | 118 ++
.../apache/felix/ipojo/InstanceManagerTest.java | 177 +++
.../felix/ipojo/configuration/InstanceDSLTest.java | 102 ++
.../dependency/impl/DependencyPropertiesTest.java | 85 +
.../TransformedServiceReferenceTest.java | 95 ++
.../DefaultExtensionDeclarationTestCase.java | 66 +
.../DefaultInstanceDeclarationTestCase.java | 132 ++
.../DefaultTypeDeclarationTestCase.java | 81 +
.../DefaultConfigurationBuilderTestCase.java | 100 ++
.../DefaultDeclarationBuilderServiceTestCase.java | 96 ++
.../service/DefaultInstanceBuilderTestCase.java | 111 ++
.../internal/linker/DeclarationLinkerTestCase.java | 116 ++
.../internal/linker/ManagedTypeTestCase.java | 99 ++
.../processor/ChainedBundleProcessorTestCase.java | 76 +
.../ExtensionBundleProcessorTestCase.java | 79 +
.../processor/ReverseBundleProcessorTestCase.java | 84 +
.../queue/AbstractQueueServiceTestCase.java | 133 ++
.../queue/ExecutorQueueServiceTestCase.java | 205 +++
.../internal/queue/GroupThreadFactoryTestCase.java | 45 +
.../internal/queue/JobInfoCallableTestCase.java | 101 ++
.../queue/NamingThreadFactoryTestCase.java | 89 ++
.../queue/PrefixedThreadFactoryTestCase.java | 48 +
.../queue/SynchronousQueueServiceTestCase.java | 96 ++
.../extender/internal/queue/callable/EmptyJob.java | 59 +
.../internal/queue/callable/ExceptionCallable.java | 38 +
.../internal/queue/callable/SleepingCallable.java | 40 +
.../internal/queue/callable/StringCallable.java | 63 +
.../queue/debug/ReplayQueueEventProxyTestCase.java | 122 ++
.../pref/HeaderPreferenceSelectionTestCase.java | 79 +
.../pref/enforce/EnforcedQueueServiceTestCase.java | 88 ++
.../dependency/DependencyIdentifierTest.java | 158 ++
.../ipojo/handlers/dependency/NullableTest.java | 67 +
.../ipojo/handlers/dependency/SmartProxyTest.java | 132 ++
.../handlers/dependency/TestSpecification.java | 24 +
.../ComponentTestWithAnotherSuperClass.java | 30 +
.../ComponentTestWithSuperClass.java | 25 +
.../ProvidedServiceHandlerTest.java | 178 +++
.../ipojo/parser/ManipulationMetadataTest.java | 257 +++
.../felix/ipojo/parser/MethodMetadataTest.java | 127 ++
.../felix/ipojo/parser/PojoMetadataTest.java | 322 ++++
.../org/apache/felix/ipojo/test/MockBundle.java | 190 +++
.../felix/ipojo/util/ContextSourceManagerTest.java | 115 ++
.../util/InstanceConfigurationSourceTest.java | 169 ++
.../ipojo/util/ManifestMetadataParserTest.java | 111 ++
.../ipojo/util/SystemPropertiesSourceTest.java | 57 +
.../src/test/resources/manipulation/MANIFEST.MF | 142 ++
ipojo/runtime/distributions/maven-tutorial/pom.xml | 100 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 27 +
.../src/main/appended-resources/META-INF/NOTICE | 8 +
.../src/main/assembly/distribution.xml | 45 +
.../annotations/hello.client.annotations/pom.xml | 72 +
.../ipojo/example/hello/client/HelloClient.java | 88 ++
.../ipojo/example/hello/client/MyDummyHello.java | 30 +
.../annotations/hello.felix.annotations/pom.xml | 123 ++
.../annotations/hello.impl.annotations/pom.xml | 72 +
.../java/ipojo/example/hello/impl/HelloImpl.java | 53 +
.../src/main/skeleton/hello.service/pom.xml | 48 +
.../src/main/java/ipojo/example/hello/Hello.java | 33 +
.../maven-tutorial/src/main/skeleton/pom.xml | 94 ++
.../src/main/skeleton/xml/hello.client.xml/pom.xml | 72 +
.../ipojo/example/hello/client/HelloClient.java | 90 ++
.../src/main/resources/metadata.xml | 47 +
.../src/main/skeleton/xml/hello.felix.xml/pom.xml | 124 ++
.../src/main/skeleton/xml/hello.impl.xml/pom.xml | 72 +
.../java/ipojo/example/hello/impl/HelloImpl.java | 36 +
.../hello.impl.xml/src/main/resources/metadata.xml | 28 +
ipojo/runtime/distributions/quickstart/pom.xml | 144 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 27 +
.../src/main/appended-resources/META-INF/NOTICE | 8 +
.../quickstart/src/main/assembly/distribution.xml | 61 +
.../distributions/ten-minutes-tutorial/pom.xml | 256 +++
.../src/main/skeleton/build.xml | 53 +
.../src/main/skeleton/spell.checker.gui/build.xml | 75 +
.../spell.checker.gui/spell.checker.gui.bnd | 19 +
.../src/spell/gui/SpellCheckerGui.java | 133 ++
.../src/main/skeleton/spell.checker/build.xml | 75 +
.../main/skeleton/spell.checker/spell.checker.bnd | 19 +
.../src/spell/checker/SpellCheck.java | 48 +
.../src/main/skeleton/spell.english/build.xml | 75 +
.../main/skeleton/spell.english/spell.english.bnd | 19 +
.../src/spell/english/EnglishDictionary.java | 46 +
.../src/main/skeleton/spell.services/build.xml | 55 +
.../skeleton/spell.services/spell.services.bnd | 19 +
.../src/spell/services/DictionaryService.java | 30 +
.../src/spell/services/SpellChecker.java | 24 +
.../src/main/solution/build.xml | 38 +
.../src/main/solution/spell.checker.gui/build.xml | 75 +
.../spell.checker.gui/spell.checker.gui.bnd | 19 +
.../src/spell/gui/SpellCheckerGui.java | 138 ++
.../src/main/solution/spell.checker/build.xml | 75 +
.../main/solution/spell.checker/spell.checker.bnd | 19 +
.../src/spell/checker/SpellCheck.java | 78 +
.../src/main/solution/spell.english/build.xml | 75 +
.../main/solution/spell.english/spell.english.bnd | 19 +
.../src/spell/english/EnglishDictionary.java | 56 +
.../src/main/solution/spell.services/build.xml | 55 +
.../solution/spell.services/spell.services.bnd | 19 +
.../src/spell/services/DictionaryService.java | 31 +
.../src/spell/services/SpellChecker.java | 40 +
ipojo/runtime/ipojo-gogo-commands/changelog.txt | 176 +++
ipojo/runtime/ipojo-gogo-commands/obr.xml | 24 +
ipojo/runtime/ipojo-gogo-commands/pom.xml | 126 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 11 +
.../src/main/appended-resources/META-INF/NOTICE | 0
.../org/apache/felix/ipojo/arch/gogo/Arch.java | 355 +++++
ipojo/runtime/karaf-feature/changelog.txt | 398 +++++
ipojo/runtime/karaf-feature/pom.xml | 126 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 10 +
.../karaf-feature/src/main/assembly/assembly.xml | 54 +
.../karaf-feature/src/main/features/features.xml | 46 +
ipojo/runtime/pom.xml | 81 +
.../main/appended-resources/META-INF/DEPENDENCIES | 21 +
.../src/main/appended-resources/META-INF/NOTICE | 8 +
ipojo/webconsole-plugin/changelog.txt | 37 +
ipojo/webconsole-plugin/obr.xml | 29 +
ipojo/webconsole-plugin/pom.xml | 133 ++
.../main/appended-resources/META-INF/DEPENDENCIES | 17 +
.../src/main/appended-resources/META-INF/LICENSE | 33 +
.../src/main/appended-resources/META-INF/NOTICE | 4 +
.../apache/felix/ipojo/webconsole/IPOJOPlugin.java | 821 ++++++++++
.../apache/felix/ipojo/webconsole/StateUtils.java | 233 +++
.../src/main/resources/res/factories.html | 66 +
.../src/main/resources/res/factory.html | 114 ++
.../src/main/resources/res/handlers.html | 70 +
.../src/main/resources/res/instance.html | 127 ++
.../src/main/resources/res/instances.html | 66 +
.../src/main/resources/res/ui/factory.js | 87 ++
.../src/main/resources/res/ui/factory_detail.js | 161 ++
.../src/main/resources/res/ui/handler.js | 95 ++
.../src/main/resources/res/ui/instance_detail.js | 189 +++
.../src/main/resources/res/ui/ipojo.css | 33 +
.../src/main/resources/res/ui/ipojo.js | 84 +
1969 files changed, 235768 insertions(+)
diff --git a/ipojo/.gitignore b/ipojo/.gitignore
new file mode 100644
index 0000000000..68cde20656
--- /dev/null
+++ b/ipojo/.gitignore
@@ -0,0 +1,4 @@
+.project
+.settings
+.classpath
+target
\ No newline at end of file
diff --git a/ipojo/arch/changelog.txt b/ipojo/arch/changelog.txt
new file mode 100644
index 0000000000..b180064a95
--- /dev/null
+++ b/ipojo/arch/changelog.txt
@@ -0,0 +1,26 @@
+Changes from the 1.4.0 to 1.6.0
+-------------------------------
+** Improvement
+ * [FELIX-1427] - Service injection with Smart Proxies
+
+Changes from 1.2.0 to 1.4.0
+---------------------------
+** Improvement
+ * Update parent pom
+ * [FELIX-996] - Arch -factory command always prints out one component factory
+
+
+Changes from 1.0.0 to 1.2.0
+---------------------------
+** Bug
+ * [FELIX-797] - Composite Architecture contains duplicate instances
+
+Changes from 0.8.0 to 1.0.0
+---------------------------
+** Improvement
+ * [FELIX-673] - Provide OBR description to iPOJO bundles
+
+
+Version 0.8.0
+-------------
+ * Initial release
diff --git a/ipojo/arch/obr.xml b/ipojo/arch/obr.xml
new file mode 100644
index 0000000000..8832ddf9ed
--- /dev/null
+++ b/ipojo/arch/obr.xml
@@ -0,0 +1,24 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<obr>
+ <require extend="false" filter="(service=org.apache.felix.ipojo.architecture.Architecture)" multiple="true" name="service" optional="true">Import Service org.apache.felix.ipojo.architecture.Architecture</require>
+ <require extend="false" filter="(service=org.apache.felix.ipojo.Factory)" multiple="false" name="service" optional="true">Import Service org.apache.felix.ipojo.Factory</require>
+ <require extend="false" filter="(service=org.apache.felix.ipojo.HandlerFactory)" multiple="false" name="service" optional="true">Import Service org.apache.felix.ipojo.HandlerFactory</require>
+ <require extend="false" filter="(&(name=requires)(namespace=org.apache.felix.ipojo))" multiple="false" optional="false" name="ipojo.handler">Requires Handler</require>
+</obr>
\ No newline at end of file
diff --git a/ipojo/arch/pom.xml b/ipojo/arch/pom.xml
new file mode 100644
index 0000000000..49eef09828
--- /dev/null
+++ b/ipojo/arch/pom.xml
@@ -0,0 +1,118 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix-parent</artifactId>
+ <version>2.1</version>
+ <relativePath>../../pom/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>bundle</packaging>
+ <name>Apache Felix iPOJO Arch Command</name>
+ <artifactId>org.apache.felix.ipojo.arch</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+
+ <description>Arch command to collect and print information about iPOJO instances.</description>
+ <url>
+ http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html
+ </url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.shell</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>Apache Felix iPOJO Arch Command</Bundle-Name>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+ <Bundle-Description>iPOJO Arch command for Felix
+ </Bundle-Description>
+ <Bundle-DocURL>
+ http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html
+ </Bundle-DocURL>
+ <Private-Package>org.apache.felix.ipojo.arch</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.8.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ <configuration>
+ <ignoreAnnotations>true</ignoreAnnotations>
+ <metadata>
+ <![CDATA[
+ <ipojo>
+ <component classname="org.apache.felix.ipojo.arch.ArchCommandImpl" public="false">
+ <Provides />
+ <requires field="m_archs" optional="true" proxy="false" />
+ <requires field="m_factories" optional="true" proxy="false" />
+ <requires field="m_handlers" optional="true" proxy="false" />
+ </component>
+ <instance component="org.apache.felix.ipojo.arch.ArchCommandImpl" name="ArchCommand" />
+ </ipojo>
+ ]]>
+ </metadata>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <enableRulesSummary>false</enableRulesSummary>
+ <violationSeverity>warning</violationSeverity>
+ <configLocation>http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml</configLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <target>1.5</target>
+ <source>1.5</source>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES
new file mode 100644
index 0000000000..1c61161053
--- /dev/null
+++ b/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES
@@ -0,0 +1,11 @@
+I. Included Third-Party Software
+
+II. Used Third-Party Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2009).
+Licensed under the Apache License 2.0.
+
+III. Overall License Summary
+- Apache License 2.0
diff --git a/ipojo/arch/src/main/appended-resources/META-INF/NOTICE b/ipojo/arch/src/main/appended-resources/META-INF/NOTICE
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
new file mode 100644
index 0000000000..4010b7d1bc
--- /dev/null
+++ b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.arch;
+
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.util.List;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.HandlerFactory;
+import org.apache.felix.ipojo.IPojoFactory;
+import org.apache.felix.ipojo.architecture.Architecture;
+import org.apache.felix.ipojo.architecture.InstanceDescription;
+import org.apache.felix.shell.Command;
+
+/**
+ * Implementation of the arch command printing the actual architecture.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ArchCommandImpl implements Command {
+
+ /** List of arch services. */
+ private Architecture[] m_archs;
+
+ /** Factory services. */
+ private Factory[] m_factories;
+
+ /** Handler Factories. */
+ private HandlerFactory[] m_handlers;
+
+ /**
+ * Get the command name.
+ * @return the command name (arch)
+ * @see org.apache.felix.shell.Command#getName()
+ */
+ public String getName() {
+ return "arch";
+ }
+
+ /**
+ * Gets help message.
+ * @return the command usage.
+ * @see org.apache.felix.shell.Command#getUsage()
+ */
+ public String getUsage() {
+ return "arch [-factories] [-instances] [-handlers] [-factory factory_name] [-instance instance_name]";
+ }
+
+ /**
+ * Gets a small description.
+ * @return get a description.
+ * @see org.apache.felix.shell.Command#getShortDescription()
+ */
+ public String getShortDescription() {
+ return "Architecture command : display the architecture";
+ }
+
+ /**
+ * Executes the arch command.
+ * @param line : command line
+ * @param out : the default output stream
+ * @param err : the error output stream
+ * @see org.apache.felix.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream)
+ */
+ public void execute(String line, PrintStream out, PrintStream err) {
+ String line2 = line.substring("arch".length()).trim();
+
+ if (line2.equalsIgnoreCase("-instances") || line2.length() == 0) {
+ printInstances(out);
+ return;
+ }
+
+ if (line2.equalsIgnoreCase("-factories")) {
+ printFactories(out);
+ return;
+ }
+
+ if (line2.startsWith("-factory")) {
+ String name = line2.substring("-factory".length()).trim();
+ printFactory(name, out, err);
+ return;
+ }
+
+ if (line2.startsWith("-instance")) {
+ String name = line2.substring("-instance".length()).trim();
+ printInstance(name, out, err);
+ return;
+ }
+
+ if (line2.startsWith("-handlers")) {
+ printHandlers(out);
+ return;
+ }
+
+ if (line2.startsWith("-stats")) {
+ printStats(out);
+ return;
+ }
+
+ err.println(getUsage());
+ }
+
+ /**
+ * Prints the statistics.
+ * @param out the out
+ */
+ private void printStats(PrintStream out) {
+ try {
+ Field field = IPojoFactory.class.getDeclaredField("INSTANCE_NAME");
+ field.setAccessible(true); // The field is not accessible.
+ List names = (List) field.get(null);
+ out.println("Number of living instances : " + names.size());
+ out.println("Created instances : " + names);
+ } catch (SecurityException e) {
+ out.println("Cannot compute stats : " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ out.println("Cannot compute stats : " + e.getMessage());
+ } catch (IllegalAccessException e) {
+ out.println("Cannot compute stats : " + e.getMessage());
+ } catch (NoSuchFieldException e) {
+ out.println("Cannot compute stats : " + e.getMessage());
+ }
+
+ }
+
+ /**
+ * Prints instance list.
+ * @param out : default print stream
+ */
+ private void printInstances(PrintStream out) {
+ for (int i = 0; i < m_archs.length; i++) {
+ InstanceDescription instance = m_archs[i].getInstanceDescription();
+ if (instance.getState() == ComponentInstance.VALID) {
+ out.println("Instance " + instance.getName() + " -> valid");
+ }
+ if (instance.getState() == ComponentInstance.INVALID) {
+ out.println("Instance " + instance.getName() + " -> invalid");
+ }
+ if (instance.getState() == ComponentInstance.STOPPED) {
+ out.println("Instance " + instance.getName() + " -> stopped");
+ }
+ }
+ }
+
+ /**
+ * Prints instance description.
+ * @param name : instance name
+ * @param out : default print stream
+ * @param err : error print stream (if the instance is not found)
+ */
+ private void printInstance(String name, PrintStream out, PrintStream err) {
+ for (int i = 0; i < m_archs.length; i++) {
+ InstanceDescription instance = m_archs[i].getInstanceDescription();
+ if (instance.getName().equalsIgnoreCase(name)) {
+ out.println(instance.getDescription());
+ return;
+ }
+ }
+ err.println("Instance " + name + " not found");
+ }
+
+ /**
+ * Prints factories.
+ * @param out : output stream
+ */
+ private void printFactories(PrintStream out) {
+ for (int i = 0; i < m_factories.length; i++) {
+ if (m_factories[i].getMissingHandlers().size() == 0) {
+ out.println("Factory " + m_factories[i].getName() + " (VALID)");
+ } else {
+ out.println("Factory " + m_factories[i].getName() + " (INVALID : " + m_factories[i].getMissingHandlers() + ")");
+ }
+ }
+ }
+
+ /**
+ * Prints factory description.
+ * @param name : factory name
+ * @param out : default print stream
+ * @param err : error print stream (if the factory is not found)
+ */
+ private void printFactory(String name, PrintStream out, PrintStream err) {
+ boolean found = false;
+ for (int i = 0; i < m_factories.length; i++) {
+ if (m_factories[i].getName().equalsIgnoreCase(name)) {
+ // Skip a line if already found
+ if (found) {
+ out.println();
+ }
+ out.println(m_factories[i].getDescription());
+ found = true;
+ }
+ }
+ if (! found) {
+ err.println("Factory " + name + " not found");
+ }
+ }
+
+ /**
+ * Prints the list of available handlers (and validity).
+ * @param out : default print stream
+ */
+ private void printHandlers(PrintStream out) {
+ for (int i = 0; i < m_handlers.length; i++) {
+ String name = m_handlers[i].getHandlerName();
+ if ("composite".equals(m_handlers[i].getType())) {
+ name = name + " [composite]";
+ }
+ if (m_handlers[i].getMissingHandlers().size() == 0) {
+ out.println("Handler " + name + " (VALID)");
+ } else {
+ out.println("Handler " + name + " (INVALID : " + m_handlers[i].getMissingHandlers() + ")");
+ }
+ }
+ }
+}
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml b/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml
new file mode 100755
index 0000000000..cf0967d31e
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml
@@ -0,0 +1,65 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+
+ <name>iPOJO Foo Service</name>
+
+ <artifactId>org.apache.felix.ipojo.log.foo</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.felix.ipojo.foo
+ </Export-Package>
+ <Private-Package>
+ org.apache.felix.ipojo.foo.impl
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java
new file mode 100755
index 0000000000..1bd0b9ff17
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.foo;
+
+/**
+ * A service interface doing mostly nothing.
+ */
+public interface FooService {
+
+ public void foo();
+
+}
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java
new file mode 100755
index 0000000000..2817fe4d45
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.foo.impl;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+import org.apache.felix.ipojo.annotations.Provides;
+import org.apache.felix.ipojo.foo.FooService;
+
+
+@Component
+@Provides
+@Instantiate(name = "ipojo.foo.provider")
+/**
+ * A very simple implementation of the FooService.
+ */
+public class FooServiceImpl implements FooService {
+
+ public void foo() {
+ System.out.println("Foo");
+ }
+
+
+}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml
new file mode 100755
index 0000000000..bbe35d94f6
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml
@@ -0,0 +1,57 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+ <name>iPOJO Log Handler Consumer</name>
+ <artifactId>org.apache.felix.ipojo.log.consumer</artifactId>
+ <description>A bundle using the log handler</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.log.foo</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.log.handler</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ org.apache.felix.ipojo.log.handler.example
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java
new file mode 100755
index 0000000000..e6c1e3e50a
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java
@@ -0,0 +1,26 @@
+package org.apache.felix.ipojo.log.handler.example;
+
+
+import org.apache.felix.ipojo.annotations.*;
+import org.apache.felix.ipojo.foo.FooService;
+import org.apache.felix.ipojo.log.handler.Log;
+
+@Component(immediate = true)
+@Log(level = Log.Level.INFO) // We configure the handler.
+@Instantiate(name = "my.simple.consumer")
+public class SimpleComponent {
+
+ @Requires
+ FooService fs;
+
+ @Validate
+ public void starting() {
+ System.out.println("Starting...");
+ fs.foo();
+ }
+
+ @Invalidate
+ public void stopping() {
+ System.out.println("Stopping...");
+ }
+}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml
new file mode 100644
index 0000000000..c1a58f79cb
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>loghandler-tutorial-felix</artifactId>
+ <name>Log-Handler-In-Felix</name>
+
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <!-- our project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.log.foo</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.log.handler</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.log.consumer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+
+ <execution>
+ <id>unpack-felix</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>org.apache.felix.main.distribution</includeArtifactIds>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>copy-bundles</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>
+ org.apache.felix.ipojo.log.foo,
+ org.apache.felix.ipojo.log.handler,
+ org.apache.felix.ipojo.log.consumer,
+ org.apache.felix.log,org.apache.felix.ipojo,
+ org.apache.felix.ipojo.arch.gogo
+ </includeArtifactIds>
+ <outputDirectory>${project.build.directory}/felix-framework-${felix.version}/bundle
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml
new file mode 100755
index 0000000000..fbf2e214f6
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml
@@ -0,0 +1,76 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+ <name>iPOJO Log Handler</name>
+ <artifactId>org.apache.felix.ipojo.log.handler</artifactId>
+ <description>A handler logging messages in an OSGi Log Service</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ org.apache.felix.ipojo.log.handler
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java
new file mode 100644
index 0000000000..f9aa1db613
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.log.handler;
+
+/**
+ * The annotation used to configure the LogHandler.
+ */
+public @interface Log {
+
+ public enum Level {
+ INFO, ERROR, WARNING
+ }
+
+ /**
+ * @return the log level
+ */
+ Level level();
+}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java
new file mode 100755
index 0000000000..9b5609bde7
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.log.handler;
+
+
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.InstanceManager;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.annotations.Handler;
+import org.apache.felix.ipojo.annotations.Requires;
+import org.apache.felix.ipojo.metadata.Element;
+import org.osgi.service.log.LogService;
+
+import java.util.Dictionary;
+
+// Declare a handler.
+@Handler(name = "Log", namespace = LogHandler.NAMESPACE)
+public class LogHandler extends PrimitiveHandler {
+
+ public static final String NAMESPACE = "org.apache.felix.ipojo.log.handler";
+
+ // Handlers are iPOJO components, so can use service dependencies
+ @Requires(optional = true, nullable = false)
+ LogService log;
+ private InstanceManager instanceManager;
+ private int logLevel;
+
+ /**
+ * Parses the component's metadata to retrieve the log level in which we log messages.
+ *
+ * @param metadata component's metadata
+ * @param configuration instance configuration (unused in this example)
+ * @throws ConfigurationException the configuration is inconsistent
+ */
+ @Override
+ public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
+ // First parse the metadata to check if the log handler logLevel
+
+ // Get all Namespace:log element from the metadata
+ Element[] log_elements = metadata.getElements("log", NAMESPACE);
+
+ // If an element match, parse the logLevel attribute of the first found element
+ if (log_elements[0].containsAttribute("level")) {
+ String l = log_elements[0].getAttribute("level");
+ if (l.equalsIgnoreCase("info")) {
+ logLevel = LogService.LOG_INFO;
+ } else if (l.equalsIgnoreCase("error")) {
+ logLevel = LogService.LOG_ERROR;
+ } else if (l.equalsIgnoreCase("warning")) {
+ logLevel = LogService.LOG_WARNING;
+ }
+ }
+
+ instanceManager = getInstanceManager();
+ }
+
+ /**
+ * The instance is starting.
+ */
+ public void start() {
+ if (log != null) {
+ log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is starting");
+ }
+ }
+
+ /**
+ * The instance is stopping.
+ */
+ public void stop() {
+ if (log != null) {
+ log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is stopping");
+ }
+ }
+
+ /**
+ * Logging messages when the instance state is changing
+ *
+ * @param state the new state
+ */
+ public void stateChanged(int state) {
+ if (log != null) {
+ if (state == InstanceManager.VALID) {
+ System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes valid");
+ log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes valid");
+ }
+ if (state == InstanceManager.INVALID) {
+ System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes invalid");
+ log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes invalid");
+ }
+ }
+ }
+}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml
new file mode 100755
index 0000000000..e9094f8d01
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml
@@ -0,0 +1,68 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+ <name>iPOJO Property Handler Consumer</name>
+ <artifactId>org.apache.felix.ipojo.properties.consumer</artifactId>
+ <description>A bundle using the properties handler</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.properties.handler</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ org.apache.felix.ipojo.handler.props.example
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml
new file mode 100755
index 0000000000..29f7aa15e4
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml
@@ -0,0 +1,9 @@
+<ipojo>
+ <!-- Declare an instance illustrating instance configuration -->
+ <instance component="PropertiesTester"
+ name="instance-using-properties-i1">
+ <property name="props.file"
+ value="props\properties-i1.properties" />
+ </instance>
+
+</ipojo>
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
new file mode 100755
index 0000000000..e75aa2df43
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.properties.example;
+
+import org.apache.felix.ipojo.annotations.Component;
+import org.apache.felix.ipojo.annotations.Instantiate;
+import org.apache.felix.ipojo.annotations.Invalidate;
+import org.apache.felix.ipojo.annotations.Validate;
+import org.apache.felix.ipojo.handler.properties.Properties;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+@Component(immediate = true, name = "PropertiesTester")
+@Properties(file = "props/my-properties.properties")
+@Instantiate
+public class PropertiesTester {
+
+ // These two fields will be injected.
+ private String property1;
+ private String property2;
+
+ /**
+ * Starting method.
+ * This method will be called when the instance starts.
+ */
+ @Validate
+ public void start() {
+ System.out.println("PropertiesTester is starting ...");
+ // Read the injected properties.
+ System.out.println("Property 1 : " + property1);
+ System.out.println("Property 2 : " + property2);
+
+ // Update the properties.
+ updateProperties();
+ }
+
+ /**
+ * Stopping method.
+ * This method will be called when the instance stops.
+ */
+ @Invalidate
+ public void stop() {
+ System.out.println("PropertiesTester is stopping ...");
+ System.out.println("Property 1 : " + property1);
+ System.out.println("Property 2 : " + property2);
+ }
+
+ /**
+ * This method just updates managed properties.
+ * It appends the current date to the actual property value.
+ */
+ private void updateProperties() {
+ System.out.println("Update properties");
+ Date date = new Date();
+ DateFormat df = DateFormat.getDateTimeInstance();
+ // The properties will be updated in the property file
+ property1 = property1 + " - " + df.format(date);
+ property2 = property2 + " - " + df.format(date);
+ }
+
+}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml
new file mode 100644
index 0000000000..a646b6bb58
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>Property-Handler-In-Felix</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <dependencies>
+ <!-- our project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.properties.handler</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>org.apache.felix.ipojo.properties.consumer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.7</version>
+ <executions>
+
+ <execution>
+ <id>unpack-felix</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>org.apache.felix.main.distribution</includeArtifactIds>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>copy-bundles</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>
+ org.apache.felix.ipojo.properties.handler,
+ org.apache.felix.ipojo.properties.consumer,
+ org.apache.felix.ipojo,
+ org.apache.felix.ipojo.arch.gogo
+ </includeArtifactIds>
+ <outputDirectory>${project.build.directory}/felix-framework-${felix.version}/bundle
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ we also copy properties file to the distribution folder,
+ the properties are stored in src/main/resources/props
+ -->
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>
+ ${project.build.directory}/felix-framework-${felix.version}/props
+ </outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/props</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties
new file mode 100644
index 0000000000..8ebd943ecc
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+property1:"aaa"
+property2:"bbb"
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties
new file mode 100644
index 0000000000..195278e50b
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+property1:"ccc"
+property2:"ddd"
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml
new file mode 100755
index 0000000000..4261fcbb86
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml
@@ -0,0 +1,61 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <packaging>bundle</packaging>
+ <name>iPOJO Properties Handler</name>
+ <artifactId>org.apache.felix.ipojo.properties.handler</artifactId>
+ <description>A handler loading a property file</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>
+ org.apache.felix.ipojo.handler.properties
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java
new file mode 100755
index 0000000000..8a0f49b091
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.properties;
+
+/**
+ * The Properties annotation.
+ * This annotation may be used in POJO class to used the Property handler.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public @interface Properties {
+
+ /**
+ * Returns the property file used by the handler.
+ */
+ String file();
+
+}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
new file mode 100755
index 0000000000..08efa3cdb4
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.properties;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.PrimitiveHandler;
+import org.apache.felix.ipojo.annotations.Handler;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.FieldMetadata;
+import org.apache.felix.ipojo.parser.PojoMetadata;
+
+/**
+ * This handler load a properties file containing property value.
+ * The handler injects this values inside fields. When stopped the handler stores updated value inside the file. The
+ * properties file contains <pre>field-name : field-value</pre> (field-value are strings)
+ *
+ * Instances can override file locations by setting the {@literal properties.file} property.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Handler(name="properties", namespace = PropertiesHandler.NAMESPACE)
+public class PropertiesHandler extends PrimitiveHandler {
+
+ /**
+ * The Handler namespace.
+ */
+ public static final String NAMESPACE = "org.apache.felix.ipojo.handler.properties";
+
+ /**
+ * The loaded properties.
+ */
+ private Properties m_properties = new Properties();
+
+ /**
+ * The properties file location, configured in the component's metadata.
+ */
+ private String m_file;
+
+ /**
+ * This method is the first to be invoked.
+ * This method aims to configure the handler. It receives the component type metadata and the instance
+ * configuration. The method parses given metadata and registers fields to inject.
+ *
+ * Step 3 : when the instance configuration contains the properties.file property, it overrides the properties file location.
+ *
+ * @param metadata : component type metadata
+ * @param configuration : instance description
+ * @throws ConfigurationException : the configuration of the handler has failed.
+ */
+ @SuppressWarnings("unchecked")
+ public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
+ // Parse metadata to get <properties file="$file"/>
+
+ // Get all elements to configure the handler
+ Element[] elem = metadata.getElements("properties", NAMESPACE);
+
+ switch (elem.length) {
+ case 0:
+ // No matching element in metadata, throw a configuration error.
+ // It actually happen only if you force the handler to be plugged.
+ throw new ConfigurationException("No properties found");
+ case 1:
+ // One 'properties' found, get attributes.
+ m_file = elem[0].getAttribute("file");
+ if (m_file == null) {
+ // if file is null, throw a configuration error.
+ throw new ConfigurationException("Malformed properties element : file attribute must be set");
+ }
+ break;
+ default:
+ // To simplify we handle only one properties element.
+ throw new ConfigurationException("Only one properties element is supported");
+ }
+
+ // Look if the instance overrides file location :
+ String instanceFile = (String) configuration.get("properties.file");
+ if (instanceFile != null) {
+ m_file = instanceFile;
+ }
+
+ // Load properties
+ try {
+ loadProperties();
+ } catch (IOException e) {
+ throw new ConfigurationException("Error when reading the " + m_file + " file : " + e.getMessage());
+ }
+
+ // Register fields
+ // By convention, properties file entry are field name, so look for each property to get field list.
+
+ //First get Pojo Metadata metadata :
+ PojoMetadata pojoMeta = getPojoMetadata();
+ Enumeration e = m_properties.keys();
+ while (e.hasMoreElements()) {
+ String field = (String) e.nextElement();
+ FieldMetadata fm = pojoMeta.getField(field);
+
+ if (fm == null) { // The field does not exist
+ throw new ConfigurationException("The field " + field + " is declared in the properties file but does not exist in the pojo");
+ }
+
+ // Then check that the field is a String field
+ if (!fm.getFieldType().equals(String.class.getName())) {
+ throw new ConfigurationException("The field " + field + " exists in the pojo, but is not a String");
+ }
+
+ // All checks are ok, register the interceptor.
+ getInstanceManager().register(fm, this);
+ }
+
+ // Finally register the field to listen
+ }
+
+ /**
+ * This method is called when the instance start (after the configure method). We just print stored properties.
+ * @see org.apache.felix.ipojo.Handler#start()
+ */
+ public void start() {
+ // The properties are already loaded (in the configure method), just print values.
+ m_properties.list(System.out);
+ }
+
+ /**
+ * This method is called when the instance stops. We save the properties to not lost the instance state and clear the stored properties.
+ * @see org.apache.felix.ipojo.Handler#stop()
+ */
+ public void stop() {
+ try {
+ saveProperties();
+ } catch (IOException e) {
+ error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
+ }
+ m_properties = null;
+ }
+
+ /**
+ * This method is called at each time the pojo 'get' a listened field. The method return the stored value.
+ * @param pojo : pojo object getting the field
+ * @param field : field name.
+ * @param o : previous value.
+ * @return the stored value.
+ */
+ public Object onGet(Object pojo, String field, Object o) {
+ // When the pojo requires a value for a managed field, this method is invoked.
+ // So, we have just to return the stored value.
+ return m_properties.get(field);
+ }
+
+ /**
+ * This method is called at each time the pojo 'set' a listened field. This method updates the local properties.
+ * @param pojo : pojo object setting the field
+ * @param field : field name
+ * @param newvalue : new value
+ */
+ public void onSet(Object pojo, String field, Object newvalue) {
+ // When the pojo set a value to a managed field, this method is invoked.
+ // So, we update the stored value.
+ m_properties.put(field, newvalue);
+ }
+
+ /**
+ * Step 2 : state properties when the instance becomes invalid.
+ * @param newState : the instance state
+ * @see org.apache.felix.ipojo.Handler#stateChanged(int)
+ */
+ public void stateChanged(int newState) {
+ // This method is invoked each times that the instance state changed.
+
+ // If the new state is invalid, save the properties.
+ if (newState == ComponentInstance.INVALID) {
+ // Reload properties
+ try {
+ saveProperties();
+ } catch (IOException e) {
+ error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
+ }
+ }
+ }
+
+ /**
+ * Step 5 : dynamic reconfiguration. This method is call when the instance is reconfigured externally. The given property contains property value.
+ * @param dict : new properties
+ * @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary)
+ */
+ @SuppressWarnings("unchecked")
+ public synchronized void reconfigure(Dictionary dict) {
+ // For each property, look if a new value is contained in the new configuration.
+ Enumeration e = m_properties.keys();
+ while (e.hasMoreElements()) {
+ String field = (String) e.nextElement();
+ String value = (String) dict.get(field);
+ // If the dictionary contains a value, update the stored value.
+ if (value != null) {
+ m_properties.put(field, value);
+ }
+ }
+ }
+
+ /**
+ * Returns handler description.
+ * @return the handler description.
+ * @see org.apache.felix.ipojo.Handler#getDescription()
+ */
+ public HandlerDescription getDescription() {
+ return new Description(this);
+ }
+
+ /**
+ * Helper method just loading the properties.
+ * @throws IOException : the file cannot be read.
+ */
+ private void loadProperties() throws IOException {
+ // Load the properties file from file system
+ File file = new File(m_file);
+ InputStream is = new FileInputStream(file);
+ m_properties.load(is);
+ }
+
+ /**
+ * Helper method writing properties.
+ * @throws IOException : the file cannot be written.
+ */
+ private void saveProperties() throws IOException {
+ // Store the file, modified the last modification date.
+ File file = new File(m_file);
+ OutputStream os = new FileOutputStream(file);
+ m_properties.store(os, "");
+ }
+
+ /**
+ * Step 3 : The handler will participate to the instance architecture.
+ * This class describing the handler.
+ */
+ private class Description extends HandlerDescription {
+
+ /**
+ * Instantiates a new description.
+ * @param h the h
+ */
+ public Description(PrimitiveHandler h) {
+ super(h);
+ }
+
+ /**
+ * This method must return the Element describing the handler. The description of this handler contains the list of properties with attached
+ * value.
+ * @return the description of the handler.
+ * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
+ */
+ @SuppressWarnings("unchecked")
+ public Element getHandlerInfo() {
+ Element elem = super.getHandlerInfo(); // This method must be called to get the root description element.
+ Enumeration e = m_properties.keys();
+ while (e.hasMoreElements()) {
+ String field = (String) e.nextElement();
+ Element prop = new Element("property", ""); // Create an element for the actual property.
+ // Add two attribute (the field and the value).
+ prop.addAttribute(new Attribute("field", field));
+ prop.addAttribute(new Attribute("value", (String) m_properties.get(field)));
+ elem.addElement(prop); // Attach the current element to the root element.
+ }
+ return elem;
+ }
+
+ }
+}
diff --git a/ipojo/distributions/handler-tutorial/pom.xml b/ipojo/distributions/handler-tutorial/pom.xml
new file mode 100644
index 0000000000..6454332f8e
--- /dev/null
+++ b/ipojo/distributions/handler-tutorial/pom.xml
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.felix</groupId>
+ <artifactId>ipojo-handler-tutorial</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <description>
+ Build the handlers form the tutorial and distributions to test them
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.gogo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ </dependency>
+ </dependencies>
+
+ <modules>
+ <!-- Log Handler tutorial -->
+ <module>FooService-And-Impl</module>
+ <module>Log-Handler</module>
+ <module>Log-Handler-Consumer</module>
+ <module>Log-Handler-In-Felix</module>
+
+ <!-- Property handler tutorial -->
+ <module>Property-Handler</module>
+ <module>Property-Handler-Consumer</module>
+ <module>Property-Handler-In-Felix</module>
+ </modules>
+
+ <properties>
+ <felix.version>4.2.1</felix.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.gogo</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <version>4.2.1</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.8.6</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <ref>project</ref>
+ </descriptorRefs>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml b/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml
new file mode 100644
index 0000000000..7b84c5b0e0
--- /dev/null
+++ b/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.distributions</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>ipojo-webconsole-quicktart</artifactId>
+
+ <packaging>pom</packaging>
+
+ <description>
+ Build a distribution of Felix including iPOJO, and a working web console
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.gogo</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.gogo.runtime</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.webconsole</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.webconsole</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.webconsole.plugins.packageadmin</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.webconsole.plugins.memoryusage</artifactId>
+ <version>1.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.jetty</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>com.springsource.javax.servlet</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.4</version>
+ </dependency>
+ </dependencies>
+
+ <!-- Add OW2 repository -->
+ <repositories>
+ <repository>
+ <id>ow2.releases</id>
+ <url>http://repository.ow2.org/nexus/content/groups/public/</url>
+ </repository>
+
+ <repository>
+ <id>com.springsource.repository.libraries.external</id>
+ <name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
+ <url>http://repository.springsource.com/maven/bundles/external</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/distribution.xml</descriptor>
+ </descriptors>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml b/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml
new file mode 100644
index 0000000000..20e8bf1a83
--- /dev/null
+++ b/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml
@@ -0,0 +1,59 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+
+ <id>distribution</id>
+
+ <formats>
+ <format>zip</format>
+ <format>tar.gz</format>
+ </formats>
+
+ <dependencySets>
+ <!-- unpack Felix distribution -->
+ <dependencySet>
+ <includes>
+ <include>*:org.apache.felix.main.distribution:*</include>
+ </includes>
+ <unpack>true</unpack>
+ <outputDirectory>.</outputDirectory>
+ <unpackOptions>
+ <excludes>
+ <exclude>**/doc/**</exclude>
+ </excludes>
+ </unpackOptions>
+ </dependencySet>
+
+ <dependencySet>
+ <includes>
+ <include>*:org.apache.felix.*:jar</include>
+ <include>javax.servlet:com.springsource.javax.servlet:*</include>
+ <include>org.osgi:org.osgi.compendium:*</include>
+ <include>org.json:org.ow2.chameleon.commons.json:*</include>
+ <include>commons-io:commons-io:*</include>
+ <include>commons-fileupload:*:*</include>
+ </includes>
+ <unpack>false</unpack>
+ <outputDirectory>./felix-framework-${felix.version}/bundle</outputDirectory>
+ </dependencySet>
+ </dependencySets>
+
+</assembly>
\ No newline at end of file
diff --git a/ipojo/distributions/pom.xml b/ipojo/distributions/pom.xml
new file mode 100644
index 0000000000..d331399346
--- /dev/null
+++ b/ipojo/distributions/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.distributions</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+
+ <packaging>pom</packaging>
+
+ <description>
+ This project build distributions for the web site, it does not intend to be released, just built.
+ </description>
+
+ <modules>
+ <module>ipojo-webconsole-quicktart</module>
+ <module>handler-tutorial</module>
+ </modules>
+
+ <properties>
+ <felix.version>4.2.1</felix.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.gogo</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.main.distribution</artifactId>
+ <version>4.2.1</version>
+ <type>zip</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.annotations</artifactId>
+ <version>1.10.1</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.10.0</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/changelog.txt b/ipojo/handler/eventadmin/changelog.txt
new file mode 100644
index 0000000000..dec38256c1
--- /dev/null
+++ b/ipojo/handler/eventadmin/changelog.txt
@@ -0,0 +1,32 @@
+Changes from the 1.6.0 to 1.8.0
+-------------------------------
+** Bug
+ * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler
+
+** Improvement
+ * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions
+ * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision
+ * [FELIX-2711] - The event admin handler should provides a Handler Description
+
+Changes from the 1.4.0 to 1.6.0
+-------------------------------
+** Bug
+ * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key
+
+Changes from 1.2.0 to 1.4.0
+---------------------------
+** Improvement
+ * Update parent pom
+
+ Changes from 1.0.0 to 1.2.0
+---------------------------
+** Bug
+ * [FELIX-794] - Event Admin handler reject correctly formed topics
+
+** Improvement
+ * [FELIX-795] - Improve metadata and manipulator performance
+ * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
+
+Version 1.0.0
+-------------
+ * Initial release
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
new file mode 100644
index 0000000000..20f637ebad
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
@@ -0,0 +1,378 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix-parent</artifactId>
+ <version>2.1</version>
+ <relativePath>../../../../pom/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <name>Apache Felix iPOJO Event Admin Handler - Integration Test</name>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+
+ <properties>
+ <exam.version>3.0.0</exam.version>
+ <url.version>1.5.1</url.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin</artifactId>
+ <version>${project.version}</version>
+ <!--
+ The event admin handler depends on an older version of the compendium and core, to avoid issue during
+ tests, we must exclude those artifacts and trust the framework to provide the right / compatible
+ version
+ -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.10.2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ <version>0.6.2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ <version>0.3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-wrap</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <!-- check src only (except remote resources additions) -->
+ <includes>
+ <include>src/**</include>
+ </includes>
+ <excludes>
+ <exclude>src/main/appended-resources/**</exclude>
+ <exclude>**/*.iml</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>test</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>regular</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/regular</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>test-all</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>equinox-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>equinox</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/equinox-native</cloneProjectsTo>
+
+ </configuration>
+ </execution>
+ <execution>
+ <id>felix-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/felix-native</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>knopflerfish</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>knopflerfish</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>knopflerfish</pax.exam.framework>
+ </properties>
+ <repositories>
+ <repository>
+ <id>knopflerfish-releases</id>
+ <url>http://www.knopflerfish.org/maven2</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.knopflerfish</groupId>
+ <artifactId>framework</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>equinox</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>equinox</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>equinox</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.8.1.v20120830-144521</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>felix</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>felix</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>felix</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ </profiles>
+</project>
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
new file mode 100644
index 0000000000..c5ef57b80a
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+
+ <artifactId>ipojo-event-admin-integration-test</artifactId>
+ <name>${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
new file mode 100644
index 0000000000..d6ea1efff0
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of an event vendor that directly uses the Event Admin service
+ * to post (asynchronously) raw events.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AsyncEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The Event Admin service reference.
+ */
+ private EventAdmin m_ea;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public AsyncEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ rawEvent.put("food", donut);
+ m_ea.postEvent(new Event("food/donuts", rawEvent));
+ return donut;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
new file mode 100644
index 0000000000..5c0e4f3f84
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+/**
+ * Donut representation.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Donut {
+
+ /**
+ * All possible donut flavours.
+ */
+ public static final String[] FLAVOURS = { "unflavoured", "icing sugar",
+ "chocolate", "toffee", "strawberry", "apple" };
+
+ /**
+ * The vendor's unique donut identifier.
+ */
+ private final long m_id;
+
+ /**
+ * The name of this donut's vendor.
+ */
+ private final String m_vendorName;
+
+ /**
+ * The m_flavour of this donut.
+ */
+ private final String m_flavour;
+
+ /**
+ * Create a new donut.
+ *
+ * @param id
+ * the vendor's unique donut identifier
+ * @param vendorName
+ * the name of this donut's vendor
+ * @param flavour
+ * the m_flavour of this donut
+ */
+ public Donut(long id, String vendorName, String flavour) {
+ this.m_id = id;
+ this.m_vendorName = vendorName;
+ this.m_flavour = flavour;
+ }
+
+ /**
+ * Get the vendor's unique identifier of this donut.
+ *
+ * @return the id
+ */
+ public long getId() {
+ return m_id;
+ }
+
+ /**
+ * Get the vendor name of this donut.
+ *
+ * @return the name
+ */
+ public String getVendorName() {
+ return m_vendorName;
+ }
+
+ /**
+ * Get the flavour of this donut.
+ *
+ * @return the flavour
+ */
+ public String getFlavour() {
+ return m_flavour;
+ }
+
+ /**
+ * Return the string representation of this donut.
+ *
+ * @return this donut as a String
+ */
+ public String toString() {
+ return m_id + " " + m_flavour + " (" + m_vendorName + ")";
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
new file mode 100644
index 0000000000..c13d87bea5
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+/**
+ * Specification of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface DonutConsumer {
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut
+ * the received donut
+ */
+ void receiveDonut(Donut donut);
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event
+ * the received event
+ */
+ void receiveEvent(Event event);
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ void clearDonuts();
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ Donut getDonut();
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ Donut[] getAllDonuts();
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ Donut waitForDonut();
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ int getNumberOfDonuts();
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
new file mode 100644
index 0000000000..956b6db1cc
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see Homer Simpson
+ */
+public class DonutConsumerImpl implements DonutConsumer {
+
+
+ /**
+ * The time that is normally necessary to cause a blacklist from the event
+ * admin service.
+ */
+ public static final long BLACK_LIST_TIME = 5000L;
+ /**
+ * The name of the donut consumer.
+ */
+ private String m_name;
+ /**
+ * The list of eaten donuts.
+ */
+ private List m_donuts = new ArrayList();
+ /**
+ * Is this consumer a slow eater ?
+ */
+ private boolean m_isSlow;
+
+ /**
+ * Utility method that causes the current thread to sleep.
+ *
+ * @param millis the number of milliseconds to wait
+ */
+ public static void sleep(long millis) {
+ long past = System.currentTimeMillis();
+ long future = past + millis;
+ long now = past;
+ while (now < future) {
+ try {
+ Thread.sleep(future - now);
+ } catch (Exception e) {
+ }
+ now = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Process incoming donuts. This method is called by the receiveDonut
+ * callback.
+ *
+ * @param donut the received donut
+ */
+ private void doReceiveDonut(Donut donut) {
+ synchronized (m_donuts) {
+ m_donuts.add(donut);
+ m_donuts.notify();
+ }
+ }
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut the received donut
+ */
+ public void receiveDonut(Donut donut) {
+ final Donut myDonut = donut;
+ if (m_isSlow) {
+ new Thread(new Runnable() {
+ public void run() {
+ sleep(BLACK_LIST_TIME);
+ doReceiveDonut(myDonut);
+ }
+ }, m_name + " eating " + donut).start();
+ } else {
+ doReceiveDonut(donut);
+ }
+ }
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event the received event
+ */
+ public void receiveEvent(Event event) {
+ Object thing = event.getProperty("food");
+ if (Donut.class.isInstance(thing)) {
+ receiveDonut((Donut) thing);
+ } else {
+ // Nothing.
+ }
+ }
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ public void clearDonuts() {
+ synchronized (m_donuts) {
+ m_donuts.clear();
+ }
+ }
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ public Donut getDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ if (!m_donuts.isEmpty()) {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ public Donut[] getAllDonuts() {
+ Donut[] donuts = new Donut[0];
+ synchronized (m_donuts) {
+ donuts = (Donut[]) m_donuts.toArray(donuts);
+ m_donuts.clear();
+ }
+ return donuts;
+ }
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ public Donut waitForDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ while (donut == null) {
+ if (m_donuts.isEmpty()) {
+ try {
+ m_donuts.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ public int getNumberOfDonuts() {
+ int length;
+ synchronized (m_donuts) {
+ length = m_donuts.size();
+ }
+ return length;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
new file mode 100644
index 0000000000..612b72adfa
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.apache.felix.ipojo.handlers.event.publisher.Publisher;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of a donut vendor that send raw events instead of sending
+ * Donut objects.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class DonutEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The event publisher of the donut vendor.
+ */
+ private Publisher m_publisher;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public DonutEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ String flavour = Donut.FLAVOURS[m_random.nextInt(Donut.FLAVOURS.length)];
+ Donut donut = new Donut(m_serial++, m_name, flavour);
+ rawEvent.put("food", donut);
+ rawEvent.put("flavour", flavour);
+ m_publisher.send(rawEvent);
+ return donut;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
new file mode 100644
index 0000000000..a098ee7004
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+/**
+ * Specification of a donut vendor.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ *
+ */
+public interface DonutProvider {
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ Donut sellDonut();
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
new file mode 100644
index 0000000000..2f708bac04
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.apache.felix.ipojo.handlers.event.publisher.Publisher;
+
+import java.util.Random;
+
+/**
+ * The standard implementation of a donut vendor.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ *
+ */
+public class DonutProviderImpl implements DonutProvider {
+
+
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+
+ /**
+ * The donut publisher of the vendor.
+ */
+ private Publisher m_publisher;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public DonutProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ m_publisher.sendData(donut);
+ System.err.println("[" + this.getClass().getSimpleName() + ":"
+ + m_name + "] Selling donut " + donut);
+ return donut;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
new file mode 100644
index 0000000000..4b6ba7f281
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see Homer Simpson
+ */
+public class EventConsumerImpl implements DonutConsumer, EventHandler {
+
+ /**
+ * The name of the donut consumer.
+ */
+ private String m_name;
+ /**
+ * The list of eaten donuts.
+ */
+ private List m_donuts = new ArrayList();
+ /**
+ * Is this consumer a slow eater ?
+ */
+ private boolean m_isSlow;
+
+ /**
+ * Utility method that causes the current thread to sleep.
+ *
+ * @param millis the number of milliseconds to wait
+ */
+ public static void sleep(long millis) {
+ long past = System.currentTimeMillis();
+ long future = past + millis;
+ long now = past;
+ while (now < future) {
+ try {
+ Thread.sleep(future - now);
+ } catch (Exception e) {
+ }
+ now = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Process incoming donuts. This method is called by the receiveDonut
+ * callback.
+ *
+ * @param donut the received donut
+ */
+ private void doReceiveDonut(Donut donut) {
+ synchronized (m_donuts) {
+ m_donuts.add(donut);
+ m_donuts.notify();
+ }
+ }
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut the received donut
+ */
+ public void receiveDonut(Donut donut) {
+ final Donut myDonut = donut;
+ if (m_isSlow) {
+ new Thread(new Runnable() {
+ public void run() {
+ sleep(DonutConsumerImpl.BLACK_LIST_TIME);
+ doReceiveDonut(myDonut);
+ }
+ }, m_name + " eating " + donut).start();
+ } else {
+ doReceiveDonut(donut);
+ }
+ }
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event the received event
+ */
+ public void receiveEvent(Event event) {
+ Object thing = event.getProperty("food");
+ if (Donut.class.isInstance(thing)) {
+ receiveDonut((Donut) thing);
+ } else {
+ // Nothing to do.
+ }
+ }
+
+ /**
+ * Event receiver callback. This method is called by the event admin service
+ * when a event is received.
+ *
+ * @param event the received event
+ */
+ public void handleEvent(Event event) {
+ receiveEvent(event);
+ }
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ public void clearDonuts() {
+ synchronized (m_donuts) {
+ m_donuts.clear();
+ }
+ }
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ public Donut getDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ if (!m_donuts.isEmpty()) {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ public Donut[] getAllDonuts() {
+ Donut[] donuts = new Donut[0];
+ synchronized (m_donuts) {
+ donuts = (Donut[]) m_donuts.toArray(donuts);
+ m_donuts.clear();
+ }
+ return donuts;
+ }
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ public Donut waitForDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ while (donut == null) {
+ if (m_donuts.isEmpty()) {
+ try {
+ m_donuts.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ public int getNumberOfDonuts() {
+ int length;
+ synchronized (m_donuts) {
+ length = m_donuts.size();
+ }
+ return length;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
new file mode 100644
index 0000000000..b61b530183
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+/**
+ * Specification of an event tracker.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface EventTracker {
+
+ /**
+ * Clear the received events list. (Useful before tests)
+ */
+ void clearEvents();
+
+ /**
+ * Get the first received event and remove it from the events list.
+ *
+ * @return the first received event or null if no event is available
+ */
+ Event getEvent();
+
+ /**
+ * Get the whole list of received events.
+ *
+ * @return the array containing all received events
+ */
+ Event[] getAllEvents();
+
+ /**
+ * Get the first event if available or wait for an incoming event. The
+ * returned event is removed from the eaten event list.
+ *
+ * @return the first available event.
+ */
+ Event waitForEvent();
+
+ /**
+ * Return the size of the events list.
+ *
+ * @return the size of the events list
+ */
+ int getNumberOfEvents();
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
new file mode 100644
index 0000000000..64f08b48ed
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
@@ -0,0 +1,152 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of an event tracker.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class EventTrackerImpl implements EventTracker, EventHandler {
+
+ /**
+ * The name of the event tracker.
+ */
+ private String m_name;
+ /**
+ * The list of received events
+ */
+ private List m_events = new ArrayList();
+
+ /**
+ * Return the string representation of a given event.
+ *
+ * @return the string representation of a given event
+ */
+ public static String eventToString(Event e) {
+ StringBuilder buf = new StringBuilder();
+ buf.append("[" + e.getTopic() + "] {");
+
+ String[] properties = e.getPropertyNames();
+ int n = properties.length - 1;
+ for (int i = 0; i <= n; i++) {
+ String name = properties[i];
+ buf.append(name + "=" + e.getProperty(name));
+ if (i != n)
+ buf.append(", ");
+ }
+ buf.append("}");
+ return buf.toString();
+ }
+
+ /**
+ * Event receiver callback. This method is called by the event admin service
+ * when a event is received.
+ *
+ * @param event the received event
+ */
+ public void handleEvent(Event event) {
+ synchronized (m_events) {
+ m_events.add(event);
+ m_events.notify();
+ }
+ }
+
+ /**
+ * Clear the received events list. (Useful before tests)
+ */
+ public void clearEvents() {
+ synchronized (m_events) {
+ m_events.clear();
+ }
+ }
+
+ /**
+ * Get the first received event and remove it from the events list.
+ *
+ * @return the first received event or null if no event is available
+ */
+ public Event getEvent() {
+ Event event = null;
+ synchronized (m_events) {
+ if (!m_events.isEmpty()) {
+ event = (Event) m_events.remove(0);
+ }
+ }
+ return event;
+ }
+
+ /**
+ * Get the whole list of received events.
+ *
+ * @return the array containing all received events
+ */
+ public Event[] getAllEvents() {
+ Event[] events = new Event[0];
+ synchronized (m_events) {
+ events = (Event[]) m_events.toArray(events);
+ m_events.clear();
+ }
+ return events;
+ }
+
+ /**
+ * Get the first event if available or wait for an incoming event. The
+ * returned event is removed from the eaten event list.
+ *
+ * @return the first available event.
+ */
+ public Event waitForEvent() {
+ Event event = null;
+ synchronized (m_events) {
+ while (event == null) {
+ if (m_events.isEmpty()) {
+ try {
+ m_events.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ event = (Event) m_events.remove(0);
+ }
+ }
+ }
+ return event;
+ }
+
+ /**
+ * Return the size of the events list.
+ *
+ * @return the size of the events list
+ */
+ public int getNumberOfEvents() {
+ int length;
+ synchronized (m_events) {
+ length = m_events.size();
+ }
+ return length;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
new file mode 100644
index 0000000000..bf519aef94
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of an event vendor that directly uses the Event Admin service
+ * to send (synchronously) raw events.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SyncEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The Event Admin service reference.
+ */
+ private EventAdmin m_ea;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public SyncEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ rawEvent.put("food", donut);
+ m_ea.sendEvent(new Event("food/donuts", rawEvent));
+ return donut;
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml
new file mode 100644
index 0000000000..fb8639e850
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+
+<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"
+ xmlns="org.apache.felix.ipojo"
+ xmlns:ev="org.apache.felix.ipojo.handlers.event">
+
+ <!-- The (asynchronous) donut provider -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"
+ name="donut-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Donut publisher -->
+ <ev:publisher name="donut-publisher" field="m_publisher"
+ topics="food/donuts" data-key="food" synchronous="false"/>
+ </component>
+
+ <!-- The (asynchronous) donut provider using publishes -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"
+ name="donut-provider-publishes">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Donut publisher -->
+ <ev:publishes name="donut-publisher" field="m_publisher"
+ topics="food/donuts" dataKey="food" synchronous="false"/>
+ </component>
+
+ <!-- The synchronous donut provider -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"
+ name="synchronous-donut-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Donut publisher -->
+ <ev:publisher name="donut-publisher" field="m_publisher"
+ topics="food/donuts" data-key="food" synchronous="true"/>
+ </component>
+
+ <!-- The synchronous donut provider using dataKey -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"
+ name="synchronous-donut-provider-2">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Donut publisher -->
+ <ev:publisher name="donut-publisher" field="m_publisher"
+ topics="food/donuts" dataKey="food" synchronous="true"/>
+ </component>
+
+ <!-- The (asynchronous) donut event provider -->
+ <component
+ classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutEventProviderImpl"
+ name="donut-event-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Raw events publisher -->
+ <ev:publisher name="event-publisher" field="m_publisher"
+ topics="food/donuts" synchronous="false"/>
+ </component>
+
+ <!-- The synchronous donut event provider -->
+ <component
+ classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutEventProviderImpl"
+ name="synchronous-donut-event-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Raw events publisher -->
+ <ev:publisher name="event-publisher" field="m_publisher"
+ topics="food/donuts" synchronous="true"/>
+ </component>
+
+ <!-- The (asynchronous) event provider -->
+ <component
+ classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.AsyncEventProviderImpl"
+ name="event-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Direcly interacts with the Event Admin service -->
+ <requires field="m_ea"/>
+ </component>
+
+ <!-- The synchronous event provider -->
+ <component
+ classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.SyncEventProviderImpl"
+ name="synchronous-event-provider">
+ <!-- Expose the donut provider service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider">
+ <property name="name" field="m_name" value="Unknown donut vendor"/>
+ </provides>
+ <!-- Direcly interacts with the Event Admin service -->
+ <requires field="m_ea"/>
+ </component>
+
+ <!-- The donut consumer -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl"
+ name="donut-consumer">
+ <!-- Expose the donut consumer service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer">
+ <property name="name" field="m_name" value="Unknown donut consumer"/>
+ <property name="slow" field="m_isSlow" value="false"/>
+ </provides>
+ <!-- Donut events subscriber -->
+ <ev:subscriber name="donut-subscriber" callback="receiveDonut"
+ topics="food/donuts" data-key="food"
+ data-type="org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut"/>
+ </component>
+
+ <!-- The donut consumer using dataKey and dataType -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl"
+ name="donut-consumer-2">
+ <!-- Expose the donut consumer service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer">
+ <property name="name" field="m_name" value="Unknown donut consumer"/>
+ <property name="slow" field="m_isSlow" value="false"/>
+ </provides>
+ <!-- Donut events subscriber -->
+ <ev:subscriber name="donut-subscriber" callback="receiveDonut"
+ topics="food/donuts" dataKey="food"
+ dataType="org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut"/>
+ </component>
+
+
+ <!-- The donut event consumer -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl"
+ name="donut-event-consumer">
+ <!-- Expose the donut consumer service -->
+ <provides specifications="org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer">
+ <property name="name" field="m_name" value="Unknown donut consumer"/>
+ <property name="slow" field="m_isSlow" value="false"/>
+ </provides>
+ <!-- Raw events subscriber -->
+ <ev:subscriber name="donut-event-subscriber" callback="receiveEvent"
+ topics="food/donuts"/>
+ </component>
+
+ <!-- The event consumer -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.EventConsumerImpl"
+ name="event-consumer">
+ <!-- Expose the donut consumer service -->
+ <provides
+ specifications="{org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer,org.osgi.service.event.EventHandler}">
+ <property name="name" field="m_name" value="Unknown event consumer"/>
+ <property name="slow" field="m_isSlow" value="false"/>
+ <property name="event.topics" type="String" value="food/donuts"/>
+ </provides>
+ </component>
+
+ <!-- The event tracker -->
+ <component classname="org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTrackerImpl"
+ name="event-tracker">
+ <!-- Expose the donut consumer service -->
+ <provides
+ specifications="{org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker,org.osgi.service.event.EventHandler}">
+ <property name="name" field="m_name" value="Unknown event tracker"/>
+ <property name="event.topics" type="String" value="food/donuts"/>
+ </provides>
+ </component>
+
+
+ <!-- Example instances -->
+ <instance component="donut-provider" name="zeifhgbzre">
+ <property name="name" value="Zeifhgbzre donuts"/>
+ </instance>
+ <instance component="donut-consumer" name="zeifhgbzre simpson">
+ <property name="name" value="Zeifhgbzre simpson"/>
+ <property name="slow" value="false"/>
+ </instance>
+
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java
new file mode 100644
index 0000000000..cb93526359
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.After;
+import org.junit.Before;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.tinybundles.core.TinyBundle;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.framework.Constants;
+import org.ow2.chameleon.testing.helpers.BaseTest;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+import org.ow2.chameleon.testing.helpers.OSGiHelper;
+import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import static junit.framework.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.*;
+
+/**
+ * Bootstrap the test from this project
+ */
+public class Common extends BaseTest {
+
+ @Override
+ protected Option[] getCustomOptions() {
+ return new Option[]{
+ eventadmin()
+ };
+ }
+
+ public CompositeOption eventadmin() {
+ return new DefaultCompositeOption(
+ mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"),
+ mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin").versionAsInProject());
+ }
+
+ @Override
+ protected List<String> getExtraExports() {
+ return Arrays.asList("org.apache.felix.ipojo.handler.eventadmin.test.donut");
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java
new file mode 100644
index 0000000000..d5eb9914ae
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import org.apache.felix.ipojo.Factory;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
+import org.osgi.framework.BundleContext;
+import org.ow2.chameleon.testing.helpers.IPOJOHelper;
+
+/**
+ * Useful variables used for the tests of the Event Admin Handler.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class EahTestUtils {
+
+ /**
+ * Enable debug messages ?
+ */
+ public static final boolean TRACE = false;
+ /**
+ * The number of tests to execute.
+ */
+ public static final int NUMBER_OF_TESTS = 50;
+ /**
+ * The time that is normally necessary to cause a blacklist from the event
+ * admin service.
+ */
+ public static final long BLACK_LIST_TIME = 5000L;
+ /**
+ * The long amount of time.
+ */
+ public static final long A_LONG_TIME = 1000L;
+ /**
+ * The bundle context.
+ */
+ private BundleContext m_context;
+ /**
+ * The iPOJO Helper.
+ */
+ private IPOJOHelper m_ipojoHelper;
+
+ /**
+ * Construct a new Event Admin Handler Tests utility instance.
+ */
+ public EahTestUtils(BundleContext context, IPOJOHelper ipojoHelper) {
+ m_ipojoHelper = ipojoHelper;
+ m_context = context;
+ }
+
+ /**
+ * Utility method that causes the current thread to sleep.
+ *
+ * @param millis the number of milliseconds to wait
+ */
+ public static void sleep(long millis) {
+ long past = System.currentTimeMillis();
+ long future = past + millis;
+ long now = past;
+ if (TRACE) {
+ System.err.println("Sleeping for " + millis + "ms");
+ }
+ while (now < future) {
+ try {
+ Thread.sleep(future - now);
+ } catch (Exception e) {
+ }
+ now = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Return the index of the given donut flavour in the flavour array.
+ *
+ * @return the index of the given flavour or -1 if not found
+ */
+ public static int flavourIndex(String flavour) {
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ if (Donut.FLAVOURS[i].equals(flavour))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Return the (asynchronous) donut provider factory.
+ *
+ * @return the (asynchronous) donut provider factory
+ */
+ public Factory getDonutProviderFactory() {
+ return m_ipojoHelper.getFactory("donut-provider");
+ }
+
+ /**
+ * Return the (asynchronous) donut provider using publishes factory.
+ *
+ * @return the (asynchronous) donut provider using publishes factory
+ */
+ public Factory getDonutProviderUsingPublishesFactory() {
+ return m_ipojoHelper.getFactory("donut-provider-publishes");
+ }
+
+ /**
+ * Return the synchronous donut provider factory.
+ *
+ * @return the synchronous donut provider factory
+ */
+ public Factory getSynchronousDonutProviderFactory() {
+ return m_ipojoHelper.getFactory(
+ "synchronous-donut-provider");
+ }
+
+ /**
+ * Return the synchronous donut provider factory using
+ * dataKey
+ *
+ * @return the synchronous donut provider factory
+ */
+ public Factory getSynchronousDonutProvider2Factory() {
+ return m_ipojoHelper.getFactory(
+ "synchronous-donut-provider-2");
+ }
+
+ /**
+ * Return the (asynchronous) donut event provider factory.
+ *
+ * @return the (asynchronous) donut event provider factory
+ */
+ public Factory getDonutEventProviderFactory() {
+ return m_ipojoHelper.getFactory(
+ "donut-event-provider");
+ }
+
+ /**
+ * Return the synchronous donut event provider factory.
+ *
+ * @return the synchronous donut event provider factory
+ */
+ public Factory getSynchronousDonutEventProviderFactory() {
+ return m_ipojoHelper.getFactory(
+ "synchronous-donut-event-provider");
+ }
+
+ /**
+ * Return the event provider factory.
+ *
+ * @return the event provider factory
+ */
+ public Factory getEventProviderFactory() {
+ return m_ipojoHelper.getFactory("event-provider");
+ }
+
+ /**
+ * Return the synchronous event provider factory.
+ *
+ * @return the synchronous event provider factory
+ */
+ public Factory getSynchronousEventProviderFactory() {
+ return m_ipojoHelper.getFactory(
+ "synchronous-event-provider");
+ }
+
+ /**
+ * Return the donut consumer factory.
+ *
+ * @return the donut consumer factory
+ */
+ public Factory getDonutConsumerFactory() {
+ return m_ipojoHelper.getFactory("donut-consumer");
+ }
+
+ /**
+ * Return the donut consumer factory using dataKey
+ * and dataType.
+ *
+ * @return the donut consumer factory
+ */
+ public Factory getDonutConsumer2Factory() {
+ return m_ipojoHelper.getFactory("donut-consumer-2");
+ }
+
+ /**
+ * Return the donut event consumer factory.
+ *
+ * @return the donut event consumer factory
+ */
+ public Factory getDonutEventConsumerFactory() {
+ return m_ipojoHelper.getFactory(
+ "donut-event-consumer");
+ }
+
+ /**
+ * Return the event consumer factory.
+ *
+ * @return the event consumer factory
+ */
+ public Factory getEventConsumerFactory() {
+ return m_ipojoHelper.getFactory("event-consumer");
+ }
+
+ /**
+ * Return the event tracker.
+ *
+ * @return the event consumer factory
+ */
+ public Factory getEventTrackerFactory() {
+ return m_ipojoHelper.getFactory("event-tracker");
+ }
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java
new file mode 100644
index 0000000000..c000435a0f
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java
@@ -0,0 +1,958 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import org.apache.felix.ipojo.*;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.apache.felix.ipojo.parser.ManifestMetadataParser;
+import org.apache.felix.ipojo.parser.ParseException;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * Test the good behaviour of the EventAdminHandler.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TestBadConfigurations extends Common {
+
+ /**
+ * The namespace of the Event admin handler.
+ */
+ private static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
+ /**
+ * The utility class instance.
+ */
+ public EahTestUtils m_utils;
+ /**
+ * The available components.
+ */
+ private Element[] m_components;
+ /**
+ * The description of a component that uses an event publisher.
+ */
+ private Element m_provider;
+ /**
+ * The event publisher description.
+ */
+ private Element m_publisher;
+ /**
+ * The name attribute of the event publisher.
+ */
+ private Attribute m_publisherName;
+ /**
+ * The field attribute of the event publisher.
+ */
+ private Attribute m_publisherField;
+ /**
+ * The topics attribute of the event publisher.
+ */
+ private Attribute m_publisherTopics;
+ /**
+ * The data-key attribute of the event publisher.
+ */
+ private Attribute m_publisherDataKey;
+ /**
+ * The synchronous attribute of the event publisher.
+ */
+ private Attribute m_publisherSynchronous;
+ /**
+ * The description of a component that uses an event subscriber.
+ */
+ private Element m_consumer;
+ /**
+ * The event subscriber description.
+ */
+ private Element m_subscriber;
+ /**
+ * The name attribute of the event subscriber.
+ */
+ private Attribute m_subscriberName;
+ /**
+ * The callback attribute of the event subscriber.
+ */
+ private Attribute m_subscriberCallback;
+ /**
+ * The topics attribute of the event subscriber.
+ */
+ private Attribute m_subscriberTopics;
+ /**
+ * The data-key attribute of the event subscriber.
+ */
+ private Attribute m_subscriberDataKey;
+ /**
+ * The data-type attribute of the event subscriber.
+ */
+ private Attribute m_subscriberDataType;
+
+ private Element getManipulationForComponent(String compName) {
+ for (int i = 0; i < m_components.length; i++) {
+ if (m_components[i].containsAttribute("name")
+ && m_components[i].getAttribute("name").equals(compName)) {
+ return m_components[i].getElements("manipulation")[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Initialization before test cases.
+ * <p/>
+ * Create all the instances
+ */
+ @Before
+ public void setUp() {
+ m_utils = new EahTestUtils(bc, ipojoHelper);
+ /**
+ * Get the list of available components.
+ */
+ try {
+ String header = (String) getTestBundle().getHeaders().get(
+ "iPOJO-Components");
+ m_components = ManifestMetadataParser.parseHeaderMetadata(header)
+ .getElements("component");
+ } catch (ParseException e) {
+ fail("Parse Exception when parsing iPOJO-Component");
+ }
+
+ /**
+ * Initialize the standard publishing component (based on the
+ * asynchronous donut provider).
+ */
+ m_provider = new Element("component", "");
+ m_provider.addAttribute(new Attribute("className",
+ "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"));
+ m_provider.addAttribute(new Attribute("name",
+ "standard donut provider for bad tests"));
+
+ // The provided service of the publisher
+ Element providesDonutProvider = new Element("provides", "");
+ providesDonutProvider.addAttribute(new Attribute("interface",
+ "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider"));
+ Element providesDonutProviderProperty = new Element("property", "");
+ providesDonutProviderProperty
+ .addAttribute(new Attribute("name", "name"));
+ providesDonutProviderProperty.addAttribute(new Attribute("field",
+ "m_name"));
+ providesDonutProviderProperty.addAttribute(new Attribute("value",
+ "Unknown donut vendor"));
+ providesDonutProvider.addElement(providesDonutProviderProperty);
+ m_provider.addElement(providesDonutProvider);
+
+ // The event publisher, corresponding to the following description :
+ // <ev:publisher name="donut-publisher" field="m_publisher"
+ // topics="food/donuts" data-key="food" synchronous="false"/>
+ m_publisher = new Element("publisher", NAMESPACE);
+ m_publisherName = new Attribute("name", "donut-publisher");
+ m_publisherField = new Attribute("field", "m_publisher");
+ m_publisherTopics = new Attribute("topics", "food/donuts");
+ m_publisherDataKey = new Attribute("data-key", "food");
+ m_publisherSynchronous = new Attribute("synchronous", "false");
+ m_publisher.addAttribute(m_publisherName);
+ m_publisher.addAttribute(m_publisherField);
+ m_publisher.addAttribute(m_publisherTopics);
+ m_publisher.addAttribute(m_publisherDataKey);
+ m_publisher.addAttribute(m_publisherSynchronous);
+ m_provider.addElement(m_publisher);
+
+ m_provider.addElement(getManipulationForComponent("donut-provider"));
+
+ /**
+ * Initialize the standard subscribing component (based on the donut
+ * consumer).
+ */
+ m_consumer = new Element("component", "");
+ m_consumer.addAttribute(new Attribute("className",
+ "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl"));
+ m_consumer.addAttribute(new Attribute("name",
+ "standard donut consumer for bad tests"));
+
+ // The provided service of the publisher
+ Element providesDonutConsumer = new Element("provides", "");
+ providesDonutConsumer.addAttribute(new Attribute("interface",
+ "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer"));
+ Element providesDonutConsumerNameProperty = new Element("property", "");
+ providesDonutConsumerNameProperty.addAttribute(new Attribute("name",
+ "name"));
+ providesDonutConsumerNameProperty.addAttribute(new Attribute("field",
+ "m_name"));
+ providesDonutConsumerNameProperty.addAttribute(new Attribute("value",
+ "Unknown donut consumer"));
+ providesDonutConsumer.addElement(providesDonutConsumerNameProperty);
+ Element providesDonutConsumerSlowProperty = new Element("property", "");
+ providesDonutConsumerSlowProperty.addAttribute(new Attribute("name",
+ "slow"));
+ providesDonutConsumerSlowProperty.addAttribute(new Attribute("field",
+ "m_isSlow"));
+ providesDonutConsumerSlowProperty.addAttribute(new Attribute("value",
+ "false"));
+ providesDonutConsumer.addElement(providesDonutConsumerSlowProperty);
+ m_consumer.addElement(providesDonutConsumer);
+
+ // The event publisher, corresponding to the following description :
+ // <ev:subscriber name="donut-subscriber" callback="receiveDonut"
+ // topics="food/donuts" data-key="food"
+ // data-type="org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut"/>
+ m_subscriber = new Element("subscriber", NAMESPACE);
+ m_subscriberName = new Attribute("name", "donut-subscriber");
+ m_subscriberCallback = new Attribute("callback", "receiveDonut");
+ m_subscriberTopics = new Attribute("topics", "food/donuts");
+ m_subscriberDataKey = new Attribute("data-key", "food");
+ m_subscriberDataType = new Attribute("data-type",
+ "org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut");
+ m_subscriber.addAttribute(m_subscriberName);
+ m_subscriber.addAttribute(m_subscriberCallback);
+ m_subscriber.addAttribute(m_subscriberTopics);
+ m_subscriber.addAttribute(m_subscriberDataKey);
+ m_subscriber.addAttribute(m_subscriberDataType);
+ m_consumer.addElement(m_subscriber);
+
+ m_consumer.addElement(getManipulationForComponent("donut-consumer"));
+ }
+
+ /**
+ * Test the base configuration is correct to be sure the bad tests will fail
+ * because of they are really bad, and not because of an other application
+ * error.
+ * <p/>
+ * This test simply create a provider and a consumer instance, send one
+ * event and check it is received.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testGoodConfig()
+ throws ConfigurationException, UnacceptableConfiguration,
+ MissingHandlerException {
+ /**
+ * Create the provider and the consumer instances.
+ */
+ Dictionary properties = new Hashtable();
+
+ // Provider
+ ComponentFactory providerFactory = new ComponentFactory(bc,
+ m_provider);
+ providerFactory.start();
+ properties.put("instance.name", "Emperor of donuts");
+ ComponentInstance providerInstance = providerFactory
+ .createComponentInstance(properties);
+ ServiceReference providerService = ipojoHelper
+ .getServiceReferenceByName(DonutProvider.class
+ .getName(), providerInstance.getInstanceName());
+ DonutProvider provider = (DonutProvider) bc
+ .getService(providerService);
+
+ // The consumer
+ properties = new Hashtable();
+ ComponentFactory consumerFactory = new ComponentFactory(bc,
+ m_consumer);
+ consumerFactory.start();
+ properties.put("instance.name", "Homer Simpson");
+ properties.put("slow", "false");
+ ComponentInstance consumerInstance = consumerFactory
+ .createComponentInstance(properties);
+ ServiceReference consumerService = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), consumerInstance.getInstanceName());
+ DonutConsumer consumer = (DonutConsumer) bc
+ .getService(consumerService);
+
+ /**
+ * Test the normal behaviour of the instances.
+ */
+ consumer.clearDonuts();
+ Donut sentDonut = provider.sellDonut();
+ Donut receivedDonut = consumer.waitForDonut();
+ assertEquals("The received donut must be the same as the sent one.",
+ sentDonut, receivedDonut);
+
+ /**
+ * Destroy component's instances.
+ */
+ bc.ungetService(providerService);
+ providerInstance.dispose();
+ bc.ungetService(consumerService);
+ consumerInstance.dispose();
+ providerFactory.stop();
+ consumerFactory.stop();
+ }
+
+ /**
+ * Try to create a publisher with no name.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithoutName()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher
+ m_publisher.removeAttribute(m_publisherName);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when no name is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.addAttribute(m_publisherName);
+ }
+ }
+
+ /**
+ * Try to create a publisher with no field.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithoutField()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher
+ m_publisher.removeAttribute(m_publisherField);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when no field is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.addAttribute(m_publisherField);
+ }
+ }
+
+ /**
+ * Try to create a publisher with an unexisting field.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithUnexistingField()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher and replace with an
+ // unexisting field name
+ m_publisher.removeAttribute(m_publisherField);
+ Attribute unexistingField = new Attribute("field", "m_unexistingField");
+ m_publisher.addAttribute(unexistingField);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when an unexisting field is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.removeAttribute(unexistingField);
+ m_publisher.addAttribute(m_publisherField);
+ }
+ }
+
+ /**
+ * Try to create a publisher with a bad typed field.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithBadTypedField()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher and replace with an
+ // bad typed field name
+ m_publisher.removeAttribute(m_publisherField);
+ Attribute badTypedField = new Attribute("field", "m_name");
+ m_publisher.addAttribute(badTypedField);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when an bad typed field is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.removeAttribute(badTypedField);
+ m_publisher.addAttribute(m_publisherField);
+ }
+ }
+
+ /**
+ * Try to create a publisher instance without topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithoutTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the publisher
+ m_publisher.removeAttribute(m_publisherTopics);
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ fact.start();
+
+ // Try to create an instance without specified topics
+ Dictionary conf = new Hashtable();
+ conf.put("instance.name", "provider without topics");
+
+ ComponentInstance instance;
+ try {
+ instance = fact.createComponentInstance(conf);
+ // Should not be executed
+ instance.dispose();
+ fail("The factory must not create instance without specified topics.");
+ } catch (ConfigurationException e) {
+ // OK
+ } finally {
+ fact.stop();
+ // Restore the original state of the publisher
+ m_publisher.addAttribute(m_publisherTopics);
+ }
+ }
+
+ /**
+ * Try to create a publisher with malformed topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithMalformedTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the publisher and replace with a
+ // malformed one
+ m_publisher.removeAttribute(m_publisherTopics);
+ Attribute malformedTopics = new Attribute("topics",
+ "| |\\| \\/ /-\\ |_ | |)");
+ m_publisher.addAttribute(malformedTopics);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when invalid topics are specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.removeAttribute(malformedTopics);
+ m_publisher.addAttribute(m_publisherTopics);
+ }
+ }
+
+ /**
+ * Try to create a publisher with a pattern topic (ending with '*') instead of a fixed topic.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithPatternTopic()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the publisher and replace with a
+ // malformed one
+ m_publisher.removeAttribute(m_publisherTopics);
+ Attribute malformedTopics = new Attribute("topics",
+ "a/pattern/topic/*");
+ m_publisher.addAttribute(malformedTopics);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when invalid topics are specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_publisher.removeAttribute(malformedTopics);
+ m_publisher.addAttribute(m_publisherTopics);
+ }
+ }
+
+ /**
+ * Try to create a publisher with malformed instance topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testPublisherWithMalformedInstanceTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the publisher and replace with a
+ // malformed one
+ m_publisher.removeAttribute(m_publisherTopics);
+ ComponentFactory fact = new ComponentFactory(bc, m_provider);
+ fact.start();
+
+ // Try to create an instance with malformed specified topics
+ Dictionary conf = new Hashtable();
+ conf.put("instance.name", "provider with malformed topics");
+ Dictionary topics = new Hashtable();
+ topics.put("donut-publisher", "| |\\| \\/ /-\\ |_ | |)");
+ conf.put("event.topics", topics);
+
+ ComponentInstance instance;
+ try {
+ instance = fact.createComponentInstance(conf);
+ // Should not be executed
+ instance.dispose();
+ fail("The factory must not create instance with invalid specified topics.");
+ } catch (ConfigurationException e) {
+ // OK
+ } finally {
+ fact.stop();
+ // Restore the original state of the publisher
+ m_publisher.addAttribute(m_publisherTopics);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with no name.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithoutName()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher
+ m_subscriber.removeAttribute(m_subscriberName);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when no name is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_subscriber.addAttribute(m_subscriberName);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with no callback.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithoutCallback()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the name attribute of the publisher
+ m_subscriber.removeAttribute(m_subscriberCallback);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when no callback is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the publisher
+ m_subscriber.addAttribute(m_subscriberCallback);
+ }
+ }
+
+ /**
+ * Try to create a subscriber instance without topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithoutTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the subscriber
+ m_subscriber.removeAttribute(m_subscriberTopics);
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ fact.start();
+
+ // Try to create an instance without specified topics
+ Dictionary conf = new Hashtable();
+ conf.put("instance.name", "consumer without topics");
+ conf.put("slow", "false");
+
+ ComponentInstance instance;
+ try {
+ instance = fact.createComponentInstance(conf);
+ // Should not be executed
+ instance.dispose();
+ fail("The factory must not create instance without specified topics.");
+ } catch (ConfigurationException e) {
+ // OK
+ } finally {
+ fact.stop();
+ // Restore the original state of the subscriber
+ m_subscriber.addAttribute(m_subscriberTopics);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with malformed topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithMalformedTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the subscriber and replace with a
+ // malformed one
+ m_subscriber.removeAttribute(m_subscriberTopics);
+ Attribute malformedTopics = new Attribute("topics",
+ "| |\\| \\/ /-\\ |_ | |)");
+ m_subscriber.addAttribute(malformedTopics);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when invalid topics are specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the subscriber
+ m_subscriber.removeAttribute(malformedTopics);
+ m_subscriber.addAttribute(m_subscriberTopics);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with malformed instance topics.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithMalformedInstanceTopics()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the topics attribute of the subscriber and replace with a
+ // malformed one
+ m_subscriber.removeAttribute(m_subscriberTopics);
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ fact.start();
+
+ // Try to create an instance with malformed specified topics
+ Dictionary conf = new Hashtable();
+ conf.put("instance.name", "consumer with malformed topics");
+ Dictionary topics = new Hashtable();
+ topics.put("donut-subscriber", "| |\\| \\/ /-\\ |_ | |)");
+ conf.put("event.topics", topics);
+
+ ComponentInstance instance;
+ try {
+ instance = fact.createComponentInstance(conf);
+ // Should not be executed
+ instance.dispose();
+ fail("The factory must not create instance with invalid specified topics.");
+ } catch (ConfigurationException e) {
+ // OK
+ } finally {
+ fact.stop();
+ // Restore the original state of the subscriber
+ m_subscriber.addAttribute(m_subscriberTopics);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with unknown data type.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithUnknownDataType()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the data-type attribute of the subscriber and replace with a
+ // malformed one
+ m_subscriber.removeAttribute(m_subscriberDataType);
+ Attribute unknownType = new Attribute("data-type", "org.unknown.Clazz");
+ m_subscriber.addAttribute(unknownType);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when unknown data type is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the subscriber
+ m_subscriber.removeAttribute(unknownType);
+ m_subscriber.addAttribute(m_subscriberDataType);
+ }
+ }
+
+ /**
+ * Try to create a subscriber with a data type that does not match with the
+ * callback parameter type.
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ */
+ @Test
+ public void testSubscriberWithUnappropriatedDataType()
+ throws ConfigurationException, MissingHandlerException,
+ UnacceptableConfiguration {
+
+ // Remove the data-type attribute of the subscriber and replace with a
+ // malformed one
+ m_subscriber.removeAttribute(m_subscriberDataType);
+ Attribute unknownType = new Attribute("data-type", "java.lang.String");
+ m_subscriber.addAttribute(unknownType);
+
+ // Create and try to start the factory
+ ComponentFactory fact = new ComponentFactory(bc, m_consumer);
+ try {
+ fact.start();
+ // Should not be executed
+ fact.stop();
+ fail("The factory must not start when unappropriated data type is specified.");
+ } catch (IllegalStateException e) {
+ // OK
+ } finally {
+ // Restore the original state of the subscriber
+ m_subscriber.removeAttribute(unknownType);
+ m_subscriber.addAttribute(m_subscriberDataType);
+ }
+ }
+
+ // DEBUG
+ public void dumpElement(String message, Element root) {
+ System.err.println(message + "\n" + dumpElement(0, root));
+ }
+
+ // DEBUG
+ private String dumpElement(int level, Element element) {
+ StringBuilder sb = new StringBuilder();
+ // Enter tag
+ for (int i = 0; i < level; i++) {
+ sb.append(" ");
+ }
+ sb.append('<');
+ sb.append(element.getName());
+ Attribute[] attributes = element.getAttributes();
+ for (int i = 0; i < attributes.length; i++) {
+ Attribute attribute = attributes[i];
+ sb.append(' ');
+ sb.append(attribute.getName());
+ sb.append('=');
+ sb.append(attribute.getValue());
+ }
+ sb.append(">\n");
+ // Children
+ Element[] elements = element.getElements();
+ for (int i = 0; i < elements.length; i++) {
+ sb.append(dumpElement(level + 1, elements[i]));
+ }
+ // Exit tag
+ for (int i = 0; i < level; i++) {
+ sb.append(" ");
+ }
+ sb.append("</" + element.getName() + ">\n");
+ return sb.toString();
+ }
+
+ /**
+ * Creates a subscriber listening on a pattern topic (ending with '*').
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened.
+ */
+ @Test
+ public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ Dictionary properties = new Hashtable();
+ Dictionary topics = new Hashtable();
+
+ // Create the donut consumer instance, listening on a pattern topic
+ properties.put("instance.name", "subscriber with pattern topic");
+ topics.put("donut-subscriber", "a/pattern/topic/*rf");
+ properties.put("event.topics", topics);
+ ComponentInstance instance = null;
+ try {
+ instance = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Should not been executed
+ instance.dispose();
+ fail("An invalid topic scope was accepted)");
+
+ } catch (ConfigurationException e) {
+ // Nothing to do
+ }
+
+ properties = new Hashtable();
+ topics = new Hashtable();
+
+ // Create the donut consumer instance, listening on a pattern topic
+ properties.put("instance.name", "subscriber with pattern topic");
+ topics.put("donut-subscriber", "a/pattern/*topic/rf");
+ properties.put("event.topics", topics);
+
+ try {
+ instance = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+ instance.dispose();
+ fail("An invalid topic scope was accepted (2)");
+ } catch (ConfigurationException e) {
+ // Nothing to do
+ }
+ }
+
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java
new file mode 100644
index 0000000000..f9fb155b17
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java
@@ -0,0 +1,714 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.MissingHandlerException;
+import org.apache.felix.ipojo.UnacceptableConfiguration;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+
+import java.util.*;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test the good behaviour of the EventAdminHandler.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TestEventAdminHandler extends Common {
+
+ /**
+ * The number of providers to test.
+ */
+ private static final int NUMBER_OF_PROVIDERS = 6;
+ /**
+ * The number of providers using the event admin handler to test.
+ */
+ private static final int NUMBER_OF_EAH_PROVIDERS = 4;
+ /**
+ * The number of consumers to test.
+ */
+ private static final int NUMBER_OF_CONSUMERS = 6;
+ /**
+ * The number of synchronous providers to test.
+ */
+ private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
+ /**
+ * The number of slow consumers to test.
+ */
+ private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
+ /**
+ * The list of topics to test.
+ */
+ private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
+ "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
+ /**
+ * The utility class instance.
+ */
+ public EahTestUtils m_utils;
+ /**
+ * The providers' instances.
+ */
+ private ComponentInstance[] m_providersInstances;
+ /**
+ * The providers' service references.
+ */
+ private ServiceReference[] m_providersServices;
+ /**
+ * The providers' services.
+ */
+ private DonutProvider[] m_providers;
+ /**
+ * The synchronous providers' services.
+ */
+ private DonutProvider[] m_synchronousProviders;
+ /**
+ * The instances of providers that uses the event admin handler.
+ */
+ private ComponentInstance[] m_eahProvidersInstances;
+ /**
+ * The services of the providers that uses the event admin handler.
+ */
+ private DonutProvider[] m_eahProviders;
+ /**
+ * The synchronous donut event provider service.
+ */
+ private DonutProvider m_synchronousDonutEventProvider;
+ /**
+ * The consumers' instances.
+ */
+ private ComponentInstance[] m_consumersInstances;
+ /**
+ * The consumers' service references.
+ */
+ private ServiceReference[] m_consumersServices;
+ /**
+ * The consumers' services.
+ */
+ private DonutConsumer[] m_consumers;
+ /**
+ * The slow consumers' services.
+ */
+ private DonutConsumer[] m_quickConsumers;
+ /**
+ * The event tracker' instances.
+ */
+ private ComponentInstance m_eventTrackerInstance;
+ /**
+ * The event tracker' service references.
+ */
+ private ServiceReference m_eventTrackerService;
+ /**
+ * The event tracker service.
+ */
+ private EventTracker m_eventTracker;
+ /**
+ * The filtered consumers' instances.
+ */
+ private ComponentInstance[] m_filteredConsumersInstances;
+ /**
+ * The filtered consumers' service references.
+ */
+ private ServiceReference[] m_filteredConsumersServices;
+ /**
+ * The filtered consumers' services.
+ */
+ private DonutConsumer[] m_filteredConsumers;
+ /**
+ * The providers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsProvidersInstances;
+ /**
+ * The providers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsProvidersServices;
+ /**
+ * The providers' service with specified topics.
+ */
+ private DonutProvider[] m_topicsProviders;
+ /**
+ * The provider that send donuts on the "foo" topic.
+ */
+ private DonutProvider m_fooProvider;
+ /**
+ * The provider that send donuts on the "bar" topic.
+ */
+ private DonutProvider m_barProvider;
+ /**
+ * The provider that send donuts on the "nut" topic.
+ */
+ private DonutProvider m_nutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar" topics.
+ */
+ private DonutProvider m_fooBarProvider;
+ /**
+ * The provider that send donuts on the "bar,nut" topics.
+ */
+ private DonutProvider m_barNutProvider;
+ /**
+ * The provider that send donuts on the "foo,nut" topics.
+ */
+ private DonutProvider m_fooNutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar,nut" topics.
+ */
+ private DonutProvider m_fooBarNutProvider;
+ /**
+ * The consumers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsConsumersInstances;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsConsumersServices;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private DonutConsumer[] m_topicsConsumers;
+ /**
+ * The consumer that receive donuts on the "foo" topic.
+ */
+ private DonutConsumer m_fooConsumer;
+ /**
+ * The consumer that receive donuts on the "bar" topic.
+ */
+ private DonutConsumer m_barConsumer;
+ /**
+ * The consumer that receive donuts on the "nut" topic.
+ */
+ private DonutConsumer m_nutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar" topics.
+ */
+ private DonutConsumer m_fooBarConsumer;
+ /**
+ * The consumer that receive donuts on the "bar,nut" topics.
+ */
+ private DonutConsumer m_barNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,nut" topics.
+ */
+ private DonutConsumer m_fooNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar,nut" topics.
+ */
+ private DonutConsumer m_fooBarNutConsumer;
+
+ /**
+ * Initialization before test cases.
+ * <p/>
+ * Create all the instances
+ *
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ */
+ @Before
+ public void setUp()
+ throws UnacceptableConfiguration, MissingHandlerException,
+ ConfigurationException {
+
+ m_utils = new EahTestUtils(bc, ipojoHelper);
+ Dictionary properties = new Hashtable();
+
+ // All the providers
+ m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
+ m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
+ m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
+ m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
+ m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
+ m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
+ m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
+
+ // Create the (asynchronous) donut provider
+ properties.put("instance.name", "asynchronous donut provider");
+ m_providersInstances[0] = m_utils.getDonutProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut provider");
+ m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous donut event provider");
+ m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut event provider");
+ m_providersInstances[3] = m_utils
+ .getSynchronousDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous event provider");
+ m_providersInstances[4] = m_utils.getEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous event provider");
+ m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutProvider.class.getName(),
+ m_providersInstances[i].getInstanceName());
+ m_providers[i] = (DonutProvider) bc
+ .getService(m_providersServices[i]);
+ }
+ m_synchronousProviders[0] = m_providers[1];
+ m_synchronousProviders[1] = m_providers[3];
+ m_synchronousProviders[2] = m_providers[5];
+ m_eahProviders[0] = m_providers[0];
+ m_eahProviders[1] = m_providers[1];
+ m_eahProviders[2] = m_providers[2];
+ m_eahProviders[3] = m_providers[3];
+ m_eahProvidersInstances[0] = m_providersInstances[0];
+ m_eahProvidersInstances[1] = m_providersInstances[1];
+ m_eahProvidersInstances[2] = m_providersInstances[2];
+ m_eahProvidersInstances[3] = m_providersInstances[3];
+ m_synchronousDonutEventProvider = m_providers[3];
+
+ // All the consumers
+ m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
+ m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
+ m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
+ m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
+ m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
+ m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
+ m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
+ m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
+
+ // Create the (quick) donut consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut consumer");
+ m_consumersInstances[0] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut event consumer");
+ m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick event consumer");
+ m_consumersInstances[2] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut consumer
+ properties = new Hashtable();
+ properties.put("slow", Boolean.TRUE);
+ properties.put("instance.name", "slow donut consumer");
+ m_consumersInstances[3] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow donut event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[5] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutConsumer.class.getName(),
+ m_consumersInstances[i].getInstanceName());
+ m_consumers[i] = (DonutConsumer) bc
+ .getService(m_consumersServices[i]);
+ }
+ m_quickConsumers[0] = m_consumers[0];
+ m_quickConsumers[1] = m_consumers[1];
+ m_quickConsumers[2] = m_consumers[2];
+
+ // Create the event tracker
+ properties = new Hashtable();
+ properties.put("instance.name", "event tracker");
+ m_eventTrackerInstance = m_utils.getEventTrackerFactory()
+ .createComponentInstance(properties);
+ m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
+ EventTracker.class.getName(), m_eventTrackerInstance
+ .getInstanceName());
+ m_eventTracker = (EventTracker) bc
+ .getService(m_eventTrackerService);
+
+ // Create the filtered consumer
+ Dictionary filter = new Hashtable();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ String flavour = Donut.FLAVOURS[i];
+ properties = new Hashtable();
+ filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
+ properties.put("instance.name", flavour + " donut consumer");
+ properties.put("event.filter", filter);
+ m_filteredConsumersInstances[i] = m_utils
+ .getDonutEventConsumerFactory().createComponentInstance(
+ properties);
+ m_filteredConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(
+ DonutConsumer.class
+ .getName(), m_filteredConsumersInstances[i]
+ .getInstanceName());
+ m_filteredConsumers[i] = (DonutConsumer) bc
+ .getService(m_filteredConsumersServices[i]);
+ }
+
+ // Create the providers and consumers selling and receiving donuts on
+ // specific topics
+ Dictionary topics = new Hashtable();
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ String topicsString = TOPICS_LIST[i];
+ properties = new Hashtable();
+ // Create provider
+ topics.put("donut-publisher", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut provider");
+ m_topicsProvidersInstances[i] = m_utils
+ .getSynchronousDonutProviderFactory()
+ .createComponentInstance(properties);
+ m_topicsProvidersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutProvider.class
+ .getName(), m_topicsProvidersInstances[i]
+ .getInstanceName());
+ m_topicsProviders[i] = (DonutProvider) bc
+ .getService(m_topicsProvidersServices[i]);
+
+ // Create consumer
+ properties = new Hashtable();
+ topics.put("donut-subscriber", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut consumer");
+
+ m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+ m_topicsConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), m_topicsConsumersInstances[i]
+ .getInstanceName());
+ m_topicsConsumers[i] = (DonutConsumer) bc
+ .getService(m_topicsConsumersServices[i]);
+ topics.remove("donut-subscriber");
+ }
+
+ m_fooProvider = m_topicsProviders[0];
+ m_barProvider = m_topicsProviders[1];
+ m_nutProvider = m_topicsProviders[2];
+ m_fooBarProvider = m_topicsProviders[3];
+ m_barNutProvider = m_topicsProviders[4];
+ m_fooNutProvider = m_topicsProviders[5];
+ m_fooBarNutProvider = m_topicsProviders[6];
+ m_fooConsumer = m_topicsConsumers[0];
+ m_barConsumer = m_topicsConsumers[1];
+ m_nutConsumer = m_topicsConsumers[2];
+ m_fooBarConsumer = m_topicsConsumers[3];
+ m_barNutConsumer = m_topicsConsumers[4];
+ m_fooNutConsumer = m_topicsConsumers[5];
+ m_fooBarNutConsumer = m_topicsConsumers[6];
+
+ }
+
+ /**
+ * Creates a subscriber listening on a pattern topic (ending with '*').
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened.
+ */
+ @Test
+ public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ Dictionary properties = new Hashtable();
+ Dictionary topics = new Hashtable();
+
+ // Create the donut consumer instance, listening on a pattern topic
+ properties.put("instance.name", "subscriber with pattern topic");
+ topics.put("donut-subscriber", "a/pattern/topic/*");
+ properties.put("event.topics", topics);
+
+ ComponentInstance instance = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+ instance.dispose();
+ }
+
+ /**
+ * Test the event handler reliability by sending events with all kinds of
+ * publisher and check they are received by all kinds of subscriber.
+ */
+ @Test
+ public void testReliability() {
+
+ // Flush donut list for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumers[i].clearDonuts();
+ }
+
+ // Send a lot of donut with each provider
+ List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
+ * EahTestUtils.NUMBER_OF_TESTS);
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ sentDonuts.add(m_providers[i].sellDonut());
+ }
+ }
+
+ // Wait a respectable amount of time
+ EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
+ + EahTestUtils.A_LONG_TIME);
+
+ // Collect all received donuts for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts.",
+ sentDonuts.size(), receivedDonuts.size());
+ assertTrue("The receiver must have eaten all sent donuts.",
+ receivedDonuts.containsAll(sentDonuts));
+ }
+ }
+
+ /**
+ * Test the synchronism of event sending for the component.
+ * <p/>
+ * This test consists to send synchronously a big amount of donuts and to
+ * check immediately if it has been received (by all quick consumers).
+ */
+ @Test
+ public void testSynchronism() {
+
+ // Flush donut list for quick consumers
+ for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
+ m_quickConsumers[i].clearDonuts();
+ }
+
+ // Send a lot of donuts and check they are immediately received.
+ Donut sentDonut;
+ Donut receivedDonut;
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
+ sentDonut = m_synchronousProviders[j].sellDonut();
+ for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
+ receivedDonut = m_quickConsumers[k].getDonut();
+ assertEquals(
+ "The donut must have been received immediately and be the be the same as the sent one.",
+ sentDonut, receivedDonut);
+ }
+ }
+ }
+ }
+
+ /**
+ * Test that the received events contains the instance name of the sender.
+ */
+ @Test
+ public void testInstanceName() {
+
+ // Flush event list of the event tracker
+ m_eventTracker.clearEvents();
+
+ // Send donuts and check the sender instance name
+ Event receivedEvent;
+ for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
+ m_eahProviders[i].sellDonut();
+ receivedEvent = m_eventTracker.waitForEvent();
+ assertEquals(
+ "The instance name property of the received message must be the same as the sender instance name.",
+ m_eahProvidersInstances[i].getInstanceName(), receivedEvent
+ .getProperty("publisher.instance.name"));
+ }
+ }
+
+ /**
+ * Test the event filtering.
+ * <p/>
+ * This test send donuts with different flavours. Each filtered consumer
+ * must receive only a certain kind of donut. Of course, all donuts must
+ * have been received too.
+ */
+ @Test
+ public void testFilters() {
+
+ // The sent donuts, sorted by flavour
+ List[] sentDonuts = new List[Donut.FLAVOURS.length];
+
+ // Flush donut list for each filtered consumer
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ m_filteredConsumers[i].clearDonuts();
+ sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
+ / Donut.FLAVOURS.length);
+ }
+
+ // Send donuts
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ Donut donut = m_synchronousDonutEventProvider.sellDonut();
+ sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
+ .add(donut);
+ }
+
+ // Check the received donuts
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
+ sentDonuts[i].size(), receivedDonuts.length);
+ assertTrue(
+ "The receiver must have eaten all sent donuts matching the wanted flavour.",
+ Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
+ }
+
+ }
+
+ /**
+ * Test the event topic.
+ * <p/>
+ * This test send donuts on several topics. Each consumer (who listens to
+ * one or several topics) must receive donuts sent on his specifics topics.
+ */
+ @Test
+ public void testTopics() {
+
+ // The sent donuts, sorted by topic
+ int foos = 0;
+ int bars = 0;
+ int nuts = 0;
+
+ // Flush consumers
+ m_fooConsumer.clearDonuts();
+ m_barConsumer.clearDonuts();
+ m_nutConsumer.clearDonuts();
+ m_fooBarConsumer.clearDonuts();
+ m_barNutConsumer.clearDonuts();
+ m_fooNutConsumer.clearDonuts();
+ m_fooBarNutConsumer.clearDonuts();
+
+ // Send donuts
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ m_fooProvider.sellDonut();
+ foos++;
+
+ m_barProvider.sellDonut();
+ bars++;
+
+ m_nutProvider.sellDonut();
+ nuts++;
+
+ m_fooBarProvider.sellDonut();
+ foos++;
+ bars++;
+
+ m_barNutProvider.sellDonut();
+ bars++;
+ nuts++;
+
+ m_fooNutProvider.sellDonut();
+ foos++;
+ nuts++;
+
+ m_fooBarNutProvider.sellDonut();
+ foos++;
+ bars++;
+ nuts++;
+ }
+
+ // Check received donuts
+ assertEquals("The number of received donuts must be correct.", foos,
+ m_fooConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars,
+ m_barConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", nuts,
+ m_nutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars, m_fooBarConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars
+ + nuts, m_barNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + nuts, m_fooNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
+
+ }
+
+ /**
+ * Finalization after test cases.
+ * <p/>
+ * Release all services references and destroy instances.
+ */
+ @After
+ public void tearDown() {
+ int index;
+ for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
+ bc.ungetService(m_providersServices[index]);
+ m_providersInstances[index].dispose();
+ }
+ for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
+ bc.ungetService(m_consumersServices[index]);
+ m_consumersInstances[index].dispose();
+ }
+ bc.ungetService(m_eventTrackerService);
+ m_eventTrackerInstance.dispose();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ bc.ungetService(m_filteredConsumersServices[i]);
+ m_filteredConsumersInstances[i].dispose();
+ }
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ bc.ungetService(m_topicsProvidersServices[i]);
+ m_topicsProvidersInstances[i].dispose();
+ bc.ungetService(m_topicsConsumersServices[i]);
+ m_topicsConsumersInstances[i].dispose();
+ }
+
+ }
+
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java
new file mode 100644
index 0000000000..ba28e47e36
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java
@@ -0,0 +1,715 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.MissingHandlerException;
+import org.apache.felix.ipojo.UnacceptableConfiguration;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+
+import java.util.*;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test the good behaviour of the EventAdminHandler.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TestEventAdminHandlerWithNewAttributes extends Common {
+
+ /**
+ * The number of providers to test.
+ */
+ private static final int NUMBER_OF_PROVIDERS = 6;
+ /**
+ * The number of providers using the event admin handler to test.
+ */
+ private static final int NUMBER_OF_EAH_PROVIDERS = 4;
+ /**
+ * The number of consumers to test.
+ */
+ private static final int NUMBER_OF_CONSUMERS = 6;
+ /**
+ * The number of synchronous providers to test.
+ */
+ private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
+ /**
+ * The number of slow consumers to test.
+ */
+ private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
+ /**
+ * The list of topics to test.
+ */
+ private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
+ "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
+ /**
+ * The utility class instance.
+ */
+ public EahTestUtils m_utils;
+ /**
+ * The providers' instances.
+ */
+ private ComponentInstance[] m_providersInstances;
+ /**
+ * The providers' service references.
+ */
+ private ServiceReference[] m_providersServices;
+ /**
+ * The providers' services.
+ */
+ private DonutProvider[] m_providers;
+ /**
+ * The synchronous providers' services.
+ */
+ private DonutProvider[] m_synchronousProviders;
+ /**
+ * The instances of providers that uses the event admin handler.
+ */
+ private ComponentInstance[] m_eahProvidersInstances;
+ /**
+ * The services of the providers that uses the event admin handler.
+ */
+ private DonutProvider[] m_eahProviders;
+ /**
+ * The synchronous donut event provider service.
+ */
+ private DonutProvider m_synchronousDonutEventProvider;
+ /**
+ * The consumers' instances.
+ */
+ private ComponentInstance[] m_consumersInstances;
+ /**
+ * The consumers' service references.
+ */
+ private ServiceReference[] m_consumersServices;
+ /**
+ * The consumers' services.
+ */
+ private DonutConsumer[] m_consumers;
+ /**
+ * The slow consumers' services.
+ */
+ private DonutConsumer[] m_quickConsumers;
+ /**
+ * The event tracker' instances.
+ */
+ private ComponentInstance m_eventTrackerInstance;
+ /**
+ * The event tracker' service references.
+ */
+ private ServiceReference m_eventTrackerService;
+ /**
+ * The event tracker service.
+ */
+ private EventTracker m_eventTracker;
+ /**
+ * The filtered consumers' instances.
+ */
+ private ComponentInstance[] m_filteredConsumersInstances;
+ /**
+ * The filtered consumers' service references.
+ */
+ private ServiceReference[] m_filteredConsumersServices;
+ /**
+ * The filtered consumers' services.
+ */
+ private DonutConsumer[] m_filteredConsumers;
+ /**
+ * The providers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsProvidersInstances;
+ /**
+ * The providers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsProvidersServices;
+ /**
+ * The providers' service with specified topics.
+ */
+ private DonutProvider[] m_topicsProviders;
+ /**
+ * The provider that send donuts on the "foo" topic.
+ */
+ private DonutProvider m_fooProvider;
+ /**
+ * The provider that send donuts on the "bar" topic.
+ */
+ private DonutProvider m_barProvider;
+ /**
+ * The provider that send donuts on the "nut" topic.
+ */
+ private DonutProvider m_nutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar" topics.
+ */
+ private DonutProvider m_fooBarProvider;
+ /**
+ * The provider that send donuts on the "bar,nut" topics.
+ */
+ private DonutProvider m_barNutProvider;
+ /**
+ * The provider that send donuts on the "foo,nut" topics.
+ */
+ private DonutProvider m_fooNutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar,nut" topics.
+ */
+ private DonutProvider m_fooBarNutProvider;
+ /**
+ * The consumers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsConsumersInstances;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsConsumersServices;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private DonutConsumer[] m_topicsConsumers;
+ /**
+ * The consumer that receive donuts on the "foo" topic.
+ */
+ private DonutConsumer m_fooConsumer;
+ /**
+ * The consumer that receive donuts on the "bar" topic.
+ */
+ private DonutConsumer m_barConsumer;
+ /**
+ * The consumer that receive donuts on the "nut" topic.
+ */
+ private DonutConsumer m_nutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar" topics.
+ */
+ private DonutConsumer m_fooBarConsumer;
+ /**
+ * The consumer that receive donuts on the "bar,nut" topics.
+ */
+ private DonutConsumer m_barNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,nut" topics.
+ */
+ private DonutConsumer m_fooNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar,nut" topics.
+ */
+ private DonutConsumer m_fooBarNutConsumer;
+
+ /**
+ * Initialization before test cases.
+ * <p/>
+ * Create all the instances
+ *
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ */
+ @Before
+ public void setUp()
+ throws UnacceptableConfiguration, MissingHandlerException,
+ ConfigurationException {
+
+ m_utils = new EahTestUtils(bc, ipojoHelper);
+ Dictionary properties = new Hashtable();
+
+ // All the providers
+ m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
+ m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
+ m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
+ m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
+ m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
+ m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
+ m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
+
+ // Create the (asynchronous) donut provider
+ properties.put("instance.name", "asynchronous donut provider");
+ m_providersInstances[0] = m_utils.getDonutProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut provider");
+ m_providersInstances[1] = m_utils.getSynchronousDonutProvider2Factory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous donut event provider");
+ m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut event provider");
+ m_providersInstances[3] = m_utils
+ .getSynchronousDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous event provider");
+ m_providersInstances[4] = m_utils.getEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous event provider");
+ m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutProvider.class.getName(),
+ m_providersInstances[i].getInstanceName());
+ m_providers[i] = (DonutProvider) bc
+ .getService(m_providersServices[i]);
+ }
+ m_synchronousProviders[0] = m_providers[1];
+ m_synchronousProviders[1] = m_providers[3];
+ m_synchronousProviders[2] = m_providers[5];
+ m_eahProviders[0] = m_providers[0];
+ m_eahProviders[1] = m_providers[1];
+ m_eahProviders[2] = m_providers[2];
+ m_eahProviders[3] = m_providers[3];
+ m_eahProvidersInstances[0] = m_providersInstances[0];
+ m_eahProvidersInstances[1] = m_providersInstances[1];
+ m_eahProvidersInstances[2] = m_providersInstances[2];
+ m_eahProvidersInstances[3] = m_providersInstances[3];
+ m_synchronousDonutEventProvider = m_providers[3];
+
+ // All the consumers
+ m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
+ m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
+ m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
+ m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
+
+ m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
+ m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
+ m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
+ m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
+
+ // Create the (quick) donut consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut consumer");
+ m_consumersInstances[0] = m_utils.getDonutConsumer2Factory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut event consumer");
+ m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick event consumer");
+ m_consumersInstances[2] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut consumer
+ properties = new Hashtable();
+ properties.put("slow", Boolean.TRUE);
+ properties.put("instance.name", "slow donut consumer");
+ m_consumersInstances[3] = m_utils.getDonutConsumer2Factory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow donut event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[5] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutConsumer.class.getName(),
+ m_consumersInstances[i].getInstanceName());
+ m_consumers[i] = (DonutConsumer) bc
+ .getService(m_consumersServices[i]);
+ }
+ m_quickConsumers[0] = m_consumers[0];
+ m_quickConsumers[1] = m_consumers[1];
+ m_quickConsumers[2] = m_consumers[2];
+
+ // Create the event tracker
+ properties = new Hashtable();
+ properties.put("instance.name", "event tracker");
+ m_eventTrackerInstance = m_utils.getEventTrackerFactory()
+ .createComponentInstance(properties);
+ m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
+ EventTracker.class.getName(), m_eventTrackerInstance
+ .getInstanceName());
+ m_eventTracker = (EventTracker) bc
+ .getService(m_eventTrackerService);
+
+ // Create the filtered consumer
+ Dictionary filter = new Hashtable();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ String flavour = Donut.FLAVOURS[i];
+ properties = new Hashtable();
+ filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
+ properties.put("instance.name", flavour + " donut consumer");
+ properties.put("event.filter", filter);
+ m_filteredConsumersInstances[i] = m_utils
+ .getDonutEventConsumerFactory().createComponentInstance(
+ properties);
+ m_filteredConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), m_filteredConsumersInstances[i]
+ .getInstanceName());
+ m_filteredConsumers[i] = (DonutConsumer) bc
+ .getService(m_filteredConsumersServices[i]);
+ }
+
+ // Create the providers and consumers selling and receiving donuts on
+ // specific topics
+ Dictionary topics = new Hashtable();
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ String topicsString = TOPICS_LIST[i];
+ properties = new Hashtable();
+ // Create provider
+ topics.put("donut-publisher", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut provider");
+ m_topicsProvidersInstances[i] = m_utils
+ .getSynchronousDonutProviderFactory()
+ .createComponentInstance(properties);
+ m_topicsProvidersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutProvider.class
+ .getName(), m_topicsProvidersInstances[i]
+ .getInstanceName());
+ m_topicsProviders[i] = (DonutProvider) bc
+ .getService(m_topicsProvidersServices[i]);
+
+ // Create consumer
+ properties = new Hashtable();
+ topics.put("donut-subscriber", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut consumer");
+
+ m_topicsConsumersInstances[i] = m_utils.getDonutConsumer2Factory()
+ .createComponentInstance(properties);
+ m_topicsConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), m_topicsConsumersInstances[i]
+ .getInstanceName());
+ m_topicsConsumers[i] = (DonutConsumer) bc
+ .getService(m_topicsConsumersServices[i]);
+ topics.remove("donut-subscriber");
+ }
+
+ m_fooProvider = m_topicsProviders[0];
+ m_barProvider = m_topicsProviders[1];
+ m_nutProvider = m_topicsProviders[2];
+ m_fooBarProvider = m_topicsProviders[3];
+ m_barNutProvider = m_topicsProviders[4];
+ m_fooNutProvider = m_topicsProviders[5];
+ m_fooBarNutProvider = m_topicsProviders[6];
+ m_fooConsumer = m_topicsConsumers[0];
+ m_barConsumer = m_topicsConsumers[1];
+ m_nutConsumer = m_topicsConsumers[2];
+ m_fooBarConsumer = m_topicsConsumers[3];
+ m_barNutConsumer = m_topicsConsumers[4];
+ m_fooNutConsumer = m_topicsConsumers[5];
+ m_fooBarNutConsumer = m_topicsConsumers[6];
+
+ }
+
+ /**
+ * Creates a subscriber listening on a pattern topic (ending with '*').
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened.
+ */
+ @Test
+ public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ Dictionary properties = new Hashtable();
+ Dictionary topics = new Hashtable();
+
+ // Create the donut consumer instance, listening on a pattern topic
+ properties.put("instance.name", "subscriber with pattern topic");
+ topics.put("donut-subscriber", "a/pattern/topic/*");
+ properties.put("event.topics", topics);
+
+ ComponentInstance instance = m_utils.getDonutConsumer2Factory()
+ .createComponentInstance(properties);
+ instance.dispose();
+ }
+
+ /**
+ * Test the event handler reliability by sending events with all kinds of
+ * publisher and check they are received by all kinds of subscriber.
+ */
+ @Test
+ public void testReliability() {
+
+ // Flush donut list for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumers[i].clearDonuts();
+ }
+
+ // Send a lot of donut with each provider
+ List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
+ * EahTestUtils.NUMBER_OF_TESTS);
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ sentDonuts.add(m_providers[i].sellDonut());
+ }
+ }
+
+ // Wait a respectable amount of time
+ EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
+ + EahTestUtils.A_LONG_TIME);
+
+ // Collect all received donuts for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts.",
+ sentDonuts.size(), receivedDonuts.size());
+ assertTrue("The receiver must have eaten all sent donuts.",
+ receivedDonuts.containsAll(sentDonuts));
+ }
+ }
+
+ /**
+ * Test the synchronism of event sending for the component.
+ * <p/>
+ * This test consists to send synchronously a big amount of donuts and to
+ * check immediately if it has been received (by all quick consumers).
+ */
+ @Test
+ public void testSynchronism() {
+
+ // Flush donut list for quick consumers
+ for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
+ m_quickConsumers[i].clearDonuts();
+ }
+
+ // Send a lot of donuts and check they are immediately received.
+ Donut sentDonut;
+ Donut receivedDonut;
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
+ sentDonut = m_synchronousProviders[j].sellDonut();
+ for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
+ receivedDonut = m_quickConsumers[k].getDonut();
+ assertEquals(
+ "The donut must have been received immediately and be the be the same as the sent one.",
+ sentDonut, receivedDonut);
+ }
+ }
+ }
+ }
+
+ /**
+ * Test that the received events contains the instance name of the sender.
+ */
+ @Test
+ public void testInstanceName() {
+
+ // Flush event list of the event tracker
+ m_eventTracker.clearEvents();
+
+ // Send donuts and check the sender instance name
+ Event receivedEvent;
+ for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
+ m_eahProviders[i].sellDonut();
+ receivedEvent = m_eventTracker.waitForEvent();
+ assertEquals(
+ "The instance name property of the received message must be the same as the sender instance name.",
+ m_eahProvidersInstances[i].getInstanceName(), receivedEvent
+ .getProperty("publisher.instance.name"));
+ }
+ }
+
+ /**
+ * Test the event filtering.
+ * <p/>
+ * This test send donuts with different flavours. Each filtered consumer
+ * must receive only a certain kind of donut. Of course, all donuts must
+ * have been received too.
+ */
+ @Test
+ public void testFilters() {
+
+ // The sent donuts, sorted by flavour
+ List[] sentDonuts = new List[Donut.FLAVOURS.length];
+
+ // Flush donut list for each filtered consumer
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ m_filteredConsumers[i].clearDonuts();
+ sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
+ / Donut.FLAVOURS.length);
+ }
+
+ // Send donuts
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ Donut donut = m_synchronousDonutEventProvider.sellDonut();
+ sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
+ .add(donut);
+ }
+
+ // Check the received donuts
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
+ sentDonuts[i].size(), receivedDonuts.length);
+ assertTrue(
+ "The receiver must have eaten all sent donuts matching the wanted flavour.",
+ Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
+ }
+
+ }
+
+ /**
+ * Test the event topic.
+ * <p/>
+ * This test send donuts on several topics. Each consumer (who listens to
+ * one or several topics) must receive donuts sent on his specifics topics.
+ */
+ @Test
+ public void testTopics() {
+
+ // The sent donuts, sorted by topic
+ int foos = 0;
+ int bars = 0;
+ int nuts = 0;
+
+ // Flush consumers
+ m_fooConsumer.clearDonuts();
+ m_barConsumer.clearDonuts();
+ m_nutConsumer.clearDonuts();
+ m_fooBarConsumer.clearDonuts();
+ m_barNutConsumer.clearDonuts();
+ m_fooNutConsumer.clearDonuts();
+ m_fooBarNutConsumer.clearDonuts();
+
+ // Send donuts
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ m_fooProvider.sellDonut();
+ foos++;
+
+ m_barProvider.sellDonut();
+ bars++;
+
+ m_nutProvider.sellDonut();
+ nuts++;
+
+ m_fooBarProvider.sellDonut();
+ foos++;
+ bars++;
+
+ m_barNutProvider.sellDonut();
+ bars++;
+ nuts++;
+
+ m_fooNutProvider.sellDonut();
+ foos++;
+ nuts++;
+
+ m_fooBarNutProvider.sellDonut();
+ foos++;
+ bars++;
+ nuts++;
+ }
+
+ // Check received donuts
+ assertEquals("The number of received donuts must be correct.", foos,
+ m_fooConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars,
+ m_barConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", nuts,
+ m_nutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars, m_fooBarConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars
+ + nuts, m_barNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + nuts, m_fooNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
+
+ }
+
+ /**
+ * Finalization after test cases.
+ * <p/>
+ * Release all services references and destroy instances.
+ */
+ @After
+ public void tearDown() {
+ int index;
+ for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
+ bc.ungetService(m_providersServices[index]);
+ m_providersInstances[index].dispose();
+ }
+ for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
+ bc.ungetService(m_consumersServices[index]);
+ m_consumersInstances[index].dispose();
+ }
+ bc.ungetService(m_eventTrackerService);
+ m_eventTrackerInstance.dispose();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ bc.ungetService(m_filteredConsumersServices[i]);
+ m_filteredConsumersInstances[i].dispose();
+ }
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ bc.ungetService(m_topicsProvidersServices[i]);
+ m_topicsProvidersInstances[i].dispose();
+ bc.ungetService(m_topicsConsumersServices[i]);
+ m_topicsConsumersInstances[i].dispose();
+ }
+
+ }
+
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java
new file mode 100644
index 0000000000..2bb7a1e858
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java
@@ -0,0 +1,714 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handler.eventadmin.test;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.ConfigurationException;
+import org.apache.felix.ipojo.MissingHandlerException;
+import org.apache.felix.ipojo.UnacceptableConfiguration;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
+import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.event.Event;
+
+import java.util.*;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test the good behaviour of the EventAdminHandler.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TestPublisher extends Common {
+
+ /**
+ * The number of providers to test.
+ */
+ private static final int NUMBER_OF_PROVIDERS = 6;
+ /**
+ * The number of providers using the event admin handler to test.
+ */
+ private static final int NUMBER_OF_EAH_PROVIDERS = 4;
+ /**
+ * The number of consumers to test.
+ */
+ private static final int NUMBER_OF_CONSUMERS = 6;
+ /**
+ * The number of synchronous providers to test.
+ */
+ private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
+ /**
+ * The number of slow consumers to test.
+ */
+ private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
+ /**
+ * The list of topics to test.
+ */
+ private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
+ "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
+ /**
+ * The utility class instance.
+ */
+ public EahTestUtils m_utils;
+ /**
+ * The providers' instances.
+ */
+ private ComponentInstance[] m_providersInstances;
+ /**
+ * The providers' service references.
+ */
+ private ServiceReference[] m_providersServices;
+ /**
+ * The providers' services.
+ */
+ private DonutProvider[] m_providers;
+ /**
+ * The synchronous providers' services.
+ */
+ private DonutProvider[] m_synchronousProviders;
+ /**
+ * The instances of providers that uses the event admin handler.
+ */
+ private ComponentInstance[] m_eahProvidersInstances;
+ /**
+ * The services of the providers that uses the event admin handler.
+ */
+ private DonutProvider[] m_eahProviders;
+ /**
+ * The synchronous donut event provider service.
+ */
+ private DonutProvider m_synchronousDonutEventProvider;
+ /**
+ * The consumers' instances.
+ */
+ private ComponentInstance[] m_consumersInstances;
+ /**
+ * The consumers' service references.
+ */
+ private ServiceReference[] m_consumersServices;
+ /**
+ * The consumers' services.
+ */
+ private DonutConsumer[] m_consumers;
+ /**
+ * The slow consumers' services.
+ */
+ private DonutConsumer[] m_quickConsumers;
+ /**
+ * The event tracker' instances.
+ */
+ private ComponentInstance m_eventTrackerInstance;
+ /**
+ * The event tracker' service references.
+ */
+ private ServiceReference m_eventTrackerService;
+ /**
+ * The event tracker service.
+ */
+ private EventTracker m_eventTracker;
+ /**
+ * The filtered consumers' instances.
+ */
+ private ComponentInstance[] m_filteredConsumersInstances;
+ /**
+ * The filtered consumers' service references.
+ */
+ private ServiceReference[] m_filteredConsumersServices;
+ /**
+ * The filtered consumers' services.
+ */
+ private DonutConsumer[] m_filteredConsumers;
+ /**
+ * The providers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsProvidersInstances;
+ /**
+ * The providers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsProvidersServices;
+ /**
+ * The providers' service with specified topics.
+ */
+ private DonutProvider[] m_topicsProviders;
+ /**
+ * The provider that send donuts on the "foo" topic.
+ */
+ private DonutProvider m_fooProvider;
+ /**
+ * The provider that send donuts on the "bar" topic.
+ */
+ private DonutProvider m_barProvider;
+ /**
+ * The provider that send donuts on the "nut" topic.
+ */
+ private DonutProvider m_nutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar" topics.
+ */
+ private DonutProvider m_fooBarProvider;
+ /**
+ * The provider that send donuts on the "bar,nut" topics.
+ */
+ private DonutProvider m_barNutProvider;
+ /**
+ * The provider that send donuts on the "foo,nut" topics.
+ */
+ private DonutProvider m_fooNutProvider;
+ /**
+ * The provider that send donuts on the "foo,bar,nut" topics.
+ */
+ private DonutProvider m_fooBarNutProvider;
+ /**
+ * The consumers' instances with specified topics.
+ */
+ private ComponentInstance[] m_topicsConsumersInstances;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private ServiceReference[] m_topicsConsumersServices;
+ /**
+ * The consumers' service references with specified topics.
+ */
+ private DonutConsumer[] m_topicsConsumers;
+ /**
+ * The consumer that receive donuts on the "foo" topic.
+ */
+ private DonutConsumer m_fooConsumer;
+ /**
+ * The consumer that receive donuts on the "bar" topic.
+ */
+ private DonutConsumer m_barConsumer;
+ /**
+ * The consumer that receive donuts on the "nut" topic.
+ */
+ private DonutConsumer m_nutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar" topics.
+ */
+ private DonutConsumer m_fooBarConsumer;
+ /**
+ * The consumer that receive donuts on the "bar,nut" topics.
+ */
+ private DonutConsumer m_barNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,nut" topics.
+ */
+ private DonutConsumer m_fooNutConsumer;
+ /**
+ * The consumer that receive donuts on the "foo,bar,nut" topics.
+ */
+ private DonutConsumer m_fooBarNutConsumer;
+
+ /**
+ * Initialization before test cases.
+ * <p/>
+ * Create all the instances
+ *
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened
+ */
+ @Before
+ public void setUp()
+ throws UnacceptableConfiguration, MissingHandlerException,
+ ConfigurationException {
+
+ m_utils = new EahTestUtils(bc, ipojoHelper);
+ Dictionary properties = new Hashtable();
+
+ // All the providers
+ m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
+ m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
+ m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
+ m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
+ m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
+ m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
+ m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
+
+ // Create the (asynchronous) donut provider
+ properties.put("instance.name", "asynchronous donut provider");
+ m_providersInstances[0] = m_utils.getDonutProviderUsingPublishesFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut provider");
+ m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous donut event provider");
+ m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous donut event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous donut event provider");
+ m_providersInstances[3] = m_utils
+ .getSynchronousDonutEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the (asynchronous) event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "asynchronous event provider");
+ m_providersInstances[4] = m_utils.getEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Create the synchronous event provider
+ properties = new Hashtable();
+ properties.put("instance.name", "synchronous event provider");
+ m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutProvider.class.getName(),
+ m_providersInstances[i].getInstanceName());
+ m_providers[i] = (DonutProvider) bc
+ .getService(m_providersServices[i]);
+ }
+ m_synchronousProviders[0] = m_providers[1];
+ m_synchronousProviders[1] = m_providers[3];
+ m_synchronousProviders[2] = m_providers[5];
+ m_eahProviders[0] = m_providers[0];
+ m_eahProviders[1] = m_providers[1];
+ m_eahProviders[2] = m_providers[2];
+ m_eahProviders[3] = m_providers[3];
+ m_eahProvidersInstances[0] = m_providersInstances[0];
+ m_eahProvidersInstances[1] = m_providersInstances[1];
+ m_eahProvidersInstances[2] = m_providersInstances[2];
+ m_eahProvidersInstances[3] = m_providersInstances[3];
+ m_synchronousDonutEventProvider = m_providers[3];
+
+ // All the consumers
+ m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
+ m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
+ m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
+ m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
+ m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
+ m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
+ m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
+ m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
+ m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
+ m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
+
+ // Create the (quick) donut consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut consumer");
+ m_consumersInstances[0] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick donut event consumer");
+ m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the (quick) event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "quick event consumer");
+ m_consumersInstances[2] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut consumer
+ properties = new Hashtable();
+ properties.put("slow", Boolean.TRUE);
+ properties.put("instance.name", "slow donut consumer");
+ m_consumersInstances[3] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow donut event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow donut event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Create the slow event consumer
+ properties = new Hashtable();
+ properties.put("instance.name", "slow event consumer");
+ properties.put("slow", Boolean.TRUE);
+ m_consumersInstances[5] = m_utils.getEventConsumerFactory()
+ .createComponentInstance(properties);
+
+ // Get all the services references
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
+ DonutConsumer.class.getName(),
+ m_consumersInstances[i].getInstanceName());
+ m_consumers[i] = (DonutConsumer) bc
+ .getService(m_consumersServices[i]);
+ }
+ m_quickConsumers[0] = m_consumers[0];
+ m_quickConsumers[1] = m_consumers[1];
+ m_quickConsumers[2] = m_consumers[2];
+
+ // Create the event tracker
+ properties = new Hashtable();
+ properties.put("instance.name", "event tracker");
+ m_eventTrackerInstance = m_utils.getEventTrackerFactory()
+ .createComponentInstance(properties);
+ m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
+ EventTracker.class.getName(), m_eventTrackerInstance
+ .getInstanceName());
+ m_eventTracker = (EventTracker) bc
+ .getService(m_eventTrackerService);
+
+ // Create the filtered consumer
+ Dictionary filter = new Hashtable();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ String flavour = Donut.FLAVOURS[i];
+ properties = new Hashtable();
+ filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
+ properties.put("instance.name", flavour + " donut consumer");
+ properties.put("event.filter", filter);
+ m_filteredConsumersInstances[i] = m_utils
+ .getDonutEventConsumerFactory().createComponentInstance(
+ properties);
+ m_filteredConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), m_filteredConsumersInstances[i]
+ .getInstanceName());
+ m_filteredConsumers[i] = (DonutConsumer) bc
+ .getService(m_filteredConsumersServices[i]);
+ }
+
+ // Create the providers and consumers selling and receiving donuts on
+ // specific topics
+ Dictionary topics = new Hashtable();
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ String topicsString = TOPICS_LIST[i];
+ properties = new Hashtable();
+ // Create provider
+ topics.put("donut-publisher", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut provider");
+ m_topicsProvidersInstances[i] = m_utils
+ .getSynchronousDonutProviderFactory()
+ .createComponentInstance(properties);
+ m_topicsProvidersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutProvider.class
+ .getName(), m_topicsProvidersInstances[i]
+ .getInstanceName());
+ m_topicsProviders[i] = (DonutProvider) bc
+ .getService(m_topicsProvidersServices[i]);
+
+ // Create consumer
+ properties = new Hashtable();
+ topics.put("donut-subscriber", topicsString);
+ properties.put("event.topics", topics);
+ properties.put("instance.name", topicsString + " donut consumer");
+
+ m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+ m_topicsConsumersServices[i] = ipojoHelper
+ .getServiceReferenceByName(DonutConsumer.class
+ .getName(), m_topicsConsumersInstances[i]
+ .getInstanceName());
+ m_topicsConsumers[i] = (DonutConsumer) bc
+ .getService(m_topicsConsumersServices[i]);
+ topics.remove("donut-subscriber");
+ }
+
+ m_fooProvider = m_topicsProviders[0];
+ m_barProvider = m_topicsProviders[1];
+ m_nutProvider = m_topicsProviders[2];
+ m_fooBarProvider = m_topicsProviders[3];
+ m_barNutProvider = m_topicsProviders[4];
+ m_fooNutProvider = m_topicsProviders[5];
+ m_fooBarNutProvider = m_topicsProviders[6];
+ m_fooConsumer = m_topicsConsumers[0];
+ m_barConsumer = m_topicsConsumers[1];
+ m_nutConsumer = m_topicsConsumers[2];
+ m_fooBarConsumer = m_topicsConsumers[3];
+ m_barNutConsumer = m_topicsConsumers[4];
+ m_fooNutConsumer = m_topicsConsumers[5];
+ m_fooBarNutConsumer = m_topicsConsumers[6];
+
+ }
+
+ /**
+ * Creates a subscriber listening on a pattern topic (ending with '*').
+ *
+ * @throws org.apache.felix.ipojo.ConfigurationException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.MissingHandlerException
+ * something bad happened.
+ * @throws org.apache.felix.ipojo.UnacceptableConfiguration
+ * something bad happened.
+ */
+ @Test
+ public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
+ Dictionary properties = new Hashtable();
+ Dictionary topics = new Hashtable();
+
+ // Create the donut consumer instance, listening on a pattern topic
+ properties.put("instance.name", "subscriber with pattern topic");
+ topics.put("donut-subscriber", "a/pattern/topic/*");
+ properties.put("event.topics", topics);
+
+ ComponentInstance instance = m_utils.getDonutConsumerFactory()
+ .createComponentInstance(properties);
+ instance.dispose();
+ }
+
+ /**
+ * Test the event handler reliability by sending events with all kinds of
+ * publisher and check they are received by all kinds of subscriber.
+ */
+ @Test
+ public void testReliability() {
+
+ // Flush donut list for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ m_consumers[i].clearDonuts();
+ }
+
+ // Send a lot of donut with each provider
+ List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
+ * EahTestUtils.NUMBER_OF_TESTS);
+ for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ sentDonuts.add(m_providers[i].sellDonut());
+ }
+ }
+
+ // Wait a respectable amount of time
+ EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
+ + EahTestUtils.A_LONG_TIME);
+
+ // Collect all received donuts for each consumer
+ for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
+ List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts.",
+ sentDonuts.size(), receivedDonuts.size());
+ assertTrue("The receiver must have eaten all sent donuts.",
+ receivedDonuts.containsAll(sentDonuts));
+ }
+ }
+
+ /**
+ * Test the synchronism of event sending for the component.
+ * <p/>
+ * This test consists to send synchronously a big amount of donuts and to
+ * check immediately if it has been received (by all quick consumers).
+ */
+ @Test
+ public void testSynchronism() {
+
+ // Flush donut list for quick consumers
+ for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
+ m_quickConsumers[i].clearDonuts();
+ }
+
+ // Send a lot of donuts and check they are immediately received.
+ Donut sentDonut;
+ Donut receivedDonut;
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
+ sentDonut = m_synchronousProviders[j].sellDonut();
+ for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
+ receivedDonut = m_quickConsumers[k].getDonut();
+ assertEquals(
+ "The donut must have been received immediately and be the be the same as the sent one.",
+ sentDonut, receivedDonut);
+ }
+ }
+ }
+ }
+
+ /**
+ * Test that the received events contains the instance name of the sender.
+ */
+ @Test
+ public void testInstanceName() {
+
+ // Flush event list of the event tracker
+ m_eventTracker.clearEvents();
+
+ // Send donuts and check the sender instance name
+ Event receivedEvent;
+ for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
+ m_eahProviders[i].sellDonut();
+ receivedEvent = m_eventTracker.waitForEvent();
+ assertEquals(
+ "The instance name property of the received message must be the same as the sender instance name.",
+ m_eahProvidersInstances[i].getInstanceName(), receivedEvent
+ .getProperty("publisher.instance.name"));
+ }
+ }
+
+ /**
+ * Test the event filtering.
+ * <p/>
+ * This test send donuts with different flavours. Each filtered consumer
+ * must receive only a certain kind of donut. Of course, all donuts must
+ * have been received too.
+ */
+ @Test
+ public void testFilters() {
+
+ // The sent donuts, sorted by flavour
+ List[] sentDonuts = new List[Donut.FLAVOURS.length];
+
+ // Flush donut list for each filtered consumer
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ m_filteredConsumers[i].clearDonuts();
+ sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
+ / Donut.FLAVOURS.length);
+ }
+
+ // Send donuts
+ for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
+ Donut donut = m_synchronousDonutEventProvider.sellDonut();
+ sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
+ .add(donut);
+ }
+
+ // Check the received donuts
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
+ assertEquals(
+ "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
+ sentDonuts[i].size(), receivedDonuts.length);
+ assertTrue(
+ "The receiver must have eaten all sent donuts matching the wanted flavour.",
+ Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
+ }
+
+ }
+
+ /**
+ * Test the event topic.
+ * <p/>
+ * This test send donuts on several topics. Each consumer (who listens to
+ * one or several topics) must receive donuts sent on his specifics topics.
+ */
+ @Test
+ public void testTopics() {
+
+ // The sent donuts, sorted by topic
+ int foos = 0;
+ int bars = 0;
+ int nuts = 0;
+
+ // Flush consumers
+ m_fooConsumer.clearDonuts();
+ m_barConsumer.clearDonuts();
+ m_nutConsumer.clearDonuts();
+ m_fooBarConsumer.clearDonuts();
+ m_barNutConsumer.clearDonuts();
+ m_fooNutConsumer.clearDonuts();
+ m_fooBarNutConsumer.clearDonuts();
+
+ // Send donuts
+ for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
+ m_fooProvider.sellDonut();
+ foos++;
+
+ m_barProvider.sellDonut();
+ bars++;
+
+ m_nutProvider.sellDonut();
+ nuts++;
+
+ m_fooBarProvider.sellDonut();
+ foos++;
+ bars++;
+
+ m_barNutProvider.sellDonut();
+ bars++;
+ nuts++;
+
+ m_fooNutProvider.sellDonut();
+ foos++;
+ nuts++;
+
+ m_fooBarNutProvider.sellDonut();
+ foos++;
+ bars++;
+ nuts++;
+ }
+
+ // Check received donuts
+ assertEquals("The number of received donuts must be correct.", foos,
+ m_fooConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars,
+ m_barConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", nuts,
+ m_nutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars, m_fooBarConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", bars
+ + nuts, m_barNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + nuts, m_fooNutConsumer.getAllDonuts().length);
+ assertEquals("The number of received donuts must be correct.", foos
+ + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
+
+ }
+
+ /**
+ * Finalization after test cases.
+ * <p/>
+ * Release all services references and destroy instances.
+ */
+ @After
+ public void tearDown() {
+ int index;
+ for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
+ bc.ungetService(m_providersServices[index]);
+ m_providersInstances[index].dispose();
+ }
+ for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
+ bc.ungetService(m_consumersServices[index]);
+ m_consumersInstances[index].dispose();
+ }
+ bc.ungetService(m_eventTrackerService);
+ m_eventTrackerInstance.dispose();
+ for (int i = 0; i < Donut.FLAVOURS.length; i++) {
+ bc.ungetService(m_filteredConsumersServices[i]);
+ m_filteredConsumersInstances[i].dispose();
+ }
+ for (int i = 0; i < TOPICS_LIST.length; i++) {
+ bc.ungetService(m_topicsProvidersServices[i]);
+ m_topicsProvidersInstances[i].dispose();
+ bc.ungetService(m_topicsConsumersServices[i]);
+ m_topicsConsumersInstances[i].dispose();
+ }
+
+ }
+
+}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt b/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt
new file mode 100644
index 0000000000..dec38256c1
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt
@@ -0,0 +1,32 @@
+Changes from the 1.6.0 to 1.8.0
+-------------------------------
+** Bug
+ * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler
+
+** Improvement
+ * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions
+ * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision
+ * [FELIX-2711] - The event admin handler should provides a Handler Description
+
+Changes from the 1.4.0 to 1.6.0
+-------------------------------
+** Bug
+ * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key
+
+Changes from 1.2.0 to 1.4.0
+---------------------------
+** Improvement
+ * Update parent pom
+
+ Changes from 1.0.0 to 1.2.0
+---------------------------
+** Bug
+ * [FELIX-794] - Event Admin handler reject correctly formed topics
+
+** Improvement
+ * [FELIX-795] - Improve metadata and manipulator performance
+ * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
+
+Version 1.0.0
+-------------
+ * Initial release
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml
new file mode 100644
index 0000000000..69b340bf5d
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml
@@ -0,0 +1,41 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<ipojo>
+ <handler
+ classname="org.apache.felix.ipojo.handlers.event.subscriber.EventAdminSubscriberHandler"
+ name="subscriber"
+ namespace="org.apache.felix.ipojo.handlers.event">
+ <provides>
+ <property field="m_topics" name="event.topics"/>
+ </provides>
+ </handler>
+
+ <!-- This handler is duplicated to support the 'Publishes' annotation -->
+ <handler classname="org.apache.felix.ipojo.handlers.event.publisher.EventAdminPublisherHandler"
+ name="publisher"
+ namespace="org.apache.felix.ipojo.handlers.event">
+ <requires field="m_ea"/>
+ </handler>
+
+ <handler classname="org.apache.felix.ipojo.handlers.event.publisher.EventAdminPublisherHandler"
+ name="publishes"
+ namespace="org.apache.felix.ipojo.handlers.event">
+ <requires field="m_ea"/>
+ </handler>
+</ipojo>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/obr.xml b/ipojo/handler/eventadmin/eventadmin-handler/obr.xml
new file mode 100644
index 0000000000..4e53bb3885
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/obr.xml
@@ -0,0 +1,31 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<obr>
+ <capability name="ipojo.handler">
+ <p n="name" v="publisher"/>
+ <p n="namespace" v="org.apache.felix.ipojo.handlers.event"/>
+ <p n="type" v="primitive"/>
+ </capability>
+ <capability name="ipojo.handler">
+ <p n="name" v="subscriber"/>
+ <p n="namespace" v="org.apache.felix.ipojo.handlers.event"/>
+ <p n="type" v="primitive"/>
+ </capability>
+ <require extend="false" filter="(service=org.osgi.service.event.EventAdmin)" multiple="false" name="service" optional="false">Import Event Admin service</require>
+</obr>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler/pom.xml
new file mode 100644
index 0000000000..873e87d59b
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/pom.xml
@@ -0,0 +1,113 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix-parent</artifactId>
+ <version>2.1</version>
+ <relativePath>../../../../pom/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>bundle</packaging>
+ <name>Apache Felix iPOJO Event Admin Handler</name>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+
+ <description>
+ iPOJO extension to easily interact with the OSGi Event Admin.
+ </description>
+ <url>
+ http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html
+ </url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.10.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.3.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.apache.felix.ipojo.handlers.event*;version="1.2.0"</Export-Package>
+ <Bundle-Name>${project.name}</Bundle-Name>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Description>iPOJO Event Admin Handlers
+ </Bundle-Description>
+ <Bundle-DocURL>
+ http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html
+ </Bundle-DocURL>
+ <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>1.10.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>ipojo-bundle</goal>
+ </goals>
+ <configuration>
+ <metadata>metadata.xml</metadata>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <enableRulesSummary>false</enableRulesSummary>
+ <violationSeverity>warning</violationSeverity>
+ <configLocation>http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml</configLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES
new file mode 100644
index 0000000000..1c61161053
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES
@@ -0,0 +1,11 @@
+I. Included Third-Party Software
+
+II. Used Third-Party Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2009).
+Licensed under the Apache License 2.0.
+
+III. Overall License Summary
+- Apache License 2.0
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
new file mode 100644
index 0000000000..c46dacfb8d
--- /dev/null
+++ b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.felix.ipojo.handlers.event;
+
+import org.apache.felix.ipojo.parser.ParseUtils;
+
+/**
+ * Utility methods.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class EventUtil {
+
+ /**
+ * The separator between topics.
+ */
+ public static final String TOPIC_SEPARATOR = ",";
+
+ /**
+ * The separator between topics.
+ */
+ public static final String TOPIC_TOKEN_SEPARATOR = "/";
+
+ /**
+ * The topic token alphabet.
+ */
+ private static final String TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
+
+ /**
+ * Tests that the given topic match with the given topic pattern.
+ *
+ * @param topic the topic to test
+ * @param topicPattern the topic pattern
+ * @return true if it matches.
+ */
+ public static final boolean matches(String topic, String topicPattern) {
+ if (topicPattern.equals("*")) {
+ return true;
+ }
+ int star;
+ if ((star = topicPattern.indexOf("*")) > 0) {
+ return topic.startsWith(topicPattern.substring(0, star - 1));
+ } else {
+ return topic.equals(topicPattern);
+ }
+ }
+
+ /**
+ * Tests that the given topic match with the given topic patterns.
+ *
+ * @param topic the topic to test
+ * @param topicPatterns the topic patterns
+ * @return true if it matches.
+ */
+ public static final boolean matches(String topic, String[] topicPatterns) {
+ int n = topicPatterns.length;
+ for (int i = 0; i < n; i++) {
+ if (matches(topic, topicPatterns[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check the given topic scope is valid.
+ *
+ * topicScope ::= "*" | ( topic "/*" ? )
+ *
+ * @param topicScope the topic scope to check.
+ *
+ * @return {@code true} if the given topic scope is valid, {@code false}
+ * otherwise.
+ */
+ public static final boolean isValidTopicScope(String topicScope) {
+ if (topicScope.equals("*")) {
+ // Wildcard character only accepted.
+ return true;
+ }
+
+ // Remove trailing "/*" if present, to check the topic radix.
+ String topicWithoutWildcard;
+ if (topicScope.endsWith("/*")) {
+ topicWithoutWildcard = topicScope.substring(0,
+ topicScope.length() - 2);
+ } else {
+ topicWithoutWildcard = topicScope;
+ }
+
+ // Validate the topic radix.
+ return isValidTopic(topicWithoutWildcard);
+ }
+
+ /**
+ * Check the given topic is valid.
+ *
+ * topic ::= token ( �/� token ) *
+ *
+ * @param topic the topic to check.
+ *
+ * @return {@code true} if the given topic is valid, {@code false}
+ * otherwise.
+ */
+ public static final boolean isValidTopic(String topic) {
+ if (topic.startsWith(TOPIC_TOKEN_SEPARATOR)
+ || topic.endsWith(TOPIC_TOKEN_SEPARATOR)) {
+ // A topic cannot start nor end with '/'.
+ return false;
+ }
+
+ String[] tokens = ParseUtils.split(topic, TOPIC_TOKEN_SEPARATOR);
+ if (tokens.length < 1) {
+ // A topic must contain at least one token.
+ return false;
+ }
+
+ // Check each token is valid.
+ for (int i = 0; i < tokens.length; i++) {
+ String token = tokens[i];
+ if (!isValidToken(token)) {
+ return false;
+ }
+ }
+
+ // The topic is valid.
+ return true;
+ }
+
+ /**
+ * Check the given token is valid.
+ *
+ * token ::= ( alphanum | "_" | "-" )+
+ *
+ * @param token the token to check.
+ *
+ * @return {@code true} if the given topic token is valid, {@code false}
... 239657 lines suppressed ...