<html>
<head>
<link rel="stylesheet" href="http://dev.eclipse.org/default_style.css">
<title>Eclipse SOA Tools Platform (STP) Downloads</title>
</head>
<body>

<!-- heading start -->
<?php

?>


<?

// we will do our own error handling
error_reporting(0);
$logging_file="/home/data/httpd/writable/stp/phplogs/downloadsphplog.log";

// user defined error handling function
function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
{
   // timestamp for the error entry
   $dt = date("Y-m-d H:i:s (T)");

   // define an assoc array of error string
   // in reality the only entries we should
   // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
   // E_USER_WARNING and E_USER_NOTICE
   $errortype = array (
               E_ERROR          => "Error",
               E_WARNING        => "Warning",
               E_PARSE          => "Parsing Error",
               E_NOTICE          => "Notice",
               E_CORE_ERROR      => "Core Error",
               E_CORE_WARNING    => "Core Warning",
               E_COMPILE_ERROR  => "Compile Error",
               E_COMPILE_WARNING => "Compile Warning",
               E_USER_ERROR      => "User Error",
               E_USER_WARNING    => "User Warning",
               E_USER_NOTICE    => "User Notice",
               E_STRICT          => "Runtime Notice"
               );
   // set of errors for which a var trace will be saved
   $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);

   $err = "<errorentry>\n";
   $err .= "\t<datetime>" . $dt . "</datetime>\n";
   $err .= "\t<errornum>" . $errno . "</errornum>\n";
   $err .= "\t<errortype>" . $errortype[$errno] . "</errortype>\n";
   $err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";
   $err .= "\t<scriptname>" . $filename . "</scriptname>\n";
   $err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";

   if (in_array($errno, $user_errors)) {
       $err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
   }
   $err .= "</errorentry>\n\n";

   // for testing
   // echo "Debug Error: $err";

   // save to the error log, and e-mail me if there is a critical user error
   error_log($err, 3, $logging_file);
   if ($errno == E_USER_ERROR) {
      mail("naci.dai@eteration.com", "PHP Downloads page Critical User Error", $err);
   }
}


$old_error_handler = set_error_handler("userErrorHandler");

?>

<?
     $QString = $_SERVER['QUERY_STRING'];
     $C = strcmp($QString, "test");
     if ($C == 0) {
      //  error_log("page started with  'test'\n", 3, $logging_file);
     }
 ?>


<table border=0 cellpadding=2 width="100%">
    <tr>
        <td width="72%"><font class=indextop> SOA Tools Platform<br>
        downloads</font> <br>
        <font class=indexsub> latest downloads from the SOA Tools Platform project</font><br>
        </td>
        <td width="14%"><img
            src="http://dev.eclipse.org/images/Idea.jpg" height=86
            width=120></td>
        <td width="14%"><a href="http://www.eclipse.org/projects/what-is-incubation.php"><img
              align="right" src="http://www.eclipse.org/images/egg-incubation.png"
              border="0" alt="Incubation" /></a></td>       
    </tr>
</table>

<!-- heading end -->

<hr />
<table border=0 cellpadding=2 width="100%">
    <tr>
        <td>
        <p>This is the starting page for where you can find the latest
        <a href="http://download.eclipse.org/stp/downloads/build_types.html">declared build</a> produced by the <a
            href="http://www.eclipse.org/stp">Eclipse
        SOA
Tools Platform (STP) Project</a>. Please note that each declared-build page details the
        pre-reqs for that particular build.</p>

        <p>As an alternative to downloading zips from the build pages, our released builds can be
        <a
            href="http://download.eclipse.org/stp/updates/">installed via
        Update Manager</a>, from an existing installation of Eclipse.</p>
    </tr>
    <tr>
        <td  colspan="2" bgcolor="#0080C0"><b><font
            color="#FFFFFF" face="Arial,Helvetica">Latest Downloads</font></b></td>
    </tr>



</table>

