Author: pwang
Date: 2008-09-02 13:30:31 -0700 (Tue, 02 Sep 2008)
New Revision: 14817

Modified:
   cyto_web/trunk/plugins/pluginPropsUtil.inc
Log:
Check Java version to make sure plugins are complied with Java 1.5 or less

Modified: cyto_web/trunk/plugins/pluginPropsUtil.inc
===================================================================
--- cyto_web/trunk/plugins/pluginPropsUtil.inc  2008-09-02 20:03:46 UTC (rev 
14816)
+++ cyto_web/trunk/plugins/pluginPropsUtil.inc  2008-09-02 20:30:31 UTC (rev 
14817)
@@ -352,6 +352,7 @@
 // Then check if any line start with "Cytoscape-Plugin"
 function validateManifestFile($zipFileName) {
        $retValue = false;
+       $javaVersion_tooHigh = false;
        $zip = zip_open($zipFileName);
        if ($zip) {
                while ($zip_entry = zip_read($zip)) {
@@ -369,8 +370,16 @@
                                                if ((!empty($cur_line))&& 
stristr($cur_line,'Cytoscape-Plugin') == $cur_line) {
                                                        //echo "MANIFEST.MF: 
Found attribute Cytoscape-Plugin<br>";
                                                        $retValue = true;
-                                                       break;
+                                                       //break;
                                                }       
+                                               if ((!empty($cur_line))&& 
stristr($cur_line,'Created-By') == $cur_line) {
+                                                       //echo "MANIFEST.MF: 
Found attribute Created-By<br>";
+                                                       // check Java Version
+                                                       $javaVersion = 
substr($cur_line, 12,3); //example: Created-By: 1.5.0_12-b04 (Sun Microsystems 
Inc.)
+                                                       if (trim($javaVersion 
>1.5)) {
+                                                               
$javaVersion_tooHigh = true;
+                                                       }
+                                               }       
                                        }
                                }
                                break;
@@ -382,15 +391,24 @@
                //failed to open the zip file
        }
 
-       if ($retValue == false) {
+       if ($retValue == false && $javaVersion_tooHigh == false) {
        ?>
        <br><b>Error</b>: MANIFEST.MF is either missing or the attribute 
Cytoscape-Plugin is not defined.       
                 <br>Please check the definition of Cytoscape plugin 
MANIFEST.MF at <a 
href="http://www.cytoscape.org/cgi-bin/moin.cgi/Cytoscape_Plugin_Tutorial";>Cytoscape
 wiki</a> for detail. </p>
                 <br><br>
-
        <?php
        }
 
+       if ($javaVersion_tooHigh == true) {
+               ?>
+       <br><b>Error</b>: Plugin should be compiled with Java 1.5 or less.      
+                <br><br>                       
+               <?php
+               $retValue = false;
+       }
+
+
+
        return $retValue;
 } // end of validateManifestFile()
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to