[seam-commits] Seam SVN: r12208 - in modules/faces/trunk/src: test/java/org/jboss/seam/faces/event and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Mar 17 08:13:30 EDT 2010


Author: nickarls
Date: 2010-03-17 08:13:29 -0400 (Wed, 17 Mar 2010)
New Revision: 12208

Added:
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java
Removed:
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java
Modified:
   modules/faces/trunk/src/main/resources/META-INF/faces-config.xml
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java
   modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java
Log:
System event listeners

Modified: modules/faces/trunk/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/src/main/resources/META-INF/faces-config.xml	2010-03-17 11:32:35 UTC (rev 12207)
+++ modules/faces/trunk/src/main/resources/META-INF/faces-config.xml	2010-03-17 12:13:29 UTC (rev 12208)
@@ -5,20 +5,46 @@
    version="2.0"
    id="seam3">
 
-   <name>seam3</name>
+	<name>seam3</name>
 
-   <ordering>
-      <after>
-         <name>weld</name>
-      </after>
-   </ordering>
-   
-   
-   <lifecycle>
-      <phase-listener>org.jboss.seam.faces.context.FlashScopedContext</phase-listener>
-      <phase-listener>org.jboss.seam.faces.PhaseEventListener</phase-listener>      
-   </lifecycle>
-	
+	<ordering>
+		<after>
+			<name>weld</name>
+		</after>
+	</ordering>
+
+	<lifecycle>
+		<phase-listener>org.jboss.seam.faces.context.FlashScopedContext</phase-listener>
+		<phase-listener>org.jboss.seam.faces.PhaseEventListener</phase-listener>      
+	</lifecycle>
+
+	<application>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.ComponentSystemEvent</system-event-class>
+		</system-event-listener>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.ExceptionQueuedEvent</system-event-class>
+		</system-event-listener>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
+		</system-event-listener>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.PostConstructCustomScopeEvent</system-event-class>
+		</system-event-listener>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.PreDestroyApplicationEvent</system-event-class>
+		</system-event-listener>
+		<system-event-listener>
+			<system-event-listener-class>org.jboss.seam.faces.event.SystemEventListener</system-event-listener-class>
+			<system-event-class>javax.faces.event.PreDestroyCustomScopeEvent</system-event-class>
+		</system-event-listener>
+	</application>	
+
 	<!--
    <factory>
       <application-factory>org.jboss.seam.faces.application.SeamApplicationFactory</application-factory>
@@ -49,10 +75,10 @@
       <component-class>org.jboss.seam.faces.component.UIRestrictView</component-class>
    </component>
    -->
-   
-   <component>
-      <component-type>org.jboss.seam.faces.ViewAction</component-type>
-      <component-class>org.jboss.seam.faces.component.UIViewAction</component-class>
-   </component>
 
+	<component>
+		<component-type>org.jboss.seam.faces.ViewAction</component-type>
+		<component-class>org.jboss.seam.faces.component.UIViewAction</component-class>
+	</component>
+
 </faces-config>

