3841a5039cab16600eeb423092805dfc7b4488a3
[jalview.git] / src / jalview / urls / UrlProviderI.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ 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.urls;
22
23 import java.io.File;
24 import java.util.List;
25 import java.util.Vector;
26
27 /**
28  * Methods for providing consistent access to up-to-date URLs
29  * 
30  * @author $author$
31  * @version $Revision$
32  */
33 public interface UrlProviderI
34 {
35
36   /*
37    * Default sequence URL link label for EMBL-EBI search
38    */
39   public static final String DEFAULT_LABEL = "EMBL-EBI Search";
40
41   /*
42    * Default sequence URL link string for EMBL-EBI search
43    */
44   public static final String DEFAULT_STRING = DEFAULT_LABEL
45           + "|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$";
46
47   /*
48    * Location of file for identifiers.org download
49    */
50   public static final String ID_ORG_FILE = System.getProperty("user.home")
51           + File.separatorChar + ".jalview_identifiers";
52
53   /**
54    * Get names and urls in as strings for display
55    * 
56    */
57   Vector<String> getLinksForDisplay();
58
59   /**
60    * Get names and urls as strings for display
61    * 
62    */
63   List<UrlLinkDisplay> getLinksForTable();
64
65   /**
66    * Set names and urls from display settings
67    */
68   void setUrlData(List<UrlLinkDisplay> links);
69
70   /**
71    * Get the id of the default URL
72    * 
73    * @return id of the default URL
74    */
75   String getDefaultUrl();
76
77   /**
78    * Get the link for the default URL
79    * 
80    * @seqid sequence id for which to build link
81    * @return link for the default URL
82    */
83   String getDefaultUrl(String seqid);
84
85   /**
86    * Get the target of thelink for the default URL
87    * 
88    * @seqid sequence id for which to build link
89    * @return target of link for the default URL
90    */
91   String getDefaultTarget(String seqid);
92
93   /**
94    * Set the default URL
95    * 
96    * @param id
97    *          the id of the URL to set as default
98    * @return true if setting was successful, false otherwise
99    */
100   boolean setDefaultUrl(String id);
101
102   /**
103    * Write out all URLs as a string suitable for serialising
104    * 
105    * @return string representation of available URLs
106    */
107   String writeUrlsAsString();
108
109   /**
110    * Set URL links from pair of collections
111    * 
112    * @param names
113    * @param urls
114    */
115   void setUrlLinks(Vector<String> names, Vector<String> urls)
116           throws IllegalArgumentException;
117
118   /**
119    * Choose the default URL in the event of the selected default being
120    * unavailable
121    * 
122    * @return id of chosen default url
123    */
124   String chooseDefaultUrl();
125
126   /**
127    * Determine if id is for a user-defined URL
128    */
129   boolean isUserEntry(String id);
130 }