You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ro...@apache.org on 2019/03/28 16:03:40 UTC
[aries] branch trunk updated: [CDI] moved to own repo
https://gitbox.apache.org/repos/asf?p=aries-cdi.git
https://github.com/apache/aries-cdi
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/aries.git
The following commit(s) were added to refs/heads/trunk by this push:
new 09f6a9b [CDI] moved to own repo https://gitbox.apache.org/repos/asf?p=aries-cdi.git https://github.com/apache/aries-cdi
09f6a9b is described below
commit 09f6a9b558510a55791908177b6ad299b79efcb2
Author: Raymond Auge <ro...@apache.org>
AuthorDate: Thu Mar 28 12:03:02 2019 -0400
[CDI] moved to own repo https://gitbox.apache.org/repos/asf?p=aries-cdi.git https://github.com/apache/aries-cdi
---
cdi/LICENSE | 203 ---
cdi/NOTICE | 8 -
cdi/README.md | 23 -
cdi/cdi-bom/LICENSE | 203 ---
cdi/cdi-bom/NOTICE | 8 -
cdi/cdi-bom/pom.xml | 133 --
cdi/cdi-executable/LICENSE | 203 ---
cdi/cdi-executable/NOTICE | 8 -
cdi/cdi-executable/executable.bndrun | 69 -
cdi/cdi-executable/logback.xml | 39 -
cdi/cdi-executable/pom.xml | 99 --
cdi/cdi-extender/LICENSE | 203 ---
cdi/cdi-extender/NOTICE | 8 -
cdi/cdi-extender/bnd.bnd | 16 -
cdi/cdi-extender/pom.xml | 174 ---
.../aries/cdi/container/internal/Activator.java | 297 ----
.../apache/aries/cdi/container/internal/CCR.java | 96 --
.../aries/cdi/container/internal/ChangeCount.java | 90 --
.../internal/bean/ComponentPropertiesBean.java | 161 --
.../cdi/container/internal/bean/ReferenceBean.java | 256 ---
.../cdi/container/internal/command/CDICommand.java | 491 ------
.../internal/container/BeanServiceObjectsImpl.java | 59 -
.../internal/container/BundleContextExtension.java | 39 -
.../container/internal/container/CDIBundle.java | 98 --
.../internal/container/CheckedCallback.java | 36 -
.../internal/container/ComponentContext.java | 147 --
.../internal/container/ConfigurationListener.java | 310 ----
.../internal/container/ContainerBootstrap.java | 165 --
.../internal/container/ContainerDeployment.java | 66 -
.../container/ContainerDeploymentArchive.java | 84 -
.../internal/container/ContainerDiscovery.java | 56 -
.../internal/container/ContainerEnvironment.java | 43 -
.../internal/container/ContainerState.java | 429 ------
.../internal/container/DiscoveryExtension.java | 496 ------
.../internal/container/ExtensionMetadata.java | 41 -
.../internal/container/ExtensionPhase.java | 287 ----
.../internal/container/LoggerExtension.java | 61 -
.../cdi/container/internal/container/Mark.java | 53 -
.../internal/container/MarkedInjectionPoint.java | 58 -
.../aries/cdi/container/internal/container/Op.java | 62 -
.../cdi/container/internal/container/Phase.java | 56 -
.../internal/container/ReferenceSync.java | 213 ---
.../internal/container/RuntimeExtension.java | 563 -------
.../internal/loader/BundleClassLoader.java | 128 --
.../internal/loader/BundleResourcesLoader.java | 136 --
.../cdi/container/internal/model/BeansModel.java | 65 -
.../internal/model/BeansModelBuilder.java | 115 --
.../internal/model/BindBeanServiceObjectsImpl.java | 143 --
.../container/internal/model/BindServiceImpl.java | 200 ---
.../internal/model/BindServiceReferenceImpl.java | 193 ---
.../aries/cdi/container/internal/model/Binder.java | 25 -
.../container/internal/model/CollectionType.java | 91 --
.../cdi/container/internal/model/Component.java | 75 -
.../internal/model/ComponentPropertiesModel.java | 134 --
.../internal/model/ContainerActivator.java | 109 --
.../internal/model/ContainerComponent.java | 156 --
.../internal/model/ExtendedActivationDTO.java | 27 -
.../model/ExtendedActivationTemplateDTO.java | 32 -
.../model/ExtendedComponentInstanceDTO.java | 354 -----
.../model/ExtendedComponentTemplateDTO.java | 24 -
.../internal/model/ExtendedConfigurationDTO.java | 30 -
.../model/ExtendedConfigurationTemplateDTO.java | 104 --
.../internal/model/ExtendedExtensionDTO.java | 27 -
.../model/ExtendedExtensionTemplateDTO.java | 23 -
.../internal/model/ExtendedReferenceDTO.java | 26 -
.../model/ExtendedReferenceTemplateDTO.java | 126 --
.../container/internal/model/FactoryActivator.java | 235 ---
.../container/internal/model/FactoryComponent.java | 137 --
.../internal/model/InstanceActivator.java | 141 --
.../cdi/container/internal/model/OSGiBean.java | 153 --
.../container/internal/model/ReferenceModel.java | 627 --------
.../container/internal/model/SingleActivator.java | 236 ---
.../container/internal/model/SingleComponent.java | 153 --
.../container/internal/provider/CDIProvider.java | 104 --
.../internal/provider/SeContainerInitializer.java | 111 --
.../cdi/container/internal/util/Annotates.java | 232 ---
.../cdi/container/internal/util/Conversions.java | 51 -
.../aries/cdi/container/internal/util/DTOs.java | 325 ----
.../aries/cdi/container/internal/util/Filters.java | 47 -
.../aries/cdi/container/internal/util/Logs.java | 241 ---
.../aries/cdi/container/internal/util/Maps.java | 135 --
.../cdi/container/internal/util/Predicates.java | 54 -
.../cdi/container/internal/util/Reflection.java | 28 -
.../aries/cdi/container/internal/util/SRs.java | 64 -
.../aries/cdi/container/internal/util/Sets.java | 61 -
.../aries/cdi/container/internal/util/Strings.java | 41 -
.../aries/cdi/container/internal/util/Syncro.java | 42 -
.../aries/cdi/container/internal/util/Throw.java | 41 -
.../apache/aries/cdi/container/package-info.java | 90 --
...vax.enterprise.inject.se.SeContainerInitializer | 13 -
.../javax.enterprise.inject.spi.CDIProvider | 13 -
.../Discovery_Ctor_dynamic_greedy_Test2.java | 308 ----
.../Discovery_Ctor_dynamic_reluctant_Test.java | 308 ----
.../Discovery_Ctor_static_greedy_Test.java | 309 ----
.../Discovery_Ctor_static_reluctant_Test.java | 309 ----
.../cdi/container/internal/model/MapsTest.java | 91 --
.../ReferenceModel_BeanServiceObjectsTest.java | 926 -----------
.../model/ReferenceModel_PropertiesTest.java | 506 ------
.../model/ReferenceModel_ServiceReferenceTest.java | 865 -----------
.../internal/model/ReferenceModel_ServiceTest.java | 888 -----------
.../internal/model/ReferenceModel_TupleTest.java | 617 --------
.../internal/phase/CDIBundlePhaseTest.java | 239 ---
.../internal/phase/ConfigurationListenerTest.java | 150 --
.../internal/phase/ContainerBootstrapTest.java | 111 --
.../internal/phase/ContainerReferencesTest.java | 534 -------
.../internal/phase/ExtensionPhaseTest.java | 153 --
.../container/internal/phase/TemplatesTests.java | 449 ------
.../cdi/container/internal/util/Sfl4jLogger.java | 158 --
.../aries/cdi/container/test/AbstractTestBase.java | 36 -
.../aries/cdi/container/test/AnnotatedCache.java | 105 --
.../cdi/container/test/BaseCDIBundleTest.java | 110 --
.../container/test/MockAnnotatedConstructor.java | 93 --
.../cdi/container/test/MockAnnotatedField.java | 94 --
.../cdi/container/test/MockAnnotatedMethod.java | 94 --
.../cdi/container/test/MockAnnotatedParameter.java | 82 -
.../cdi/container/test/MockAnnotatedType.java | 94 --
.../container/test/MockBeanDeploymentArchive.java | 69 -
.../aries/cdi/container/test/MockCdiContainer.java | 89 --
.../test/MockCdiContainerAndComponents.java | 63 -
.../cdi/container/test/MockConfiguration.java | 132 --
.../cdi/container/test/MockInjectionPoint.java | 104 --
.../cdi/container/test/MockServiceReference.java | 171 --
.../container/test/MockServiceRegistration.java | 95 --
.../apache/aries/cdi/container/test/TestUtil.java | 318 ----
.../container/test/beans/ArrayListFooProducer.java | 28 -
.../apache/aries/cdi/container/test/beans/Bar.java | 17 -
.../cdi/container/test/beans/BarAnnotated.java | 74 -
.../container/test/beans/BarBadlyAnnotated.java | 29 -
.../cdi/container/test/beans/BarProducer.java | 42 -
.../cdi/container/test/beans/BarReference.java | 19 -
.../aries/cdi/container/test/beans/BarService.java | 24 -
.../cdi/container/test/beans/BarWithConfig.java | 30 -
.../cdi/container/test/beans/BarWithReference.java | 24 -
.../apache/aries/cdi/container/test/beans/Baz.java | 19 -
.../test/beans/CollectionFooProducer.java | 27 -
.../aries/cdi/container/test/beans/Config.java | 19 -
.../aries/cdi/container/test/beans/Drat.java | 17 -
.../aries/cdi/container/test/beans/FieldFoo.java | 27 -
.../cdi/container/test/beans/FieldListFoo.java | 29 -
.../apache/aries/cdi/container/test/beans/Foo.java | 23 -
.../cdi/container/test/beans/FooAnnotated.java | 42 -
.../cdi/container/test/beans/FooProducer.java | 31 -
.../cdi/container/test/beans/FooReference.java | 19 -
.../aries/cdi/container/test/beans/FooService.java | 27 -
.../cdi/container/test/beans/FooWithConfig.java | 24 -
.../test/beans/FooWithReferenceAndConfig.java | 45 -
.../cdi/container/test/beans/ListFooProducer.java | 27 -
.../cdi/container/test/beans/MethodBindFoo.java | 25 -
.../container/test/beans/MethodBindFooNamed.java | 26 -
.../cdi/container/test/beans/MethodSetFoo.java | 25 -
.../cdi/container/test/beans/ObserverFoo.java | 53 -
.../test/beans/Reference_D_R_M_U_Service.java | 39 -
.../test/beans/Reference_S_R_M_U_Service.java | 32 -
.../beans/ctordynamicgreedy/CtorCollectionFoo.java | 28 -
.../test/beans/ctordynamicgreedy/CtorFoo.java | 26 -
.../test/beans/ctordynamicgreedy/CtorFooBar.java | 27 -
.../test/beans/ctordynamicgreedy/CtorFooFoo.java | 26 -
.../beans/ctordynamicgreedy/CtorFooFooNamed.java | 29 -
.../test/beans/ctordynamicgreedy/CtorFooNamed.java | 27 -
.../beans/ctordynamicgreedy/CtorFooOptional.java | 28 -
.../test/beans/ctordynamicgreedy/CtorListFoo.java | 28 -
.../ctordynamicreluctant/CtorCollectionFoo.java | 29 -
.../test/beans/ctordynamicreluctant/CtorFoo.java | 27 -
.../beans/ctordynamicreluctant/CtorFooBar.java | 28 -
.../beans/ctordynamicreluctant/CtorFooFoo.java | 27 -
.../ctordynamicreluctant/CtorFooFooNamed.java | 30 -
.../beans/ctordynamicreluctant/CtorFooNamed.java | 28 -
.../ctordynamicreluctant/CtorFooOptional.java | 29 -
.../beans/ctordynamicreluctant/CtorListFoo.java | 29 -
.../beans/ctorstaticgreedy/CtorCollectionFoo.java | 27 -
.../test/beans/ctorstaticgreedy/CtorFoo.java | 25 -
.../test/beans/ctorstaticgreedy/CtorFooBar.java | 26 -
.../test/beans/ctorstaticgreedy/CtorFooFoo.java | 25 -
.../beans/ctorstaticgreedy/CtorFooFooNamed.java | 26 -
.../test/beans/ctorstaticgreedy/CtorFooNamed.java | 26 -
.../beans/ctorstaticgreedy/CtorFooOptional.java | 27 -
.../test/beans/ctorstaticgreedy/CtorListFoo.java | 27 -
.../ctorstaticreluctant/CtorCollectionFoo.java | 28 -
.../test/beans/ctorstaticreluctant/CtorFoo.java | 26 -
.../test/beans/ctorstaticreluctant/CtorFooBar.java | 27 -
.../test/beans/ctorstaticreluctant/CtorFooFoo.java | 26 -
.../beans/ctorstaticreluctant/CtorFooFooNamed.java | 27 -
.../beans/ctorstaticreluctant/CtorFooNamed.java | 27 -
.../beans/ctorstaticreluctant/CtorFooOptional.java | 28 -
.../beans/ctorstaticreluctant/CtorListFoo.java | 28 -
cdi/cdi-extender/src/test/resources/logback.xml | 33 -
cdi/cdi-extension-el-jsp/LICENSE | 203 ---
cdi/cdi-extension-el-jsp/NOTICE | 8 -
cdi/cdi-extension-el-jsp/pom.xml | 123 --
.../aries/cdi/extension/el/jsp/ELJSPActivator.java | 56 -
.../aries/cdi/extension/el/jsp/ELJSPExtension.java | 159 --
.../extension/el/jsp/ELJSPExtensionFactory.java | 37 -
.../aries/cdi/extension/el/jsp/package-info.java | 48 -
cdi/cdi-extension-http/LICENSE | 203 ---
cdi/cdi-extension-http/NOTICE | 8 -
cdi/cdi-extension-http/pom.xml | 113 --
.../aries/cdi/extension/http/HttpActivator.java | 56 -
.../aries/cdi/extension/http/HttpExtension.java | 436 ------
.../cdi/extension/http/HttpExtensionFactory.java | 37 -
.../aries/cdi/extension/http/package-info.java | 43 -
cdi/cdi-extension-jndi/LICENSE | 203 ---
cdi/cdi-extension-jndi/NOTICE | 8 -
cdi/cdi-extension-jndi/pom.xml | 100 --
.../aries/cdi/extension/jndi/JndiActivator.java | 67 -
.../aries/cdi/extension/jndi/JndiContext.java | 199 ---
.../aries/cdi/extension/jndi/JndiExtension.java | 61 -
.../cdi/extension/jndi/JndiExtensionFactory.java | 41 -
.../aries/cdi/extension/jndi/package-info.java | 38 -
cdi/cdi-extra/LICENSE | 203 ---
cdi/cdi-extra/NOTICE | 8 -
cdi/cdi-extra/bnd.bnd | 16 -
cdi/cdi-extra/pom.xml | 108 --
.../cdi/extra/propertytypes/EventDelivery.java | 81 -
.../aries/cdi/extra/propertytypes/EventFilter.java | 75 -
.../aries/cdi/extra/propertytypes/EventTopics.java | 75 -
.../cdi/extra/propertytypes/ExportedService.java | 174 ---
.../extra/propertytypes/HttpWhiteboardContext.java | 100 --
.../propertytypes/HttpWhiteboardContextSelect.java | 80 -
.../HttpWhiteboardFilterAsyncSupported.java | 79 -
.../HttpWhiteboardFilterDispatcher.java | 80 -
.../propertytypes/HttpWhiteboardFilterName.java | 79 -
.../propertytypes/HttpWhiteboardFilterPattern.java | 81 -
.../propertytypes/HttpWhiteboardFilterRegex.java | 81 -
.../propertytypes/HttpWhiteboardFilterServlet.java | 81 -
.../propertytypes/HttpWhiteboardListener.java | 60 -
.../propertytypes/HttpWhiteboardResource.java | 98 --
.../HttpWhiteboardServletAsyncSupported.java | 79 -
.../HttpWhiteboardServletErrorPage.java | 81 -
.../HttpWhiteboardServletMultipart.java | 172 ---
.../propertytypes/HttpWhiteboardServletName.java | 81 -
.../HttpWhiteboardServletPattern.java | 81 -
.../extra/propertytypes/HttpWhiteboardTarget.java | 79 -
.../cdi/extra/propertytypes/JSONRequired.java | 93 --
.../extra/propertytypes/JaxrsApplicationBase.java | 81 -
.../propertytypes/JaxrsApplicationSelect.java | 79 -
.../cdi/extra/propertytypes/JaxrsExtension.java | 61 -
.../extra/propertytypes/JaxrsExtensionSelect.java | 79 -
.../cdi/extra/propertytypes/JaxrsMediaType.java | 79 -
.../aries/cdi/extra/propertytypes/JaxrsName.java | 77 -
.../cdi/extra/propertytypes/JaxrsResource.java | 60 -
.../extra/propertytypes/JaxrsWhiteboardTarget.java | 79 -
.../extra/propertytypes/ServiceDescription.java | 71 -
.../cdi/extra/propertytypes/ServiceRanking.java | 71 -
.../cdi/extra/propertytypes/ServiceVendor.java | 71 -
.../cdi/extra/propertytypes/package-info.java | 18 -
cdi/cdi-itests/LICENSE | 203 ---
cdi/cdi-itests/NOTICE | 8 -
cdi/cdi-itests/bnd.bnd | 76 -
cdi/cdi-itests/bnd/basic-beans.bnd | 13 -
cdi/cdi-itests/bnd/services-one.bnd | 13 -
cdi/cdi-itests/bnd/tb1.bnd | 13 -
cdi/cdi-itests/bnd/tb10.bnd | 13 -
cdi/cdi-itests/bnd/tb11.bnd | 13 -
cdi/cdi-itests/bnd/tb12.bnd | 13 -
cdi/cdi-itests/bnd/tb13.bnd | 13 -
cdi/cdi-itests/bnd/tb152_2.bnd | 13 -
cdi/cdi-itests/bnd/tb152_2b.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1a.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1b.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1c.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1d.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1e.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1f.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1g.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1h.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1i.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1j.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1k.bnd | 13 -
cdi/cdi-itests/bnd/tb152_3_1_1l.bnd | 13 -
cdi/cdi-itests/bnd/tb2.bnd | 13 -
cdi/cdi-itests/bnd/tb3.bnd | 14 -
cdi/cdi-itests/bnd/tb5.bnd | 13 -
cdi/cdi-itests/bnd/tb6.bnd | 14 -
cdi/cdi-itests/bnd/tb7.bnd | 13 -
cdi/cdi-itests/bnd/tb8.bnd | 13 -
cdi/cdi-itests/bnd/tb9.bnd | 13 -
cdi/cdi-itests/itest.bndrun | 78 -
cdi/cdi-itests/logback.xml | 41 -
cdi/cdi-itests/pom.xml | 196 ---
.../aries/cdi/test/beans/BeanWithReference.java | 28 -
.../aries/cdi/test/beans/BundleContextBean.java | 41 -
.../aries/cdi/test/beans/CdiEventObserver.java | 47 -
.../cdi/test/beans/ConstructorInjectedService.java | 43 -
.../test/beans/FieldInjectedBundleScopedImpl.java | 86 --
.../beans/FieldInjectedPrototypeScopedImpl.java | 86 --
.../aries/cdi/test/beans/FieldInjectedService.java | 39 -
.../aries/cdi/test/beans/Instance_Optional.java | 48 -
.../cdi/test/beans/Instance_ServiceProperties.java | 65 -
.../cdi/test/beans/Instance_ServiceReference.java | 51 -
.../cdi/test/beans/IntegerServiceProvider.java | 52 -
.../cdi/test/beans/MethodInjectedService.java | 43 -
.../org/apache/aries/cdi/test/beans/PojoImpl.java | 39 -
.../cdi/test/beans/ServiceWithProperties.java | 98 --
.../apache/aries/cdi/test/beans/package-info.java | 24 -
.../aries/cdi/test/cases/AbstractTestCase.java | 290 ----
.../aries/cdi/test/cases/BeanPropertyTypeTest.java | 65 -
.../apache/aries/cdi/test/cases/CdiBeanTests.java | 265 ----
.../aries/cdi/test/cases/CdiContainerTests.java | 75 -
.../aries/cdi/test/cases/CdiExtenderTests.java | 61 -
.../aries/cdi/test/cases/CloseableTracker.java | 32 -
.../aries/cdi/test/cases/ConfigurationTests.java | 236 ---
.../cdi/test/cases/DisableComponentTests.java | 168 --
.../apache/aries/cdi/test/cases/EventsTests.java | 150 --
.../cdi/test/cases/FactoryComponentTests.java | 154 --
.../apache/aries/cdi/test/cases/HttpTestCase.java | 250 ---
.../aries/cdi/test/cases/JndiExtensionTests.java | 87 --
.../cdi/test/cases/OSGiBeanDescriptorTests.java | 75 -
.../cases/OptionalReluctantReferenceTests.java | 231 ---
.../apache/aries/cdi/test/cases/ProducerTest.java | 76 -
.../org/apache/aries/cdi/test/cases/Test152_2.java | 57 -
.../org/apache/aries/cdi/test/cases/Test152_3.java | 75 -
.../apache/aries/cdi/test/cases/Test152_3_1.java | 287 ----
.../apache/aries/cdi/test/cases/Test152_3_1_1.java | 1629 --------------------
.../cdi/test/components/ServiceBundleScope.java | 45 -
.../cdi/test/components/ServicePrototypeScope.java | 42 -
.../cdi/test/components/ServiceSingletonFour.java | 30 -
.../cdi/test/components/ServiceSingletonOne.java | 30 -
.../cdi/test/components/ServiceSingletonThree.java | 30 -
.../cdi/test/components/ServiceSingletonTwo.java | 30 -
.../aries/cdi/test/components/package-info.java | 3 -
.../apache/aries/cdi/test/interfaces/BeanId.java | 30 -
.../aries/cdi/test/interfaces/BeanService.java | 23 -
.../interfaces/BundleContextBeanQualifier.java | 28 -
.../aries/cdi/test/interfaces/BundleScoped.java | 21 -
.../test/interfaces/CdiEventObserverQualifier.java | 28 -
.../test/interfaces/FieldInjectedReference.java | 32 -
.../org/apache/aries/cdi/test/interfaces/Pojo.java | 30 -
.../aries/cdi/test/interfaces/PrototypeScoped.java | 21 -
.../aries/cdi/test/interfaces/SingletonScoped.java | 21 -
.../org/apache/aries/cdi/test/tb1/BeanImpl.java | 45 -
.../cdi/test/tb10/SingleReferenceEventHandler.java | 70 -
.../aries/cdi/test/tb11/OptionalReference_AS.java | 49 -
.../aries/cdi/test/tb11/OptionalReference_FC.java | 49 -
.../aries/cdi/test/tb11/OptionalReference_SC.java | 49 -
.../apache/aries/cdi/test/tb11/package-info.java | 16 -
.../apache/aries/cdi/test/tb12/IntegerManager.java | 51 -
.../cdi/test/tb12/IntegerServiceProvider.java | 52 -
.../apache/aries/cdi/test/tb12/package-info.java | 17 -
.../apache/aries/cdi/test/tb13/CustomContext.java | 47 -
.../apache/aries/cdi/test/tb13/package-info.java | 17 -
.../org/apache/aries/cdi/test/tb152_2/One.java | 26 -
.../org/apache/aries/cdi/test/tb152_2/Two.java | 26 -
.../org/apache/aries/cdi/test/tb152_2b/One.java | 23 -
.../org/apache/aries/cdi/test/tb152_2b/Two.java | 26 -
.../org/apache/aries/cdi/test/tb152_3/One.java | 51 -
.../org/apache/aries/cdi/test/tb152_3/Two.java | 39 -
.../org/apache/aries/cdi/test/tb152_3_1/One.java | 65 -
.../org/apache/aries/cdi/test/tb152_3_1/Three.java | 64 -
.../org/apache/aries/cdi/test/tb152_3_1/Two.java | 64 -
.../cdi/test/tb152_3_1_1a/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1a/ImmediateSingle.java | 32 -
.../aries/cdi/test/tb152_3_1_1a/package-info.java | 16 -
.../cdi/test/tb152_3_1_1b/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1b/ImmediateSingle_C.java | 36 -
.../aries/cdi/test/tb152_3_1_1b/package-info.java | 16 -
.../cdi/test/tb152_3_1_1c/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1c/ImmediateFactory.java | 32 -
.../aries/cdi/test/tb152_3_1_1c/package-info.java | 16 -
.../cdi/test/tb152_3_1_1d/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1d/SingletonSingle.java | 34 -
.../aries/cdi/test/tb152_3_1_1d/package-info.java | 16 -
.../cdi/test/tb152_3_1_1e/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1e/SingletonSingle_C.java | 38 -
.../aries/cdi/test/tb152_3_1_1e/package-info.java | 16 -
.../cdi/test/tb152_3_1_1f/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1f/SingletonFactory.java | 34 -
.../aries/cdi/test/tb152_3_1_1f/package-info.java | 16 -
.../aries/cdi/test/tb152_3_1_1g/BundleSingle.java | 38 -
.../cdi/test/tb152_3_1_1g/ContextObserver.java | 73 -
.../aries/cdi/test/tb152_3_1_1g/package-info.java | 16 -
.../cdi/test/tb152_3_1_1h/BundleSingle_C.java | 42 -
.../cdi/test/tb152_3_1_1h/ContextObserver.java | 73 -
.../aries/cdi/test/tb152_3_1_1h/package-info.java | 16 -
.../aries/cdi/test/tb152_3_1_1i/BundleFactory.java | 38 -
.../cdi/test/tb152_3_1_1i/ContextObserver.java | 73 -
.../aries/cdi/test/tb152_3_1_1i/package-info.java | 16 -
.../cdi/test/tb152_3_1_1j/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1j/PrototypeSingle.java | 38 -
.../aries/cdi/test/tb152_3_1_1j/package-info.java | 16 -
.../cdi/test/tb152_3_1_1k/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1k/PrototypeSingle_C.java | 42 -
.../aries/cdi/test/tb152_3_1_1k/package-info.java | 16 -
.../cdi/test/tb152_3_1_1l/ContextObserver.java | 73 -
.../cdi/test/tb152_3_1_1l/PrototypeFactory.java | 38 -
.../aries/cdi/test/tb152_3_1_1l/package-info.java | 16 -
.../org/apache/aries/cdi/test/tb2/PojoImpl.java | 35 -
.../java/org/apache/aries/cdi/test/tb3/Config.java | 23 -
.../aries/cdi/test/tb3/ConfigurationBeanA.java | 65 -
.../aries/cdi/test/tb3/ConfigurationBeanB.java | 67 -
.../java/org/apache/aries/cdi/test/tb5/Config.java | 23 -
.../aries/cdi/test/tb5/ConfigurationBeanC.java | 66 -
.../org/apache/aries/cdi/test/tb6/BarServlet.java | 68 -
.../org/apache/aries/cdi/test/tb6/FooServlet.java | 54 -
.../org/apache/aries/cdi/test/tb6/RequestData.java | 49 -
.../org/apache/aries/cdi/test/tb6/SessionData.java | 41 -
.../java/org/apache/aries/cdi/test/tb7/Config.java | 23 -
.../aries/cdi/test/tb7/ConfigurationBeanF.java | 64 -
.../apache/aries/cdi/test/tb8/ContainerBean.java | 38 -
.../aries/cdi/test/tb8/SingleComponentBean.java | 37 -
.../test/tb9/ContainerReferenceEventHandler.java | 69 -
cdi/pom.xml | 410 -----
403 files changed, 37643 deletions(-)
diff --git a/cdi/LICENSE b/cdi/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/cdi/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/cdi/NOTICE b/cdi/NOTICE
deleted file mode 100644
index 424644d..0000000
--- a/cdi/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-
-Apache Aries
-Copyright 2009-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
diff --git a/cdi/README.md b/cdi/README.md
deleted file mode 100644
index 6718feb..0000000
--- a/cdi/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Aries CDI Integration
-
-This is an implementation of [OSGi RFC 0193](https://github.com/osgi/design/blob/master/rfcs/rfc0193/rfc-0193-CDI-Integration.pdf).
-
-## License
-
-[Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
-
-## Building From Source
-
-The build uses maven so it should look pretty familiar to most developers.
-
-`mvn clean install`
-
-## Pre-built runtime
-
-This repository contains an [OSGi enRoute](http://enroute.osgi.org/) based, pre-assembled executable jar providing a complete runtime for you to just drop in your CDI bundles. It comes preconfigured with logging, Gogo shell and Felix SCR.
-
-Once you've completed a successfull build, you should be able to execute the command:
-
-`java -jar cdi-itests/target/cdi-executable.jar`
-
-and be presented with a gogo shell prompt ready for you to install a CDI bundle.
diff --git a/cdi/cdi-bom/LICENSE b/cdi/cdi-bom/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/cdi/cdi-bom/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/cdi/cdi-bom/NOTICE b/cdi/cdi-bom/NOTICE
deleted file mode 100644
index 424644d..0000000
--- a/cdi/cdi-bom/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-
-Apache Aries
-Copyright 2009-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
diff --git a/cdi/cdi-bom/pom.xml b/cdi/cdi-bom/pom.xml
deleted file mode 100644
index acf013b..0000000
--- a/cdi/cdi-bom/pom.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<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.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.apache.aries.cdi.bom</artifactId>
- <packaging>pom</packaging>
- <name>Apache Aries CDI - BOM</name>
- <description>Bill Of Materials for Apache Aries CDI.</description>
-
- <scm>
- <connection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-bom</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-bom</developerConnection>
- <url>https://svn.apache.org/viewvc/aries/trunk/cdi/cdi-bom</url>
- </scm>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>javax.ejb-api</artifactId>
- <version>3.2</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extender</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extension.el.jsp</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extension.http</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extension.jndi</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extra</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.spifly</groupId>
- <artifactId>org.apache.aries.spifly.dynamic.framework.extension</artifactId>
- <version>1.2</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <version>1.9.10</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.http.jetty</artifactId>
- <version>4.0.6</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.logback</artifactId>
- <version>1.0.2</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.platform</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.13.200</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.3.2.Final</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-osgi-bundle</artifactId>
- <version>${weld.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
\ No newline at end of file
diff --git a/cdi/cdi-executable/LICENSE b/cdi/cdi-executable/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/cdi/cdi-executable/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/cdi/cdi-executable/NOTICE b/cdi/cdi-executable/NOTICE
deleted file mode 100644
index 424644d..0000000
--- a/cdi/cdi-executable/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-
-Apache Aries
-Copyright 2009-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
diff --git a/cdi/cdi-executable/executable.bndrun b/cdi/cdi-executable/executable.bndrun
deleted file mode 100644
index b9639da..0000000
--- a/cdi/cdi-executable/executable.bndrun
+++ /dev/null
@@ -1,69 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#-runtrace: false
-#-runvm: -Xdebug, "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
-
--standalone: true
--runee: JavaSE-1.8
--runfw: org.eclipse.osgi
--runkeep: true
--runproperties: \
- eclipse.log.enabled=false,\
- logback.configurationFile=file:${.}/logback.xml,\
- org.osgi.service.http.port=8080,\
- osgi.console=
-
--resolve.effective: resolve, active
--runrequires: \
- osgi.identity;filter:='(osgi.identity=javax.ejb-api)',\
- osgi.identity;filter:='(osgi.identity=javax.transaction-api)',\
- osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extension.http)',\
- osgi.identity;filter:='(osgi.identity=org.apache.aries.cdi.extra)',\
- osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)'
-
--runpath: \
- ch.qos.logback.classic,\
- ch.qos.logback.core,\
- org.apache.felix.logback,\
- slf4j.api
-
--runsystempackages: \
- org.slf4j;version=1.7.25,\
- org.slf4j.helpers;version=1.7.25,\
- org.slf4j.spi;version=1.7.25,\
- sun.misc
-
--runbundles: \
- javax.ejb-api;version='[3.2.0,3.2.1)',\
- javax.transaction-api;version='[1.2.0,1.2.1)',\
- jboss-classfilewriter;version='[1.2.3,1.2.4)',\
- org.apache.aries.cdi.extender;version='[1.0.2,1.0.3)',\
- org.apache.aries.cdi.extension.http;version='[1.0.2,1.0.3)',\
- org.apache.aries.cdi.extra;version='[1.0.2,1.0.3)',\
- org.apache.aries.spifly.dynamic.framework.extension;version='[1.2.0,1.2.1)',\
- org.apache.felix.configadmin;version='[1.9.10,1.9.11)',\
- org.apache.felix.gogo.command;version='[1.1.0,1.1.1)',\
- org.apache.felix.gogo.runtime;version='[1.1.2,1.1.3)',\
- org.apache.felix.gogo.shell;version='[1.1.2,1.1.3)',\
- org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\
- org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
- org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-atinject_1.0_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-el_2.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-interceptor_1.2_spec;version='[1.1.0,1.1.1)',\
- org.apache.geronimo.specs.geronimo-jcdi_2.0_spec;version='[1.1.0,1.1.1)',\
- org.jboss.logging.jboss-logging;version='[3.3.2,3.3.3)',\
- org.jboss.weld.osgi-bundle;version='[3.0.5,3.0.6)',\
- org.osgi.service.cdi;version='[1.0.0,1.0.1)',\
- org.osgi.util.function;version='[1.1.0,1.1.1)',\
- org.osgi.util.promise;version='[1.1.0,1.1.1)'
diff --git a/cdi/cdi-executable/logback.xml b/cdi/cdi-executable/logback.xml
deleted file mode 100644
index 407b764..0000000
--- a/cdi/cdi-executable/logback.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<configuration>
- <!-- scan="true" scanPeriod="5 seconds" debug="true"> -->
- <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
- <resetJUL>true</resetJUL>
- </contextListener>
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <!-- <pattern>%d{HH:mm:ss.SSS} [%.15thread] %-5level %logger{36}:%line - %msg%n</pattern> -->
- <pattern>[%.15thread] %-5level %logger{36}:%line - %msg%n</pattern>
- </encoder>
- </appender>
-
- <!-- <logger name="Events.Service.org.apache.aries.cdi" level="INFO"/> -->
- <!-- <logger name="org.apache.aries.cdi" level="DEBUG"/> -->
-
- <logger name="org.eclipse" level="ERROR"/>
- <logger name="org.jboss" level="ERROR"/>
-
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- </root>
-</configuration>
diff --git a/cdi/cdi-executable/pom.xml b/cdi/cdi-executable/pom.xml
deleted file mode 100644
index c44057a..0000000
--- a/cdi/cdi-executable/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<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.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.apache.aries.cdi.executable</artifactId>
- <name>Apache Aries CDI - Executable JAR</name>
- <description>
- A full fledged executable JAR containing Aries CDI and several other
- useful features. Deploy your CDI bundles directly into this runtime.
- </description>
- <packaging>pom</packaging>
-
- <licenses>
- <license>
- <name>ASL 2.0</name>
- <url>https://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-executable</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-executable</developerConnection>
- <url>https://svn.apache.org/viewvc/aries/trunk/cdi/cdi-executable</url>
- </scm>
-
- <properties>
- <gpg.skip>true</gpg.skip>
- <maven.deploy.skip>true</maven.deploy.skip>
- <maven.install.skip>true</maven.install.skip>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.bom</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.gogo.bom</artifactId>
- <version>1.0.2</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <plugins>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-resolver-maven-plugin</artifactId>
- <configuration>
- <bndruns>
- <bndrun>executable.bndrun</bndrun>
- </bndruns>
- <includeDependencyManagement>true</includeDependencyManagement>
- </configuration>
- </plugin>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-export-maven-plugin</artifactId>
- <configuration>
- <bndruns>
- <bndrun>executable.bndrun</bndrun>
- </bndruns>
- <includeDependencyManagement>true</includeDependencyManagement>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
diff --git a/cdi/cdi-extender/LICENSE b/cdi/cdi-extender/LICENSE
deleted file mode 100644
index 6b0b127..0000000
--- a/cdi/cdi-extender/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/cdi/cdi-extender/NOTICE b/cdi/cdi-extender/NOTICE
deleted file mode 100644
index 424644d..0000000
--- a/cdi/cdi-extender/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-
-Apache Aries
-Copyright 2009-2011 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-
diff --git a/cdi/cdi-extender/bnd.bnd b/cdi/cdi-extender/bnd.bnd
deleted file mode 100644
index b11d838..0000000
--- a/cdi/cdi-extender/bnd.bnd
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
--cdiannotations:
--conditionalpackage: \
- org.apache.felix.utils.extender,\
- org.osgi.util.converter
\ No newline at end of file
diff --git a/cdi/cdi-extender/pom.xml b/cdi/cdi-extender/pom.xml
deleted file mode 100644
index 10d2055..0000000
--- a/cdi/cdi-extender/pom.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<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">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>org.apache.aries.cdi.extender</artifactId>
- <name>Apache Aries CDI - CDI Component Runtime (CCR)</name>
- <description>Aries CDI Component Runtime (CCR) implements OSGi CDI Integration Specification 1.0</description>
-
- <licenses>
- <license>
- <name>ASL 2.0</name>
- <url>https://www.apache.org/licenses/LICENSE-2.0</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-extender</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/cdi/cdi-extender</developerConnection>
- <url>https://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.converter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.3_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld</groupId>
- <artifactId>weld-osgi-bundle</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.annotation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.namespace.extender</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.namespace.implementation</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.namespace.service</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.cdi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.cm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.log</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.util.function</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.util.promise</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>javax.ejb-api</artifactId>
- <version>3.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.cdi</groupId>
- <artifactId>org.apache.aries.cdi.extra</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-el_2.2_spec</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>2.13.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/Activator.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/Activator.java
deleted file mode 100644
index b0c7881..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/Activator.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal;
-
-import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
-import static org.osgi.service.cdi.CDIConstants.CDI_CAPABILITY_NAME;
-import static org.osgi.service.cdi.CDIConstants.REQUIREMENT_BEANS_ATTRIBUTE;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Observable;
-import java.util.Observer;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.aries.cdi.container.internal.command.CDICommand;
-import org.apache.aries.cdi.container.internal.container.CDIBundle;
-import org.apache.aries.cdi.container.internal.container.ConfigurationListener;
-import org.apache.aries.cdi.container.internal.container.ContainerBootstrap;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.ExtensionPhase;
-import org.apache.aries.cdi.container.internal.model.ContainerActivator;
-import org.apache.aries.cdi.container.internal.model.ContainerComponent;
-import org.apache.aries.cdi.container.internal.model.FactoryActivator;
-import org.apache.aries.cdi.container.internal.model.FactoryComponent;
-import org.apache.aries.cdi.container.internal.model.SingleActivator;
-import org.apache.aries.cdi.container.internal.model.SingleComponent;
-import org.apache.aries.cdi.container.internal.util.Logs;
-import org.apache.felix.utils.extender.AbstractExtender;
-import org.apache.felix.utils.extender.Extension;
-import org.osgi.annotation.bundle.Header;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.wiring.BundleRequirement;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.service.cdi.runtime.CDIComponentRuntime;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.annotations.RequireConfigurationAdmin;
-import org.osgi.service.log.Logger;
-import org.osgi.service.log.LoggerFactory;
-import org.osgi.util.promise.PromiseFactory;
-import org.osgi.util.tracker.ServiceTracker;
-
-@Header(
- name = Constants.BUNDLE_ACTIVATOR,
- value = "${@class}"
-)
-@RequireConfigurationAdmin
-public class Activator extends AbstractExtender {
-
- private static final Logs _logs = new Logs.Builder(FrameworkUtil.getBundle(Activator.class).getBundleContext()).build();
- private static final Logger _log = _logs.getLogger(Activator.class);
- private static final ThreadGroup _threadGroup = new ThreadGroup("Apache Aries CCR - CDI");
- private static final ExecutorService _executorService = Executors.newFixedThreadPool(
- 1,
- new ThreadFactory() {
-
- @Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(_threadGroup, r, "Aries CCR Thread");
- t.setDaemon(true);
- return t;
- }
-
- }
- );
- private static final PromiseFactory _promiseFactory = new PromiseFactory(_executorService);
- public static final CCR ccr = new CCR(_promiseFactory, _logs);
-
- public Activator() {
- setSynchronous(true);
- }
-
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- if (_log.isDebugEnabled()) {
- _log.debug("CCR starting {}", bundleContext.getBundle());
- }
-
- _command = new CDICommand(ccr);
-
- _bundleContext = bundleContext;
-
- registerCCR();
- registerCDICommand();
-
- super.start(bundleContext);
-
- if (_log.isDebugEnabled()) {
- _log.debug("CCR started {}", bundleContext.getBundle());
- }
- }
-
- private void registerCCR() {
- Dictionary<String, Object> properties = new Hashtable<>();
- properties.put(Constants.SERVICE_CHANGECOUNT, _ccrChangeCount.get());
- properties.put(Constants.SERVICE_DESCRIPTION, "Aries CDI - CDI Component Runtime");
- properties.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
-
- ChangeObserverFactory changeObserverFactory = new ChangeObserverFactory();
-
- _ccrChangeCount.addObserver(changeObserverFactory);
-
- _ccrRegistration = _bundleContext.registerService(
- CDIComponentRuntime.class, changeObserverFactory, properties);
- }
-
- private void registerCDICommand() {
- Dictionary<String, Object> properties = new Hashtable<>();
- properties.put("osgi.command.scope", "cdi");
- properties.put("osgi.command.function", new String[] {"list", "info"});
- properties.put(Constants.SERVICE_DESCRIPTION, "Aries CDI - Gogo Commands");
- properties.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
-
- _commandRegistration = _bundleContext.registerService(Object.class, _command, properties);
- }
-
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- if (_log.isDebugEnabled()) {
- _log.debug("CCR stoping {}", bundleContext.getBundle());
- }
-
- super.stop(bundleContext);
-
- _commandRegistration.unregister();
- _ccrRegistration.unregister();
-
- if (_log.isDebugEnabled()) {
- _log.debug("CCR stoped {}", bundleContext.getBundle());
- }
- }
-
- @Override
- protected Extension doCreateExtension(Bundle bundle) throws Exception {
- if (!requiresCDIExtender(bundle)) {
- return null;
- }
-
- ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> caTracker = new ServiceTracker<>(
- bundle.getBundleContext(), ConfigurationAdmin.class, null);
-
- caTracker.open();
-
- ServiceTracker<LoggerFactory, LoggerFactory> loggerTracker = new ServiceTracker<>(
- bundle.getBundleContext(), LoggerFactory.class, null);
-
- loggerTracker.open();
-
- ContainerState containerState = new ContainerState(
- bundle, _bundleContext.getBundle(), _ccrChangeCount, _promiseFactory, caTracker, _logs);
-
- // the CDI bundle
- return new CDIBundle(ccr, containerState,
- // handle extensions
- new ExtensionPhase(containerState,
- // listen for configurations of the container component
- new ConfigurationListener.Builder(containerState).component(
- // the container component
- new ContainerComponent.Builder(containerState,
- // when dependencies are satisfied activate the container
- new ContainerActivator.Builder(containerState,
- // when the active container bootstraps CDI
- new ContainerBootstrap(
- containerState,
- // when CDI is bootstrapping is complete and is up and running
- // activate the configuration listeners for single and factory components
- new ConfigurationListener.Builder(containerState),
- new SingleComponent.Builder(containerState,
- new SingleActivator.Builder(containerState)),
- new FactoryComponent.Builder(containerState,
- new FactoryActivator.Builder(containerState))
- )
- )
- ).build()
- ).build()
- )
- );
- }
-
- @Override
- protected void debug(Bundle bundle, String msg) {
- if (_log.isTraceEnabled()) {
- _log.trace(msg, bundle);
- }
- }
-
- @Override
- protected void warn(Bundle bundle, String msg, Throwable t) {
- if (_log.isWarnEnabled()) {
- _log.warn(msg, bundle, t);
- }
- }
-
- @Override
- protected void error(String msg, Throwable t) {
- if (_log.isErrorEnabled()) {
- _log.error(msg, t);
- }
- }
-
- private boolean requiresCDIExtender(Bundle bundle) {
- BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
- List<BundleWire> requiredBundleWires = bundleWiring.getRequiredWires(EXTENDER_NAMESPACE);
-
- for (BundleWire bundleWire : requiredBundleWires) {
- Map<String, Object> attributes = bundleWire.getCapability().getAttributes();
-
- if (attributes.containsKey(EXTENDER_NAMESPACE) &&
- attributes.get(EXTENDER_NAMESPACE).equals(CDI_CAPABILITY_NAME)) {
-
- Bundle providerWiringBundle = bundleWire.getProviderWiring().getBundle();
-
- if (providerWiringBundle.equals(_bundleContext.getBundle())) {
- BundleRequirement requirement = bundleWire.getRequirement();
- Map<String, Object> requirementAttributes = requirement.getAttributes();
-
- @SuppressWarnings("unchecked")
- List<String> beans = (List<String>)requirementAttributes.get(REQUIREMENT_BEANS_ATTRIBUTE);
-
- if (beans != null && !beans.isEmpty()) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- private BundleContext _bundleContext;
- private final ChangeCount _ccrChangeCount = new ChangeCount();
- private ServiceRegistration<CDIComponentRuntime> _ccrRegistration;
- private volatile CDICommand _command;
- private ServiceRegistration<?> _commandRegistration;
-
- private class ChangeObserverFactory implements Observer, ServiceFactory<CDIComponentRuntime> {
-
- @Override
- public CDIComponentRuntime getService(
- Bundle bundle,
- ServiceRegistration<CDIComponentRuntime> registration) {
-
- _registrations.add(registration);
-
- return ccr;
- }
-
- @Override
- public void ungetService(
- Bundle bundle, ServiceRegistration<CDIComponentRuntime> registration,
- CDIComponentRuntime service) {
-
- _registrations.remove(registration);
- }
-
- @Override
- public void update(Observable o, Object arg) {
- if (!(o instanceof ChangeCount)) {
- return;
- }
-
- ChangeCount changeCount = (ChangeCount)o;
-
- for (ServiceRegistration<CDIComponentRuntime> registration : _registrations) {
- Dictionary<String, Object> properties = registration.getReference().getProperties();
- properties.put(Constants.SERVICE_CHANGECOUNT, changeCount.get());
- registration.setProperties(properties);
- }
- }
-
- private final List<ServiceRegistration<CDIComponentRuntime>> _registrations = new CopyOnWriteArrayList<>();
-
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/CCR.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/CCR.java
deleted file mode 100644
index 448da2c..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/CCR.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.util.DTOs;
-import org.apache.aries.cdi.container.internal.util.Logs;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.osgi.framework.Bundle;
-import org.osgi.service.cdi.runtime.CDIComponentRuntime;
-import org.osgi.service.cdi.runtime.dto.ContainerDTO;
-import org.osgi.service.cdi.runtime.dto.template.ContainerTemplateDTO;
-import org.osgi.util.promise.PromiseFactory;
-
-public class CCR implements CDIComponentRuntime {
-
- public CCR(PromiseFactory promiseFactory, Logs logs) {
- _promiseFactory = promiseFactory;
- }
-
- public void add(Bundle bundle, ContainerState containerState) {
- _states.put(bundle, containerState);
- }
-
- @Override
- public Collection<ContainerDTO> getContainerDTOs(Bundle... bundles) {
- if ((bundles != null) && (bundles.length > 0)) {
- return call(
- () -> Stream.of(bundles).filter(
- b -> Objects.nonNull(_states.get(b))
- ).map(
- b -> _states.get(b)
- ).map(
- cs -> DTOs.copy(cs.containerDTO(), true)
- ).collect(Collectors.toList())
- );
- }
-
- return call(
- () -> _states.values().stream().map(
- cs -> DTOs.copy(cs.containerDTO(), true)
- ).collect(Collectors.toList())
- );
- }
-
- @Override
- public ContainerTemplateDTO getContainerTemplateDTO(Bundle bundle) {
- return call(
- () -> Optional.ofNullable(_states.get(bundle)).map(
- cs -> DTOs.copy(cs.containerDTO().template, true)
- ).orElse(null)
- );
- }
-
- public ContainerState getContainerState(Bundle bundle) {
- return _states.get(bundle);
- }
-
- public void remove(Bundle bundle) {
- _states.remove(bundle);
- }
-
- public <R> R call(Callable<R> callable) {
- try {
- return _promiseFactory.submit(callable).getValue();
- }
- catch (Exception e) {
- return Throw.exception(e);
- }
- }
-
- private final PromiseFactory _promiseFactory;
- private final Map<Bundle, ContainerState> _states = new ConcurrentHashMap<>();
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/ChangeCount.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/ChangeCount.java
deleted file mode 100644
index b3ff0b5..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/ChangeCount.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal;
-
-import java.util.Observable;
-import java.util.Observer;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.aries.cdi.container.internal.util.Syncro;
-
-public class ChangeCount extends Observable implements Observer {
-
- @Override
- public int hashCode() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.hashCode();
- }
- }
-
- public final long get() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.get();
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.equals(obj);
- }
- }
-
- public final long getAndIncrement() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.getAndIncrement();
- }
- finally {
- setChanged();
- notifyObservers();
- }
- }
-
- public final long incrementAndGet() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.incrementAndGet();
- }
- finally {
- setChanged();
- notifyObservers();
- }
- }
-
- @Override
- public String toString() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.toString();
- }
- }
-
- public long longValue() {
- try (Syncro syncro = _syncro.open()) {
- return _changeCount.longValue();
- }
- }
-
- @Override
- public void update(Observable o, Object arg) {
- if (!(o instanceof ChangeCount)) {
- return;
- }
-
- incrementAndGet();
- }
-
- private final AtomicLong _changeCount = new AtomicLong(1);
- private final Syncro _syncro = new Syncro(true);
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ComponentPropertiesBean.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ComponentPropertiesBean.java
deleted file mode 100644
index 8155ac9..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ComponentPropertiesBean.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Default;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.apache.aries.cdi.container.internal.container.ComponentContext;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Mark;
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
-import org.apache.aries.cdi.container.internal.util.Conversions;
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.osgi.service.cdi.annotations.ComponentProperties;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.cdi.annotations.PID;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-
-public class ComponentPropertiesBean implements Bean<Object> {
-
- public ComponentPropertiesBean(
- ContainerState containerState,
- ComponentTemplateDTO component,
- ExtendedConfigurationTemplateDTO template) {
-
- _containerState = containerState;
- _component = component;
- _template = template;
-
- _qualifiers = Sets.hashSet(ComponentProperties.Literal.INSTANCE, Default.Literal.INSTANCE);
- _types = Sets.hashSet(_template.injectionPointType, Object.class);
-
- if (_template.pid != null) {
- _qualifiers.add(PID.Literal.of(_template.pid, _template.policy));
- }
- }
-
- @Override
- public Object create(CreationalContext<Object> creationalContext) {
- Map<String, Object> properties;
- ExtendedActivationDTO current = ComponentContext.With.current();
-
- if (current == null) {
- properties = _containerState.containerDTO().components.get(0).instances.get(0).properties;
- }
- else {
- properties = current.instance.properties;
- }
-
- Objects.requireNonNull(properties);
-
- if (_injectionPoint != null) {
- return Conversions.convert(properties).to(_injectionPoint.getType());
- }
-
- return Conversions.convert(properties).to(_template.injectionPointType);
- }
-
- @Override
- public void destroy(Object instance, CreationalContext<Object> creationalContext) {
- }
-
- @Override
- public Set<Type> getTypes() {
- return _types;
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- return _qualifiers;
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- ExtendedActivationDTO current = ComponentContext.With.current();
-
- if (current == null) {
- return ApplicationScoped.class;
- }
-
- return ComponentScoped.class;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes() {
- return Collections.emptySet();
- }
-
- @Override
- public boolean isAlternative() {
- return false;
- }
-
- @Override
- public Class<?> getBeanClass() {
- return _template.beanClass;
- }
-
- @Override
- public Set<InjectionPoint> getInjectionPoints() {
- return Collections.emptySet();
- }
-
- @Override
- public boolean isNullable() {
- return false;
- }
-
- public void setInjectionPoint(InjectionPoint injectionPoint) {
- _injectionPoint = injectionPoint;
- }
-
- public void setMark(Mark mark) {
- _qualifiers.add(mark);
- }
-
- @Override
- public String toString() {
- if (_string == null) {
- _string = "ConfigurationBean[" + ((_template.pid == null)?_component.name:_template.pid) + "]";
- }
- return _string;
- }
-
- private final ComponentTemplateDTO _component;
- private final ContainerState _containerState;
- private final Set<Annotation> _qualifiers;
- private final ExtendedConfigurationTemplateDTO _template;
- private final Set<Type> _types;
- private volatile String _string;
- private volatile InjectionPoint _injectionPoint;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ReferenceBean.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ReferenceBean.java
deleted file mode 100644
index c1ac4b8..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ReferenceBean.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.bean;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.stream.Collectors;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.Default;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Provider;
-
-import org.apache.aries.cdi.container.internal.container.Mark;
-import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceTemplateDTO;
-import org.apache.aries.cdi.container.internal.util.Logs;
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.ReferencePolicy;
-import org.osgi.service.cdi.ReferencePolicyOption;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.cdi.annotations.Reference;
-import org.osgi.service.cdi.annotations.Reluctant;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.log.Logger;
-
-public class ReferenceBean implements Bean<Object> {
-
- public ReferenceBean(
- Logs logs,
- ComponentTemplateDTO component,
- ExtendedReferenceTemplateDTO template) {
-
- _component = component;
- _template = template;
-
- _log = logs.getLogger(getClass());
- _qualifiers = Sets.hashSet(Reference.Literal.of(Object.class, ""), Default.Literal.INSTANCE);
-
- if (_template.policyOption == ReferencePolicyOption.RELUCTANT) {
- _qualifiers.add(Reluctant.Literal.INSTANCE);
- }
-
- _types = Sets.hashSet(_template.injectionPointType, Object.class);
- }
-
- @Override
- public Object create(CreationalContext<Object> c) {
- Objects.requireNonNull(_bm);
- Objects.requireNonNull(_snapshot);
-
- _log.debug(l -> l.debug("Creating {}", this));
-
- final SortedMap<ServiceReference<Object>, Object> tracked = _snapshot.serviceTracker.getTracked();
-
- if (_template.collectionType == CollectionType.BINDER_SERVICE ||
- _template.collectionType == CollectionType.BINDER_REFERENCE ||
- _template.collectionType == CollectionType.BINDER_BEAN_SERVICE_OBJECTS) {
-
- return _snapshot.binder;
- }
- else if (_template.policy == ReferencePolicy.DYNAMIC) {
- if (_template.maximumCardinality == MaximumCardinality.MANY) {
- return new Provider<List<Object>>() {
- @Override
- public List<Object> get() {
- return tracked.values().stream().map(
- s -> decorate(c, s)
- ).collect(Collectors.toList());
- }
- };
- }
- else if (_template.minimumCardinality == 0) {
- return new Provider<Optional<Object>>() {
- @Override
- public Optional<Object> get() {
- Iterator<Object> iterator = tracked.values().iterator();
- if (iterator.hasNext()) {
- return Optional.of(decorate(c, iterator.next()));
- }
- return Optional.empty();
- }
- };
- }
- else {
- return new Provider<Object>() {
- @Override
- public Object get() {
- Iterator<Object> iterator = tracked.values().iterator();
- if (iterator.hasNext()) {
- return decorate(c, iterator.next());
- }
- return null;
- }
- };
- }
- }
- else {
- if (_template.maximumCardinality == MaximumCardinality.MANY) {
- return tracked.values().stream().map(
- s -> decorate(c, s)
- ).collect(Collectors.toList());
- }
- else if (_template.minimumCardinality == 0) {
- Iterator<Object> iterator = tracked.values().iterator();
- if (iterator.hasNext()) {
- return Optional.of(decorate(c, iterator.next()));
- }
- return Optional.empty();
- }
- else {
- Iterator<Object> iterator = tracked.values().iterator();
- if (iterator.hasNext()) {
- return decorate(c, iterator.next());
- }
- return null;
- }
- }
- }
-
- private <S> S decorate(CreationalContext<S> c, S s) {
- return s;
-
-// TODO do we want to support decorators/interceptors on in-bound services one day???
-// ==================================================================================
-
-// if (s == null) return null;
-//
-// List<javax.enterprise.inject.spi.Decorator<?>> decorators = _bm.resolveDecorators(
-// Collections.singleton(_template.serviceClass),
-// new Annotation[0]);
-//
-// if (decorators.isEmpty()) {
-// return s;
-// }
-//
-// org.jboss.weld.manager.BeanManagerImpl bmi =
-// ((org.jboss.weld.bean.builtin.BeanManagerProxy)_bm).delegate();
-// org.jboss.weld.injection.CurrentInjectionPoint cip = bmi.getServices().get(
-// org.jboss.weld.injection.CurrentInjectionPoint.class);
-// InjectionPoint ip = cip.peek();
-// return org.jboss.weld.util.Decorators.getOuterDelegate(
-// (Bean<S>)this, s, c, (Class<S>)_template.serviceClass,
-// (org.jboss.weld.injection.EmptyInjectionPoint.INSTANCE.equals(ip) ? null : ip),
-// bmi, decorators);
- }
-
- @Override
- public void destroy(Object instance, CreationalContext<Object> creationalContext) {
- }
-
- @Override
- public Class<?> getBeanClass() {
- return _template.beanClass;
- }
-
- @Override
- public Set<InjectionPoint> getInjectionPoints() {
- return Collections.emptySet();
- }
-
- @Override
- public String getName() {
- return null;//_template.name;
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- return _qualifiers;
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- if (_component.type == ComponentType.CONTAINER) {
- return Dependent.class;
- }
- return ComponentScoped.class;
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes() {
- return Collections.emptySet();
- }
-
- @Override
- public Set<Type> getTypes() {
- return _types;
- }
-
- @Override
- public boolean isAlternative() {
- return false;
- }
-
- @Override
- public boolean isNullable() {
- return false;
- }
-
- public void setMark(Mark mark) {
- _qualifiers.add(mark);
- _string = null; // invalidate the toString
- }
-
- public void setReferenceDTO(ExtendedReferenceDTO snapshot) {
- _snapshot = snapshot;
- }
-
- public void setBeanManager(BeanManager bm) {
- _bm = bm;
- }
-
- @Override
- public String toString() {
- if (_string == null) {
- _string = "ReferenceBean[" + _template.name + ", " + _template.injectionPointType + ", " + getScope().getSimpleName() + ", " + _qualifiers + "]";
- }
- return _string;
- }
-
- private volatile BeanManager _bm;
- private final ComponentTemplateDTO _component;
- private final Logger _log;
- private final Set<Annotation> _qualifiers;
- private volatile ExtendedReferenceDTO _snapshot;
- private volatile String _string;
- private final ExtendedReferenceTemplateDTO _template;
- private final Set<Type> _types;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/command/CDICommand.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/command/CDICommand.java
deleted file mode 100644
index 8631e3a..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/command/CDICommand.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.command;
-
-import static java.util.stream.Collectors.*;
-
-import java.util.Collection;
-import java.util.Formatter;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.apache.aries.cdi.container.internal.CCR;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.runtime.dto.ActivationDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentInstanceDTO;
-import org.osgi.service.cdi.runtime.dto.ConfigurationDTO;
-import org.osgi.service.cdi.runtime.dto.ContainerDTO;
-import org.osgi.service.cdi.runtime.dto.ReferenceDTO;
-import org.osgi.service.cdi.runtime.dto.template.ActivationTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
-
-public class CDICommand {
-
- public CDICommand(CCR ccr) {
- _ccr = ccr;
- }
-
- public String info(Bundle bundle) {
- try (Formatter f = new Formatter()) {
- Collection<ContainerDTO> containerDTOs = _ccr.getContainerDTOs(bundle);
-
- if (containerDTOs.isEmpty()) {
- f.format(NO_BUNDLES);
- return f.toString();
- }
-
- list0(f, containerDTOs.iterator().next(), false, true);
-
- return f.toString();
- }
- }
-
- public String list(Bundle... bundles) {
- try (Formatter f = new Formatter()) {
- Collection<ContainerDTO> containerDTOs = _ccr.getContainerDTOs(bundles);
-
- if (containerDTOs.isEmpty()) {
- f.format(NO_BUNDLES);
- return f.toString();
- }
-
- List<ContainerDTO> containerDTOList = containerDTOs.stream().sorted(
- (a, b) -> Long.compare(a.bundle.id,b.bundle.id)
- ).collect(toList());
-
- for (Iterator<ContainerDTO> itr = containerDTOList.iterator(); itr.hasNext();) {
- ContainerDTO containerDTO = itr.next();
-
- list0(f, containerDTO, itr.hasNext(), false);
- }
-
- return f.toString();
- }
- }
-
- private void list0(Formatter f, ContainerDTO containerDTO, boolean hasNext, boolean verbose) {
- String curb = hasNext ? TLLS : CLLS;
- String prefix = hasNext ? PSSSSSSS : SSSSSSSS;
-
- f.format(
- "%s%s[%s]%n",
- curb,
- containerDTO.bundle.symbolicName,
- containerDTO.bundle.id);
-
- f.format(
- "%s%sCOMPONENTS%n",
- (hasNext ? PSSS : SSSS),
- curb);
-
- Map<Boolean, List<ComponentTemplateDTO>> componentTemplateDTOs = containerDTO.template.components.stream().collect(
- partitioningBy(c -> c.type == ComponentType.CONTAINER)
- );
-
- ComponentTemplateDTO componentTemplateDTO = componentTemplateDTOs.get(Boolean.TRUE).get(0);
-
- List<ComponentTemplateDTO> singleAndFactory = componentTemplateDTOs.get(Boolean.FALSE);
-
- list0(
- f,
- containerDTO,
- componentTemplateDTO,
- prefix,
- !singleAndFactory.isEmpty(),
- !singleAndFactory.isEmpty(),
- verbose);
-
- for (Iterator<ComponentTemplateDTO> itr2 = singleAndFactory.iterator(); itr2.hasNext();) {
- componentTemplateDTO = itr2.next();
-
- list0(
- f,
- containerDTO,
- componentTemplateDTO,
- prefix,
- itr2.hasNext(),
- false, verbose);
- }
- }
-
- private void list0(
- Formatter f, ContainerDTO containerDTO, ComponentTemplateDTO componentTemplateDTO, String prefix,
- boolean hasNext, boolean curb, boolean verbose) {
- Map<Boolean, List<ConfigurationTemplateDTO>> configMap = configMap(componentTemplateDTO);
-
- if (verbose) {
- f.format(
- "%s%sNAME: %s%n",
- prefix,
- (hasNext ? TLLS : CLLS),
- componentTemplateDTO.name);
- f.format(
- "%s%s%sTYPE: %s%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS,
- componentTemplateDTO.type);
- }
- else {
- f.format(
- "%s%sNAME: %s (%s%s)%n",
- prefix,
- (hasNext ? TLLS : CLLS),
- componentTemplateDTO.name,
- componentTemplateDTO.type,
- factoryPid(configMap));
- }
-
- ComponentDTO componentDTO = containerDTO.components.stream().filter(
- c -> c.template.name.equals(componentTemplateDTO.name)
- ).findFirst().orElse(null);
-
- if ((componentDTO != null) && !componentDTO.instances.isEmpty()) {
- Iterator<ComponentInstanceDTO> itr3 = componentDTO.instances.iterator();
-
- for (;itr3.hasNext();) {
- ComponentInstanceDTO instanceDTO = itr3.next();
-
- formatInstance(
- f,
- prefix,
- componentDTO,
- instanceDTO,
- pids(instanceDTO, configMap),
- hasNext,
- itr3.hasNext(),
- verbose);
- }
- }
- else {
- formatInstance(
- f,
- prefix,
- componentDTO,
- null,
- configMap.get(Boolean.FALSE).stream().map(c -> c.pid).collect(toList()).toString(),
- hasNext,
- false,
- verbose);
- }
- }
-
- private void formatInstance(
- Formatter f, String prefix, ComponentDTO componentDTO,
- ComponentInstanceDTO instanceDTO, String pids,
- boolean hasNext, boolean hasNext2, boolean verbose) {
-
- if (verbose) {
- f.format(
- "%s%s%sBEANS: %s%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS,
- componentDTO.template.beans.toString());
-
- f.format(
- "%s%s%sCONFIGURATIONS%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS);
-
- for (Iterator<ConfigurationTemplateDTO> itr = componentDTO.template.configurations.iterator();itr.hasNext();) {
- ConfigurationTemplateDTO conf = itr.next();
-
- ConfigurationDTO configurationDTO = null;
-
- if (instanceDTO != null) {
- configurationDTO = instanceDTO.configurations.stream().filter(
- c -> c.template.maximumCardinality == conf.maximumCardinality &&
- c.template.pid == conf.pid &&
- c.template.policy == conf.policy
- ).findFirst().orElse(null);
- }
-
- f.format(
- "%s%s%sPID: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? TLLS : CLLS),
- (configurationDTO != null ? configurationDTO.properties.get(Constants.SERVICE_PID) + STAR : conf.pid));
- f.format(
- "%s%s%s%sPOLICY: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSS : SSSS),
- ((conf.maximumCardinality == MaximumCardinality.MANY) ? TLLS : CLLS),
- conf.policy);
-
- if (conf.maximumCardinality == MaximumCardinality.MANY) {
- f.format(
- "%s%s%sFACTORY PID: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- conf.pid);
- }
- }
-
- if (instanceDTO != null) {
- f.format(
- "%s%s%sCOMPONENT PROPERTIES*%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS);
-
- for (Iterator<String> itr = instanceDTO.properties.keySet().iterator(); itr.hasNext();) {
- String key = itr.next();
-
- f.format(
- "%s%s%s%s=%s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? TLLS : CLLS),
- key,
- instanceDTO.properties.get(key));
- }
- }
-
- if (!componentDTO.template.references.isEmpty()) {
- f.format(
- "%s%s%sREFERENCES%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS);
-
- for (Iterator<ReferenceTemplateDTO> itr = componentDTO.template.references.iterator(); itr.hasNext();) {
- ReferenceTemplateDTO dto = itr.next();
-
- ReferenceDTO referenceDTO = null;
-
- if (instanceDTO != null) {
- referenceDTO = instanceDTO.references.stream().filter(
- r -> r.template.maximumCardinality == dto.maximumCardinality &&
- r.template.minimumCardinality == dto.minimumCardinality &&
- r.template.name == dto.name &&
- r.template.policy == dto.policy &&
- r.template.policyOption == dto.policyOption &&
- r.template.serviceType == dto.serviceType &&
- r.template.targetFilter == dto.targetFilter
- ).findFirst().orElse(null);
- }
-
- f.format(
- "%s%s%sNAME: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? TLLS : CLLS),
- dto.name);
- f.format(
- "%s%s%sSERVICE TYPE: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- dto.serviceType);
- f.format(
- "%s%s%sTARGET FILTER: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- (referenceDTO != null ? referenceDTO.targetFilter + STAR : dto.targetFilter));
- f.format(
- "%s%s%sMAX CARDINALITY: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- dto.maximumCardinality);
- f.format(
- "%s%s%sMIN CARDINALITY: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- (referenceDTO != null ? referenceDTO.minimumCardinality + STAR : dto.minimumCardinality));
- f.format(
- "%s%s%sPOLICY: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSTLLS : SSSSTLLS),
- dto.policy);
- f.format(
- "%s%s%s%sPOLICY OPTION: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSS : SSSS),
- (referenceDTO != null ? TLLS : CLLS),
- dto.policyOption);
-
- if (referenceDTO != null) {
- f.format(
- "%s%s%sMATCHES: %s*%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSCLLS : SSSSCLLS),
- referenceDTO.matches);
- }
- }
- }
-
- if (!componentDTO.template.activations.isEmpty()) {
- f.format(
- "%s%s%sACTIVATIONS%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- TLLS);
-
- for (Iterator<ActivationTemplateDTO> itr = componentDTO.template.activations.iterator(); itr.hasNext();) {
- ActivationTemplateDTO dto = itr.next();
-
- ActivationDTO activationDTO = null;
-
- if (instanceDTO != null) {
- activationDTO = instanceDTO.activations.stream().filter(
- a -> a.template.properties.equals(dto.properties) &&
- a.template.scope == dto.scope &&
- a.template.serviceClasses.equals(dto.serviceClasses)
- ).findFirst().orElse(null);
- }
-
- f.format(
- "%s%s%sSERVICE TYPES: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? TLLS : CLLS),
- dto.serviceClasses);
- f.format(
- "%s%s%s%sSERVICE SCOPE: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSS : SSSS),
- (activationDTO != null ? TLLS : CLLS),
- dto.scope.toString().toLowerCase());
-
- if (activationDTO != null) {
- f.format(
- "%s%s%sSERVICE REFERENCE: %s%n",
- prefix,
- (hasNext ? PSSSPSSS : SSSSPSSS),
- (itr.hasNext() ? PSSSCLLS : SSSSCLLS),
- activationDTO.service + STAR);
- }
- }
- }
-
- f.format(
- "%s%s%sSTATE: %s*%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- (hasNext2 ? TLLS : CLLS),
- state(componentDTO));
-
- return;
- }
-
- f.format(
- "%s%s%sSTATE: %s %s%n",
- prefix,
- (hasNext ? PSSS : SSSS),
- (hasNext2 ? TLLS : CLLS),
- state(componentDTO),
- pids);
- }
-
- private String pids(
- ComponentInstanceDTO instanceDTO,
- Map<Boolean, List<ConfigurationTemplateDTO>> configMap) {
-
- List<String> resolvedPids = instanceDTO.configurations.stream().map(
- c -> c.properties
- ).filter(Objects::nonNull).map(
- p -> (String)p.get(Constants.SERVICE_PID)
- ).collect(toList());
-
- return configMap.values().stream().flatMap(v -> v.stream()).map(c -> c.pid).map(
- c -> {
- String pid = resolvedPids.stream().filter(
- rp -> rp.startsWith(c + '~') || rp.startsWith(c + '.')
- ).findFirst().orElse(null);
-
- if (pid != null) {
- return pid + STAR;
- }
- else if (resolvedPids.stream().anyMatch(rp -> rp.equals(c))) {
- return c + STAR;
- }
- return c;
- }
- ).collect(toList()).toString();
- }
-
- private Map<Boolean, List<ConfigurationTemplateDTO>> configMap(ComponentTemplateDTO componentTemplateDTO) {
- return componentTemplateDTO.configurations.stream().filter(
- c -> c.pid != null
- ).collect(
- partitioningBy(c -> c.maximumCardinality == MaximumCardinality.MANY)
- );
- }
-
- private String factoryPid(Map<Boolean, List<ConfigurationTemplateDTO>> configMap) {
- return configMap.get(Boolean.TRUE).stream().map(
- c -> c.pid
- ).findFirst().map(
- c -> EQUAL + c
- ).orElse(BLANK);
- }
-
- private Object state(ComponentDTO componentDTO) {
- if (componentDTO == null) {
- return NULL;
- }
- else if (!componentDTO.enabled) {
- return DISABLED;
- }
- else if (componentDTO.instances.size() == 0) {
- return WAITING;
- }
- return ACTIVE;
- }
-
- private static final String BLANK = "";
- private static final String ACTIVE = "active";
- private static final String DISABLED = "disabled";
- private static final String EQUAL = "=";
- private static final String NULL = "null";
- private static final String STAR = "*";
- private static final String WAITING = "waiting";
- private static final String CLLS = "└── ";
- private static final String PSSS = "│   ";
- private static final String SSSS = "Â Â Â Â ";
- private static final String TLLS = "├── ";
- private static final String SSSSSSSS = "Â Â Â Â Â Â Â Â ";
- private static final String PSSSSSSS = "│       ";
- private static final String PSSSPSSS = "│   │   ";
- private static final String PSSSTLLS = "│   ├── ";
- private static final String SSSSTLLS = "    ├── ";
- private static final String SSSSPSSS = "    │   ";
- private static final String SSSSCLLS = "    └── ";
- private static final String PSSSCLLS = "│   └── ";
- private static final String NO_BUNDLES = "No matching CDI bundles";
-
- private final CCR _ccr;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BeanServiceObjectsImpl.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BeanServiceObjectsImpl.java
deleted file mode 100644
index c5b9a92..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BeanServiceObjectsImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.osgi.framework.ServiceObjects;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.reference.BeanServiceObjects;
-
-public class BeanServiceObjectsImpl<T> implements BeanServiceObjects<T> {
-
- public BeanServiceObjectsImpl(ServiceObjects<T> so) {
- _so = so;
- }
-
- public void close() {
- _objects.removeIf(
- o -> {
- _so.ungetService(o);
- return true;
- }
- );
- }
-
- @Override
- public T getService() {
- T service = _so.getService();
- _objects.add(service);
- return service;
- }
-
- @Override
- public ServiceReference<T> getServiceReference() {
- return _so.getServiceReference();
- }
-
- @Override
- public void ungetService(T service) {
- _objects.remove(service);
- _so.ungetService(service);
- }
-
- private final Set<T> _objects = ConcurrentHashMap.newKeySet();
- private final ServiceObjects<T> _so;
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BundleContextExtension.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BundleContextExtension.java
deleted file mode 100644
index 50ad245..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/BundleContextExtension.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.configurator.BeanConfigurator;
-
-import org.osgi.framework.BundleContext;
-
-public class BundleContextExtension implements Extension {
-
- public BundleContextExtension(BundleContext bundleContext) {
- _bundleContext = bundleContext;
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager manager) {
- BeanConfigurator<BundleContext> bean = abd.addBean();
- bean.addType(BundleContext.class);
- bean.createWith(c -> _bundleContext);
- }
-
- private final BundleContext _bundleContext;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CDIBundle.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CDIBundle.java
deleted file mode 100644
index c9816bd..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CDIBundle.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import org.apache.aries.cdi.container.internal.CCR;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.apache.felix.utils.extender.Extension;
-import org.osgi.service.log.Logger;
-
-public class CDIBundle extends Phase implements Extension {
-
- public CDIBundle(CCR ccr, ContainerState containerState, Phase next) {
- super(containerState, next);
- _ccr = ccr;
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- containerState.closing();
-
- return next.map(
- next -> {
- submit(next.closeOp(), next::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in cdibundle CLOSE on {}", bundle(), f));
-
- error(f);
- }
- );
-
- _ccr.remove(bundle());
-
- return true;
- }
- ).orElse(true);
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Op.Type.INIT, bundle().toString());
- }
-
- @Override
- public void destroy() throws Exception {
- close();
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- return next.map(
- next -> {
- _ccr.add(containerState.bundle(), containerState);
-
- submit(next.openOp(), next::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in cdibundle OPEN on {}", bundle(), f));
-
- error(f);
- }
- );
-
- return true;
- }
- ).orElse(true);
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Op.Type.INIT, bundle().toString());
- }
-
- @Override
- public void start() throws Exception {
- open();
- }
-
- private final CCR _ccr;
- private final Logger _log;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CheckedCallback.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CheckedCallback.java
deleted file mode 100644
index 5301cb8..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/CheckedCallback.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.function.Predicate;
-
-import org.osgi.util.promise.Failure;
-import org.osgi.util.promise.Promise;
-import org.osgi.util.promise.Success;
-
-public interface CheckedCallback<T, R> extends Failure, Predicate<Op>, Success<T, R> {
-
- @Override
- @SuppressWarnings("unchecked")
- public default Promise<R> call(Promise<T> resolved) throws Exception {
- return (Promise<R>)resolved;
- }
-
- @Override
- public default void fail(Promise<?> resolved) throws Exception {
- resolved.getFailure().printStackTrace();
- }
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ComponentContext.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ComponentContext.java
deleted file mode 100644
index ad321dc..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ComponentContext.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationDTO;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.cdi.runtime.dto.ActivationDTO;
-
-public class ComponentContext implements Context {
-
- @SuppressWarnings("unchecked")
- public void destroy() {
- if (!isActive()) return;
-
- Map<Class<?>, BeanInstance<?>> map = _beans.computeIfAbsent(
- _componentModel.get(), k -> new ConcurrentHashMap<>());
-
- if (map == null) {
- return;
- }
-
- for (BeanInstance<?> beanInstance : map.values()) {
- beanInstance.getBean().destroy(beanInstance.getInstance(), beanInstance.getCreationalContext());
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T> T get(Contextual<T> contextual) {
- if (!isActive()) return null;
-
- @SuppressWarnings("rawtypes")
- Bean bean = (Bean)contextual;
- Class<?> beanClass = bean.getBeanClass();
-
- Map<Class<?>, BeanInstance<?>> map = _beans.computeIfAbsent(
- _componentModel.get(), k -> new ConcurrentHashMap<>());
-
- if (map.containsKey(beanClass)) {
- return (T)map.get(beanClass).getInstance();
- }
-
- return null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
- if (!isActive()) return null;
-
- @SuppressWarnings("rawtypes")
- Bean bean = (Bean)contextual;
- Class<?> beanClass = bean.getBeanClass();
-
- Map<Class<?>, BeanInstance<?>> map = _beans.computeIfAbsent(
- _componentModel.get(), k -> new ConcurrentHashMap<>());
-
- if (map.containsKey(beanClass)) {
- return (T)map.get(beanClass).getInstance();
- }
-
- T instance = (T) bean.create(creationalContext);
-
- map.put(beanClass, new BeanInstance<>(bean, creationalContext, instance));
-
- return instance;
- }
-
- @Override
- public Class<? extends Annotation> getScope() {
- return ComponentScoped.class;
- }
-
- @Override
- public boolean isActive() {
- return _componentModel.get() != null;
- }
-
- private static final Map<ActivationDTO, Map<Class<?>, BeanInstance<?>>> _beans = new ConcurrentHashMap<>();
- private static final ThreadLocal<ExtendedActivationDTO> _componentModel = new ThreadLocal<>();
-
- public static class With implements AutoCloseable {
-
- public With(ExtendedActivationDTO activationDTO) {
- _componentModel.set(activationDTO);
- }
-
- @Override
- public void close() {
- _componentModel.set(null);
- }
-
- public static ExtendedActivationDTO current() {
- return _componentModel.get();
- }
-
- }
-
- @SuppressWarnings("rawtypes")
- private class BeanInstance<T> {
-
- public BeanInstance(Bean<T> bean, CreationalContext<T> creationalContext, T instance) {
- _bean = bean;
- _creationalContext = creationalContext;
- _instance = instance;
- }
-
- public Bean getBean() {
- return _bean;
- }
-
- public CreationalContext<T> getCreationalContext() {
- return _creationalContext;
- }
-
- public T getInstance() {
- return _instance;
- }
-
- private final Bean<T> _bean;
- private final CreationalContext<T> _creationalContext;
- private final T _instance;
-
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ConfigurationListener.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ConfigurationListener.java
deleted file mode 100644
index 9a89301..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ConfigurationListener.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Objects;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.model.Component;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentInstanceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationDTO;
-import org.apache.aries.cdi.container.internal.util.Maps;
-import org.apache.aries.cdi.container.internal.util.Predicates;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.jboss.weld.exceptions.IllegalArgumentException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.cm.ConfigurationEvent;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Promise;
-
-public class ConfigurationListener extends Phase implements org.osgi.service.cm.ConfigurationListener {
-
- public static class Builder {
-
- public Builder(ContainerState containerState) {
- _containerState = containerState;
- }
-
- public Builder component(Component component) {
- _component = component;
- return this;
- }
-
- public ConfigurationListener build() {
- Objects.requireNonNull(_component);
- return new ConfigurationListener(_containerState, _component);
- }
-
- private Component _component;
- private final ContainerState _containerState;
-
- }
-
- protected ConfigurationListener(
- ContainerState containerState,
- Component component) {
-
- super(containerState, component);
- _component = component;
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- if (_listenerService != null) {
- _listenerService.unregister();
- _listenerService = null;
- }
-
- return next.map(
- next -> {
- submit(next.closeOp(), next::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Failure in configuration listener close on {}", next, f));
-
- error(f);
- }
- );
-
- return true;
- }
- ).orElse(true);
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.CONFIGURATION_LISTENER, _component.template().name);
- }
-
- @Override
- public void configurationEvent(ConfigurationEvent event) {
- next.map(next -> (Component)next).ifPresent(
- next -> next.configurationTemplates().stream().filter(
- t -> Predicates.isMatchingConfiguration(event).test(t)
- ).findFirst().ifPresent(
- t -> {
- String eventString = Arrays.asList(event.getPid(), event.getFactoryPid(), type(event)).toString();
-
- Promise<Boolean> result = containerState.submit(
- Op.of(Mode.OPEN, Type.CONFIGURATION_EVENT, eventString),
- () -> {
- _log.debug(l -> l.debug("CCR Event {} matched {} because of {}", eventString, _component.template().name, _component.template().configurations));
- processEvent(next, t, event);
- return true;
- }
- );
-
- try {
- result.getValue();
- }
- catch (Exception e) {
- Throw.exception(e);
- }
- }
- )
- );
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- if (containerState.bundleContext() == null) {
- // this bundle was already removed
- return false;
- }
-
- Dictionary<String, Object> properties = new Hashtable<>();
- properties.put("name", toString());
- properties.put(Constants.SERVICE_DESCRIPTION, "Aries CDI - Configuration Listener for " + containerState.bundle());
- properties.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
-
- _listenerService = containerState.bundleContext().registerService(
- org.osgi.service.cm.ConfigurationListener.class, this, properties);
-
- return next.map(next -> (Component)next).map(
- component -> {
- submit(component.openOp(), component::open).then(
- s -> {
- component.configurationTemplates().stream().filter(
- ct -> Objects.nonNull(ct.pid)
- ).forEach(
- template -> {
- if (template.maximumCardinality == MaximumCardinality.ONE) {
- containerState.findConfig(template.pid).ifPresent(
- c -> processEvent(
- component,
- template,
- new ConfigurationEvent(
- containerState.caTracker().getServiceReference(),
- ConfigurationEvent.CM_UPDATED,
- null,
- c.getPid()))
- );
- }
- else {
- containerState.findConfigs(template.pid, true).ifPresent(
- arr -> Arrays.stream(arr).forEach(
- c -> processEvent(
- component,
- template,
- new ConfigurationEvent(
- containerState.caTracker().getServiceReference(),
- ConfigurationEvent.CM_UPDATED,
- c.getFactoryPid(),
- c.getPid()))
- )
- );
- }
- }
- );
-
- return s;
- },
- f -> {
- _log.error(l -> l.error("CCR Failure during configuration start on {}", next, f.getFailure()));
-
- error(f.getFailure());
- }
- );
-
- return true;
- }
- ).orElse(true);
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.CONFIGURATION_LISTENER, _component.template().name);
- }
-
- @Override
- public String toString() {
- return Arrays.asList(getClass().getSimpleName(), _component).toString();
- }
-
- private void processEvent(Component component, ConfigurationTemplateDTO t, ConfigurationEvent event) {
- boolean required = t.policy == ConfigurationPolicy.REQUIRED;
- boolean single = t.maximumCardinality == MaximumCardinality.ONE;
-
- switch (event.getType()) {
- case ConfigurationEvent.CM_DELETED:
- component.instances().stream().map(
- ExtendedComponentInstanceDTO.class::cast
- ).filter(
- instance -> (!single && event.getPid().equals(instance.pid)) || single
- ).forEach(
- instance -> {
- submit(instance.closeOp(), instance::close).then(
- s -> {
- if (!required) {
- instance.configurations.removeIf(
- c -> c.template == t
- );
-
- submit(instance.openOp(), instance::open);
- }
- else {
- component.instances().remove(instance);
- }
-
- return s;
- }
- );
- }
- );
- return;
- case ConfigurationEvent.CM_LOCATION_CHANGED:
- break;
- case ConfigurationEvent.CM_UPDATED:
- if (!single &&
- !component.instances().stream().map(
- ExtendedComponentInstanceDTO.class::cast
- ).filter(
- instance -> event.getPid().equals(instance.pid)
- ).findFirst().isPresent()) {
-
- ExtendedComponentInstanceDTO instance = new ExtendedComponentInstanceDTO(
- containerState, _component.activatorBuilder());
- instance.activations = new CopyOnWriteArrayList<>();
- instance.configurations = new CopyOnWriteArrayList<>();
- instance.pid = event.getPid();
- instance.references = new CopyOnWriteArrayList<>();
- instance.template = component.template();
-
- component.instances().add(instance);
- }
-
- containerState.findConfig(event.getPid()).ifPresent(
- configuration -> {
- ExtendedConfigurationDTO configurationDTO = new ExtendedConfigurationDTO();
-
- configurationDTO.configuration = configuration;
- configurationDTO.pid = configuration.getPid();
- configurationDTO.properties = Maps.of(configuration.getProcessedProperties(event.getReference()));
- configurationDTO.template = t;
-
- component.instances().stream().map(
- ExtendedComponentInstanceDTO.class::cast
- ).filter(
- instance -> (!single && event.getPid().equals(instance.pid)) || single
- ).forEach(
- instance -> {
- submit(instance.closeOp(), instance::close).then(
- s -> {
- instance.configurations.removeIf(c -> c.template == t);
- instance.configurations.add(configurationDTO);
-
- submit(instance.openOp(), instance::open);
-
- return s;
- }
- );
- }
- );
- }
- );
- break;
- }
- }
-
- private String type(ConfigurationEvent event) {
- if (event.getType() == ConfigurationEvent.CM_DELETED)
- return "DELETED";
- if (event.getType() == ConfigurationEvent.CM_LOCATION_CHANGED)
- return "LOCATION_CHANGED";
- if (event.getType() == ConfigurationEvent.CM_UPDATED)
- return "UPDATED";
- throw new IllegalArgumentException("CM Event type " + event.getType());
- }
-
- private volatile ServiceRegistration<org.osgi.service.cm.ConfigurationListener> _listenerService;
-
- private final Component _component;
- private final Logger _log;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java
deleted file mode 100644
index c67a26e..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerBootstrap.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.loader.BundleResourcesLoader;
-import org.apache.aries.cdi.container.internal.model.ExtendedExtensionDTO;
-import org.apache.aries.cdi.container.internal.model.FactoryComponent;
-import org.apache.aries.cdi.container.internal.model.SingleComponent;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.bootstrap.spi.Metadata;
-import org.jboss.weld.util.ServiceLoader;
-import org.osgi.service.log.Logger;
-
-public class ContainerBootstrap extends Phase {
-
- public ContainerBootstrap(
- ContainerState containerState,
- ConfigurationListener.Builder configurationBuilder,
- SingleComponent.Builder singleBuilder,
- FactoryComponent.Builder factoryBuilder) {
-
- super(containerState, null);
-
- _configurationBuilder = configurationBuilder;
- _singleBuilder = singleBuilder;
- _factoryBuilder = factoryBuilder;
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro syncro = _lock.open()) {
- if (_bootstrap != null) {
- _log.debug(l -> l.debug("CCR container bootstrap shutdown on {}", _bootstrap));
- _bootstrap.shutdown();
- _bootstrap = null;
- }
-
- return true;
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Failure in container bootstrap shutdown on {}", _bootstrap, t));
-
- return false;
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.CONTAINER_BOOTSTRAP, containerState.id());
- }
-
- @Override
- public boolean open() {
- try (Syncro syncro = _lock.open()) {
- if (containerState.bundleContext() == null) {
- // this bundle was already removed
- return false;
- }
-
- if (_bootstrap != null) {
- return true;
- }
-
- if (containerState.containerDTO().components.isEmpty()) {
- return false;
- }
-
- List<Metadata<Extension>> extensions = new CopyOnWriteArrayList<>();
-
- // Add the internal extensions
- extensions.add(
- new ExtensionMetadata(
- new BundleContextExtension(containerState.bundleContext()),
- containerState.id()));
- extensions.add(
- new ExtensionMetadata(
- new RuntimeExtension(containerState, _configurationBuilder, _singleBuilder, _factoryBuilder),
- containerState.id()));
- extensions.add(
- new ExtensionMetadata(
- new LoggerExtension(containerState),
- containerState.id()));
-
- Thread currentThread = Thread.currentThread();
- ClassLoader current = currentThread.getContextClassLoader();
- BundleResourcesLoader.Builder builder = new BundleResourcesLoader.Builder(containerState.bundle(), containerState.extenderBundle());
-
- try {
- currentThread.setContextClassLoader(containerState.classLoader());
-
- // Add extensions found from the bundle's class loader, such as those in the Bundle-ClassPath
- ServiceLoader.load(Extension.class, containerState.classLoader()).forEach(extensions::add);
-
- // Add external extensions
- containerState.containerDTO().extensions.stream().map(
- ExtendedExtensionDTO.class::cast
- ).map(
- e -> {
- builder.add(e.serviceReference.getBundle());
- return new ExtensionMetadata(e.extension.getService(), e.template.serviceFilter);
- }
- ).forEach(extensions::add);
-
- _bootstrap = new WeldBootstrap();
-
- BeanDeploymentArchive beanDeploymentArchive = new ContainerDeploymentArchive(
- builder.build(),
- containerState.id(),
- containerState.beansModel().getBeanClassNames(),
- containerState.beansModel().getBeansXml());
-
- Deployment deployment = new ContainerDeployment(extensions, beanDeploymentArchive);
-
- _bootstrap.startExtensions(extensions);
- _bootstrap.startContainer(containerState.id(), new ContainerEnvironment(), deployment);
- _bootstrap.startInitialization();
- _bootstrap.deployBeans();
- _bootstrap.validateBeans();
- _bootstrap.endInitialization();
- }
- finally {
- currentThread.setContextClassLoader(current);
- }
-
- return true;
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.CONTAINER_BOOTSTRAP, containerState.id());
- }
-
-
- private volatile WeldBootstrap _bootstrap;
- private final ConfigurationListener.Builder _configurationBuilder;
- private final FactoryComponent.Builder _factoryBuilder;
- private final SingleComponent.Builder _singleBuilder;
- private final Syncro _lock = new Syncro(true);
- private final Logger _log;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeployment.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeployment.java
deleted file mode 100644
index 7e838a5..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeployment.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.jboss.weld.bootstrap.api.ServiceRegistry;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.CDI11Deployment;
-import org.jboss.weld.bootstrap.spi.Metadata;
-
-public class ContainerDeployment implements CDI11Deployment {
-
- public ContainerDeployment(Iterable<Metadata<Extension>> extensions, BeanDeploymentArchive beanDeploymentArchive) {
- _extensions = extensions;
- _beanDeploymentArchive = beanDeploymentArchive;
-
- _beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>();
- _beanDeploymentArchives.add(beanDeploymentArchive);
- }
-
- @Override
- public BeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) {
- return _beanDeploymentArchive;
- }
-
- @Override
- public Collection<BeanDeploymentArchive> getBeanDeploymentArchives() {
- return _beanDeploymentArchives;
- }
-
- @Override
- public Iterable<Metadata<Extension>> getExtensions() {
- return _extensions;
- }
-
- @Override
- public ServiceRegistry getServices() {
- return _beanDeploymentArchive.getServices();
- }
-
- @Override
- public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> aClass) {
- return _beanDeploymentArchive;
- }
-
- private final BeanDeploymentArchive _beanDeploymentArchive;
- private final Collection<BeanDeploymentArchive> _beanDeploymentArchives;
- private final Iterable<Metadata<Extension>> _extensions;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeploymentArchive.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeploymentArchive.java
deleted file mode 100644
index 4fbca9b..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDeploymentArchive.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.jboss.weld.bootstrap.api.ServiceRegistry;
-import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.BeansXml;
-import org.jboss.weld.bootstrap.spi.EEModuleDescriptor;
-import org.jboss.weld.bootstrap.spi.EEModuleDescriptor.ModuleType;
-import org.jboss.weld.bootstrap.spi.helpers.EEModuleDescriptorImpl;
-import org.jboss.weld.ejb.spi.EjbDescriptor;
-import org.jboss.weld.resources.spi.ResourceLoader;
-import org.jboss.weld.serialization.spi.ProxyServices;
-
-public class ContainerDeploymentArchive
- implements BeanDeploymentArchive {
-
- public <T extends ResourceLoader & ProxyServices> ContainerDeploymentArchive(
- T loader, String id, Collection<String> beanClassNames, BeansXml beansXml) {
-
- _id = id;
- _beanClassNames = beanClassNames;
- _beansXml = beansXml;
- _services = new SimpleServiceRegistry();
-
- if (loader != null) {
- _services.add(ResourceLoader.class, loader);
- _services.add(ProxyServices.class, loader);
- _services.add(EEModuleDescriptor.class, new EEModuleDescriptorImpl(id, ModuleType.WEB));
- }
- }
-
- @Override
- public Collection<String> getBeanClasses() {
- return _beanClassNames;
- }
-
- @Override
- public Collection<BeanDeploymentArchive> getBeanDeploymentArchives() {
- return Collections.emptyList();
- }
-
- @Override
- public BeansXml getBeansXml() {
- return _beansXml;
- }
-
- @Override
- public Collection<EjbDescriptor<?>> getEjbs() {
- return Collections.emptyList();
- }
-
- @Override
- public String getId() {
- return _id;
- }
-
- @Override
- public ServiceRegistry getServices() {
- return _services;
- }
-
- private final Collection<String> _beanClassNames;
- private final BeansXml _beansXml;
- private final String _id;
- private final ServiceRegistry _services;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java
deleted file mode 100644
index ecaa8d1..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.bootstrap.spi.Metadata;
-
-public class ContainerDiscovery {
-
- public ContainerDiscovery(ContainerState containerState) {
- String id = containerState.id() + "-discovery";
-
- BeansModel beansModel = containerState.beansModel();
-
- BeanDeploymentArchive beanDeploymentArchive = new ContainerDeploymentArchive(
- containerState.loader(), id, beansModel.getBeanClassNames(),
- beansModel.getBeansXml());
-
- ExtensionMetadata extension = new ExtensionMetadata(
- new DiscoveryExtension(containerState), id);
-
- List<Metadata<Extension>> extensions = Collections.singletonList(extension);
-
- Deployment deployment = new ContainerDeployment(
- Collections.singletonList(extension), beanDeploymentArchive);
-
- WeldBootstrap _bootstrap = new WeldBootstrap();
-
- _bootstrap.startExtensions(extensions);
- _bootstrap.startContainer(id, new ContainerEnvironment(), deployment);
- _bootstrap.startInitialization();
- _bootstrap.deployBeans();
- _bootstrap.shutdown();
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerEnvironment.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerEnvironment.java
deleted file mode 100644
index a968c32..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerEnvironment.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.weld.bootstrap.api.Environment;
-import org.jboss.weld.bootstrap.api.Service;
-
-public class ContainerEnvironment implements Environment {
-
- public ContainerEnvironment() {
- _requiredBeanDeploymentArchiveServices = new HashSet<Class<? extends Service>>();
- _requiredDeploymentServices = new HashSet<Class<? extends Service>>();
- }
-
- @Override
- public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices() {
- return _requiredBeanDeploymentArchiveServices;
- }
-
- @Override
- public Set<Class<? extends Service>> getRequiredDeploymentServices() {
- return _requiredDeploymentServices;
- }
-
- private final Set<Class<? extends Service>> _requiredBeanDeploymentArchiveServices;
- private final Set<Class<? extends Service>> _requiredDeploymentServices;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java
deleted file mode 100644
index a6c072f..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import static org.apache.aries.cdi.container.internal.util.Filters.asFilter;
-import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
-import static org.osgi.service.cdi.CDIConstants.CDI_CAPABILITY_NAME;
-import static org.osgi.service.cdi.CDIConstants.CDI_CONTAINER_ID;
-import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
-
-import org.apache.aries.cdi.container.internal.ChangeCount;
-import org.apache.aries.cdi.container.internal.loader.BundleClassLoader;
-import org.apache.aries.cdi.container.internal.loader.BundleResourcesLoader;
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.apache.aries.cdi.container.internal.model.BeansModelBuilder;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedExtensionTemplateDTO;
-import org.apache.aries.cdi.container.internal.util.Logs;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.jboss.weld.resources.spi.ResourceLoader;
-import org.jboss.weld.serialization.spi.ProxyServices;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.dto.BundleDTO;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRequirement;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.resource.Namespace;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.runtime.dto.ContainerDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ContainerTemplateDTO;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Deferred;
-import org.osgi.util.promise.Promise;
-import org.osgi.util.promise.PromiseFactory;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class ContainerState {
-
- public static final AnnotationLiteral<Any> ANY = new AnnotationLiteral<Any>() {
- private static final long serialVersionUID = 1L;
- };
-
- public ContainerState(
- Bundle bundle,
- Bundle extenderBundle,
- ChangeCount ccrChangeCount,
- PromiseFactory promiseFactory,
- ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> caTracker,
- Logs ccrLogs) {
-
- _bundle = bundle;
- _extenderBundle = extenderBundle;
- _ccrLogs = ccrLogs;
- _bundleContext = bundle.getBundleContext();
- _log = _ccrLogs.getLogger(getClass());
- _containerLogs = new Logs.Builder(_bundleContext).build();
-
- _changeCount = new ChangeCount();
- _changeCount.addObserver(ccrChangeCount);
-
- _promiseFactory = promiseFactory;
- _caTracker = caTracker;
-
- BundleWiring bundleWiring = _bundle.adapt(BundleWiring.class);
-
- List<BundleWire> wires = bundleWiring.getRequiredWires(EXTENDER_NAMESPACE);
-
- Map<String, Object> cdiAttributes = Collections.emptyMap();
-
- for (BundleWire wire : wires) {
- BundleCapability capability = wire.getCapability();
- Map<String, Object> attributes = capability.getAttributes();
- String extender = (String)attributes.get(EXTENDER_NAMESPACE);
-
- if (extender.equals(CDI_CAPABILITY_NAME)) {
- BundleRequirement requirement = wire.getRequirement();
- cdiAttributes = requirement.getAttributes();
- break;
- }
- }
-
- wires = bundleWiring.getRequiredWires(CDI_EXTENSION_PROPERTY);
-
- List<String> extensionRequirements = new ArrayList<>();
-
- for (BundleWire wire : wires) {
- String filter = wire.getRequirement().getDirectives().get(
- Namespace.REQUIREMENT_FILTER_DIRECTIVE);
- Bundle extensionProvider = wire.getProvider().getBundle();
-
- StringBuilder sb = new StringBuilder();
-
- sb.append("(&");
- sb.append(filter);
- sb.append("(");
- sb.append(Constants.SERVICE_BUNDLEID);
- sb.append("=");
- sb.append(extensionProvider.getBundleId());
- sb.append("))");
-
- extensionRequirements.add(sb.toString());
- }
-
- _containerDTO = new ContainerDTO();
- _containerDTO.bundle = _bundle.adapt(BundleDTO.class);
- _containerDTO.changeCount = _changeCount.get();
- _containerDTO.components = new CopyOnWriteArrayList<>();
- _containerDTO.errors = new CopyOnWriteArrayList<>();
- _containerDTO.extensions = new CopyOnWriteArrayList<>();
- _containerDTO.template = new ContainerTemplateDTO();
- _containerDTO.template.components = new CopyOnWriteArrayList<>();
- _containerDTO.template.extensions = new CopyOnWriteArrayList<>();
- _containerDTO.template.id = Optional.ofNullable(
- (String)cdiAttributes.get(CDI_CONTAINER_ID)
- ).orElse(
- _bundle.getSymbolicName()
- );
-
- extensionRequirements.forEach(
- extensionFilter -> {
- ExtendedExtensionTemplateDTO extensionTemplateDTO = new ExtendedExtensionTemplateDTO();
-
- try {
- extensionTemplateDTO.filter = asFilter(extensionFilter);
- extensionTemplateDTO.serviceFilter = extensionFilter;
-
- _containerDTO.template.extensions.add(extensionTemplateDTO);
- }
- catch (Exception e) {
- _containerDTO.errors.add(Throw.asString(e));
- }
- }
- );
-
- _containerComponentTemplateDTO = new ComponentTemplateDTO();
- _containerComponentTemplateDTO.activations = new CopyOnWriteArrayList<>();
- _containerComponentTemplateDTO.beans = new CopyOnWriteArrayList<>();
- _containerComponentTemplateDTO.configurations = new CopyOnWriteArrayList<>();
- _containerComponentTemplateDTO.name = _containerDTO.template.id;
- _containerComponentTemplateDTO.properties = Collections.emptyMap();
- _containerComponentTemplateDTO.references = new CopyOnWriteArrayList<>();
- _containerComponentTemplateDTO.type = ComponentType.CONTAINER;
-
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = Optional.ofNullable(
- (String)cdiAttributes.get(CDI_CONTAINER_ID)
- ).map(
- s -> s.replaceAll("-", ".")
- ).orElse(
- "osgi.cdi." + _bundle.getSymbolicName().replaceAll("-", ".")
- );
- configurationTemplate.policy = ConfigurationPolicy.OPTIONAL;
-
- _containerComponentTemplateDTO.configurations.add(configurationTemplate);
-
- _containerDTO.template.components.add(_containerComponentTemplateDTO);
-
- _aggregateClassLoader = new BundleClassLoader(getBundles(_bundle, _extenderBundle));
-
- _beansModel = new BeansModelBuilder(this, _aggregateClassLoader, bundleWiring, cdiAttributes).build();
-
- _bundleClassLoader = bundleWiring.getClassLoader();
-
- try {
- new ContainerDiscovery(this);
- }
- catch (Exception e) {
- _log.error(l -> l.error("CCR Discovery resulted in errors on {}", bundle, e));
-
- _containerDTO.errors.add(Throw.asString(e));
- }
-
- _beanManagerDeferred = _promiseFactory.deferred();
- }
-
- public <T, R> Promise<R> addCallback(CheckedCallback<T, R> checkedCallback) {
- Deferred<R> deferred = _promiseFactory.deferred();
- _callbacks.put(checkedCallback, deferred);
- return deferred.getPromise();
- }
-
- public BeanManager beanManager() {
- try {
- return _beanManagerDeferred.getPromise().timeout(5000).getValue();
- } catch (InvocationTargetException | InterruptedException e) {
- return Throw.exception(e);
- }
- }
-
- public void beanManager(BeanManager beanManager) {
- if (_beanManagerDeferred.getPromise().isDone()) {
- _beanManagerDeferred = _promiseFactory.deferred();
- }
- _beanManagerDeferred.resolve(beanManager);
- }
-
- public BeansModel beansModel() {
- return _beansModel;
- }
-
- public Bundle bundle() {
- return _bundle;
- }
-
- public ClassLoader bundleClassLoader() {
- return _bundleClassLoader;
- }
-
- public BundleContext bundleContext() {
- return _bundleContext;
- }
-
- public ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> caTracker() {
- return _caTracker;
- }
-
- public Logs ccrLogs() {
- return _ccrLogs;
- }
-
- public ClassLoader classLoader() {
- return _aggregateClassLoader;
- }
-
- public void closing() {
- try {
- _closing.set(_promiseFactory.submit(() -> Boolean.TRUE).getValue());
- } catch (InvocationTargetException | InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- public ComponentContext componentContext() {
- return _componentContext;
- }
-
- public ComponentTemplateDTO containerComponentTemplateDTO() {
- return _containerComponentTemplateDTO;
- }
-
- public ContainerDTO containerDTO() {
- _containerDTO.changeCount = _changeCount.get();
- return _containerDTO;
- }
-
- public Logs containerLogs() {
- return _containerLogs;
- }
-
- public void error(Throwable t) {
- containerDTO().errors.add(Throw.asString(t));
- }
-
- public Bundle extenderBundle() {
- return _extenderBundle;
- }
-
- public Optional<Configuration> findConfig(String pid) {
- return findConfigs(pid, false).map(arr -> arr[0]);
- }
-
- public Optional<Configuration[]> findConfigs(String pid, boolean factory) {
- try {
- String query = "(service.pid=".concat(pid).concat(")");
-
- if (factory) {
- query = "(service.factoryPid=".concat(pid).concat(")");
- }
-
- ConfigurationAdmin cm = _caTracker.getService();
-
- if (cm == null) {
- _log.error(l -> l.error("CCR unexpected error fetching configuration admin for {}", pid));
-
- return Optional.empty();
- }
-
- return Optional.ofNullable(cm.listConfigurations(query));
- }
- catch (Exception e) {
- _log.warn(l -> l.warn("CCR unexpected error fetching configuration for {}", pid, e));
-
- return Optional.empty();
- }
- }
-
- public String id() {
- return _containerDTO.template.id;
- }
-
- public void incrementChangeCount() {
- _changeCount.incrementAndGet();
- }
-
- @SuppressWarnings("unchecked")
- public <T extends ResourceLoader & ProxyServices> T loader() {
- return (T)new BundleResourcesLoader.Builder(_bundle, _extenderBundle).build();
- }
-
- public PromiseFactory promiseFactory() {
- return _promiseFactory;
- }
-
- @SuppressWarnings("unchecked")
- public <T, R> Promise<T> submit(Op op, Callable<T> task) {
- try {
- switch (op.mode) {
- case CLOSE: {
- // always perform close synchronously
- _log.debug(l -> l.debug("CCR submit {}", op));
- return _promiseFactory.resolved(task.call());
- }
- case OPEN:
- // when closing don't do perform any opens
- // also, don't log it since it's just going to be noise
- if (_closing.get()) {
- return _promiseFactory.resolved((T)new Object());
- }
- }
- }
- catch (Exception e) {
- return _promiseFactory.failed(e);
- }
-
- _log.debug(l -> l.debug("CCR submit {}", op));
-
- Promise<T> promise = _promiseFactory.submit(task);
-
- for (Entry<CheckedCallback<?, ?>, Deferred<?>> entry : _callbacks.entrySet()) {
- CheckedCallback<T, R> cc = (CheckedCallback<T, R>)entry.getKey();
- if (cc.test(op)) {
- ((Deferred<R>)entry.getValue()).resolveWith(promise.then(cc, cc)).then(
- s -> {
- _callbacks.remove(cc);
- return s;
- },
- f -> _callbacks.remove(cc)
- );
- }
- }
-
- return promise;
- }
-
- private static Bundle[] getBundles(Bundle bundle, Bundle extenderBundle) {
- List<Bundle> bundles = new ArrayList<>();
-
- bundles.add(bundle);
- bundles.add(extenderBundle);
-
- BundleWiring extenderWiring = extenderBundle.adapt(BundleWiring.class);
-
- List<BundleWire> requiredWires = extenderWiring.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE);
-
- for (BundleWire bundleWire : requiredWires) {
- BundleCapability capability = bundleWire.getCapability();
- Map<String, Object> attributes = capability.getAttributes();
- String packageName = (String)attributes.get(PackageNamespace.PACKAGE_NAMESPACE);
- if (!packageName.startsWith("org.jboss.weld.")) {
- continue;
- }
-
- Bundle wireBundle = bundleWire.getProvider().getBundle();
- if (!bundles.contains(wireBundle)) {
- bundles.add(wireBundle);
- }
- }
-
- return bundles.toArray(new Bundle[0]);
- }
-
- private final ClassLoader _aggregateClassLoader;
- private volatile Deferred<BeanManager> _beanManagerDeferred;
- private final BeansModel _beansModel;
- private final Bundle _bundle;
- private final BundleContext _bundleContext;
- private final ClassLoader _bundleClassLoader;
- private final Map<CheckedCallback<?, ?>, Deferred<?>> _callbacks = new ConcurrentHashMap<>();
- private final ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> _caTracker;
- private final Logger _log;
- private final Logs _ccrLogs;
- private final ChangeCount _changeCount;
- private final AtomicBoolean _closing = new AtomicBoolean(false);
- private final ComponentContext _componentContext = new ComponentContext();
- private final ContainerDTO _containerDTO;
- private final Logs _containerLogs;
- private final ComponentTemplateDTO _containerComponentTemplateDTO;
- private final Bundle _extenderBundle;
- private final PromiseFactory _promiseFactory;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java
deleted file mode 100644
index a4fa150..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.DefinitionException;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionPoint;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.apache.aries.cdi.container.internal.model.ComponentPropertiesModel;
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.OSGiBean;
-import org.apache.aries.cdi.container.internal.model.ReferenceModel;
-import org.apache.aries.cdi.container.internal.model.ReferenceModel.Builder;
-import org.apache.aries.cdi.container.internal.util.Annotates;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.ServiceScope;
-import org.osgi.service.cdi.annotations.ComponentProperties;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.cdi.annotations.FactoryComponent;
-import org.osgi.service.cdi.annotations.PID;
-import org.osgi.service.cdi.annotations.Reference;
-import org.osgi.service.cdi.annotations.SingleComponent;
-import org.osgi.service.cdi.reference.BindBeanServiceObjects;
-import org.osgi.service.cdi.reference.BindService;
-import org.osgi.service.cdi.reference.BindServiceReference;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-
-public class DiscoveryExtension implements Extension {
-
- public DiscoveryExtension(ContainerState containerState) {
- _containerState = containerState;
- _beansModel = _containerState.beansModel();
- _containerTemplate = _containerState.containerDTO().template.components.get(0);
- }
-
- <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> pat) {
- Class<X> declaringClass = Annotates.declaringClass(pat.getAnnotatedType());
-
- final String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- osgiBean.found(true);
- }
-
- <X> void processBindObject(@Observes ProcessInjectionPoint<X, BindService<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X> void processBindServiceObjects(@Observes ProcessInjectionPoint<X, BindBeanServiceObjects<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X> void processBindServiceReference(@Observes ProcessInjectionPoint<X, BindServiceReference<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X, T> void processInjectionPoint(@Observes ProcessInjectionPoint<X, T> pip) {
- processInjectionPoint0(pip, false);
- }
-
- <X, T> void processInjectionPoint0(ProcessInjectionPoint<X, T> pip, boolean special) {
- InjectionPoint injectionPoint = pip.getInjectionPoint();
-
- Annotated annotated = injectionPoint.getAnnotated();
-
- Class<X> declaringClass = Annotates.declaringClass(annotated);
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- if (special) {
- doSpecial(osgiBean, annotated, injectionPoint.getType());
- }
- else {
- doOther(osgiBean, declaringClass, annotated, injectionPoint);
- }
- }
-
- <X> void processBean(@Observes ProcessBean<X> pb) {
- final Class<X> declaringClass = Annotates.declaringClass(pb);
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- osgiBean.found(true);
-
- final Annotated annotated = pb.getAnnotated();
-
- try {
- List<String> serviceTypes = Annotates.serviceClassNames(annotated);
- Map<String, Object> componentProperties = Annotates.componentProperties(annotated);
- ServiceScope serviceScope = Annotates.serviceScope(annotated);
-
- if (annotated.isAnnotationPresent(SingleComponent.class)) {
- doSingleComponent(osgiBean, declaringClass, annotated, pb.getBean(), serviceTypes, serviceScope, componentProperties);
- }
- else if (annotated.isAnnotationPresent(FactoryComponent.class)) {
- doFactoryComponent(osgiBean, declaringClass, annotated, pb.getBean(), serviceTypes, serviceScope, componentProperties);
- }
- else if (annotated.isAnnotationPresent(ComponentScoped.class)) {
- // Explicitly ignore this case
- }
- else {
- doContainerBean(osgiBean, declaringClass, annotated, pb, pb.getBean().getScope(), serviceTypes, serviceScope, componentProperties);
- }
- }
- catch (Exception e) {
- pb.addDefinitionError(e);
- }
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager beanManager) {
- _containerState.containerDTO().template.components.stream().filter(
- template -> template.type != ComponentType.CONTAINER
- ).map(
- template -> (ExtendedComponentTemplateDTO)template
- ).forEach(
- template -> {
- Set<Bean<?>> visited = new HashSet<>();
- scanComponentBean(template, template.bean, beanManager, visited);
- }
- );
-
- _beansModel.getOSGiBeans().stream().forEach(
- osgiBean -> {
- if (!osgiBean.found()) {
- abd.addDefinitionError(
- new DefinitionException(
- String.format(
- "Did not find bean for %s",
- osgiBean.getBeanClass())));
- }
- }
- );
- }
-
- void doComponentProperties(OSGiBean osgiBean, Class<?> declaringClass, InjectionPoint injectionPoint) {
- try {
- ComponentPropertiesModel configurationModel = new ComponentPropertiesModel.Builder(
- injectionPoint.getType()
- ).declaringClass(
- declaringClass
- ).injectionPoint(
- injectionPoint
- ).build();
-
- osgiBean.addConfiguration(_containerState, configurationModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void doContainerBean(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, ProcessBean<?> pb, Class<? extends Annotation> scope, List<String> serviceTypeNames, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- String className = declaringClass.getName();
-
- if (!_containerTemplate.beans.contains(className)) {
- _containerTemplate.beans.add(className);
- }
-
- if (!serviceTypeNames.isEmpty()) {
- if (!scope.equals(ApplicationScoped.class) &&
- !scope.equals(Dependent.class)) {
-
- pb.addDefinitionError(
- new IllegalStateException(
- String.format(
- "@Service can only be used on @ApplicationScoped, @Dependent, @SingleComponent, and @FactoryComponent: %s",
- pb.getBean())));
- return;
- }
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.cdiScope = scope;
- activationTemplate.declaringClass = declaringClass;
- if (pb instanceof ProcessProducerField) {
- activationTemplate.producer = ((ProcessProducerField<?, ?>) pb).getAnnotatedProducerField();
- }
- else if (pb instanceof ProcessProducerMethod) {
- activationTemplate.producer = ((ProcessProducerMethod<?, ?>) pb).getAnnotatedProducerMethod();
- }
- activationTemplate.properties = componentProperties;
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypeNames;
-
- _containerTemplate.activations.add(activationTemplate);
- }
-
- osgiBean.setComponent(_containerState, _containerTemplate);
- }
-
- void doFactoryComponent(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, Bean<?> bean, List<String> serviceTypeNames, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- ExtendedComponentTemplateDTO componentTemplate = new ExtendedComponentTemplateDTO();
- componentTemplate.activations = new CopyOnWriteArrayList<>();
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.declaringClass = declaringClass;
- activationTemplate.properties = Collections.emptyMap();
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypeNames;
-
- componentTemplate.activations.add(activationTemplate);
-
- componentTemplate.bean = bean;
- componentTemplate.beans = new CopyOnWriteArrayList<>();
- componentTemplate.configurations = new CopyOnWriteArrayList<>();
- componentTemplate.name = bean.getName();
- componentTemplate.properties = componentProperties;
- componentTemplate.references = new CopyOnWriteArrayList<>();
- componentTemplate.type = ComponentType.FACTORY;
-
- annotated.getAnnotations(PID.class).stream().forEach(
- PID -> {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = Optional.of(PID.value()).map(
- s -> {
- if (s.equals("$") || s.equals("")) {
- return componentTemplate.name;
- }
- return s;
- }
- ).orElse(componentTemplate.name);
-
- configurationTemplate.policy = PID.policy();
-
- componentTemplate.configurations.add(configurationTemplate);
- }
- );
-
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.MANY;
- configurationTemplate.pid = Optional.ofNullable(
- annotated.getAnnotation(FactoryComponent.class)
- ).map(fc -> {
- if (fc.value().equals("$") || fc.value().equals("")) {
- return componentTemplate.name;
- }
- return fc.value();
- }).orElse(componentTemplate.name);
- configurationTemplate.policy = ConfigurationPolicy.REQUIRED;
-
- componentTemplate.configurations.add(configurationTemplate);
- componentTemplate.beans.add(declaringClass.getName());
-
- _containerState.containerDTO().template.components.add(componentTemplate);
-
- osgiBean.setComponent(_containerState, componentTemplate);
- }
-
- void doOther(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, InjectionPoint injectionPoint) {
- Reference reference = annotated.getAnnotation(Reference.class);
- ComponentProperties componentProperties = annotated.getAnnotation(ComponentProperties.class);
-
- if (reference != null) {
- doReference(osgiBean, annotated, injectionPoint, reference, componentProperties);
- }
- else if (componentProperties != null) {
- doComponentProperties(osgiBean, declaringClass, injectionPoint);
- }
- }
-
- void doReference(OSGiBean osgiBean, Annotated annotated, InjectionPoint injectionPoint, Reference reference, ComponentProperties componentProperties) {
- if (componentProperties != null) {
- _containerState.error(
- new IllegalArgumentException(
- String.format(
- "Cannot use @Reference and @Configuration on the same injection point {}",
- injectionPoint))
- );
-
- return;
- }
-
- Builder builder = null;
-
- if (annotated instanceof AnnotatedParameter) {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
-
- try {
- ReferenceModel referenceModel = builder.type(injectionPoint.getType()).build();
-
- osgiBean.addReference(referenceModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void doSingleComponent(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, Bean<?> bean, List<String> serviceTypes, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- ExtendedComponentTemplateDTO componentTemplate = new ExtendedComponentTemplateDTO();
- componentTemplate.activations = new CopyOnWriteArrayList<>();
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.declaringClass = declaringClass;
- activationTemplate.properties = Collections.emptyMap();
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypes;
-
- componentTemplate.activations.add(activationTemplate);
-
- componentTemplate.bean = bean;
- componentTemplate.beans = new CopyOnWriteArrayList<>();
- componentTemplate.configurations = new CopyOnWriteArrayList<>();
- componentTemplate.name = bean.getName();
- componentTemplate.properties = componentProperties;
- componentTemplate.references = new CopyOnWriteArrayList<>();
- componentTemplate.type = ComponentType.SINGLE;
-
- annotated.getAnnotations(PID.class).stream().forEach(
- PID -> {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = Optional.of(PID.value()).map(
- s -> {
- if (s.equals("$") || s.equals("")) {
- return componentTemplate.name;
- }
- return s;
- }
- ).orElse(componentTemplate.name);
-
- if (PID.value().equals("$") || PID.value().equals("")) {
- configurationTemplate.pid = componentTemplate.name;
- }
- else {
- configurationTemplate.pid = PID.value();
- }
-
- configurationTemplate.policy = PID.policy();
-
- componentTemplate.configurations.add(configurationTemplate);
- }
- );
-
- if (componentTemplate.configurations.isEmpty()) {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = componentTemplate.name;
- configurationTemplate.policy = ConfigurationPolicy.OPTIONAL;
-
- componentTemplate.configurations.add(configurationTemplate);
- }
-
- componentTemplate.beans.add(declaringClass.getName());
-
- _containerState.containerDTO().template.components.add(componentTemplate);
-
- osgiBean.setComponent(_containerState, componentTemplate);
- }
-
- void doSpecial(OSGiBean osgiBean, Annotated annotated, Type injectionPointType) {
- Builder builder = null;
-
- if (annotated instanceof AnnotatedParameter) {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
-
- try {
- ReferenceModel referenceModel = builder.type(injectionPointType).build();
-
- osgiBean.addReference(referenceModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void scanComponentBean(
- ExtendedComponentTemplateDTO template,
- Bean<?> bean,
- BeanManager beanManager,
- Set<Bean<?>> visited) {
-
- if (visited.contains(bean)) {
- return;
- }
-
- visited.add(bean);
-
- Class<?> beanClass = bean.getBeanClass();
-
- String className = beanClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- ComponentTemplateDTO currentTemplate = osgiBean.getComponent();
-
- if (currentTemplate == null) {
- osgiBean.setComponent(_containerState, template);
- }
- else if (!currentTemplate.equals(template)) {
- throw new IllegalStateException("Something is wrong here");
- }
-
- if (!template.beans.contains(className)) {
- template.beans.add(className);
- }
-
- for (InjectionPoint injectionPoint : bean.getInjectionPoints()) {
- if (injectionPoint.getAnnotated().isAnnotationPresent(ComponentProperties.class) ||
- injectionPoint.getAnnotated().isAnnotationPresent(Reference.class)) {
-
- continue;
- }
-
- Set<Bean<?>> beans = beanManager.getBeans(
- injectionPoint.getType(),
- injectionPoint.getQualifiers().toArray(new Annotation[0]));
-
- Bean<?> next = beanManager.resolve(beans);
-
- if ((next == null) || next.getScope() != ComponentScoped.class) {
- continue;
- }
-
- scanComponentBean(template, next, beanManager, visited);
- }
- }
-
- private final BeansModel _beansModel;
- private final ComponentTemplateDTO _containerTemplate;
- private final ContainerState _containerState;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionMetadata.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionMetadata.java
deleted file mode 100644
index 7ae345c..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionMetadata.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.jboss.weld.bootstrap.spi.Metadata;
-
-public class ExtensionMetadata implements Metadata<Extension> {
-
- public ExtensionMetadata(Extension extension, String location) {
- _extension = extension;
- _location = location;
- }
-
- @Override
- public Extension getValue() {
- return _extension;
- }
-
- @Override
- public String getLocation() {
- return _location;
- }
-
- private final Extension _extension;
- private final String _location;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionPhase.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionPhase.java
deleted file mode 100644
index f59f467..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ExtensionPhase.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import static org.apache.aries.cdi.container.internal.util.Filters.*;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.concurrent.ConcurrentSkipListSet;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.model.ExtendedExtensionDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedExtensionTemplateDTO;
-import org.apache.aries.cdi.container.internal.util.Conversions;
-import org.apache.aries.cdi.container.internal.util.SRs;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.runtime.dto.ExtensionDTO;
-import org.osgi.service.cdi.runtime.dto.template.ExtensionTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Promise;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class ExtensionPhase extends Phase {
-
- public ExtensionPhase(ContainerState containerState, Phase next) {
- super(containerState, next);
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- if (!extensionTemplates().isEmpty()) {
- if (_extensionTracker != null) {
- _extensionTracker.close();
-
- _extensionTracker = null;
- }
-
- return true;
- }
- else {
- return next.map(
- next -> {
- submit(next.closeOp(), next::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in extension CLOSE on {}", bundle(), f));
-
- error(f);
- }
- );
-
- return true;
- }
- ).orElse(true);
- }
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.EXTENSION, containerState.id());
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- if (containerState.bundleContext() == null) {
- // this bundle was already removed
- return false;
- }
-
- if (!extensionTemplates().isEmpty()) {
- _extensionTracker = new ServiceTracker<>(
- containerState.bundleContext(), createExtensionFilter(), new ExtensionPhaseCustomizer());
-
- _extensionTracker.open();
-
- return true;
- }
- else {
- return next.map(
- next -> {
- submit(next.openOp(), next::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in extension OPEN on {}", bundle(), f));
-
- error(f);
- }
- );
-
- return true;
- }
- ).orElse(true);
- }
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.EXTENSION, containerState.id());
- }
-
- Filter createExtensionFilter() {
- final List<ExtensionTemplateDTO> templates = extensionTemplates();
-
- StringBuilder sb = new StringBuilder("(&(objectClass=" + Extension.class.getName() + ")");
-
- if (templates.size() > 1) sb.append("(|");
-
- for (ExtensionTemplateDTO tmpl : templates) {
- sb.append(tmpl.serviceFilter);
- }
-
- if (templates.size() > 1) sb.append(")");
-
- sb.append(")");
-
- return asFilter(sb.toString());
- }
-
- List<ExtensionTemplateDTO> extensionTemplates() {
- return containerState.containerDTO().template.extensions;
- }
-
- List<ExtensionDTO> snapshots() {
- return containerState.containerDTO().extensions;
- }
-
-
- private ServiceTracker<Extension, ExtendedExtensionDTO> _extensionTracker;
- private final Logger _log;
- private final SortedSet<ExtendedExtensionDTO> _references = new ConcurrentSkipListSet<>(
- (e1, e2) -> e1.serviceReference.compareTo(e2.serviceReference)
- );
-
- private class ExtensionPhaseCustomizer implements ServiceTrackerCustomizer<Extension, ExtendedExtensionDTO> {
-
- @Override
- public ExtendedExtensionDTO addingService(ServiceReference<Extension> reference) {
- ExtendedExtensionTemplateDTO template = extensionTemplates().stream().map(
- t -> (ExtendedExtensionTemplateDTO)t
- ).filter(
- t -> t.filter.match(reference)
- ).findFirst().get();
-
- ExtendedExtensionDTO snapshot = snapshots().stream().map(
- s -> (ExtendedExtensionDTO)s
- ).filter(
- s -> s.template == template
- ).findFirst().orElse(null);
-
- if (snapshot != null) {
- if (reference.compareTo(snapshot.serviceReference) <= 0) {
- return null;
- }
-
- if (snapshots().remove(snapshot)) {
- _references.add(snapshot);
- snapshot.extension = null;
- containerState.bundleContext().ungetService(snapshot.serviceReference);
- }
- }
-
- ExtendedExtensionDTO extensionDTO = new ExtendedExtensionDTO();
-
- BundleContext bc = containerState.bundleContext();
-
- extensionDTO.extension = bc.getServiceObjects(reference);
- extensionDTO.service = SRs.from(reference);
- extensionDTO.serviceReference = reference;
- extensionDTO.template = template;
-
- snapshots().add(extensionDTO);
- containerState.incrementChangeCount();
-
- next.ifPresent(
- next -> submit(next.closeOp(), next::close).then(
- s -> {
- if (snapshots().size() == extensionTemplates().size()) {
- return submit(next.openOp(), next::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in extension open TRACKING {} on {}", reference, bundle(), f));
-
- error(f);
- }
- );
- }
-
- return s;
- },
- f -> {
- _log.error(l -> l.error("CCR Error extension close TRACKING {} on {}", reference, bundle(), f.getFailure()));
-
- error(f.getFailure());
- }
- )
- );
-
- return extensionDTO;
- }
-
- @Override
- public void modifiedService(ServiceReference<Extension> reference, ExtendedExtensionDTO extentionDTO) {
- removedService(reference, extentionDTO);
- addingService(reference);
- }
-
- @Override
- public void removedService(ServiceReference<Extension> reference, final ExtendedExtensionDTO extensionDTO) {
- _log.debug(l -> l.debug("CCR Departing extension {} on {}", Conversions.convert(extensionDTO).to(ExtensionDTO.class), bundle()));
-
- containerState.bundleContext().ungetService(reference);
-
- if (!snapshots().removeIf(snap -> ((ExtendedExtensionDTO)snap).serviceReference.equals(reference))) {
- return;
- }
-
- for (Iterator<ExtendedExtensionDTO> itr = _references.iterator();itr.hasNext();) {
- ExtendedExtensionDTO entry = itr.next();
- if (((ExtendedExtensionTemplateDTO)extensionDTO.template).filter.match(entry.serviceReference)) {
- entry.extension = containerState.bundleContext().getServiceObjects(entry.serviceReference);
- itr.remove();
- snapshots().add(entry);
- break;
- }
- }
-
- containerState.incrementChangeCount();
-
- next.ifPresent(
- next -> {
- Promise<Boolean> result = submit(next.closeOp(), next::close).then(
- s -> {
- if (snapshots().size() == extensionTemplates().size()) {
- return submit(next.openOp(), next::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in extension open {} on {}", reference, bundle(), f));
-
- error(f);
- }
- );
- }
-
- return s;
- },
- f -> {
- _log.error(l -> l.error("CCR Error in extension close {} on {}", reference, bundle(), f.getFailure()));
-
- error(f.getFailure());
- }
- );
-
- try {
- result.getValue();
- }
- catch (Exception e) {
- Throw.exception(e);
- }
- }
- );
- }
-
- }
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/LoggerExtension.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/LoggerExtension.java
deleted file mode 100644
index d340d1f..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/LoggerExtension.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.configurator.BeanConfigurator;
-
-import org.osgi.service.log.FormatterLogger;
-import org.osgi.service.log.Logger;
-import org.osgi.service.log.LoggerFactory;
-
-public class LoggerExtension implements Extension {
-
- public LoggerExtension(ContainerState containerState) {
- _containerState = containerState;
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd) {
- final LoggerFactory lf = _containerState.containerLogs().getLoggerFactory();
-
- BeanConfigurator<FormatterLogger> formatterLoggerBean = abd.addBean();
- formatterLoggerBean.addType(FormatterLogger.class);
- formatterLoggerBean.produceWith(
- i -> {
- InjectionPoint ip = i.select(InjectionPoint.class).get();
- return lf.getLogger(
- ip.getMember().getDeclaringClass().getName(),
- FormatterLogger.class);
- }
- );
-
- BeanConfigurator<Logger> loggerBean = abd.addBean();
- loggerBean.addType(Logger.class);
- loggerBean.produceWith(
- i -> {
- InjectionPoint ip = i.select(InjectionPoint.class).get();
- return lf.getLogger(
- ip.getMember().getDeclaringClass().getName(),
- Logger.class);
- }
- );
- }
-
- private final ContainerState _containerState;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Mark.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Mark.java
deleted file mode 100644
index 285d5a9..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Mark.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Qualifier;
-
-@Qualifier
-@Target(value = {ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE})
-@Retention(value = RetentionPolicy.RUNTIME)
-public @interface Mark {
-
- public class Literal extends AnnotationLiteral<Mark> implements Mark {
-
- private static final long serialVersionUID = 1L;
-
- public static Literal from(int i) {
- return new Literal(i);
- }
-
- public Literal(int i) {
- _value = i;
- }
-
- @Override
- public int value() {
- return _value;
- }
-
- private final int _value;
-
- }
-
- int value();
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/MarkedInjectionPoint.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/MarkedInjectionPoint.java
deleted file mode 100644
index 0433f2e..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/MarkedInjectionPoint.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.jboss.weld.injection.ForwardingInjectionPoint;
-
-public class MarkedInjectionPoint extends ForwardingInjectionPoint {
-
- public MarkedInjectionPoint(InjectionPoint injectionPoint) {
- _delegate = injectionPoint;
- _mark = Mark.Literal.from(counter.incrementAndGet());
- _qualifiers = Sets.hashSet(injectionPoint.getQualifiers(), _mark);
- }
-
- @Override
- protected InjectionPoint delegate() {
- return _delegate;
- }
-
- public InjectionPoint getDelegate() {
- return delegate();
- }
-
- public Mark getMark() {
- return _mark;
- }
-
- @Override
- public Set<Annotation> getQualifiers() {
- return _qualifiers;
- }
-
- private static final AtomicInteger counter = new AtomicInteger();
-
- private final InjectionPoint _delegate;
- private final Mark _mark;
- private final Set<Annotation> _qualifiers;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Op.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Op.java
deleted file mode 100644
index 48c0380..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Op.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Arrays;
-
-public class Op {
-
- public static enum Mode {CLOSE, OPEN}
-
- public static enum Type {
- CONFIGURATION_EVENT,
- CONFIGURATION_LISTENER,
- CONTAINER_ACTIVATOR,
- CONTAINER_BOOTSTRAP,
- CONTAINER_COMPONENT,
- CONTAINER_FIRE_EVENTS,
- CONTAINER_INSTANCE,
- CONTAINER_PUBLISH_SERVICES,
- REFERENCES,
- EXTENSION,
- FACTORY_ACTIVATOR,
- FACTORY_COMPONENT,
- FACTORY_INSTANCE,
- INIT,
- SINGLE_ACTIVATOR,
- SINGLE_COMPONENT,
- SINGLE_INSTANCE,
- }
-
- public static Op of(Mode mode, Type type, String name) {
- return new Op(mode, type, name);
- }
-
- private Op(Mode mode, Type type, String name) {
- this.mode = mode;
- this.type = type;
- this.name = name;
- }
-
- public final Mode mode;
- public final Type type;
- public final String name;
-
- @Override
- public String toString() {
- return Arrays.asList(getClass().getSimpleName(), mode, type, name).toString();
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Phase.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Phase.java
deleted file mode 100644
index 65ef1f7..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Phase.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.Optional;
-import java.util.concurrent.Callable;
-
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.framework.Bundle;
-import org.osgi.util.promise.Promise;
-
-public abstract class Phase {
-
- protected final Syncro syncro = new Syncro(true);
-
- public Phase(ContainerState containerState, Phase next) {
- this.containerState = containerState;
- this.next = Optional.ofNullable(next);
- }
-
- public final Bundle bundle() {
- return containerState.bundle();
- }
-
- public abstract Op closeOp();
-
- public abstract boolean close();
-
- public final void error(Throwable t) {
- containerState.error(t);
- }
-
- public abstract boolean open();
-
- public abstract Op openOp();
-
- public final <T> Promise<T> submit(Op op, Callable<T> callable) {
- return containerState.submit(op, callable);
- }
-
- protected final ContainerState containerState;
- protected final Optional<Phase> next;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ReferenceSync.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ReferenceSync.java
deleted file mode 100644
index ff8dd6c..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ReferenceSync.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import java.util.AbstractMap.SimpleImmutableEntry;
-
-import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentInstanceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.InstanceActivator;
-import org.apache.aries.cdi.container.internal.util.Conversions;
-import org.apache.aries.cdi.container.internal.util.Maps;
-import org.apache.aries.cdi.container.internal.util.SRs;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.ReferencePolicy;
-import org.osgi.service.cdi.ReferencePolicyOption;
-import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class ReferenceSync implements ServiceTrackerCustomizer<Object, Object> {
-
- public ReferenceSync(
- ContainerState containerState,
- ExtendedReferenceDTO referenceDTO,
- ExtendedComponentInstanceDTO componentInstanceDTO,
- InstanceActivator.Builder<?> builder) {
-
- _containerState = containerState;
- _referenceDTO = referenceDTO;
- _componentInstanceDTO = componentInstanceDTO;
- _builder = builder;
- _templateDTO = (ExtendedReferenceTemplateDTO)_referenceDTO.template;
- _log = _containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public Object addingService(final ServiceReference<Object> reference) {
- boolean active = _componentInstanceDTO.active;
- boolean resolved = (_referenceDTO.matches.size() >= _templateDTO.minimumCardinality);
- boolean dynamic = (_templateDTO.policy == ReferencePolicy.DYNAMIC);
- boolean reluctant = (_templateDTO.policyOption == ReferencePolicyOption.RELUCTANT);
- CollectionType collectionType = _templateDTO.collectionType;
- boolean requiresUpdate = true;
-
- if (resolved && reluctant && active && !dynamic) {
- requiresUpdate = false;
- }
-
- try (Syncro open = _syncro.open()) {
- _referenceDTO.matches = SRs.from(_referenceDTO.serviceTracker.getServiceReferences(), reference);
-
- if (collectionType == CollectionType.BINDER_SERVICE ||
- collectionType == CollectionType.BINDER_REFERENCE ||
- collectionType == CollectionType.BINDER_BEAN_SERVICE_OBJECTS) {
-
- requiresUpdate = false;
-
- return _referenceDTO.binder.addingService(reference);
- }
- else if (collectionType == CollectionType.PROPERTIES) {
- return Maps.of(reference.getProperties());
- }
- else if (collectionType == CollectionType.REFERENCE) {
- return reference;
- }
- else if (collectionType == CollectionType.SERVICEOBJECTS) {
- return new BeanServiceObjectsImpl<>(
- _containerState.bundleContext().getServiceObjects(reference));
- }
- else if (collectionType == CollectionType.TUPLE) {
- return new SimpleImmutableEntry<>(
- Maps.of(reference.getProperties()),
- _containerState.bundleContext().getService(reference));
- }
-
- return _containerState.bundleContext().getService(reference);
- }
- finally {
- if (requiresUpdate) {
- InstanceActivator activator = _builder.setInstance(
- _componentInstanceDTO
- ).build();
-
- updateStatically(activator);
- }
- }
- }
-
- @Override
- public void modifiedService(ServiceReference<Object> reference, Object service) {
- CollectionType collectionType = _templateDTO.collectionType;
-
- if (collectionType == CollectionType.BINDER_SERVICE ||
- collectionType == CollectionType.BINDER_REFERENCE ||
- collectionType == CollectionType.BINDER_BEAN_SERVICE_OBJECTS) {
-
- _referenceDTO.binder.modifiedService(reference);
- }
- else if (collectionType == CollectionType.PROPERTIES ||
- collectionType == CollectionType.REFERENCE ||
- collectionType == CollectionType.SERVICEOBJECTS ||
- collectionType == CollectionType.TUPLE) {
-
- removedService(reference, service);
- addingService(reference);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void removedService(ServiceReference<Object> reference, Object service) {
- boolean active = _componentInstanceDTO.active;
- boolean resolved = (_referenceDTO.matches.size() >= _templateDTO.minimumCardinality);
- boolean dynamic = (_templateDTO.policy == ReferencePolicy.DYNAMIC);
- CollectionType collectionType = _templateDTO.collectionType;
- boolean requiresUpdate = true;
-
- if (resolved && active && dynamic) {
- requiresUpdate = false;
- }
-
- try (Syncro open = _syncro.open()) {
- _referenceDTO.matches.removeIf(d -> d.id == SRs.id(reference));
-
- if (collectionType == CollectionType.BINDER_SERVICE ||
- collectionType == CollectionType.BINDER_REFERENCE ||
- collectionType == CollectionType.BINDER_BEAN_SERVICE_OBJECTS) {
-
- requiresUpdate = false;
-
- _referenceDTO.binder.removedService(reference);
-
- return;
- }
- else if (collectionType == CollectionType.PROPERTIES) {
- return;
- }
- else if (collectionType == CollectionType.REFERENCE) {
- return;
- }
- else if (collectionType == CollectionType.SERVICEOBJECTS) {
- ((BeanServiceObjectsImpl<Object>)service).close();
-
- return;
- }
-
- _containerState.bundleContext().ungetService(reference);
- }
- finally {
- if (requiresUpdate) {
- InstanceActivator activator = _builder.setInstance(
- _componentInstanceDTO
- ).build();
-
- updateStatically(activator);
- }
- }
- }
-
- @Override
- public String toString() {
- if (_string == null) {
- _string = Conversions.convert(_referenceDTO.template).to(ReferenceTemplateDTO.class).toString();
- }
- return _string;
- }
-
- private void updateStatically(InstanceActivator activator) {
- _containerState.submit(
- activator.closeOp(), activator::close
- ).then(
- s -> _containerState.submit(
- activator.openOp(), activator::open
- ).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in OPEN for {} on {}", _componentInstanceDTO.ident(), _containerState.bundle(), f));
-
- _containerState.error(f);
- }
- ),
- f -> {
- _log.error(l -> l.error("CCR Error in CLODE for {} on {}", _componentInstanceDTO.ident(), _containerState.bundle(), f.getFailure()));
-
- _containerState.error(f.getFailure());
- }
- );
- }
-
- private final InstanceActivator.Builder<?> _builder;
- private final ExtendedComponentInstanceDTO _componentInstanceDTO;
- private final ContainerState _containerState;
- private final Logger _log;
- private final ExtendedReferenceDTO _referenceDTO;
- private volatile String _string;
- private final Syncro _syncro = new Syncro(true);
- private final ExtendedReferenceTemplateDTO _templateDTO;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
deleted file mode 100644
index 3e1cf40..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.container;
-
-import static javax.interceptor.Interceptor.Priority.PLATFORM_AFTER;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.annotation.Priority;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMember;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionPoint;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-import javax.enterprise.inject.spi.Producer;
-import javax.enterprise.inject.spi.ProducerFactory;
-
-import org.apache.aries.cdi.container.internal.bean.ComponentPropertiesBean;
-import org.apache.aries.cdi.container.internal.bean.ReferenceBean;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.model.ComponentPropertiesModel;
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentInstanceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedReferenceTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.FactoryComponent;
-import org.apache.aries.cdi.container.internal.model.OSGiBean;
-import org.apache.aries.cdi.container.internal.model.ReferenceModel;
-import org.apache.aries.cdi.container.internal.model.SingleComponent;
-import org.apache.aries.cdi.container.internal.util.Annotates;
-import org.apache.aries.cdi.container.internal.util.SRs;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.PrototypeServiceFactory;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cdi.CDIConstants;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.ServiceScope;
-import org.osgi.service.cdi.annotations.ComponentProperties;
-import org.osgi.service.cdi.annotations.Reference;
-import org.osgi.service.cdi.reference.BindBeanServiceObjects;
-import org.osgi.service.cdi.reference.BindService;
-import org.osgi.service.cdi.reference.BindServiceReference;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.template.ActivationTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Promise;
-
-public class RuntimeExtension implements Extension {
-
- public RuntimeExtension(
- ContainerState containerState,
- ConfigurationListener.Builder configurationBuilder,
- SingleComponent.Builder singleBuilder,
- FactoryComponent.Builder factoryBuilder) {
-
- _containerState = containerState;
-
- _log = _containerState.containerLogs().getLogger(getClass());
- _log.debug(l -> l.debug("CCR RuntimeExtension {}", containerState.bundle()));
-
- _configurationBuilder = configurationBuilder;
- _singleBuilder = singleBuilder;
- _factoryBuilder = factoryBuilder;
- _containerTemplate = _containerState.containerDTO().template.components.get(0);
- }
-
- void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
- bbd.addQualifier(org.osgi.service.cdi.annotations.ComponentProperties.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.MinimumCardinality.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.PID.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.PrototypeRequired.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.Reference.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.Reluctant.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.Service.class);
- bbd.addQualifier(org.osgi.service.cdi.annotations.ServiceInstance.class);
- bbd.addScope(org.osgi.service.cdi.annotations.ComponentScoped.class, false, false);
- bbd.addStereotype(org.osgi.service.cdi.annotations.FactoryComponent.class);
- bbd.addStereotype(org.osgi.service.cdi.annotations.SingleComponent.class);
- }
-
- void processBindObject(@Observes ProcessInjectionPoint<?, BindService<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- void processBindServiceObjects(@Observes ProcessInjectionPoint<?, BindBeanServiceObjects<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- void processBindServiceReference(@Observes ProcessInjectionPoint<?, BindServiceReference<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- void processInjectionPoint(@Observes ProcessInjectionPoint<?, ?> pip) {
- processInjectionPoint0(pip, false);
- }
-
- <X> void processBean(@Observes ProcessBean<X> pb) {
- final Class<X> declaringClass = Annotates.declaringClass(pb);
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _containerState.beansModel().getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- final Annotated annotated = pb.getAnnotated();
-
- try {
- List<String> serviceTypes = Annotates.serviceClassNames(annotated);
- Map<String, Object> componentProperties = Annotates.componentProperties(annotated);
- ServiceScope serviceScope = Annotates.serviceScope(annotated);
-
- if (annotated.isAnnotationPresent(org.osgi.service.cdi.annotations.SingleComponent.class) ||
- annotated.isAnnotationPresent(org.osgi.service.cdi.annotations.FactoryComponent.class)) {
-
- ActivationTemplateDTO activationTemplate = osgiBean.getComponent().activations.get(0);
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypes;
- osgiBean.getComponent().properties = componentProperties;
- }
- else if (annotated.isAnnotationPresent(org.osgi.service.cdi.annotations.ComponentScoped.class)) {
- // Explicitly ignore this case
- }
- else if (!serviceTypes.isEmpty()) {
- AnnotatedMember<?> producer = null;
-
- if (pb instanceof ProcessProducerField) {
- producer = ((ProcessProducerField<?, ?>) pb).getAnnotatedProducerField();
- }
- else if (pb instanceof ProcessProducerMethod) {
- producer = ((ProcessProducerMethod<?, ?>) pb).getAnnotatedProducerMethod();
- }
-
- ExtendedActivationTemplateDTO activationTemplate = null;
-
- for (ActivationTemplateDTO at : _containerTemplate.activations) {
- ExtendedActivationTemplateDTO extended = (ExtendedActivationTemplateDTO)at;
- if (extended.declaringClass.equals(declaringClass) && Objects.equals(extended.producer, producer)) {
- activationTemplate = extended;
- break;
- }
- }
-
- if (activationTemplate == null) {
- activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.cdiScope = pb.getBean().getScope();
- activationTemplate.declaringClass = declaringClass;
- activationTemplate.producer = producer;
- _containerTemplate.activations.add(activationTemplate);
- }
-
- activationTemplate.properties = componentProperties;
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypes;
- }
- }
- catch (Exception e) {
- pb.addDefinitionError(e);
- }
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) {
- abd.addContext(_containerState.componentContext());
-
- _containerState.containerDTO().template.components.forEach(
- ct -> addBeans(ct, abd, bm)
- );
- }
-
- void afterDeploymentValidation(
- @Observes @Priority(PLATFORM_AFTER + 100) AfterDeploymentValidation adv,
- BeanManager bm) {
-
- _log.debug(l -> l.debug("CCR AfterDeploymentValidation on {}", _containerState.bundle()));
-
- _containerState.beanManager(bm);
-
- ComponentDTO componentDTO = _containerState.containerDTO().components.get(0);
-
- _containerState.submit(
- Op.of(Mode.OPEN, Type.CONTAINER_PUBLISH_SERVICES, _containerState.id()),
- () -> registerServices(componentDTO, bm)
- ).then(
- s -> initComponents()
- ).then(s -> {
- Dictionary<String, Object> properties = new Hashtable<>();
- properties.put(CDIConstants.CDI_CONTAINER_ID, _containerState.id());
- properties.put(Constants.SERVICE_DESCRIPTION, "Aries CDI - BeanManager for " + _containerState.bundle());
- properties.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
-
- registerService(
- new String[] {BeanManager.class.getName()}, bm,
- properties);
-
- return s;
- }
- );
- }
-
- void beforeShutdown(@Observes BeforeShutdown bs) {
- _log.debug(l -> l.debug("CCR BeforeShutdown on {}", _containerState.bundle()));
-
- _containerState.beanManager(null);
-
- _configurationListeners.removeIf(
- cl -> {
- _containerState.submit(cl.closeOp(), cl::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error while closing configuration listener {} on {}", cl, _containerState.bundle(), f));
- }
- );
-
- return true;
- }
- );
-
- _registrations.removeIf(
- r -> {
- try {
- r.unregister();
- }
- catch (Exception e) {
- _log.error(l -> l.error("CCR Error while unregistring {} on {}", r, _containerState.bundle(), e));
- }
- return true;
- }
- );
- }
-
- private void addBeans(ComponentTemplateDTO componentTemplate, AfterBeanDiscovery abd, BeanManager bm) {
- ComponentDTO componentDTO = _containerState.containerDTO().components.get(0);
-
- componentTemplate.references.stream().map(ExtendedReferenceTemplateDTO.class::cast).forEach(
- t -> {
- ReferenceBean bean = t.bean;
- bean.setBeanManager(bm);
- if (componentTemplate.type == ComponentType.CONTAINER) {
- componentDTO.instances.get(0).references.stream().filter(
- r -> r.template == t
- ).findFirst().map(
- ExtendedReferenceDTO.class::cast
- ).ifPresent(
- r -> bean.setReferenceDTO(r)
- );
- }
-
- _log.debug(l -> l.debug("CCR Adding synthetic bean {} on {}", bean, _containerState.bundle()));
-
- abd.addBean(bean);
- }
- );
-
- componentTemplate.configurations.stream().map(ExtendedConfigurationTemplateDTO.class::cast).filter(
- t -> Objects.nonNull(t.injectionPointType)
- ).forEach(
- t -> {
- ComponentPropertiesBean bean = t.bean;
-
- _log.debug(l -> l.debug("CCR Adding synthetic bean {} on {}", bean, _containerState.bundle()));
-
- abd.addBean(bean);
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- private Producer<Object> createProducer(Object producerObject, Bean<Object> bean, BeanManager bm) {
- ProducerFactory<Object> producerFactory = null;
- if (producerObject instanceof AnnotatedField)
- producerFactory = bm.getProducerFactory((AnnotatedField<Object>)producerObject, bean);
- else if (producerObject instanceof AnnotatedMethod)
- producerFactory = bm.getProducerFactory((AnnotatedMethod<Object>)producerObject, bean);
-
- if (producerFactory == null)
- return null;
-
- return producerFactory.createProducer(bean);
- }
-
- private Promise<Boolean> initComponents() {
- _containerState.containerDTO().template.components.stream().filter(
- t -> t.type != ComponentType.CONTAINER
- ).map(ExtendedComponentTemplateDTO.class::cast).forEach(
- this::initComponent
- );
-
- return null;
- }
-
- private void initComponent(ExtendedComponentTemplateDTO componentTemplateDTO) {
- if (componentTemplateDTO.type == ComponentType.FACTORY) {
- initFactoryComponent(componentTemplateDTO);
- }
- else {
- initSingleComponent(componentTemplateDTO);
- }
- }
-
- private Promise<Boolean> initFactoryComponent(ExtendedComponentTemplateDTO componentTemplateDTO) {
- ConfigurationListener cl = _configurationBuilder.component(
- _factoryBuilder.template(componentTemplateDTO).build()
- ).build();
-
- _configurationListeners.add(cl);
-
- return _containerState.submit(cl.openOp(), cl::open);
- }
-
- private Promise<Boolean> initSingleComponent(ExtendedComponentTemplateDTO componentTemplateDTO) {
- ConfigurationListener cl = _configurationBuilder.component(
- _singleBuilder.template(componentTemplateDTO).build()
- ).build();
-
- _configurationListeners.add(cl);
-
- return _containerState.submit(cl.openOp(), cl::open);
- }
-
- private boolean matchConfiguration(OSGiBean osgiBean, ProcessInjectionPoint<?, ?> pip) {
- InjectionPoint injectionPoint = pip.getInjectionPoint();
-
- Class<?> declaringClass = Annotates.declaringClass(injectionPoint.getAnnotated());
-
- ConfigurationTemplateDTO current = new ComponentPropertiesModel.Builder(injectionPoint.getType()).declaringClass(
- declaringClass
- ).injectionPoint(
- injectionPoint
- ).build().toDTO();
-
- return osgiBean.getComponent().configurations.stream().map(
- t -> (ExtendedConfigurationTemplateDTO)t
- ).filter(
- t -> current.equals(t)
- ).findFirst().map(
- t -> {
- MarkedInjectionPoint markedInjectionPoint = new MarkedInjectionPoint(injectionPoint);
-
- pip.setInjectionPoint(markedInjectionPoint);
-
- t.bean.setInjectionPoint(injectionPoint);
- t.bean.setMark(markedInjectionPoint.getMark());
-
- return true;
- }
- ).orElse(false);
- }
-
- private boolean matchReference(OSGiBean osgiBean, ProcessInjectionPoint<?, ?> pip) {
- InjectionPoint injectionPoint = pip.getInjectionPoint();
-
- Annotated annotated = injectionPoint.getAnnotated();
-
- ReferenceModel.Builder builder = null;
-
- if (annotated instanceof AnnotatedField) {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
- else if (annotated instanceof AnnotatedMethod) {
- builder = new ReferenceModel.Builder((AnnotatedMethod<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
-
- ReferenceModel referenceModel = builder.injectionPoint(injectionPoint).build();
-
- ExtendedReferenceTemplateDTO current = referenceModel.toDTO();
-
- return osgiBean.getComponent().references.stream().map(
- t -> (ExtendedReferenceTemplateDTO)t
- ).filter(
- t -> current.equals(t)
- ).findFirst().map(
- t -> {
- MarkedInjectionPoint markedInjectionPoint = new MarkedInjectionPoint(injectionPoint);
-
- pip.setInjectionPoint(markedInjectionPoint);
-
- t.bean.setMark(markedInjectionPoint.getMark());
-
- _log.debug(l -> l.debug("CCR maping InjectionPoint {} to reference template {}", injectionPoint, t));
-
- return true;
- }
- ).orElse(false);
- }
-
- private void processInjectionPoint0(ProcessInjectionPoint<?, ?> pip, boolean special) {
- InjectionPoint injectionPoint = pip.getInjectionPoint();
-
- Class<?> declaringClass = Annotates.declaringClass(injectionPoint.getAnnotated());
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _containerState.beansModel().getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- Annotated annotated = injectionPoint.getAnnotated();
- ComponentProperties componentProperties = annotated.getAnnotation(ComponentProperties.class);
- Reference reference = annotated.getAnnotation(Reference.class);
-
- if (((reference != null) || special) && matchReference(osgiBean, pip)) {
- return;
- }
-
- if (componentProperties != null) {
- matchConfiguration(osgiBean, pip);
- }
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- private void registerService(
- ExtendedComponentInstanceDTO componentInstance,
- ExtendedActivationTemplateDTO activationTemplate,
- BeanManager bm) {
-
- ServiceScope scope = activationTemplate.scope;
-
- if (activationTemplate.cdiScope == ApplicationScoped.class) {
- scope = ServiceScope.SINGLETON;
- }
-
- final Context context = bm.getContext(activationTemplate.cdiScope);
- final Bean<Object> bean = (Bean<Object>)bm.resolve(
- bm.getBeans(activationTemplate.declaringClass, Any.Literal.INSTANCE));
- final Producer producer = createProducer(activationTemplate.producer, bean, bm);
-
- Object serviceObject;
-
- if (scope == ServiceScope.PROTOTYPE) {
- serviceObject = new PrototypeServiceFactory<Object>() {
- @Override
- public Object getService(Bundle bundle, ServiceRegistration<Object> registration) {
- CreationalContext<Object> cc = bm.createCreationalContext(bean);
- if (producer != null) {
- return producer.produce(cc);
- }
- return context.get(bean, cc);
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration<Object> registration, Object service) {
- }
- };
- }
- else if (scope == ServiceScope.BUNDLE) {
- serviceObject = new ServiceFactory<Object>() {
- @Override
- public Object getService(Bundle bundle, ServiceRegistration<Object> registration) {
- CreationalContext<Object> cc = bm.createCreationalContext(bean);
- if (producer != null) {
- return producer.produce(cc);
- }
- return context.get(bean, cc);
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration<Object> registration, Object service) {
- }
- };
- }
- else {
- CreationalContext<Object> cc = bm.createCreationalContext(bean);
- if (producer != null) {
- serviceObject = producer.produce(cc);
- }
- else {
- serviceObject = context.get(bean, cc);
- }
- }
-
- Objects.requireNonNull(serviceObject, "The service object is somehow null on " + this);
-
- Dictionary<String, Object> properties = new Hashtable<>(
- componentInstance.componentProperties(activationTemplate.properties));
-
- ServiceRegistration<?> serviceRegistration = registerService(
- activationTemplate.serviceClasses.toArray(new String[0]),
- serviceObject, properties);
-
- ExtendedActivationDTO activationDTO = new ExtendedActivationDTO();
- activationDTO.errors = new CopyOnWriteArrayList<>();
- activationDTO.service = SRs.from(serviceRegistration.getReference());
- activationDTO.template = activationTemplate;
- componentInstance.activations.add(activationDTO);
- }
-
- private ServiceRegistration<?> registerService(String[] serviceTypes, Object serviceObject, Dictionary<String, Object> properties) {
- ServiceRegistration<?> serviceRegistration = _containerState.bundleContext().registerService(
- serviceTypes, serviceObject, properties);
-
- _registrations.add(serviceRegistration);
-
- return serviceRegistration;
- }
-
- private boolean registerServices(ComponentDTO componentDTO, BeanManager bm) {
- componentDTO.template.activations.stream().map(
- ExtendedActivationTemplateDTO.class::cast
- ).forEach(
- a -> registerService((ExtendedComponentInstanceDTO)componentDTO.instances.get(0), a, bm)
- );
-
- return true;
- }
-
- private final ConfigurationListener.Builder _configurationBuilder;
- private final List<ConfigurationListener> _configurationListeners = new CopyOnWriteArrayList<>();
- private final ContainerState _containerState;
- private final ComponentTemplateDTO _containerTemplate;
- private final FactoryComponent.Builder _factoryBuilder;
- private final Logger _log;
- private final List<ServiceRegistration<?>> _registrations = new CopyOnWriteArrayList<>();
- private final SingleComponent.Builder _singleBuilder;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleClassLoader.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleClassLoader.java
deleted file mode 100644
index 9246c04..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleClassLoader.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.loader;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.osgi.framework.Bundle;
-
-public class BundleClassLoader extends URLClassLoader {
-
- public BundleClassLoader(Bundle[] bundles) {
- super(new URL[0]);
-
- if (bundles.length == 0) {
- throw new IllegalArgumentException(
- "At least one bundle is required");
- }
-
- _bundles = bundles;
- }
-
- @Override
- public URL findResource(String name) {
- for (Bundle bundle : _bundles) {
- URL url = bundle.getResource(name);
-
- if (url != null) {
- return url;
- }
- }
-
- return null;
- }
-
- @Override
- public Enumeration<URL> findResources(String name) {
- for (Bundle bundle : _bundles) {
- try {
- Enumeration<URL> enumeration = bundle.getResources(name);
-
- if ((enumeration != null) && enumeration.hasMoreElements()) {
- return enumeration;
- }
- }
- catch (IOException ioe) {
- }
- }
-
- return Collections.emptyEnumeration();
- }
-
- public Bundle[] getBundles() {
- return _bundles;
- }
-
- @Override
- public URL getResource(String name) {
- return findResource(name);
- }
-
- @Override
- public Enumeration<URL> getResources(String name) {
- return findResources(name);
- }
-
- @Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
- Object classLoadingLock = getClassLoadingLock(name);
-
- synchronized (classLoadingLock) {
- for (Bundle bundle : _bundles) {
- try {
- return bundle.loadClass(name);
- }
- catch (ClassNotFoundException cnfe) {
- continue;
- }
- }
-
- throw new ClassNotFoundException(name);
- }
- }
-
- @Override
- protected Class<?> loadClass(String name, boolean resolve)
- throws ClassNotFoundException {
-
- Object classLoadingLock = getClassLoadingLock(name);
-
- synchronized (classLoadingLock) {
- Class<?> clazz = _cache.get(name);
-
- if (clazz == null) {
- clazz = findClass(name);
-
- if (resolve) {
- resolveClass(clazz);
- }
-
- _cache.put(name, clazz);
- }
-
- return clazz;
- }
- }
-
- private final Bundle[] _bundles;
- private final ConcurrentMap<String, Class<?>> _cache = new ConcurrentHashMap<>();
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleResourcesLoader.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleResourcesLoader.java
deleted file mode 100644
index 621ac34..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/loader/BundleResourcesLoader.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.loader;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.weld.resources.spi.ResourceLoader;
-import org.jboss.weld.resources.spi.ResourceLoadingException;
-import org.jboss.weld.serialization.spi.ProxyServices;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleWire;
-import org.osgi.framework.wiring.BundleWiring;
-
-public class BundleResourcesLoader implements ProxyServices, ResourceLoader {
-
- public static class Builder {
-
- public Builder(Bundle bundle, Bundle extenderBundle) {
- this.bundle = bundle;
- this.extenderBundle = extenderBundle;
- }
-
- public Builder add(Bundle bundle) {
- additionalBundles.add(bundle);
- return this;
- }
-
- public BundleResourcesLoader build() {
- return new BundleResourcesLoader(bundle, extenderBundle, additionalBundles);
- }
-
- private final Bundle bundle;
- private final Bundle extenderBundle;
- private final List<Bundle> additionalBundles = new ArrayList<>();
- }
-
- BundleResourcesLoader(Bundle bundle, Bundle extenderBundle, List<Bundle> additionalBundles) {
- BundleWiring extenderWiring = extenderBundle.adapt(BundleWiring.class);
-
- List<Bundle> bundles = new ArrayList<>();
-
- bundles.add(bundle);
- bundles.add(extenderBundle);
-
- List<BundleWire> requiredWires = extenderWiring.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE);
-
- for (BundleWire bundleWire : requiredWires) {
- BundleCapability capability = bundleWire.getCapability();
- Map<String, Object> attributes = capability.getAttributes();
- String packageName = (String)attributes.get(PackageNamespace.PACKAGE_NAMESPACE);
- if (!packageName.startsWith("org.jboss.weld.")) {
- continue;
- }
-
- Bundle wireBundle = bundleWire.getProvider().getBundle();
- if (!bundles.contains(wireBundle)) {
- bundles.add(wireBundle);
- }
- }
-
- bundles.addAll(additionalBundles);
-
- _classLoader = new BundleClassLoader(bundles.toArray(new Bundle[0]));
- }
-
-
- @Override
- public void cleanup() {
- }
-
- @Override
- public Class<?> classForName(String className) {
- try {
- return _classLoader.loadClass(className);
- }
- catch (ClassNotFoundException e) {
- throw new ResourceLoadingException(ERROR_LOADING_CLASS + className, e);
- }
- catch (LinkageError e) {
- throw new ResourceLoadingException(ERROR_LOADING_CLASS + className, e);
- }
- catch (TypeNotPresentException e) {
- throw new ResourceLoadingException(ERROR_LOADING_CLASS + className, e);
- }
- }
-
- @Override
- public ClassLoader getClassLoader(Class<?> proxiedBeanType) {
- return _classLoader;
- }
-
- @Override
- public Class<?> loadBeanClass(String className) {
- return classForName(className);
- }
-
- @Override
- public URL getResource(String name) {
- return _classLoader.getResource(name);
- }
-
- @Override
- public Collection<URL> getResources(String name) {
- try {
- return Collections.list(_classLoader.getResources(name));
- }
- catch (IOException e) {
- return Collections.emptyList();
- }
- }
-
- private static final String ERROR_LOADING_CLASS = "Error loading class ";
-
- private final ClassLoader _classLoader;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModel.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModel.java
deleted file mode 100644
index 4933d14..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModel.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
-
-import org.jboss.weld.bootstrap.spi.BeansXml;
-import org.jboss.weld.xml.BeansXmlParser;
-
-public class BeansModel {
-
- public BeansModel(
- Map<String, OSGiBean> beans,
- Collection<URL> beanDescriptorURLs) {
-
- _beans = beans;
-
- BeansXml beansXml = BeansXml.EMPTY_BEANS_XML;
-
- if (!beanDescriptorURLs.isEmpty()) {
- BeansXmlParser beansXmlParser = new BeansXmlParser();
- beansXml = beansXmlParser.parse(beanDescriptorURLs);
- }
-
- _beansXml = beansXml;
- }
-
- public Collection<String> getBeanClassNames() {
- return _beans.keySet();
- }
-
- public BeansXml getBeansXml() {
- return _beansXml;
- }
-
- public OSGiBean getOSGiBean(String beanClass) {
- return _beans.get(beanClass);
- }
-
- public Collection<OSGiBean> getOSGiBeans() {
- return _beans.values();
- }
-
- public void putOSGiBean(String beanClass, OSGiBean osgiBean) {
- _beans.put(beanClass, osgiBean);
- }
-
- private final Map<String, OSGiBean> _beans;
- private final BeansXml _beansXml;
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java
deleted file mode 100644
index 0ec959b..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import static org.apache.aries.cdi.container.internal.util.Reflection.cast;
-import static org.osgi.service.cdi.CDIConstants.REQUIREMENT_BEANS_ATTRIBUTE;
-import static org.osgi.service.cdi.CDIConstants.REQUIREMENT_DESCRIPTOR_ATTRIBUTE;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.service.log.Logger;
-
-public class BeansModelBuilder {
-
- public BeansModelBuilder(
- ContainerState containerState,
- ClassLoader aggregateClassLoader,
- BundleWiring bundleWiring,
- Map<String, Object> cdiAttributes) {
-
- _containerState = containerState;
- _aggregateClassLoader = aggregateClassLoader;
- _bundleWiring = bundleWiring;
- _attributes = cdiAttributes;
- _bundle = _bundleWiring.getBundle();
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- public BeansModel build() {
- List<URL> beanDescriptorURLs = new ArrayList<URL>();
- Map<String, Object> attributes = getAttributes();
-
- List<String> beanDescriptorPaths = cast(attributes.get(REQUIREMENT_DESCRIPTOR_ATTRIBUTE));
-
- if (beanDescriptorPaths == null) {
- beanDescriptorPaths = new ArrayList<>();
- }
-
- if (beanDescriptorPaths.isEmpty()) {
- beanDescriptorPaths.add("META-INF/beans.xml");
- }
-
- if (beanDescriptorPaths != null) {
- for (String descriptorPath : beanDescriptorPaths) {
- URL url = getResource(descriptorPath);
-
- if (url != null) {
- beanDescriptorURLs.add(url);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- List<String> beanClassNames = Optional.ofNullable(
- _attributes.get(REQUIREMENT_BEANS_ATTRIBUTE)
- ).map(v -> (List<String>)v).orElse(Collections.emptyList());
-
- Map<String, OSGiBean> beans = new HashMap<>();
-
- for (String beanClassName : beanClassNames) {
- try {
- Class<?> clazz = _aggregateClassLoader.loadClass(beanClassName);
-
- beans.put(beanClassName, new OSGiBean.Builder(_containerState.containerLogs(), clazz).build());
-
- _log.debug(l -> l.debug("CCR found bean {} on {}", beanClassName, _containerState.bundle()));
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Error loading class {} on {}", beanClassName, _containerState.bundle(), t));
-
- _containerState.error(t);
- }
- }
-
- return new BeansModel(beans, beanDescriptorURLs);
- }
-
- public Map<String, Object> getAttributes() {
- return _attributes;
- }
-
- public URL getResource(String resource) {
- return _bundle.getResource(resource);
- }
-
-
- private final ClassLoader _aggregateClassLoader;
- private final Map<String, Object> _attributes;
- private final Bundle _bundle;
- private final BundleWiring _bundleWiring;
- private final ContainerState _containerState;
- private final Logger _log;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindBeanServiceObjectsImpl.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindBeanServiceObjectsImpl.java
deleted file mode 100644
index 2e0dba5..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindBeanServiceObjectsImpl.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Consumer;
-
-import org.apache.aries.cdi.container.internal.container.BeanServiceObjectsImpl;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.reference.BeanServiceObjects;
-import org.osgi.service.cdi.reference.BindBeanServiceObjects;
-import org.osgi.service.log.Logger;
-
-public class BindBeanServiceObjectsImpl<T> implements Binder<T>, BindBeanServiceObjects<T> {
-
- private final ContainerState _containerState;
- private final Logger _log;
-
- private final List<ServiceReference<T>> _queue = new CopyOnWriteArrayList<>();
- private final AtomicBoolean _enqueue = new AtomicBoolean(true);
- private volatile Optional<Consumer<BeanServiceObjects<T>>> onAdding = Optional.empty();
- private volatile Optional<Consumer<BeanServiceObjects<T>>> onUpdate = Optional.empty();
- private volatile Optional<Consumer<BeanServiceObjects<T>>> onRemove = Optional.empty();
-
- private volatile BeanServiceObjects<T> serviceObjects;
-
- public BindBeanServiceObjectsImpl(ContainerState containerState) {
- _containerState = containerState;
- _log = _containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> addingService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.add(reference);
- return this;
- }
-
- BundleContext bundleContext = _containerState.bundleContext();
- serviceObjects = new BeanServiceObjectsImpl<T>(bundleContext.getServiceObjects(reference));
-
- onAdding.ifPresent(
- c -> {
- try {
- c.accept(serviceObjects);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> modifiedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- return this; // i.e. do nothing
- }
-
- onUpdate.ifPresent(
- c -> {
- try {
- c.accept(serviceObjects);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> removedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.remove(reference);
- return this;
- }
-
- onRemove.ifPresent(
- c -> {
- try {
- c.accept(serviceObjects);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public void bind() {
- _enqueue.set(false);
- _queue.removeIf(
- reference -> {
- addingService(reference);
- return true;
- }
- );
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> adding(Consumer<BeanServiceObjects<T>> action) {
- onAdding = Optional.ofNullable(action);
- return this;
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> modified(Consumer<BeanServiceObjects<T>> consumer) {
- onUpdate = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindBeanServiceObjectsImpl<T> removed(Consumer<BeanServiceObjects<T>> consumer) {
- onRemove = Optional.ofNullable(consumer);
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceImpl.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceImpl.java
deleted file mode 100644
index b53d418..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceImpl.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.util.Maps;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.reference.BindService;
-import org.osgi.service.log.Logger;
-
-public class BindServiceImpl<T> implements Binder<T>, BindService<T> {
-
- private final ContainerState _containerState;
- private final Logger _log;
-
- private final List<ServiceReference<T>> _queue = new CopyOnWriteArrayList<>();
- private final AtomicBoolean _enqueue = new AtomicBoolean(true);
- private volatile Optional<Consumer<T>> onAdding = Optional.empty();
- private volatile Optional<BiConsumer<T, Map<String, Object>>> onAddingBi = Optional.empty();
- private volatile Optional<Consumer<T>> onUpdate = Optional.empty();
- private volatile Optional<BiConsumer<T, Map<String, Object>>> onUpdateBi = Optional.empty();
- private volatile Optional<Consumer<T>> onRemove = Optional.empty();
- private volatile Optional<BiConsumer<T, Map<String, Object>>> onRemoveBi = Optional.empty();
-
- private volatile T service;
-
- public BindServiceImpl(ContainerState containerState) {
- _containerState = containerState;
- _log = _containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public BindServiceImpl<T> addingService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.add(reference);
- return this;
- }
-
- BundleContext bundleContext = _containerState.bundleContext();
- service = bundleContext.getService(reference);
- Map<String, Object> map = Maps.of(reference.getProperties());
-
- onAdding.ifPresent(
- c -> {
- try {
- c.accept(service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onAddingBi.ifPresent(
- c -> {
- try {
- c.accept(service, map);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindServiceImpl<T> modifiedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- return this; // i.e. do nothing
- }
-
- Map<String, Object> map = Maps.of(reference.getProperties());
-
- onUpdate.ifPresent(
- c -> {
- try {
- c.accept(service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onUpdateBi.ifPresent(
- c -> {
- try {
- c.accept(service, map);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindServiceImpl<T> removedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.remove(reference);
- return this;
- }
-
- Map<String, Object> map = Maps.of(reference.getProperties());
-
- onRemove.ifPresent(
- c -> {
- try {
- c.accept(service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onRemoveBi.ifPresent(
- c -> {
- try {
- c.accept(service, map);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public void bind() {
- _enqueue.set(false);
- _queue.removeIf(
- reference -> {
- addingService(reference);
- return true;
- }
- );
- }
-
- @Override
- public BindServiceImpl<T> adding(Consumer<T> action) {
- onAdding = Optional.ofNullable(action);
- return this;
- }
-
- @Override
- public BindServiceImpl<T> adding(BiConsumer<T, Map<String, Object>> action) {
- onAddingBi = Optional.ofNullable(action);
- return this;
- }
-
- @Override
- public BindServiceImpl<T> modified(Consumer<T> consumer) {
- onUpdate = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceImpl<T> modified(BiConsumer<T, Map<String, Object>> consumer) {
- onUpdateBi = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceImpl<T> removed(Consumer<T> consumer) {
- onRemove = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceImpl<T> removed(BiConsumer<T, Map<String, Object>> consumer) {
- onRemoveBi = Optional.ofNullable(consumer);
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceReferenceImpl.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceReferenceImpl.java
deleted file mode 100644
index 11adfcd..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BindServiceReferenceImpl.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.reference.BindServiceReference;
-import org.osgi.service.log.Logger;
-
-public class BindServiceReferenceImpl<T> implements Binder<T>, BindServiceReference<T> {
-
- private final ContainerState _containerState;
- private final Logger _log;
-
- private final List<ServiceReference<T>> _queue = new CopyOnWriteArrayList<>();
- private final AtomicBoolean _enqueue = new AtomicBoolean(true);
- private volatile Optional<Consumer<ServiceReference<T>>> onAdding = Optional.empty();
- private volatile Optional<BiConsumer<ServiceReference<T>, T>> onAddingBi = Optional.empty();
- private volatile Optional<Consumer<ServiceReference<T>>> onUpdate = Optional.empty();
- private volatile Optional<BiConsumer<ServiceReference<T>, T>> onUpdateBi = Optional.empty();
- private volatile Optional<Consumer<ServiceReference<T>>> onRemove = Optional.empty();
- private volatile Optional<BiConsumer<ServiceReference<T>, T>> onRemoveBi = Optional.empty();
-
- private volatile T service;
-
- public BindServiceReferenceImpl(ContainerState containerState) {
- _containerState = containerState;
- _log = _containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public BindServiceReferenceImpl<T> addingService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.add(reference);
- return this;
- }
-
- BundleContext bundleContext = _containerState.bundleContext();
- service = bundleContext.getService(reference);
-
- onAdding.ifPresent(
- c -> {
- try {
- c.accept(reference);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onAddingBi.ifPresent(
- c -> {
- try {
- c.accept(reference, service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> modifiedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- return this; // i.e. do nothing
- }
-
- onUpdate.ifPresent(
- c -> {
- try {
- c.accept(reference);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onUpdateBi.ifPresent(
- c -> {
- try {
- c.accept(reference, service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> removedService(ServiceReference<T> reference) {
- if (_enqueue.get()) {
- _queue.remove(reference);
- return this;
- }
-
- onRemove.ifPresent(
- c -> {
- try {
- c.accept(reference);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
- onRemoveBi.ifPresent(
- c -> {
- try {
- c.accept(reference, service);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR error in {}", this, t));
- }
- }
- );
-
- return this;
- }
-
- @Override
- public void bind() {
- _enqueue.set(false);
- _queue.removeIf(
- reference -> {
- addingService(reference);
- return true;
- }
- );
- }
-
- @Override
- public BindServiceReferenceImpl<T> adding(Consumer<ServiceReference<T>> action) {
- onAdding = Optional.ofNullable(action);
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> adding(BiConsumer<ServiceReference<T>, T> action) {
- onAddingBi = Optional.ofNullable(action);
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> modified(Consumer<ServiceReference<T>> consumer) {
- onUpdate = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> modified(BiConsumer<ServiceReference<T>, T> consumer) {
- onUpdateBi = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> removed(Consumer<ServiceReference<T>> consumer) {
- onRemove = Optional.ofNullable(consumer);
- return this;
- }
-
- @Override
- public BindServiceReferenceImpl<T> removed(BiConsumer<ServiceReference<T>, T> consumer) {
- onRemoveBi = Optional.ofNullable(consumer);
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Binder.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Binder.java
deleted file mode 100644
index 6972f11..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Binder.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import org.osgi.framework.ServiceReference;
-
-public interface Binder<T> {
-
- public Binder<T> addingService(ServiceReference<T> reference);
- public Binder<T> modifiedService(ServiceReference<T> reference);
- public Binder<T> removedService(ServiceReference<T> reference);
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/CollectionType.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/CollectionType.java
deleted file mode 100644
index f40da88..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/CollectionType.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-public enum CollectionType {
- /**
- * The service collection type is used to indicate the collection holds the
- * bound service objects.
- * <p>
- * This is the default collection type.
- */
- SERVICE("service"),
-
- /**
- * The reference collection type is used to indicate the collection holds
- * Service References for the bound services.
- */
- REFERENCE("reference"),
-
- /**
- * The serviceobjects collection type is used to indicate the collection
- * holds Component Service Objects for the bound services.
- */
- SERVICEOBJECTS("serviceobjects"),
-
- /**
- * The properties collection type is used to indicate the collection holds
- * unmodifiable Maps containing the service properties of the bound
- * services.
- * <p>
- * The Maps must implement {@code Comparable} with the {@code compareTo}
- * method comparing service property maps using the same ordering as
- * {@code ServiceReference.compareTo} based upon service ranking and service
- * id.
- */
- PROPERTIES("properties"),
-
- /**
- * The tuple collection type is used to indicate the collection holds
- * unmodifiable Map.Entries whose key is an unmodifiable Map containing the
- * service properties of the bound service, as specified in
- * {@link #PROPERTIES}, and whose value is the bound service object.
- * <p>
- * The Map.Entries must implement {@code Comparable} with the
- * {@code compareTo} method comparing service property maps using the same
- * ordering as {@code ServiceReference.compareTo} based upon service ranking
- * and service id.
- */
- TUPLE("tuple"),
-
- /**
- * Used to indicate the reference is a binder for registering handler
- * methods for tracking service instances.
- */
- BINDER_SERVICE("binder_service"),
-
- /**
- * Used to indicate the reference is a binder for registering handler
- * methods for tracking service references.
- */
- BINDER_REFERENCE("binder_reference"),
-
- /**
- * Used to indicate the reference is a binder for registering handler
- * methods for tracking bean service objects.
- */
- BINDER_BEAN_SERVICE_OBJECTS("binder_bean_service_objects");
-
- private final String value;
-
- CollectionType(String value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return value;
- }
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Component.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Component.java
deleted file mode 100644
index 76536ca..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/Component.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Phase;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentInstanceDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-
-public abstract class Component extends Phase {
-
- public abstract static class Builder<T extends Builder<T>> {
-
- public Builder(ContainerState containerState, InstanceActivator.Builder<?> activatorBuilder) {
- _containerState = containerState;
- _activatorBuilder = activatorBuilder;
- }
-
- @SuppressWarnings("unchecked")
- public T template(ComponentTemplateDTO templateDTO) {
- _templateDTO = templateDTO;
- return (T)this;
- }
-
- public abstract Component build();
-
- protected InstanceActivator.Builder<?> _activatorBuilder;
- protected ContainerState _containerState;
- protected Phase _next;
- protected ComponentTemplateDTO _templateDTO;
-
- }
-
- Component(Builder<?> builder) {
- super(builder._containerState, null);
- _activatorBuilder = builder._activatorBuilder;
- }
-
- public InstanceActivator.Builder<?> activatorBuilder() {
- return _activatorBuilder;
- }
-
- public abstract List<ConfigurationTemplateDTO> configurationTemplates();
-
- public abstract List<ComponentInstanceDTO> instances();
-
- public abstract ComponentDTO snapshot();
-
- public abstract ComponentTemplateDTO template();
-
- @Override
- public String toString() {
- return Arrays.asList(getClass().getSimpleName(), template().name).toString();
- }
-
- private final InstanceActivator.Builder<?> _activatorBuilder;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java
deleted file mode 100644
index 8530ca3..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import static org.apache.aries.cdi.container.internal.util.Reflection.*;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.LinkedHashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.annotations.PID;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-
-public class ComponentPropertiesModel {
-
- public static class Builder {
-
- public Builder(Type injectionPointType) {
- _injectionPointType = injectionPointType;
- }
-
- public ComponentPropertiesModel build() {
- Objects.requireNonNull(_delcaringClass);
- Objects.requireNonNull(_injectionPointType);
- return new ComponentPropertiesModel(_injectionPointType, _delcaringClass, _pid, _qualifiers);
- }
-
- public Builder declaringClass(Class<?> delcaringClass) {
- _delcaringClass = delcaringClass;
- return this;
- }
-
- public Builder injectionPoint(InjectionPoint injectionPoint) {
- _qualifiers = injectionPoint.getQualifiers();
- _pid = injectionPoint.getAnnotated().getAnnotation(PID.class);
- return this;
- }
-
- private Class<?> _delcaringClass;
- private PID _pid;
- private Set<Annotation> _qualifiers;
- private Type _injectionPointType;
-
- }
-
- private ComponentPropertiesModel(
- Type injectionPointType,
- Class<?> delcaringClass,
- PID pid,
- Set<Annotation> qualifiers) {
-
- _injectionPointType = injectionPointType;
- _pid = pid;
- _qualifiers = new LinkedHashSet<>();
- _declaringClass = delcaringClass;
-
- if (qualifiers != null) {
- _qualifiers.addAll(qualifiers);
- }
-
- Type rawType = injectionPointType;
-
- if (_injectionPointType instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType)_injectionPointType;
-
- rawType = pt.getRawType();
- }
-
- _beanClass = cast(rawType);
- }
-
- public PID getPid() {
- return _pid;
- }
-
- public Set<Annotation> getQualifiers() {
- return _qualifiers;
- }
-
- public Type getType() {
- return _injectionPointType;
- }
-
- public ConfigurationTemplateDTO toDTO() {
- ExtendedConfigurationTemplateDTO dto = new ExtendedConfigurationTemplateDTO();
-
- dto.beanClass = _beanClass;
- dto.declaringClass = _declaringClass;
- dto.injectionPointType = _injectionPointType;
- dto.maximumCardinality = MaximumCardinality.ONE;
-
- if (_pid != null) {
- dto.pid = _pid.value();
- }
-
- dto.policy = (_pid != null) ? _pid.policy() : ConfigurationPolicy.OPTIONAL;
-
- return dto;
- }
-
- @Override
- public String toString() {
- if (_string == null) {
- _string = String.format("configuration[type='%s', pid='%s', policy='%s']", _injectionPointType, _pid.value(), _pid.policy());
- }
- return _string;
- }
-
- private final Class<?> _beanClass;
- private final Class<?> _declaringClass;
- private final PID _pid;
- private final Set<Annotation> _qualifiers;
- private volatile String _string;
- private final Type _injectionPointType;
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerActivator.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerActivator.java
deleted file mode 100644
index 2d4a0d2..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerActivator.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import org.apache.aries.cdi.container.internal.container.ContainerBootstrap;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.service.log.Logger;
-
-public class ContainerActivator extends InstanceActivator {
-
- public static class Builder extends InstanceActivator.Builder<Builder> {
-
- public Builder(ContainerState containerState, ContainerBootstrap next) {
- super(containerState, next);
- }
-
- @Override
- public ContainerActivator build() {
- return new ContainerActivator(this);
- }
-
- }
-
- private final Syncro syncro = new Syncro(true);
-
- private ContainerActivator(Builder builder) {
- super(builder);
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- boolean result = next.map(
- next -> {
- submit(next.closeOp(), next::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Failure in container activator close on {}", next, f));
- }
- );
-
- return true;
- }
- ).orElse(true);
-
- _instance.active = false;
-
- return result;
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.CONTAINER_ACTIVATOR, _instance.template.name);
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- if (!_instance.referencesResolved()) {
- return false;
- }
-
- boolean result = next.map(
- next -> {
- submit(next.openOp(), next::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Failure in container activator open on {}", next, f));
-
- containerState.error(f);
- }
- );
-
- return true;
- }
- ).orElse(true);
-
- if (result) {
- _instance.active = true;
- }
-
- return result;
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.CONTAINER_ACTIVATOR, _instance.template.name);
- }
-
- private final Logger _log;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerComponent.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerComponent.java
deleted file mode 100644
index 6af43e7..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ContainerComponent.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentInstanceDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Promise;
-
-public class ContainerComponent extends Component {
-
- public static class Builder extends Component.Builder<Builder> {
-
- public Builder(ContainerState containerState, ContainerActivator.Builder activatorBuilder) {
- super(containerState, activatorBuilder);
- }
-
- @Override
- public ContainerComponent build() {
- template(_containerState.containerComponentTemplateDTO());
- return new ContainerComponent(this);
- }
-
- }
-
- protected ContainerComponent(Builder builder) {
- super(builder);
-
- _log = containerState.containerLogs().getLogger(getClass());
-
- _template = builder._templateDTO;
- _activatorBuilder = builder._activatorBuilder;
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- if (_snapshot == null) {
- return true;
- }
-
- _snapshot.instances.removeIf(
- instance -> {
- ExtendedComponentInstanceDTO einstance = (ExtendedComponentInstanceDTO)instance;
-
- Promise<Boolean> result = submit(einstance.closeOp(), einstance::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in container component close for {} on {}", einstance.ident(), bundle(), f));
- }
- );
-
- try {
- return result.getValue();
- }
- catch (InvocationTargetException | InterruptedException e) {
- return Throw.exception(e);
- }
- }
- );
-
- containerState.containerDTO().components.remove(_snapshot);
- _snapshot = null;
-
- return true;
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.CONTAINER_COMPONENT, _template.name);
- }
-
- @Override
- public List<ConfigurationTemplateDTO> configurationTemplates() {
- return _template.configurations;
- }
-
- @Override
- public List<ComponentInstanceDTO> instances() {
- return _snapshot.instances;
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- _snapshot = new ComponentDTO();
- _snapshot.instances = new CopyOnWriteArrayList<>();
- _snapshot.template = _template;
-
- containerState.containerDTO().components.add(_snapshot);
-
- ExtendedComponentInstanceDTO instanceDTO = new ExtendedComponentInstanceDTO(
- containerState, _activatorBuilder);
-
- instanceDTO.activations = new CopyOnWriteArrayList<>();
- instanceDTO.configurations = new CopyOnWriteArrayList<>();
- instanceDTO.references = new CopyOnWriteArrayList<>();
- instanceDTO.template = _template;
-
- _snapshot.instances.add(instanceDTO);
-
- submit(instanceDTO.openOp(), instanceDTO::open).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in container component open for {} on {}", _template.name, containerState.bundle()));
- }
- );
-
- return true;
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.CONTAINER_COMPONENT, _template.name);
- }
-
- @Override
- public ComponentDTO snapshot() {
- return _snapshot;
- }
-
- @Override
- public ComponentTemplateDTO template() {
- return _template;
- }
-
- private final InstanceActivator.Builder<?> _activatorBuilder;
- private final Logger _log;
- private volatile ComponentDTO _snapshot;
- private final ComponentTemplateDTO _template;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationDTO.java
deleted file mode 100644
index b4f5b6d..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationDTO.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.function.Consumer;
-
-import org.osgi.service.cdi.runtime.dto.ActivationDTO;
-
-public class ExtendedActivationDTO extends ActivationDTO {
-
- public ExtendedComponentInstanceDTO instance;
-
- public Consumer<ExtendedActivationDTO> onClose;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java
deleted file mode 100644
index 89cc5d8..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.annotation.Annotation;
-
-import org.osgi.service.cdi.runtime.dto.template.ActivationTemplateDTO;
-
-public class ExtendedActivationTemplateDTO extends ActivationTemplateDTO {
-
- /**
- * The class which declared the activation (i.e. @Service).
- */
- public Class<?> declaringClass;
-
- public Class<? extends Annotation> cdiScope;
-
- public Object producer;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentInstanceDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentInstanceDTO.java
deleted file mode 100644
index 581a960..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentInstanceDTO.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import static org.apache.aries.cdi.container.internal.util.Filters.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.container.ReferenceSync;
-import org.apache.aries.cdi.container.internal.util.Conversions;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.framework.Constants;
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentInstanceDTO;
-import org.osgi.service.cdi.runtime.dto.ConfigurationDTO;
-import org.osgi.service.cdi.runtime.dto.ReferenceDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class ExtendedComponentInstanceDTO extends ComponentInstanceDTO {
-
- public boolean active;
- public String pid;
- public ComponentTemplateDTO template;
-
- private final InstanceActivator.Builder<?> _builder;
- private final Long _componentId = _componentIds.incrementAndGet();
- private final ContainerState _containerState;
- private final Logger _log;
- private final AtomicReference<InstanceActivator> _noRequiredDependenciesActivator = new AtomicReference<>();
- private final Syncro sync = new Syncro(true);
-
- public ExtendedComponentInstanceDTO(
- ContainerState containerState,
- InstanceActivator.Builder<?> builder) {
-
- _containerState = containerState;
- _builder = builder;
-
- _log = _containerState.containerLogs().getLogger(getClass());
- }
-
- public boolean close() {
- try (Syncro open = sync.open()) {
- _containerState.submit(Op.of(Mode.CLOSE, Type.REFERENCES, ident()),
- () -> {
- references.removeIf(
- r -> {
- ExtendedReferenceDTO referenceDTO = (ExtendedReferenceDTO)r;
- referenceDTO.serviceTracker.close();
- return true;
- }
- );
-
- if (_noRequiredDependenciesActivator.get() != null) {
- _containerState.submit(
- _noRequiredDependenciesActivator.get().closeOp(),
- () -> _noRequiredDependenciesActivator.get().close()
- ).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in CLOSE on {}", ident(), f));
-
- _containerState.error(f);
- }
- );
- }
-
- return true;
- }
- ).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in component instance stop on {}", this, f));
- }
- );
-
- properties = null;
-
- return true;
- }
- }
-
- public Op closeOp() {
- return Op.of(Mode.CLOSE, getType(), ident());
- }
-
- /**
- * @return true when all the configuration templates are resolved, otherwise false
- */
- public final boolean configurationsResolved() {
- for (ConfigurationTemplateDTO template : template.configurations) {
- if (template.policy == ConfigurationPolicy.REQUIRED) {
- // find a configuration snapshot or not resolved
- boolean found = false;
- for (ConfigurationDTO snapshot : configurations) {
- if (snapshot.template == template) {
- found = true;
- }
- }
- if (!found) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public final boolean referencesResolved() {
- for (ReferenceTemplateDTO template : template.references) {
- if (template.minimumCardinality > 0) {
- // find a reference snapshot or not resolved
- boolean found = false;
- for (ReferenceDTO snapshot : references) {
- if (!snapshot.template.equals(template)) continue;
- ExtendedReferenceDTO extended = (ExtendedReferenceDTO)snapshot;
- if (extended.matches.size() >= extended.minimumCardinality) {
- found = true;
- }
- }
- if (!found) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public boolean open() {
- try (Syncro open = sync.open()) {
- if (!configurationsResolved() || (properties != null)) {
- return false;
- }
-
- ConfigurationDTO containerConfiguration = containerConfiguration();
-
- if (containerConfiguration != null) {
- Boolean enabled = Conversions.convert(
- containerConfiguration.properties.get(
- template.name.concat(".enabled"))
- ).defaultValue(Boolean.TRUE).to(Boolean.class);
-
- if (!enabled) {
- _containerState.containerDTO().components.stream().filter(
- c -> c.template == template
- ).forEach(c -> c.enabled = false);
-
- return false;
- }
- else {
- _containerState.containerDTO().components.stream().filter(
- c -> c.template == template
- ).forEach(c -> c.enabled = true);
- }
- }
-
- properties = componentProperties(null);
-
- template.references.stream().map(ExtendedReferenceTemplateDTO.class::cast).forEach(
- t -> {
- ExtendedReferenceDTO referenceDTO = new ExtendedReferenceDTO();
-
- if (t.collectionType == CollectionType.BINDER_SERVICE) {
- referenceDTO.binder = new BindServiceImpl<>(_containerState);
- }
- else if (t.collectionType == CollectionType.BINDER_REFERENCE) {
- referenceDTO.binder = new BindServiceReferenceImpl<>(_containerState);
- }
- else if (t.collectionType == CollectionType.BINDER_BEAN_SERVICE_OBJECTS) {
- referenceDTO.binder = new BindBeanServiceObjectsImpl<>(_containerState);
- }
-
- referenceDTO.matches = new CopyOnWriteArrayList<>();
- referenceDTO.minimumCardinality = minimumCardinality(t.name, t.minimumCardinality);
- referenceDTO.targetFilter = targetFilter(t.serviceType, t.name, t.targetFilter);
- referenceDTO.template = t;
- referenceDTO.serviceTracker = new ServiceTracker<>(
- _containerState.bundleContext(),
- asFilter(referenceDTO.targetFilter),
- new ReferenceSync(_containerState, referenceDTO, this, _builder));
-
- references.add(referenceDTO);
- }
- );
-
- _containerState.submit(
- Op.of(Mode.OPEN, Type.REFERENCES, ident()),
- () -> {
- references.stream().map(ExtendedReferenceDTO.class::cast).forEach(
- r -> r.serviceTracker.open()
- );
-
- return referencesResolved();
- }
- ).then(
- s -> {
- if (s.getValue()) {
- // none of the reference dependencies are required
- _noRequiredDependenciesActivator.set(_builder.setInstance(this).build());
-
- return _containerState.submit(
- _noRequiredDependenciesActivator.get().openOp(),
- () -> _noRequiredDependenciesActivator.get().open()
- ).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in OPEN on {}", ident(), f));
-
- _containerState.error(f);
- }
- );
- }
-
- return s;
- }
- );
-
- return true;
- }
- }
-
- private ConfigurationDTO containerConfiguration() {
- List<ComponentDTO> components = _containerState.containerDTO().components;
-
- if (components.isEmpty()) {
- return null;
- }
-
- List<ComponentInstanceDTO> instances = components.get(0).instances;
-
- if (instances.isEmpty()) {
- return null;
- }
-
- List<ConfigurationDTO> configurations = instances.get(0).configurations;
-
- if (configurations.isEmpty()) {
- return null;
- }
-
- return configurations.get(0);
- }
-
- public Op openOp() {
- return Op.of(Mode.OPEN, getType(), ident());
- }
-
- public Map<String, Object> componentProperties(Map<String, Object> others) {
- Map<String, Object> props = new HashMap<>();
- if (others != null) {
- props.putAll(others);
- }
- props.putAll(template.properties);
- List<String> servicePids = new ArrayList<>();
-
- for (ConfigurationTemplateDTO t : template.configurations) {
- configurations.stream().filter(
- c -> c.template.equals(t)
- ).findFirst().ifPresent(
- c -> {
- Map<String, Object> copy = new HashMap<>(c.properties);
-
- Optional.ofNullable(
- copy.remove(Constants.SERVICE_PID)
- ).map(String.class::cast).ifPresent(
- v -> servicePids.add(v)
- );
-
- props.putAll(copy);
- }
- );
- }
-
- if (!servicePids.isEmpty()) {
- props.put(Constants.SERVICE_PID, servicePids);
- }
- props.put("component.id", _componentId);
- props.put("component.name", template.name);
-
- return props;
- }
-
- private Type getType() {
- switch (template.type) {
- case SINGLE: return Type.SINGLE_INSTANCE;
- case FACTORY: return Type.FACTORY_INSTANCE;
- default: return Type.CONTAINER_INSTANCE;
- }
- }
-
- private int minimumCardinality(String componentName, int minimumCardinality) {
- Objects.requireNonNull(properties);
- Objects.requireNonNull(componentName);
- return Optional.ofNullable(
- properties.get(componentName.concat(".cardinality.minimum"))
- ).map(
- v -> Integer.valueOf(String.valueOf(v))
- ).filter(
- v -> v >= minimumCardinality
- ).orElse(minimumCardinality);
- }
-
- private String targetFilter(String serviceType, String componentName, String targetFilter) {
- Objects.requireNonNull(properties);
- Objects.requireNonNull(serviceType);
- Objects.requireNonNull(componentName);
- Objects.requireNonNull(targetFilter);
- String base = "(objectClass=".concat(serviceType).concat(")");
- String extraFilter = Optional.ofNullable(
- properties.get(componentName.concat(".target"))
- ).map(
- v -> v + targetFilter
- ).orElse(targetFilter);
-
- if (extraFilter.length() == 0) {
- return base;
- }
- return "(&".concat(base).concat(extraFilter).concat(")");
- }
-
- public String ident() {
- return template.name + "[" + _componentId + "]";
- }
-
- private static final AtomicLong _componentIds = new AtomicLong();
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java
deleted file mode 100644
index d150668..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-
-public class ExtendedComponentTemplateDTO extends ComponentTemplateDTO {
-
- public Bean<?> bean;
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationDTO.java
deleted file mode 100644
index 83d9c16..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationDTO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import org.osgi.service.cdi.runtime.dto.ConfigurationDTO;
-import org.osgi.service.cm.Configuration;
-
-public class ExtendedConfigurationDTO extends ConfigurationDTO {
-
- /**
- * The actual PID whether the template is a factory or single
- * configuration.
- */
- public String pid;
-
- public Configuration configuration;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationTemplateDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationTemplateDTO.java
deleted file mode 100644
index f6f5ffb..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedConfigurationTemplateDTO.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.reflect.Type;
-
-import org.apache.aries.cdi.container.internal.bean.ComponentPropertiesBean;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-
-public class ExtendedConfigurationTemplateDTO extends ConfigurationTemplateDTO {
-
- /**
- * The bean class which the synthetic bean required to resolve the
- * injection point must provide.
- */
- public Class<?> beanClass;
-
- /**
- * The class which declared the reference.
- */
- public Class<?> declaringClass;
-
- /**
- * The type of the injection point declaring the configuration.
- */
- public Type injectionPointType;
-
- public ComponentPropertiesBean bean;
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((beanClass == null) ? 0 : beanClass.hashCode());
- result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
- result = prime * result + ((injectionPointType == null) ? 0 : injectionPointType.hashCode());
- result = prime * result + ((maximumCardinality == null) ? 0 : maximumCardinality.hashCode());
- result = prime * result + ((pid == null) ? 0 : pid.hashCode());
- result = prime * result + ((policy == null) ? 0 : policy.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ExtendedConfigurationTemplateDTO other = (ExtendedConfigurationTemplateDTO) obj;
- if (beanClass == null) {
- if (other.beanClass != null) {
- return false;
- }
- } else if (!beanClass.equals(other.beanClass)) {
- return false;
- }
- if (declaringClass == null) {
- if (other.declaringClass != null) {
- return false;
- }
- } else if (!declaringClass.equals(other.declaringClass)) {
- return false;
- }
- if (injectionPointType == null) {
- if (other.injectionPointType != null) {
- return false;
- }
- } else if (!injectionPointType.equals(other.injectionPointType)) {
- return false;
- }
- if (maximumCardinality != other.maximumCardinality) {
- return false;
- }
- if (pid == null) {
- if (other.pid != null) {
- return false;
- }
- } else if (!pid.equals(other.pid)) {
- return false;
- }
- if (policy != other.policy) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionDTO.java
deleted file mode 100644
index bb614f1..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionDTO.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.osgi.framework.ServiceObjects;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.runtime.dto.ExtensionDTO;
-
-public class ExtendedExtensionDTO extends ExtensionDTO {
- public ServiceObjects<Extension> extension;
-
- public ServiceReference<Extension> serviceReference;
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionTemplateDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionTemplateDTO.java
deleted file mode 100644
index 9fc692c..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedExtensionTemplateDTO.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import org.osgi.framework.Filter;
-import org.osgi.service.cdi.runtime.dto.template.ExtensionTemplateDTO;
-
-public class ExtendedExtensionTemplateDTO extends ExtensionTemplateDTO {
-
- public Filter filter;
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceDTO.java
deleted file mode 100644
index ca1ea81..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceDTO.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import org.osgi.service.cdi.runtime.dto.ReferenceDTO;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class ExtendedReferenceDTO extends ReferenceDTO {
-
- public Binder<Object> binder;
-
- public ServiceTracker<Object, Object> serviceTracker;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceTemplateDTO.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceTemplateDTO.java
deleted file mode 100644
index c3a2ae62..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedReferenceTemplateDTO.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.reflect.Type;
-
-import org.apache.aries.cdi.container.internal.bean.ReferenceBean;
-import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
-
-public class ExtendedReferenceTemplateDTO extends ReferenceTemplateDTO {
-
- public ReferenceBean bean;
-
- public Class<?> beanClass;
-
- public CollectionType collectionType;
-
- public Class<?> declaringClass;
-
- public Type injectionPointType;
-
- public Class<?> serviceClass;
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((beanClass == null) ? 0 : beanClass.hashCode());
- result = prime * result + ((collectionType == null) ? 0 : collectionType.hashCode());
- result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
- result = prime * result + ((injectionPointType == null) ? 0 : injectionPointType.hashCode());
- result = prime * result + ((maximumCardinality == null) ? 0 : maximumCardinality.hashCode());
- result = prime * result + minimumCardinality;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((policy == null) ? 0 : policy.hashCode());
- result = prime * result + ((policyOption == null) ? 0 : policyOption.hashCode());
- result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
- result = prime * result + ((targetFilter == null) ? 0 : targetFilter.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ExtendedReferenceTemplateDTO other = (ExtendedReferenceTemplateDTO) obj;
- if (beanClass == null) {
- if (other.beanClass != null) {
- return false;
- }
- } else if (!beanClass.equals(other.beanClass)) {
- return false;
- }
- if (collectionType != other.collectionType) {
- return false;
- }
- if (declaringClass == null) {
- if (other.declaringClass != null) {
- return false;
- }
- } else if (!declaringClass.equals(other.declaringClass)) {
- return false;
- }
- if (injectionPointType == null) {
- if (other.injectionPointType != null) {
- return false;
- }
- } else if (!injectionPointType.equals(other.injectionPointType)) {
- return false;
- }
- if (maximumCardinality != other.maximumCardinality) {
- return false;
- }
- if (minimumCardinality != other.minimumCardinality) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (policy != other.policy) {
- return false;
- }
- if (policyOption != other.policyOption) {
- return false;
- }
- if (serviceType == null) {
- if (other.serviceType != null) {
- return false;
- }
- } else if (!serviceType.equals(other.serviceType)) {
- return false;
- }
- if (targetFilter == null) {
- if (other.targetFilter != null) {
- return false;
- }
- } else if (!targetFilter.equals(other.targetFilter)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java
deleted file mode 100644
index 5853603..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.apache.aries.cdi.container.internal.bean.ReferenceBean;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.util.Maps;
-import org.apache.aries.cdi.container.internal.util.SRs;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.PrototypeServiceFactory;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cdi.ServiceScope;
-import org.osgi.service.log.Logger;
-
-public class FactoryActivator extends InstanceActivator {
-
- public static class Builder extends InstanceActivator.Builder<Builder> {
-
- public Builder(ContainerState containerState) {
- super(containerState, null);
- }
-
- @Override
- public FactoryActivator build() {
- return _cache.computeIfAbsent(_instance, i -> new FactoryActivator(this));
- }
-
- private final Map<ExtendedComponentInstanceDTO, FactoryActivator> _cache = new ConcurrentHashMap<>();
-
- }
-
- private FactoryActivator(Builder builder) {
- super(builder);
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro synchro = _lock.open()) {
- if (serviceRegistration != null) {
- serviceRegistration.unregister();
- serviceRegistration = null;
- }
-
- _instance.activations.removeIf(
- a -> {
- ExtendedActivationDTO extended = (ExtendedActivationDTO)a;
- extended.onClose.accept(extended);
- return true;
- }
- );
-
- _instance.active = false;
-
- return true;
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.FACTORY_ACTIVATOR, _instance.ident());
- }
-
- @Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public boolean open() {
- try (Syncro synchro = _lock.open()) {
- if (containerState.bundleContext() == null) {
- // this bundle was already removed
- return false;
- }
-
- if (!_instance.referencesResolved() || _instance.active) {
- return false;
- }
-
- final BeanManager beanManager = containerState.beanManager();
-
- if (beanManager == null) {
- return false;
- }
-
- ExtendedActivationTemplateDTO activationTemplate =
- (ExtendedActivationTemplateDTO)_instance.template.activations.get(0);
-
- _instance.template.references.stream().map(ExtendedReferenceTemplateDTO.class::cast).forEach(
- t -> {
- _instance.references.stream().filter(
- r -> r.template == t
- ).findFirst().map(
- ExtendedReferenceDTO.class::cast
- ).ifPresent(
- r -> {
- ReferenceBean bean = t.bean;
- bean.setBeanManager(beanManager);
- bean.setReferenceDTO(r);
- }
- );
- }
- );
-
-
- ExtendedComponentTemplateDTO extended = (ExtendedComponentTemplateDTO)_instance.template;
-
- Set<Bean<?>> beans = beanManager.getBeans(
- extended.bean.getBeanClass(), extended.bean.getQualifiers().toArray(new Annotation[0]));
- Bean<? extends Object> bean = beanManager.resolve(beans);
-
- if (activationTemplate.serviceClasses.isEmpty() /* immediate */) {
- activate(bean, activationTemplate, beanManager);
-
- _log.debug(l -> l.debug("CCR `immediate component` {} activated on {}", _instance.ident(), bundle()));
- }
- else if (activationTemplate.scope == ServiceScope.SINGLETON) {
- Entry<ExtendedActivationDTO, Object> entry = activate(
- bean, activationTemplate, beanManager);
- serviceRegistration = containerState.bundleContext().registerService(
- activationTemplate.serviceClasses.toArray(new String[0]),
- entry.getValue(),
- Maps.dict(_instance.properties));
- entry.getKey().service = SRs.from(serviceRegistration.getReference());
-
- _log.debug(l -> l.debug("CCR `singleton scope service` {} activated on {}", _instance.ident(), bundle()));
- }
- else if (activationTemplate.scope == ServiceScope.BUNDLE) {
- serviceRegistration = containerState.bundleContext().registerService(
- activationTemplate.serviceClasses.toArray(new String[0]),
- new ServiceFactory() {
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- Entry<ExtendedActivationDTO, Object> entry = activate(
- bean, activationTemplate, beanManager);
- entry.getKey().service = SRs.from(registration.getReference());
- _locals.put(entry.getValue(), entry.getKey());
- return entry.getValue();
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object object) {
- ExtendedActivationDTO activationDTO = _locals.remove(object);
-
- if (activationDTO != null) {
- activationDTO.onClose.accept(activationDTO);
- }
- }
-
- final Map<Object, ExtendedActivationDTO> _locals = new ConcurrentHashMap<>();
-
- },
- Maps.dict(_instance.properties)
- );
-
- _log.debug(l -> l.debug("CCR `bundle scope service` {} activated on {}", _instance.ident(), bundle()));
- }
- else if (activationTemplate.scope == ServiceScope.PROTOTYPE) {
- serviceRegistration = containerState.bundleContext().registerService(
- activationTemplate.serviceClasses.toArray(new String[0]),
- new PrototypeServiceFactory() {
-
- @Override
- public Object getService(Bundle bundle, ServiceRegistration registration) {
- Entry<ExtendedActivationDTO, Object> entry = activate(
- bean, activationTemplate, beanManager);
- entry.getKey().service = SRs.from(registration.getReference());
- _locals.put(entry.getValue(), entry.getKey());
- return entry.getValue();
- }
-
- @Override
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object object) {
- ExtendedActivationDTO activationDTO = _locals.remove(object);
-
- if (activationDTO != null) {
- activationDTO.onClose.accept(activationDTO);
- }
- }
-
- final Map<Object, ExtendedActivationDTO> _locals = new ConcurrentHashMap<>();
-
- },
- Maps.dict(_instance.properties)
- );
-
- _log.debug(l -> l.debug("CCR `prototype scope service` {} activated on {}", _instance.ident(), bundle()));
- }
-
- _instance.active = true;
-
- return true;
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.FACTORY_ACTIVATOR, _instance.ident());
- }
-
- @Override
- public String toString() {
- return Arrays.asList(getClass().getSimpleName(), _instance.ident()).toString();
- }
-
- private final Syncro _lock = new Syncro(true);
- private final Logger _log;
- private volatile ServiceRegistration<?> serviceRegistration;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryComponent.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryComponent.java
deleted file mode 100644
index c426d6a..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryComponent.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Op.Mode;
-import org.apache.aries.cdi.container.internal.container.Op.Type;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.osgi.service.cdi.runtime.dto.ComponentDTO;
-import org.osgi.service.cdi.runtime.dto.ComponentInstanceDTO;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.log.Logger;
-import org.osgi.util.promise.Promise;
-
-public class FactoryComponent extends Component {
-
- public static class Builder extends Component.Builder<Builder> {
-
- public Builder(ContainerState containerState, FactoryActivator.Builder activatorBuilder) {
- super(containerState, activatorBuilder);
- }
-
- @Override
- public FactoryComponent build() {
- return new FactoryComponent(this);
- }
-
- }
-
- protected FactoryComponent(Builder builder) {
- super(builder);
-
- _template = builder._templateDTO;
- _log = containerState.containerLogs().getLogger(getClass());
- }
-
- @Override
- public boolean close() {
- try (Syncro open = syncro.open()) {
- if (_snapshot == null) {
- return true;
- }
-
- _snapshot.instances.removeIf(
- instance -> {
- ExtendedComponentInstanceDTO einstance = (ExtendedComponentInstanceDTO)instance;
-
- Promise<Boolean> result = submit(einstance.closeOp(), einstance::close).onFailure(
- f -> {
- _log.error(l -> l.error("CCR Error in factory component close for {} on {}", einstance.ident(), bundle(), f));
- }
- );
-
- try {
- return result.getValue();
- }
- catch (InvocationTargetException | InterruptedException e) {
- return Throw.exception(e);
- }
- }
- );
-
- containerState.containerDTO().components.remove(_snapshot);
-
- _snapshot = null;
-
- return true;
- }
- }
-
- @Override
- public Op closeOp() {
- return Op.of(Mode.CLOSE, Type.FACTORY_COMPONENT, _template.name);
- }
-
- @Override
- public List<ConfigurationTemplateDTO> configurationTemplates() {
- return _template.configurations;
- }
-
- @Override
- public List<ComponentInstanceDTO> instances() {
- return _snapshot.instances;
- }
-
- @Override
- public ComponentDTO snapshot() {
- return _snapshot;
- }
-
- @Override
- public boolean open() {
- try (Syncro open = syncro.open()) {
- _snapshot = new ComponentDTO();
- _snapshot.instances = new CopyOnWriteArrayList<>();
- _snapshot.template = _template;
-
- containerState.containerDTO().components.add(_snapshot);
-
- return true;
- }
- }
-
- @Override
- public Op openOp() {
- return Op.of(Mode.OPEN, Type.FACTORY_COMPONENT, _template.name);
- }
-
- @Override
- public ComponentTemplateDTO template() {
- return _template;
- }
-
- private final Logger _log;
- private volatile ComponentDTO _snapshot;
- private final ComponentTemplateDTO _template;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/InstanceActivator.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/InstanceActivator.java
deleted file mode 100644
index 4f3a7ec..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/InstanceActivator.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.lang.annotation.Annotation;
-import java.util.AbstractMap;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.enterprise.context.BeforeDestroyed;
-import javax.enterprise.context.Destroyed;
-import javax.enterprise.context.Initialized;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.apache.aries.cdi.container.internal.container.ComponentContext.With;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.container.Op;
-import org.apache.aries.cdi.container.internal.container.Phase;
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.apache.aries.cdi.container.internal.util.Throw;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.log.Logger;
-
-public abstract class InstanceActivator extends Phase {
-
- public abstract static class Builder<T extends Builder<T>> {
-
- public Builder(ContainerState containerState, Phase next) {
- _containerState = containerState;
- _next = next;
- }
-
- public abstract InstanceActivator build();
-
- @SuppressWarnings("unchecked")
- public T setInstance(ExtendedComponentInstanceDTO instance) {
- _instance = instance;
- return (T)this;
- }
-
- private ContainerState _containerState;
- protected ExtendedComponentInstanceDTO _instance;
- private Phase _next;
- }
-
- protected InstanceActivator(Builder<?> builder) {
- super(builder._containerState, builder._next);
-
- _instance = builder._instance;
- _log = builder._containerState.ccrLogs().getLogger(InstanceActivator.class);
- }
-
- @Override
- public abstract Op closeOp();
-
- @Override
- public abstract Op openOp();
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected Entry<ExtendedActivationDTO, Object> activate(
- Bean<? extends Object> bean,
- ExtendedActivationTemplateDTO activationTemplate,
- BeanManager beanManager) {
-
- ExtendedActivationDTO activationDTO = new ExtendedActivationDTO();
- activationDTO.errors = new CopyOnWriteArrayList<>();
- activationDTO.template = activationTemplate;
- activationDTO.instance = _instance;
-
- _instance.activations.add(activationDTO);
-
- try (With with = new With(activationDTO)) {
- try {
- final Object object = containerState.componentContext().get(
- (Bean)bean,
- (CreationalContext)beanManager.createCreationalContext(bean));
-
- final Set<Annotation> qualifiers = bean.getQualifiers();
-
- try {
- beanManager.fireEvent(object, Sets.hashSet(qualifiers, Initialized.Literal.of(ComponentScoped.class)).toArray(new Annotation[0]));
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Error in activator event @Initialized for {} on {}", _instance, bundle(), t));
- activationDTO.errors.add(Throw.asString(t));
- }
-
- activationDTO.onClose = a -> {
- try (With with2 = new With(a)) {
- try {
- beanManager.fireEvent(object, Sets.hashSet(qualifiers, BeforeDestroyed.Literal.of(ComponentScoped.class)).toArray(new Annotation[0]));
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Error in activator event @BeforeDestroyed for {} on {}", _instance, bundle(), t));
- activationDTO.errors.add(Throw.asString(t));
- }
-
- containerState.componentContext().destroy();
-
- try {
- beanManager.fireEvent(object, Sets.hashSet(qualifiers, Destroyed.Literal.of(ComponentScoped.class)).toArray(new Annotation[0]));
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Error in activator event @Destroyed for {} on {}", _instance, bundle(), t));
- activationDTO.errors.add(Throw.asString(t));
- }
-
- _instance.activations.remove(a);
- }
- };
-
- return new AbstractMap.SimpleImmutableEntry<>(activationDTO, object);
- }
- catch (Throwable t) {
- _log.error(l -> l.error("CCR Error in activator create for {} on {}", _instance, bundle(), t));
- activationDTO.errors.add(Throw.asString(t));
-
- return new AbstractMap.SimpleImmutableEntry<>(activationDTO, null);
- }
- }
- }
-
- private final Logger _log;
- protected final ExtendedComponentInstanceDTO _instance;
-
-}
diff --git a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java b/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java
deleted file mode 100644
index cfdd2ff..0000000
--- a/cdi/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.aries.cdi.container.internal.model;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.aries.cdi.container.internal.bean.ComponentPropertiesBean;
-import org.apache.aries.cdi.container.internal.bean.ReferenceBean;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.util.Logs;
-import org.apache.aries.cdi.container.internal.util.Syncro;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ConfigurationTemplateDTO;
-import org.osgi.service.cdi.runtime.dto.template.ReferenceTemplateDTO;
-
-public class OSGiBean implements Comparable<OSGiBean> {
-
- public static class Builder {
-
- public Builder(Logs logs, Class<?> beanClass) {
- Objects.requireNonNull(beanClass);
- _logs = logs;
- _beanClass = beanClass;
- }
-
- public OSGiBean build() {
- return new OSGiBean(_logs, _beanClass);
- }
-
- private final Class<?> _beanClass;
- private final Logs _logs;
-
- }
-
- private OSGiBean(Logs logs, Class<?> beanClass) {
- _logs = logs;
- _beanClass = beanClass;
- }
-
- public synchronized void addConfiguration(ContainerState containerState, ConfigurationTemplateDTO dto) {
- try (Syncro syncro = _lock.open()) {
- if (_componentTemplate == null) {
- _configurationsQueue.add(dto);
- }
- else {
- ((ExtendedConfigurationTemplateDTO)dto).bean = new ComponentPropertiesBean(
- containerState, _componentTemplate, (ExtendedConfigurationTemplateDTO)dto);
-
- _componentTemplate.configurations.add(dto);
- }
- }
- }
-
- public synchronized void addReference(ReferenceTemplateDTO dto) {
- try (Syncro syncro = _lock.open()) {
- if (_componentTemplate == null) {
- _referencesQueue.add(dto);
- }
- else {
- ((ExtendedReferenceTemplateDTO)dto).bean = new ReferenceBean(
... 30586 lines suppressed ...