You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/10/07 21:25:31 UTC

svn commit: r582669 - in /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra: conversation/ frameworkAdapter/ frameworkAdapter/basic/ frameworkAdapter/jsf/ frameworkAdapter/local/ requestParameterProvider/

Author: imario
Date: Sun Oct  7 12:25:30 2007
New Revision: 582669

URL: http://svn.apache.org/viewvc?rev=582669&view=rev
Log:
FA tests

Added:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java   (contents, props changed)
      - copied, changed from r582656, myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java
Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapterFilter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapterFilter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/RequestParameterProviderManager.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java Sun Oct  7 12:25:30 2007
@@ -19,6 +19,14 @@
 
 package org.apache.myfaces.orchestra.conversation;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.orchestra.frameworkAdapter.AbstractFrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+import org.apache.myfaces.orchestra.lib.OrchestraException;
+import org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterProviderManager;
+import org.apache.myfaces.shared_orchestra.util.ClassUtils;
+
 import java.io.IOException;
 import java.io.ObjectStreamException;
 import java.io.Serializable;
@@ -27,14 +35,6 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
-import org.apache.myfaces.orchestra.lib.OrchestraException;
-import org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterProviderManager;
-import org.apache.myfaces.shared_orchestra.util.ClassUtils;
-
 /**
  * Deals with the various conversation contexts in the current session.
  * <p>
@@ -71,11 +71,11 @@
 	// Used to report problems to the user. This member is only ever assigned to once, during the constructor
 	// for this class, and all ConversationMessager implementations are required to be thread-safe so there
 	// are no thread-safety issues with accessing this member.
-	private ConversationMessager conversationMessager;
+	// private ConversationMessager conversationMessager;
 
 	protected ConversationManager()
 	{
-		conversationMessager = createMessager();
+		// conversationMessager = createMessager();
 	}
 
 	/**
@@ -113,7 +113,7 @@
 
 		return conversationManager;
 	}
-	
+
 	/**
 	 * Get the current, or create a new unique conversationContextId.
 	 * <p>
@@ -317,14 +317,15 @@
 	 * <p>
 	 * The instance to use can be configured by defining a bean in the IOC configuration
 	 * with the name org.apache.orchestra.conversation.ConversationMessager. This should
-	 * be a "prototype" object, ie one that returns a new instance on each lookup. 
+	 * be a "prototype" object, ie one that returns a new instance on each lookup.
 	 * <p>
 	 * Alternatively the class to use can be configured in your web.xml using a servlet
 	 * config init parameter named <code>org.apache.myfaces.conversation.MESSAGER</code>.
 	 */
 	public ConversationMessager getMessager()
 	{
-		return conversationMessager;
+		return FrameworkAdapter.getInstance().getConversationMessager();
+		// return conversationMessager;
 	}
 
 	/**
@@ -335,7 +336,7 @@
 	private static ConversationMessager createMessager()
 	{
 		// First try init parameter for backwards compatibility
-		FrameworkAdapterInterface adapter = FrameworkAdapter.getInstance(); 
+		AbstractFrameworkAdapter adapter = FrameworkAdapter.getInstance();
 		String conversationMessagerName = adapter.getInitParameter(INIT_MESSAGER);
 		if (conversationMessagerName != null)
 		{
@@ -374,7 +375,7 @@
 	 * Check the timeout for each conversation context, and all conversations
 	 * within those contexts.
 	 * <p>
-	 * If any conversation has not been accessed within its timeout period 
+	 * If any conversation has not been accessed within its timeout period
 	 * then clear the context.
 	 * <p>
 	 * Invoke the checkTimeout method on each context so that any conversation

Copied: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java (from r582656, myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java)
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java?p2=myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java&p1=myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java&r1=582656&r2=582669&rev=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapterInterface.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java Sun Oct  7 12:25:30 2007
@@ -22,6 +22,8 @@
  */
 package org.apache.myfaces.orchestra.frameworkAdapter;
 
