dev@javaserverfaces.java.net

[REVIEW] Issue 208 phase 1.

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Thu, 15 Dec 2005 11:18:34 -0800

Remove compile dependencies on commons-collections.



SECTION: Modified Files
----------------------------

M src/com/sun/faces/context/FacesContextImpl.java
  - remove unused code

M src/com/sun/faces/application/StateManagerImpl.java
M systest/src/com/sun/faces/application/ResetUniqueRequestIdBean.java
M test/com/sun/faces/application/DeprStateManagerImpl.java
  - Use custom LRUMap instead of that from commons-collections

M build-tests.xml
 - simple test for new LRUMap

A src/com/sun/faces/util/LRUMap.java
  - Simple LRUMap implementation (based on javadocs for LinkedHashMap)

A test/com/sun/faces/util/TestLRUMap.java
 - Test case for LRUMap


SECTION: Diffs
----------------------------
Index: build-tests.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/build-tests.xml,v
retrieving revision 1.224
diff -u -r1.224 build-tests.xml
--- build-tests.xml 14 Dec 2005 22:27:52 -0000 1.224
+++ build-tests.xml 15 Dec 2005 19:11:55 -0000
@@ -217,7 +217,7 @@
                 <sysproperty key="cactus.contextURL"
                              
value="http://${container.host}:${container.port}/test"/>
             </custom-sysproperties>
- <suite>
+ <suite>
                 <test todir="${impl.test.results.dir}"
                       
name="com.sun.faces.application.TestActionListenerImpl"/>
                 <test todir="${impl.test.results.dir}"
@@ -347,7 +347,9 @@
                    test-results-dir="${impl.test.results.dir}">
             <suite>
                 <test todir="${impl.test.results.dir}"
- name="com.sun.faces.util.TestUtil_local"/>
+ name="com.sun.faces.util.TestUtil_local"/>
+ <test todir="${impl.test.results.dir}"
+ name="com.sun.faces.util.TestLRUMap"/>
             </suite>
         </jsf.junit>
         <antcall target="test.config"/>
Index: src/com/sun/faces/application/StateManagerImpl.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/StateManagerImpl.java,v
retrieving revision 1.38
diff -u -r1.38 StateManagerImpl.java
--- src/com/sun/faces/application/StateManagerImpl.java 26 Aug 2005
15:26:59 -0000 1.38
+++ src/com/sun/faces/application/StateManagerImpl.java 15 Dec 2005
19:11:55 -0000
@@ -36,7 +36,7 @@
 import com.sun.faces.RIConstants;
 import com.sun.faces.util.TreeStructure;
 import com.sun.faces.util.Util;
-import org.apache.commons.collections.LRUMap;
+import com.sun.faces.util.LRUMap;
 
 import javax.faces.application.StateManager;
 import javax.faces.component.UIComponent;
Index: src/com/sun/faces/context/FacesContextImpl.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/context/FacesContextImpl.java,v
retrieving revision 1.75
diff -u -r1.75 FacesContextImpl.java
--- src/com/sun/faces/context/FacesContextImpl.java 29 Nov 2005
16:20:13 -0000 1.75
+++ src/com/sun/faces/context/FacesContextImpl.java 15 Dec 2005
19:11:55 -0000
@@ -29,12 +29,7 @@
 
 package com.sun.faces.context;
 
-import com.sun.faces.util.Util;
-import org.apache.commons.collections.CursorableLinkedList;
-
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
+import javax.el.ELContext;
 import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
 import javax.faces.application.ApplicationFactory;
@@ -45,22 +40,23 @@
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseStream;
 import javax.faces.context.ResponseWriter;
-import javax.faces.event.FacesEvent;
 import javax.faces.lifecycle.Lifecycle;
 import javax.faces.render.RenderKit;
 import javax.faces.render.RenderKitFactory;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Locale;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.LinkedHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.commons.collections.CursorableLinkedList;
 
-import javax.el.ELContext;
 import com.sun.faces.el.ELContextImpl;
