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 2018/04/14 01:10:31 UTC

svn commit: r1829115 [9/12] - in /aries/trunk/cdi: ./ cdi-extender/ cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/ cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ cdi-extender/src/main/java/org/apache/aries...

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceReference.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceReference.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceReference.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceReference.java Sat Apr 14 01:10:27 2018
@@ -1,19 +1,39 @@
+/**
+ * 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.test;
 
 import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Hashtable;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.aries.cdi.container.internal.util.Maps;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.dto.ServiceReferenceDTO;
 
 public class MockServiceReference<S> implements ServiceReference<S> {
 
-	public MockServiceReference(S service) {
+	public MockServiceReference(Bundle bundle, S service, String[] classes) {
+		_bundle = bundle;
 		_service = service;
+		_properties.put(Constants.OBJECTCLASS, classes);
+		_properties.put(Constants.SERVICE_BUNDLEID, bundle.getBundleId());
 		_properties.put(Constants.SERVICE_ID, _serviceIds.incrementAndGet());
+		_properties.put(Constants.SERVICE_SCOPE, Constants.SCOPE_SINGLETON);
 	}
 
 	@Override
@@ -22,7 +42,7 @@ public class MockServiceReference<S> imp
 			return -1;
 		}
 
-		ServiceReference otherReference = (ServiceReference)other;
+		ServiceReference<?> otherReference = (ServiceReference<?>)other;
 
 		Long id = (Long)getProperty(Constants.SERVICE_ID);
 		Long otherId = (Long)otherReference.getProperty(Constants.SERVICE_ID);
@@ -87,7 +107,11 @@ public class MockServiceReference<S> imp
 
 	@Override
 	public Bundle getBundle() {
-		return null;
+		return _bundle;
+	}
+	@Override
+	public Dictionary<String, Object> getProperties() {
+		return _properties;
 	}
 
 	@Override
@@ -121,10 +145,26 @@ public class MockServiceReference<S> imp
 		_properties.put(key, value);
 	}
 
-	public static final AtomicInteger _serviceIds = new AtomicInteger();
+	public ServiceReferenceDTO toDTO() {
+		ServiceReferenceDTO dto = new ServiceReferenceDTO();
+		dto.bundle = _bundle.getBundleId();
+		dto.id = (Long)getProperty(Constants.SERVICE_ID);
+		dto.properties = Maps.of(_properties);
+		dto.usingBundles = new long[0];
+
+		return dto;
+	}
+
+	@Override
+	public String toString() {
+		return toDTO().toString();
+	}
+
+	public static final AtomicLong _serviceIds = new AtomicLong();
 
 	private static final Integer _ZERO = new Integer(0);
 
+	private final Bundle _bundle;
 	private final Dictionary<String, Object> _properties = new Hashtable<>();
 	private final S _service;
 

Added: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceRegistration.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceRegistration.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceRegistration.java (added)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/MockServiceRegistration.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,95 @@
+/**
+ * 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.test;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceRegistration;
+
+public class MockServiceRegistration<S> implements ServiceRegistration<S> {
+
+	public MockServiceRegistration(
+		MockServiceReference<S> mockServiceReference,
+		List<MockServiceRegistration<?>> serviceRegistrations,
+		List<Entry<ServiceListener, Filter>> serviceListeners) {
+
+		_mockServiceReference = mockServiceReference;
+		_serviceRegistrations = serviceRegistrations;
+		_serviceListeners = serviceListeners;
+
+		if (_serviceRegistrations.add(this)) {
+			_serviceListeners.stream().filter(
+				entry -> entry.getValue().match(_mockServiceReference)
+			).forEach(
+				entry -> entry.getKey().serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, _mockServiceReference))
+			);
+		}
+	}
+
+	@Override
+	public MockServiceReference<S> getReference() {
+		return _mockServiceReference;
+	}
+
+	@Override
+	public void setProperties(Dictionary<String, ?> properties) {
+		for (Enumeration<String> enu = properties.keys(); enu.hasMoreElements();) {
+			String key = enu.nextElement();
+			if (key.equals(Constants.OBJECTCLASS) ||
+				key.equals(Constants.SERVICE_BUNDLEID) ||
+				key.equals(Constants.SERVICE_ID) ||
+				key.equals(Constants.SERVICE_SCOPE)) {
+				continue;
+			}
+			_mockServiceReference.setProperty(key, properties.get(key));
+		}
+
+		_serviceListeners.stream().filter(
+			entry -> entry.getValue().match(_mockServiceReference)
+		).forEach(
+			entry -> entry.getKey().serviceChanged(new ServiceEvent(ServiceEvent.MODIFIED, _mockServiceReference))
+		);
+	}
+
+	@Override
+	public void unregister() {
+		_serviceRegistrations.removeIf(
+			reg -> {
+				if (reg.getReference().equals(_mockServiceReference)) {
+					_serviceListeners.stream().filter(
+						entry -> entry.getValue().match(_mockServiceReference)
+					).forEach(
+						entry -> entry.getKey().serviceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING, _mockServiceReference))
+					);
+					return true;
+				}
+				return false;
+			}
+		);
+	}
+
+	private final MockServiceReference<S> _mockServiceReference;
+	private final List<Entry<ServiceListener, Filter>> _serviceListeners;
+	private final List<MockServiceRegistration<?>> _serviceRegistrations;
+
+}
+

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/TestUtil.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/TestUtil.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/TestUtil.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/TestUtil.java Sat Apr 14 01:10:27 2018
@@ -14,84 +14,67 @@
 
 package org.apache.aries.cdi.container.test;
 
+import static org.apache.aries.cdi.container.internal.util.Reflection.*;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.*;
+
 import java.net.URL;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.enterprise.inject.spi.BeanManager;
+import java.util.Optional;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executors;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
 
+import org.apache.aries.cdi.container.internal.ChangeCount;
 import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.model.AbstractModelBuilder;
 import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.apache.aries.cdi.container.internal.model.Context;
-import org.apache.aries.cdi.container.internal.model.Registrator;
-import org.apache.aries.cdi.container.internal.model.Tracker;
-import org.apache.aries.cdi.container.internal.reference.ReferenceCallback;
+import org.apache.aries.cdi.container.internal.util.Filters;
+import org.apache.aries.cdi.container.internal.util.Logs;
+import org.apache.aries.cdi.container.internal.util.Sfl4jLogger;
 import org.jboss.weld.resources.spi.ResourceLoader;
 import org.jboss.weld.serialization.spi.ProxyServices;
-import org.osgi.framework.ServiceObjects;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.CdiConstants;
-import org.osgi.service.cm.ManagedService;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.mockito.stubbing.Answer;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.dto.BundleDTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+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.namespace.extender.ExtenderNamespace;
+import org.osgi.service.cdi.CDIConstants;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.log.Logger;
+import org.osgi.service.log.LoggerFactory;
+import org.osgi.util.promise.PromiseFactory;
+import org.osgi.util.tracker.ServiceTracker;
 
 public class TestUtil {
 
-	public static AbstractModelBuilder getModelBuilder(final String osgiBeansFile) {
-		return getModelBuilder(
-			Arrays.asList(
-				"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.Bar.xml",
-				"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.BarAnnotated.xml",
-				"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.BarBadlyAnnotated.xml",
-				"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.FooAnnotated.xml",
-				"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.FooService.xml"
-			),  osgiBeansFile);
-	}
-
-	public static AbstractModelBuilder getModelBuilder(
-		final List<String> defaultResources, final String osgiBeansFile) {
-
-		return new AbstractModelBuilder() {
-
-			@Override
-			public List<String> getDefaultResources() {
-				return defaultResources;
-			}
-
-			@Override
-			public URL getResource(String resource) {
-				return getClassLoader().getResource(resource);
-			}
-
-			@Override
-			public ClassLoader getClassLoader() {
-				return getClass().getClassLoader();
-			}
-
-			@Override
-			public Map<String, Object> getAttributes() {
-				if (osgiBeansFile == null) {
-					return Collections.emptyMap();
-				}
-
-				return Collections.singletonMap(
-					CdiConstants.REQUIREMENT_OSGI_BEANS_ATTRIBUTE, Arrays.asList(osgiBeansFile));
-			}
-		};
-	}
-
-	public static <T extends Comparable<T>> Collection<T> sort(Collection<T> set) {
+	public static <T extends Comparable<T>> List<T> sort(Collection<T> set) {
 		return sort(set, (c1, c2) -> c1.getClass().getName().compareTo(c2.getClass().getName()));
 	}
 
-	public static <T> Collection<T> sort(Collection<T> set, Comparator<T> comparator) {
+	public static <T> List<T> sort(Collection<T> set, Comparator<T> comparator) {
 		List<T> list = new ArrayList<>(set);
 
 		Collections.sort(list, comparator);
@@ -99,14 +82,45 @@ public class TestUtil {
 		return list;
 	}
 
-	public static ContainerState getContainerState(BeansModel beansModel) {
-		final TContext context = new TContext();
-		final TBMRegistrator bmRegistrator = new TBMRegistrator();
-		final TMSRegistrator msRegistrator = new TMSRegistrator();
-		final TRegistrator serviceRegistrator = new TRegistrator();
-		final TTracker tracker = new TTracker();
+	public static ContainerState getContainerState(final BeansModel beansModel) throws Exception {
+		BundleDTO ccrBundleDTO = new BundleDTO();
+		ccrBundleDTO.id = 1;
+		ccrBundleDTO.lastModified = 2300l;
+		ccrBundleDTO.state = Bundle.ACTIVE;
+		ccrBundleDTO.symbolicName = "ccr";
+		ccrBundleDTO.version = "1.0.0";
+
+		Bundle ccrBundle = mockBundle(ccrBundleDTO, b -> {
+			when(b.adapt(BundleWiring.class).getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE)).thenReturn(new ArrayList<>());
+		});
+
+		BundleDTO bundleDTO = new BundleDTO();
+		bundleDTO.id = 2;
+		bundleDTO.lastModified = 24000l;
+		bundleDTO.state = Bundle.ACTIVE;
+		bundleDTO.symbolicName = "foo";
+		bundleDTO.version = "1.0.0";
+
+		Bundle bundle = mockBundle(bundleDTO, b -> {
+			BundleWire extenderWire = mock(BundleWire.class);
+			BundleCapability extenderCapability = mock(BundleCapability.class);
+			BundleRequirement extenderRequirement = mock(BundleRequirement.class);
+
+			when(b.adapt(BundleWiring.class).getRequiredWires(ExtenderNamespace.EXTENDER_NAMESPACE)).thenReturn(Collections.singletonList(extenderWire));
+			when(b.adapt(BundleWiring.class).listResources("OSGI-INF/cdi", "*.xml", BundleWiring.LISTRESOURCES_LOCAL)).thenReturn(Collections.singletonList("OSGI-INF/cdi/osgi-beans.xml"));
+
+			when(extenderWire.getCapability()).thenReturn(extenderCapability);
+			when(extenderCapability.getAttributes()).thenReturn(Collections.singletonMap(ExtenderNamespace.EXTENDER_NAMESPACE, CDIConstants.CDI_CAPABILITY_NAME));
+			when(extenderWire.getRequirement()).thenReturn(extenderRequirement);
+			when(extenderRequirement.getAttributes()).thenReturn(new HashMap<>());
+		});
+
+		ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> caTracker = new ServiceTracker<>(bundle.getBundleContext(), ConfigurationAdmin.class, null);
+		caTracker.open();
+		ConfigurationAdmin ca = mock(ConfigurationAdmin.class);
+		bundle.getBundleContext().registerService(ConfigurationAdmin.class, ca, null);
 
-		return new ContainerState(null, null) {
+		return new ContainerState(bundle, ccrBundle, new ChangeCount(), new PromiseFactory(Executors.newFixedThreadPool(1)), caTracker, new Logs.Builder(bundle.getBundleContext()).build()) {
 
 			@Override
 			public BeansModel beansModel() {
@@ -118,128 +132,187 @@ public class TestUtil {
 				return null;
 			}
 
-			@Override
-			public Context context() {
-				return context;
-			}
-
-			@Override
-			public Registrator<BeanManager> beanManagerRegistrator() {
-				return bmRegistrator;
-			}
-
-			@Override
-			public Registrator<ManagedService> managedServiceRegistrator() {
-				return msRegistrator;
-			}
-
-			@Override
-			public Registrator<Object> serviceRegistrator() {
-				return serviceRegistrator;
-			}
-
-			@Override
-			public Tracker tracker() {
-				return tracker;
-			}
-
 		};
 	}
 
-	public static class TContext extends Context {
-
-		@Override
-		public <T> T getService(ServiceReference<T> reference) {
-			if (reference instanceof MockServiceReference) {
-				return ((MockServiceReference<T>)reference).getService();
-			}
-			return null;
-		}
-
-		@Override
-		public <T> ServiceObjects<T> getServiceObjects(ServiceReference<T> reference) {
-			return null;
-		}
-
-		@Override
-		public <T> boolean ungetService(ServiceReference<T> reference) {
-			return false;
-		}
-
-	}
-
-	public static class TBMRegistrator extends Registrator<BeanManager> {
-
-		@Override
-		public void close() {
-			registrations.clear();
-		}
-
-		@Override
-		public void registerService(String[] classNames, BeanManager service, Dictionary<String, ?> properties) {
-			registrations.put(properties, service);
-		}
-
-		@Override
-		public int size() {
-			return registrations.size();
-		}
-
-		public final Map<Dictionary<String, ?>, BeanManager> registrations = new ConcurrentHashMap<>();
-
-	}
-
-	public static class TMSRegistrator extends Registrator<ManagedService> {
+	@SuppressWarnings("unchecked")
+	public static Bundle mockBundle(BundleDTO bundleDTO, Consumer<Bundle> extra) throws Exception {
+		Bundle bundle = mock(Bundle.class);
+		BundleContext bundleContext = mock(BundleContext.class);
+		BundleWiring bundleWiring = mock(BundleWiring.class);
+
+		when(bundle.getBundleContext()).thenReturn(bundleContext);
+		when(bundle.toString()).thenReturn(bundleDTO.symbolicName + "[" + bundleDTO.id + "]");
+		when(bundle.getBundleId()).thenReturn(bundleDTO.id);
+		when(bundle.getLastModified()).thenReturn(bundleDTO.lastModified);
+		when(bundle.getSymbolicName()).thenReturn(bundleDTO.symbolicName);
+		when(bundle.adapt(BundleWiring.class)).thenReturn(bundleWiring);
+		when(bundle.adapt(BundleDTO.class)).thenReturn(bundleDTO);
+		when(bundle.adapt(ServiceReferenceDTO[].class)).then(
+			(Answer<ServiceReferenceDTO[]>) serviceDTOs -> {
+				return serviceRegistrations.stream().filter(
+					reg -> reg.getReference().getBundle().equals(bundle)
+				).map(
+					reg -> reg.getReference().toDTO()
+				).collect(Collectors.toList()).toArray(new ServiceReferenceDTO[0]);
+			}
+		);
+		when(bundle.getResource(any())).then(
+			(Answer<URL>) getResource -> {
+				return bundleDTO.getClass().getClassLoader().getResource((String)getResource.getArgument(0));
+			}
+		);
+		when(bundle.loadClass(any())).then(
+			(Answer<Class<?>>) loadClass -> {
+				return bundleDTO.getClass().getClassLoader().loadClass((String)loadClass.getArgument(0));
+			}
+		);
+		when(bundleWiring.getBundle()).thenReturn(bundle);
+		when(bundleContext.getBundle()).thenReturn(bundle);
+		when(bundleContext.getService(any())).then(
+			(Answer<Object>) getService -> {
+				return serviceRegistrations.stream().filter(
+					reg -> reg.getReference().equals(getService.getArgument(0))
+				).findFirst().get().getReference().getService();
+			}
+		);
+		doAnswer(
+			(Answer<ServiceRegistration<?>>) registerService -> {
+				Class<?> clazz = registerService.getArgument(0);
+				MockServiceReference<?> mockServiceReference = new MockServiceReference<>(
+					bundle, registerService.getArgument(1), new String[] {clazz.getName()});
+
+				Optional.ofNullable(
+					registerService.getArgument(2)
+				).map(
+					arg -> (Dictionary<String, Object>)arg
+				).ifPresent(
+					dict -> {
+						for (Enumeration<String> enu = dict.keys(); enu.hasMoreElements();) {
+							String key = enu.nextElement();
+							if (key.equals(Constants.OBJECTCLASS) ||
+								key.equals(Constants.SERVICE_BUNDLEID) ||
+								key.equals(Constants.SERVICE_ID) ||
+								key.equals(Constants.SERVICE_SCOPE)) {
+								continue;
+							}
+							mockServiceReference.setProperty(key, dict.get(key));
+						}
+					}
+				);
+
+				return new MockServiceRegistration<>(mockServiceReference, serviceRegistrations, serviceListeners);
+			}
+		).when(bundleContext).registerService(any(Class.class), any(Object.class), any());
+		doAnswer(
+			(Answer<ServiceRegistration<?>>) registerService -> {
+				String[] clazzes = registerService.getArgument(0);
+				MockServiceReference<?> mockServiceReference = new MockServiceReference<>(
+					bundle, registerService.getArgument(1), clazzes);
+
+				Optional.ofNullable(
+					registerService.getArgument(2)
+				).map(
+					arg -> (Dictionary<String, Object>)arg
+				).ifPresent(
+					dict -> {
+						for (Enumeration<String> enu = dict.keys(); enu.hasMoreElements();) {
+							String key = enu.nextElement();
+							if (key.equals(Constants.OBJECTCLASS) ||
+								key.equals(Constants.SERVICE_BUNDLEID) ||
+								key.equals(Constants.SERVICE_ID) ||
+								key.equals(Constants.SERVICE_SCOPE)) {
+								continue;
+							}
+							mockServiceReference.setProperty(key, dict.get(key));
+						}
+					}
+				);
+
+				return new MockServiceRegistration<>(mockServiceReference, serviceRegistrations, serviceListeners);
+			}
+		).when(bundleContext).registerService(any(String[].class), any(Object.class), any());
+		doAnswer(
+			(Answer<Void>) addServiceListener -> {
+				ServiceListener sl = cast(addServiceListener.getArgument(0));
+				Filter filter = FrameworkUtil.createFilter(addServiceListener.getArgument(1));
+				if (serviceListeners.add(new SimpleEntry<>(sl, filter))) {
+					serviceRegistrations.stream().filter(
+						reg -> filter.match(reg.getReference())
+					).forEach(
+						reg -> sl.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()))
+					);
+				}
+				return null;
+			}
+		).when(bundleContext).addServiceListener(any(), any());
 
-		@Override
-		public void close() {
-			registrations.clear();
-		}
-
-		@Override
-		public void registerService(String[] classNames, ManagedService service, Dictionary<String, ?> properties) {
-			registrations.put(properties, service);
-		}
-
-		@Override
-		public int size() {
-			return registrations.size();
-		}
+		ServiceTracker<LoggerFactory, LoggerFactory> loggerTracker = new ServiceTracker<>(bundle.getBundleContext(), LoggerFactory.class, null);
+		loggerTracker.open();
+		LoggerFactory lf = mock(LoggerFactory.class);
+		when(lf.getLogger(any(Class.class))).then(
+			(Answer<Logger>) getLogger -> {
+				Class<?> clazz = getLogger.getArgument(0);
+				return new Sfl4jLogger(clazz.getName());
+			}
+		);
+		when(lf.getLogger(anyString())).then(
+			(Answer<Logger>) getLogger -> {
+				String name = getLogger.getArgument(0);
+				return new Sfl4jLogger(name);
+			}
+		);
+		when(lf.getLogger(any(Class.class), any())).then(
+			(Answer<Logger>) getLogger -> {
+				Class<?> clazz = getLogger.getArgument(0);
+				return new Sfl4jLogger(clazz.getName());
+			}
+		);
+		when(lf.getLogger(anyString(), any())).then(
+			(Answer<Logger>) getLogger -> {
+				String name = getLogger.getArgument(0);
+				return new Sfl4jLogger(name);
+			}
+		);
+		when(lf.getLogger(any(), anyString(), any())).then(
+			(Answer<Logger>) getLogger -> {
+				String name = getLogger.getArgument(1);
+				return new Sfl4jLogger(name);
+			}
+		);
+		bundle.getBundleContext().registerService(LoggerFactory.class, lf, null);
 
-		public final Map<Dictionary<String, ?>, ManagedService> registrations = new ConcurrentHashMap<>();
+		extra.accept(bundle);
 
+		return bundle;
 	}
 
-	public static class TRegistrator extends Registrator<Object> {
+	public static ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> mockCaSt(Bundle bundle) throws Exception {
+		ServiceTracker<ConfigurationAdmin, ConfigurationAdmin> caTracker = new ServiceTracker<>(bundle.getBundleContext(), ConfigurationAdmin.class, null);
+		caTracker.open();
+		ConfigurationAdmin ca = mock(ConfigurationAdmin.class);
+		bundle.getBundleContext().registerService(ConfigurationAdmin.class, ca, null);
+
+		when(ca.listConfigurations(anyString())).then(
+			(Answer<Configuration[]>) listConfigurations -> {
+				String query = listConfigurations.getArgument(0);
+				Filter filter = Filters.asFilter(query);
+				List<MockConfiguration> list = configurations.stream().filter(
+					c -> filter.match(c.getProperties())
+				).collect(Collectors.toList());
 
-		@Override
-		public void close() {
-			registrations.clear();
-		}
-
-		@Override
-		public void registerService(String[] classNames, Object service, Dictionary<String, ?> properties) {
-			registrations.put(properties, service);
-		}
-
-		@Override
-		public int size() {
-			return registrations.size();
-		}
-
-		public final Map<Dictionary<String, ?>, Object> registrations = new ConcurrentHashMap<>();
+				if (list.isEmpty()) {
+					return null;
+				}
+				return list.toArray(new Configuration[0]);
+			}
+		);
 
+		return caTracker;
 	}
 
-	public static class TTracker extends Tracker {
-
-		@Override
-		public <T> void track(String targetFilter, ReferenceCallback callback) {
-			trackers.put(targetFilter, callback);
-		}
-
-		public final Map<String, ServiceTrackerCustomizer<Object, ?>> trackers = new ConcurrentHashMap<>();
-
-	}
+	public static final List<MockConfiguration> configurations = new CopyOnWriteArrayList<>();
+	public static final List<Map.Entry<ServiceListener, Filter>> serviceListeners = new CopyOnWriteArrayList<>();
+	public static final List<MockServiceRegistration<?>> serviceRegistrations = new CopyOnWriteArrayList<>();
 
 }
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarAnnotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarAnnotated.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarAnnotated.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarAnnotated.java Sat Apr 14 01:10:27 2018
@@ -18,37 +18,38 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
 
-import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
 import javax.inject.Inject;
-import javax.inject.Named;
 import javax.inject.Provider;
 
+import org.apache.aries.cdi.extra.propertytypes.JaxrsResource;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.cdi.ConfigurationPolicy;
 import org.osgi.service.cdi.annotations.Configuration;
 import org.osgi.service.cdi.annotations.Greedy;
 import org.osgi.service.cdi.annotations.PID;
 import org.osgi.service.cdi.annotations.Prototype;
 import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.cdi.annotations.Service;
 
 public class BarAnnotated {
 
 	@Inject
+	@Greedy
 	@Reference
-	Optional<Foo> foo;
+	Foo foo;
 
 	@Inject
-	@Named("foos")
 	@Reference
-	Instance<Foo> instanceFoos;
+	Optional<Foo> fooOptional;
 
 	@Inject
 	@Reference
-	Provider<Collection<Foo>> collectionFoos;
+	Provider<Collection<Foo>> dynamicFoos;
 
 	@Inject
-	@Greedy
 	@Reference
-	Collection<Map.Entry<Map<String, Object>, Foo>> tupleFoos;
+	Collection<Map.Entry<Map<String, Object>, Integer>> tupleIntegers;
 
 	@Inject
 	@Prototype
@@ -60,8 +61,13 @@ public class BarAnnotated {
 	Collection<Map<String, Object>> propertiesFoos;
 
 	@Inject
-	@PID("foo.config")
+	@PID(value = "foo.config", policy = ConfigurationPolicy.REQUIRED)
 	@Configuration
 	Config config;
 
+	@Produces
+	@Service
+	@JaxrsResource
+	Baz baz = new Baz() {};
+
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarProducer.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarProducer.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarProducer.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarProducer.java Sat Apr 14 01:10:27 2018
@@ -14,11 +14,26 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
+import java.math.BigDecimal;
+
 import javax.enterprise.inject.Produces;
 
+import org.apache.aries.cdi.extra.propertytypes.ServiceRanking;
+import org.osgi.service.cdi.annotations.Bundle;
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.cdi.annotations.Service;
+
 public class BarProducer {
 	@Produces
-	public Bar getBar() {
-		return new Bar() {};
+	@Service
+	public Bar getBar(@Reference Bar bar) {
+		return bar;
 	}
+
+	@Produces
+	@Service(Integer.class)
+	@Bundle
+	@ServiceRanking(100)
+	Number fum = new BigDecimal(25);
+
 }
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarService.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarService.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarService.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarService.java Sat Apr 14 01:10:27 2018
@@ -14,6 +14,11 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
+import org.osgi.service.cdi.annotations.FactoryComponent;
+import org.osgi.service.cdi.annotations.Service;
+
+@FactoryComponent
+@Service
 public class BarService implements Bar {
 
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java Sat Apr 14 01:10:27 2018
@@ -16,12 +16,15 @@ package org.apache.aries.cdi.container.t
 
 import javax.inject.Inject;
 
+import org.osgi.service.cdi.annotations.Configuration;
+
 public class BarWithConfig {
 
 	@Inject
 	public Bar bar;
 
 	@Inject
+	@Configuration
 	public Config config;
 
 }

Copied: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Baz.java (from r1829114, aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReference.java)
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Baz.java?p2=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Baz.java&p1=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReference.java&r1=1829114&r2=1829115&rev=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReference.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Baz.java Sat Apr 14 01:10:27 2018
@@ -14,11 +14,6 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
-import javax.inject.Inject;
-
-public class FooWithReference {
-
-	@Inject
-	public FooReference fooReference;
+public interface Baz {
 
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Foo.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Foo.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Foo.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Foo.java Sat Apr 14 01:10:27 2018
@@ -16,4 +16,8 @@ package org.apache.aries.cdi.container.t
 
 public interface Foo {
 
+	default String function(String input) {
+		return "_".concat(input).concat("_");
+	}
+
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooAnnotated.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooAnnotated.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooAnnotated.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooAnnotated.java Sat Apr 14 01:10:27 2018
@@ -14,26 +14,28 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
 import javax.inject.Named;
-import javax.inject.Qualifier;
 
+import org.apache.aries.cdi.extra.propertytypes.ServiceRanking;
 import org.osgi.service.cdi.annotations.Service;
 import org.osgi.service.cdi.annotations.SingleComponent;
-
-@Qualifier @Retention(RUNTIME) @Target(TYPE)
-@interface ServiceRanking {
-	int value();
-}
+import org.osgi.service.cdi.reference.ReferenceEvent;
 
 @SingleComponent
 @Named("foo.annotated")
 @Service(Foo.class)
 @ServiceRanking(12)
 public class FooAnnotated implements Foo, Cloneable {
+
+	void watchFoos(@Observes ReferenceEvent<Integer> numbers) {
+		numbers.onAddingServiceReference(number -> System.out.println("Added: " + number));
+		numbers.onUpdateServiceReference(number -> System.out.println("Updated: " + number));
+		numbers.onRemoveServiceReference(number -> System.out.println("Removed: " + number));
+	}
+
+	@Inject
+	FooWithReferenceAndConfig fooWithReferenceAndConfig;
+
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooService.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooService.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooService.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooService.java Sat Apr 14 01:10:27 2018
@@ -14,6 +14,14 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
+import org.osgi.service.cdi.annotations.Service;
+
+@Service(Foo.class)
 public class FooService implements Foo, Cloneable {
 
+	@Override
+	public String function(String input) {
+		return "#".concat(input).concat("#");
+	}
+
 }

Added: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java (added)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,42 @@
+/**
+ * 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.test.beans;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.osgi.service.cdi.annotations.ComponentScoped;
+import org.osgi.service.cdi.annotations.Configuration;
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.cdi.reference.ReferenceEvent;
+
+@ComponentScoped
+public class FooWithReferenceAndConfig {
+
+	void watchNumbers(@Observes ReferenceEvent<Integer> numbers) {
+		numbers.onAddingServiceReference(number -> System.out.println("Added: " + number));
+		numbers.onUpdateServiceReference(number -> System.out.println("Updated: " + number));
+		numbers.onRemoveServiceReference(number -> System.out.println("Removed: " + number));
+	}
+
+	@Inject
+	@Reference
+	public Foo fooReference;
+
+	@Inject
+	@Configuration
+	public Config config;
+
+}

Modified: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/ObserverFoo.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/ObserverFoo.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/ObserverFoo.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/ObserverFoo.java Sat Apr 14 01:10:27 2018
@@ -21,7 +21,6 @@ import javax.enterprise.context.Applicat
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.EventMetadata;
 
-import org.osgi.service.cdi.annotations.Reference;
 import org.osgi.service.cdi.reference.ReferenceEvent;
 
 @ApplicationScoped
@@ -32,7 +31,7 @@ public class ObserverFoo {
 	}
 
 	void foos(
-		@Observes @Reference ReferenceEvent<Foo> event,
+		@Observes ReferenceEvent<Foo> event,
 		EventMetadata eventMetadata) {
 
 		event.onAdding(

Copied: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_D_R_M_U_Service.java (from r1829114, aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java)
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_D_R_M_U_Service.java?p2=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_D_R_M_U_Service.java&p1=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java&r1=1829114&r2=1829115&rev=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_D_R_M_U_Service.java Sat Apr 14 01:10:27 2018
@@ -14,14 +14,24 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
+import javax.annotation.PostConstruct;
 import javax.inject.Inject;
+import javax.inject.Provider;
 
-public class BarWithConfig {
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.log.Logger;
 
+// dynamic, reluctant, mandatory, unary
+public class Reference_D_R_M_U_Service {
 	@Inject
-	public Bar bar;
+	@Reference
+	Provider<Foo> foo;
 
 	@Inject
-	public Config config;
+	Logger logger;
 
+	@PostConstruct
+	void init() {
+
+	}
 }

Copied: aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_S_R_M_U_Service.java (from r1829114, aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java)
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_S_R_M_U_Service.java?p2=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_S_R_M_U_Service.java&p1=aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java&r1=1829114&r2=1829115&rev=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/BarWithConfig.java (original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/Reference_S_R_M_U_Service.java Sat Apr 14 01:10:27 2018
@@ -16,12 +16,15 @@ package org.apache.aries.cdi.container.t
 
 import javax.inject.Inject;
 
-public class BarWithConfig {
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.log.Logger;
 
+// static, reluctant, mandatory, unary
+public class Reference_S_R_M_U_Service {
 	@Inject
-	public Bar bar;
+	@Reference
+	Foo foo;
 
 	@Inject
-	public Config config;
-
+	Logger logger;
 }

Modified: aries/trunk/cdi/cdi-extender/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/resources/logback.xml?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/resources/logback.xml (original)
+++ aries/trunk/cdi/cdi-extender/src/test/resources/logback.xml Sat Apr 14 01:10:27 2018
@@ -9,7 +9,7 @@
 		</encoder>
 	</appender>
 
-	<logger name="org.apache.aries.cdi.container" level="ERROR"/>
+	<logger name="org.apache.aries.cdi.container" level="DEBUG"/>
 
 	<root level="ERROR">
 		<appender-ref ref="STDOUT" />

Modified: aries/trunk/cdi/cdi-extension-http/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/bnd.bnd?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/bnd.bnd (original)
+++ aries/trunk/cdi/cdi-extension-http/bnd.bnd Sat Apr 14 01:10:27 2018
@@ -1,11 +1,2 @@
-Bundle-Activator: org.apache.aries.cdi.extension.http.Activator
-Provide-Capability: \
-	osgi.cdi.extension;\
-		osgi.cdi.extension=http;\
-		implementation="org.apache.aries.cdi.extension.http.HttpExtension";\
-		version:Version="${Bundle-Version}"
-Require-Capability:\
-	osgi.implementation;filter:='(&(osgi.implementation=osgi.cdi)(version>=0.0.1)(!(version>=1.0.0)))',\
-	osgi.implementation;filter:="(&(osgi.implementation=osgi.http)(version>=1.0)(!(version>=2.0)))"
--contract: JavaCDI, JavaServlet
+-contract: JavaAnnotation, JavaCDI, JavaServlet
 -includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-extension-http/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/pom.xml?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/pom.xml (original)
+++ aries/trunk/cdi/cdi-extension-http/pom.xml Sat Apr 14 01:10:27 2018
@@ -30,9 +30,9 @@
 	</parent>
 
 	<artifactId>org.apache.aries.cdi.extension.http</artifactId>
-	<name>CDI Http Extender</name>
+	<name>Aries CDI Http Extension</name>
 	<description>
-		Provides support to CDI bundles for http servlet scopes such as @RequestScoped,
+		Provides support to CDI bundles for http servlet scopes; @RequestScoped,
 		@ApplicationScoped, @SessionScoped and @ConversationScoped.
 	</description>
 
@@ -57,40 +57,40 @@
 			<version>1.1.2</version>
 		</dependency>
 		<dependency>
-			<groupId>org.jboss.weld</groupId>
-			<artifactId>weld-osgi-bundle</artifactId>
-			<version>3.0.1.Final</version>
+			<groupId>org.jboss.weld.module</groupId>
+			<artifactId>weld-web</artifactId>
+			<version>${weld.release}</version>
 			<exclusions>
 				<exclusion>
 					<groupId>javax.enterprise</groupId>
 					<artifactId>cdi-api</artifactId>
 				</exclusion>
-				<exclusion>
-					<groupId>javax.inject</groupId>
-					<artifactId>javax.inject</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.annotation</groupId>
-					<artifactId>jboss-annotations-api_1.2_spec</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.el</groupId>
-					<artifactId>jboss-el-api_3.0_spec</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.interceptor</groupId>
-					<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
-				</exclusion>
 			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.annotation.bundle</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.namespace.extender</artifactId>
 			<version>1.0.1</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.namespace.implementation</artifactId>
+			<version>1.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.namespace.service</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.service.cdi</artifactId>
 			<version>1.0.0-SNAPSHOT</version>
 		</dependency>

Added: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpActivator.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpActivator.java (added)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpActivator.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,66 @@
+/**
+ * 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.extension.http;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.osgi.annotation.bundle.Capability;
+import org.osgi.annotation.bundle.Header;
+import org.osgi.annotation.bundle.Requirement;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.namespace.implementation.ImplementationNamespace;
+import org.osgi.namespace.service.ServiceNamespace;
+import org.osgi.service.cdi.annotations.RequireCDIImplementation;
+
+@Capability(
+	attribute = {
+		"objectClass:List<String>=javax.enterprise.inject.spi.Extension",
+		"osgi.cdi.extension=aries.cdi.http"},
+	namespace = ServiceNamespace.SERVICE_NAMESPACE
+)
+@Header(
+	name = Constants.BUNDLE_ACTIVATOR,
+	value = "org.apache.aries.cdi.extension.http.HttpActivator"
+)
+@Requirement(
+	name = "osgi.http",
+	namespace = ImplementationNamespace.IMPLEMENTATION_NAMESPACE,
+	version = "1.0.0"
+)
+@RequireCDIImplementation
+public class HttpActivator implements BundleActivator {
+
+	@Override
+	public void start(BundleContext context) throws Exception {
+		Dictionary<String, Object> properties = new Hashtable<>();
+		properties.put("osgi.cdi.extension", "aries.cdi.http");
+		_serviceRegistration = context.registerService(
+			Extension.class, new HttpExtensionFactory(), properties);
+	}
+
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		_serviceRegistration.unregister();
+	}
+
+	private ServiceRegistration<Extension> _serviceRegistration;
+
+}

Modified: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java (original)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtension.java Sat Apr 14 01:10:27 2018
@@ -14,8 +14,8 @@
 
 package org.apache.aries.cdi.extension.http;
 
-import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
-import static org.osgi.service.cdi.CdiConstants.CDI_CAPABILITY_NAME;
+import static org.osgi.namespace.extender.ExtenderNamespace.*;
+import static org.osgi.service.cdi.CDIConstants.*;
 
 import java.util.Collections;
 import java.util.Dictionary;
@@ -23,6 +23,7 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Priority;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.AfterDeploymentValidation;
 import javax.enterprise.inject.spi.AnnotatedType;
@@ -51,7 +52,10 @@ public class HttpExtension implements Ex
 		_bundle = bundle;
 	}
 
-	void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager beanManager) {
+	void afterDeploymentValidation(
+		@Observes @Priority(javax.interceptor.Interceptor.Priority.LIBRARY_AFTER+800)
+		AfterDeploymentValidation adv, BeanManager beanManager) {
+
 		Dictionary<String, Object> properties = new Hashtable<>();
 
 		properties.put(

Modified: aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java (original)
+++ aries/trunk/cdi/cdi-extension-http/src/main/java/org/apache/aries/cdi/extension/http/HttpExtensionFactory.java Sat Apr 14 01:10:27 2018
@@ -17,10 +17,10 @@ package org.apache.aries.cdi.extension.h
 import javax.enterprise.inject.spi.Extension;
 
 import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.PrototypeServiceFactory;
 import org.osgi.framework.ServiceRegistration;
 
-public class HttpExtensionFactory implements ServiceFactory<Extension> {
+public class HttpExtensionFactory implements PrototypeServiceFactory<Extension> {
 
 	@Override
 	public Extension getService(

Modified: aries/trunk/cdi/cdi-extension-jndi/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/bnd.bnd?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/bnd.bnd (original)
+++ aries/trunk/cdi/cdi-extension-jndi/bnd.bnd Sat Apr 14 01:10:27 2018
@@ -1,10 +1,2 @@
-Bundle-Activator: org.apache.aries.cdi.extension.jndi.Activator
-Provide-Capability: \
-	osgi.cdi.extension;\
-		osgi.cdi.extension=jndi;\
-		implementation="org.apache.aries.cdi.extension.jndi.JndiExtension";\
-		version:Version="${Bundle-Version}"
-Require-Capability:\
-	osgi.implementation;filter:='(&(osgi.implementation=osgi.cdi)(version>=0.0.1)(!(version>=1.0.0)))'
 -contract: JavaCDI
 -includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-extension-jndi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/pom.xml?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/pom.xml (original)
+++ aries/trunk/cdi/cdi-extension-jndi/pom.xml Sat Apr 14 01:10:27 2018
@@ -55,11 +55,31 @@
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.annotation.bundle</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.namespace.service</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.service.cdi</artifactId>
 			<version>1.0.0-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.log</artifactId>
+			<version>1.4.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.util.promise</artifactId>
+			<version>1.1.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
 			<artifactId>osgi.core</artifactId>
 			<version>6.0.0</version>
 			<scope>provided</scope>

Added: aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiActivator.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiActivator.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiActivator.java (added)
+++ aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiActivator.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,72 @@
+/**
+ * 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.extension.jndi;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.enterprise.inject.spi.Extension;
+import javax.naming.spi.ObjectFactory;
+
+import org.osgi.annotation.bundle.Capability;
+import org.osgi.annotation.bundle.Header;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.namespace.service.ServiceNamespace;
+import org.osgi.service.cdi.CDIConstants;
+import org.osgi.service.cdi.annotations.RequireCDIImplementation;
+import org.osgi.service.jndi.JNDIConstants;
+import org.osgi.service.log.LoggerFactory;
+import org.osgi.util.tracker.ServiceTracker;
+
+@Capability(
+	attribute = {
+		"objectClass:List<String>=javax.enterprise.inject.spi.Extension",
+		"osgi.cdi.extension=aries.cdi.jndi"},
+	namespace = ServiceNamespace.SERVICE_NAMESPACE
+)
+@Header(
+	name = Constants.BUNDLE_ACTIVATOR,
+	value = "org.apache.aries.cdi.extension.jndi.JndiActivator"
+)
+@RequireCDIImplementation
+public class JndiActivator implements BundleActivator {
+
+	@Override
+	public void start(BundleContext context) throws Exception {
+		_lft = new ServiceTracker<>(context, LoggerFactory.class, null);
+		_lft.open();
+
+		Dictionary<String, Object> properties = new Hashtable<>();
+		properties.put(CDIConstants.CDI_EXTENSION_PROPERTY, "aries.cdi.jndi");
+		properties.put(JNDIConstants.JNDI_URLSCHEME, "java");
+
+		_serviceRegistration = context.registerService(
+			new String[] {Extension.class.getName(), ObjectFactory.class.getName()},
+			new JndiExtensionFactory(_lft.getService()), properties);
+	}
+
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		_serviceRegistration.unregister();
+	}
+
+	private volatile ServiceTracker<LoggerFactory, LoggerFactory> _lft;
+	@SuppressWarnings("rawtypes")
+	private ServiceRegistration _serviceRegistration;
+
+}

Modified: aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiContext.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiContext.java (original)
+++ aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiContext.java Sat Apr 14 01:10:27 2018
@@ -14,6 +14,7 @@
 
 package org.apache.aries.cdi.extension.jndi;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.Hashtable;
 
 import javax.enterprise.inject.spi.BeanManager;
@@ -26,9 +27,13 @@ import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
 
+import org.osgi.service.log.Logger;
+import org.osgi.util.promise.Promise;
+
 public class JndiContext implements Context {
 
-	public JndiContext(BeanManager beanManager) {
+	public JndiContext(Logger log, Promise<BeanManager> beanManager) {
+		_log = log;
 		_beanManager = beanManager;
 	}
 
@@ -40,10 +45,15 @@ public class JndiContext implements Cont
 	@Override
 	public Object lookup(String name) throws NamingException {
 		if (name.length() == 0) {
-			return new JndiContext(_beanManager);
+			return new JndiContext(_log, _beanManager);
 		}
 		if (name.equals("java:comp/BeanManager")) {
-			return _beanManager;
+			try {
+				return _beanManager.timeout(5000).getValue();
+			}
+			catch (InvocationTargetException | InterruptedException e) {
+				_log.error(l -> l.error(e.getMessage(), e));
+			}
 		}
 		throw new NamingException("Could not find " + name);
 	}
@@ -183,6 +193,7 @@ public class JndiContext implements Cont
 		throw new OperationNotSupportedException();
 	}
 
-	private final BeanManager _beanManager;
+	private final Logger _log;
+	private final Promise<BeanManager> _beanManager;
 
 }
\ No newline at end of file

Modified: aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtension.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtension.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtension.java (original)
+++ aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtension.java Sat Apr 14 01:10:27 2018
@@ -16,15 +16,24 @@ package org.apache.aries.cdi.extension.j
 
 import java.util.Hashtable;
 
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Initialized;
 import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.Extension;
 import javax.naming.Name;
 import javax.naming.spi.ObjectFactory;
 
+import org.osgi.service.log.Logger;
+import org.osgi.util.promise.Deferred;
+
 public class JndiExtension implements Extension, ObjectFactory {
 
+	public JndiExtension(Logger log) {
+		_beanManager = new Deferred<>();
+		_jndiContext = new JndiContext(log, _beanManager.getPromise());
+	}
+
 	@Override
 	public Object getObjectInstance(
 			Object obj, Name name, javax.naming.Context context, Hashtable<?, ?> environment)
@@ -37,10 +46,11 @@ public class JndiExtension implements Ex
 		return null;
 	}
 
-	void afterDeploymentValidation(@Observes AfterDeploymentValidation adv, BeanManager beanManager) {
-		_jndiContext = new JndiContext(beanManager);
+	void applicationScopedInitialized(@Observes @Initialized(ApplicationScoped.class) Object o, BeanManager bm) {
+		_beanManager.resolve(bm);
 	}
 
-	private JndiContext _jndiContext;
+	private final Deferred<BeanManager> _beanManager;
+	private final JndiContext _jndiContext;
 
 }

Modified: aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtensionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtensionFactory.java?rev=1829115&r1=1829114&r2=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtensionFactory.java (original)
+++ aries/trunk/cdi/cdi-extension-jndi/src/main/java/org/apache/aries/cdi/extension/jndi/JndiExtensionFactory.java Sat Apr 14 01:10:27 2018
@@ -15,14 +15,21 @@
 package org.apache.aries.cdi.extension.jndi;
 
 import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.PrototypeServiceFactory;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.Logger;
+import org.osgi.service.log.LoggerFactory;
 
-public class JndiExtensionFactory implements ServiceFactory {
+@SuppressWarnings("rawtypes")
+public class JndiExtensionFactory implements PrototypeServiceFactory {
+
+	public JndiExtensionFactory(LoggerFactory loggerFactory) {
+		_loggerFactory = loggerFactory;
+	}
 
 	@Override
 	public Object getService(Bundle bundle, ServiceRegistration registration) {
-		return new JndiExtension();
+		return new JndiExtension(_loggerFactory.getLogger(bundle, JndiContext.class.getName(), Logger.class));
 	}
 
 	@Override
@@ -30,4 +37,6 @@ public class JndiExtensionFactory implem
 		Bundle bundle, ServiceRegistration registration, Object extension) {
 	}
 
+	private final LoggerFactory _loggerFactory;
+
 }

Added: aries/trunk/cdi/cdi-extra/LICENSE
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/LICENSE?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/LICENSE (added)
+++ aries/trunk/cdi/cdi-extra/LICENSE Sat Apr 14 01:10:27 2018
@@ -0,0 +1,203 @@
+
+                                 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.
+

Added: aries/trunk/cdi/cdi-extra/NOTICE
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/NOTICE?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/NOTICE (added)
+++ aries/trunk/cdi/cdi-extra/NOTICE Sat Apr 14 01:10:27 2018
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+

Added: aries/trunk/cdi/cdi-extra/bnd.bnd
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/bnd.bnd?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/bnd.bnd (added)
+++ aries/trunk/cdi/cdi-extra/bnd.bnd Sat Apr 14 01:10:27 2018
@@ -0,0 +1,4 @@
+Import-Package: javax.servlet;resoltion:=optional, *
+-contract: JavaServlet;resoltion:=optional
+-exportcontents: ${packages;VERSIONED}
+-includeresource: META-INF/=LICENSE, META-INF/=NOTICE
\ No newline at end of file

Copied: aries/trunk/cdi/cdi-extra/pom.xml (from r1829114, aries/trunk/cdi/cdi-extension-http/pom.xml)
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/pom.xml?p2=aries/trunk/cdi/cdi-extra/pom.xml&p1=aries/trunk/cdi/cdi-extension-http/pom.xml&r1=1829114&r2=1829115&rev=1829115&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extension-http/pom.xml (original)
+++ aries/trunk/cdi/cdi-extra/pom.xml Sat Apr 14 01:10:27 2018
@@ -18,7 +18,7 @@
 <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">
+	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>
 
@@ -29,11 +29,10 @@
 		<relativePath>..</relativePath>
 	</parent>
 
-	<artifactId>org.apache.aries.cdi.extension.http</artifactId>
-	<name>CDI Http Extender</name>
+	<artifactId>org.apache.aries.cdi.extra</artifactId>
+	<name>Aries CDI Extra</name>
 	<description>
-		Provides support to CDI bundles for http servlet scopes such as @RequestScoped,
-		@ApplicationScoped, @SessionScoped and @ConversationScoped.
+		Aries CDI Extra includes common CDI Component Property Types
 	</description>
 
 	<build>
@@ -47,46 +46,21 @@
 
 	<dependencies>
 		<dependency>
-			<groupId>org.apache.aries.cdi</groupId>
-			<artifactId>org.apache.aries.javax.cdi-api</artifactId>
-			<version>${project.version}</version>
+			<groupId>org.apache.aries.spec</groupId>
+			<artifactId>org.apache.aries.javax.jax.rs-api</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.http.servlet-api</artifactId>
 			<version>1.1.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.jboss.weld</groupId>
-			<artifactId>weld-osgi-bundle</artifactId>
-			<version>3.0.1.Final</version>
-			<exclusions>
-				<exclusion>
-					<groupId>javax.enterprise</groupId>
-					<artifactId>cdi-api</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>javax.inject</groupId>
-					<artifactId>javax.inject</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.annotation</groupId>
-					<artifactId>jboss-annotations-api_1.2_spec</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.el</groupId>
-					<artifactId>jboss-el-api_3.0_spec</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>org.jboss.spec.javax.interceptor</groupId>
-					<artifactId>jboss-interceptors-api_1.2_spec</artifactId>
-				</exclusion>
-			</exclusions>
+			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
-			<artifactId>org.osgi.namespace.extender</artifactId>
-			<version>1.0.1</version>
+			<artifactId>osgi.annotation</artifactId>
+			<version>7.0.0-SNAPSHOT</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
@@ -96,14 +70,32 @@
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.namespace.service</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.event</artifactId>
+			<version>1.4.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.service.http.whiteboard</artifactId>
-			<version>1.0.0</version>
+			<version>1.1.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.jaxrs</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.osgi</groupId>
 			<artifactId>osgi.core</artifactId>
-			<version>6.0.0</version>
+			<version>7.0.0-SNAPSHOT</version>
 			<scope>provided</scope>
 		</dependency>
 	</dependencies>

Added: aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventDelivery.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventDelivery.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventDelivery.java (added)
+++ aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventDelivery.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) OSGi Alliance (2018). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.extra.propertytypes;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.osgi.service.cdi.annotations.ComponentPropertyType;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
+import org.osgi.service.event.annotations.RequireEventAdmin;
+
+/**
+ * Component Property Type for the {@link EventConstants#EVENT_DELIVERY} service
+ * property of an {@link EventHandler} service.
+ * <p>
+ * This annotation can be used on an {@link EventHandler} component to declare
+ * the value of the {@link EventConstants#EVENT_DELIVERY} service property.
+ */
+@ComponentPropertyType
+@RequireEventAdmin
+@Retention(RUNTIME)
+@Target({FIELD, METHOD, TYPE})
+public @interface EventDelivery {
+	/**
+	 * Service property specifying the {@code Event} delivery qualities
+	 * requested by an {@link EventHandler} service.
+	 * <p>
+	 * The supported delivery qualities are:
+	 * <ul>
+	 * <li>{@link EventConstants#DELIVERY_ASYNC_ORDERED}</li>
+	 * <li>{@link EventConstants#DELIVERY_ASYNC_UNORDERED}}</li>
+	 * </ul>
+	 *
+	 * @return The requested event delivery qualities.
+	 * @see EventConstants#EVENT_DELIVERY
+	 */
+	String[] value();
+}

