Package org.apache.beehive.netui.compiler.typesystem.declaration

Examples of org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration


        //
        Collection innerTypes = CompilerUtils.getClassNestedTypes( jclass );
       
        for ( Iterator ii = innerTypes.iterator(); ii.hasNext();
        {
            TypeDeclaration innerType = ( TypeDeclaration ) ii.next();
            if ( innerType instanceof ClassDeclaration
                 && innerType.hasModifier( Modifier.PUBLIC )
                 && innerType.hasModifier( Modifier.STATIC ) )
            {
                addRulesFromBeanClass( ( ClassDeclaration ) innerType );
            }
        }
    }
View Full Code Here


           
            //
            // If this annotation came from a base class, and if inheritLocalPaths is true on the Controller
            // annotation, then make the path relative to the base class module.
            //
            TypeDeclaration containingType = annotation.getContainingType();
            if ( ! CompilerUtils.typesAreEqual( jclass, containingType )
                 && parentApp.getFlowControllerInfo().getMergedControllerAnnotation().isInheritLocalPaths() )
            {
                // TODO: when we no longer support Struts 1.1, we can simply use the 'module' property
                // to make this forward relative to the base class module.
                path = CompilerUtils.getPathRelativeToPackage( path, containingType.getPackage() );
                setInheritedPath( true );
            }
           
            setPath( path );
        }
