update author list in license for (JAL-826)
[jalview.git] / src / jalview / ws / io / mime / JalviewMimeContentHandler.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.
35  * TODO: complete implementation
36  * TODO: test implementation
37  * TODO: hook in to Jalview IO and service response parser.
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    * @param ds
51    */
52   public JalviewMimeContentHandler(JalviewDataset ds)
53   {
54     context=ds;
55   }
56   /**
57    * type of data pack being parsed currently
58    */
59   String currentType;
60   /**
61    * name of data pack being parsed currently
62    */
63   String currentName;
64   
65   /**
66    * sources for data to be parsed 
67    */
68   List<DataProvider> dataItems = new ArrayList<DataProvider>(); 
69   
70   @Override
71   public void body(BodyDescriptor arg0, InputStream arg1)
72           throws MimeException, IOException
73   {
74     
75     // TODO Auto-generated method stub
76     
77   }
78
79   @Override
80   public void endBodyPart() throws MimeException
81   {
82     // TODO Auto-generated method stub
83     
84   }
85
86   @Override
87   public void endHeader() throws MimeException
88   {
89     // TODO Auto-generated method stub
90     
91   }
92
93   @Override
94   public void endMessage() throws MimeException
95   {
96     // TODO Auto-generated method stub
97     
98   }
99
100   @Override
101   public void endMultipart() throws MimeException
102   {
103     // TODO Auto-generated method stub
104     
105   }
106
107   @Override
108   public void epilogue(InputStream arg0) throws MimeException, IOException
109   {
110     // TODO Auto-generated method stub
111     
112   }
113
114   @Override
115   public void field(Field arg0) throws MimeException
116   {
117     // TODO Auto-generated method stub
118     
119   }
120
121   @Override
122   public void preamble(InputStream arg0) throws MimeException, IOException
123   {
124     // TODO Auto-generated method stub
125     
126   }
127
128   @Override
129   public void raw(InputStream arg0) throws MimeException, IOException
130   {
131     // TODO Auto-generated method stub
132     
133   }
134
135   @Override
136   public void startBodyPart() throws MimeException
137   {
138     // TODO Auto-generated method stub
139     
140   }
141
142   @Override
143   public void startHeader() throws MimeException
144   {
145     // TODO Auto-generated method stub
146     
147   }
148
149   @Override
150   public void startMessage() throws MimeException
151   {
152     // TODO Auto-generated method stub
153     
154   }
155
156   @Override
157   public void startMultipart(BodyDescriptor arg0) throws MimeException
158   {
159     // TODO Auto-generated method stub
160     
161   }
162
163   /**
164    * 
165    * @return data providers to parse each data file extracted from the mime stream.
166    */
167   public Iterable<DataProvider> getJalviewDataProviders()
168   {
169     // TODO Auto-generated method stub
170     return null;
171   }
172
173 }