Merge branch 'JAL-1286' into Release_2_8_1_Branch
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Thu, 7 Nov 2013 13:54:20 +0000 (13:54 +0000)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Thu, 7 Nov 2013 13:54:20 +0000 (13:54 +0000)
slightly dirty merge - JAL-1400 patches have been brought in too
Conflicts:
build.xml

build.xml
examples/applets.html
src/jalview/io/FileParse.java
test/jalview/io/FileIOTester.java
utils/InstallAnywhere/Jalview.iap_xml

index 0e13756..bf84feb 100755 (executable)
--- a/build.xml
+++ b/build.xml
                                <include name="*.jar"/>
                        </fileset>
                </delete>
-               <jar destfile="${packageDir}/${outputJar}">
+               <jar destfile="${packageDir}/${outputJar}" index="true">
                        <manifest>
                                <attribute name="Main-Class" value="jalview.bin.Jalview" />
+        <attribute name="Permissions" value="all-permissions" />
+        <!--<attribute name="Trusted-Lib" value="true" /> -->
+        <attribute name="Application-Name" value="Jalview Desktop"/>
+        <attribute name="Codebase" value="*"/>
                        </manifest>
                        <fileset dir="${outputDir}/">
                                <exclude name="cache*/**" />
                <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
                <copy todir="${outputDir}/lang">
                        <fileset dir="${resourceDir}/lang"><include name="**.*"/></fileset></copy>
-               <jar destfile="in.jar">
+               <jar destfile="in.jar" index="true">
                        <manifest>
                                <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
+                               <attribute name="Permissions" value="sandbox" /> 
+        <!--<attribute name="Trusted-Lib" value="true" /> -->
+                               <attribute name="Application-Name" value="JalviewLite Applet"/>
+                               <attribute name="Codebase" value="www.jalview.org"/>
                        </manifest>
                        <fileset dir="${outputDir}">
                                <include name="com/**" />
                      <include name="**/*"/>
                        </fileset>
          </copy>
-                       
+           <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
+           <jar update="true" index="true" jarfile="${packageDir}/examples/$(jmolJar}"/>
+    <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
+
+      <fileset dir="${packageDir}/examples">
+        <include name="*.jar" />
+      </fileset>
+    </signjar>
        </target>
        <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
         <javadoc destdir="${javadocDir}">
index c53cc7a..255f104 100755 (executable)
@@ -178,6 +178,7 @@ var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-9060947-1"]);_gaq.push(["_tr
       <td width="10%" valign="center"><applet
         code="jalview.bin.JalviewLite" width="140" height="35"
         archive="jalviewApplet.jar">
+<param name="permissions" value="sandbox">
        <param name="file" value="uniref50.fa">
         <param name="treeFile" value="ferredoxin.nw">
          <param name="userDefinedColour"
@@ -203,6 +204,7 @@ var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-9060947-1"]);_gaq.push(["_tr
       <td width="10%" valign="center"><applet
         code="jalview.bin.JalviewLite" width="140" height="35"
         archive="jalviewApplet.jar">
+<param name="permissions" value="sandbox">
        <param name="file" value="uniref50.fa">
         <param name="features" value="exampleFeatures.txt">
          <param name="showFeatureSettings" value="true">
@@ -226,6 +228,7 @@ var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-9060947-1"]);_gaq.push(["_tr
       <td width="10%" valign="center"><applet
         code="jalview.bin.JalviewLite" width="140" height="35"
         archive="jalviewApplet.jar,JmolApplet-12.2.4.jar">
+<param name="permissions" value="sandbox">
        <param name="file" value="uniref50.fa">
         <!-- <param name="debug" value="true">
                         -->
@@ -252,6 +255,7 @@ var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-9060947-1"]);_gaq.push(["_tr
       <td width="10%" valign="middle"><applet
         code="jalview.bin.JalviewLite" width="140" height="35"
         archive="jalviewApplet.jar">
+<param name="permissions" value="sandbox">
        <param name="file" value="jpred_msa.fasta">
         <param name="jnetfile" value="jpred_msa.seq.concise">
          <param name="defaultColour" value="Clustal">
@@ -284,6 +288,7 @@ var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-9060947-1"]);_gaq.push(["_tr
       <td width="10%" valign="center"><applet
         code="jalview.bin.JalviewLite" width="140" height="35"
         archive="jalviewApplet.jar">