Deleted: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java	2010-03-17 11:32:35 UTC (rev 12207)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java	2010-03-17 12:13:29 UTC (rev 12208)
@@ -1,92 +0,0 @@
-package org.jboss.seam.faces.event;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.faces.event.PhaseEvent;
-
-import org.jboss.seam.faces.event.qualifier.After;
-import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
-import org.jboss.seam.faces.event.qualifier.Before;
-import org.jboss.seam.faces.event.qualifier.InvokeApplication;
-import org.jboss.seam.faces.event.qualifier.ProcessValidations;
-import org.jboss.seam.faces.event.qualifier.RenderResponse;
-import org.jboss.seam.faces.event.qualifier.RestoreView;
-import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-
- at ApplicationScoped
-public class Observer
-{
-   public static boolean observeBeforeRenderResponse;
-   public static boolean observeAfterRenderResponse;
-   public static boolean observeBeforeApplyRequestValues;
-   public static boolean observeAfterApplyRequestValues;
-   public static boolean observeBeforeInvokeApplication;
-   public static boolean observeAfterInvokeApplication;
-   public static boolean observeBeforeProcessValidations;
-   public static boolean observeAfterProcessValidations;
-   public static boolean observeBeforeRestoreView;
-   public static boolean observeAfterRestoreView;
-   public static boolean observeBeforeUpdateModelValues;
-   public static boolean observeAfterUpdateModelValues;
-   
-   public void observeBeforeRenderResponse(@Observes @Before @RenderResponse PhaseEvent e) 
-   {
-      Observer.observeBeforeRenderResponse = true;
-   }
-   
-   public void observeAfterRenderResponse(@Observes @After @RenderResponse PhaseEvent e) 
-   {
-      Observer.observeAfterRenderResponse = true;
-   }
-   
-   public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues PhaseEvent e) 
-   {
-      Observer.observeBeforeApplyRequestValues = true;
-   }
-   
-   public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues PhaseEvent e) 
-   {
-      Observer.observeAfterApplyRequestValues = true;
-   }
-   
-   public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication PhaseEvent e) 
-   {
-      Observer.observeBeforeInvokeApplication = true;
-   }
-   
-   public void observeAfterInvokeApplication(@Observes @After @InvokeApplication PhaseEvent e) 
-   {
-      Observer.observeAfterInvokeApplication = true;
-   }   
-   
-   public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations PhaseEvent e) 
-   {
-      Observer.observeBeforeProcessValidations = true;
-   }
-   
-   public void observeAfterProcessValidations(@Observes @After @ProcessValidations PhaseEvent e) 
-   {
-      Observer.observeAfterProcessValidations = true;
-   }   
-   
-   public void observeBeforeRestoreView(@Observes @Before @RestoreView PhaseEvent e) 
-   {
-      Observer.observeBeforeRestoreView = true;
-   }
-   
-   public void observeAfterRestoreView(@Observes @After @RestoreView PhaseEvent e) 
-   {
-      Observer.observeAfterRestoreView = true;
-   }  
-
-   public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues PhaseEvent e) 
-   {
-      Observer.observeBeforeUpdateModelValues = true;
-   }
-   
-   public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues PhaseEvent e) 
-   {
-      Observer.observeAfterUpdateModelValues = true;
-   }  
-   
-}

Copied: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java (from rev 12207, modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/Observer.java)
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerObserver.java	2010-03-17 12:13:29 UTC (rev 12208)
@@ -0,0 +1,92 @@
+package org.jboss.seam.faces.event;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.event.PhaseEvent;
+
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.InvokeApplication;
+import org.jboss.seam.faces.event.qualifier.ProcessValidations;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.faces.event.qualifier.RestoreView;
+import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+
+ at ApplicationScoped
+public class PhaseListenerObserver
+{
+   public static boolean observeBeforeRenderResponse;
+   public static boolean observeAfterRenderResponse;
+   public static boolean observeBeforeApplyRequestValues;
+   public static boolean observeAfterApplyRequestValues;
+   public static boolean observeBeforeInvokeApplication;
+   public static boolean observeAfterInvokeApplication;
+   public static boolean observeBeforeProcessValidations;
+   public static boolean observeAfterProcessValidations;
+   public static boolean observeBeforeRestoreView;
+   public static boolean observeAfterRestoreView;
+   public static boolean observeBeforeUpdateModelValues;
+   public static boolean observeAfterUpdateModelValues;
+   
+   public void observeBeforeRenderResponse(@Observes @Before @RenderResponse PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeRenderResponse = true;
+   }
+   
+   public void observeAfterRenderResponse(@Observes @After @RenderResponse PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterRenderResponse = true;
+   }
+   
+   public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeApplyRequestValues = true;
+   }
+   
+   public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterApplyRequestValues = true;
+   }
+   
+   public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeInvokeApplication = true;
+   }
+   
+   public void observeAfterInvokeApplication(@Observes @After @InvokeApplication PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterInvokeApplication = true;
+   }   
+   
+   public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeProcessValidations = true;
+   }
+   
+   public void observeAfterProcessValidations(@Observes @After @ProcessValidations PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterProcessValidations = true;
+   }   
+   
+   public void observeBeforeRestoreView(@Observes @Before @RestoreView PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeRestoreView = true;
+   }
+   
+   public void observeAfterRestoreView(@Observes @After @RestoreView PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterRestoreView = true;
+   }  
+
+   public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeBeforeUpdateModelValues = true;
+   }
+   
+   public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues PhaseEvent e) 
+   {
+      PhaseListenerObserver.observeAfterUpdateModelValues = true;
+   }  
+   
+}

Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java	2010-03-17 11:32:35 UTC (rev 12207)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/PhaseListenerTests.java	2010-03-17 12:13:29 UTC (rev 12208)
@@ -1,18 +1,11 @@
 package org.jboss.seam.faces.event;
 
