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

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


                className = className.substring( 3 );
                int lastDot = pkg.lastIndexOf( '.' );
                pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
            }
            className = ( pkg.length() > 0 ? pkg + '.' : "" ) + className.replace( '/', '.' );
            TypeDeclaration type = env.getTypeDeclaration( className );
            fileToCheck = type != null ? CompilerUtils.getSourceFile( type, false ) : null;
            if ( fileToCheck == null ) fileExists = false;
        }
        // In certain error conditions (jpfFile == null), we can't determine the file.  In this case, just ignore.
        else if ( CompilerUtils.getSourceFile( outerClass, false ) != null )
View Full Code Here


                                    MemberDeclaration classMember )
            throws FatalCompileTimeException
    {
        String name = CompilerUtils.getString( annotation, NAME_ATTR, false );

        TypeDeclaration outerClass = CompilerUtils.getOuterClass( classMember );
        if ( WebappPathOrActionType.actionExists( name, outerClass, annotation, getEnv(), getFlowControllerInfo(), false ) )
        {
            if ( ! UniqueValueType.alreadyAddedErrorForValue( classMember, annotation, name, getEnv() ) )
            {
                addError( annotation, "error.duplicate-action", new Object[]{ 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, false );

                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, false );
                        }
                    }
                }
               
                //
                // 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

                className = className.substring( 3 );
                int lastDot = pkg.lastIndexOf( '.' );
                pkg = lastDot != -1 ? pkg.substring( 0, lastDot ) : "";
            }
            className = ( pkg.length() > 0 ? pkg + '.' : "" ) + className.replace( '/', '.' );
            TypeDeclaration type = env.getTypeDeclaration( className );
            fileToCheck = type != null ? CompilerUtils.getSourceFile( type, false ) : null;
            if ( fileToCheck == null ) fileExists = false;
        }
        // In certain error conditions (jpfFile == null), we can't determine the file.  In this case, just ignore.
        else if ( CompilerUtils.getSourceFile( outerClass, false ) != 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 check the method if it's 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 );
        }

        //
        // 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

                String name = CompilerUtils.getString( sharedFlowRef, NAME_ATTR, true );
                TypeInstance type = CompilerUtils.getTypeInstance( sharedFlowRef, TYPE_ATTR, true );
               
                if ( type instanceof DeclaredType )   // if it's not a DeclaredType, the error will be caught elsewhere.
                {
                    TypeDeclaration typeDecl = ( ( DeclaredType ) type ).getDeclaration();
                   
                    if ( typeDecl != null )     // If the declaration is null, it's an error type.
                    {
                        _sharedFlowTypes.put( name, typeDecl );
                    }
                }
            }
        }
       
        //
        // If there's no SharedFlowController, fall back to the deprecated Global.app.
        //
        if ( _sharedFlowTypes.isEmpty() )
        {
            TypeDeclaration type = env.getTypeDeclaration( GLOBALAPP_FULL_CLASSNAME );
            if ( type != null ) _sharedFlowTypes.put( GLOBALAPP_SHARED_FLOW_NAME, type );
        }
 
        _sharedFlowTypeNames = new LinkedHashMap();
        _sharedFlowFiles = new LinkedHashMap();
       
        for ( Iterator i = _sharedFlowTypes.entrySet().iterator(); i.hasNext();
        {
            Map.Entry entry = ( Map.Entry ) i.next();
            TypeDeclaration type = ( TypeDeclaration ) entry.getValue();
            _sharedFlowTypeNames.put( entry.getKey(), type.getQualifiedName() );
            File file = CompilerUtils.getSourceFile( type, false );
           
            if ( file != null )
            {
                _sharedFlowFiles.put( entry.getKey(), file );
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.