+import org.apache.myfaces.orchestra.conversation.ConversationMessager;
+
 import java.io.IOException;
 
 /**
@@ -31,44 +33,66 @@
  * Orchestra locates a concrete implementation of this class by using the FrameworkAdapter class, which supports
  * configuration of the actual underlying object returned.
  */
-public interface FrameworkAdapterInterface
+public abstract class AbstractFrameworkAdapter
 {
+	private ConversationMessager conversationMessager;
+
+	public ConversationMessager getConversationMessager()
+	{
+		if (conversationMessager == null)
+		{
+			conversationMessager = createConversationMessager();
+		}
+
+		return conversationMessager;
+	}
+
+	protected ConversationMessager createConversationMessager()
+	{
+		return null;
+	}
+
+	public void setConversationMessager(ConversationMessager conversationMessager)
+	{
+		this.conversationMessager = conversationMessager;
+	}
+
 	/**
 	 * Return the global init parameter with the specified name.
 	 * In most cases this is expected to return data from the ServletContext.
 	 */
-	public String getInitParameter(String key);
+	public abstract String getInitParameter(String key);
 
 	/**
 	 * Get a value from the set of input parameters sent by the user as part
 	 * of the request.
 	 */
-	public Object getRequestParameterAttribute(String key);
+	public abstract Object getRequestParameterAttribute(String key);
 
-	public boolean containsRequestParameterAttribute(String key);
+	public abstract boolean containsRequestParameterAttribute(String key);
 
 	/**
-	 * Get a request-scope variable. 
+	 * Get a request-scope variable.
 	 */
-	public Object getRequestAttribute(String key);
+	public abstract Object getRequestAttribute(String key);
 
-	public void setRequestAttribute(String key, Object value);
+	public abstract void setRequestAttribute(String key, Object value);
 
-	public boolean containsRequestAttribute(String key);
+	public abstract boolean containsRequestAttribute(String key);
 
 	/**
 	 * Get a variable from the session-scope of the current user.
 	 */
-	public Object getSessionAttribute(String key);
+	public abstract Object getSessionAttribute(String key);
 
-	public void setSessionAttribute(String key, Object value);
+	public abstract void setSessionAttribute(String key, Object value);
 
-	public boolean containsSessionAttribute(String key);
+	public abstract boolean containsSessionAttribute(String key);
 
 	/**
 	 * Instruct the remote browser to fetch the specified URL.
 	 */
-	public void redirect(String url) throws IOException;
+	public abstract void redirect(String url) throws IOException;
 
 	/**
 	 * Return the variable with the specified name, or null if no such bean exists.
@@ -82,17 +106,17 @@
 	 * is NOT evaluated as "property c of property b of bean a", but as the bean
 	 * with name 'a.b.c'.
 	 */
-	public Object getBean(String name);
+	public abstract Object getBean(String name);
 
 	/**
 	 * Navigate to the specified logical destination.
 	 * <p>
-	 * For frameworks that have a built-in navigation system, that system should be 
+	 * For frameworks that have a built-in navigation system, that system should be
 	 * invoked.
 	 * <p>
 	 * For frameworks with no logical navigation system, the navigationName is treated
 	 * as a plain URL. Whether a FORWARD or a REDIRECT to this URL is perfomed is
 	 * determined by the subclass.
 	 */
-	public void invokeNavigation(String navigationName) throws IOException;
+	public abstract void invokeNavigation(String navigationName) throws IOException;
 }

Propchange: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/AbstractFrameworkAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java Sun Oct  7 12:25:30 2007
@@ -41,13 +41,13 @@
 	/**
 	 * Expected to be called only by a servlet filter at the start and end of each request.
 	 */
-	public static void setInstance(FrameworkAdapterInterface frameworkAdapterInterface)
+	public static void setInstance(AbstractFrameworkAdapter frameworkAdapterInterface)
 	{
 		instance.set(frameworkAdapterInterface);
 	}
 