View Full Code Here

            {
                //
                // If this annotation came from a base class, and if inheritLocalPaths is true on the Controller
                // annotation, then make the path relative to the base class module.
                //
                TypeDeclaration containingType = annotation.getContainingType();
                if ( ! CompilerUtils.typesAreEqual( jclass, containingType )
                     && parent.getFlowControllerInfo().getMergedControllerAnnotation().isInheritLocalPaths() )
                {
                    // TODO: when we no longer support Struts 1.1, we can simply use the 'module' property
                    // to make this forward relative to the base class module.
                    path = CompilerUtils.getPathRelativeToPackage( path, containingType.getPackage() );
                    setInheritedPath( true );
                }
                else
                {
                    contextRelative = false;
View Full Code Here

    {
        Collection innerTypes = CompilerUtils.getClassNestedTypes( jclass );
       
        for ( Iterator ii = innerTypes.iterator(); ii.hasNext();
        {
            TypeDeclaration innerType = ( TypeDeclaration ) ii.next();
            if ( innerType instanceof ClassDeclaration )
            {
                ClassDeclaration innerClass = ( ClassDeclaration ) innerType;
               
                if ( innerType.hasModifier( Modifier.PUBLIC )
                     && CompilerUtils.isAssignableFrom( PAGEFLOW_FORM_CLASS_NAME, innerClass, _env ) )
                {
                    addFormBean( innerClass, null );
                }
            }
View Full Code Here

        MethodDeclaration[] methods = CompilerUtils.getClassMethods( jclass, null );
       
        for ( int i = 0; i < methods.length; i++ )
        {
            MethodDeclaration method = methods[i];
            TypeDeclaration declaringType = method.getDeclaringType();
           
            //
            // Only add diagnostics if the method is in this class, or if it's inherited from a class that's *not* on
            // sourcepath (i.e., its SourcePosition is null).
            //
            if ( declaringType.equals( jclass ) || declaringType.getPosition() == null )
            {
                checkMethod( method, jclass, _actionGrammar, _exceptionHandlerGrammar );
            }
            else
            {
                //
                // We still want to run the checks, which aggregate information into the FlowControllerInfo.  We just
                // don't want diagnostics to be printed.
                //
                checkMethod( method, jclass, _actionGrammarSilentDiagnostics, _exceptionHandlerGrammarSilentDiagnostics );
            }
        }

        //
        // Check the inner classes.
        //
        Collection innerTypes = CompilerUtils.getClassNestedTypes( jclass );
       
        for ( Iterator ii = innerTypes.iterator(); ii.hasNext();
        {
            TypeDeclaration innerType = ( TypeDeclaration ) ii.next();
            if ( innerType instanceof ClassDeclaration ) checkInnerClass( ( ClassDeclaration ) innerType );
        }
       
        //
        // Run additional .jpf- or .app-specific checks.
        //
        doAdditionalClassChecks( jclass );
       
        //
        // Runtime performance enhancement: enable saving of previous-page and previous-action information based on
        // whether there were Forwards that contained navigateTo attributes.
        //
        enableNavigateTo( jclass, fcInfo.getMergedControllerAnnotation(), fcInfo );
        Map sharedFlowTypes = fcInfo.getSharedFlowTypes();
       
        if ( sharedFlowTypes != null )
        {
            for ( Iterator ii = sharedFlowTypes.values().iterator(); ii.hasNext();
            {
                TypeDeclaration sharedFlowType = ( TypeDeclaration ) ii.next();
                //
                // Saving of previous-page/previous-action info must be enabled if any of the referenced shared flows
                // use this feature.
                //
                enableNavigateTo( sharedFlowType, new MergedControllerAnnotation( sharedFlowType ), fcInfo );
View Full Code Here

    {
        for ( ClassType type = jclass.getSuperclass();
              type != null && CompilerUtils.isAssignableFrom( FLOWCONTROLLER_BASE_CLASS, type, getEnv() );
              type = type.getSuperclass() )
        {
            TypeDeclaration decl = CompilerUtils.getDeclaration( type );
           
            //
            // Check simple actions in the Controller annotation.
            //
            List simpleActions =
                    CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true );
           
            if ( simpleActions != null )
            {
                for ( Iterator j = simpleActions.iterator(); j.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) j.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                    List conditionalForwards = CompilerUtils.getAnnotationArray( i, CONDITIONAL_FORWARDS_ATTR, true );
                   
                    if ( conditionalForwards != null )
                    {
                        for ( Iterator k = conditionalForwards.iterator(); k.hasNext();
                        {
                            AnnotationInstance ann = ( AnnotationInstance ) k.next();
                            checkRelativePath( ann, PATH_ATTR, jclass, decl, false );
                        }
                    }
                }
            }
           
            //
            // Check Forwards in the Controller annotation.
            //
            List forwards = CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, FORWARDS_ATTR, true );
           
            if ( forwards != null )
            {
                for ( Iterator ii = forwards.iterator(); ii.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) ii.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                }
            }
           
            //
            // Check Catches in the Controller annotation.
            //
            List catches = CompilerUtils.getAnnotationArrayValue( decl, CONTROLLER_TAG_NAME, CATCHES_ATTR, true );
           
            if ( catches != null )
            {
                for ( Iterator j = catches.iterator(); j.hasNext();
                {
                    AnnotationInstance i = ( AnnotationInstance ) j.next();
                    checkRelativePath( i, PATH_ATTR, jclass, decl, false );
                }
            }

            //
            // Check strutsMerge and validatorMerge in the Controller annotation.
            //
            AnnotationInstance controllerAnnotation = CompilerUtils.getAnnotation( decl, CONTROLLER_TAG_NAME );

            if ( controllerAnnotation != null )
            {
                checkRelativePath( controllerAnnotation, VALIDATOR_MERGE_ATTR, jclass, decl, true );
                checkRelativePath( controllerAnnotation, STRUTSMERGE_ATTR, jclass, decl, true );
            }
           
            //
            // Check Forwards and Catches on action methods and exception-handler methods.
            //
            MethodDeclaration[] methods = decl.getMethods();
            for ( int i = 0; i < methods.length; i++ )
            {
                MethodDeclaration method = methods[i];
                AnnotationInstance ann = CompilerUtils.getAnnotation( method, ACTION_TAG_NAME);
                if ( ann == null ) ann = CompilerUtils.getAnnotation( method, EXCEPTION_HANDLER_TAG_NAME );
View Full Code Here

   
    protected void checkAction( String stringValue, AnnotationValue annValue, MemberDeclaration classMember )
    {
        if ( stringValue.endsWith( ACTION_EXTENSION_DOT ) && stringValue.indexOf( '/' ) == -1 )
        {
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );

            if ( outerType != null )    // null in some error conditions
            {
                int extensionPos = stringValue.lastIndexOf( ACTION_EXTENSION_DOT );
                String actionMethodName = stringValue.substring( 0, extensionPos );
                FlowControllerInfo fcInfo = getFlowControllerInfo();
                boolean foundIt = actionExists( actionMethodName, outerType, null, getEnv(), fcInfo, true );

                if ( ! foundIt && actionMethodName.length() > 0 )
                {
                    //
                    // Check for a Shared Flow action reference of the form <shared-flow-name>..
                    //
                    int dot = actionMethodName.indexOf( '.' );
                   
                    if ( dot != -1 && dot < actionMethodName.length() - 1 )
                    {
                        String sharedFlowName = actionMethodName.substring( 0, dot );
                        TypeDeclaration sfTypeDecl = ( TypeDeclaration ) getFlowControllerInfo().getSharedFlowTypes().get( sharedFlowName );
                       
                        if ( sfTypeDecl != null )
                        {
                            actionMethodName = actionMethodName.substring( dot + 1 );
                            foundIt = actionExists( actionMethodName, sfTypeDecl, null, getEnv(), fcInfo, true );
                        }
                    }
                }
               
                //
                // Look in (legacy) Global.app, unless the class being checked is a shared flow (shared flows are
                // the successor to Global.app -- they can't raise Global.app actions.
                //
                if ( ! foundIt &&
                     ! CompilerUtils.isAssignableFrom( SHARED_FLOW_BASE_CLASS,
                                                       CompilerUtils.getOutermostClass( classMember ), getEnv() ) )
                {
                    TypeDeclaration globalAppDecl = getEnv().getTypeDeclaration( GLOBALAPP_FULL_CLASSNAME );
                    if ( globalAppDecl != null )
                    {
                        foundIt = actionExists( actionMethodName, globalAppDecl, null, getEnv(), fcInfo, false );
                    }
                }
View Full Code Here

        //
        // If this is a return-action, store its info in the FlowControllerInfo (which is eventually provided to tools).
        //
        if ( isReturnAction )
        {
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
            TypeInstance formBeanType =
                    getFlowControllerInfo().addReturnAction( ( String ) value.getValue(), annotation, outerType );
           
            if ( formBeanType != null && ! ( formBeanType instanceof DeclaredType ) )
            {
View Full Code Here

            // for @Jpf.Catch annotations that refer to exception-handler methods, which also have
            // forwards that get rolled onto this entity.
            //
            List additionalEntities = new ArrayList();
           
            TypeDeclaration outerType = CompilerUtils.getOuterClass( classMember );
           
            Collection classLevelCatches =
                    getFlowControllerInfo().getMergedControllerAnnotation().getCatches();
            addAdditionalAnnotationsToCheck( classLevelCatches, outerType, additionalEntities );
           
View Full Code Here

        // Make sure it's a filetype that should exist on the filesystem.  If not, ignore it.
        //
        if ( ! checkAnyExtension() && ! isCheckableExtension( filePath ) ) return null;

        boolean fileExists = true;
        TypeDeclaration outerClass = CompilerUtils.getOutermostClass( classMember );
        File fileToCheck = null;

        if ( filePath.charAt( 0 ) == '/' // relative to webapp root
        {
            if ( _pathMustBeRelative ) addError( value, "error.relative-uri" );
           
            if ( filePath.endsWith( JPF_FILE_EXTENSION_DOT ) )
            {
                TypeDeclaration type = CompilerUtils.inferTypeFromPath( filePath, getEnv() );
                fileToCheck = type != null ? CompilerUtils.getSourceFile( type, false ) : null;
               
                // Note that if we can't infer the file from the type, we'll fall through to the next case, where
                // we actually look for the file in the webapp.
            }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.compiler.typesystem.declaration.TypeDeclaration

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.