-import javax.enterprise.util.AnnotationLiteral;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.inject.Inject;
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.testng.Arquillian;
-import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
-import org.jboss.seam.faces.event.qualifier.InvokeApplication;
-import org.jboss.seam.faces.event.qualifier.ProcessValidations;
-import org.jboss.seam.faces.event.qualifier.RenderResponse;
-import org.jboss.seam.faces.event.qualifier.RestoreView;
-import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -29,97 +22,97 @@
    public static JavaArchive createTestArchive()
    {
       return Archives.create("test.jar", JavaArchive.class)
-         .addClasses(Observer.class, PhaseEventListener.class, GenericEventListener.class)
+         .addClasses(PhaseListenerObserver.class, PhaseEventListener.class, GenericEventListener.class)
          .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
    }
 
    @Inject PhaseEventListener phaseEventListener;
 
-   MockFacesEnvironment environment = MockFacesEnvironment.createEnvironment();
-   MockLifecycle lifecycle = new MockLifecycle();
+   private MockFacesEnvironment environment = MockFacesEnvironment.createEnvironment();
+   private MockLifecycle lifecycle = new MockLifecycle();
    
    @Test
-   public void testBeforeRenderResponse()
+   public void testBeforeRenderResponseObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RENDER_RESPONSE, lifecycle));
-      assert Observer.observeBeforeRenderResponse;
+      assert PhaseListenerObserver.observeBeforeRenderResponse;
    }
    
    @Test
-   public void testAfterRenderResponse()
+   public void testAfterRenderResponseObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RENDER_RESPONSE, lifecycle));
-      assert Observer.observeAfterRenderResponse;
+      assert PhaseListenerObserver.observeAfterRenderResponse;
    }
    
    @Test
-   public void testBeforeApplyRequestValues()
+   public void testBeforeApplyRequestValuesObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.APPLY_REQUEST_VALUES, lifecycle));
-      assert Observer.observeBeforeApplyRequestValues;
+      assert PhaseListenerObserver.observeBeforeApplyRequestValues;
    }
    
    @Test
-   public void testAfterApplyRequestValues()
+   public void testAfterApplyRequestValuesObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.APPLY_REQUEST_VALUES, lifecycle));
-      assert Observer.observeAfterApplyRequestValues;
+      assert PhaseListenerObserver.observeAfterApplyRequestValues;
    }   
 
    @Test
-   public void testBeforeInvokeApplication()
+   public void testBeforeInvokeApplicationObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.INVOKE_APPLICATION, lifecycle));
-      assert Observer.observeBeforeInvokeApplication;
+      assert PhaseListenerObserver.observeBeforeInvokeApplication;
    }
    
    @Test
-   public void testAfterInvokeApplication()
+   public void testAfterInvokeApplicationObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.INVOKE_APPLICATION, lifecycle));
-      assert Observer.observeAfterInvokeApplication;
+      assert PhaseListenerObserver.observeAfterInvokeApplication;
    }   
 
    @Test