-	public static FrameworkAdapterInterface getInstance()
+	public static AbstractFrameworkAdapter getInstance()
 	{
-		return (FrameworkAdapterInterface) instance.get();
+		return (AbstractFrameworkAdapter) instance.get();
 	}
 }

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java Sun Oct  7 12:25:30 2007
@@ -18,18 +18,20 @@
  */
 package org.apache.myfaces.orchestra.frameworkAdapter.basic;
 
-import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.orchestra.conversation.ConversationMessager;
+import org.apache.myfaces.orchestra.conversation.basic.BasicConversationMessager;
+import org.apache.myfaces.orchestra.frameworkAdapter.AbstractFrameworkAdapter;
+import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
+import org.apache.myfaces.shared_orchestra.util.ClassUtils;
 
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
+import java.io.IOException;
 
 /**
  * An implementation of the FrameworkAdapter for plain servlet environments.
@@ -37,7 +39,7 @@
  * This class requires the BasicFrameworkAdapterFilter to be configured to run
  * for every request.
  */
-public class BasicFrameworkAdapter implements FrameworkAdapterInterface
+public class BasicFrameworkAdapter extends AbstractFrameworkAdapter
 {
 	private final static String ISE_MESSAGE="No request/response data available"; // NON-NLS
 
@@ -47,10 +49,33 @@
 	private final Log log = LogFactory.getLog(BasicFrameworkAdapter.class);
 
 	private final ServletContext servletContext;
+	private final String conversationMessager;
 
-	public BasicFrameworkAdapter(ServletContext context)
+	public BasicFrameworkAdapter(ServletContext context, String conversationMessager)
 	{
 		servletContext = context;
+		this.conversationMessager = conversationMessager;
+	}
+
+	protected ConversationMessager createConversationMessager()
+	{
+		if (conversationMessager == null)
+		{
+			return createDefaultConversationMessager();
+		}
+
+		Object instance = getBean(conversationMessager);
+		if (instance instanceof ConversationMessager)
+		{
+			return (ConversationMessager) instance;
+		}
+
+		return (ConversationMessager) ClassUtils.newInstance(conversationMessager);
+	}
+
+	protected ConversationMessager createDefaultConversationMessager()
+	{
+		return new BasicConversationMessager();
 	}
 
 	private HttpServletRequest getRequest()
@@ -77,7 +102,7 @@
 
 		FrameworkAdapter.setInstance(this);
 	}
-	
+
 	public void endRequest()
 	{
 		log.debug("Ending request");
@@ -85,7 +110,7 @@
 		httpServletRequest.set(null);
 		httpServletResponse.set(null);
 	}
-	
+
 	public String getInitParameter(String key)
 	{
 		return servletContext.getInitParameter(key);
@@ -199,7 +224,7 @@
 			redir.append(getRequestContextPath());
 		}
 		redir.append(url);
-		
+
 		HttpServletResponse rsp = getResponse();
 		String dstUrl = rsp.encodeRedirectURL(redir.toString());
 		rsp.sendRedirect(dstUrl);
@@ -228,9 +253,9 @@
 
 		obj = getSessionAttribute(name);
 		if (obj != null) return obj;
-		
+
 		// TODO: look up application-scoped objects.
-		
+
 		return null;
 	}
 

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapterFilter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapterFilter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapterFilter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapterFilter.java Sun Oct  7 12:25:30 2007
@@ -19,7 +19,8 @@
 
 package org.apache.myfaces.orchestra.frameworkAdapter.basic;
 