+import com.sun.faces.util.Util;
 
 public class FacesContextImpl extends FacesContext {
 
@@ -83,8 +79,7 @@
 
     // Relationship Instance Variables
     private ResponseStream responseStream = null;
- private ResponseWriter responseWriter = null;
- private CursorableLinkedList facesEvents = null;
+ private ResponseWriter responseWriter = null;
     private ExternalContext externalContext = null;
     private Application application = null;
     private UIViewRoot viewRoot = null;
@@ -187,18 +182,7 @@
 
         }
         return result;
- }
-
-
- public Iterator getFacesEvents() {
- assertNotReleased();
- if (facesEvents != null) {
- return (facesEvents.cursor());
- } else {
- return (Collections.EMPTY_LIST.iterator());
- }
- }
-
+ }
 
     public Severity getMaximumSeverity() {
         assertNotReleased();
@@ -305,10 +289,7 @@
                 (Util.getExceptionMessageString(
                     Util.NULL_PARAMETERS_ERROR_MESSAGE_ID));
         }
-
- if (viewRoot != root) {
- facesEvents = null;
- }
+
         viewRoot = root;
     }
 
@@ -327,33 +308,7 @@
                     Util.NULL_RESPONSE_WRITER_ERROR_MESSAGE_ID));
         }
         responseWriter = newResponseWriter;
- }
-
-
- public void addFacesEvent(FacesEvent event) {
- assertNotReleased();
- // Validate our preconditions
- if (event == null) {
- throw new NullPointerException
-
(Util.getExceptionMessageString(Util.NULL_EVENT_ERROR_MESSAGE_ID));
- }
-
- // Add this event to our internal queue
- if (facesEvents == null) {
- facesEvents = new CursorableLinkedList();
- }
- facesEvents.add(event);
-
- if (logger.isLoggable(Level.FINE)) {
- String id = event.getComponent().getId();
- if (id == null) {
- id = "<<NONE>>";
- }
- logger.fine("Adding FacesEvent[sourceId=" + id +
- ",type=" + event.getClass().getName());
- }
-
- }
+ }
 
 
     public void addMessage(String clientId, FacesMessage message) {
@@ -390,8 +345,7 @@
         released = true;
         externalContext = null;
         responseStream = null;
- responseWriter = null;
- facesEvents = null;
+ responseWriter = null;
         componentMessageLists = null;
         renderResponse = false;
         responseComplete = false;
Index: systest/src/com/sun/faces/application/ResetUniqueRequestIdBean.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/systest/src/com/sun/faces/application/ResetUniqueRequestIdBean.java,v
retrieving revision 1.5
diff -u -r1.5 ResetUniqueRequestIdBean.java
---
systest/src/com/sun/faces/application/ResetUniqueRequestIdBean.java
 19 Oct 2005 19:51:25 -0000 1.5
+++
systest/src/com/sun/faces/application/ResetUniqueRequestIdBean.java
 15 Dec 2005 19:11:55 -0000
@@ -33,8 +33,7 @@
 
 import com.sun.faces.RIConstants;
 import com.sun.faces.cactus.TestingUtil;
-
-import org.apache.commons.collections.LRUMap;
+import com.sun.faces.util.LRUMap;
 
 public class ResetUniqueRequestIdBean {
 
Index: test/com/sun/faces/application/DeprStateManagerImpl.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/application/DeprStateManagerImpl.java,v
retrieving revision 1.2
diff -u -r1.2 DeprStateManagerImpl.java
--- test/com/sun/faces/application/DeprStateManagerImpl.java 22 Aug
2005 22:11:08 -0000 1.2
+++ test/com/sun/faces/application/DeprStateManagerImpl.java 15 Dec
2005 19:11:56 -0000
@@ -36,7 +36,7 @@
 import com.sun.faces.RIConstants;
 import com.sun.faces.util.TreeStructure;
 import com.sun.faces.util.Util;
-import org.apache.commons.collections.LRUMap;
+import com.sun.faces.util.LRUMap;
 
 import javax.faces.application.StateManager;
 import javax.faces.component.UIComponent;


SECTION: New Files
----------------------------
SEE ATTACHMENTS