-   public void testBeforeProcessValidations()
+   public void testBeforeProcessValidationsObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.PROCESS_VALIDATIONS, lifecycle));
-      assert Observer.observeBeforeProcessValidations;
+      assert PhaseListenerObserver.observeBeforeProcessValidations;
    }
    
    @Test
-   public void testAfterProcessValidations()
+   public void testAfterProcessValidationsObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.PROCESS_VALIDATIONS, lifecycle));
-      assert Observer.observeAfterProcessValidations;
+      assert PhaseListenerObserver.observeAfterProcessValidations;
    }   
 
    @Test
-   public void testBeforeRestoreView()
+   public void testBeforeRestoreViewObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RESTORE_VIEW, lifecycle));
-      assert Observer.observeBeforeRestoreView;
+      assert PhaseListenerObserver.observeBeforeRestoreView;
    }
    
    @Test
-   public void testAfterRestoreView()
+   public void testAfterRestoreViewObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.RESTORE_VIEW, lifecycle));
-      assert Observer.observeAfterRestoreView;
+      assert PhaseListenerObserver.observeAfterRestoreView;
    }   
 
    @Test
-   public void testBeforeUpdateModelValues()
+   public void testBeforeUpdateModelValuesObserver()
    {
       phaseEventListener.beforePhase(new PhaseEvent(environment.getFacesContext(), PhaseId.UPDATE_MODEL_VALUES, lifecycle));
-      assert Observer.observeBeforeUpdateModelValues;
+      assert PhaseListenerObserver.observeBeforeUpdateModelValues;
    }
    
    @Test
-   public void testAfterUpdateModelValues()
+   public void testAfterUpdateModelValuesObserver()
    {
       phaseEventListener.afterPhase(new PhaseEvent(environment.getFacesContext(), PhaseId.UPDATE_MODEL_VALUES, lifecycle));
-      assert Observer.observeAfterUpdateModelValues;
+      assert PhaseListenerObserver.observeAfterUpdateModelValues;
    }   
 
 }

Modified: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java	2010-03-17 11:32:35 UTC (rev 12207)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventListenerTests.java	2010-03-17 12:13:29 UTC (rev 12208)
@@ -1,6 +1,92 @@
 package org.jboss.seam.faces.event;
 
-public class SystemEventListenerTests
+import java.util.HashMap;
+
+import javax.faces.application.Application;
+import javax.faces.event.ComponentSystemEvent;
+import javax.faces.event.ExceptionQueuedEvent;
+import javax.faces.event.ExceptionQueuedEventContext;
+import javax.faces.event.PostConstructApplicationEvent;
+import javax.faces.event.PostConstructCustomScopeEvent;
+import javax.faces.event.PreDestroyApplicationEvent;
+import javax.faces.event.PreDestroyCustomScopeEvent;
+import javax.faces.event.ScopeContext;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.jboss.test.faces.mock.application.MockApplication;
+import org.jboss.test.faces.mock.component.MockUIComponent;
+import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
+import org.testng.annotations.Test;
+
+ at Test
+public class SystemEventListenerTests extends Arquillian
 {
 
+   @Deployment
+   public static JavaArchive createTestArchive()
+   {
+      return Archives.create("test.jar", JavaArchive.class)
+         .addClasses(SystemEventObserver.class, SystemEventListener.class, GenericEventListener.class)
+         .addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+   }
+   
+   @Inject SystemEventListener systemEventListener;
+
+   private MockFacesEnvironment environment = MockFacesEnvironment.createEnvironment();
+   private MockApplication application = new MockApplication();
+   
+   @SuppressWarnings("serial")
+   @Test
+   public void testComponentSystemEventObserver()
+   {
+      systemEventListener.processEvent(new ComponentSystemEvent(new MockUIComponent()){});
+      assert SystemEventObserver.componentSystemEvent;
+   }   
+   
+   @Test
+   public void testExceptionQueuedEventObserver()
+   {
+      ExceptionQueuedEventContext eqec = new ExceptionQueuedEventContext(environment.getFacesContext(), new NullPointerException());
+      ExceptionQueuedEvent eqe = new ExceptionQueuedEvent(eqec);
+      systemEventListener.processEvent(eqe);
+      assert SystemEventObserver.excecptionQueuedEvent;
+   }   
+   
+   @Test
+   public void testPostConstructApplicationEventObserver()
+   {
+      systemEventListener.processEvent(new PostConstructApplicationEvent(application));
+      assert SystemEventObserver.postConstructApplicationEvent;
+   }   
+   
+   @Test
+   public void testPostConstructCustomScopeEvent()
+   {
+      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
+      systemEventListener.processEvent(new PostConstructCustomScopeEvent(sc));
+      assert SystemEventObserver.postConstructCustomScopeEvent;
+   }
+   
+   @Test
+   public void testPreDestroyApplicationEventObserver()
+   {
+      systemEventListener.processEvent(new PreDestroyApplicationEvent(application));
+      assert SystemEventObserver.preDestroyApplicationEvent;
+   }    
+   
+   @Test
+   public void testPreDestroyCustomScopeEventObserver()
+   {
+      ScopeContext sc = new ScopeContext("dummyscope", new HashMap<String, Object>());
+      systemEventListener.processEvent(new PreDestroyCustomScopeEvent(sc));
+      assert SystemEventObserver.preDestroyCustomScopeEvent;
+   }        
+   
 }

