Package org.jostraca.util

Examples of org.jostraca.util.RootBuildResource


          }
        }

        // test resource files
        if( proceed ) {
          RootBuildResource rbr               = new RootBuildResource();
          String[]          generatedFiles    = meta.getList( Property.jostraca_GeneratedFiles, Standard.COMMA );
          int               numGF             = generatedFiles.length;

          // this assumes that we actually want to generate files, not just compile the template
          // however, the CodeBuilder should ensure that no unnecessary compilation is done in any case
          // this logic will probably cause unnecessary reparsing of the template, but it's good to err
          // on the side of regenerating to avoid false negatives
          if( 0 == numGF ) {
            iUserMessageHandler.debug( "Not uptodate:", "no files generated previously." );
            uptodate = false;
          }

          // there were previously generated files, so we can test the resources against them for uptodateness
          else {
            String[]          tm_resourceFiles  = meta.getList( Property.jostraca_FileBuildResources, Standard.COMMA );
            int               num_tmRF          = tm_resourceFiles.length;

            File[]            cmd_resourceFiles = parseResourceFiles( tmps.get( Property.main_CodeWriterOptions ),
                                                                      tmps.get( Property.main_WorkFolder ) );
            int               num_cmdRF         = cmd_resourceFiles.length;

            // check against template
            for( int gfI = 0; gfI < numGF; gfI++ ) {
              FileBuildResource fbr = new FileBuildResource( new File( tp.getTemplatePath() ),
                                                             new File( generatedFiles[gfI] ) );
              rbr.add( fbr );
            }

            // check against template resources
            for( int rfI = 0; rfI < num_tmRF; rfI++ ) {
              for( int gfI = 0; gfI < numGF; gfI++ ) {
                FileBuildResource fbr = new FileBuildResource( new File( tm_resourceFiles[rfI] ),
                                                               new File( generatedFiles[gfI] ) );
                rbr.add( fbr );
              }
            }

            // check against cmd resources
            for( int rfI = 0; rfI < num_cmdRF; rfI++ ) {
              for( int gfI = 0; gfI < numGF; gfI++ ) {
                FileBuildResource fbr = new FileBuildResource( cmd_resourceFiles[rfI],
                                                               new File( generatedFiles[gfI] ) );
                rbr.add( fbr );
              }
            }

            uptodate = rbr.uptodate();         
            proceed  = false;

            if( uptodate ) {
              iUserMessageHandler.debug( "Uptodate:", rbr.toString() );
            }
            else {
              iUserMessageHandler.debug( "Not uptodate:", rbr.toString() );
            }
          }
        }
      }
