2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.ws.io.mime;
21 import jalview.io.packed.DataProvider;
22 import jalview.io.packed.JalviewDataset;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.util.ArrayList;
27 import java.util.List;
29 import org.apache.james.mime4j.MimeException;
30 import org.apache.james.mime4j.descriptor.BodyDescriptor;
31 import org.apache.james.mime4j.parser.ContentHandler;
32 import org.apache.james.mime4j.parser.Field;
35 * ContentHandler for parsing mime encoded messages into Jalview objects. TODO:
36 * complete implementation TODO: test implementation TODO: hook in to Jalview IO
37 * and service response parser.
42 public class JalviewMimeContentHandler implements ContentHandler
45 * context for data parsed from multi-part mime document
47 JalviewDataset context;
50 * create a new handler to process a Jalview mime message.
54 public JalviewMimeContentHandler(JalviewDataset ds)
60 * type of data pack being parsed currently
65 * name of data pack being parsed currently
70 * sources for data to be parsed
72 List<DataProvider> dataItems = new ArrayList<DataProvider>();
75 public void body(BodyDescriptor arg0, InputStream arg1)
76 throws MimeException, IOException
79 // TODO Auto-generated method stub
84 public void endBodyPart() throws MimeException
86 // TODO Auto-generated method stub
91 public void endHeader() throws MimeException
93 // TODO Auto-generated method stub
98 public void endMessage() throws MimeException
100 // TODO Auto-generated method stub
105 public void endMultipart() throws MimeException
107 // TODO Auto-generated method stub
112 public void epilogue(InputStream arg0) throws MimeException, IOException
114 // TODO Auto-generated method stub
119 public void field(Field arg0) throws MimeException
121 // TODO Auto-generated method stub
126 public void preamble(InputStream arg0) throws MimeException, IOException
128 // TODO Auto-generated method stub
133 public void raw(InputStream arg0) throws MimeException, IOException
135 // TODO Auto-generated method stub
140 public void startBodyPart() throws MimeException
142 // TODO Auto-generated method stub
147 public void startHeader() throws MimeException
149 // TODO Auto-generated method stub
154 public void startMessage() throws MimeException
156 // TODO Auto-generated method stub
161 public void startMultipart(BodyDescriptor arg0) throws MimeException
163 // TODO Auto-generated method stub
169 * @return data providers to parse each data file extracted from the mime
172 public Iterable<DataProvider> getJalviewDataProviders()
174 // TODO Auto-generated method stub