-import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -27,25 +28,27 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
 
 /**
  * Configures the BasicFrameworkAdapter.
- * <p> 
+ * <p>
  * Orchestra accesses information about the request, response, session, etc via a
  * FrameworkAdapter so that it can be used with multiple web tier frameworks. This
  * class selects and configures the simplest version of this adapter.
  */
 public class BasicFrameworkAdapterFilter implements Filter
 {
+	private final static String INIT_CONVERSATION_MESSAGER = "conversationMessagerClass";
+
 	private final Log log = LogFactory.getLog(BasicFrameworkAdapterFilter.class);
 	private BasicFrameworkAdapter adapter;
 
 	public void init(FilterConfig filterConfig) throws ServletException
 	{
-		 adapter = new BasicFrameworkAdapter(filterConfig.getServletContext());
+		String conversationMessager = filterConfig.getInitParameter(INIT_CONVERSATION_MESSAGER);
+
+		 adapter = new BasicFrameworkAdapter(filterConfig.getServletContext(), conversationMessager);
 	}
 
 	public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain filterChain) throws IOException, ServletException

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java Sun Oct  7 12:25:30 2007
@@ -18,23 +18,12 @@
  */
 package org.apache.myfaces.orchestra.frameworkAdapter.jsf;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.orchestra.conversation.ConversationMessager;
 import org.apache.myfaces.orchestra.conversation.jsf.JsfConversationMessager;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
-import org.apache.myfaces.orchestra.lib.OrchestraException;
+import org.apache.myfaces.orchestra.frameworkAdapter.basic.BasicFrameworkAdapter;
+
+import javax.faces.context.FacesContext;
+import java.io.IOException;
 
 /**
  * An implementation of the FrameworkAdapter for JSF environments.
@@ -42,57 +31,23 @@
  * This class requires the JsfFrameworkAdapterFilter to be configured to run
  * or every JSF request.
  */
-public class JsfFrameworkAdapter implements FrameworkAdapterInterface
+public class JsfFrameworkAdapter extends BasicFrameworkAdapter
 {
-	private final static String ISE_MESSAGE="can't find a way to access jsf data structures"; // NON-NLS
-	private final static ThreadLocal httpServletRequest = new ThreadLocal();
-	private final static ThreadLocal httpServletResponse = new ThreadLocal();
-
-	private final Log log = LogFactory.getLog(JsfFrameworkAdapter.class);
-	private final Map magicBeans = new HashMap();
-
-	public JsfFrameworkAdapter()
-	{
-		// Define magic bean names that cause an instance to be created even when it
-		// is not defined in the IOC configuration.
-		magicBeans.put(
-			ConversationMessager.class.getName(),
-			JsfConversationMessager.class);
-	}
-
-	protected FacesContext getFacesContext()
+	public JsfFrameworkAdapter(String conversationMessager)
 	{
-		return FacesContext.getCurrentInstance();
+		super(null, conversationMessager);
 	}
 
-	private HttpServletRequest getRequest()
+	protected ConversationMessager createDefaultConversationMessager()
 	{
-		return (HttpServletRequest) httpServletRequest.get();
+		return new JsfConversationMessager();
 	}
 
-	public void beginRequest(ServletRequest req, ServletResponse rsp)
-	{
-		log.debug("Beginning request");
-		if (req instanceof HttpServletRequest)
-		{
-			httpServletRequest.set(req);
-		}
-		if (rsp instanceof HttpServletResponse)
-		{
-			httpServletResponse.set(rsp);
-		}
-
-		FrameworkAdapter.setInstance(this);
-	}
-	
-	public void endRequest()
+	protected FacesContext getFacesContext()
 	{
-		log.debug("Ending request");
-		FrameworkAdapter.setInstance(null);
-		httpServletRequest.set(null);
-		httpServletResponse.set(null);
+		return FacesContext.getCurrentInstance();
 	}
-	
+
 	public String getInitParameter(String key)
 	{
 		FacesContext context = getFacesContext();
@@ -110,14 +65,8 @@
 
 		// Fall back to standard request stuff. Note that this is necessary as this
 		// method might be called before the FacesServletFilter has been run, ie
-		// the FacesContext might not yet exist. 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			return request.getParameter(key);
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		// the FacesContext might not yet exist.
+		return super.getRequestParameterAttribute(key);
 	}
 
 	public boolean containsRequestParameterAttribute(String key)
@@ -128,13 +77,7 @@
 			return context.getExternalContext().getRequestParameterMap().containsKey(key);
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			return request.getParameter(key) != null;
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.containsRequestParameterAttribute(key);
 	}
 
 	public Object getRequestAttribute(String key)