<p> Owing to the migration of the STP to Subversion in Q4 2007, there is no download page for the 0.7.0.200711162004 which is the version that shipped with the fall update. This is due to the fact the build system had to be migrated over.  However, here is a link to the All In One zip file.</p>

<a href="http://download.eclipse.org/stp/downloads/stp-all-in-one-incubation-0.7.0.200711162004.zip">STP 0.7.0.200711162004 All In One</a>

<?php

//$fileHandle = fopen("dlconfig.txt", "r");
//while (!feof($fileHandle)) {
//
//        $aLine = fgets($fileHandle, 4096);
//        parse_str($aLine);
//
//
//}

//fclose($fileHandle);

// fix for next version of php

       $contents = substr(file_get_contents('dlconfig.txt'),0,-1);
       $contents = str_replace("\n", "", $contents);

        #split the content file by & and fill the arrays
        $elements = explode("&",$contents);
        $t = 0;
        $p = 0;
        for ($c = 0; $c < count($elements)-1; $c++) {
                $tString = "dropType";
                $pString = "dropPrefix";
                if (strstr($elements[$c],$tString)) {
                   $temp = preg_split("/=/",$elements[$c]);
                   $dropType[$t] = trim($temp[1]);
                   $t++;
                }
                if (strstr($elements[$c],$pString)) {
                   $temp = preg_split("/=/",$elements[$c]);
                   $dropPrefix[$p] = trim($temp[1]);
                   $p++;
                }
        }

// debug
// echo "Debug: droptype count: ", count($dropType), "<br />";

for ($i = 0; $i < count($dropType); $i++) {
        $dt = $dropType[$i];
        $dt = trim($dt);
        $typeToPrefix[$dt] = $dropPrefix[$i];

                                // echo "Debug prefix: ", $dropPrefix[$i], "<br />";
                                // echo "Debug dropType: ", $dropType[$i], "<br />";

}



$aDirectory = dir("drops");

while (false !== ($anEntry = $aDirectory->read())) {

        // Short cut because we know aDirectory only contains other directories.
        if ($anEntry != "." && $anEntry!=".." ) {
                //echo "Debug anEntry: $anEntry<br />" ;
                $aDropDirectoryName = "drops/".$anEntry;
                if (is_Readable($aDropDirectoryName)) {
                        $aDropDirectory = dir($aDropDirectoryName);
                        //echo "Debug aDropDirectory: $aDropDirectory->path <br />" ;

                        $fileCount = 0;
                        while ($aDropEntry = $aDropDirectory->read()) {
                             // echo "Debug aDropEntry: $aDropEntry<br />" ;
                             if ( (stristr($aDropEntry, ".tar.gz")) || (stristr($aDropEntry, ".zip")) )  {
                                        // Count the dropfile entry in the directory (so we won't display links, if not all there
                                        $fileCount = $fileCount + 1;
                                }
                        }

                        $aDropDirectory->close();
                }
                // Read the count file
                $countFile = "drops/".$anEntry."/files.count";
                $indexFile = "drops/".$anEntry."/index.html";


                if (!file_exists($indexFile)) {
                        $indexFile = "drops/".$anEntry."/index.php";
                }

                $latestTimeStamp = array();
                $latestFile = array();

                if (file_exists($countFile) && file_exists($indexFile)) {
                        $anArray = file($countFile);
                        // debug
                        //echo "Number according to files.count: ", $anArray[0];
                        //echo "   actual counted files: ", $fileCount;

                        // If a match - process the directoryVV
                       if ($anArray[0] == $fileCount) {
                                // debug
                                //echo "yes, counted equaled expected count<br>";

                                $parts = explode("-", $anEntry);
                                if (count($parts) == 3) {
                                // debug
                                //echo "yes, counted parts was 3<br>";
                                        $buckets[$parts[0]][] = $anEntry;

                                        $timePart = $parts[2];
                                        $year = substr($timePart, 0, 4);
                                        $month = substr($timePart, 4, 2);
                                        $day = substr($timePart, 6, 2);
                                        $hour = substr($timePart,8,2);
                                        $minute = substr($timePart,10,2);
                                        $timeStamp = mktime($hour, $minute, 0, $month, $day, $year);

                                        $timeStamps[$anEntry] = date("D, j M Y -- H:i \(\U\T\C\)", $timeStamp);

                                        if (sizeof($latestTimeStamp) > 0) {
                                        if ($timeStamp > $latestTimeStamp[$parts[0]]) {
                                                $latestTimeStamp[$parts[0]] = $timeStamp;
                                                $latestFile[$parts[0]] = $anEntry;
                                        }
                                        }
                                }

                      }
                }

        }
}

