Author: craigmcc
Date: Sat Jul 30 19:54:40 2005
New Revision: 226603

URL: http://svn.apache.org/viewcvs?rev=226603&view=rev
Log:
Add additional convenience methods.

Modified:
    
struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractFacesBean.java

Modified: 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractFacesBean.java
URL: 
http://svn.apache.org/viewcvs/struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractFacesBean.java?rev=226603&r1=226602&r2=226603&view=diff
==============================================================================
--- 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractFacesBean.java
 (original)
+++ 
struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractFacesBean.java
 Sat Jul 30 19:54:40 2005
@@ -17,12 +17,15 @@
 package org.apache.shale.view;
 
 import java.util.Map;
+import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
 
 /**
  * <p>Convenient abstract base class for application beans that wish to
@@ -83,6 +86,24 @@
 
 
     /**
+     * <p>Return the configured <code>Lifecycle</code> instance for
+     * the current application.</p>
+     */
+    protected Lifecycle getLifecycle() {
+
+        String lifecycleId =
+          getExternalContext().getInitParameter("javax.faces.LIFECYCLE_ID");
+        if (lifecycleId == null || lifecycleId.length() == 0) {
+            lifecycleId = LifecycleFactory.DEFAULT_LIFECYCLE;
+        }
+        LifecycleFactory lifecycleFactory = (LifecycleFactory)
+          FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+        return lifecycleFactory.getLifecycle(lifecycleId);
+
+    }
+
+
+    /**
      * <p>Return a <code>Map</code> of the request scope attributes
      * for this request.</p>
      */
@@ -167,6 +188,34 @@
 
         ValueBinding vb = getApplication().createValueBinding(expr);
         vb.setValue(getFacesContext(), value);
+
+    }
+
+
+    // ------------------------------------------------------------- Log 
Methods
+
+
+    /**
+     * <p>Log the specified message to the server's log file.</p>
+     *
+     * @param message Message to be logged
+     */
+    protected void log(String message) {
+
+        getExternalContext().log(message);
+
+    }
+
+
+    /**
+     * <p>Log the specified message and exception to the server's log file.</p>
+     *
+     * @param message Message to be logged
+     * @param throwable Exception to be logged
+     */
+    protected void log(String message, Throwable throwable) {
+
+        getExternalContext().log(message, throwable);
 
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to