Package org.apache.beehive.netui.util.internal.cache

Examples of org.apache.beehive.netui.util.internal.cache.ClassLevelCache


     */
    protected Method getActionMethod( String methodName, Class argType )
    {
        String cacheKey = argType != null ? methodName + '/' + argType.getName() : methodName;
        Class thisClass = getClass();
        ClassLevelCache cache = ClassLevelCache.getCache( thisClass );
        Method actionMethod = ( Method ) cache.get( CACHEID_ACTION_METHODS, cacheKey );
       
        if ( actionMethod != null )
        {
            return actionMethod;
        }
        else
        {
            //
            // We didn't find it in the cache.  Look for it reflectively.
            //
            if ( argType == null )
            {
                //
                // No form -- look for a method with no arguments.
                //
                actionMethod = InternalUtils.lookupMethod( thisClass, methodName, null );
            }
            else
            {
                //
                // Has a form.  Look for a method with a single argument -- either the given type
                // or any superclass.
                //
                while ( argType != null )
                {
                    actionMethod = InternalUtils.lookupMethod( thisClass, methodName, new Class[]{ argType } );
                   
                    if ( actionMethod != null )
                    {
                        break;
                    }
                   
                    argType = argType.getSuperclass();
                }
            }
               
            if ( actionMethod != null && actionMethod.getReturnType().equals( Forward.class ) )
            {
                if ( ! Modifier.isPublic( actionMethod.getModifiers() ) ) actionMethod.setAccessible( true );
                cache.put( CACHEID_ACTION_METHODS, cacheKey, actionMethod );
                return actionMethod;
            }
        }
       
        return null;
View Full Code Here


     *
     * @return the Struts module path for actions in this shared flow.
     */
    public String getModulePath()
    {
        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
        String modulePath = ( String ) cache.getCacheObject( CACHED_INFO_KEY );
       
        if ( modulePath == null )
        {
            String className = getClass().getName();
            int lastDot = className.lastIndexOf( '.' );
            assert lastDot != -1 : className;
            className = className.substring( 0, lastDot );
            modulePath = "/-" + className.replace( '.', '/' );
            cache.setCacheObject( CACHED_INFO_KEY, modulePath );
        }
       
        return modulePath;
    }
View Full Code Here

    protected Method getExceptionHandlerMethod( FlowControllerHandlerContext context, String methodName, Throwable ex,
                                                Object formBean )
    {
        FlowController flowController = context.getFlowController();
        String cacheKey = methodName + '/' + ex.getClass().getName();
        ClassLevelCache cache = ClassLevelCache.getCache( flowController.getClass() );
        Method method = ( Method ) cache.get( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey );
       
        if ( method != null )
        {
            return method;
        }
    
        Class flowControllerClass = flowController.getClass();
        for ( Class exClass = ex.getClass(); exClass != null; exClass = exClass.getSuperclass() )
        {
            Class[] args = new Class[]{ exClass, String.class, String.class, Object.class };
            Method foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
           
            //
            // If we didn't find an exception-handler with the right signature, look for the deprecated signature with
            // FormData as the last argument.
            //
            if ( foundMethod == null && ( formBean == null || formBean instanceof FormData ) )
            {
                args = new Class[]{ exClass, String.class, String.class, FormData.class };        
                foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
            }
           
            //
            // If we didn't find an exception-handler with the right signature, look for the deprecated signature with
            // ActionForm as the last argument.
            //
            if ( foundMethod == null && ( formBean == null || formBean instanceof ActionForm ) )
            {
                args = new Class[]{ exClass, String.class, String.class, ActionForm.class };        
                foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
            }
           
            if ( foundMethod != null )
            {
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( "Found exception handler for " + exClass.getName() );
                }
               
                if ( ! Modifier.isPublic( foundMethod.getModifiers() ) ) foundMethod.setAccessible( true );
                cache.put( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey, foundMethod );
                return foundMethod;
            }
            else
            {
                if ( _log.isErrorEnabled() )
View Full Code Here

        return ret.append( className.substring( lastDot + 1 ) ).append( JPF_EXTENSION ).toString();
    }
   
    private CachedPageFlowInfo getCachedInfo()
    {
        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
        CachedPageFlowInfo info = ( CachedPageFlowInfo ) cache.getCacheObject( CACHED_INFO_KEY );
       
        if ( info == null )
        {
            info = new CachedPageFlowInfo( getClass(), getServletContext() );
            cache.setCacheObject( CACHED_INFO_KEY, info );
        }
       
        return info;
    }
View Full Code Here

        return _pageInputs;
    }
   
    private CachedFacesBackingInfo getCachedInfo()
    {
        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
        CachedFacesBackingInfo info = ( CachedFacesBackingInfo ) cache.getCacheObject( CACHED_INFO_KEY );
       
        if ( info == null )
        {
            info = new CachedFacesBackingInfo( getClass(), getServletContext() );
            cache.setCacheObject( CACHED_INFO_KEY, info );
        }
       
        return info;
    }
View Full Code Here

        return ret.append( className.substring( lastDot + 1 ) ).append( JPF_EXTENSION ).toString();
    }
   
    private CachedPageFlowInfo getCachedInfo()
    {
        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
        CachedPageFlowInfo info = ( CachedPageFlowInfo ) cache.getCacheObject( CACHED_INFO_KEY );
       
        if ( info == null )
        {
            info = new CachedPageFlowInfo( getClass(), getServletContext() );
            cache.setCacheObject( CACHED_INFO_KEY, info );
        }
       
        return info;
    }
