Project

General

Profile

« Previous | Next » 

Revision 1515

Added by Jing Tao over 21 years ago

Move a methods

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
972 972
          // for inline data, the data base only store the file name, so we
973 973
          // can combine the file name and inline data file path, to get it
974 974
          String fileName = currentNode.nodedata;
975
          String content = readInlineDataFromFileSystem(fileName);
975
          String content = EmlSAXHandler.readInlineDataFromFileSystem(fileName);
976 976
          out.print(content);
977 977
        }
978 978
        // reset proccess inline data false
......
1019 1019
    out.flush();
1020 1020
  }
1021 1021
  
1022
  /* In eml2, the inline data wouldn't store in db, it store in file system
1023
   * The db stores file name(without path).
1024
   */
1025
  private String readInlineDataFromFileSystem(String fileName) 
1026
                                              throws McdbException
1027
  {
1028
    String data = null;
1029
    String path = MetaCatUtil.getOption("inlinedatafilepath");
1030
    // the new file name will look like path/docid.rev.2
1031
    File inlineDataDirectory = new File(path);
1032
    File dataFile = new File(inlineDataDirectory, fileName);
1033
    try
1034
    {
1035
      FileReader fileReader = new FileReader(dataFile);
1036
      BufferedReader stringReader = new BufferedReader(fileReader);
1037
      // read first line of data
1038
      String tmp = stringReader.readLine();
1039
      // pass first line data to data varible
1040
      data = tmp;
1041
      // at the end tmp will be null
1042
      while (tmp != null)
1043
      {
1044
        // read a new line
1045
        tmp = stringReader.readLine();
1046
        // append new line to data
1047
        if (tmp != null)
1048
        {
1049
          data = data+tmp;
1050
        }
1051
      }
1052
      
1053
    }
1054
    catch (Exception e)
1055
    {
1056
      throw new McdbException(e.getMessage());
1057
    }
1058
    MetaCatUtil.debugMessage("the inline data retrieve from file: "+data, 50);
1059
    return data;
1060
  }
1022

  
1061 1023
  
1062 1024
  private boolean isRevisionOnly(DocumentIdentifier docid) throws Exception
1063 1025
  {

Also available in: Unified diff