+<param name="permissions" value="sandbox">
        <param name="file" value="RF00031_folded.stk">
         <param name="defaultColour" value="Purine/Pyrimidine">
          <param name="showAnnotation" value="true">
index f9440fa..bb52ec2 100755 (executable)
@@ -142,12 +142,35 @@ public class FileParse
     }
     if (!error)
     {
+      if (fileStr.toLowerCase().endsWith(".gz"))
+      {
+        try
+        {
+          dataIn = tryAsGzipSource(new FileInputStream(fileStr));
+          dataName = fileStr;
+          return error;
+        } catch (Exception x)
+        {
+          warningMessage = "Failed  to resolve as a GZ stream ("
+                  + x.getMessage() + ")";
+          x.printStackTrace();
+        }
+        ;
+      }
+      
       dataIn = new BufferedReader(new FileReader(fileStr));
       dataName = fileStr;
     }
     return error;
   }
-
+  private BufferedReader tryAsGzipSource(InputStream inputStream) throws Exception
+  {
+    BufferedReader inData = new BufferedReader(new InputStreamReader(new GZIPInputStream(inputStream)));
+    inData.mark(2048);
+    inData.read();
+    inData.reset();
+    return inData;
+  }
   private boolean checkURLSource(String fileStr) throws IOException,
           MalformedURLException
   {
@@ -156,14 +179,10 @@ public class FileParse
     //
     // GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via Kenny Sabir
     Exception e=null;
-    if (fileStr.endsWith(".gz")) {
+    if (fileStr.toLowerCase().endsWith(".gz")) {
       try {
           InputStream inputStream = url.openStream();
-          dataIn = new BufferedReader(new InputStreamReader(new GZIPInputStream(inputStream)));
-          dataIn.mark(2048);
-          dataIn.read();
-          dataIn.reset();
-          
+          dataIn = tryAsGzipSource(inputStream);
           dataName = fileStr;
           return false;
       } catch (Exception ex) {
index 62ce958..a2aa5da 100644 (file)
@@ -34,16 +34,42 @@ public class FileIOTester
   public static void tearDownAfterClass() throws Exception
   {
   }
-final static File ALIGN_FILE = new File("test/jalview/io/test_gz_fasta.gz");
+  final static File ALIGN_FILE = new File("test/jalview/io/test_gz_fasta.gz");
+  final static File NOTGZALIGN_FILE = new File("test/jalview/io/test_gz_fasta_notgz.gz");
 
+  private void assertValidFasta(String src, FileParse fp)
+  {
+    assertTrue("Couldn't resolve "+src+" as a valid file",fp.isValid());
+    String type = new IdentifyFile().Identify(fp);
+    assertTrue("Gzipped data from '"+src+"' identified as '"+type+"'",type.equalsIgnoreCase("FASTA"));
+  }
   @Test
   public void testGzipIo() throws IOException
   {     
     String uri;
     FileParse fp = new FileParse(uri=ALIGN_FILE.getAbsoluteFile().toURI().toString(),AppletFormatAdapter.URL);
-    assertTrue("Couldn't resolve "+uri+" as a valid file",fp.isValid());
-    String type = new IdentifyFile().Identify(fp);
-    assertTrue("Gzipped data from '"+uri+"' identified as '"+type+"'",type.equalsIgnoreCase("FASTA"));
+    assertValidFasta(uri, fp);
   }
 
+  @Test
+  public void testGziplocalFileIO() throws IOException
+  {
+    String filepath;
+    FileParse fp = new FileParse(filepath=ALIGN_FILE.getAbsoluteFile().toString(), AppletFormatAdapter.FILE);
+    assertValidFasta(filepath, fp);
+  }
+  @Test
+  public void testNonGzipURLIO() throws IOException
+  {
+    String uri;
+    FileParse fp = new FileParse(uri=NOTGZALIGN_FILE.getAbsoluteFile().toURI().toString(),AppletFormatAdapter.URL);
+    assertValidFasta(uri, fp);
+  }
+  @Test
+  public void testNonGziplocalFileIO() throws IOException
+  {
+    String filepath;
+    FileParse fp = new FileParse(filepath=NOTGZALIGN_FILE.getAbsoluteFile().toString(), AppletFormatAdapter.FILE);
+    assertValidFasta(filepath, fp);
+  }
 }
index 0416611..e34e520 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- This script was automatically generated using InstallAnywhere 2013 Professional, Build 4538
      STATUS: Fully Functional LICENSED Edition
-     DATE:   Mon Oct 21 14:27:40 BST 2013 -->
-<InstallAnywhere_Deployment_Project increments="5104">
+     DATE:   Fri Nov 01 13:57:32 GMT 2013 -->
+<InstallAnywhere_Deployment_Project increments="5103">
        <!-- ** DO NOT EDIT ** Essential authorization and configuration data ** DO NOT EDIT ** -->
        <essentialScriptInfo>
                <versionID major="15" minor="0" revision="0"/>
@@ -10,7 +10,7 @@
                <scriptID>12,42,11,85,78,76,73,67,69,78,83,69,68</scriptID>
                <buildID>3,13,71,76,105,110,117,120,44,32,50,46,54,46,51,50,45,50,55,57,46,50,50,46,49,46,101,108,54,46,120,56,54,95,54,52,44,32,97,109,100,54,52,59,32,74,97,118,97,32,49,46,55,46,48,95,50,53,44,32,79,114,97,99,108,101,32,67,111,114,112,111,114,97,116,105,111,110,44,32,104,116,116,112,58,47,47,106,97,118,97,46,111,114,97,99,108,101,46,99,111,109,47,59,32,101,110,44,32,85,110,107,110,111,119,110,59,32,73,83,79,45,56,56,53,57,45,49</buildID>
                <!-- The authorizationID may change between project saves and builds.  This does not effect the integrity of the project, nor do changes in this value represent changes in the actual InstallAnywhere project. -->
-               <authorizationID>1,0,0,64,-35,60,16,-128,80,127,118,101,93,105,116,96,121,48,48,49,56,52,67,98,113,112,112,37,82,101,96,63,55,-11,2,11,7,83,27,1,1,0,0</authorizationID>
+               <authorizationID>1,0,0,64,29,-4,96,96,80,127,118,101,93,105,116,96,121,48,48,49,56,52,67,98,113,112,112,37,82,101,96,63,55,-11,2,0,1,84,19,2,1,0,0</authorizationID>
        </essentialScriptInfo>
        <installationObjects uniqueObjects="217">
                <object class="com.zerog.ia.installer.Installer" objectID="fe7d63eda660">
@@ -4037,7 +4037,7 @@ Press "Done" to quit the installer.]]></string>
                                                                <boolean>true</boolean>
                                                        </property>
                                                        <property name="credentialInformation">
-                                                               <object class="com.flexera.ia.vapp.datastructures.VMWareCredentialInformationImpl" objectID="eeb45609a007">
+                                                               <object class="com.flexera.ia.vapp.datastructures.VMWareCredentialInformationImpl" objectID="27759feba050">
                                                                        <property name="hostName">
                                                                                <string><![CDATA[]]></string>
                                                                        </property>
@@ -4231,7 +4231,7 @@ Press "Done" to quit the installer.]]></string>
                                        </method>
                                        <method name="put">
                                                <string><![CDATA[com.zerog.ia.project.save.last.date]]></string>
-                                               <string><![CDATA[21 October 2013 14:27:40 o'clock BST]]></string>
+                                               <string><![CDATA[01 November 2013 13:57:31 o'clock GMT]]></string>
                                        </method>
                                        <method name="put">
                                                <string><![CDATA[com.zerog.ia.build.options.optimization.platform.cdrom]]></string>
@@ -6822,7 +6822,7 @@ and any path to a file to read from that file]]></string>
                                                                                                <boolean>false</boolean>
                                                                                        </property>
                                                                                        <property name="totalSize">
-                                                                                               <long>13096</long>
+                                                                                               <long>1</long>
                                                                                        </property>
                                                                                        <property name="macBinary">
                                                                                                <boolean>false</boolean>
@@ -7340,7 +7340,6 @@ and any path to a file to read from that file]]></string>
                        </visualChildren>
                        <installChildren>
                                <object refID="fe7d6493a66a"/>
-                               <object refID="ee9b98899f7a"/>
                        </installChildren>
                </object>
        </installationObjects>