| Class | Line # | Actions | |||
|---|---|---|---|---|---|
| ParamDatastoreI | 26 | 4 | 2 |
| 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.ws.params; | |
| 22 | ||
| 23 | import java.io.IOException; | |
| 24 | import java.util.List; | |
| 25 | ||
| 26 | public interface ParamDatastoreI | |
| 27 | { | |
| 28 | ||
| 29 | public List<WsParamSetI> getPresets(); | |
| 30 | ||
| 31 | public WsParamSetI getPreset(String name); | |
| 32 | ||
| 33 | /** | |
| 34 | * Returns if the service has presets. | |
| 35 | * @return {@code true} if service has presets | |
| 36 | */ | |
| 37 | 0 | public default boolean hasPresets() |
| 38 | { | |
| 39 | 0 | var presets = getPresets(); |
| 40 | 0 | return presets != null && presets.size() > 0; |
| 41 | } | |
| 42 | ||
| 43 | public List<ArgumentI> getServiceParameters(); | |
| 44 | ||
| 45 | /** | |
| 46 | * Returns if the service has parameters. | |
| 47 | * @return {@code true} if service has parameters | |
| 48 | */ | |
| 49 | 0 | public default boolean hasParameters() |
| 50 | { | |
| 51 | 0 | var parameters = getServiceParameters(); |
| 52 | 0 | return parameters != null && parameters.size() > 0; |
| 53 | } | |
| 54 | ||
| 55 | public boolean presetExists(String name); | |
| 56 | ||
| 57 | public void deletePreset(String name); | |
| 58 | ||
| 59 | /** | |
| 60 | * writes or overwrites the record for a modifiable WsParamSetI entry with a | |
| 61 | * given name in the datastore. | |
| 62 | * | |
| 63 | * @param presetName | |
| 64 | * @param text | |
| 65 | * @param jobParams | |
| 66 | * may throw an illegal argument RunTimeException if the presetName | |
| 67 | * overwrites an existing, unmodifiable preset. | |
| 68 | */ | |
| 69 | public void storePreset(String presetName, String text, | |
| 70 | List<ArgumentI> jobParams); | |
| 71 | ||
| 72 | /** | |
| 73 | * update an existing instance with a new name, descriptive text and | |
| 74 | * parameters. | |
| 75 | * | |
| 76 | * @param oldName | |
| 77 | * @param presetName | |
| 78 | * @param text | |
| 79 | * @param jobParams | |
| 80 | */ | |
| 81 | public void updatePreset(String oldName, String presetName, String text, | |
| 82 | List<ArgumentI> jobParams); | |
| 83 | ||
| 84 | /** | |
| 85 | * factory method - builds a service specific parameter object using the given | |
| 86 | * data | |
| 87 | * | |
| 88 | * @param name | |
| 89 | * @param description | |
| 90 | * @param applicable | |
| 91 | * URLs | |
| 92 | * @param parameterfile | |
| 93 | * Service specific jalview parameter file (as returned from new | |
| 94 | * method) | |
| 95 | * @return null or valid WsParamSetI object for this service. | |
| 96 | */ | |
| 97 | ||
| 98 | public WsParamSetI parseServiceParameterFile(String name, | |
| 99 | String description, String[] serviceURL, String parameters) | |
| 100 | throws IOException; | |
| 101 | ||
| 102 | /** | |
| 103 | * create the service specific parameter file for this pset object. | |
| 104 | * | |
| 105 | * @param pset | |
| 106 | * @return string representation of the parameters specified by this set. | |
| 107 | * @throws IOException | |
| 108 | */ | |
| 109 | public String generateServiceParameterFile(WsParamSetI pset) | |
| 110 | throws IOException; | |
| 111 | ||
| 112 | } |