You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/03/17 21:23:30 UTC

svn commit: r519439 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/

Author: weber
Date: Sat Mar 17 13:23:29 2007
New Revision: 519439

URL: http://svn.apache.org/viewvc?view=rev&rev=519439
Log:
TOBAGO-312 (Integrate handling of ajax requests into standard lifecycle)
  reformat code for checkstyle

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/InvokeApplicationExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseListenerManager.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RenderResponseExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/TobagoLifecycle.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,39 +1,37 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
  *
  * Apply request values phase (JSF Spec 2.2.2)
  */
 class ApplyRequestValuesExecutor implements PhaseExecutor {
-	public boolean execute(FacesContext facesContext) {
-		facesContext.getViewRoot().processDecodes(facesContext);
-		return false;
-	}
+  public boolean execute(FacesContext facesContext) {
+    facesContext.getViewRoot().processDecodes(facesContext);
+    return false;
+  }
 
-	public PhaseId getPhase() {
-		return PhaseId.APPLY_REQUEST_VALUES;
-	}
+  public PhaseId getPhase() {
+    return PhaseId.APPLY_REQUEST_VALUES;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/InvokeApplicationExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/InvokeApplicationExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/InvokeApplicationExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/InvokeApplicationExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,39 +1,37 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
  *
  * Invoke application phase (JSF Spec 2.2.5)
  */
 class InvokeApplicationExecutor implements PhaseExecutor {
-	public boolean execute(FacesContext facesContext) {
-		facesContext.getViewRoot().processApplication(facesContext);
-		return false;
-	}
+  public boolean execute(FacesContext facesContext) {
+    facesContext.getViewRoot().processApplication(facesContext);
+    return false;
+  }
 
-	public PhaseId getPhase() {
-		return PhaseId.INVOKE_APPLICATION;
-	}
+  public PhaseId getPhase() {
+    return PhaseId.INVOKE_APPLICATION;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,34 +1,30 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
 
 /**
  * Implements the PhaseExecutor for a lifecycle
- *
- * @author Nikolay Petrov
- *
  */
 interface PhaseExecutor {
-  
+
   /**
    * Executes a phase of the JavaServer(tm) Faces lifecycle, like UpdateModelValues.
    * The <code>execute</code> method is called by the lifecylce implementation's private
@@ -36,11 +32,11 @@
    * @param facesContext The <code>FacesContext</code> for the current request we are processing 
    * @return <code>true</code> if execution should be stopped
    */
-	boolean execute(FacesContext facesContext);
-	
+  boolean execute(FacesContext facesContext);
+
   /**
    * Returns the <code>PhaseId</code> for which the implemented executor is invoked 
    * @return
    */
   PhaseId getPhase();
-}
\ No newline at end of file
+}

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseListenerManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseListenerManager.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseListenerManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/PhaseListenerManager.java Sat Mar 17 13:23:29 2007
@@ -1,24 +1,22 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
-
 import java.util.HashMap;
 import java.util.Map;
 import javax.faces.context.FacesContext;
@@ -33,68 +31,66 @@
  * This class encapsulates the logic used to call PhaseListeners.  It was 
  * needed because of issue 9 of the JSF 1.2 spec.  See section 11.3 for more
  * details.
- *
- * @author Stan Silvert
  */
 class PhaseListenerManager {
-    
-    private static final Log log = LogFactory.getLog(PhaseListenerManager.class);
-    
-    private Lifecycle lifecycle;
-    private FacesContext facesContext;
-    private PhaseListener[] phaseListeners;
-    
-    // Tracks success in the beforePhase.  Listeners that throw an exception
-    // in beforePhase or were never called because a previous listener threw
-    // an exception should not have its afterPhase called
-    private Map listenerSuccessMap = new HashMap();
-    
-    /** Creates a new instance of PhaseListenerManager */
-    PhaseListenerManager(Lifecycle lifecycle, FacesContext facesContext, PhaseListener[] phaseListeners) {
-        this.lifecycle = lifecycle;
-        this.facesContext = facesContext;
-        this.phaseListeners = phaseListeners;
-    }
-    
-    private boolean isListenerForThisPhase(PhaseListener phaseListener, PhaseId phaseId) {
-        int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
-        return (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal() ||
-                listenerPhaseId == phaseId.getOrdinal());
-    }
-    
-    void informPhaseListenersBefore(PhaseId phaseId) {
-        boolean[] beforePhaseSuccess = new boolean[phaseListeners.length];
-        listenerSuccessMap.put(phaseId, beforePhaseSuccess);
-        
-        for (int i = 0; i < phaseListeners.length; i++) {
-            PhaseListener phaseListener = phaseListeners[i];
-            if (isListenerForThisPhase(phaseListener, phaseId)) {
-                try {
-                    phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
-                    beforePhaseSuccess[i] = true;
-                } catch (Exception e) {
-                    beforePhaseSuccess[i] = false; // redundant - for clarity
-                    log.error("Exception in PhaseListener " + phaseId.toString() + " beforePhase.", e);
-                    return;
-                }
-            }
+
+  private static final Log LOG = LogFactory.getLog(PhaseListenerManager.class);
+
+  private Lifecycle lifecycle;
+  private FacesContext facesContext;
+  private PhaseListener[] phaseListeners;
+
+  // Tracks success in the beforePhase.  Listeners that throw an exception
+  // in beforePhase or were never called because a previous listener threw
+  // an exception should not have its afterPhase called
+  private Map<PhaseId, boolean[]> listenerSuccessMap = new HashMap<PhaseId, boolean[]>();
+
+  /** Creates a new instance of PhaseListenerManager */
+  PhaseListenerManager(Lifecycle lifecycle, FacesContext facesContext, PhaseListener[] phaseListeners) {
+    this.lifecycle = lifecycle;
+    this.facesContext = facesContext;
+    this.phaseListeners = phaseListeners;
+  }
+
+  private boolean isListenerForThisPhase(PhaseListener phaseListener, PhaseId phaseId) {
+    int listenerPhaseId = phaseListener.getPhaseId().getOrdinal();
+    return (listenerPhaseId == PhaseId.ANY_PHASE.getOrdinal()
+        || listenerPhaseId == phaseId.getOrdinal());
+  }
+
+  void informPhaseListenersBefore(PhaseId phaseId) {
+    boolean[] beforePhaseSuccess = new boolean[phaseListeners.length];
+    listenerSuccessMap.put(phaseId, beforePhaseSuccess);
+
+    for (int i = 0; i < phaseListeners.length; i++) {
+      PhaseListener phaseListener = phaseListeners[i];
+      if (isListenerForThisPhase(phaseListener, phaseId)) {
+        try {
+          phaseListener.beforePhase(new PhaseEvent(facesContext, phaseId, lifecycle));
+          beforePhaseSuccess[i] = true;
+        } catch (Exception e) {
+          beforePhaseSuccess[i] = false; // redundant - for clarity
+          LOG.error("Exception in PhaseListener " + phaseId.toString() + " beforePhase.", e);
+          return;
         }
+      }
     }
+  }
 
-    void informPhaseListenersAfter(PhaseId phaseId) {
-        boolean[] beforePhaseSuccess = (boolean[])listenerSuccessMap.get(phaseId);
-        
-        for (int i = phaseListeners.length - 1; i >= 0; i--)  {
-            PhaseListener phaseListener = phaseListeners[i];
-            if (isListenerForThisPhase(phaseListener, phaseId) 
-                && beforePhaseSuccess[i]) {
-                try {
-                    phaseListener.afterPhase(new PhaseEvent(facesContext, phaseId, lifecycle));
-                } catch (Exception e) {
-                    log.error("Exception in PhaseListener " + phaseId.toString() + " afterPhase", e);
-                }
-            }
-        }
+  void informPhaseListenersAfter(PhaseId phaseId) {
+    boolean[] beforePhaseSuccess = listenerSuccessMap.get(phaseId);
 
+    for (int i = phaseListeners.length - 1; i >= 0; i--)  {
+      PhaseListener phaseListener = phaseListeners[i];
+      if (isListenerForThisPhase(phaseListener, phaseId)
+          && beforePhaseSuccess[i]) {
+        try {
+          phaseListener.afterPhase(new PhaseEvent(facesContext, phaseId, lifecycle));
+        } catch (Exception e) {
+          LOG.error("Exception in PhaseListener " + phaseId.toString() + " afterPhase", e);
+        }
+      }
     }
+
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,39 +1,36 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
- *
  * Process validations phase (JSF Spec 2.2.3)
  */
 class ProcessValidationsExecutor implements PhaseExecutor {
-	public boolean execute(FacesContext facesContext) {
-		facesContext.getViewRoot().processValidators(facesContext);
-		return false;
-	}
+  public boolean execute(FacesContext facesContext) {
+    facesContext.getViewRoot().processValidators(facesContext);
+    return false;
+  }
 
-	public PhaseId getPhase() {
-		return PhaseId.PROCESS_VALIDATIONS;
-	}
+  public PhaseId getPhase() {
+    return PhaseId.PROCESS_VALIDATIONS;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RenderResponseExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RenderResponseExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RenderResponseExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RenderResponseExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,22 +1,21 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import java.io.IOException;
 
@@ -28,24 +27,23 @@
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
  *
  * render response phase (JSF Spec 2.2.6)
  */
 class RenderResponseExecutor implements PhaseExecutor {
-	public boolean execute(FacesContext facesContext) {
-		Application application = facesContext.getApplication();
-		ViewHandler viewHandler = application.getViewHandler();
-
-		try {
-			viewHandler.renderView(facesContext, facesContext.getViewRoot());
-		} catch (IOException e) {
-			throw new FacesException(e.getMessage(), e);
-		}
-		return false;
-	}
-
-	public PhaseId getPhase() {
-		return PhaseId.RENDER_RESPONSE;
-	}
+  public boolean execute(FacesContext facesContext) {
+    Application application = facesContext.getApplication();
+    ViewHandler viewHandler = application.getViewHandler();
+
+    try {
+      viewHandler.renderView(facesContext, facesContext.getViewRoot());
+    } catch (IOException e) {
+      throw new FacesException(e.getMessage(), e);
+    }
+    return false;
+  }
+
+  public PhaseId getPhase() {
+    return PhaseId.RENDER_RESPONSE;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/RestoreViewExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,22 +1,21 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import java.io.IOException;
 
@@ -27,112 +26,112 @@
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
-import javax.portlet.PortletRequest;
+//import javax.portlet.PortletRequest;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.portlet.MyFacesGenericPortlet;
-import org.apache.myfaces.portlet.PortletUtil;
-import org.apache.myfaces.shared_impl.util.RestoreStateUtils;
-import org.apache.myfaces.util.DebugUtils;
+//import org.apache.myfaces.portlet.MyFacesGenericPortlet;
+//import org.apache.myfaces.portlet.PortletUtil;
+//import org.apache.myfaces.shared_impl.util.RestoreStateUtils;
+//import org.apache.myfaces.util.DebugUtils;
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
  *
  * Restore view phase (JSF Spec 2.2.1)
  */
 class RestoreViewExecutor implements PhaseExecutor {
 
-	private static final Log log = LogFactory.getLog(LifecycleImpl.class);
+  private static final Log LOG = LogFactory.getLog(RestoreViewExecutor.class);
 
-	public boolean execute(FacesContext facesContext) {
-		if(facesContext.getViewRoot() != null) {
-			facesContext.getViewRoot().setLocale(facesContext.getExternalContext().getRequestLocale());
-			RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(facesContext, facesContext.getViewRoot());
-			return false;
-		}
-
-		// Derive view identifier
-		String viewId = deriveViewId(facesContext);
-
-		if (viewId == null) {
-			ExternalContext externalContext = facesContext.getExternalContext();
-
-			if(externalContext.getRequestServletPath() == null) {
-				return true;
-			}
-			
-			if (!externalContext.getRequestServletPath().endsWith("/")) {
-				try {
-					externalContext.redirect(externalContext.getRequestServletPath() + "/");
-					facesContext.responseComplete();
-					return true;
-				} catch (IOException e) {
-					throw new FacesException("redirect failed", e);
-				}
-			}
-		}
-
-		Application application = facesContext.getApplication();
-		ViewHandler viewHandler = application.getViewHandler();
-
-		// boolean viewCreated = false;
-		UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewId);
-		if (viewRoot == null) {
-			viewRoot = viewHandler.createView(facesContext, viewId);
-			viewRoot.setViewId(viewId);
-			facesContext.renderResponse();
-			// viewCreated = true;
-		}
-
-		facesContext.setViewRoot(viewRoot);
-
-		if (facesContext.getExternalContext().getRequestParameterMap().isEmpty()) {
-			// no POST or query parameters --> set render response flag
-			facesContext.renderResponse();
-		}
-
-		RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(facesContext, viewRoot);
-		return false;
-	}
-
-	public PhaseId getPhase() {
-		return PhaseId.RESTORE_VIEW;
-	}
-
-	private static String deriveViewId(FacesContext facesContext) {
-		ExternalContext externalContext = facesContext.getExternalContext();
-
-		if (PortletUtil.isPortletRequest(facesContext)) {
-			PortletRequest request = (PortletRequest) externalContext.getRequest();
-			return request.getParameter(MyFacesGenericPortlet.VIEW_ID);
-		}
-
-		String viewId = externalContext.getRequestPathInfo(); // getPathInfo
-		if (viewId == null) {
-			// No extra path info found, so it is propably extension mapping
-			viewId = externalContext.getRequestServletPath(); // getServletPath
-			DebugUtils.assertError(viewId != null, log,
-					"RequestServletPath is null, cannot determine viewId of current page.");
-			if (viewId == null)
-				return null;
-
-			// TODO: JSF Spec 2.2.1 - what do they mean by "if the default
-			// ViewHandler implementation is used..." ?
-			String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
-			String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
-			DebugUtils.assertError(suffix.charAt(0) == '.', log, "Default suffix must start with a dot!");
-
-			int dot = viewId.lastIndexOf('.');
-			if (dot == -1) {
-				log.error("Assumed extension mapping, but there is no extension in " + viewId);
-				viewId = null;
-			} else {
-				viewId = viewId.substring(0, dot) + suffix;
-			}
-		}
+  public boolean execute(FacesContext facesContext) {
+    if(facesContext.getViewRoot() != null) {
+      facesContext.getViewRoot().setLocale(facesContext.getExternalContext().getRequestLocale());
+//      RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(facesContext, facesContext.getViewRoot());
+      return false;
+    }
+
+    // Derive view identifier
+    String viewId = deriveViewId(facesContext);
+
+    if (viewId == null) {
+      ExternalContext externalContext = facesContext.getExternalContext();
+
+      if(externalContext.getRequestServletPath() == null) {
+        return true;
+      }
+
+      if (!externalContext.getRequestServletPath().endsWith("/")) {
+        try {
+          externalContext.redirect(externalContext.getRequestServletPath() + "/");
+          facesContext.responseComplete();
+          return true;
+        } catch (IOException e) {
+          throw new FacesException("redirect failed", e);
+        }
+      }
+    }
+
+    Application application = facesContext.getApplication();
+    ViewHandler viewHandler = application.getViewHandler();
+
+    // boolean viewCreated = false;
+    UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewId);
+    if (viewRoot == null) {
+      viewRoot = viewHandler.createView(facesContext, viewId);
+      viewRoot.setViewId(viewId);
+      facesContext.renderResponse();
+      // viewCreated = true;
+    }
+
+    facesContext.setViewRoot(viewRoot);
+
+    if (facesContext.getExternalContext().getRequestParameterMap().isEmpty()) {
+      // no POST or query parameters --> set render response flag
+      facesContext.renderResponse();
+    }
+
+//    RestoreStateUtils.recursivelyHandleComponentReferencesAndSetValid(facesContext, viewRoot);
+    return false;
+  }
+
+  public PhaseId getPhase() {
+    return PhaseId.RESTORE_VIEW;
+  }
+
+  private static String deriveViewId(FacesContext facesContext) {
+    ExternalContext externalContext = facesContext.getExternalContext();
+
+//    if (PortletUtil.isPortletRequest(facesContext)) {
+//      PortletRequest request = (PortletRequest) externalContext.getRequest();
+//      return request.getParameter(MyFacesGenericPortlet.VIEW_ID);
+//    }
+
+    String viewId = externalContext.getRequestPathInfo(); // getPathInfo
+    if (viewId == null) {
+      // No extra path info found, so it is propably extension mapping
+      viewId = externalContext.getRequestServletPath(); // getServletPath
+//      DebugUtils.assertError(viewId != null, LOG,
+//          "RequestServletPath is null, cannot determine viewId of current page.");
+      if (viewId == null) {
+        return null;
+      }
+
+      // TODO: JSF Spec 2.2.1 - what do they mean by "if the default
+      // ViewHandler implementation is used..." ?
+      String defaultSuffix = externalContext.getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
+      String suffix = defaultSuffix != null ? defaultSuffix : ViewHandler.DEFAULT_SUFFIX;
+//      DebugUtils.assertError(suffix.charAt(0) == '.', LOG, "Default suffix must start with a dot!");
+
+      int dot = viewId.lastIndexOf('.');
+      if (dot == -1) {
+        LOG.error("Assumed extension mapping, but there is no extension in " + viewId);
+        viewId = null;
+      } else {
+        viewId = viewId.substring(0, dot) + suffix;
+      }
+    }
 
-		return viewId;
-	}
+    return viewId;
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/TobagoLifecycle.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/TobagoLifecycle.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/TobagoLifecycle.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/TobagoLifecycle.java Sat Mar 17 13:23:29 2007
@@ -1,22 +1,21 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -29,175 +28,175 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.util.DebugUtils;
+//import org.apache.myfaces.util.DebugUtils;
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Manfred Geiler
- * @author Nikolay Petrov
  */
-public class LifecycleImpl
-        extends Lifecycle
-{
-    private static final Log log = LogFactory.getLog(LifecycleImpl.class);
-
-    private PhaseExecutor[] lifecycleExecutors;
-    private PhaseExecutor renderExecutor;
-
-    private final List _phaseListenerList = new ArrayList();
-
-    /**
-     * Lazy cache for returning _phaseListenerList as an Array.
-     */
-    private PhaseListener[] _phaseListenerArray = null;
-
-    public LifecycleImpl() {
-        // hide from public access
-    	lifecycleExecutors = new PhaseExecutor[] {
-    			new RestoreViewExecutor(),
-    			new ApplyRequestValuesExecutor(),
-    			new ProcessValidationsExecutor(),
-    			new UpdateModelValuesExecutor(),
-    			new InvokeApplicationExecutor()
-    	};
-
-    	renderExecutor = new RenderResponseExecutor();
-    }
-
-    public void execute(FacesContext facesContext) throws FacesException {
-        PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this, facesContext, getPhaseListeners());
-        for(int executorIndex = 0;executorIndex < lifecycleExecutors.length;executorIndex++) {
-        	if(executePhase(facesContext, lifecycleExecutors[executorIndex], phaseListenerMgr)) {
-        		return;
-        	}
-        }
-    }
-
-
-    private boolean executePhase(FacesContext facesContext, PhaseExecutor executor,
-    		PhaseListenerManager phaseListenerMgr) throws FacesException {
-		boolean skipFurtherProcessing = false;
-        if (log.isTraceEnabled()) {
-        	log.trace("entering " + executor.getPhase() + " in " + LifecycleImpl.class.getName());
-        }
-
-        try {
-            phaseListenerMgr.informPhaseListenersBefore(executor.getPhase());
-
-            if(isResponseComplete(facesContext, executor.getPhase(), true)) {
-                // have to return right away
-            	return true;
-            }
-            if(shouldRenderResponse(facesContext, executor.getPhase(), true)) {
-            	skipFurtherProcessing = true;
-            }
-
-            if(executor.execute(facesContext)) {
-            	return true;
-            }
-        } finally {
-            phaseListenerMgr.informPhaseListenersAfter(executor.getPhase());
-        }
-
-
-        if (isResponseComplete(facesContext, executor.getPhase(), false)
-        		|| shouldRenderResponse(facesContext, executor.getPhase(), false)) {
-        	// since this phase is completed we don't need to return right away even if the response is completed
-        	skipFurtherProcessing = true;
-        }
-
-        if (!skipFurtherProcessing && log.isTraceEnabled()) {
-			log.trace("exiting " + executor.getPhase() + " in " + LifecycleImpl.class.getName());
-        }
-
-        return skipFurtherProcessing;
-    }
-
-    public void render(FacesContext facesContext) throws FacesException {
-    	// if the response is complete we should not be invoking the phase listeners
-        if(isResponseComplete(facesContext, renderExecutor.getPhase(), true)) {
-        	return;
-        }
-        if (log.isTraceEnabled()) log.trace("entering " + renderExecutor.getPhase() + " in " + LifecycleImpl.class.getName());
-
-        PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this, facesContext, getPhaseListeners());
-
-        try {
-            phaseListenerMgr.informPhaseListenersBefore(renderExecutor.getPhase());
-            // also possible that one of the listeners completed the response
-            if(isResponseComplete(facesContext, renderExecutor.getPhase(), true)) {
-            	return;
-            }
-
-            renderExecutor.execute(facesContext);
-        } finally {
-            phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
-        }
-
-        if (log.isTraceEnabled()) {
-            //Note: DebugUtils Logger must also be in trace level
-            DebugUtils.traceView("View after rendering");
-        }
-
-        if (log.isTraceEnabled()) {
-        	log.trace("exiting " + renderExecutor.getPhase() + " in " + LifecycleImpl.class.getName());
-        }
-    }
-
-    private boolean isResponseComplete(FacesContext facesContext, PhaseId phase, boolean before) {
-		boolean flag = false;
-	    if (facesContext.getResponseComplete()) {
-	        if (log.isDebugEnabled()) {
-				log.debug("exiting from lifecycle.execute in " + phase
-						+ " because getResponseComplete is true from one of the " +
-						(before ? "before" : "after") + " listeners");
-	        }
-	        flag = true;
-	    }
-	    return flag;
-	}
-
-	private boolean shouldRenderResponse(FacesContext facesContext, PhaseId phase, boolean before) {
-			boolean flag = false;
-	    if (facesContext.getRenderResponse()) {
-	        if (log.isDebugEnabled()) {
-				log.debug("exiting from lifecycle.execute in " + phase
-						+ " because getRenderResponse is true from one of the " +
-						(before ? "before" : "after") + " listeners");
-	        }
-	        flag = true;
-	    }
-	    return flag;
-	}
-
-    public void addPhaseListener(PhaseListener phaseListener) {
-		if (phaseListener == null) {
-			throw new NullPointerException("PhaseListener must not be null.");
-		}
-		synchronized (_phaseListenerList) {
-			_phaseListenerList.add(phaseListener);
-			_phaseListenerArray = null; // reset lazy cache array
-		}
-	}
-
-	public void removePhaseListener(PhaseListener phaseListener) {
-		if (phaseListener == null) {
-			throw new NullPointerException("PhaseListener must not be null.");
-		}
-		synchronized (_phaseListenerList) {
-			_phaseListenerList.remove(phaseListener);
-			_phaseListenerArray = null; // reset lazy cache array
-		}
-	}
-
-	public PhaseListener[] getPhaseListeners() {
-		synchronized (_phaseListenerList) {
-			// (re)build lazy cache array if necessary
-			if (_phaseListenerArray == null) {
-				_phaseListenerArray = (PhaseListener[]) _phaseListenerList.toArray(new PhaseListener[_phaseListenerList
-						.size()]);
-			}
-			return _phaseListenerArray;
-		}
-	}
+public class TobagoLifecycle extends Lifecycle {
+
+  private static final Log LOG = LogFactory.getLog(TobagoLifecycle.class);
+
+  private PhaseExecutor[] lifecycleExecutors;
+  private PhaseExecutor renderExecutor;
+
+  private final List<PhaseListener> phaseListenerList = new ArrayList<PhaseListener>();
+
+  /**
+   * Lazy cache for returning phaseListenerList as an Array.
+   */
+  private PhaseListener[] phaseListenerArray = null;
+
+  public TobagoLifecycle() {
+    // hide from public access
+    lifecycleExecutors = new PhaseExecutor[] {
+        new RestoreViewExecutor(),
+        new ApplyRequestValuesExecutor(),
+        new ProcessValidationsExecutor(),
+        new UpdateModelValuesExecutor(),
+        new InvokeApplicationExecutor()
+    };
+
+    renderExecutor = new RenderResponseExecutor();
+  }
+
+  public void execute(FacesContext facesContext) throws FacesException {
+    PhaseListenerManager phaseListenerMgr
+        = new PhaseListenerManager(this, facesContext, getPhaseListeners());
+    for (PhaseExecutor executor : lifecycleExecutors) {
+      if (executePhase(facesContext, executor, phaseListenerMgr)) {
+        return;
+      }
+    }
+  }
+
+  private boolean executePhase(FacesContext facesContext, PhaseExecutor executor,
+                               PhaseListenerManager phaseListenerMgr)
+      throws FacesException {
+
+    boolean skipFurtherProcessing = false;
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("entering " + executor.getPhase() + " in " + TobagoLifecycle.class.getName());
+    }
+
+    try {
+      phaseListenerMgr.informPhaseListenersBefore(executor.getPhase());
+
+      if(isResponseComplete(facesContext, executor.getPhase(), true)) {
+        // have to return right away
+        return true;
+      }
+      if(shouldRenderResponse(facesContext, executor.getPhase(), true)) {
+        skipFurtherProcessing = true;
+      }
+
+      if(executor.execute(facesContext)) {
+        return true;
+      }
+    } finally {
+      phaseListenerMgr.informPhaseListenersAfter(executor.getPhase());
+    }
+
+
+    if (isResponseComplete(facesContext, executor.getPhase(), false)
+        || shouldRenderResponse(facesContext, executor.getPhase(), false)) {
+      // since this phase is completed we don't need to return right away even if the response is completed
+      skipFurtherProcessing = true;
+    }
+
+    if (!skipFurtherProcessing && LOG.isTraceEnabled()) {
+      LOG.trace("exiting " + executor.getPhase() + " in " + TobagoLifecycle.class.getName());
+    }
+
+    return skipFurtherProcessing;
+  }
+
+  public void render(FacesContext facesContext) throws FacesException {
+    // if the response is complete we should not be invoking the phase listeners
+    if(isResponseComplete(facesContext, renderExecutor.getPhase(), true)) {
+      return;
+    }
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("entering " + renderExecutor.getPhase() + " in " + TobagoLifecycle.class.getName());
+    }
+
+    PhaseListenerManager phaseListenerMgr = new PhaseListenerManager(this, facesContext, getPhaseListeners());
+
+    try {
+      phaseListenerMgr.informPhaseListenersBefore(renderExecutor.getPhase());
+      // also possible that one of the listeners completed the response
+      if(isResponseComplete(facesContext, renderExecutor.getPhase(), true)) {
+        return;
+      }
+
+      renderExecutor.execute(facesContext);
+    } finally {
+      phaseListenerMgr.informPhaseListenersAfter(renderExecutor.getPhase());
+    }
+
+    if (LOG.isTraceEnabled()) {
+      //Note: DebugUtils Logger must also be in trace level
+//      DebugUtils.traceView("View after rendering");
+    }
+
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("exiting " + renderExecutor.getPhase() + " in " + TobagoLifecycle.class.getName());
+    }
+  }
+
+  private boolean isResponseComplete(FacesContext facesContext, PhaseId phase, boolean before) {
+    boolean flag = false;
+    if (facesContext.getResponseComplete()) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("exiting from lifecycle.execute in " + phase
+            + " because getResponseComplete is true from one of the "
+            + (before ? "before" : "after") + " listeners");
+      }
+      flag = true;
+    }
+    return flag;
+  }
+
+  private boolean shouldRenderResponse(FacesContext facesContext, PhaseId phase, boolean before) {
+    boolean flag = false;
+    if (facesContext.getRenderResponse()) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("exiting from lifecycle.execute in " + phase
+            + " because getRenderResponse is true from one of the "
+            + (before ? "before" : "after") + " listeners");
+      }
+      flag = true;
+    }
+    return flag;
+  }
+
+  public void addPhaseListener(PhaseListener phaseListener) {
+    if (phaseListener == null) {
+      throw new NullPointerException("PhaseListener must not be null.");
+    }
+    synchronized (phaseListenerList) {
+      phaseListenerList.add(phaseListener);
+      phaseListenerArray = null; // reset lazy cache array
+    }
+  }
+
+  public void removePhaseListener(PhaseListener phaseListener) {
+    if (phaseListener == null) {
+      throw new NullPointerException("PhaseListener must not be null.");
+    }
+    synchronized (phaseListenerList) {
+      phaseListenerList.remove(phaseListener);
+      phaseListenerArray = null; // reset lazy cache array
+    }
+  }
+
+  public PhaseListener[] getPhaseListeners() {
+    synchronized (phaseListenerList) {
+      // (re)build lazy cache array if necessary
+      if (phaseListenerArray == null) {
+        phaseListenerArray = phaseListenerList.toArray(new PhaseListener[phaseListenerList.size()]);
+      }
+      return phaseListenerArray;
+    }
+  }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java?view=diff&rev=519439&r1=519438&r2=519439
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java Sat Mar 17 13:23:29 2007
@@ -1,22 +1,21 @@
+package org.apache.myfaces.tobago.lifecycle;
+
 /*
- * 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
+ * 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
+ *      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.
+ * 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.myfaces.lifecycle;
 
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
@@ -24,17 +23,15 @@
 
 /**
  * Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
- * @author Nikolay Petrov
- *
  * Update model values phase (JSF Spec 2.2.4)
  */
 class UpdateModelValuesExecutor implements PhaseExecutor {
-	public boolean execute(FacesContext facesContext) {
-		facesContext.getViewRoot().processUpdates(facesContext);
-		return false;
-	}
+  public boolean execute(FacesContext facesContext) {
+    facesContext.getViewRoot().processUpdates(facesContext);
+    return false;
+  }
 
-	public PhaseId getPhase() {
-		return PhaseId.UPDATE_MODEL_VALUES;
-	}
+  public PhaseId getPhase() {
+    return PhaseId.UPDATE_MODEL_VALUES;
+  }
 }