$aDirectory->close();

?>


<TABLE width="100%" CELLPADDING=2>
    <tr>
        <td width=\"30%\"><b>Build Type</b></td>
        <td><b>Build Name</b></td>
        <td><b>Build Date</b></td>
    </tr>



    <?php
                foreach($dropType as $value) {
                        $prefix=$typeToPrefix[$value];

                         if (array_key_exists($prefix, $latestFile)) {
                                $fileName = $latestFile[$prefix];
                                echo "<tr>
                                <td width=\"30%\">$value</td>";

                                $parts = explode("-", $fileName);

                                if (sizeof($parts) > 1) {
                                // Uncomment the line below if we need click through licenses.
                                // echo "<td><a href=license.php?license=drops/$fileName>$parts[1]</a></td>";

                                // Comment the line below if we need click through licenses.
                                echo "<td><a href=\"drops/$fileName/\">$parts[1]</a></td>";

                                echo "<td>$timeStamps[$fileName]</td>";
                                echo "</tr>";
                        }
                        }
                }
                ?>


</TABLE>



<?php


                 include 'report.php';
                 foreach($dropType as $value) {
                         $prefix=$typeToPrefix[$value];


                         echo "
                         <table width=\"100%\" cellpadding=2>
                         <tr bgcolor=\"#999999\">
                         <td align=left width=\"30%\"><b><a name=\"$value\"><font color=\"#FFFFFF\" face=\"Arial,Helvetica\">$value";
                         echo "</font></a></b></td>
                         </TR>
                         <TR>
                         <td align=left>
                         <TABLE  width=\"100%\" CELLPADDING=2>
                         <tr>
                         <td width=\"30%\"><b>Build Name</b></td>
                         <td><b>Build Date</b></td>
                         </tr>";

                        if (array_key_exists($prefix, $buckets)) {
                         $aBucket = $buckets[$prefix];
                         if (isset($aBucket)) {
                                rsort($aBucket);

                                $i = 0;
                                $ts = array();
                                $ts2iv = array();
                                foreach($aBucket as $iv) {
                                        $parts = explode("-", $iv);
                                        $ts[$i] = $parts[2];
                                        $ts2iv[$ts[$i]] = $iv;
                                        $i++;
                                }

                                rsort($ts);
                                $i = 0;
                                $aBucket = array();
                                foreach($ts as $tsvalue) {
                                        $aBucket[$i] = $ts2iv[$tsvalue];
                                        $i++;
                                }

                                foreach($aBucket as $innerValue) {
                                         $parts = explode("-", $innerValue);
                                         echo "<tr>";

                                         // Uncomment the line below if we need click through licenses.
                                         // echo "<td><a href=\"license.php?license=drops/$innerValue\">$parts[1]</a></td>";

                                         // Comment the line below if we need click through licenses.
                                         echo "<td><a href=\"drops/$innerValue/\">$parts[1]</a></td>";

                                         echo "<td>$timeStamps[$innerValue]</td>";

                                         $testResults = parse_testResult("drops/$innerValue/testResults.php");
                                         list ($compileErrors, $compileWarnings, $junitFailures) = $testResults;
                                         $violations = parse("drops/$innerValue/apitools/index.xml", "count=\"");
                                         $tc = parse("drops/$innerValue/apitools/index-api-tc.xml", "missing-coverage-count=\"");
                                        // $removed_apis = parse("drops/$innerValue/apitools/index-api-compatibility.xml", "removed-api-count=\"");

                                         echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/compile_err.gif\" width=\"16\" height=\"16\"/><font color=red>$compileErrors</font></td>";
                                         echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/compile_warn.gif\" width=\"16\" height=\"16\"/><font color=orange>$compileWarnings</font></td>";
                                         echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/junit_err.gif\" width=\"16\" height=\"16\"/><font color=red>$junitFailures</font></td>";
                                         echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/api_err.gif\" width=\"20\" height=\"16\"/><font color=red>$violations</font></td>";
                                         echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/api_junit.gif\"/ width=\"16\" height=\"16\"/><font color=red>$tc</font></td>";
                                        // echo "<td width=\"50\"><img src=\"http://download.eclipse.org/stp/downloads/api_removed.gif\" width=\"20\" height=\"16\"/><font color=red>$removed_apis</font></td>";

                                         echo "</tr>";
                                }
                            }}
                       echo "</table></table>";
                }

