You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/12/04 03:14:16 UTC

svn commit: r723190 - in /myfaces/core/branches/2_0_0/api/src/main/java/javax/faces: context/FacesContext.java event/ExceptionEvent.java event/ExceptionEventContext.java

Author: lu4242
Date: Wed Dec  3 18:14:15 2008
New Revision: 723190

URL: http://svn.apache.org/viewvc?rev=723190&view=rev
Log:
MYFACES-2093 Add ExceptionEvent and ExceptionEventContext class

Added:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java   (with props)
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java   (with props)
Modified:
    myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java?rev=723190&r1=723189&r2=723190&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java Wed Dec  3 18:14:15 2008
@@ -218,6 +218,16 @@
         return false;
     }
     
+    public ExceptionHandler getExceptionHandler()
+    {
+        throw new UnsupportedOperationException();
+    }
+    
+    public void setExceptionHandler(ExceptionHandler exceptionHandler)
+    {
+        throw new UnsupportedOperationException();
+    }
+    
     public void setCurrentPhaseId(PhaseId currentPhaseId)
     {
         throw new UnsupportedOperationException();

Added: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java?rev=723190&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java (added)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java Wed Dec  3 18:14:15 2008
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+/**
+*
+* @since 2.0
+* @author Leonardo Uribe (latest modification by $Author$)
+* @version $Revision$ $Date$
+*/
+public class ExceptionEvent extends SystemEvent
+{
+    
+    public ExceptionEvent(ExceptionEventContext eventContext)
+    {
+        super(eventContext);
+    }
+}

Propchange: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEvent.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java?rev=723190&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java (added)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java Wed Dec  3 18:14:15 2008
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.event;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+*
+* @since 2.0
+* @author Leonardo Uribe (latest modification by $Author$)
+* @version $Revision$ $Date$
+*/
+public class ExceptionEventContext implements SystemEventListenerHolder
+{
+    public static final String IN_BEFORE_PHASE_KEY = ExceptionEventContext.class
+            .getName()
+            + ".IN_BEFORE_PHASE";
+    public static final String IN_AFTER_PHASE_KEY = ExceptionEventContext.class
+            .getName()
+            + ".IN_AFTER_PHASE";
+
+    private final FacesContext _facesContext;
+    private final Throwable _throwable;
+    private final UIComponent _component;
+    private final PhaseId _phaseId;
+    private final Map<Object, Object> _attributes;
+
+    public ExceptionEventContext(FacesContext facesContext, Throwable throwable)
+    {
+        this(facesContext, throwable, null, null);
+    }
+
+    public ExceptionEventContext(FacesContext facesContext,
+            Throwable throwable, UIComponent component)
+    {
+        this(facesContext, throwable, component, null);
+    }
+
+    public ExceptionEventContext(FacesContext facesContext,
+            Throwable throwable, UIComponent component, PhaseId phaseId)
+    {
+        _facesContext = facesContext;
+        _throwable = throwable;
+        _component = component;
+        _phaseId = phaseId;
+        _attributes = new HashMap<Object, Object>();
+    }
+
+    public FacesContext getContext()
+    {
+        return _facesContext;
+    }
+
+    public Throwable getException()
+    {
+        return _throwable;
+    }
+
+    public UIComponent getComponent()
+    {
+        return _component;
+    }
+
+    public PhaseId getPhaseId()
+    {
+        return _phaseId;
+    }
+
+    public Map<Object, Object> getAttributes()
+    {
+        return _attributes;
+    }
+
+    public List<SystemEventListener> getListenersForEventClass(
+            Class<? extends SystemEvent> facesEventClass)
+    {
+        List<SystemEventListener> ret = new ArrayList<SystemEventListener>(1);
+        ret.add(_facesContext.getExceptionHandler());
+        return ret;
+    }
+}

Propchange: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/event/ExceptionEventContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL