You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by cr...@apache.org on 2006/07/05 20:01:11 UTC

svn commit: r419299 [3/3] - in /struts/shale/trunk: shale-remoting/src/main/java/org/apache/shale/remoting/ shale-remoting/src/main/java/org/apache/shale/remoting/faces/ shale-remoting/src/main/java/org/apache/shale/remoting/impl/ shale-spring/src/main...

Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockSessionMap.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockSessionMap.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockSessionMap.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockSessionMap.java Wed Jul  5 11:01:09 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,6 +41,13 @@
     // ------------------------------------------------------------ Constructors
 
 
+    /**
+     * <p>Construct an instance exposing the attributes of the specified
+     * session.</p>
+     *
+     * @param session Session whose attributes are to be exposed
+     *  as a Map
+     */
     public MockSessionMap(HttpSession session) {
 
         this.session = session;
@@ -54,12 +61,16 @@
     // ------------------------------------------------------ Instance Variables
 
 
+    /**
+     * <p>The session whose attributes we are exposing as a Map.</p>
+     */
     private HttpSession session = null;
- 
+
 
     // ------------------------------------------------------------- Map Methods
 
 
+    /** {@inheritDoc} */
     public void clear() {
 
         Iterator keys = keySet().iterator();
@@ -70,6 +81,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public boolean containsKey(Object key) {
 
         return session.getAttribute(key(key)) != null;
@@ -77,6 +89,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public boolean containsValue(Object value) {
 
         if (value == null) {
@@ -94,6 +107,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Set entrySet() {
 
         Set set = new HashSet();
@@ -106,6 +120,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public boolean equals(Object o) {
 
         return session.equals(o);
@@ -113,6 +128,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Object get(Object key) {
 
         return session.getAttribute(key(key));
@@ -120,6 +136,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public int hashCode() {
 
         return session.hashCode();
@@ -127,6 +144,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public boolean isEmpty() {
 
         return size() < 1;
@@ -134,6 +152,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Set keySet() {
 
         Set set = new HashSet();
@@ -146,6 +165,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Object put(Object key, Object value) {
 
         if (value == null) {
@@ -159,6 +179,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void putAll(Map map) {
 
         Iterator keys = map.keySet().iterator();
@@ -170,6 +191,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Object remove(Object key) {
 
         String skey = key(key);
@@ -180,6 +202,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public int size() {
 
         int n = 0;
@@ -193,6 +216,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Collection values() {
 
         List list = new ArrayList();
@@ -208,6 +232,11 @@
     // --------------------------------------------------------- Private Methods
 
 
+    /**
+     * <p>Return the specified key, after converting it to a String.</p>
+     *
+     * @param key Key to be converted
+     */
     private String key(Object key) {
 
         if (key == null) {

Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockStateManager.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockStateManager.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockStateManager.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockStateManager.java Wed Jul  5 11:01:09 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@
  * $Id$
  */
 public class MockStateManager extends StateManager {
-    
+
 
     // ------------------------------------------------------------ Constructors
 
@@ -49,6 +49,7 @@
     // ---------------------------------------------------- StateManager Methods
 
 
+    /** {@inheritDoc} */
     public SerializedView saveSerializedView(FacesContext context) {
 
         throw new UnsupportedOperationException();
@@ -56,6 +57,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Object getTreeStructureToSave(FacesContext context) {
 
         throw new UnsupportedOperationException();
@@ -63,6 +65,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Object getComponentStateToSave(FacesContext context) {
 
         throw new UnsupportedOperationException();
@@ -70,6 +73,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void writeState(FacesContext context, SerializedView view)
       throws IOException {
 
@@ -78,6 +82,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public UIViewRoot restoreView(FacesContext context, String viewId,
                                   String renderKitId) {
 
@@ -86,6 +91,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public UIViewRoot restoreTreeStructure(FacesContext context, String viewId,
                                            String renderKitId) {
 
@@ -94,6 +100,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void restoreComponentState(FacesContext context, UIViewRoot view,
                                       String renderKitId) {
 

Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockValueBinding.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockValueBinding.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockValueBinding.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockValueBinding.java Wed Jul  5 11:01:09 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,21 +42,30 @@
     // ------------------------------------------------------------ Constructors
 
 
+    /**
+     * <p>Construct a default instance.</p>
+     */
     public MockValueBinding() {
 
-	this(null, null);
+        this(null, null);
 
     }
 
 
+    /**
+     * <p>Construct a new value binding for the specified expression.</p>
+     *
+     * @param application Application instance to be wrapped
+     * @param ref Expression to be wrapped
+     */
     public MockValueBinding(Application application, String ref) {
 
         this.application = application;
-	if (ref != null) {
-	    if (ref.startsWith("#{") && ref.endsWith("}")) {
-		ref = ref.substring(2, ref.length() - 1);
-	    }
-	}
+        if (ref != null) {
+            if (ref.startsWith("#{") && ref.endsWith("}")) {
+                ref = ref.substring(2, ref.length() - 1);
+            }
+        }
         this.ref = ref;
 
     }
@@ -65,7 +74,10 @@
     // ----------------------------------------------------- Mock Object Methods
 
 
-    public String ref(){
+    /**
+     * <p>Return the expression string for this value binding.</p>
+     */
+    public String ref() {
 
         return this.ref;
 
@@ -75,13 +87,22 @@
     // ------------------------------------------------------ Instance Variables
 
 
+    /**
+     * <p>The <code>Application</code> instance for this application.</p>
+     */
     private transient Application application; // Restored as necessary
+
+
+    /**
+     * <p>The expression this value binding will evaluate.</p>
+     */
     private String ref;
 
 
     // ---------------------------------------------------- ValueBinding Methods
 
 
+    /** {@inheritDoc} */
     public Object getValue(FacesContext context)
         throws EvaluationException, PropertyNotFoundException {
 
@@ -110,6 +131,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void setValue(FacesContext context, Object value)
         throws EvaluationException, PropertyNotFoundException {
 
@@ -123,11 +145,11 @@
         String name = (String) names.get(0);
         Object base = vr.resolveVariable(context, name);
         if (names.size() < 2) {
-            if ("applicationScope".equals(name) ||
-                "requestScope".equals(name) ||
-                "sessionScope".equals(name)) {
-                throw new ReferenceSyntaxException("Cannot set '" +
-                                                   name + "'");
+            if ("applicationScope".equals(name)
+                || "requestScope".equals(name)
+                || "sessionScope".equals(name)) {
+                throw new ReferenceSyntaxException("Cannot set '"
+                                                   + name + "'");
             }
             Map map = econtext().getRequestMap();
             if (map.containsKey(name)) {
@@ -161,6 +183,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public boolean isReadOnly(FacesContext context)
         throws PropertyNotFoundException {
 
@@ -189,6 +212,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public Class getType(FacesContext context)
         throws PropertyNotFoundException {
 
@@ -216,34 +240,43 @@
 
     }
 
+    /** {@inheritDoc} */
     public String getExpressionString() {
-	return "#{" + ref + "}";
+
+        return "#{" + ref + "}";
+
     }
 
 
     // ----------------------------------------------------- StateHolder Methods
 
 
+    /** {@inheritDoc} */
     public Object saveState(FacesContext context) {
 
-        Object values[] = new Object[1];
-	values[0] = ref;
-	return values;
+        Object[] values = new Object[1];
+        values[0] = ref;
+        return values;
 
     }
 
 
+    /** {@inheritDoc} */
     public void restoreState(FacesContext context, Object state) {
 
-        Object values[] = (Object[]) state;
+        Object[] values = (Object[]) state;
         ref = (String) values[0];
 
     }
 
 
+    /**
+     * <p>Flag indicating that this value is transient.</p>
+     */
     private boolean transientFlag = false;
 
 
+    /** {@inheritDoc} */
     public boolean isTransient() {
 
         return this.transientFlag;
@@ -251,6 +284,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void setTransient(boolean transientFlag) {
 
         this.transientFlag = transientFlag;
@@ -261,16 +295,22 @@
     // --------------------------------------------------------- Private Methods
 
 
+    /**
+     * <p>Return the relevant <code>Application</code> instance.</p>
+     */
     private Application application() {
 
-	if (application == null) {
-	    application = FacesContext.getCurrentInstance().getApplication();
-	}
-	return (application);
+        if (application == null) {
+            application = FacesContext.getCurrentInstance().getApplication();
+        }
+        return (application);
 
     }
 
 
+    /**
+     * <p>Return the relevant <code>ExternalContext</code> instance.</p>
+     */
     private ExternalContext econtext() {
 
         return (FacesContext.getCurrentInstance().getExternalContext());
@@ -278,6 +318,11 @@
     }
 
 
+    /**
+     * <p>Return a list of the expression elements in this expression.</p>
+     *
+     * @param ref Expression to be parsed
+     */
     private List parse(String ref) {
 
         String expr = ref;
@@ -293,14 +338,14 @@
             }
         }
         if (names.size() < 1) {
-            throw new ReferenceSyntaxException("No expression in '" +
-                                               ref + "'");
+            throw new ReferenceSyntaxException("No expression in '"
+                                               + ref + "'");
         }
         for (int i = 0; i < names.size(); i++) {
             String name = (String) names.get(i);
             if (name.length() < 1) {
-                throw new ReferenceSyntaxException("Invalid expression '" +
-                                                   ref + "'");
+                throw new ReferenceSyntaxException("Invalid expression '"
+                                                   + ref + "'");
             }
         }
         return (names);

Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockVariableResolver.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockVariableResolver.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockVariableResolver.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockVariableResolver.java Wed Jul  5 11:01:09 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,6 +56,7 @@
     // ------------------------------------------------ VariableResolver Methods
 
 
+    /** {@inheritDoc} */
     public Object resolveVariable(FacesContext context, String name) {
 
         if ((context == null) || (name == null)) {
@@ -100,6 +101,9 @@
     // --------------------------------------------------------- Private Methods
 
 
+    /**
+     * <p>Return the <code>ExternalContext</code> for this request.</p>
+     */
     private ExternalContext external() {
 
         return FacesContext.getCurrentInstance().getExternalContext();

Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockViewHandler.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockViewHandler.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockViewHandler.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockViewHandler.java Wed Jul  5 11:01:09 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,6 +51,7 @@
     // ----------------------------------------------------- ViewHandler Methods
 
 
+    /** {@inheritDoc} */
     public Locale calculateLocale(FacesContext context) {
 
         Locale locale = context.getApplication().getDefaultLocale();
@@ -62,6 +63,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public String calculateRenderKitId(FacesContext context) {
 
         String renderKitId = context.getApplication().getDefaultRenderKitId();
@@ -73,6 +75,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public UIViewRoot createView(FacesContext context, String viewId) {
 
         // Save locale and renderKitId from previous view (if any), per spec
@@ -105,6 +108,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public String getActionURL(FacesContext context, String viewId) {
 
         return FacesContext.getCurrentInstance().getExternalContext().
@@ -113,6 +117,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public String getResourceURL(FacesContext context, String path) {
 
         return FacesContext.getCurrentInstance().getExternalContext().
@@ -121,6 +126,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void renderView(FacesContext context, UIViewRoot view) {
 
         throw new UnsupportedOperationException();
@@ -128,6 +134,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public UIViewRoot restoreView(FacesContext context, String viewId) {
 
         throw new UnsupportedOperationException();
@@ -135,6 +142,7 @@
     }
 
 
+    /** {@inheritDoc} */
     public void writeState(FacesContext context) {
 
         throw new UnsupportedOperationException();