Package org.apache.beehive.netui.compiler.genmodel

Examples of org.apache.beehive.netui.compiler.genmodel.GenStrutsApp


    protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
            throws IOException, FatalCompileTimeException;
   
    public void generate( ClassDeclaration publicClass )
    {
        GenStrutsApp app = null;
        getFCSourceFileInfo().startBuild( getEnv(), publicClass );
       
        try
        {
            // Write the Struts config XML, and the Validator config XML if appropriate.
            app = createStrutsApp( publicClass );
            GenValidationModel validationModel = new GenValidationModel( publicClass, app, getEnv() );
           
            if ( ! validationModel.isEmpty() )
            {
                app.setValidationModel( validationModel );
                validationModel.writeToFile();
            }
           
            generateStrutsConfig( app, publicClass );
           
            // First, write out XML for any fields annotated with @Jpf.SharedFlowField or @Control.
            writeFieldAnnotations( publicClass, app );
        }
        catch ( FatalCompileTimeException e )
        {
            e.printDiagnostic( getDiagnostics() );
        }
        catch ( Exception e )
        {
            e.printStackTrace();    // @TODO log
            assert e instanceof IOException : e.getClass().getName();
            getDiagnostics().addError( publicClass, "error.could-not-generate",
                                       app != null ? app.getStrutsConfigFile() : null, e.getMessage() );
        }
        finally
        {
            getFCSourceFileInfo().endBuild();
        }
View Full Code Here


    protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
        throws IOException, FatalCompileTimeException
    {
        File sourceFile = CompilerUtils.getSourceFile( jclass, true );
        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFCSourceFileInfo(), false, getDiagnostics() );
    }
View Full Code Here

    protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
        throws IOException, FatalCompileTimeException
    {
        File sourceFile = CompilerUtils.getSourceFile( jclass, true );
        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFCSourceFileInfo(), true, getDiagnostics() );
    }
