WSTester updated to work plus hopefully all the other changes that need to go into...
[jabaws.git] / webservices / compbio / ws / client / Jws2Client.java
index a06a6fa..ae38d9f 100644 (file)
@@ -50,7 +50,6 @@ import compbio.data.msa.RegistryWS;
 import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.RNAstruct;\r
 import compbio.data.sequence.ScoreManager;\r
 import compbio.data.sequence.ClustalAlignmentUtil;\r
 import compbio.data.sequence.SequenceUtil;\r
@@ -150,7 +149,6 @@ public class Jws2Client {
                String presetName = CmdHelper.getPresetName(cmd);\r
 \r
                Metadata<T> msaws = (Metadata<T>) connect(hostname, service);\r
-               Metadata<T> foldws = (Metadata<T>) connect(hostname, service);\r
                Preset<T> preset = null;\r
                if (presetName != null) {\r
                        preset = MetadataHelper.getPreset(msaws, presetName);\r
@@ -164,7 +162,6 @@ public class Jws2Client {
 //             System.out.println("The Options read from the command line: " + customOptions);\r
                \r
                Alignment alignment = null;\r
-               String rnastruct = null;\r
                if (inputFile != null) {\r
                        Writer writer = null;\r
                        if (outFile != null) {\r
@@ -178,17 +175,14 @@ public class Jws2Client {
                                ScoreManager result = analize(inputFile,\r
                                                ((SequenceAnnotation<T>) msaws), preset, customOptions);\r
 \r
+                               // A System.out.println just for testing!\r
+                               System.out.println(result.toString());\r
+                               \r
                                IOHelper.writeOut(writer, result);\r
                        } else if (service.getServiceType() == MsaWS.class) {\r
                                alignment = align(inputFile, (MsaWS<T>) msaws, preset,\r
                                                customOptions);\r
                                IOHelper.writeOut(writer, alignment);\r
-                       } else if (service.getServiceType() == FoldWS.class) {\r
-                               rnastruct = fold(inputFile, (FoldWS<T>) foldws, preset, customOptions);\r
-                               // No IOHelper method for rnastruct/String yet\r
-                               if (writer != null) {\r
-                                       writer.write(rnastruct);\r
-                               }\r
                        }\r
                        writer.close();\r
                }\r
@@ -537,60 +531,60 @@ public class Jws2Client {
         * @return String\r
         */\r
        \r
-       static <T> String fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
-                       List<Option<T>> customOptions) {\r
-               FileInputStream instream = null;\r
-               Alignment alignment = null;\r
-               String rnastruct = null;\r
-               try {\r
-                       instream = new FileInputStream(file);\r
-                       alignment = ClustalAlignmentUtil.readClustalFile(instream);\r
-                       instream.close();\r
-                       String jobId = null;\r
-                       if (customOptions != null && preset != null) {\r
-                               System.out.println("WARN: Parameters (-f) are defined together"\r
-                                               + "with a preset (-r), ignoring preset! ");\r
-                       }\r
-                       if (customOptions != null) {\r
-                               jobId = foldws.customFold(alignment, customOptions);\r
-                       } else if (preset != null) {\r
-                               jobId = foldws.presetFold(alignment, preset);\r
-                       } else {\r
-                               jobId = foldws.fold(alignment);\r
-                       }\r
-                       System.out.println("\n\ncalling fold.........");\r
-                       Thread.sleep(1000);\r
-                       rnastruct = foldws.getResult(jobId);\r
-                               \r
-               } catch (IOException e) {\r
-                       System.err.println("Exception while reading the input file. Exception details: ");\r
-                       e.printStackTrace();\r
-               } catch (UnknownFileFormatException e) {\r
-                       System.err.println("Exception while reading input file. Doesnt look like a Clustal format file");\r
-                       e.printStackTrace();\r
-               } catch (JobSubmissionException e) {\r
-                       System.err.println("Exception while submitting job to the web server. ");\r
-                       e.printStackTrace();\r
-               } catch (ResultNotAvailableException e) {\r
-                       System.err.println("Exception while waiting for results. Exception details: ");\r
-                       e.printStackTrace();\r
-               } catch (InterruptedException ignored) {\r
-                       // ignore and propagate an interruption\r
-                       Thread.currentThread().interrupt();\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-               } finally {\r
-                       if (instream != null) {\r
-                               try {\r
-                                       instream.close();\r
-                               } catch (IOException ignored) {\r
-                                       // ignore\r
-                               }\r
-                       }\r
-               }\r
-               return rnastruct;\r
-       }\r
-               \r
+//     static <T> String fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
+//                     List<Option<T>> customOptions) {\r
+//             FileInputStream instream = null;\r
+//             Alignment alignment = null;\r
+//             String rnastruct = null;\r
+//             try {\r
+//                     instream = new FileInputStream(file);\r
+//                     alignment = ClustalAlignmentUtil.readClustalFile(instream);\r
+//                     instream.close();\r
+//                     String jobId = null;\r
+//                     if (customOptions != null && preset != null) {\r
+//                             System.out.println("WARN: Parameters (-f) are defined together"\r
+//                                             + "with a preset (-r), ignoring preset! ");\r
+//                     }\r
+//                     if (customOptions != null) {\r
+//                             jobId = foldws.customFold(alignment, customOptions);\r
+//                     } else if (preset != null) {\r
+//                             jobId = foldws.presetFold(alignment, preset);\r
+//                     } else {\r
+//                             jobId = foldws.fold(alignment);\r
+//                     }\r
+//                     System.out.println("\n\ncalling fold.........");\r
+//                     Thread.sleep(1000);\r
+//                     rnastruct = foldws.getResult(jobId);\r
+//                             \r
+//             } catch (IOException e) {\r
+//                     System.err.println("Exception while reading the input file. Exception details: ");\r
+//                     e.printStackTrace();\r
+//             } catch (UnknownFileFormatException e) {\r
+//                     System.err.println("Exception while reading input file. Doesnt look like a Clustal format file");\r
+//                     e.printStackTrace();\r
+//             } catch (JobSubmissionException e) {\r
+//                     System.err.println("Exception while submitting job to the web server. ");\r
+//                     e.printStackTrace();\r
+//             } catch (ResultNotAvailableException e) {\r
+//                     System.err.println("Exception while waiting for results. Exception details: ");\r
+//                     e.printStackTrace();\r
+//             } catch (InterruptedException ignored) {\r
+//                     // ignore and propagate an interruption\r
+//                     Thread.currentThread().interrupt();\r
+//             } catch (WrongParameterException e) {\r
+//                     e.printStackTrace();\r
+//             } finally {\r
+//                     if (instream != null) {\r
+//                             try {\r
+//                                     instream.close();\r
+//                             } catch (IOException ignored) {\r
+//                                     // ignore\r
+//                             }\r
+//                     }\r
+//             }\r
+//             return rnastruct;\r
+//     }\r
+//             \r
        /**\r
         * Prints Jws2Client usage information to standard out\r
         * \r