920ab3a50fca1792f1eccf890f9d7113de0badd4
[jalview.git] / src / jalview / ws / io / mime / JalviewMimeContentHandler.java
1 /*
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
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
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  */
18 package jalview.ws.io.mime;
19
20 import jalview.io.packed.DataProvider;
21 import jalview.io.packed.JalviewDataset;
22
23 import java.io.IOException;
24 import java.io.InputStream;
25 import java.util.ArrayList;
26 import java.util.List;
27
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;
32
33 /**
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.
37  * 
38  * @author JimP
39  * 
40  */
41 public class JalviewMimeContentHandler implements ContentHandler
42 {
43   /**
44    * context for data parsed from multi-part mime document
45    */
46   JalviewDataset context;
47
48   /**
49    * create a new handler to process a Jalview mime message.
50    * 
51    * @param ds
52    */
53   public JalviewMimeContentHandler(JalviewDataset ds)
54   {
55     context = ds;
56   }
57
58   /**
59    * type of data pack being parsed currently
60    */
61   String currentType;
62
63   /**
64    * name of data pack being parsed currently
65    */
66   String currentName;
67
68   /**
69    * sources for data to be parsed
70    */
71   List<DataProvider> dataItems = new ArrayList<DataProvider>();
72
73   @Override
74   public void body(BodyDescriptor arg0, InputStream arg1)
75           throws MimeException, IOException
76   {
77
78     // TODO Auto-generated method stub
79
80   }
81
82   @Override
83   public void endBodyPart() throws MimeException
84   {
85     // TODO Auto-generated method stub
86
87   }
88
89   @Override
90   public void endHeader() throws MimeException
91   {
92     // TODO Auto-generated method stub
93
94   }
95
96   @Override
97   public void endMessage() throws MimeException
98   {
99     // TODO Auto-generated method stub
100
101   }
102
103   @Override
104   public void endMultipart() throws MimeException
105   {
106     // TODO Auto-generated method stub
107
108   }
109
110   @Override
111   public void epilogue(InputStream arg0) throws MimeException, IOException
112   {
113     // TODO Auto-generated method stub
114
115   }
116
117   @Override
118   public void field(Field arg0) throws MimeException
119   {
120     // TODO Auto-generated method stub
121
122   }
123
124   @Override
125   public void preamble(InputStream arg0) throws MimeException, IOException
126   {
127     // TODO Auto-generated method stub
128
129   }
130
131   @Override
132   public void raw(InputStream arg0) throws MimeException, IOException
133   {
134     // TODO Auto-generated method stub
135
136   }
137
138   @Override
139   public void startBodyPart() throws MimeException
140   {
141     // TODO Auto-generated method stub
142
143   }
144
145   @Override
146   public void startHeader() throws MimeException
147   {
148     // TODO Auto-generated method stub
149
150   }
151
152   @Override
153   public void startMessage() throws MimeException
154   {
155     // TODO Auto-generated method stub
156
157   }
158
159   @Override
160   public void startMultipart(BodyDescriptor arg0) throws MimeException
161   {
162     // TODO Auto-generated method stub
163
164   }
165
166   /**
167    * 
168    * @return data providers to parse each data file extracted from the mime
169    *         stream.
170    */
171   public Iterable<DataProvider> getJalviewDataProviders()
172   {
173     // TODO Auto-generated method stub
174     return null;
175   }
176
177 }