aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rotty3...@apache.org
Subject svn commit: r1829454 [2/2] - in /aries/trunk/cdi: cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/bean/ cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ cdi-extender/src/main/java/org/apache/aries/cdi/con...
Date Wed, 18 Apr 2018 15:13:47 GMT
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=1829454&r1=1829453&r2=1829454&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
Wed Apr 18 15:13:46 2018
@@ -14,14 +14,13 @@
 
 package org.apache.aries.cdi.container.test.beans;
 
-import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 
 import org.apache.aries.cdi.extra.propertytypes.ServiceRanking;
 import org.osgi.service.cdi.annotations.Service;
 import org.osgi.service.cdi.annotations.SingleComponent;
-import org.osgi.service.cdi.reference.ReferenceEvent;
+import org.osgi.service.cdi.reference.BindObject;
 
 @SingleComponent
 @Named("foo.annotated")
@@ -29,10 +28,12 @@ import org.osgi.service.cdi.reference.Re
 @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
+	void watchFoos(BindObject<Integer> numbers) {
+		numbers.adding(number -> System.out.println("Added: " + number)
+		).modified(number -> System.out.println("Updated: " + number)
+		).removed(number -> System.out.println("Removed: " + number)
+		).bind();
 	}
 
 	@Inject

Modified: 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=1829454&r1=1829453&r2=1829454&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java
(original)
+++ aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/test/beans/FooWithReferenceAndConfig.java
Wed Apr 18 15:13:46 2018
@@ -14,21 +14,22 @@
 
 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;
+import org.osgi.service.cdi.reference.BindObject;
 
 @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
+	void watchNumbers(BindObject<Integer> numbers) {
+		numbers.adding(number -> System.out.println("Added: " + number)
+		).modified(number -> System.out.println("Updated: " + number)
+		).removed(number -> System.out.println("Removed: " + number)
+		).bind();
 	}
 
 	@Inject

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=1829454&r1=1829453&r2=1829454&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
Wed Apr 18 15:13:46 2018
@@ -18,10 +18,10 @@ import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.EventMetadata;
+import javax.inject.Inject;
 