?>




<table border="0" width="100%" cellpadding="2">
    <tbody>
        <tr>
            <td valign="top">
            <table border="0" cellpadding="2">
                <tbody>
                    <tr>
                        <td width="100%" bgcolor="#0080c0" valign="top"><b><font
                            face="Arial,Helvetica"><font color="#ffffff">Download
                        Related Links</font> </font></b></td>
                    </tr>
                    <tr>
                        <td valign="top">
                        <p><a
                            href="http://download.eclipse.org/stp/committers/"
                            target="_top">Continuous Builds</a> are
                        produced since the last declared build, but are
                        generally not tested and of interest only to
                        committers and early testers.</p>
                        </td>
                    </tr>
                </tbody>
            </table>
            </td>
            <td width="350" valign="top">
            <table border="0" cellpadding="2">
                <tbody>
                    <tr>
                        <td width="100%" colspan="4" bgcolor="#0080c0"
                            valign="top"><b><font face="Arial,Helvetica"><font
                            color="#ffffff">Metrics Legend</font> </font></b></td>
                    </tr>




                    <tr>
                        <td valign="top"><img src="http://download.eclipse.org/stp/downloads/compile_err.gif" /></td>
                        <td width="50%">compilation errors.</td>
                        <td valign="top"><img src="http://download.eclipse.org/stp/downloads/compile_warn.gif" /></td>
                        <td width="50%">compilation warnings.</td>
                    </tr>
                    <tr>
                        <td valign="top"><img src="http://download.eclipse.org/stp/downloads/junit_err.gif" /></td>
                        <td width="50%">junit failures.</td>
                        <td valign="top"><img src="http://download.eclipse.org/stp/downloads/api_err.gif" /></td>
                        <td width="50%">API violations.</td>
                    </tr>
                    <tr>
                        <td valign="top"><img src="http://download.eclipse.org/stp/downloads/api_junit.gif" /></td>
                        <td width="50%">APIs without junit testcases.</td>
                        <td valign="top"><font class="indexsub"> <img
                            src="http://download.eclipse.org/stp/downloads/api_removed.gif" /></font></td>
                        <td width="50%">removed APIs.</td>
                    </tr>




                </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>




<!-- footer -->
<center>
<hr />
<p>All downloads are provided under the terms and conditions of the <a
    href="http://www.eclipse.org/legal/notice.html">Eclipse.org Software
User Agreement</a> unless otherwise specified.</p>

<p>If you have problems downloading the drops, contact the <font
    size="-1" face="arial,helvetica,geneva"><a
    href="mailto:webmaster@eclipse.org">webmaster</a></font>.</p>
</center>
<!-- end footer -->


</body>
</html>
<?
if (isset($old_error_handler) && sizeof($old_error_handler)) {
        set_error_handler($old_error_handler);
}
?>