View Full Code Here

        return _pageInputs;
    }
   
    private CachedFacesBackingInfo getCachedInfo()
    {
        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
        CachedFacesBackingInfo info = ( CachedFacesBackingInfo ) cache.getCacheObject( CACHED_INFO_KEY );
       
        if ( info == null )
        {
            info = new CachedFacesBackingInfo( getClass(), getServletContext() );
            cache.setCacheObject( CACHED_INFO_KEY, info );
        }
       
        return info;
    }
View Full Code Here

    protected Method getExceptionHandlerMethod( FlowControllerHandlerContext context, String methodName, Throwable ex,
                                                Object formBean )
    {
        FlowController flowController = context.getFlowController();
        String cacheKey = methodName + '/' + ex.getClass().getName();
        ClassLevelCache cache = ClassLevelCache.getCache( flowController.getClass() );
        Method method = ( Method ) cache.get( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey );
       
        if ( method != null )
        {
            return method;
        }
    
        Class flowControllerClass = flowController.getClass();
        for ( Class exClass = ex.getClass(); exClass != null; exClass = exClass.getSuperclass() )
        {
            Class[] args = new Class[]{ exClass, String.class, String.class, Object.class };
            Method foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
           
            //
            // If we didn't find an exception-handler with the right signature, look for the deprecated signature with
            // FormData as the last argument.
            //
            if ( foundMethod == null && ( formBean == null || formBean instanceof FormData ) )
            {
                args = new Class[]{ exClass, String.class, String.class, FormData.class };        
                foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
            }
           
            //
            // If we didn't find an exception-handler with the right signature, look for the deprecated signature with
            // ActionForm as the last argument.
            //
            if ( foundMethod == null && ( formBean == null || formBean instanceof ActionForm ) )
            {
                args = new Class[]{ exClass, String.class, String.class, ActionForm.class };        
                foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
            }
           
            if ( foundMethod != null )
            {
                if ( _log.isDebugEnabled() )
                {
                    _log.debug( "Found exception handler for " + exClass.getName() );
                }
               
                foundMethod.setAccessible( true );
                cache.put( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey, foundMethod );
                return foundMethod;
            }
            else
            {
                if ( _log.isErrorEnabled() )
View Full Code Here

     */
    protected Method getActionMethod( String methodName, Class argType )
    {
        String cacheKey = argType != null ? methodName + '/' + argType.getName() : methodName;
        Class thisClass = getClass();
        ClassLevelCache cache = ClassLevelCache.getCache( thisClass );
        Method actionMethod = ( Method ) cache.get( CACHEID_ACTION_METHODS, cacheKey );
       
        if ( actionMethod != null )
        {
            return actionMethod;
        }
        else
        {
            //
            // We didn't find it in the cache.  Look for it reflectively.
            //
            if ( argType == null )
            {
                //
                // No form -- look for a method with no arguments.
                //
                actionMethod = InternalUtils.lookupMethod( thisClass, methodName, null );
            }
            else
            {
                //
                // Has a form.  Look for a method with a single argument -- either the given type
                // or any superclass.
                //
                while ( argType != null )
                {
                    actionMethod = InternalUtils.lookupMethod( thisClass, methodName, new Class[]{ argType } );
                   
                    if ( actionMethod != null )
                    {
                        break;
                    }
                   
                    argType = argType.getSuperclass();
                }
            }
               
            if ( actionMethod != null && actionMethod.getReturnType().equals( Forward.class ) )
            {
                actionMethod.setAccessible( true );
                cache.put( CACHEID_ACTION_METHODS, cacheKey, actionMethod );
                return actionMethod;
            }
        }
       
        return null;
View Full Code Here

     */
    protected Method getActionMethod( String methodName, Class argType )
    {
        String cacheKey = argType != null ? methodName + '/' + argType.getName() : methodName;
        Class thisClass = getClass();
        ClassLevelCache cache = ClassLevelCache.getCache( thisClass );
        Method actionMethod = ( Method ) cache.get( CACHEID_ACTION_METHODS, cacheKey );

        if ( actionMethod != null )
        {
            return actionMethod;
        }
        else
        {
            //
            // We didn't find it in the cache.  Look for it reflectively.
            //
            if ( argType == null )
            {
                //
                // No form -- look for a method with no arguments.
                //
                actionMethod = InternalUtils.lookupMethod( thisClass, methodName, null );
            }
            else
            {
                //
                // Has a form.  Look for a method with a single argument -- either the given type
                // or any superclass.
                //
                while ( argType != null )
                {
                    actionMethod = InternalUtils.lookupMethod( thisClass, methodName, new Class[]{ argType } );

                    if ( actionMethod != null )
                    {
                        break;
                    }

                    argType = argType.getSuperclass();
                }
            }

            if ( actionMethod != null && actionMethod.getReturnType().equals( Forward.class ) )
            {
                if ( ! Modifier.isPublic( actionMethod.getModifiers() ) ) actionMethod.setAccessible( true );
                cache.put( CACHEID_ACTION_METHODS, cacheKey, actionMethod );
                return actionMethod;
            }
        }

        return null;
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.util.internal.cache.ClassLevelCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.