You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/04/12 08:43:37 UTC
svn commit: r161025 [6/13] - in incubator/beehive/trunk: ./
external/beehive-antext/ netui/ant/ netui/external/xdoclet/
netui/src/bootstrap/ netui/src/compiler-core/
netui/src/compiler-core/org/apache/beehive/netui/compiler/
netui/src/compiler-core/org/apache/beehive/netui/compiler/genmodel/
netui/src/compiler-core/org/apache/beehive/netui/compiler/grammar/
netui/src/compiler-core/org/apache/beehive/netui/compiler/model/
netui/src/compiler-core/org/apache/beehive/netui/compiler/model/validation/
netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/
netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/declaration/
netui/src/compiler-core/org/apache/beehive/netui/compiler/typesystem/type/
netui/src/compiler-core/schema/processed-annotations/
netui/src/compiler-xdoclet/
netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/tools/
netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/
netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/declaration/
netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/env/
netui/src/compiler-xdoclet/org/apache/beehive/netui/compiler/xdoclet/typesystem/impl/type/
netui/src/compiler-xdoclet/org/apache/beehive/netui/tasks/
netui/src/compiler-xdoclet/org/apache/beehive/netui/xdoclet/
netui/src/compiler/ netui/src/compiler/org/apache/beehive/netui/compiler/apt/
netui/src/compiler/org/apache/beehive/netui/compiler/typesystem/impl/
netui/src/compiler/org/apache/beehive/netui/compiler/typesystem/impl/declaration/
netui/src/compiler/org/apache/beehive/netui/compiler/typesystem/impl/type/
netui/src/pageflow-jdk14/ netui/src/pageflow-jdk14/org/
netui/src/pageflow-jdk14/org/apache/
netui/src/pageflow-jdk14/org/apache/beehive/
netui/src/pageflow-jdk14/org/apache/beehive/netui/
netui/src/pageflow-jdk14/org/apache/beehive/netui/pageflow/
netui/src/pageflow-jdk14/org/apache/beehive/netui/pageflow/internal/
netui/src/pageflow/ netui/src/pageflow/org/apache/beehive/netui/pageflow/
netui/src/pageflow/org/apache/beehive/netui/pageflow/config/
netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/
netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/
netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/
netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/
netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/internal/
netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/
netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/
netui/src/pageflow/org/apache/beehive/netui/pageflow/requeststate/
netui/src/pageflow/org/apache/beehive/netui/pageflow/util/
netui/src/pageflow/org/apache/beehive/netui/pageflow/xmlhttprequest/
netui/src/pageflow/org/apache/beehive/netui/script/common/
netui/src/pageflow/org/apache/beehive/netui/script/el/
netui/src/pageflow/org/apache/beehive/netui/script/el/util/
netui/src/scoping/ netui/src/tags-databinding/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/filter/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/pager/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/sort/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/config/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/rendering/cell/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/rendering/pager/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/sql/
netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/base/style/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/cellrepeater/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/invoke/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/pageinput/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/repeater/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/repeater/pad/
netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/xml/
netui/src/tags-html/ netui/src/tags-html/org/apache/beehive/netui/tags/
netui/src/tags-html/org/apache/beehive/netui/tags/html/
netui/src/tags-html/org/apache/beehive/netui/tags/internal/
netui/src/tags-html/org/apache/beehive/netui/tags/javascript/
netui/src/tags-html/org/apache/beehive/netui/tags/rendering/
netui/src/tags-html/org/apache/beehive/netui/tags/tree/
netui/src/tags-template/
netui/src/tags-template/org/apache/beehive/netui/tags/template/
netui/src/testRecorder/
netui/src/tomcat-webapp/5x/org/apache/beehive/netui/tomcat/ netui/src/util/
netui/src/util/org/apache/beehive/netui/core/urls/
netui/src/util/org/apache/beehive/netui/core/urltemplates/
netui/src/util/org/apache/beehive/netui/util/
netui/src/util/org/apache/beehive/netui/util/cache/
netui/src/util/org/apache/beehive/netui/util/classloader/
netui/src/util/org/apache/beehive/netui/util/config/
netui/src/util/org/apache/beehive/netui/util/internal/
netui/src/util/org/apache/beehive/netui/util/internal/concurrent/
netui/src/util/org/apache/beehive/netui/util/type/ netui/test/src/junitTests/
netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/
netui/test/src/junitTests/org/apache/beehive/netui/test/core/urltemplates/
netui/test/src/junitTests/org/apache/beehive/netui/test/datagrid/
netui/test/src/junitTests/org/apache/beehive/netui/test/servlet/
netui/test/src/junitTests/org/apache/beehive/netui/test/util/iterator/
netui/test/src/testRecorderQA/ netui/test/webapps/drt/
netui/test/webapps/drt/coreWeb/WEB-INF/src/miniTests/actionInterceptors/
netui/test/webapps/drt/coreWeb/miniTests/actionInterceptors/interruptChain/
netui/test/webapps/drt/coreWeb/miniTests/exceptionMessages/
netui/test/webapps/drt/coreWeb/miniTests/handlePageException/
netui/test/webapps/drt/coreWeb/miniTests/handlers/
netui/test/webapps/drt/coreWeb/miniTests/pageFlowUtils/
netui/test/webapps/drt/coreWeb/miniTests/preventDoubleSubmit/
netui/test/webapps/drt/coreWeb/miniTests/tiles/
netui/test/webapps/drt/coreWeb/miniTests/updateFormFromNested/
netui/test/webapps/drt/coreWeb/pageFlowCore/inheritance/super1/
netui/test/webapps/drt/coreWeb/pageFlowCore/pfPageInput/
netui/test/webapps/drt/coreWeb/tags/encoding/
netui/test/webapps/drt/coreWeb/template/xhtml/
netui/test/webapps/drt/coreWeb/tiles/pf/
netui/test/webapps/drt/coreWeb/tiles/pf/nested/
netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/
netui/test/webapps/drt/coreWeb/validation/argExpressions/
netui/test/webapps/drt/coreWeb/validation/custom/
netui/test/webapps/drt/coreWeb/validation/declarativeValidation/
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java Mon Apr 11 23:42:11 2005
@@ -19,9 +19,6 @@
import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
import org.apache.beehive.netui.util.logging.Logger;
-import org.apache.beehive.controls.api.context.ControlBeanContext;
-import org.apache.beehive.controls.api.properties.PropertyMap;
-import org.apache.beehive.controls.api.bean.ControlBean;
import javax.servlet.http.HttpSessionBindingListener;
import javax.servlet.http.HttpServletRequest;
@@ -30,10 +27,7 @@
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.ServletContext;
import java.io.Serializable;
-import java.util.Map;
-import java.util.Iterator;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
public abstract class PageFlowManagedObject
implements Serializable, HttpSessionBindingListener
@@ -63,14 +57,14 @@
throws Exception
{
reinitialize( request, response, servletContext );
- initJavaControls( request, response );
+ JavaControlUtils.initJavaControls( request, response, servletContext, this );
onCreate();
}
void destroy( HttpSession session )
{
onDestroy( session );
- uninitJavaControls();
+ JavaControlUtils.uninitJavaControls( session.getServletContext(), this );
}
/**
@@ -127,101 +121,6 @@
*/
public abstract void ensureFailover( HttpServletRequest request );
- /**
- * Initialize all null member variables that are Java Controls.
- *
- * @param request the current HttpServletRequest.
- */
- private void initJavaControls( HttpServletRequest request, HttpServletResponse response )
- throws ControlFieldInitializationException
- {
- Map controlFields = JavaControlUtils.getAccessibleControlFieldAnnotations( getClass() );
- if ( controlFields.isEmpty() ) return;
-
- request = PageFlowUtils.unwrapMultipart( request );
- ControlBeanContext beanContext =
- JavaControlUtils.getControlBeanContext( request, response, _servletContext, false );
- assert beanContext != null : "ControlBeanContext was not initialized by PageFlowRequestProcessor";
- String classID = getClass().getName();
-
- for ( Iterator i = controlFields.entrySet().iterator(); i.hasNext(); )
- {
- Map.Entry entry = ( Map.Entry ) i.next();
- Field field = ( Field ) entry.getKey();
-
- //
- // We don't want the field to be transient -- the reference should not go away when this
- // object is serialized/deserialized. The checker should enforce this.
- //
- assert ! Modifier.isTransient( field.getModifiers() ) : field.getName();
-
- try
- {
- if ( field.get( this ) == null ) // make sure it's not already initialized
- {
- if ( _log.isTraceEnabled() )
- {
- _log.trace( "Initializing field " + field.getName() + " (" + field.getType().getName()
- + ") with a Java Control..." );
- }
-
- PropertyMap propertyMap = ( PropertyMap ) entry.getValue();
- Class fieldType = field.getType();
- String controlID = getControlID( field, classID );
- boolean isControlBeanClass = ! fieldType.isInterface();
- ControlBean bean = JavaControlUtils.createControl( fieldType.getName(), isControlBeanClass,
- controlID, propertyMap, beanContext );
- field.set( this, bean );
- }
- }
- catch ( Exception e )
- {
- _log.error( "Exception occurred while initializing control field " + field.getName(), e );
- throw new ControlFieldInitializationException( field.getName(), this, e );
- }
- }
- }
-
- /**
- * Create a unique ID for a given Java Control field.
- */
- private String getControlID( Field controlField, String classID )
- {
- StringBuilder controlID = new StringBuilder();
- controlID.append( classID ); // classname
- controlID.append( '@' ).append( hashCode() ); // instance ID
- controlID.append( '.' ).append( controlField.getName() ); // name of the control field
- return controlID.toString();
- }
-
- /**
- * Clean up all member variables that are Java Controls.
- */
- private void uninitJavaControls()
- {
- Map controlFields = JavaControlUtils.getAccessibleControlFieldAnnotations( getClass() );
-
- for ( Iterator i = controlFields.keySet().iterator(); i.hasNext(); )
- {
- Field controlField = ( Field ) i.next();
-
- try
- {
- Object fieldValue = controlField.get( this );
-
- if ( fieldValue != null )
- {
- controlField.set( this, null );
- JavaControlUtils.destroyControl( fieldValue );
- }
- }
- catch ( IllegalAccessException e )
- {
- _log.error( "Exception while uninitializing Java Control " + controlField.getName(), e );
- }
- }
- }
-
protected ServletContext getServletContext()
{
return _servletContext;
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java Mon Apr 11 23:42:11 2005
@@ -123,7 +123,7 @@
public String getMessage()
{
- StringBuilder buf = new StringBuilder();
+ StringBuffer buf = new StringBuffer();
String[] parts = getMessageParts();
Object[] args = getMessageArgs();
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java Mon Apr 11 23:42:11 2005
@@ -174,7 +174,7 @@
// Initialize shared flows for the current request.
//
RequestContext requestContext = new RequestContext( request, response );
- Map< String, SharedFlowController > sharedFlows =
+ Map/*< String, SharedFlowController >*/ sharedFlows =
_flowControllerFactory.getSharedFlowsForRequest( requestContext );
ImplicitObjectUtil.loadSharedFlow( request, sharedFlows );
ImplicitObjectUtil.loadGlobalApp( request, PageFlowUtils.getGlobalApp( httpRequest ) );
@@ -320,7 +320,7 @@
//
if ( request instanceof PageFlowRequestWrapper )
{
- request = ( ( PageFlowRequestWrapper ) request ).getRequest();
+ request = ( ( PageFlowRequestWrapper ) request ).getHttpRequest();
}
chain.doFilter( request, response );
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Mon Apr 11 23:42:11 2005
@@ -26,7 +26,6 @@
import org.apache.beehive.netui.pageflow.handler.Handlers;
import org.apache.beehive.netui.pageflow.handler.LoginHandler;
import org.apache.beehive.netui.pageflow.handler.ReloadableClassHandler;
-import org.apache.beehive.netui.pageflow.interceptor.Interceptor;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
import org.apache.beehive.netui.pageflow.interceptor.Interceptors;
import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptorContext;
@@ -40,6 +39,7 @@
import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
import org.apache.beehive.netui.pageflow.internal.LegacySettings;
import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
@@ -95,10 +95,8 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
-import static org.apache.beehive.netui.pageflow.internal.InternalConstants.*;
-import static org.apache.beehive.netui.pageflow.PageFlowConstants.*;
/**
* The Page Flow extension of the Struts RequestProcessor, which contains callbacks that are invoked
@@ -107,7 +105,7 @@
*/
public class PageFlowRequestProcessor
extends TilesRequestProcessor
- implements Serializable
+ implements Serializable, InternalConstants, PageFlowConstants
{
private static int requestCount = 0;
@@ -117,17 +115,17 @@
private static final int ACTION_OVERRIDE_PARAM_PREFIX_LEN = ACTION_OVERRIDE_PARAM_PREFIX.length();
private static final String SCHEME_UNSECURE = "http";
private static final String SCHEME_SECURE = "https";
- private static final String REDIRECT_REQUEST_ATTRS_PREFIX = ATTR_PREFIX + "requestAttrs:";
+ private static final String REDIRECT_REQUEST_ATTRS_PREFIX = InternalConstants.ATTR_PREFIX + "requestAttrs:";
private static final String REDIRECT_REQUEST_ATTRS_PARAM = "forceRedirect";
private static final String FLOW_CONTROLLER_ACTION_CLASSNAME = FlowControllerAction.class.getName();
- private Map< String, Class > _formBeanClasses = new HashMap< String, Class >();
- private Map< String, List< ActionMapping > > _overloadedActions = new HashMap< String, List< ActionMapping > >();
+ private Map/*< String, Class >*/ _formBeanClasses = new HashMap/*< String, Class >*/();
+ private Map/*< String, List< ActionMapping > >*/ _overloadedActions = new HashMap/*< String, List< ActionMapping > >*/();
private ServletContainerAdapter _servletContainerAdapter;
private Handlers _handlers;
private FlowControllerFactory _flowControllerFactory;
private LegacySettings _legacySettings;
- private ConcurrentHashMap< String, Class > _pageServletClasses = new ConcurrentHashMap< String, Class >();
+ private InternalConcurrentHashMap/*< String, Class >*/ _pageServletClasses = new InternalConcurrentHashMap/*< String, Class >*/();
private PageFlowPageFilter _pageServletFilter;
@@ -547,7 +545,7 @@
try
{
RequestContext requestContext = new RequestContext( request, response );
- Map< String, SharedFlowController > sharedFlows =
+ Map/*< String, SharedFlowController >*/ sharedFlows =
_flowControllerFactory.getSharedFlowsForRequest( requestContext );
ImplicitObjectUtil.loadSharedFlow( request, sharedFlows );
ImplicitObjectUtil.loadGlobalApp( request, PageFlowUtils.getGlobalApp( request ) );
@@ -692,7 +690,7 @@
//
// Forward requests for *.jpf to the "begin" action within the appropriate Struts module.
//
- if ( FileUtils.osSensitiveEndsWith( uri, PageFlowConstants.JPF_EXTENSION ) )
+ if ( FileUtils.osSensitiveEndsWith( uri, PageFlowConstants.PAGEFLOW_EXTENSION ) )
{
//
// Make sure the current module config matches the request URI. If not, this could be an
@@ -703,7 +701,7 @@
{
if ( _log.isErrorEnabled() )
{
- StringBuilder msg = new StringBuilder( "No module configuration registered for " );
+ StringBuffer msg = new StringBuffer( "No module configuration registered for " );
msg.append( uri ).append( " (module path " ).append( modulePath ).append( ")." );
_log.error( msg.toString() );
}
@@ -711,7 +709,7 @@
if ( modulePath.length() == 0 ) modulePath = "/";
InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null,
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response,
- getServletContext(), uri, modulePath );
+ getServletContext(), new Object[]{ uri, modulePath } );
return true;
}
@@ -736,14 +734,14 @@
if ( _log.isErrorEnabled() )
{
- StringBuilder msg = new StringBuilder( "Wrong .jpf requested for this directory: got " );
+ StringBuffer msg = new StringBuffer( "Wrong .jpf requested for this directory: got " );
msg.append( requestedType ).append( ", expected " ).append( desiredType ).append( '.' );
_log.error( msg.toString() );
}
InternalUtils.sendDevTimeError( "PageFlow_WrongPath", null,
HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response,
- getServletContext(), requestedType, desiredType);
+ getServletContext(), new Object[]{ requestedType, desiredType } );
return true;
}
@@ -805,7 +803,7 @@
// Go through the chain of pre-request interceptors.
//
RequestInterceptorContext context = new RequestInterceptorContext( request, response, getServletContext() );
- List< Interceptor > interceptors = context.getRequestInterceptors();
+ List/*< Interceptor >*/ interceptors = context.getRequestInterceptors();
try
{
@@ -1003,7 +1001,7 @@
private boolean isCorrectFormType( Class formBeanClass, ActionMapping mapping )
{
assert mapping.getName() != null : "cannot pass an ActionMapping that has no form bean";
- Class cachedFormBeanClass = _formBeanClasses.get( mapping.getName() );
+ Class cachedFormBeanClass = ( Class ) _formBeanClasses.get( mapping.getName() );
return isCorrectFormType( formBeanClass, cachedFormBeanClass, mapping );
}
@@ -1128,11 +1126,11 @@
if ( unqualifiedActionPath != null )
{
- List< ActionMapping > overloaded = _overloadedActions.get( unqualifiedActionPath );
+ List/*< ActionMapping >*/ overloaded = ( List ) _overloadedActions.get( unqualifiedActionPath );
if ( overloaded == null )
{
- overloaded = new ArrayList< ActionMapping >();
+ overloaded = new ArrayList/*< ActionMapping >*/();
_overloadedActions.put( unqualifiedActionPath, overloaded );
}
@@ -1169,7 +1167,7 @@
* Read component instance mapping configuration file.
* This is where we read files properties.
*/
- @Override
+
protected void initDefinitionsMapping() throws ServletException
{
definitionsFactory = null;
@@ -1210,7 +1208,7 @@
if ( forwardedForm != null )
{
forwardedFormClass = forwardedForm.getClass();
- List< ActionMapping > possibleMatches = _overloadedActions.get( path );
+ List/*< ActionMapping >*/ possibleMatches = ( List ) _overloadedActions.get( path );
ActionMapping bestMatch = null;
//
@@ -1220,9 +1218,9 @@
//
for ( int i = 0; possibleMatches != null && i < possibleMatches.size(); ++i )
{
- ActionMapping possibleMatch = possibleMatches.get( i );
+ ActionMapping possibleMatch = ( ActionMapping ) possibleMatches.get( i );
assert possibleMatch instanceof PageFlowActionMapping : possibleMatch.getClass();
- Class cachedFormBeanClass = _formBeanClasses.get( possibleMatch.getName() );
+ Class cachedFormBeanClass = ( Class ) _formBeanClasses.get( possibleMatch.getName() );
if ( forwardedFormClass.equals( cachedFormBeanClass ) )
{
@@ -1335,12 +1333,12 @@
if ( dot != -1 )
{
- Map< String, SharedFlowController > sharedFlows = PageFlowUtils.getSharedFlows( request );
+ Map/*< String, SharedFlowController >*/ sharedFlows = PageFlowUtils.getSharedFlows( request );
if ( sharedFlows == null ) return true;
if ( dot == actionPath.length() - 1 ) return true; // empty action name
assert actionPath.length() > 0 && actionPath.charAt( 0 ) == '/' : actionPath;
String sharedFlowName = actionPath.substring( 1, dot );
- SharedFlowController sf = sharedFlows.get( sharedFlowName );
+ SharedFlowController sf = ( SharedFlowController ) sharedFlows.get( sharedFlowName );
if ( sf != null )
{
@@ -1361,7 +1359,7 @@
//
int lastSlash = actionPath.lastIndexOf( '/' );
assert lastSlash != -1 : actionPath;
- StringBuilder uri = new StringBuilder( sf.getModulePath() );
+ StringBuffer uri = new StringBuffer( sf.getModulePath() );
uri.append( '/' );
uri.append( actionPath.substring( dot + 1 ) );
uri.append( ACTION_EXTENSION );
@@ -1389,7 +1387,7 @@
{
if ( _log.isInfoEnabled() )
{
- StringBuilder msg = new StringBuilder( "Action \"" ).append( actionPath );
+ StringBuffer msg = new StringBuffer( "Action \"" ).append( actionPath );
_log.info( msg.append( "\" was also unhandled by Global.app." ).toString() );
}
@@ -1773,7 +1771,7 @@
private boolean processPageForward( String pagePath, HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException
{
- Class pageServletClass = _pageServletClasses.get( pagePath );
+ Class pageServletClass = ( Class ) _pageServletClasses.get( pagePath );
if ( pageServletClass == null )
{
@@ -1982,7 +1980,7 @@
ServletContext servletContext = getServletContext();
String actionName = InternalUtils.getActionName( mapping );
ActionInterceptorContext context = null;
- List< Interceptor > interceptors = null;
+ List/*< Interceptor >*/ interceptors = null;
if ( action instanceof FlowControllerAction )
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java Mon Apr 11 23:42:11 2005
@@ -223,7 +223,7 @@
if ( interceptorContext != null )
{
- ActionInterceptor interceptor = interceptorContext.getOverridingInterceptor();
+ ActionInterceptor interceptor = interceptorContext.getOverridingActionInterceptor();
InterceptorForward originalForward = interceptorContext.getOriginalForward();
String actionName = interceptorContext.getActionName();
_stack.push( new PushedPageFlow( pageFlow, interceptor, originalForward, actionName ) );
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java Mon Apr 11 23:42:11 2005
@@ -19,10 +19,9 @@
import org.apache.beehive.netui.core.urls.FreezableMutableURI;
import org.apache.beehive.netui.core.urls.MutableURI;
-import org.apache.beehive.netui.core.urls.URLRewriter.URLType;
import org.apache.beehive.netui.core.urls.URLRewriterService;
+import org.apache.beehive.netui.core.urls.URLType;
import org.apache.beehive.netui.core.urltemplates.URLTemplateDescriptor;
-import org.apache.beehive.netui.pageflow.config.PageFlowActionFormBean;
import org.apache.beehive.netui.pageflow.internal.ActionResultImpl;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
import org.apache.beehive.netui.pageflow.internal.InternalConstants;
@@ -57,27 +56,28 @@
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.Iterator;
+
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
-import static org.apache.beehive.netui.pageflow.internal.InternalConstants.*;
-import static org.apache.beehive.netui.pageflow.PageFlowConstants.*;
/**
* Utility methods related to Page Flow.
*/
public class PageFlowUtils
+ implements PageFlowConstants, InternalConstants
{
private static final Logger _log = Logger.getInstance( PageFlowUtils.class );
private static final String ACTION_URI_ATTR = ATTR_PREFIX + "_actionURI";
- private static final int JPF_EXTENSION_LEN = JPF_EXTENSION.length();
- private static final String DEFAULT_AUTORESOLVE_EXTENSIONS[] = new String[]{ ACTION_EXTENSION, JPF_EXTENSION };
+ private static final int PAGEFLOW_EXTENSION_LEN = PAGEFLOW_EXTENSION.length();
+ private static final String DEFAULT_AUTORESOLVE_EXTENSIONS[] = new String[]{ ACTION_EXTENSION, PAGEFLOW_EXTENSION };
/** Map of Struts module prefix to Map of form-type-name to form-name. */
- private static Map< String, Map< String, List< String > > > _formNameMaps =
- new ConcurrentHashMap< String, Map< String, List< String > > >();
+ private static Map/*< String, Map< String, List< String > > >*/ _formNameMaps =
+ new InternalConcurrentHashMap/*< String, Map< String, List< String > > >*/();
/**
@@ -160,7 +160,7 @@
public static String getBeginActionURI( String requestURI )
{
// Translate this to a request for the begin action ("begin.do") for this PageFlowController.
- StringBuilder retVal = new StringBuilder();
+ StringBuffer retVal = new StringBuffer();
int lastSlash = requestURI.lastIndexOf( '/' );
if ( lastSlash != -1 )
@@ -280,9 +280,9 @@
* @param request the current HttpServletRequest, which is used to determine the current page flow.
* @return a Map of shared flow name (string) to shared flow instance ({@link SharedFlowController}).
*/
- public static Map< String, SharedFlowController > getSharedFlows( HttpServletRequest request )
+ public static Map/*< String, SharedFlowController >*/ getSharedFlows( HttpServletRequest request )
{
- Map< String, SharedFlowController > sharedFlows = ImplicitObjectUtil.getSharedFlow( request );
+ Map/*< String, SharedFlowController >*/ sharedFlows = ImplicitObjectUtil.getSharedFlow( request );
return sharedFlows != null ? sharedFlows : Collections.EMPTY_MAP;
}
@@ -453,25 +453,25 @@
}
}
- private static List< String > getFormNamesFromModuleConfig( String formBeanClassName, ModuleConfig moduleConfig )
+ private static List/*< String >*/ getFormNamesFromModuleConfig( String formBeanClassName, ModuleConfig moduleConfig )
{
String modulePrefix = moduleConfig.getPrefix();
- Map< String, List< String > > formNameMap = _formNameMaps.get( modulePrefix ); // map of form-type-name to form-name
+ Map/*< String, List< String > >*/ formNameMap = ( Map ) _formNameMaps.get( modulePrefix ); // map of form-type-name to form-name
if ( formNameMap == null )
{
- formNameMap = new HashMap< String, List< String > >();
+ formNameMap = new HashMap/*< String, List< String > >*/();
FormBeanConfig[] formBeans = moduleConfig.findFormBeanConfigs();
for ( int j = 0; j < formBeans.length; ++j )
{
assert formBeans[j] != null;
String formBeanType = InternalUtils.getFormBeanType( formBeans[j] );
- List< String > formBeanNames = formNameMap.get( formBeanType );
+ List/*< String >*/ formBeanNames = ( List ) formNameMap.get( formBeanType );
if ( formBeanNames == null )
{
- formBeanNames = new ArrayList< String >();
+ formBeanNames = new ArrayList/*< String >*/();
formNameMap.put( formBeanType, formBeanNames );
}
@@ -481,7 +481,7 @@
_formNameMaps.put( modulePrefix, formNameMap );
}
- return formNameMap.get( formBeanClassName );
+ return ( List ) formNameMap.get( formBeanClassName );
}
/**
@@ -505,7 +505,7 @@
//
// Get the names of *all* form beans of the desired type, and blast out this instance under all those names.
//
- List< String > formNames = getFormNamesFromModuleConfig( formClass.getName(), moduleConfig );
+ List/*< String >*/ formNames = getFormNamesFromModuleConfig( formClass.getName(), moduleConfig );
if ( formNames == null )
{
@@ -516,8 +516,9 @@
{
assert formNames.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list
- for ( String formName : formNames )
+ for ( Iterator ii = formNames.iterator(); ii.hasNext(); )
{
+ String formName = ( String ) ii.next();
InternalUtils.setFormInScope( formName, form, mapping, request, overwrite );
}
}
@@ -558,12 +559,12 @@
public static String getFormBeanName( Class formBeanClass, HttpServletRequest request )
{
ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request );
- List< String > names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig );
+ List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig );
if ( names != null )
{
assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list
- return names.get( 0 );
+ return ( String ) names.get( 0 );
}
return generateFormBeanName( formBeanClass, request );
@@ -624,10 +625,10 @@
if ( uri.charAt( 0 ) == '/' ) uri = uri.substring( 1 );
- assert FileUtils.osSensitiveEndsWith( uri, JPF_EXTENSION ) : uri;
- if ( FileUtils.osSensitiveEndsWith( uri, JPF_EXTENSION ) )
+ assert FileUtils.osSensitiveEndsWith( uri, PAGEFLOW_EXTENSION ) : uri;
+ if ( FileUtils.osSensitiveEndsWith( uri, PAGEFLOW_EXTENSION ) )
{
- uri = uri.substring( 0, uri.length() - JPF_EXTENSION_LEN );
+ uri = uri.substring( 0, uri.length() - PAGEFLOW_EXTENSION_LEN );
}
return uri.replace( '/', '.' );
@@ -655,7 +656,7 @@
*/
public static String getPageFlowURI( String className )
{
- return '/' + className.replace( '.', '/' ) + JPF_EXTENSION;
+ return '/' + className.replace( '.', '/' ) + PAGEFLOW_EXTENSION;
}
/**
@@ -825,7 +826,7 @@
public static void addValidationError( String propertyName, String messageKey, Object messageArg,
ServletRequest request )
{
- addActionError( request, propertyName, messageKey, messageArg );
+ addActionError( request, propertyName, messageKey, new Object[]{ messageArg } );
}
/**
@@ -838,7 +839,7 @@
*/
public static void addValidationError( String propertyName, String messageKey, ServletRequest request )
{
- addActionError( request, propertyName, messageKey );
+ addActionError( request, propertyName, messageKey, null );
}
/**
@@ -850,7 +851,7 @@
* @param messageArgs zero or more arguments to the message.
*/
public static void addActionError( ServletRequest request, String propertyName, String messageKey,
- Object ... messageArgs )
+ Object[] messageArgs )
{
InternalUtils.addActionError( propertyName, new ActionMessage( messageKey, messageArgs ), request );
}
@@ -864,7 +865,7 @@
* @param messageArgs zero or more arguments to the message.
*/
public static void addActionErrorExpression( ServletRequest request, String propertyName, String expression,
- Object ... messageArgs )
+ Object[] messageArgs )
{
InternalUtils.addActionError( propertyName, new ExpressionMessage( expression, messageArgs ), request );
}
@@ -916,7 +917,7 @@
//CR122325 - added modulePath to actionOverride var in URL for case where portlet jpf
//forwards to another jpf and a refresh is done while action from first jpf is in URL.
assert actionOverride.charAt( 0 ) == '/' : actionOverride;
- StringBuilder uri = new StringBuilder( scopedRequest.getContextPath() );
+ StringBuffer uri = new StringBuffer( scopedRequest.getContextPath() );
uri.append( actionOverride );
uri.append( PageFlowConstants.ACTION_EXTENSION );
scopedRequest.setRequestURI( uri.toString() );
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ProcessPopulate.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ProcessPopulate.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ProcessPopulate.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ProcessPopulate.java Mon Apr 11 23:42:11 2005
@@ -84,7 +84,7 @@
public String toString()
{
- StringBuilder buf = new StringBuilder();
+ StringBuffer buf = new StringBuffer();
buf.append("expression: " + expression + "\n");
if(values != null)
for(int i = 0; i < values.length; i++)
@@ -133,7 +133,7 @@
if(!handlerMap.containsKey(handler))
throw new IllegalStateException(Bundle.getErrorString("ProcessPopulate_handler_notRegistered", new Object[] {handler}));
- StringBuilder buf = new StringBuilder();
+ StringBuffer buf = new StringBuffer();
buf.append(WLW_TAG_HANDLER_PREFIX);
buf.append(handler);
buf.append(WLW_TAG_HANDLER_SUFFIX);
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SecurityProtocol.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SecurityProtocol.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SecurityProtocol.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SecurityProtocol.java Mon Apr 11 23:42:11 2005
@@ -20,9 +20,46 @@
/**
* Enumeration to represent secure/unsecure/unspecified values associated with URIs in the webapp.
*/
-public enum SecurityProtocol
+public class SecurityProtocol
{
- SECURE,
- UNSECURE,
- UNSPECIFIED
+ protected static final int INT_SECURE = 0;
+ protected static final int INT_UNSECURE = 1;
+ protected static final int INT_UNSPECIFIED = 2;
+
+ public static final SecurityProtocol SECURE = new SecurityProtocol( INT_SECURE );
+ public static final SecurityProtocol UNSECURE = new SecurityProtocol( INT_UNSECURE );
+ public static final SecurityProtocol UNSPECIFIED = new SecurityProtocol( INT_UNSPECIFIED );
+
+ private int _val;
+
+ private SecurityProtocol( int val )
+ {
+ _val = val;
+ }
+
+ public String toString()
+ {
+ switch ( _val )
+ {
+ case INT_SECURE : return "secure";
+ case INT_UNSECURE: return "unsecure";
+ case INT_UNSPECIFIED: return "unspecified";
+ }
+
+ assert false : _val;
+ return "<unknown Modifier>";
+ }
+
+ public boolean equals( Object o )
+ {
+ if ( o == null ) return false;
+ if ( o == this ) return true;
+ if ( ! ( o instanceof SecurityProtocol ) ) return false;
+ return ( ( SecurityProtocol ) o )._val == _val;
+ }
+
+ public int hashCode()
+ {
+ return _val;
+ }
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ServletContainerAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ServletContainerAdapter.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ServletContainerAdapter.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ServletContainerAdapter.java Mon Apr 11 23:42:11 2005
@@ -17,7 +17,6 @@
*/
package org.apache.beehive.netui.pageflow;
-import org.apache.beehive.controls.api.context.ControlBeanContext;
import org.apache.beehive.netui.pageflow.internal.Adapter;
import javax.servlet.http.HttpServletRequest;
@@ -101,7 +100,7 @@
* @param request the current HttpServletRequest.
* @param response the current HttpServletResponse.
*
- * @exception javax.security.auth.login.LoginException if the authentication failed
+ * @exception LoginException if the authentication failed
*/
public void login( String username, String password, HttpServletRequest request, HttpServletResponse response )
throws LoginException;
@@ -158,7 +157,7 @@
* @param response the current HttpServletResponse.
* @return a new ControlBeanContext.
*/
- public ControlBeanContext createControlBeanContext( HttpServletRequest request, HttpServletResponse response );
+ public Object createControlBeanContext( HttpServletRequest request, HttpServletResponse response );
/**
* Get the name of the platform, which may be used to find platform-specific configuration files.
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java Mon Apr 11 23:42:11 2005
@@ -27,7 +27,7 @@
import javax.servlet.ServletContext;
import org.apache.beehive.netui.pageflow.internal.AdapterManager;
-import static org.apache.beehive.netui.pageflow.internal.InternalConstants.*;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
// TODO: javadoc
@@ -58,7 +58,7 @@
public void persistInSession( HttpServletRequest request, HttpServletResponse response )
{
- request.getSession().setAttribute( SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );
+ request.getSession().setAttribute( InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );
}
/**
@@ -71,7 +71,7 @@
public void ensureFailover( HttpServletRequest request )
{
ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( getServletContext() );
- servletContainerAdapter.ensureFailover( SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this, request );
+ servletContainerAdapter.ensureFailover( InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this, request );
}
/**
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionFormBean.java Mon Apr 11 23:42:11 2005
@@ -1,41 +1,41 @@
-/*
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Header:$
- */
-package org.apache.beehive.netui.pageflow.config;
-
-import org.apache.struts.config.FormBeanConfig;
-import org.apache.struts.action.ActionFormBean;
-
-
-/**
- * Class to handle our extensions to the Struts <form-bean> tag.
- */
-public class PageFlowActionFormBean extends ActionFormBean
-{
- private String _actualType; // applicable for non-ActionForm-derived form types
-
-
- public String getActualType()
- {
- return _actualType;
- }
-
- public void setActualType( String actualType )
- {
- _actualType = actualType;
- }
-}
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.config;
+
+import org.apache.struts.config.FormBeanConfig;
+import org.apache.struts.action.ActionFormBean;
+
+
+/**
+ * Class to handle our extensions to the Struts <form-bean> tag.
+ */
+public class PageFlowActionFormBean extends ActionFormBean
+{
+ private String _actualType; // applicable for non-ActionForm-derived form types
+
+
+ public String getActualType()
+ {
+ return _actualType;
+ }
+
+ public void setActualType( String actualType )
+ {
+ _actualType = actualType;
+ }
+}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowActionMapping.java Mon Apr 11 23:42:11 2005
@@ -37,7 +37,7 @@
private String _formMember;
private String _formClass; // applicable for non-ActionForm-derived form types
private boolean _readonly = false;
- private Map< String, String > _conditionalForwards = new LinkedHashMap< String, String >();
+ private Map/*< String, String >*/ _conditionalForwards = new LinkedHashMap/*< String, String >*/();
private String _formBeanMessageResourcesKey;
private String _defaultForward;
@@ -152,7 +152,7 @@
/**
* Get a map of expression -> forward-name. If the expression evaluates to <code>true</code> the forward is used.
*/
- public Map< String, String > getConditionalForwardsMap()
+ public Map/*< String, String >*/ getConditionalForwardsMap()
{
return _conditionalForwards;
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/config/PageFlowControllerConfig.java Mon Apr 11 23:42:11 2005
@@ -36,7 +36,7 @@
private boolean _isReturnToPageDisabled;
private boolean _isReturnToActionDisabled;
private boolean _isMissingDefaultMessages;
- private LinkedHashMap< String, String > _sharedFlowTypes;
+ private LinkedHashMap/*< String, String >*/ _sharedFlowTypes;
private String _controllerClass;
private boolean _isSharedFlow;
private String _overrideMultipartClass = null;
@@ -102,7 +102,7 @@
}
String[] keyValues = sharedFlows.split( "," );
- _sharedFlowTypes = new LinkedHashMap< String, String >();
+ _sharedFlowTypes = new LinkedHashMap/*< String, String >*/();
for ( int i = 0; i < keyValues.length; i++ )
{
@@ -119,7 +119,7 @@
throw new UnsupportedOperationException( "not implemented; uses getSharedFlowTypes" );
}
- public Map< String, String > getSharedFlowTypes()
+ public Map/*< String, String >*/ getSharedFlowTypes()
{
return _sharedFlowTypes;
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java Mon Apr 11 23:42:11 2005
@@ -18,7 +18,8 @@
package org.apache.beehive.netui.pageflow.faces.internal;
import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.pageflow.internal.AnnotationReader;
+import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
import javax.faces.el.MethodBinding;
import javax.faces.el.MethodNotFoundException;
@@ -27,6 +28,7 @@
import javax.faces.component.StateHolder;
import javax.faces.component.UIComponentBase;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletContext;
import java.lang.reflect.Method;
import java.lang.reflect.Field;
@@ -84,38 +86,48 @@
try
{
+ Object servletContextObject = context.getExternalContext().getContext();
+ assert servletContextObject instanceof ServletContext : servletContextObject.getClass().getName();
+ ServletContext servletContext = ( ServletContext ) servletContextObject;
Method method = backingClass.getMethod( _methodName, _params );
- Jpf.CommandHandler ann = method.getAnnotation( Jpf.CommandHandler.class );
+ AnnotationReader annReader = AnnotationReader.getAnnotationReader( backingClass, servletContext );
+ ProcessedAnnotation ann = annReader.getJpfAnnotation( method, "CommandHandler" );
if ( ann != null )
{
- Jpf.RaiseAction[] raiseActions = ann.raiseActions();
+ ProcessedAnnotation[] raiseActions =
+ AnnotationReader.getAnnotationArrayAttribute( ann, "raiseActions" );
- for ( int i = 0; i < raiseActions.length; i++ )
+ if ( raiseActions != null )
{
- Jpf.RaiseAction raiseAction = raiseActions[i];
-
- if ( raiseAction.action().equals( action ) )
+ for ( int i = 0; i < raiseActions.length; i++ )
{
- String formBeanMember = raiseAction.outputFormBean();
+ ProcessedAnnotation raiseAction = raiseActions[i];
+ String actionAttr = AnnotationReader.getStringAttribute( raiseAction, "action" );
- if ( formBeanMember.length() > 0 )
+ if ( actionAttr.equals( action ) )
{
- try
+ String formBeanMember =
+ AnnotationReader.getStringAttribute( raiseAction, "outputFormBean" );
+
+ if ( formBeanMember != null && formBeanMember.length() > 0 )
{
- // TODO: must cache fields and annotations
- Field field = backingClass.getDeclaredField( formBeanMember );
- field.setAccessible( true );
- Object value = field.get( backingBean );
- InternalUtils.setForwardedFormBean( httpRequest, InternalUtils.wrapFormBean( value ) );
- }
- catch ( NoSuchFieldException e )
- {
- e.printStackTrace( ); // TODO: log
- }
- catch ( IllegalAccessException e )
- {
- e.printStackTrace( ); // TODO: log
+ try
+ {
+ // TODO: must cache fields and annotations
+ Field field = backingClass.getDeclaredField( formBeanMember );
+ field.setAccessible( true );
+ Object value = field.get( backingBean );
+ InternalUtils.setForwardedFormBean( httpRequest, InternalUtils.wrapFormBean( value ) );
+ }
+ catch ( NoSuchFieldException e )
+ {
+ e.printStackTrace( ); // TODO: log
+ }
+ catch ( IllegalAccessException e )
+ {
+ e.printStackTrace( ); // TODO: log
+ }
}
}
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java Mon Apr 11 23:42:11 2005
@@ -24,7 +24,7 @@
public class HandlerConfig
implements Serializable
{
- private Map< String, String > _customProperties = new HashMap< String, String >();
+ private Map/*< String, String >*/ _customProperties = new HashMap/*< String, String >*/();
private String _handlerClass;
public HandlerConfig( String handlerClass )
@@ -32,7 +32,7 @@
_handlerClass = handlerClass;
}
- public Map< String, String > getCustomProperties()
+ public Map/*< String, String >*/ getCustomProperties()
{
return _customProperties;
}
@@ -44,7 +44,7 @@
public String getCustomProperty( String name )
{
- return _customProperties.get( name );
+ return ( String ) _customProperties.get( name );
}
public String getHandlerClass()
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java Mon Apr 11 23:42:11 2005
@@ -22,10 +22,10 @@
public abstract class InterceptorChain
{
- private LinkedList< Interceptor > _chain = new LinkedList< Interceptor >();
+ private LinkedList/*< Interceptor >*/ _chain = new LinkedList/*< Interceptor >*/();
private InterceptorContext _context;
- protected InterceptorChain( InterceptorContext context, List< Interceptor > interceptors )
+ protected InterceptorChain( InterceptorContext context, List/*< Interceptor >*/ interceptors )
{
_context = context;
_chain.addAll( interceptors );
@@ -36,7 +36,7 @@
{
if ( ! _chain.isEmpty() )
{
- return invoke( _chain.remove() );
+ return invoke( ( Interceptor ) _chain.removeFirst() );
}
else
{
@@ -58,6 +58,6 @@
protected Interceptor removeFirst()
{
- return _chain.remove();
+ return ( Interceptor ) _chain.removeFirst();
}
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java Mon Apr 11 23:42:11 2005
@@ -25,7 +25,7 @@
implements Serializable
{
private String _interceptorClass;
- private Map< String, String > _customProperties = new HashMap< String, String >();
+ private Map/*< String, String >*/ _customProperties = new HashMap/*< String, String >*/();
protected InterceptorConfig()
{
@@ -46,7 +46,7 @@
_interceptorClass = interceptorClass;
}
- public Map< String, String > getCustomProperties()
+ public Map/*< String, String >*/ getCustomProperties()
{
return _customProperties;
}
@@ -58,6 +58,6 @@
public String getCustomProperty( String name )
{
- return _customProperties.get( name );
+ return ( String ) _customProperties.get( name );
}
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java Mon Apr 11 23:42:11 2005
@@ -54,7 +54,7 @@
}
protected static void addInterceptors( org.apache.beehive.netui.util.config.bean.Interceptor[] configBeans,
- List< Interceptor > interceptorsList, Class baseClassOrInterface )
+ List/*< Interceptor >*/ interceptorsList, Class baseClassOrInterface )
{
if ( configBeans != null )
{
@@ -89,7 +89,7 @@
* @return an initialized Interceptor, or <code>null</code> if an error occurred.
*/
protected static Interceptor addInterceptor( InterceptorConfig config, Class baseClassOrInterface,
- List< Interceptor > interceptors )
+ List/*< Interceptor >*/ interceptors )
{
Interceptor interceptor = createInterceptor( config, baseClassOrInterface );
if ( interceptor != null ) interceptors.add( interceptor );
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java Mon Apr 11 23:42:11 2005
@@ -22,7 +22,7 @@
public class Interceptors
{
- public static void doPreIntercept( InterceptorContext context, List< Interceptor > interceptors )
+ public static void doPreIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors )
throws InterceptorException
{
if ( interceptors != null )
@@ -32,7 +32,7 @@
}
}
- public static void doPostIntercept( InterceptorContext context, List< Interceptor > interceptors )
+ public static void doPostIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors )
throws InterceptorException
{
if ( interceptors != null )
@@ -45,7 +45,7 @@
private static final class PreInvokeInterceptorChain
extends InterceptorChain
{
- public PreInvokeInterceptorChain( InterceptorContext context, List< Interceptor > interceptors )
+ public PreInvokeInterceptorChain( InterceptorContext context, List/*< Interceptor >*/ interceptors )
{
super( context, interceptors );
}
@@ -61,7 +61,7 @@
private static final class PostInvokeInterceptorChain
extends InterceptorChain
{
- public PostInvokeInterceptorChain( InterceptorContext context, List< Interceptor > interceptors )
+ public PostInvokeInterceptorChain( InterceptorContext context, List/*< Interceptor >*/ interceptors )
{
super( context, interceptors );
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptorContext.java Mon Apr 11 23:42:11 2005
@@ -18,7 +18,7 @@
package org.apache.beehive.netui.pageflow.interceptor.action;
import org.apache.beehive.netui.pageflow.PageFlowController;
-import org.apache.beehive.netui.pageflow.interceptor.Interceptor;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
import org.apache.beehive.netui.pageflow.interceptor.request.RequestInterceptorContext;
import org.apache.beehive.netui.util.logging.Logger;
import org.apache.beehive.netui.util.config.ConfigUtil;
@@ -35,17 +35,16 @@
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
import java.io.Serializable;
-import static org.apache.beehive.netui.pageflow.internal.InternalConstants.ATTR_PREFIX;
public class ActionInterceptorContext
extends RequestInterceptorContext
{
- private static final String ACTIVE_INTERCEPTOR_CONTEXT_ATTR = ATTR_PREFIX + "interceptorContext";
- private static final String CACHE_ATTR = ATTR_PREFIX + "actionInterceptorConfig";
+ private static final String ACTIVE_INTERCEPTOR_CONTEXT_ATTR = InternalConstants.ATTR_PREFIX + "interceptorContext";
+ private static final String CACHE_ATTR = InternalConstants.ATTR_PREFIX + "actionInterceptorConfig";
private static final Logger _log = Logger.getInstance( ActionInterceptorContext.class );
@@ -112,19 +111,14 @@
getRequest().setAttribute( ACTIVE_INTERCEPTOR_CONTEXT_ATTR, this );
}
- public InterceptorForward getResultOverride()
- {
- return ( InterceptorForward ) super.getResultOverride();
- }
-
- public ActionInterceptor getOverridingInterceptor()
+ public ActionInterceptor getOverridingActionInterceptor()
{
return ( ActionInterceptor ) super.getOverridingInterceptor();
}
public InterceptorForward getInterceptorForward()
{
- return getResultOverride();
+ return ( InterceptorForward ) getResultOverride();
}
public boolean hasInterceptorForward()
@@ -193,11 +187,11 @@
}
}
- public List< Interceptor > getActionInterceptors()
+ public List/*< Interceptor >*/ getActionInterceptors()
{
ServletContext servletContext = getServletContext();
- ConcurrentHashMap< String, HashMap< String, ArrayList< Interceptor > > > cache =
- ( ConcurrentHashMap< String, HashMap< String, ArrayList< Interceptor > > > ) servletContext.getAttribute( CACHE_ATTR );
+ InternalConcurrentHashMap/*< String, HashMap< String, ArrayList< Interceptor > > >*/ cache =
+ ( InternalConcurrentHashMap ) servletContext.getAttribute( CACHE_ATTR );
if ( cache == null )
{
@@ -206,25 +200,25 @@
// one of the caches will get overwritten in the ServletContext, but it will just get recreated the
// next time.
//
- cache = new ConcurrentHashMap< String, HashMap< String, ArrayList< Interceptor > > >();
+ cache = new InternalConcurrentHashMap/*< String, HashMap< String, ArrayList< Interceptor > > >*/();
servletContext.setAttribute( CACHE_ATTR, cache );
}
String modulePath = getPageFlow().getModulePath();
String actionName = getActionName();
- HashMap< String, ArrayList< Interceptor > > cacheByPageFlow = cache.get( modulePath );
+ HashMap/*< String, ArrayList< Interceptor > >*/ cacheByPageFlow = ( HashMap ) cache.get( modulePath );
if ( cacheByPageFlow != null )
{
- List< Interceptor > interceptors = cacheByPageFlow.get( actionName );
+ List/*< Interceptor >*/ interceptors = ( List ) cacheByPageFlow.get( actionName );
if ( interceptors != null ) return interceptors;
}
//
// We didn't find it in the cache -- build it.
//
- if ( cacheByPageFlow == null ) cacheByPageFlow = new HashMap< String, ArrayList< Interceptor > >();
+ if ( cacheByPageFlow == null ) cacheByPageFlow = new HashMap/*< String, ArrayList< Interceptor > >*/();
PageflowActionInterceptors config = ConfigUtil.getConfig().getPageflowActionInterceptors();
- ArrayList< Interceptor > interceptorsList = new ArrayList< Interceptor >();
+ ArrayList/*< Interceptor >*/ interceptorsList = new ArrayList/*< Interceptor >*/();
if ( config == null )
{
@@ -297,7 +291,7 @@
}
private static void addSimpleInterceptors( org.apache.beehive.netui.util.config.bean.SimpleActionInterceptor[] configBeans,
- List< Interceptor > interceptorsList )
+ List/*< Interceptor >*/ interceptorsList )
{
for ( int i = 0; i < configBeans.length; i++ )
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java Mon Apr 11 23:42:11 2005
@@ -34,13 +34,13 @@
public void preAction( ActionInterceptorContext context, InterceptorChain chain )
throws InterceptorException
{
- if ( ! getConfig().isAfterAction() ) doit( context, chain );
+ if ( ! getActionInterceptorConfig().isAfterAction() ) doit( context, chain );
}
public void postAction( ActionInterceptorContext context, InterceptorChain chain )
throws InterceptorException
{
- if ( getConfig().isAfterAction() ) doit( context, chain );
+ if ( getActionInterceptorConfig().isAfterAction() ) doit( context, chain );
}
private void doit( ActionInterceptorContext context, InterceptorChain chain )
@@ -48,7 +48,7 @@
{
try
{
- String path = getConfig().getPath();
+ String path = getActionInterceptorConfig().getPath();
setOverrideForward( new InterceptorForward( new URI( path ) ), context );
chain.continueChain();
}
@@ -62,7 +62,7 @@
{
}
- public SimpleActionInterceptorConfig getConfig()
+ public SimpleActionInterceptorConfig getActionInterceptorConfig()
{
return ( SimpleActionInterceptorConfig ) super.getConfig();
}
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/internal/ActionInterceptors.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/internal/ActionInterceptors.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/internal/ActionInterceptors.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/internal/ActionInterceptors.java Mon Apr 11 23:42:11 2005
@@ -36,7 +36,7 @@
{
private ActionExecutor _actionExecutor;
- public WrapActionInterceptorChain( InterceptorContext context, List< Interceptor > interceptors,
+ public WrapActionInterceptorChain( InterceptorContext context, List/*< Interceptor >*/ interceptors,
ActionExecutor actionExecutor )
{
super( context, interceptors );
@@ -74,7 +74,7 @@
}
}
- public static ActionForward wrapAction( ActionInterceptorContext context, List< Interceptor > interceptors,
+ public static ActionForward wrapAction( ActionInterceptorContext context, List/*< Interceptor >*/ interceptors,
ActionExecutor actionExecutor )
throws InterceptorException, IOException, ServletException
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptorContext.java Mon Apr 11 23:42:11 2005
@@ -18,7 +18,6 @@
package org.apache.beehive.netui.pageflow.interceptor.request;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorContext;
-import org.apache.beehive.netui.pageflow.interceptor.Interceptor;
import org.apache.beehive.netui.pageflow.internal.InternalConstants;
import org.apache.beehive.netui.util.config.ConfigUtil;
import org.apache.beehive.netui.util.config.bean.RequestInterceptors;
@@ -83,23 +82,23 @@
{
org.apache.beehive.netui.util.config.bean.Interceptor[] interceptors =
globalRequestInterceptors.getRequestInterceptorArray();
- ArrayList< Interceptor > interceptorsList = new ArrayList< Interceptor >();
+ ArrayList/*< Interceptor >*/ interceptorsList = new ArrayList/*< Interceptor >*/();
addInterceptors( interceptors, interceptorsList, RequestInterceptor.class );
servletContext.setAttribute( INTERCEPTORS_LIST_ATTR, interceptorsList );
}
}
}
- public List< Interceptor > getRequestInterceptors()
+ public List/*< Interceptor >*/ getRequestInterceptors()
{
- return ( List< Interceptor > ) getServletContext().getAttribute( INTERCEPTORS_LIST_ATTR );
+ return ( List/*< Interceptor >*/ ) getServletContext().getAttribute( INTERCEPTORS_LIST_ATTR );
}
public static void addInterceptor( ServletContext servletContext, RequestInterceptor interceptor )
{
- List< Interceptor > interceptorsList =
- ( List< Interceptor > ) servletContext.getAttribute( INTERCEPTORS_LIST_ATTR );
- if ( interceptorsList == null ) interceptorsList = new ArrayList< Interceptor >();
+ List/*< Interceptor >*/ interceptorsList =
+ ( List/*< Interceptor >*/ ) servletContext.getAttribute( INTERCEPTORS_LIST_ATTR );
+ if ( interceptorsList == null ) interceptorsList = new ArrayList/*< Interceptor >*/();
interceptorsList.add( interceptor );
servletContext.setAttribute( INTERCEPTORS_LIST_ATTR, interceptorsList );
}
Added: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java?view=auto&rev=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java (added)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java Mon Apr 11 23:42:11 2005
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal;
+
+import org.apache.beehive.netui.pageflow.PageFlowConstants;
+import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotationsDocument;
+import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
+import org.apache.beehive.netui.compiler.schema.annotations.AnnotatedElement;
+import org.apache.beehive.netui.compiler.schema.annotations.AnnotationAttribute;
+import org.apache.beehive.netui.util.logging.Logger;
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
+import org.apache.xmlbeans.XmlException;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+import java.io.IOException;
+import java.lang.reflect.Member;
+
+/**
+ * Utility for reading XML files that describe annotations in classes. These files are generated during Page Flow build.
+ */
+public class AnnotationReader
+{
+ private static final Logger _log = Logger.getInstance( AnnotationReader.class );
+ private static final String CACHE_ATTR = InternalConstants.ATTR_PREFIX + "annCache";
+
+ private ProcessedAnnotationsDocument.ProcessedAnnotations _annotations;
+
+ public static AnnotationReader getAnnotationReader( Class type, ServletContext servletContext )
+ {
+ InternalConcurrentHashMap cache = ( InternalConcurrentHashMap ) servletContext.getAttribute( CACHE_ATTR );
+
+ if ( cache == null )
+ {
+ cache = new InternalConcurrentHashMap();
+ servletContext.setAttribute( CACHE_ATTR, cache );
+ }
+
+ AnnotationReader reader = ( AnnotationReader ) cache.get( type );
+
+ if ( reader == null )
+ {
+ reader = new AnnotationReader( type, servletContext );
+ cache.put( type, reader );
+ }
+
+ return reader;
+ }
+
+ private AnnotationReader( Class type, ServletContext servletContext )
+ {
+ String annotationsXml =
+ PageFlowConstants.PAGEFLOW_MODULE_CONFIG_GEN_DIR + "/jpf-annotations-"
+ + type.getName().replace( '.', '-' ) + ".xml";
+ InputStream in = servletContext.getResourceAsStream( annotationsXml );
+
+ if ( in != null )
+ {
+ try
+ {
+ ProcessedAnnotationsDocument doc = ProcessedAnnotationsDocument.Factory.parse( in );
+ _annotations = doc.getProcessedAnnotations();
+ }
+ catch ( XmlException e )
+ {
+ _log.error( "Error while parsing annotations XML file " + annotationsXml, e );
+ }
+ catch ( IOException e )
+ {
+ _log.error( "Error while reading annotations XML file " + annotationsXml, e );
+ }
+ finally
+ {
+ try
+ {
+ in.close();
+ }
+ catch ( IOException e )
+ {
+ _log.error( "Could not close input stream for " + annotationsXml, e );
+ }
+ }
+ }
+ }
+
+ public ProcessedAnnotation getAnnotation( String declarationName, String annotationTypeName )
+ {
+ if ( _annotations == null ) return null;
+
+ AnnotatedElement[] elements = _annotations.getAnnotatedElementArray();
+
+ for ( int i = 0; i < elements.length; i++ )
+ {
+ AnnotatedElement element = elements[i];
+ if ( element.getElementName().equals( declarationName ) )
+ {
+ // For now, we can be sure that there's only one element in this array.
+ assert element.getAnnotationArray().length == 1 : element.getAnnotationArray().length;
+ ProcessedAnnotation pa = element.getAnnotationArray( 0 );
+ return pa.getAnnotationName().equals( annotationTypeName ) ? pa : null;
+ }
+ }
+
+ return null;
+ }
+
+ public ProcessedAnnotation getJpfAnnotation( Member member, String annotationTypeName )
+ {
+ return getAnnotation( member.getName(), InternalConstants.ANNOTATION_QUALIFIER + annotationTypeName );
+ }
+
+ public ProcessedAnnotation getJpfAnnotation( Class type, String annotationTypeName )
+ {
+ return getAnnotation( type.getName(), InternalConstants.ANNOTATION_QUALIFIER + annotationTypeName );
+ }
+
+ public static String getStringAttribute( ProcessedAnnotation ann, String attrName )
+ {
+ AnnotationAttribute[] attrs = ann.getAnnotationAttributeArray();
+
+ for ( int i = 0; i < attrs.length; i++ )
+ {
+ AnnotationAttribute attr = attrs[i];
+
+ if ( attr.getAttributeName().equals( attrName ) )
+ {
+ String value = attr.getStringValue1();
+ assert value != null : "attribute " + attrName + " did not have a String value";
+ return value;
+ }
+ }
+
+ return null;
+ }
+
+ public static ProcessedAnnotation[] getAnnotationArrayAttribute( ProcessedAnnotation ann, String attrName )
+ {
+ AnnotationAttribute[] attrs = ann.getAnnotationAttributeArray();
+
+ for ( int i = 0; i < attrs.length; i++ )
+ {
+ AnnotationAttribute attr = attrs[i];
+
+ if ( attr.getAttributeName().equals( attrName ) )
+ {
+ ProcessedAnnotation[] array = attr.getAnnotationValueArray();
+ assert array != null : "attribute " + attrName + " did not have an array of annotations.";
+ return array;
+ }
+ }
+
+ return null;
+ }
+}
Propchange: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedFacesBackingInfo.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedFacesBackingInfo.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedFacesBackingInfo.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedFacesBackingInfo.java Mon Apr 11 23:42:11 2005
@@ -17,8 +17,7 @@
*/
package org.apache.beehive.netui.pageflow.internal;
-import org.apache.beehive.netui.pageflow.annotations.Jpf;
-
+import javax.servlet.ServletContext;
import java.lang.reflect.Field;
@@ -34,22 +33,23 @@
private Field _pageFlowMemberField;
- public CachedFacesBackingInfo( Class facesBackingClass )
+ public CachedFacesBackingInfo( Class facesBackingClass, ServletContext servletContext )
{
Field[] fields = facesBackingClass.getDeclaredFields();
+ AnnotationReader annReader = AnnotationReader.getAnnotationReader( facesBackingClass, servletContext );
for ( int i = 0; i < fields.length; i++ )
{
Field field = fields[i];
- if ( field.getAnnotation( Jpf.PageFlowField.class ) != null )
+ if ( annReader.getJpfAnnotation( field, "PageFlowField" ) != null )
{
_pageFlowMemberField = field;
_pageFlowMemberField.setAccessible( true );
}
}
- initSharedFlowFields( fields );
+ initSharedFlowFields( annReader, fields );
}
public Field getPageFlowMemberField()
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedPageFlowInfo.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedPageFlowInfo.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedPageFlowInfo.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedPageFlowInfo.java Mon Apr 11 23:42:11 2005
@@ -19,6 +19,8 @@
import org.apache.beehive.netui.pageflow.PageFlowConstants;
+import javax.servlet.ServletContext;
+
/**
* Information that is cached per pageflow class.
@@ -37,15 +39,16 @@
private String _URI;
- public CachedPageFlowInfo( Class pageFlowClass )
+ public CachedPageFlowInfo( Class pageFlowClass, ServletContext servletContext )
{
- initSharedFlowFields( pageFlowClass.getDeclaredFields() );
+ AnnotationReader annReader = AnnotationReader.getAnnotationReader( pageFlowClass, servletContext );
+ initSharedFlowFields( annReader, pageFlowClass.getDeclaredFields() );
//
// URI
//
String className = pageFlowClass.getName();
- _URI = '/' + className.replace( '.', '/' ) + PageFlowConstants.JPF_EXTENSION;
+ _URI = '/' + className.replace( '.', '/' ) + PageFlowConstants.PAGEFLOW_EXTENSION;
//
// module path
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java?view=diff&r1=161024&r2=161025
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/CachedSharedFlowRefInfo.java Mon Apr 11 23:42:11 2005
@@ -17,8 +17,9 @@
*/
package org.apache.beehive.netui.pageflow.internal;
-import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import org.apache.beehive.netui.compiler.schema.annotations.ProcessedAnnotation;
+import javax.servlet.ServletContext;
import java.util.List;
import java.util.ArrayList;
import java.lang.reflect.Field;
@@ -36,23 +37,23 @@
*/
private SharedFlowFieldInfo[] _sharedFlowMemberFields;
- protected void initSharedFlowFields( Field[] fields )
+ protected void initSharedFlowFields( AnnotationReader annReader, Field[] fields )
{
- List< SharedFlowFieldInfo > sharedFlowFields = null;
+ List/*< SharedFlowFieldInfo >*/ sharedFlowFields = null;
for ( int i = 0; i < fields.length; i++ )
{
Field field = fields[i];
- Jpf.SharedFlowField sharedFlowFieldAnn = field.getAnnotation( Jpf.SharedFlowField.class );
+ ProcessedAnnotation sharedFlowFieldAnn = annReader.getJpfAnnotation( field, "SharedFlowField" );
if ( sharedFlowFieldAnn != null )
{
field.setAccessible( true );
- if ( sharedFlowFields == null ) sharedFlowFields = new ArrayList< SharedFlowFieldInfo >();
+ if ( sharedFlowFields == null ) sharedFlowFields = new ArrayList/*< SharedFlowFieldInfo >*/();
SharedFlowFieldInfo info = new SharedFlowFieldInfo();
info.field = field;
- info.sharedFlowName = sharedFlowFieldAnn.name();
+ info.sharedFlowName = AnnotationReader.getStringAttribute( sharedFlowFieldAnn, "name" );
sharedFlowFields.add( info );
}
else if ( field.getName().equals( InternalConstants.GLOBALAPP_MEMBER_NAME ) )
@@ -61,7 +62,7 @@
// Legacy behavior: initialize a field called 'globalApp' with the Global.app instance.
//
field.setAccessible( true );
- if ( sharedFlowFields == null ) sharedFlowFields = new ArrayList< SharedFlowFieldInfo >();
+ if ( sharedFlowFields == null ) sharedFlowFields = new ArrayList/*< SharedFlowFieldInfo >*/();
SharedFlowFieldInfo info = new SharedFlowFieldInfo();
info.field = field;
info.sharedFlowName = null;
@@ -71,7 +72,7 @@
if ( sharedFlowFields != null )
{
- _sharedFlowMemberFields = sharedFlowFields.toArray( new SharedFlowFieldInfo[ sharedFlowFields.size() ] );
+ _sharedFlowMemberFields = ( SharedFlowFieldInfo[] ) sharedFlowFields.toArray( new SharedFlowFieldInfo[ sharedFlowFields.size() ] );
}
}