View Javadoc
1   /*
2    * #%L
3    * SUMARiS
4    * %%
5    * Copyright (C) 2019 SUMARiS Consortium
6    * %%
7    * This program is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as
9    * published by the Free Software Foundation, either version 3 of the
10   * License, or (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public
18   * License along with this program.  If not, see
19   * <http://www.gnu.org/licenses/gpl-3.0.html>.
20   * #L%
21   */
22  
23  package net.sumaris.rdf.config;
24  
25  import org.nuiton.config.ConfigOptionDef;
26  
27  import java.io.File;
28  import java.net.URI;
29  import java.net.URL;
30  
31  import static org.nuiton.i18n.I18n.n;
32  
33  public enum RdfConfigurationOption implements ConfigOptionDef {
34  
35      RDF_ENABLE(
36              "rdf.enable",
37              n("sumaris.config.option.rdf.enable.description"),
38              "false",
39              Boolean.class,
40              false),
41  
42  
43      RDF_MODEL_DATE(
44              "rdf.model.version",
45              n("sumaris.config.option.rdf.model.version.description"),
46              "2019-11-20",
47              String.class,
48              false),
49  
50      RDF_MODEL_PREFIX(
51              "rdf.model.uri",
52              n("sumaris.config.option.rdf.model.uri.description"),
53              "${server.url}/ontologies",
54              String.class,
55              false),
56  
57      RDF_MODEL_LANGUAGE(
58              "rdf.model.language",
59              n("sumaris.config.option.rdf.model.language.description"),
60              "en",
61              String.class,
62              false),
63  
64      RDF_MODEL_DESCRIPTION(
65              "rdf.model.description",
66              n("sumaris.config.option.rdf.model.description.description"),
67              "A representation of the ${sumaris.name} model",
68              String.class,
69              false),
70  
71      RDF_MODEL_COMMENT(
72              "rdf.model.comment",
73              n("sumaris.config.option.rdf.model.comment.description"),
74              "Please see full documentation at ${sumaris.site.doc.url}",
75              String.class,
76              false),
77  
78      RDF_MODEL_LICENSE (
79              "rdf.model.license",
80              n("sumaris.config.option.rdf.model.license.description"),
81              "http://www.gnu.org/licenses/gpl-3.0.html",
82              String.class,
83              false),
84  
85      RDF_MODEL_AUTHORS (
86              "rdf.model.authors",
87              n("sumaris.config.option.rdf.model.authors.description"),
88              "${sumaris.organizationName}",
89              String.class,
90              false),
91      ;
92  
93      /** Configuration key. */
94      private final String key;
95  
96      /** I18n key of option description */
97      private final String description;
98  
99      /** Type of option */
100     private final Class<?> type;
101 
102     /** Default value of option. */
103     private String defaultValue;
104 
105     /** Flag to not keep option value on disk */
106     private boolean isTransient;
107 
108     /** Flag to not allow option value modification */
109     private boolean isFinal;
110 
111     RdfConfigurationOption(String key,
112                            String description,
113                            String defaultValue,
114                            Class<?> type,
115                            boolean isTransient) {
116         this.key = key;
117         this.description = description;
118         this.defaultValue = defaultValue;
119         this.type = type;
120         this.isTransient = isTransient;
121         this.isFinal = isTransient;
122     }
123 
124     RdfConfigurationOption(String key,
125                            String description,
126                            String defaultValue,
127                            Class<?> type) {
128         this(key, description, defaultValue, type, true);
129     }
130 
131     /** {@inheritDoc} */
132     @Override
133     public String getKey() {
134         return key;
135     }
136 
137     /** {@inheritDoc} */
138     @Override
139     public Class<?> getType() {
140         return type;
141     }
142 
143     /** {@inheritDoc} */
144     @Override
145     public String getDescription() {
146         return description;
147     }
148 
149     /** {@inheritDoc} */
150     @Override
151     public String getDefaultValue() {
152         return defaultValue;
153     }
154 
155     /** {@inheritDoc} */
156     @Override
157     public boolean isTransient() {
158         return isTransient;
159     }
160 
161     /** {@inheritDoc} */
162     @Override
163     public boolean isFinal() {
164         return isFinal;
165     }
166 
167     /** {@inheritDoc} */
168     @Override
169     public void setDefaultValue(String defaultValue) {
170         this.defaultValue = defaultValue;
171     }
172 
173     /** {@inheritDoc} */
174     @Override
175     public void setTransient(boolean newValue) {
176         // not used
177     }
178 
179     /** {@inheritDoc} */
180     @Override
181     public void setFinal(boolean newValue) {
182         // not used
183     }
184 
185 }