Changeset 3240


Ignore:
Timestamp:
Apr 12, 2007, 1:01:22 PM (15 years ago)
Author:
dominic
Message:

added comments and close method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/tab2mage_ebi/src/plugins/core/net/sf/basedb/plugins/Tab2MageWriter.java

    r3229 r3240  
    22
    33import java.io.BufferedWriter;
     4import java.io.IOException;
    45import java.io.OutputStreamWriter;
    56import java.io.UnsupportedEncodingException;
     
    5556      new BaseException(e);
    5657    }
    57     //statusOut.write(" Please check the messages below for the status of the export");
     58   
    5859  }
    5960 
    6061  /**
    6162      writes the tab2mage file
    62       @param experiment, the experiment to export which wasselected by the user on the GUI
    63       @param protocols, the protocls used wthin the experiment
    64       @param hybSectionHeader, a set containing the hybridization section headers
    65       @param hybDataRows, list of hybridization data rows
    66       @param job, the job parameter values
    67       @param response, the reasponse object
    68       @param dc, the client database control object
    69    */
    70   //  not checking for null parameters here, it is assumed it been catered for in the calling metthod
    71   public static void writeTab2MageFile(Experiment experiment, Set<Protocol> protocols, Set<String> hybSectionHeader,  List<String> hybDataRows,
    72                   ParameterValues job, Response response, DbControl dc)
     63      @param experiment
     64      @param protocols
     65      @param hybSectionHeader
     66      @param hybDataRows
     67      @param job
     68      @param response
     69      @param dc
     70   */
     71  //  not checking for null parameters here, it is assumed it's been catered for in the calling method
     72  public static void writeTab2MageFile(Experiment experiment, Set<Protocol> protocols, Set<String> hybSectionHeader, 
     73                  List<String> hybDataRows, ParameterValues job, Response response, DbControl dc)
    7374  {
    7475    /*
     
    8990   
    9091  }
    91  
     92  /**
     93    writes Tab2Mage experiment section
     94    @param experiment, the experiment to write
     95    @param response, the reponse object to reytun failures or expceptions
     96    @param job, the job parameter values for the plugin
     97   */
    9298  private static void writeTab2MageExperimentSection(Experiment experiment, ParameterValues job, Response response)
    9399  {
    94100    try
    95101    {
     102      statusOut.write(" Please check the messages below for the status of the export"); //not part of experiment and may be moved elsewhere.
     103     
    96104      out.write("# This file contains an experiment exported in tab2mage specification from BASE\n\n");
    97105      out.write("Experiment section \n");
     
    123131      response.setError(ex.getMessage(), Arrays.asList(ex));
    124132    }
    125     finally
    126     {
    127      
    128     }
    129   }
    130  
     133  }
     134  /**
     135    writes Tab2Mage protocol section
     136    @param protocols, list of protocols to write
     137    @param response, the reponse object to return failures or exceptions
     138    @param dc, database control object
     139   */
    131140  private static void writeTab2MageProtocolSection(Set<Protocol> protocols, DbControl dc, Response response)
    132141  {
     
    167176      response.setError(ex.getMessage(), Arrays.asList(ex));
    168177    }
    169     finally
    170     {
    171      
    172     }
    173   }
    174   /**
    175      Tab2Mage Hybridization  Header Section
     178  }
     179  /**
     180     writes Tab2Mage hybridization  header section
    176181     @param hybSectionHeader, the header to display
    177      @param response, the reponse object to reytun failures
     182     @param response, the reponse object to reytun failures or expceptions
    178183   */
    179184
     
    189194      }
    190195      out.write("\n");
    191     }
    192     catch(Throwable ex)
    193     {
    194       response.setError(ex.getMessage(), Arrays.asList(ex));
    195     }
    196    
     196      out.flush();
     197    }
     198    catch(Throwable ex)
     199    {
     200      response.setError(ex.getMessage(), Arrays.asList(ex));
     201    }
    197202  }
    198203 
    199204  /**
    200205     Tab2Mage Hybridization  Channel Line Section
    201      @param hybSectionHeader, the header to display
    202      @param response, the reponse object to return failures
     206     @param hybDataRow, the data rows to display
     207     @param response, the reponse object to return failures or expceptions
    203208   */
    204209
     
    220225      }
    221226      out.write("\n");
     227      out.flush();
    222228    }
    223229    catch(Throwable ex)
     
    227233   
    228234  }
     235 
     236  /**
     237    closes the file writers
     238   */
     239  public static void closeWriter()
     240  {
     241    try
     242    {
     243      if (out!= null) out.close();
     244      if (statusOut!=null) statusOut.close();
     245    }
     246    catch(Throwable ex)
     247    {
     248      new IOException(ex.getMessage());
     249    }
     250  }
     251 
    229252  /**
    230253   gets the file writer for the tab2mage file
     
    251274  }
    252275 
    253  
    254276}
Note: See TracChangeset for help on using the changeset viewer.