View Full Code Here


  }


  private void recordBuildResources( Template pTemplate ) {
    try {
      RootBuildResource rbr = (RootBuildResource) pTemplate.getBuildResource();
      //t.track( "recordBuildResources.PrefixOperatorFiles", pPropertySet.get( Property.jostraca_PrefixOperatorFiles ) );
      PropertySet ps = pTemplate.getMergedPropertySet();

      // handle PrefixOperatorPSM files
      String[] psmfiles = ps.getList( Property.jostraca_PrefixOperatorFiles, Standard.COMMA );
      int      numPF    = psmfiles.length;
      String[] genfiles = ps.getList( Property.jostraca_GeneratedFiles,      Standard.COMMA );
      int      numGF    = genfiles.length;
      for( int pfI = 0; pfI < numPF; pfI++ ) {
        for( int gfI = 0; gfI < numGF; gfI++ ) {
          FileBuildResource fbr = new FileBuildResource( new File( psmfiles[pfI] ), new File( genfiles[gfI] ) );
          rbr.add( fbr );
        }
      }

      recordBuildResources( pTemplate, rbr, new HashMap() );
      //t.track( "recordBuildResources.FileBuildResources", pPropertySet.get( Property.jostraca_FileBuildResources ) );
View Full Code Here

  // public methods

  public void testToString() throws Exception {
   
    RootBuildResource root = new RootBuildResource();
    System.out.println( root.toString() );
    System.out.println( "\n-1--\n" );
   
    RootBuildResource subroot = new RootBuildResource();
    root.add( subroot );
    System.out.println( root.toString() );
    System.out.println( "\n-2--\n" );

    FileBuildResource fbr01 = new FileBuildResource( new File("a"), new File("b") );
    System.out.println( fbr01 );
    System.out.println( "\n-3--\n" );

    root.add( fbr01 );
    root.add( fbr01 );
    System.out.println( root.toString() );
    System.out.println( "\n-4--\n" );

    FileBuildResource fbr02 = new FileBuildResource( new File("c"), new File("d") );
    subroot.add( fbr02 );
    System.out.println( root.toString() );
    System.out.println( "\n-5--\n" );

  }
View Full Code Here



  public void testUptodate() throws Exception {
   
    RootBuildResource root = new RootBuildResource();
    assertTrue( root.uptodate() );
    System.out.println( root.toStringStatus() );   
    System.out.println( "\n---\n" );

    RootBuildResource subroot = new RootBuildResource();
    root.add( subroot );
    assertTrue( root.uptodate() );
    System.out.println( root.toStringStatus() );   
    System.out.println( "\n---\n" );

    RootBuildResource br01 = new RootBuildResource( true );
    root.add( br01 );
    assertTrue( root.uptodate() );
    System.out.println( root.toStringStatus() );   
    System.out.println( "\n---\n" );

    RootBuildResource br02 = new RootBuildResource( false );
    subroot.add( br02 );
    assertTrue( !root.uptodate() );
    System.out.println( root.toStringStatus() );   
    System.out.println( "\n---\n" );
View Full Code Here

          }
        }

        // test resource files
        if( proceed ) {
          RootBuildResource rbr               = new RootBuildResource();
          String[]          generatedFiles    = meta.getList( Property.jostraca_GeneratedFiles, Standard.COMMA );
          int               numGF             = generatedFiles.length;

          // this assumes that we actually want to generate files, not just compile the template
          // however, the CodeBuilder should ensure that no unnecessary compilation is done in any case
          // this logic will probably cause unnecessary reparsing of the template, but it's good to err
          // on the side of regenerating to avoid false negatives
          if( 0 == numGF ) {
            iUserMessageHandler.debug( "Not uptodate:", "no files generated previously." );
            uptodate = false;
          }

          // there were previously generated files, so we can test the resources against them for uptodateness
          else {
            String[]          tm_resourceFiles  = meta.getList( Property.jostraca_FileBuildResources, Standard.COMMA );
            int               num_tmRF          = tm_resourceFiles.length;

            File[]            cmd_resourceFiles = parseResourceFiles( tmps.get( Property.main_CodeWriterOptions ),
                                                                      tmps.get( Property.main_WorkFolder ) );
            int               num_cmdRF         = cmd_resourceFiles.length;

            // check against template
            for( int gfI = 0; gfI < numGF; gfI++ ) {
              FileBuildResource fbr = new FileBuildResource( new File( tp.getTemplatePath() ),
                                                             new File( generatedFiles[gfI] ) );
              rbr.add( fbr );
            }

            // check against template resources
            for( int rfI = 0; rfI < num_tmRF; rfI++ ) {
              for( int gfI = 0; gfI < numGF; gfI++ ) {
                FileBuildResource fbr = new FileBuildResource( new File( tm_resourceFiles[rfI] ),
                                                               new File( generatedFiles[gfI] ) );
                rbr.add( fbr );
              }
            }

            // check against cmd resources
            for( int rfI = 0; rfI < num_cmdRF; rfI++ ) {
              for( int gfI = 0; gfI < numGF; gfI++ ) {
                FileBuildResource fbr = new FileBuildResource( cmd_resourceFiles[rfI],
                                                               new File( generatedFiles[gfI] ) );
                rbr.add( fbr );
              }
            }

            uptodate = rbr.uptodate();         
            proceed  = false;

            if( uptodate ) {
              iUserMessageHandler.debug( "Uptodate:", rbr.toString() );
            }
            else {
              iUserMessageHandler.debug( "Not uptodate:", rbr.toString() );
            }
          }
        }
      }
View Full Code Here

  }


  private void recordBuildResources( Template pTemplate ) {
    try {
      RootBuildResource rbr = (RootBuildResource) pTemplate.getBuildResource();
      //t.track( "recordBuildResources.PrefixOperatorFiles", pPropertySet.get( Property.jostraca_PrefixOperatorFiles ) );
      PropertySet ps = pTemplate.getMergedPropertySet();

      // handle PrefixOperatorPSM files
      String[] psmfiles = ps.getList( Property.jostraca_PrefixOperatorFiles, Standard.COMMA );
      int      numPF    = psmfiles.length;
      String[] genfiles = ps.getList( Property.jostraca_GeneratedFiles,      Standard.COMMA );
      int      numGF    = genfiles.length;
      for( int pfI = 0; pfI < numPF; pfI++ ) {
        for( int gfI = 0; gfI < numGF; gfI++ ) {
          FileBuildResource fbr = new FileBuildResource( new File( psmfiles[pfI] ), new File( genfiles[gfI] ) );
          rbr.add( fbr );
        }
      }

      recordBuildResources( pTemplate, rbr, new HashMap() );
      //t.track( "recordBuildResources.FileBuildResources", pPropertySet.get( Property.jostraca_FileBuildResources ) );
View Full Code Here

TOP

Related Classes of org.jostraca.util.RootBuildResource

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.