7462cacfe616fa2f296a319f34a7a710d3c8bab2
[jalview.git] / src / jalview / ws / rest / params / Tree.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 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.rest.params;
22
23 import jalview.ws.params.OptionI;
24 import jalview.ws.rest.InputType;
25 import jalview.ws.rest.RestJob;
26
27 import java.io.UnsupportedEncodingException;
28 import java.util.ArrayList;
29 import java.util.List;
30
31 import org.apache.http.entity.mime.content.ContentBody;
32
33 /**
34  * format a tree for input to a rest service
35  * 
36  * @author JimP
37  * 
38  */
39 public class Tree extends InputType
40 {
41   public Tree()
42   {
43     super(new Class[]
44     { jalview.analysis.NJTree.class });
45   }
46
47   // TODO specify modifiers for tree output format
48   @Override
49   public ContentBody formatForInput(RestJob rj)
50           throws UnsupportedEncodingException
51   {
52     // TODO: implement tree inputType
53     /*
54      * rj.getTreeForInput(token); return new StringBody(new )
55      */
56     throw new Error("Tree InputType not yet implemented");
57     // return null;
58   }
59
60   public String getURLtokenPrefix()
61   {
62     return "NEWICK";
63   }
64
65   @Override
66   public List<String> getURLEncodedParameter()
67   {
68     ArrayList<String> prms = new ArrayList<String>();
69     super.addBaseParams(prms);
70     return prms;
71   }
72
73   @Override
74   public boolean configureProperty(String tok, String val,
75           StringBuffer warnings)
76   {
77     return true;
78   }
79
80   @Override
81   public List<OptionI> getOptions()
82   {
83     return getBaseOptions();
84   }
85
86 }