View Full Code Here

            throws FatalCompileTimeException
    {
        //
        // Check for basic things like writability of the struts-config file.
        //
        GenStrutsApp strutsApp = null;
        File strutsConfigFile = null;
       
        //
        // Make sure we can write to the struts-config XML file.
        //
        try
        {
            strutsApp = createStrutsApp( jclass );
            strutsConfigFile = strutsApp.getStrutsConfigFile();
        }
        catch ( IOException e )
        {
            // will be reported at generate time
        }
       
        if ( strutsConfigFile != null )
        {
            getFCSourceFileInfo().addReferencedFile( strutsConfigFile );
           
            if ( strutsConfigFile.exists() && strutsApp != null && ! strutsApp.canWrite() )
            {
                getDiagnostics().addError( jclass, "error.struts-config-not-writable", strutsConfigFile );
            }
        }
       
View Full Code Here

            throws FatalCompileTimeException
    {
        //
        // Check for basic things like writability of the struts-config file.
        //
        GenStrutsApp strutsApp = null;
        File strutsConfigFile = null;
       
        //
        // Make sure we can write to the struts-config XML file.
        //
        try
        {
            strutsApp = createStrutsApp( jclass );
            strutsConfigFile = strutsApp.getStrutsConfigFile();
        }
        catch ( XmlException e )
        {
            // will be reported at generate time
        }
        catch ( IOException e )
        {
            // will be reported at generate time
        }
       
        if ( strutsConfigFile != null )
        {
            File parentDir = strutsConfigFile.getParentFile();
   
            getFCSourceFileInfo().addReferencedFile( strutsConfigFile );
           
            if ( ! parentDir.isDirectory() )
            {
                //
                // The second call to isDirectory below accounts for the possibility that another thread has created
                // the directory.  Filesystem-based double-checked-locking... works.  We don't need to have
                // compiler-wide contention around this check.
                //
                if ( ! parentDir.mkdirs() && ! parentDir.isDirectory() )
                {
                    getDiagnostics().addError( jclass, "error.invalid-parent-directory", parentDir );
                }
            }
   
            if ( strutsConfigFile.exists() && strutsApp != null && ! strutsApp.canWrite() )
            {
                getDiagnostics().addError( jclass, "error.struts-config-not-writable", strutsConfigFile );
            }
        }
       
View Full Code Here

    protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
            throws XmlException, IOException, FatalCompileTimeException;
   
    public void generate( ClassDeclaration publicClass )
    {
        GenStrutsApp app = null;
        getFCSourceFileInfo().startBuild( getEnv(), publicClass );
       
        try
        {
            // Write the Struts config XML, and the Validator config XML if appropriate.
            app = createStrutsApp( publicClass );
            GenValidationModel validationModel = new GenValidationModel( publicClass, app, getEnv() );
           
            if ( ! validationModel.isEmpty() )
            {
                app.setValidationModel( validationModel );
                validationModel.writeToFile();
            }
           
            generateStrutsConfig( app, publicClass );
           
            // First, write out XML for any fields annotated with @Jpf.SharedFlowField or @Control.
            writeFieldAnnotations( publicClass, app );
        }
        catch ( FatalCompileTimeException e )
        {
            e.printDiagnostic( getDiagnostics() );
        }
        catch ( Exception e )
        {
            e.printStackTrace();    // @TODO log
            assert e instanceof XmlException || e instanceof IOException || e instanceof FileNotFoundException
                    : e.getClass().getName();
            getDiagnostics().addError( publicClass, "error.could-not-generate",
                                       app != null ? app.getStrutsConfigFile() : null, e.getMessage() );
        }
        finally
        {
            getFCSourceFileInfo().endBuild();
        }
View Full Code Here

    protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
        throws XmlException, IOException, FatalCompileTimeException
    {
        File sourceFile = CompilerUtils.getSourceFile( jclass, true );
        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFCSourceFileInfo(), false, getDiagnostics() );
    }
View Full Code Here

    protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
        throws XmlException, IOException, FatalCompileTimeException
    {
        File sourceFile = CompilerUtils.getSourceFile( jclass, true );
        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFCSourceFileInfo(), true, getDiagnostics() );
    }
View Full Code Here

    protected abstract GenStrutsApp createStrutsApp( ClassDeclaration cl )
            throws IOException, FatalCompileTimeException;
   
    public void generate( ClassDeclaration publicClass )
    {
        GenStrutsApp app = null;
        getFCSourceFileInfo().startBuild( getEnv(), publicClass );
       
        try
        {
            // Write the Struts config XML, and the Validator config XML if appropriate.
            app = createStrutsApp( publicClass );
            GenValidationModel validationModel = new GenValidationModel( publicClass, app, getEnv() );
           
            if ( ! validationModel.isEmpty() )
            {
                app.setValidationModel( validationModel );
                validationModel.writeToFile();
            }
           
            generateStrutsConfig( app, publicClass );
           
            // First, write out XML for any fields annotated with @Jpf.SharedFlowField or @Control.
            writeFieldAnnotations( publicClass, app );
        }
        catch ( FatalCompileTimeException e )
        {
            e.printDiagnostic( getDiagnostics() );
        }
        catch ( Exception e )
        {
            e.printStackTrace();    // @TODO log
            assert e instanceof IOException : e.getClass().getName();
            getDiagnostics().addError( publicClass, "error.could-not-generate",
                                       app != null ? app.getStrutsConfigFile() : null, e.getMessage() );
        }
        finally
        {
            getFCSourceFileInfo().endBuild();
        }
View Full Code Here

    protected GenStrutsApp createStrutsApp( ClassDeclaration jclass )
        throws IOException, FatalCompileTimeException
    {
        File sourceFile = CompilerUtils.getSourceFile( jclass, true );
        return new GenStrutsApp( sourceFile, jclass, getEnv(), getFCSourceFileInfo(), true, getDiagnostics() );
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.compiler.genmodel.GenStrutsApp

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.