@@ -145,13 +88,7 @@
 			return context.getExternalContext().getRequestMap().get(key);
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			return request.getAttribute(key);
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.getRequestAttribute(key);
 	}
 
 	public void setRequestAttribute(String key, Object value)
@@ -163,14 +100,7 @@
 			return;
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			request.setAttribute(key, value);
-			return;
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		super.setRequestAttribute(key, value);
 	}
 
 	public boolean containsRequestAttribute(String key)
@@ -181,13 +111,7 @@
 			return context.getExternalContext().getRequestMap().containsKey(key);
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			return request.getAttribute(key) != null;
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.containsRequestAttribute(key);
 	}
 
 	public Object getSessionAttribute(String key)
@@ -198,13 +122,7 @@
 			return context.getExternalContext().getSessionMap().get(key);
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null && request.getSession(true) != null)
-		{
-			return request.getSession(true).getAttribute(key);
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.getSessionAttribute(key);
 	}
 
 	public void setSessionAttribute(String key, Object value)
@@ -216,13 +134,7 @@
 			return;
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null && request.getSession(true) != null)
-		{
-			request.getSession(true).setAttribute(key, value);
-			return;
-		}
-
+		super.setSessionAttribute(key, value);
 	}
 
 	public boolean containsSessionAttribute(String key)
@@ -233,13 +145,7 @@
 			return context.getExternalContext().getSessionMap().containsKey(key);
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null && request.getSession(true) != null)
-		{
-			return request.getSession(true).getAttribute(key) != null;
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.containsSessionAttribute(key);
 	}
 
 	protected String getRequestContextPath()
@@ -250,13 +156,7 @@
 			return context.getExternalContext().getRequestContextPath();
 		}
 
-		HttpServletRequest request = getRequest();
-		if (request != null)
-		{
-			return request.getContextPath();
-		}
-
-		throw new IllegalStateException(ISE_MESSAGE);
+		return super.getRequestContextPath();
 	}
 
 	public void redirect(String url) throws IOException
@@ -284,63 +184,8 @@
 			throw new IllegalStateException("getBean invoked before FacesServlet");
 		}
 
-		Object bean = context.getApplication()
+		return context.getApplication()
 	        	.getVariableResolver().resolveVariable(context, name);
-
-		if (bean == null)
-		{
-			bean = createMagicBean(name);
-		}
-
-		return bean;
-	}
-
-	/**
-	 * If the bean requested has one of the special "magic" names, then create an instance
-	 * from the corresponding hard-wired defaults in this class.
-	 * <p>
-	 * This provides a kind of "hard wired IOC default". This method is called when the
-	 * getBean method cannot locate an instance anywhere else.
-	 * <p>
-	 * Code throughout Orchestra generally locates resources by calling the getBean method
-	 * passing a bean name which is the classname of the implementation required. The user
-	 * can then configure an appropriate instance to be returned. If the user does not 
-	 * define a matching bean then the calling code uses "new" to create an instance of a
-	 * suitable default type. Unfortunately that doesn't work when the default type depends
-	 * upon what UI framework is being used. Intercepting calls here solves that issue by
-	 * ensuring that a suitable default object is returned for this framework but only if
-	 * the user has not mapped that name to their own definition.
-	 */
-	protected Object createMagicBean(String name)
-	{
-		Class beanClass; 
-		synchronized(magicBeans)
-		{
-			beanClass = (Class) magicBeans.get(name);
-		}
-
-		if (beanClass == null)
-		{
-			return null;
-		}
-		
-		// Ok, this is indeed a magic bean. Create an instance.
-		// Note that magic beans are always "prototypes"; a new instance
-		// is created for each call to getBean().
-		try
-		{
-			return beanClass.newInstance();
-		}
-		catch(InstantiationException e)
-		{
-			throw new OrchestraException(
-				"Internal error: unable to create instance of special bean " + name, e);
-		}
-		catch(IllegalAccessException e)
-		{
-			throw new OrchestraException(
-					"Internal error: unable to create instance of special bean " + name, e);
-		}
 	}
 
 	public void invokeNavigation(String navigationName)

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapterFilter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapterFilter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapterFilter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapterFilter.java Sun Oct  7 12:25:30 2007
@@ -19,7 +19,8 @@
 
 package org.apache.myfaces.orchestra.frameworkAdapter.jsf;
 
