2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.ws.io.mime;
20 import jalview.io.packed.DataProvider;
21 import jalview.io.packed.JalviewDataset;
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.apache.james.mime4j.MimeException;
29 import org.apache.james.mime4j.descriptor.BodyDescriptor;
30 import org.apache.james.mime4j.parser.ContentHandler;
31 import org.apache.james.mime4j.parser.Field;
34 * ContentHandler for parsing mime encoded messages into Jalview objects. TODO:
35 * complete implementation TODO: test implementation TODO: hook in to Jalview IO
36 * and service response parser.
41 public class JalviewMimeContentHandler implements ContentHandler
44 * context for data parsed from multi-part mime document
46 JalviewDataset context;
49 * create a new handler to process a Jalview mime message.
53 public JalviewMimeContentHandler(JalviewDataset ds)
59 * type of data pack being parsed currently
64 * name of data pack being parsed currently
69 * sources for data to be parsed
71 List<DataProvider> dataItems = new ArrayList<DataProvider>();
74 public void body(BodyDescriptor arg0, InputStream arg1)
75 throws MimeException, IOException
78 // TODO Auto-generated method stub
83 public void endBodyPart() throws MimeException
85 // TODO Auto-generated method stub
90 public void endHeader() throws MimeException
92 // TODO Auto-generated method stub
97 public void endMessage() throws MimeException
99 // TODO Auto-generated method stub
104 public void endMultipart() throws MimeException
106 // TODO Auto-generated method stub
111 public void epilogue(InputStream arg0) throws MimeException, IOException
113 // TODO Auto-generated method stub
118 public void field(Field arg0) throws MimeException
120 // TODO Auto-generated method stub
125 public void preamble(InputStream arg0) throws MimeException, IOException
127 // TODO Auto-generated method stub
132 public void raw(InputStream arg0) throws MimeException, IOException
134 // TODO Auto-generated method stub
139 public void startBodyPart() throws MimeException
141 // TODO Auto-generated method stub
146 public void startHeader() throws MimeException
148 // TODO Auto-generated method stub
153 public void startMessage() throws MimeException
155 // TODO Auto-generated method stub
160 public void startMultipart(BodyDescriptor arg0) throws MimeException
162 // TODO Auto-generated method stub
168 * @return data providers to parse each data file extracted from the mime
171 public Iterable<DataProvider> getJalviewDataProviders()
173 // TODO Auto-generated method stub