Subversion Repositories DevTools

Rev

Rev 906 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 906 Rev 908
Line 71... Line 71...
71
  public static final int DB_PUBLISHING = 6;
71
  public static final int DB_PUBLISHING = 6;
72
 
72
 
73
  /**package object of no consequence
73
  /**package object of no consequence
74
   * @attribute
74
   * @attribute
75
   */
75
   */
76
  static final Package NULL_PACKAGE = new Package();
76
  public static final Package NULL_PACKAGE = new Package();
77
 
77
 
78
  /**registered status
78
  /**registered status
79
   * @attribute
79
   * @attribute
80
   */
80
   */
81
  static boolean mRegistered = false;
81
  static boolean mRegistered = false;
Line 1628... Line 1628...
1628
              throw new Exception("queryPackageVersions rset3 null bsa_name " + pv_id);
1628
              throw new Exception("queryPackageVersions rset3 null bsa_name " + pv_id);
1629
            }
1629
            }
1630
 
1630
 
1631
            if ( !ignore )
1631
            if ( !ignore )
1632
            {
1632
            {
1633
              boolean supportedBuildStandard = true;
-
 
1634
              BuildStandard bs = new BuildStandard(rippleEngine);
1633
              BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
1635
 
1634
 
1636
              if ( bm_name.compareTo("Solaris") == 0 )
-
 
1637
              {
-
 
1638
                bs.setSolaris();
-
 
1639
              }
-
 
1640
              else if ( bm_name.compareTo("Win32") == 0 )
-
 
1641
              {
-
 
1642
                bs.setWin32();
-
 
1643
              }
-
 
1644
              else if ( bm_name.compareTo("Linux") == 0 )
-
 
1645
              {
-
 
1646
                bs.setLinux();
-
 
1647
              }
-
 
1648
              else if ( bm_name.compareTo("Generic") == 0 )
-
 
1649
              {
-
 
1650
                bs.setGeneric();
-
 
1651
              }
-
 
1652
              else
-
 
1653
              {
-
 
1654
                supportedBuildStandard = false;
-
 
1655
              }
-
 
1656
               
-
 
1657
              if ( bsa_name.compareTo("Production") == 0 )
-
 
1658
              {
-
 
1659
                bs.setProduction();
-
 
1660
              }
-
 
1661
              else if ( bsa_name.compareTo("Debug") == 0 )
-
 
1662
              {
-
 
1663
                bs.setDebug();
-
 
1664
              }
-
 
1665
              else if ( bsa_name.compareTo("Production and Debug") == 0 )
-
 
1666
              {
-
 
1667
                bs.setAll();
-
 
1668
              }
-
 
1669
              else if ( bsa_name.compareTo("Java 1.4") == 0 )
-
 
1670
              {
-
 
1671
                bs.set1_4();
-
 
1672
              }
-
 
1673
              else if ( bsa_name.compareTo("Java 1.5") == 0 )
-
 
1674
              {
-
 
1675
                bs.set1_5();
-
 
1676
              }
-
 
1677
              else if ( bsa_name.compareTo("Java 1.6") == 0 )
-
 
1678
              {
-
 
1679
                bs.set1_6();
-
 
1680
              }
-
 
1681
              else
-
 
1682
              {
-
 
1683
                supportedBuildStandard = false;
-
 
1684
              }
-
 
1685
               
-
 
1686
              if ( supportedBuildStandard )
1635
              if ( bs.supportedBuildStandard() )
1687
              {
1636
              {
1688
                p.mBuildStandardCollection.add(bs);
1637
                p.mBuildStandardCollection.add(bs);
1689
              }
1638
              }
1690
            }
1639
            }
1691
          }
1640
          }
Line 2170... Line 2119...
2170
              throw new Exception("queryPackageVersions rset10 null bsa_name " + pv_id);
2119
              throw new Exception("queryPackageVersions rset10 null bsa_name " + pv_id);
2171
            }
2120
            }
2172
 
2121
 
2173
            if ( !ignore )
2122
            if ( !ignore )