Added: aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventFilter.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventFilter.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventFilter.java (added)
+++ aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventFilter.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) OSGi Alliance (2018). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.extra.propertytypes;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.osgi.service.cdi.annotations.ComponentPropertyType;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
+import org.osgi.service.event.annotations.RequireEventAdmin;
+
+/**
+ * Component Property Type for the {@link EventConstants#EVENT_FILTER} service
+ * property of an {@link EventHandler} service.
+ * <p>
+ * This annotation can be used on an {@link EventHandler} component to declare
+ * the value of the {@link EventConstants#EVENT_FILTER} service property.
+ */
+@ComponentPropertyType
+@RequireEventAdmin
+@Retention(RUNTIME)
+@Target({FIELD, METHOD, TYPE})
+public @interface EventFilter {
+	/**
+	 * Service property specifying the {@code Event} filter to an
+	 * {@link EventHandler} service.
+	 *
+	 * @return The event filter.
+	 * @see EventConstants#EVENT_FILTER
+	 */
+	String value();
+}

Added: aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventTopics.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventTopics.java?rev=1829115&view=auto
==============================================================================
--- aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventTopics.java (added)
+++ aries/trunk/cdi/cdi-extra/src/main/java/org/apache/aries/cdi/extra/propertytypes/EventTopics.java Sat Apr 14 01:10:27 2018
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) OSGi Alliance (2018). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * 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.extra.propertytypes;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.osgi.service.cdi.annotations.ComponentPropertyType;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
+import org.osgi.service.event.annotations.RequireEventAdmin;
+
+/**
+ * Component Property Type for the {@link EventConstants#EVENT_TOPIC} service
+ * property of an {@link EventHandler} service.
+ * <p>
+ * This annotation can be used on an {@link EventHandler} component to declare
+ * the values of the {@link EventConstants#EVENT_TOPIC} service property.
+ */
+@ComponentPropertyType
+@RequireEventAdmin
+@Retention(RUNTIME)
+@Target({FIELD, METHOD, TYPE})
+public @interface EventTopics {
+	/**
+	 * Service property specifying the {@code Event} topics of interest to an
+	 * {@link EventHandler} service.
+	 *
+	 * @return The event topics.
+	 * @see EventConstants#EVENT_TOPIC
+	 */
+	String[] value();
+}