1ff69646106805209d8739782550267b30e460fe
[jalview.git] / src / jalview / ws / rest / params / JobConstant.java
1 package jalview.ws.rest.params;
2
3 import jalview.ws.rest.InputType;
4 import jalview.ws.rest.NoValidInputDataException;
5 import jalview.ws.rest.RestJob;
6
7 import java.io.UnsupportedEncodingException;
8
9 import org.apache.http.entity.mime.content.ContentBody;
10 import org.apache.http.entity.mime.content.StringBody;
11
12 /**
13  * defines a constant value always provided as a parameter.
14  * @author JimP
15  *
16  */
17 public class JobConstant extends InputType
18 {
19
20   String value;
21   /**
22    * 
23    * @param param name of parameter
24    * @param val value of parameter
25    */
26   public JobConstant(String param, String val)
27   {
28     // needs no data from the restJob
29     super(null);
30     this.token = param;
31     value = val;
32   }
33
34   @Override
35   public ContentBody formatForInput(RestJob rj)
36           throws UnsupportedEncodingException, NoValidInputDataException
37   {
38     
39     return new StringBody(value);
40   }
41
42 }