2174
            {
2123
            {
2175
              boolean supportedBuildStandard = true;
-
 
2176
              BuildStandard bs = new BuildStandard(rippleEngine);
2124
              BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
2177
 
2125
 
2178
              if ( bm_name.compareTo("Solaris") == 0 )
-
 
2179
              {
-
 
2180
                bs.setSolaris();
-
 
2181
              }
-
 
2182
              else if ( bm_name.compareTo("Win32") == 0 )
-
 
2183
              {
-
 
2184
                bs.setWin32();
-
 
2185
              }
-
 
2186
              else if ( bm_name.compareTo("Linux") == 0 )
-
 
2187
              {
-
 
2188
                bs.setLinux();
-
 
2189
              }
-
 
2190
              else if ( bm_name.compareTo("Generic") == 0 )
-
 
2191
              {
-
 
2192
                bs.setGeneric();
-
 
2193
              }
-
 
2194
              else
-
 
2195
              {
-
 
2196
                supportedBuildStandard = false;
-
 
2197
              }
-
 
2198
                
-
 
2199
              if ( bsa_name.compareTo("Production") == 0 )
-
 
2200
              {
-
 
2201
                bs.setProduction();
-
 
2202
              }
-
 
2203
              else if ( bsa_name.compareTo("Debug") == 0 )
-
 
2204
              {
-
 
2205
                bs.setDebug();
-
 
2206
              }
-
 
2207
              else if ( bsa_name.compareTo("Production and Debug") == 0 )
-
 
2208
              {
-
 
2209
                bs.setAll();
-
 
2210
              }
-
 
2211
              else if ( bsa_name.compareTo("Java 1.4") == 0 )
-
 
2212
              {
-
 
2213
                bs.set1_4();
-
 
2214
              }
-
 
2215
              else if ( bsa_name.compareTo("Java 1.5") == 0 )
-
 
2216
              {
-
 
2217
                bs.set1_5();
-
 
2218
              }
-
 
2219
              else if ( bsa_name.compareTo("Java 1.6") == 0 )
-
 
2220
              {
-
 
2221
                bs.set1_6();
-
 
2222
              }
-
 
2223
              else
-
 
2224
              {
-
 
2225
                supportedBuildStandard = false;
-
 
2226
              }
-
 
2227
                
-
 
2228
              if ( supportedBuildStandard )
2126
              if ( bs.supportedBuildStandard() )
2229
              {
2127
              {
2230
                p.mBuildStandardCollection.add(bs);
2128
                p.mBuildStandardCollection.add(bs);
2231
              }
2129
              }
2232
            }
2130
            }
2233
          }
2131
          }
Line 2405... Line 2303...
2405
            }
2303
            }
2406
          }
2304
          }
2407
          
2305
          
2408
          rset14.close();
2306
          rset14.close();
2409
          stmt14.close();
2307
          stmt14.close();
-
 
2308
 
-
 
2309
          // force ripple info
-
 
2310
          // an op code of 0 means force ripple
-
 
2311
          MutableInt instruction = new MutableInt();
-
 
2312
          instruction.value = 0;
-
 
2313
          MutableInt pvid = new MutableInt();
-
 
2314
          MutableInt userid = new MutableInt();
-
 
2315
          
-
 
2316
          while ( getDaemonInst( baseline, instruction, 0, pvid, userid ) )
-
 
2317
          {
-
 
2318
            Package p = findPackage(pvid.value, packageCollection);
-
 
2319
            
-
 
2320
            if ( p != NULL_PACKAGE )
-
 
2321
            {
-
 
2322
              mLogger.info("queryPackageVersions forced ripple data " + pvid.value);
-
 
2323
              p.mForcedRippleInstruction = instruction.value;
-
 
2324
            }
-
 
2325
            else
-
 
2326
            {
-
 
2327
              // discard
-
 
2328
              markDaemonInstCompleted( instruction.value );
-
 
2329
            }
-
 
2330
          }
-
 
2331
          
-
 
2332
          // test build info
-
 
2333
          // bare minimal data collection - last thing needed is more data to collect
-
 
2334
          // the approach...
-
 
2335
          // query all test build instructions for this baseline
-
 
2336
          // for each, query its build information
-
 
2337
          // store them in "mTestBuild" Package attributes as follows:
-
 
2338
          // - mTestBuildInstruction (default 0)
-
 
2339
          // - mTestBuildEmail (default "null")
-
 
2340
          // - mTestBuildLocation (default "null")
-
 
2341
          // - mTestBuildLabel (default "null")
-
 
2342
          // - mTestBuildStandardCollection
-
 
2343
          // - mTestBuildDependencyCollection
-
 
2344
          // additionally, trust nothing - these are wips that at any time may have:
-
 
2345
          // - no build location
-
 
2346
          // - no build label
-
 
2347
          // - an empty build standard collection
-
 
2348
          // proceed with defaults above if necessary (the build will subsequently fail)
