2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ws.io.mime;
23 import jalview.io.packed.DataProvider;
24 import jalview.io.packed.JalviewDataset;
26 import java.io.IOException;
27 import java.io.InputStream;
28 import java.util.ArrayList;
29 import java.util.List;
31 import org.apache.james.mime4j.MimeException;
32 import org.apache.james.mime4j.descriptor.BodyDescriptor;
33 import org.apache.james.mime4j.parser.ContentHandler;
34 import org.apache.james.mime4j.parser.Field;
37 * ContentHandler for parsing mime encoded messages into Jalview objects. TODO:
38 * complete implementation TODO: test implementation TODO: hook in to Jalview IO
39 * and service response parser.
44 public class JalviewMimeContentHandler implements ContentHandler
47 * context for data parsed from multi-part mime document
49 JalviewDataset context;
52 * create a new handler to process a Jalview mime message.
56 public JalviewMimeContentHandler(JalviewDataset ds)
62 * type of data pack being parsed currently
67 * name of data pack being parsed currently
72 * sources for data to be parsed
74 List<DataProvider> dataItems = new ArrayList<DataProvider>();
77 public void body(BodyDescriptor arg0, InputStream arg1)
78 throws MimeException, IOException
81 // TODO Auto-generated method stub
86 public void endBodyPart() throws MimeException
88 // TODO Auto-generated method stub
93 public void endHeader() throws MimeException
95 // TODO Auto-generated method stub
100 public void endMessage() throws MimeException
102 // TODO Auto-generated method stub
107 public void endMultipart() throws MimeException
109 // TODO Auto-generated method stub
114 public void epilogue(InputStream arg0) throws MimeException, IOException
116 // TODO Auto-generated method stub
121 public void field(Field arg0) throws MimeException
123 // TODO Auto-generated method stub
128 public void preamble(InputStream arg0) throws MimeException, IOException
130 // TODO Auto-generated method stub
135 public void raw(InputStream arg0) throws MimeException, IOException
137 // TODO Auto-generated method stub
142 public void startBodyPart() throws MimeException
144 // TODO Auto-generated method stub
149 public void startHeader() throws MimeException
151 // TODO Auto-generated method stub
156 public void startMessage() throws MimeException
158 // TODO Auto-generated method stub
163 public void startMultipart(BodyDescriptor arg0) throws MimeException
165 // TODO Auto-generated method stub
171 * @return data providers to parse each data file extracted from the mime
174 public Iterable<DataProvider> getJalviewDataProviders()
176 // TODO Auto-generated method stub