You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/03/20 01:02:45 UTC
svn commit: r387078 - in
/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script: ./
common/ common/bundle/
Author: ekoneil
Date: Sun Mar 19 16:02:42 2006
New Revision: 387078
URL: http://svn.apache.org/viewcvs?rev=387078&view=rev
Log:
Javadoc and some code cleanup in preparation for adding an ExpressionEngineContext object that will configure internal features of an expression engine.
BB: self
Test: NetUI tests pass
Modified:
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/Expression.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEngineFactory.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluationException.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluator.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluatorFactory.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionUpdateException.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/IllegalExpressionException.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/RuntimeExpressionException.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/AbstractScriptableMap.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/BundleMap.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderBean.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderStack.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/IDataAccessProvider.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ScriptablePageInput.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/bundle/BundleNodeFactory.java
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/Expression.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/Expression.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/Expression.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/Expression.java Sun Mar 19 16:02:42 2006
@@ -17,16 +17,10 @@
*/
package org.apache.beehive.netui.script;
-// java imports
-
import java.util.List;
-// internal imports
-
-// external imports
-
/**
- * This class implements an abstraction atop an Expression object.
+ * This class implements support for an Expression object.
* It provides access to metadata about the parsed expression
* including the data binding context and tokens that constitute
* the expression.
@@ -35,6 +29,7 @@
/**
* Get the expression's data binding context.
+ * @return the implicit object that this expression references
*/
public abstract String getContext();
@@ -42,6 +37,7 @@
* Get the expression's token list. For an expression that looks like
* "actionForm.customer.name", this will include the tokens "actionForm",
* "customer", and "name".
+ * @return the list of tokens contained in the expression
*/
public abstract List getTokens();
@@ -49,8 +45,10 @@
* Return an expression that is created starting with the
* token at the given index.
*
- * @throws {@link java.lang.IllegalStateException} if the provided start token is out of bounds
- * given the number of tokens in the expression
+ * @param start the token index at which to build the sub-expression
+ * @return a sub-expression starting with the token referenced by <code>start</code>
+ * @throws java.lang.IllegalStateException if the provided start token is out of bounds
+ * given the number of tokens in the expression.
*/
public abstract String getExpression(int start);
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEngineFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEngineFactory.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEngineFactory.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEngineFactory.java Sun Mar 19 16:02:42 2006
@@ -18,7 +18,7 @@
package org.apache.beehive.netui.script;
/**
- *
+ * An abstract factory for returning an {@link ExpressionEvaluator}.
*/
public abstract class ExpressionEngineFactory {
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluationException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluationException.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluationException.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluationException.java Sun Mar 19 16:02:42 2006
@@ -17,22 +17,15 @@
*/
package org.apache.beehive.netui.script;
-// java imports
-
-// internal imports
-
-// external imports
-
/**
- * The most general exception thrown when an error occurs in evaluating
- * an expression.
+ * An exception thrown when errors occur evaluating an expression.
*/
public class ExpressionEvaluationException
extends Exception {
- private String expression = null;
- private String[] contexts = null;
- private String localizedMessage = null;
+ private String _expression = null;
+ private String[] _contexts = null;
+ private String _localizedMessage = null;
/**
* Construct an ExpressionEvaluationException.
@@ -50,7 +43,7 @@
*/
public ExpressionEvaluationException(String message, String expression) {
super(message);
- this.expression = expression;
+ this._expression = expression;
}
/**
@@ -63,7 +56,7 @@
*/
public ExpressionEvaluationException(String message, String expression, Throwable cause) {
super(message, cause);
- this.expression = expression;
+ this._expression = expression;
}
/**
@@ -74,7 +67,7 @@
*/
public ExpressionEvaluationException(String expression, Throwable cause) {
super(cause);
- this.expression = expression;
+ this._expression = expression;
}
/**
@@ -83,7 +76,7 @@
* @return the expression that caused the problem
*/
public String getExpression() {
- return expression;
+ return _expression;
}
/**
@@ -93,7 +86,7 @@
* @param contexts the list of available contexts.
*/
public void setAvailableContexts(String[] contexts) {
- this.contexts = contexts;
+ this._contexts = contexts;
}
/**
@@ -104,14 +97,14 @@
* if the contexts were not set.
*/
public String[] getAvailableContexts() {
- return contexts;
+ return _contexts;
}
public void setLocalizedMessage(String localizedMessage) {
- this.localizedMessage = localizedMessage;
+ this._localizedMessage = localizedMessage;
}
public String getLocalizedMessage() {
- return localizedMessage;
+ return _localizedMessage;
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluator.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluator.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluator.java Sun Mar 19 16:02:42 2006
@@ -20,8 +20,9 @@
import javax.servlet.jsp.el.VariableResolver;
/**
- * An interface for evaluating expressions in NetUI. Different languages may implement
- * this to expose the language for use in the NetUI JSP tags.
+ * Interface for implementing a runtime for evaluating expressions. An ExpressionEvaluator is
+ * used to execute <i>read</i> and <i>update</i> expressions. It also provides a set of methods
+ * for performing utility type operations on expressions.
*/
public interface ExpressionEvaluator {
@@ -50,6 +51,7 @@
* may be contained within an object available in this JavaBean.
* @param requestParameter a boolean that marks this update as occurring from data in the request, if
* <code>true</code> or simply as a regular update.
+ * @throws ExpressionUpdateException when an exception occurs updating a value
*/
public void update(String expression, Object value, VariableResolver variableResolver, boolean requestParameter)
throws ExpressionUpdateException;
@@ -63,20 +65,21 @@
* @param oldContext the old context to replace, if present
* @param newContext the new context to replace if the expression starts with the <code>oldContext</code>
* @param lookupIndex an index used to qualify an expression into an array look-up.
- * @exclude
*/
public String changeContext(String expression, String oldContext, String newContext, int lookupIndex)
throws ExpressionEvaluationException;
/**
* Qualify the expression into the given context. This will take the <code>expression</code>
- * and simply qualify it into the new context <code>contextName</code>.
+ * and simply qualify it into the new context <code>implicitObjectName</code>.
*
- * @param contextName the new context
+ * @param implicitObjectName the new context
* @param expression the expression to qualify
- * @exclude
+ * @return the new expression created by adding the implicit object name <code>implicitObjectName</code>
+ * to the expression string <code>expression</code>
+ * @throws ExpressionEvaluationException if an exception occurs qualifying the expression with the implict object name
*/
- public String qualify(String contextName, String expression)
+ public String qualify(String implicitObjectName, String expression)
throws ExpressionEvaluationException;
/**
@@ -99,11 +102,10 @@
public boolean containsExpression(String expression);
/**
- * Parse an atomic expression into a common parsed expression
- * representation.
+ * Parse an expression into its object representation as a {@link Expression}.
*
* @param expression the String expression to parse
* @return the parsed expression
*/
public Expression parseExpression(String expression);
-}
+}
\ No newline at end of file
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluatorFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluatorFactory.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluatorFactory.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionEvaluatorFactory.java Sun Mar 19 16:02:42 2006
@@ -27,23 +27,26 @@
import org.apache.beehive.netui.util.logging.Logger;
/**
- * Get an expression evaluator.
+ * Factory used to obtain {@link ExpressionEvaluator} instances.
*/
public class ExpressionEvaluatorFactory {
private static final Logger LOGGER = Logger.getInstance(ExpressionEvaluatorFactory.class);
+ /**
+ * {@link Map} that maps String keys naming a type of {@link ExpressionEvaluator} to a
+ * {@link ExpressionEngineFactory} that creates an instance of an {@link ExpressionEvaluator}.
+ */
private static final HashMap FACTORY_MAP = new HashMap();
private static ExpressionEngineFactory DEFAULT_FACTORY;
static {
try {
DEFAULT_FACTORY = initialize(FACTORY_MAP);
- } catch(Exception e) {
+ }
+ catch(Exception e) {
DEFAULT_FACTORY = null;
-
- if(LOGGER.isErrorEnabled())
- LOGGER.error("An exception occurred loading the expression evaluator configuration. Cause: " + e, e);
+ LOGGER.error("An exception occurred loading the expression evaluator configuration. Cause: " + e, e);
}
}
@@ -52,17 +55,18 @@
*
* @return an {@link ExpressionEvaluator}
*/
- public final static ExpressionEvaluator getInstance() {
+ public static ExpressionEvaluator getInstance() {
return getInstance(null);
}
/**
* Get an {@link ExpressionEvaluator} named <code>name</code>.
*
- * @return an ExpressionEvaluator matching the given name.
- * @throws IllegalArgumentException if an ExpressionEvaluator matching the name is not found
+ * @param name the name of the {@link ExpressionEvaluator} to obtain.
+ * @return an {@link ExpressionEvaluator} matching the given name.
+ * @throws IllegalArgumentException if an {@link ExpressionEvaluator} matching the name is not found
*/
- public final static ExpressionEvaluator getInstance(String name) {
+ public static ExpressionEvaluator getInstance(String name) {
assert DEFAULT_FACTORY != null;
assert FACTORY_MAP != null;
@@ -72,13 +76,11 @@
return ((ExpressionEngineFactory)FACTORY_MAP.get(name)).getInstance();
String msg = "An ExpressionEvaluator named \"" + name + "\" is not available.";
- if(LOGGER.isErrorEnabled())
- LOGGER.error(msg);
-
+ LOGGER.error(msg);
throw new IllegalArgumentException(msg);
}
- private static final ExpressionEngineFactory initialize(Map factoryMap) {
+ private static ExpressionEngineFactory initialize(Map factoryMap) {
assert factoryMap != null;
NetUIConfig config = ConfigUtil.getConfig();
@@ -98,18 +100,16 @@
try {
Class type = Class.forName(className);
factory = (ExpressionEngineFactory)type.newInstance();
- } catch(ClassNotFoundException cnf) {
- if(LOGGER.isWarnEnabled())
- LOGGER.warn("Could not create an ExpressionEngineFactory for type \"" + className +
- "\" because the implementation class could not be found.");
-
+ }
+ catch(ClassNotFoundException cnf) {
+ LOGGER.warn("Could not create an ExpressionEngineFactory for type \"" + className +
+ "\" because the implementation class could not be found.");
continue;
- } catch(Exception ex) {
+ }
+ catch(Exception ex) {
assert ex instanceof IllegalAccessException || ex instanceof InstantiationException;
-
- if(LOGGER.isWarnEnabled())
- LOGGER.warn("Could not create an ExpressionEngineFactory for type \"" + className +
- "\" because an error occurred creating the factory. Cause: " + ex, ex);
+ LOGGER.warn("Could not create an ExpressionEngineFactory for type \"" + className +
+ "\" because an error occurred creating the factory. Cause: " + ex, ex);
continue;
}
@@ -126,21 +126,23 @@
ExpressionEngineFactory defaultEngineFactory = null;
String defaultLanguage = elConfig.getDefaultLanguage();
+
if(defaultLanguage != null) {
defaultEngineFactory = (ExpressionEngineFactory)factoryMap.get(defaultLanguage);
if(defaultEngineFactory != null) {
- if(LOGGER.isInfoEnabled())
- LOGGER.info("Using a default expression evaluator of type \"" + factoryMap.get(defaultLanguage).getClass().getName() + "\"");
- } else {
+ LOGGER.info("Using a default expression evaluator of type \"" + factoryMap.get(defaultLanguage).getClass().getName() + "\"");
+ }
+ else {
String msg =
"The default ExpressionEvaluator named \"" + defaultLanguage + "\" was specified, but the ExpressionEngineFactory could not be found.";
- if(LOGGER.isWarnEnabled()) LOGGER.warn(msg);
+ LOGGER.warn(msg);
throw new RuntimeException(msg);
}
- } else {
+ }
+ else {
String msg = "There is no default expression engine specified.";
- if(LOGGER.isErrorEnabled()) LOGGER.error(msg);
+ LOGGER.error(msg);
throw new RuntimeException(msg);
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionUpdateException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionUpdateException.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionUpdateException.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/ExpressionUpdateException.java Sun Mar 19 16:02:42 2006
@@ -17,14 +17,8 @@
*/
package org.apache.beehive.netui.script;
-// java imports
-
-// internal imports
-
-// external imports
-
/**
- * An exception thrown when an error occurs during an expression update.
+ * Exception thrown when an error occurs during an expression update.
*/
public class ExpressionUpdateException
extends ExpressionEvaluationException {
@@ -71,4 +65,4 @@
public Object getUpdateValue() {
return null;
}
-}
+}
\ No newline at end of file
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/IllegalExpressionException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/IllegalExpressionException.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/IllegalExpressionException.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/IllegalExpressionException.java Sun Mar 19 16:02:42 2006
@@ -17,14 +17,8 @@
*/
package org.apache.beehive.netui.script;
-// java imports
-
-// internal imports
-
-// external imports
-
/**
- * An exception thrown when an expression is written in an illegal syntax.
+ * Exception thrown when an expression contains illegal syntax.
*/
public class IllegalExpressionException
extends RuntimeExpressionException {
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/RuntimeExpressionException.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/RuntimeExpressionException.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/RuntimeExpressionException.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/RuntimeExpressionException.java Sun Mar 19 16:02:42 2006
@@ -17,19 +17,13 @@
*/
package org.apache.beehive.netui.script;
-// java imports
-
-// internal imports
-
-// external imports
-
/**
- *
+ * Exception base class for all domain-specific {@link RuntimeException}s thrown by an {@link ExpressionEvaluator}.
*/
public abstract class RuntimeExpressionException
extends RuntimeException {
- private String localizedMessage = null;
+ private String _localizedMessage = null;
public RuntimeExpressionException() {
super();
@@ -48,10 +42,10 @@
}
public void setLocalizedMessage(String localizedMessage) {
- this.localizedMessage = localizedMessage;
+ this._localizedMessage = localizedMessage;
}
public String getLocalizedMessage() {
- return (localizedMessage != null ? localizedMessage : getMessage());
+ return (_localizedMessage != null ? _localizedMessage : getMessage());
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/AbstractScriptableMap.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/AbstractScriptableMap.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/AbstractScriptableMap.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/AbstractScriptableMap.java Sun Mar 19 16:02:42 2006
@@ -113,18 +113,16 @@
return ((_key == null ? 0 : _key.hashCode()) ^ (_value == null ? 0 : _value.hashCode()));
}
- public boolean equals(Object obj) {
- if(obj == null || !(obj instanceof Map.Entry))
- return false;
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- Map.Entry entry = (Map.Entry)obj;
- Object key = entry.getKey();
- Object value = entry.getValue();
- if((key == null || (key != null && key.equals(_key))) &&
- (value == null || (value != null && value.equals(_value))))
- return true;
+ final Entry entry = (Entry) o;
- return false;
+ if (_key != null ? !_key.equals(entry._key) : entry._key != null) return false;
+ if (_value != null ? !_value.equals(entry._value) : entry._value != null) return false;
+
+ return true;
}
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/BundleMap.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/BundleMap.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/BundleMap.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/BundleMap.java Sun Mar 19 16:02:42 2006
@@ -42,8 +42,8 @@
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
/**
- * Provide a {@link java.util.Map} of {@link org.apache.beehive.netui.script.common.BundleMap.BundleNodeMap} objects that can
- * expose various implementations of {@link BundleNode} to
+ * Provide a {@link java.util.Map} of {@link org.apache.beehive.netui.script.common.BundleMap.BundleNodeMap}
+ * objects that can expose various implementations of {@link BundleNode} to
* expression languages. <p/> This {@link java.util.Map} implementation is
* optimized for read as the entrySet() is created lazily. In addition, the
* entrySet does not contain all possible BundleNodeMap objects as named
@@ -60,7 +60,6 @@
private HashMap _registeredBundles = null;
private HttpServletRequest _servletRequest = null;
- private HttpSession _httpSession = null;
private ServletContext _servletContext = null;
/**
@@ -76,7 +75,6 @@
assert servletContext != null;
_servletRequest = servletRequest;
- _httpSession = servletRequest.getSession(false);
_servletContext = servletContext;
_registeredBundles = new HashMap();
@@ -218,7 +216,7 @@
if(value != null)
LOGGER.warn("Can not resolve the default module bundle."
+ " The object resolved from the request is of type "
- +(value != null ? value.getClass().toString() : "null"));
+ + value.getClass().toString());
return null;
}
}
@@ -239,12 +237,12 @@
if(value != null)
LOGGER.warn("Can not resolve module bundle with name \"" + name
+ "\". The object resolved from ServletContext is of type "
- +(value != null ? value.getClass().toString() : "null"));
+ + value.getClass().toString());
return null;
}
}
- private final ModuleConfig lookupCurrentModuleConfig() {
+ private ModuleConfig lookupCurrentModuleConfig() {
return (ModuleConfig)_servletRequest.getAttribute(Globals.MODULE_KEY);
}
@@ -263,7 +261,7 @@
throw new RuntimeException(msg);
}
- private final String formatBundleNames(String[] names) {
+ private String formatBundleNames(String[] names) {
InternalStringBuilder sb = new InternalStringBuilder(128);
sb.append("[");
for(int i = 0; i < names.length; i++) {
@@ -276,7 +274,7 @@
return sb.toString();
}
- private final String[] createBundleList() {
+ private String[] createBundleList() {
String[] names = null;
if(_registeredBundles != null) {
names = new String[_registeredBundles.size()];
@@ -289,7 +287,7 @@
return names;
}
- private final String[] createStrutsBundleList() {
+ private String[] createStrutsBundleList() {
String[] names = null;
ModuleConfig config = lookupCurrentModuleConfig();
if(config != null) {
@@ -312,13 +310,12 @@
*
* @return the {@link java.util.Locale} to use when looking-up strings while data binding to resource bundles
*/
- private final Locale retrieveUserLocale() {
+ private Locale retrieveUserLocale() {
return InternalUtils.lookupLocale(_servletRequest);
}
final class BundleNodeEntry
- extends Entry
- {
+ extends Entry {
BundleNodeEntry(Object key) {
super(key, null);
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderBean.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderBean.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderBean.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderBean.java Sun Mar 19 16:02:42 2006
@@ -24,8 +24,6 @@
*/
public class DataAccessProviderBean {
- private static final Logger _logger = Logger.getInstance(DataAccessProviderBean.class);
-
private IDataAccessProvider _provider = null;
public DataAccessProviderBean(IDataAccessProvider provider) {
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderStack.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderStack.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderStack.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/DataAccessProviderStack.java Sun Mar 19 16:02:42 2006
@@ -22,11 +22,11 @@
public class DataAccessProviderStack {
- private static final String KEY = "org.apache.beehive.netui.script.common.DataAccessProviderStack";
+ private static final String KEY = DataAccessProviderStack.class.getName();
private Stack _stack = null;
- public static final void addDataAccessProvider(IDataAccessProvider provider, JspContext jspContext) {
+ public static void addDataAccessProvider(IDataAccessProvider provider, JspContext jspContext) {
assert jspContext != null;
DataAccessProviderBean bean = new DataAccessProviderBean(provider);
@@ -37,17 +37,15 @@
curStack = new DataAccessProviderStack();
jspContext.setAttribute(KEY, curStack);
- } else
- curStack = (DataAccessProviderStack)val;
+ }
+ else curStack = (DataAccessProviderStack)val;
curStack.push(bean);
jspContext.setAttribute("container", bean);
-
- return;
}
- public static final DataAccessProviderBean removeDataAccessProvider(JspContext jspContext) {
+ public static DataAccessProviderBean removeDataAccessProvider(JspContext jspContext) {
assert jspContext != null;
Object val = jspContext.getAttribute(KEY);
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/IDataAccessProvider.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/IDataAccessProvider.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/IDataAccessProvider.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/IDataAccessProvider.java Sun Mar 19 16:02:42 2006
@@ -17,12 +17,6 @@
*/
package org.apache.beehive.netui.script.common;
-// java imports
-
-// internal imports
-
-// external imports
-
/**
* The IDataAccessProvider interface is implemented by objects
* that need to provide their children with data and wish
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java Sun Mar 19 16:02:42 2006
@@ -34,8 +34,6 @@
import org.apache.beehive.netui.pageflow.PageFlowUtils;
import org.apache.beehive.netui.pageflow.internal.AnyBeanActionForm;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.FacesBackingBeanFactory;
-import org.apache.beehive.netui.pageflow.RequestContext;
import org.apache.beehive.netui.script.el.NetUIUpdateVariableResolver;
import org.apache.beehive.netui.util.logging.Logger;
@@ -58,15 +56,15 @@
/* do not construct */
private ImplicitObjectUtil() {}
- public static final void loadActionForm(JspContext jspContext, Object form) {
+ public static void loadActionForm(JspContext jspContext, Object form) {
jspContext.setAttribute(ACTION_FORM_IMPLICIT_OBJECT_KEY, unwrapForm(form));
}
- public static final void unloadActionForm(JspContext jspContext) {
+ public static void unloadActionForm(JspContext jspContext) {
jspContext.removeAttribute(ACTION_FORM_IMPLICIT_OBJECT_KEY);
}
- public static final void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
+ public static void loadPageFlow(ServletRequest request, PageFlowController pageFlow) {
if(pageFlow != null)
request.setAttribute(PAGE_FLOW_IMPLICIT_OBJECT_KEY, pageFlow);
@@ -74,40 +72,39 @@
request.setAttribute(PAGE_INPUT_IMPLICIT_OBJECT_KEY, map != null ? map : Collections.EMPTY_MAP);
}
- public static final void loadFacesBackingBean(ServletRequest request, FacesBackingBean fbb) {
+ public static void loadFacesBackingBean(ServletRequest request, FacesBackingBean fbb) {
if(fbb != null)
request.setAttribute(BACKING_IMPLICIT_OBJECT_KEY, fbb);
}
- public static final void unloadFacesBackingBean(ServletRequest request) {
+ public static void unloadFacesBackingBean(ServletRequest request) {
request.removeAttribute(BACKING_IMPLICIT_OBJECT_KEY);
}
- public static final void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
+ public static void loadSharedFlow(ServletRequest request, Map/*<String, SharedFlowController>*/ sharedFlows) {
if(sharedFlows != null)
request.setAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY, sharedFlows);
}
- public static final void loadGlobalApp(ServletRequest request, GlobalApp globalApp) {
+ public static void loadGlobalApp(ServletRequest request, GlobalApp globalApp) {
if(globalApp != null)
request.setAttribute(GLOBAL_APP_IMPLICIT_OBJECT_KEY, globalApp);
}
- public static final void loadBundleMap(ServletRequest servletRequest, BundleMap bundleMap) {
+ public static void loadBundleMap(ServletRequest servletRequest, BundleMap bundleMap) {
servletRequest.setAttribute(BUNDLE_IMPLICIT_OBJECT_KEY, bundleMap);
}
- public static final Object unwrapForm(Object form) {
+ public static Object unwrapForm(Object form) {
if(LOGGER.isDebugEnabled() && form instanceof AnyBeanActionForm)
- LOGGER.debug("using form of type: " + ((AnyBeanActionForm)form != null ? ((AnyBeanActionForm)form).getClass().getName() : "null"));
+ LOGGER.debug("using form of type: " + form.getClass().getName());
if(form instanceof AnyBeanActionForm)
return ((AnyBeanActionForm)form).getBean();
- else
- return form;
+ else return form;
}
- public static final Map/*<String, SharedFlowController>*/ getSharedFlow(ServletRequest request) {
+ public static Map/*<String, SharedFlowController>*/ getSharedFlow(ServletRequest request) {
return (Map/*<String, SharedFlowController>*/)request.getAttribute(SHARED_FLOW_IMPLICIT_OBJECT_KEY);
}
@@ -125,13 +122,10 @@
}
}
- public static final GlobalApp getGlobalApp(ServletRequest request, ServletResponse response) {
+ public static GlobalApp getGlobalApp(ServletRequest request, ServletResponse response) {
assert request instanceof HttpServletRequest;
-
GlobalApp ga = PageFlowUtils.getGlobalApp((HttpServletRequest)request);
-
if(ga == null) {
- // @todo: i18n
RuntimeException re = new RuntimeException("Can not create the globalApp binding context; the GlobalApp object is null.");
if(LOGGER.isErrorEnabled()) LOGGER.error("", re);
throw re;
@@ -143,27 +137,26 @@
/**
*
*/
- public static final VariableResolver getUpdateVariableResolver(ServletRequest request, ServletResponse response, boolean isHandlingPost) {
+ public static VariableResolver getUpdateVariableResolver(ServletRequest request, ServletResponse response, boolean isHandlingPost) {
Object form = ImplicitObjectUtil.unwrapForm(request.getAttribute(org.apache.struts.taglib.html.Constants.BEAN_KEY));
/* todo: need to provide get(Read|Update)VariableResolver methods on the ExpressionEngineFactory */
return new NetUIUpdateVariableResolver(form, request, response, isHandlingPost);
}
- public static final VariableResolver getUpdateVariableResolver(Object form, ServletRequest request, ServletResponse response, boolean isHandlingPost) {
+ public static VariableResolver getUpdateVariableResolver(Object form, ServletRequest request, ServletResponse response, boolean isHandlingPost) {
Object realForm = ImplicitObjectUtil.unwrapForm(form);
/* todo: need to provide get(Read|Update)VariableResolver methods on the ExpressionEngineFactory */
return new NetUIUpdateVariableResolver(realForm, request, response, isHandlingPost);
}
- public static final VariableResolver getReadVariableResolver(PageContext pageContext) {
+ public static VariableResolver getReadVariableResolver(PageContext pageContext) {
assert pageContext != null;
return pageContext.getVariableResolver();
}
- public static final void loadImplicitObjects(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, PageFlowController curJpf) {
- // @todo: need to wrap this in checks for JSP 1.2
+ public static void loadImplicitObjects(HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, PageFlowController curJpf) {
// @todo: feature: need to add support for chaining in user-code to run when setting implicit objects on the request
loadPageFlow(request, curJpf);
@@ -172,7 +165,7 @@
loadBundleMap(request, bundleMap);
}
- public static final void loadOutputFormBean(ServletRequest request, Object bean) {
+ public static void loadOutputFormBean(ServletRequest request, Object bean) {
if(bean != null)
request.setAttribute(OUTPUT_FORM_BEAN_OBJECT_KEY, bean);
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ScriptablePageInput.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ScriptablePageInput.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ScriptablePageInput.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/ScriptablePageInput.java Sun Mar 19 16:02:42 2006
@@ -17,35 +17,33 @@
*/
package org.apache.beehive.netui.script.common;
-// java imports
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
-// internal imports
import org.apache.beehive.netui.pageflow.PageFlowUtils;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
import org.apache.beehive.netui.util.logging.Logger;
-// external imports
-
/**
+ * <p>
* Provide a {@link java.util.Map} object that exposes a set of page inputs to
* expression language clients. Access to these page inputs is based on the
* name of the page input.
- * <p/>
+ * </p>
+ * <p>
* Access is optimized for read in that the "get" method is fast. The entrySet()
* method is only used if needed, which is generally to toString the Map.
+ * </p>
+ * @deprecated
*/
public class ScriptablePageInput
extends AbstractScriptableMap {
- private static final Logger _logger = Logger.getInstance(ScriptablePageInput.class);
+ private static final Logger LOGGER = Logger.getInstance(ScriptablePageInput.class);
private HttpServletRequest _request = null;
private Set _entrySet = null;
@@ -57,7 +55,7 @@
}
public Object get(Object name) {
- if(_logger.isDebugEnabled()) _logger.debug("page input get: " + name);
+ if(LOGGER.isDebugEnabled()) LOGGER.debug("page input get: " + name);
assert name instanceof String;
@@ -99,6 +97,6 @@
public boolean containsKey(Object key) {
Map piMap = InternalUtils.getPageInputMap(_request);
- return (piMap != null ? piMap.containsKey(key) : false);
+ return (piMap != null && piMap.containsKey(key));
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/bundle/BundleNodeFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/bundle/BundleNodeFactory.java?rev=387078&r1=387077&r2=387078&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/bundle/BundleNodeFactory.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/script/common/bundle/BundleNodeFactory.java Sun Mar 19 16:02:42 2006
@@ -29,7 +29,7 @@
private static final BundleNodeFactory FACTORY = new BundleNodeFactory();
- public static final BundleNodeFactory getInstance() {
+ public static BundleNodeFactory getInstance() {
return FACTORY;
}