-
 
2349
          // in all cases, build a meaningful email body to inform the user
-
 
2350
          // of the snapshot of build information that applied to the build and store in:
-
 
2351
          // - mTestBuildEmailBody
-
 
2352
 
-
 
2353
          // an op code of 1 means test build
-
 
2354
          instruction.value = 0;
-
 
2355
          while ( getDaemonInst( baseline, instruction, 1, pvid, userid ) )
-
 
2356
          {
-
 
2357
            // can only do one test build at a time - others will be discarded until future cycle
-
 
2358
            boolean discard = false;
-
 
2359
            mLogger.info("queryPackageVersions test build data " + pvid.value);
-
 
2360
            int testBuildPvId = pvid.value;
-
 
2361
            int testBuildInstruction = instruction.value;
-
 
2362
            String testBuildEmail = "";
-
 
2363
            CallableStatement stmt141 = mConnection.prepareCall(
-
 
2364
            "select user_email from release_manager.users where user_id=" + userid.value);
-
 
2365
            ResultSet rset141 = stmt141.executeQuery();
-
 
2366
            
-
 
2367
            while( rset141.next() )
-
 
2368
            {
-
 
2369
              testBuildEmail = rset141.getString("user_email");
-
 
2370
              
-
 
2371
              if ( testBuildEmail == null )
-
 
2372
              {
-
 
2373
                // no one to inform - discard
-
 
2374
                discard = true;
-
 
2375
              }
-
 
2376
            }
-
 
2377
            
-
 
2378
            rset141.close();
-
 
2379
            stmt141.close();
-
 
2380
 
-
 
2381
            if ( discard )
-
 
2382
            {
-
 
2383
              mLogger.error("queryPackageVersions rset141 null user_email " + userid.value);
-
 
2384
              markDaemonInstCompleted( instruction.value );
-
 
2385
            }
-
 
2386
            else
-
 
2387
            {
-
 
2388
              String pkg_name = "";
-
 
2389
              String pkg_ext = "";
-
 
2390
              String testBuildLabel = "null";
-
 
2391
              String testBuildLocation = "null";
-
 
2392
              
-
 
2393
              // get wip package info
-
 
2394
              CallableStatement stmt15 = mConnection.prepareCall(
-
 
2395
              "select p.pkg_name, pv.v_ext, pv.pkg_label, pv.src_path " +
-
 
2396
              "from release_manager.work_in_progress wip, release_manager.package_versions pv, release_manager.packages p " +
-
 
2397
              "where wip.rtag_id=" + baseline +
-
 
2398
              " and pv.pv_id=" + testBuildPvId +
-
 
2399
              " and wip.pv_id=" + testBuildPvId +
-
 
2400
              " and p.pkg_id=pv.pkg_id "
-
 
2401
              );
-
 
2402
              ResultSet rset15 = stmt15.executeQuery();
-
 
2403
              
-
 
2404
              int rsetSize = 0;
-
 
2405
               
-
 
2406
              while( rset15.next() )
-
 
2407
              {
-
 
2408
                rsetSize++;
-
 
2409
                pkg_name = rset15.getString("pkg_name");
-
 
2410
                 
-
 
2411
                if ( pkg_name == null )
-
 
2412
                {
-
 
2413
                  mLogger.fatal("queryPackageVersions rset15 null pkg_name " + testBuildPvId);
-
 
2414
                  // show stopper
-
 
2415
                  throw new Exception("queryPackageVersions rset15 null pkg_name " + testBuildPvId);
-
 
2416
                }
-
 
2417
    
-
 
2418
                pkg_ext = rset15.getString("v_ext");
-
 
2419
                 
-
 
2420
                if ( pkg_ext == null )
-
 
2421
                {
-
 
2422
                  pkg_ext = "";
-
 
2423
                }
-
 
2424
    
-
 
2425
                testBuildLabel = rset15.getString("pkg_label");
-
 
2426
                 
-
 
2427
                if ( testBuildLabel == null )
-
 
2428
                {
-
 
2429
                  testBuildLabel = "null";
-
 
2430
                }
-
 
2431
                
-
 
2432
                testBuildLocation = rset15.getString("src_path");
-
 
2433
                 
-
 
2434
                if ( testBuildLocation == null )
-
 
2435
                {
-
 
2436
                  testBuildLocation = "null";
-
 
2437
                }
-
 
2438
              }
-
 
2439
              
-
 
2440
              rset15.close();
-
 
2441
              stmt15.close();
-
 
2442
 
-
 
2443
              if ( rsetSize == 0 )
-
 
2444
              {
-
 
2445
                mLogger.error("queryPackageVersions rset15 no wip found " + instruction.value);
-
 
2446
                markDaemonInstCompleted( instruction.value );
-
 
2447
              }
-
 
2448
              else
-
 
2449
              {
-
 
2450
                Package q = findPackage(pkg_name + pkg_ext, packageCollection);
-
 
2451
                
-
 
2452
                if ( q == NULL_PACKAGE )
-
 
2453
                {
-
 
2454
                  // wip package alias does not exist in this release (planned or released packages)
-
 
2455
                  q = new Package( pkg_name, pkg_ext, pkg_name + pkg_ext, testBuildLabel, testBuildLocation, testBuildInstruction, testBuildEmail);
-
 
2456
                  packageCollection.add(q);
-
 
2457
                }
-
 
2458
                else
-
 
2459
                {
-
 
2460
                  // avoid interaction with real versions
-
 
2461
                  q.mVersion = "0.0.0000";
-
 
2462
                  q.mTestBuildLabel = testBuildLabel;
-
 
2463
                  q.mTestBuildLocation = testBuildLocation;
-
 
2464
                  q.mTestBuildInstruction = testBuildInstruction;
-
 
2465
                  q.mTestBuildEmail = testBuildEmail;
-
 
2466
                }
-
 
2467
  
-
 
2468
                // get wip package dependency info
-
 
2469
                CallableStatement stmt16 = mConnection.prepareCall(
-
 
2470
                "select p.pkg_name, dpv.v_ext " +
-
 
2471
                "from release_manager.work_in_progress wip, release_manager.package_versions pv, " +
-
 
2472
                "release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p " +
-
 
2473
                "where wip.rtag_id=" + baseline +
-
 
2474
                " and pv.pv_id=" + testBuildPvId +
-
 
2475
                " and wip.pv_id=" + testBuildPvId +
-
 
2476
                " and pd.pv_id=" + testBuildPvId +
-
 
2477
                " and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id "
-
 
2478
                );
-
 
2479
                ResultSet rset16 = stmt16.executeQuery();
-
 
2480
                  
-
 
2481
                while( rset16.next() )
-
 
2482
                {
-
 
2483
                  String dpkg_name = rset16.getString("pkg_name");
-
 
2484
                  
-
 
2485
                  if ( dpkg_name == null )
-
 
2486
                  {
-
 
2487
                    mLogger.fatal("queryPackageVersions rset16 null pkg_name " + testBuildPvId);
-
 
2488
                    // show stopper
-
 
2489
                    throw new Exception("queryPackageVersions rset16 null pkg_name " + testBuildPvId);
-
 
2490
                  }
-
 
2491
                  
-
 
2492
                  String v_ext = rset16.getString("v_ext");
-
 
2493
                  
-
 
2494
                  if ( v_ext == null )
-
 
2495
                  {
-
 
2496
                    v_ext = "";
-
 
2497
                  }
-
 
2498
      
-
 
2499
                  q.mTestBuildDependencyCollection.add(dpkg_name + v_ext);
-
 
2500
                }
-
 
2501
                
-
 
2502
                rset16.close();
-
 
2503
                stmt16.close();
-
 
2504
  
-
 
2505
                // get planned package build info
-
 
2506
                CallableStatement stmt17 = mConnection.prepareCall(
-
 
2507
                "select bm.bm_name, bsa.bsa_name " +
-
 
2508
                "from release_manager.work_in_progress wip, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa " +
-
 
2509
                "where wip.rtag_id=" + baseline +
-
 
2510
                " and wip.pv_id=" + testBuildPvId +
-
 
2511
                " and pv.pv_id=" + testBuildPvId +
-
 
2512
                " and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id "
-
 
2513
                );
-
 
2514
                ResultSet rset17 = stmt17.executeQuery();
-
 
2515
                   
-
 
2516
                while( rset17.next() )
-
 
2517
                {
-
 
2518
                  String bm_name = rset17.getString("bm_name");
-
 
2519
                   
-
 
2520
                  if ( bm_name == null )
-
 
2521
                  {
-
 
2522
                    mLogger.fatal("queryPackageVersions rset17 null bm_name " + testBuildPvId);
-
 
2523
                    // show stopper
-
 
2524
                    throw new Exception("queryPackageVersions rset17 null bm_name " + testBuildPvId);
-
 
2525
                  }
-
 
2526
                   
-
 
2527
                  String bsa_name = rset17.getString("bsa_name");
-
 
2528
                   
-
 
2529
                  if ( bsa_name == null )
-
 
2530
                  {
-
 
2531
                    mLogger.fatal("queryPackageVersions rset17 null bsa_name " + testBuildPvId);
-
 
2532
                    // show stopper
-
 
2533
                    throw new Exception("queryPackageVersions rset17 null bsa_name " + testBuildPvId);
-
 
2534
                  }
-
 
2535
      
-
 
2536
                  BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
-
 
2537
  
-
 
2538
                  if ( bs.supportedBuildStandard() )
-
 
2539
                  {
-
 
2540
                    q.mTestBuildStandardCollection.add(bs);
-
 
2541
                  }
-
 
2542
                }
-
 
2543
                
-
 
2544
                rset17.close();
-
 
2545
                stmt17.close();
-
 
2546
              }
-
 
2547
            }
-
 
2548
          }