-import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -27,13 +28,11 @@
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
 
 /**
  * Configures the JsfFrameworkAdapter.
- * <p> 
+ * <p>
  * Orchestra accesses information about the request, response, session, etc via a
  * FrameworkAdapter so that it can be used with multiple web tier frameworks. This
  * class selects and configures the JSF version of this adapter.
@@ -44,11 +43,16 @@
  */
 public class JsfFrameworkAdapterFilter implements Filter
 {
+	private final static String INIT_CONVERSATION_MESSAGER = "conversationMessagerClass";
+
 	private final Log log = LogFactory.getLog(JsfFrameworkAdapterFilter.class);
-	private final JsfFrameworkAdapter adapter = new JsfFrameworkAdapter();
+	private JsfFrameworkAdapter adapter;
 
 	public void init(FilterConfig filterConfig) throws ServletException
 	{
+		String conversationMessager = filterConfig.getInitParameter(INIT_CONVERSATION_MESSAGER);
+
+		adapter =  new JsfFrameworkAdapter(conversationMessager);
 	}
 
 	public void doFilter(ServletRequest req, ServletResponse rsp, FilterChain filterChain) throws IOException, ServletException

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java Sun Oct  7 12:25:30 2007
@@ -22,7 +22,7 @@
  */
 package org.apache.myfaces.orchestra.frameworkAdapter.local;
 
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
+import org.apache.myfaces.orchestra.frameworkAdapter.AbstractFrameworkAdapter;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.ApplicationContext;
@@ -48,7 +48,7 @@
  * Note also that because this is intended for use only without a real request
  * and response, there is no corresponding Filter class.
  */
-public class LocalFrameworkAdapter implements FrameworkAdapterInterface, ApplicationContextAware
+public class LocalFrameworkAdapter extends AbstractFrameworkAdapter implements ApplicationContextAware
 {
 	private ConfigurableApplicationContext configurableApplicationContext;
 

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/RequestParameterProviderManager.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/RequestParameterProviderManager.java?rev=582669&r1=582668&r2=582669&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/RequestParameterProviderManager.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/requestParameterProvider/RequestParameterProviderManager.java Sun Oct  7 12:25:30 2007
@@ -22,7 +22,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
-import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
+import org.apache.myfaces.orchestra.frameworkAdapter.AbstractFrameworkAdapter;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -146,8 +146,8 @@
 
 	protected boolean isResponseIntercepted()
 	{
-		FrameworkAdapterInterface fa = FrameworkAdapter.getInstance();
-		
+		AbstractFrameworkAdapter fa = FrameworkAdapter.getInstance();
+
 		return Boolean.TRUE.equals(fa.getRequestAttribute(RequestParameterServletFilter.REQUEST_PARAM_FILTER_CALLED))
 			|| Boolean.TRUE.equals(fa.getRequestAttribute(RequestParameterServletFilter.REQUEST_PARAM_RESPONSE_WRAPPED));
 	}