Added: modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java
===================================================================
--- modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java	                        (rev 0)
+++ modules/faces/trunk/src/test/java/org/jboss/seam/faces/event/SystemEventObserver.java	2010-03-17 12:13:29 UTC (rev 12208)
@@ -0,0 +1,52 @@
+package org.jboss.seam.faces.event;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+import org.jboss.seam.faces.event.qualifier.ComponentSystemEvent;
+import org.jboss.seam.faces.event.qualifier.ExceptionQueuedEvent;
+import org.jboss.seam.faces.event.qualifier.PostConstructApplicationEvent;
+import org.jboss.seam.faces.event.qualifier.PostConstructCustomScopeEvent;
+import org.jboss.seam.faces.event.qualifier.PreDestroyApplicationEvent;
+import org.jboss.seam.faces.event.qualifier.PreDestroyCustomScopeEvent;
+
+ at ApplicationScoped
+public class SystemEventObserver
+{
+   public static boolean componentSystemEvent;
+   public static boolean excecptionQueuedEvent;
+   public static boolean postConstructApplicationEvent;
+   public static boolean postConstructCustomScopeEvent;
+   public static boolean preDestroyApplicationEvent;
+   public static boolean preDestroyCustomScopeEvent;
+
+   public void observeComponentSystemEvent(@Observes @ComponentSystemEvent javax.faces.event.ComponentSystemEvent e) 
+   {
+      componentSystemEvent = true;
+   }
+
+   public void observeExceptionQueuedEvent(@Observes @ExceptionQueuedEvent javax.faces.event.ExceptionQueuedEvent e) 
+   {
+      excecptionQueuedEvent = true;
+   }
+
+   public void observePostConstructApplicationEvent(@Observes @PostConstructApplicationEvent javax.faces.event.PostConstructApplicationEvent e) 
+   {
+      postConstructApplicationEvent = true;
+   }
+   
+   public void observePreDestroyApplicationEvent(@Observes @PreDestroyApplicationEvent javax.faces.event.PreDestroyApplicationEvent e) 
+   {
+      preDestroyApplicationEvent = true;
+   }   
+   
+   public void observePostConstructCustomScopeEvent(@Observes @PostConstructCustomScopeEvent javax.faces.event.PostConstructCustomScopeEvent e) 
+   {
+      postConstructCustomScopeEvent = true;
+   }
+   
+   public void observePreDestroyCustomScopeEvent(@Observes @PreDestroyCustomScopeEvent javax.faces.event.PreDestroyCustomScopeEvent e) 
+   {
+      preDestroyCustomScopeEvent = true;
+   }
+}



More information about the seam-commits mailing list