39
39
import java .nio .file .Files ;
40
40
import java .nio .file .Paths ;
41
41
import java .util .ArrayList ;
42
- import java .util .Arrays ;
43
42
import java .util .LinkedList ;
44
43
import java .util .List ;
45
44
@@ -59,15 +58,6 @@ public class UserLibrary extends ContributedLibrary {
59
58
private List <String > declaredTypes ;
60
59
private boolean onGoingDevelopment ;
61
60
62
- private static final List <String > MANDATORY_PROPERTIES = Arrays
63
- .asList ("name" , "version" , "author" , "maintainer" ,
64
- "sentence" , "paragraph" , "url" );
65
-
66
- private static final List <String > CATEGORIES = Arrays .asList (
67
- "Display" , "Communication" , "Signal Input/Output" , "Sensors" ,
68
- "Device Control" , "Timing" , "Data Storage" , "Data Processing" , "Other" ,
69
- "Uncategorized" );
70
-
71
61
public static UserLibrary create (File libFolder ) throws IOException {
72
62
// Parse metadata
73
63
File propertiesFile = new File (libFolder , "library.properties" );
@@ -90,7 +80,7 @@ public static UserLibrary create(File libFolder) throws IOException {
90
80
throw new IOException ("'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information" );
91
81
92
82
// Check mandatory properties
93
- for (String p : MANDATORY_PROPERTIES )
83
+ for (String p : Constants . LIBRARY_MANDATORY_PROPERTIES )
94
84
if (!properties .containsKey (p ))
95
85
throw new IOException ("Missing '" + p + "' from library" );
96
86
@@ -135,7 +125,7 @@ public static UserLibrary create(File libFolder) throws IOException {
135
125
String category = properties .get ("category" );
136
126
if (category == null )
137
127
category = "Uncategorized" ;
138
- if (!CATEGORIES .contains (category )) {
128
+ if (!Constants . LIBRARY_CATEGORIES .contains (category )) {
139
129
System .out .println ("WARNING: Category '" + category + "' in library " + properties .get ("name" ) + " is not valid. Setting to 'Uncategorized'" );
140
130
category = "Uncategorized" ;
141
131
}
@@ -222,10 +212,6 @@ public String getLicense() {
222
212
return license ;
223
213
}
224
214
225
- public static List <String > getCategories () {
226
- return CATEGORIES ;
227
- }
228
-
229
215
@ Override
230
216
public void setCategory (String category ) {
231
217
this .category = category ;
0 commit comments