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