-import org.osgi.service.cdi.reference.ReferenceEvent;
+import org.osgi.service.cdi.reference.BindObject;
 
 @ApplicationScoped
 public class ObserverFoo {
@@ -30,27 +30,24 @@ public class ObserverFoo {
 		return _foos;
 	}
 
-	void foos(
-		@Observes ReferenceEvent<Foo> event,
-		EventMetadata eventMetadata) {
+	@Inject
+	void foos(BindObject<Foo> event, EventMetadata eventMetadata) {
 
-		event.onAdding(
+		event.adding(
 			foo -> {
 				System.out.printf("Adding %s, %s%n", foo, eventMetadata);
 				_foos.add(foo);
 			}
-		);
-		event.onUpdate(
+		).modified(
 			foo -> {
 				System.out.printf("Modified %s, %s%n", foo, eventMetadata);
 			}
-		);
-		event.onRemove(
+		).removed(
 			foo -> {
 				System.out.printf("Removed %s, %s%n", foo, eventMetadata);
 				_foos.remove(foo);
 			}
-		);
+		).bind();
 	}
 
 	private List<Foo> _foos = new CopyOnWriteArrayList<>();

Modified: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/JndiExtensionTests.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/JndiExtensionTests.java?rev=1829454&r1=1829453&r2=1829454&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/JndiExtensionTests.java
(original)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/JndiExtensionTests.java
Wed Apr 18 15:13:46 2018
@@ -79,7 +79,7 @@ public class JndiExtensionTests extends
 		extensionBundle.start();
 
 		for (int i = 20; (i > 0) && (bmTracker.getTrackingCount() == trackingCount);
i--) {
-			Thread.sleep(20);
+			Thread.sleep(100);
 		}
 
 		assertNotNull(bmTracker.getService());

Modified: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb10/SingleReferenceEventHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb10/SingleReferenceEventHandler.java?rev=1829454&r1=1829453&r2=1829454&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb10/SingleReferenceEventHandler.java
(original)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb10/SingleReferenceEventHandler.java
Wed Apr 18 15:13:46 2018
@@ -17,41 +17,39 @@ package org.apache.aries.cdi.test.tb10;
 import java.util.Map;
 import java.util.concurrent.ConcurrentSkipListMap;
 
-import javax.enterprise.event.Observes;
+import javax.inject.Inject;
 
 import org.apache.aries.cdi.test.interfaces.Pojo;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cdi.annotations.Service;
 import org.osgi.service.cdi.annotations.SingleComponent;
-import org.osgi.service.cdi.reference.ReferenceEvent;
+import org.osgi.service.cdi.reference.BindServiceReference;
 
 @Service
 @SingleComponent
 public class SingleReferenceEventHandler implements Pojo {
 
-	void integers(@Observes ReferenceEvent<Integer> event) {
-		event.onAddingServiceObjects(
-			so -> {
-				ServiceReference<Integer> serviceReference = so.getServiceReference();
-				System.out.println("=====ADDING==>>> " + serviceReference);
+	@Inject
+	void integers(BindServiceReference<Integer> binder) {
+		binder.adding(
+			sr -> {
+				System.out.println("=====ADDING==>>> " + sr + " " + SingleReferenceEventHandler.this);
 
-				_services.put(so.getServiceReference(), "ADDED");
+				_services.put(sr, "ADDED");
 			}
-		);
-		event.onUpdateServiceObjects(
-			so -> {
-				System.out.println("=====UPDATING==>>> " + so.getServiceReference());
+		).modified(
+			sr -> {
+				System.out.println("=====UPDATING==>>> " + sr + " " + SingleReferenceEventHandler.this);
 
-				_services.put(so.getServiceReference(), "UPDATED");
+				_services.put(sr, "UPDATED");
 			}
-		);
-		event.onRemoveServiceReference(
+		).removed(
 			sr -> {
-				System.out.println("=====REMOVING==>>> " + sr);
+				System.out.println("=====REMOVING==>>> " + sr + " " + SingleReferenceEventHandler.this);
 
 				_services.remove(sr);
 			}
-		);
+		).bind();
 	}
 
 	@Override

Modified: aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb9/ContainerReferenceEventHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb9/ContainerReferenceEventHandler.java?rev=1829454&r1=1829453&r2=1829454&view=diff
==============================================================================
--- aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb9/ContainerReferenceEventHandler.java
(original)
+++ aries/trunk/cdi/cdi-itests/src/main/java/org/apache/aries/cdi/test/tb9/ContainerReferenceEventHandler.java
Wed Apr 18 15:13:46 2018
@@ -17,40 +17,38 @@ package org.apache.aries.cdi.test.tb9;
 import java.util.TreeMap;
 
 import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
+import javax.inject.Inject;
 
 import org.apache.aries.cdi.test.interfaces.Pojo;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cdi.annotations.Service;
-import org.osgi.service.cdi.reference.ReferenceEvent;
+import org.osgi.service.cdi.reference.BindServiceReference;
 
 @ApplicationScoped
 @Service
 public class ContainerReferenceEventHandler implements Pojo {
 
-	void integers(@Observes ReferenceEvent<Integer> event) {
-		event.onAddingServiceObjects(
-			so -> {
-				ServiceReference<Integer> serviceReference = so.getServiceReference();
-				System.out.println("=====ADDING==>>> " + serviceReference);
+	@Inject
+	void integers(BindServiceReference<Integer> binder) {
+		binder.adding(
+			sr -> {
+				System.out.println("=====ADDING==>>> " + sr);
 
-				_services.put(so.getServiceReference(), "ADDED");
+				_services.put(sr, "ADDED");
 			}
-		);
-		event.onUpdateServiceObjects(
-			so -> {
-				System.out.println("=====UPDATING==>>> " + so.getServiceReference());
+		).modified(
+			sr -> {
+				System.out.println("=====UPDATING==>>> " + sr);
 
-				_services.put(so.getServiceReference(), "UPDATED");
+				_services.put(sr, "UPDATED");
 			}
-		);
-		event.onRemoveServiceReference(
+		).removed(
 			sr -> {
 				System.out.println("=====REMOVING==>>> " + sr);
 
 				_services.remove(sr);
 			}
-		);
+		).bind();
 	}
 
 	@Override



Mime
View raw message