2410
        }
2549
        }
2411
        else
2550
        else
2412
        {
2551
        {
2413
          // get released product info
2552
          // get released product info
2414
          CallableStatement stmt = mConnection.prepareCall(
2553
          CallableStatement stmt = mConnection.prepareCall(
Line 2962... Line 3101...
2962
        );
3101
        );
2963
        ResultSet rset = stmt.executeQuery();
3102
        ResultSet rset = stmt.executeQuery();
2964
         
3103
         
2965
        while( rset.next() )
3104
        while( rset.next() )
2966
        {
3105
        {
2967
          boolean supportedBuildStandard = true;
-
 
2968
          BuildStandard bs = new BuildStandard(rippleEngine);
-
 
2969
          String bm_name = rset.getString("bm_name");
3106
          String bm_name = rset.getString("bm_name");
2970
          
3107
          
2971
          if ( bm_name == null )
3108
          if ( bm_name == null )
2972
          {
3109
          {
2973
            mLogger.fatal("queryBuildInfo null bm_name " + p.mId);
3110
            mLogger.fatal("queryBuildInfo null bm_name " + p.mId);
2974
            // show stopper
3111
            // show stopper
2975
            throw new Exception("queryBuildInfo null bm_name " + p.mId);
3112
            throw new Exception("queryBuildInfo null bm_name " + p.mId);
2976
          }
3113
          }
2977
          else if ( bm_name.compareTo("Solaris") == 0 )
-
 
2978
          {
3114
          
2979
            bs.setSolaris();
-
 
2980
          }
-
 
2981
          else if ( bm_name.compareTo("Win32") == 0 )
-
 
2982
          {
-
 
2983
            bs.setWin32();
-
 
2984
          }
-
 
2985
          else if ( bm_name.compareTo("Linux") == 0 )
-
 
2986
          {
-
 
2987
            bs.setLinux();
-
 
2988
          }
-
 
2989
          else if ( bm_name.compareTo("Generic") == 0 )
-
 
2990
          {
-
 
2991
            bs.setGeneric();
-
 
2992
          }
-
 
2993
          else
-
 
2994
          {
-
 
2995
            supportedBuildStandard = false;
-
 
2996
          }
-
 
2997
           
-
 
2998
          String bsa_name = rset.getString("bsa_name");
3115
          String bsa_name = rset.getString("bsa_name");
2999
           
3116
          
3000
          if ( bsa_name == null )
3117
          if ( bsa_name == null )
3001
          {
3118
          {
3002
            mLogger.fatal("queryBuildInfo null bsa_name " + p.mId);
3119
            mLogger.fatal("queryBuildInfo null bsa_name " + p.mId);
3003
            // show stopper
3120
            // show stopper
3004
            throw new Exception("queryBuildInfo null bsa_name " + p.mId);
3121
            throw new Exception("queryBuildInfo null bsa_name " + p.mId);
3005
          }
3122
          }
3006
          else if ( bsa_name.compareTo("Production") == 0 )
-
 
3007
          {
-
 
3008
            bs.setProduction();
-
 
3009
          }
-
 
3010
          else if ( bsa_name.compareTo("Debug") == 0 )
-
 
3011
          {
-
 
3012
            bs.setDebug();
-
 
3013
          }
3123
 
3014
          else if ( bsa_name.compareTo("Production and Debug") == 0 )
3124
          BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
3015
          {
-
 
3016
            bs.setAll();
-
 
3017
          }
-
 
3018
          else if ( bsa_name.compareTo("Java 1.4") == 0 )
-
 
3019
          {
-
 
3020
            bs.set1_4();
-
 
3021
          }
-
 
3022
          else if ( bsa_name.compareTo("Java 1.5") == 0 )
-
 
3023
          {
-
 
3024
            bs.set1_5();
-
 
3025
          }
-
 
3026
          else if ( bsa_name.compareTo("Java 1.6") == 0 )
-
 
3027
          {
-
 
3028
            bs.set1_6();
-
 
3029
          }
-
 
3030
          else
-
 
3031
          {
-
 
3032
            supportedBuildStandard = false;
-
 
3033
          }
-
 
3034
           
3125
           
3035
          if ( supportedBuildStandard )
3126
          if ( bs.supportedBuildStandard() )
3036
          {
3127
          {
3037
            p.mBuildStandardCollection.add(bs);
3128
            p.mBuildStandardCollection.add(bs);
3038
          }
3129
          }
3039
        }
3130
        }
3040
        
3131
        
Line 3718... Line 3809...
3718
   * packageVersion   IN passed to Exclude_Indirect_From_Build 
3809
   * packageVersion   IN passed to Exclude_Indirect_From_Build 
3719
   * rtagId           IN passed to Exclude_Indirect_From_Build
3810
   * rtagId           IN passed to Exclude_Indirect_From_Build
3720
   * rootPvId         IN passed to Exclude_Indirect_From_Build
3811
   * rootPvId         IN passed to Exclude_Indirect_From_Build
3721
   * rootCause        IN passed to Exclude_Indirect_From_Build
3812
   * rootCause        IN passed to Exclude_Indirect_From_Build
3722
   * rootFile         IN passed to Exclude_Indirect_From_Build
3813
   * rootFile         IN passed to Exclude_Indirect_From_Build
3723
   * newSession       IN handles database connection/commit/disconnection when true
-
 
3724
   * supercede        IN checks for a row with a matching packageVersionId and rtagId when false
3814
   * supercede        IN checks for a row with a matching packageVersionId and rtagId when false
3725
   *                     such a row will prevent the execution of Exclude_Indirect_From_Build
3815
   *                     such a row will prevent the execution of Exclude_Indirect_From_Build
-
 
3816
   * testBuildInstruction IN will prevent the execution of Exclude_Indirect_From_Build when > 0
3726
   * 
3817
   * 
3727
   * returns:
3818
   * returns:
3728
   * none
3819
   * none
3729
   */
3820
   */
3730
  public void excludeFromBuild(String packageVersionId, 
3821
  public void excludeFromBuild(String packageVersionId, 
3731
                               String packageVersion, String rtagId, String rootPvId,
3822
                               String packageVersion, String rtagId, String rootPvId,
-
 
3823
                               String rootCause, String rootFile,
3732
                               String rootCause, String rootFile, boolean newSession, boolean supercede) throws SQLException, Exception
3824
                               boolean supercede, int testBuildInstruction) throws SQLException, Exception
3733
  {
3825
  {
3734
    mLogger.debug("excludeFromBuild " + packageVersionId);
3826
    mLogger.debug("excludeFromBuild " + packageVersionId);
-
 
3827
    if ( testBuildInstruction > 0 )
-
 
3828
    {
-
 
3829
      return;
-
 
3830
    }
-
 
3831
    
3735
    if ( mUseDatabase )
3832
    if ( mUseDatabase )
3736
    {
3833
    {
3737
      try
3834
      try
3738
      {
3835
      {
3739
        if ( newSession )
-
 
3740
        {
-
 
3741
          connect();
3836
        connect();
3742
        }
-
 
3743
        
3837
        
3744
        boolean exist = false;
3838
        boolean exist = false;
3745
        
3839
        
3746
        if ( !supercede )
3840
        if ( !supercede )
3747
        {
3841
        {
Line 3791... Line 3885...
3791
            // flag build failure
3885
            // flag build failure
3792
            mLogger.fatal( "excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result );
3886
            mLogger.fatal( "excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result );
3793
            throw new Exception("excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result);
3887
            throw new Exception("excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result);
3794
          }
3888
          }
3795
          stmt.close();
3889
          stmt.close();
3796
          
-
 
3797
          if ( newSession )
-
 
3798
          {
-
 
3799
            commit();
3890
          commit();
3800
          }
-
 
3801
        }
3891
        }
3802
      }
3892
      }
3803
      catch( SQLException e )
3893
      catch( SQLException e )
3804
      {
3894
      {
3805
        if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
3895
        if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
Line 3816... Line 3906...
3816
      finally
3906
      finally
3817
      {
3907
      {
3818
        // this block is executed regardless of what happens in the try block
3908
        // this block is executed regardless of what happens in the try block
3819
        // even if an exception is thrown
3909
        // even if an exception is thrown
3820
        // ensure disconnect
3910
        // ensure disconnect
-
 
3911
        disconnect();
-
 
3912
      }
-
 
3913
    }
-
 
3914
  }
-
 
3915
 
-
 
3916
  /**executes the get_daemon_inst function with the passed parameters
-
 
3917
   * returns true when an instruction exists
-
 
3918
   */
-
 
3919
  private boolean getDaemonInst(final int rtagId, MutableInt instruction, 
-
 
3920
                               final int opCode, MutableInt pvId, MutableInt userId ) throws SQLException, Exception
-
 
3921
  {
-
 
3922
    mLogger.debug("getDaemonInst " + instruction);
-
 
3923
    boolean retVal = false;
-
 
3924
    
-
 
3925
    if ( mUseDatabase )
-
 
3926
    {
-
 
3927
      try
-
 
3928
      {
-
 
3929
        CallableStatement stmt = mConnection.prepareCall( "begin ? := PK_BUILDAPI.GET_DAEMON_INST(?,?,?,?,?,?); end;" );
-
 
3930
        stmt.registerOutParameter(1, Types.INTEGER);
-
 
3931
        stmt.registerOutParameter(3, Types.INTEGER);
-
 
3932
        stmt.registerOutParameter(4, Types.INTEGER);
-
 
3933
        stmt.registerOutParameter(5, Types.INTEGER);
-
 
3934
        stmt.registerOutParameter(6, Types.INTEGER);
-
 
3935
        stmt.registerOutParameter(7, Types.INTEGER);
-
 
3936
        stmt.setInt(2, rtagId );
-
 
3937
        stmt.setInt( 3, instruction.value );
-
 
3938
        stmt.setInt( 4, opCode );
-
 
3939
        stmt.execute();
-
 
3940
        int result = stmt.getInt( 1 );
-
 
3941
        
3821
        if ( newSession )
3942
        if ( result == 1 )
3822
        {
3943
        {
-
 
3944
          retVal = true;
-
 
3945
          instruction.value = stmt.getInt( 3 );
-
 
3946
          pvId.value = stmt.getInt( 5 );
-
 
3947
          userId.value = stmt.getInt( 6 );
-
 
3948
        }
-
 
3949
        
3823
          disconnect();
3950
        stmt.close();
-
 
3951
      }
-
 
3952
      catch( SQLException e )
-
 
3953
      {
-
 
3954
        if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
-
 
3955
        {
-
 
3956
          mLogger.error("getDaemonInst database access error only");
-
 
3957
          throw new SQLException();
-
 
3958
        }
-
 
3959
        else
-
 
3960
        {
-
 
3961
          mLogger.fatal("getDaemonInst show stopper");
-
 
3962
          throw new Exception("getDaemonInst show stopper");
3824
        }
3963
        }
3825
      }
3964
      }
3826
    }
3965
    }
-
 
3966
    
-
 
3967
    return retVal;
-
 
3968
  }
-
 
3969
 
-
 
3970
  /**executes the mark_daemon_inst_in_progress function with the passed parameters
-
 
3971
   */
-
 
3972
  public void markDaemonInstInProgress(final int instruction) throws SQLException, Exception
-
 
3973
  {
-
 
3974
    mLogger.debug("markDaemonInstInProgress " + instruction);
-
 
3975
    
-
 
3976
    if ( mUseDatabase )
-
 
3977
    {
-
 
3978
      try
-
 
3979
      {
-
 
3980
        CallableStatement stmt = mConnection.prepareCall( "call PK_BUILDAPI.MARK_DAEMON_INST_IN_PROGRESS(?)" );
-
 
3981
        stmt.setInt( 1, instruction );
-
 
3982
        stmt.executeUpdate();
-
 
3983
        stmt.close();
-
 
3984
      }
-
 
3985
      catch( SQLException e )
-
 
3986
      {
-
 
3987
        if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
-
 
3988
        {
-
 
3989
          mLogger.error("markDaemonInstInProgress database access error only");
-
 
3990
          throw new SQLException();
-
 
3991
        }
-
 
3992
        else
-
 
3993
        {
-
 
3994
          mLogger.fatal("markDaemonInstInProgress show stopper");
-
 
3995
          throw new Exception("markDaemonInstInProgress show stopper");
-
 
3996
        }
-
 
3997
      }
-
 
3998
    }
-
 
3999
  }
-
 
4000
 
-
 
4001
  /**executes the mark_daemon_inst_completed function with the passed parameters
-
 
4002
   */
-
 
4003
  public void markDaemonInstCompleted(final int instruction) throws SQLException, Exception
-
 
4004
  {
-
 
4005
    mLogger.debug("markDaemonInstCompleted " + instruction);
-
 
4006
    
-
 
4007
    if ( mUseDatabase )
-
 
4008
    {
-
 
4009
      try
-
 
4010
      {
-
 
4011
        CallableStatement stmt = mConnection.prepareCall( "call PK_BUILDAPI.MARK_DAEMON_INST_COMPLETED(?)" );
-
 
4012
        stmt.setInt( 1, instruction );
-
 
4013
        stmt.executeUpdate();
-
 
4014
        stmt.close();
-
 
4015
      }
-
 
4016
      catch( SQLException e )
-
 
4017
      {
-
 
4018
        if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
-
 
4019
        {
-
 
4020
          mLogger.error("markDaemonInstCompleted database access error only");
-
 
4021
          throw new SQLException();
-
 
4022
        }
-
 
4023
        else
-
 
4024
        {
-
 
4025
          mLogger.fatal("markDaemonInstCompleted show stopper");
-
 
4026
          throw new Exception("markDaemonInstCompleted show stopper");
-
 
4027
        }
-
 
4028
      }
-
 
4029
    }
-
 
4030
  }
-
 
4031
 
-
 
4032
  /**handles database connection/disconnection
-
 
4033
   * executes the mark_daemon_inst_completed function with the passed parameters
-
 
4034
   */
-
 
4035
  public void markDaemonInstCompletedConnect(final int instruction) throws SQLException, Exception
-
 
4036
  {
-
 
4037
    mLogger.debug("markDaemonInstCompletedConnect " + instruction);
-
 
4038
    
-
 
4039
    try
-
 
4040
    {
-
 
4041
      connect();
-
 
4042
      markDaemonInstCompleted(instruction);
-
 
4043
      commit();
-
 
4044
    }
-
 
4045
    catch( SQLException e )
-
 
4046
    {
-
 
4047
      if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
-
 
4048
      {
-
 
4049
        mLogger.error("markDaemonInstCompletedConnect database access error only");
-
 
4050
        throw new SQLException();
-
 
4051
      }
-
 
4052
      else
-
 
4053
      {
-
 
4054
        mLogger.fatal("markDaemonInstCompletedConnect show stopper");
-
 
4055
        throw new Exception("markDaemonInstCompletedConnect show stopper");
-
 
4056
      }
-
 
4057
    }
-
 
4058
    finally
-
 
4059
    {
-
 
4060
      // this block is executed regardless of what happens in the try block
-
 
4061
      // even if an exception is thrown
-
 
4062
      // ensure disconnect
-
 
4063
      disconnect();
-
 
4064
    }
3827
  }
4065
  }
3828
 
4066
 
3829
  /**removes an excluded package from the do_not_ripple table
4067
  /**removes an excluded package from the do_not_ripple table
3830
   */
4068
   */
3831
  public void includeToBuild(String packageVersionId, String rtagId) throws SQLException, Exception
4069
  public void includeToBuild(String packageVersionId, String rtagId) throws SQLException, Exception
Line 5257... Line 5495...
5257
          }
5495
          }
5258
          
5496
          
5259
          // again, a null root_cause is quite acceptable
5497
          // again, a null root_cause is quite acceptable
5260
          String rootCause = rset.getString("root_cause");
5498
          String rootCause = rset.getString("root_cause");
5261
          
5499
          
-
 
5500
          // force email notification by using a zero test build instruction
5262
          BuildExclusion buildExclusion = new BuildExclusion(pvId, rootPvId, rootCause);
5501
          BuildExclusion buildExclusion = new BuildExclusion(pvId, rootPvId, rootCause, 0);
5263
          buildExclusionCollection.add(buildExclusion);
5502
          buildExclusionCollection.add(buildExclusion);
5264
        }
5503
        }
5265
 
5504
 
5266
        rset.close();
5505
        rset.close();
5267
        stmt.close();
5506
        stmt.close();