1
|
/**
|
2
|
* Copyright (C) 2009 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.dataportal;
|
10
|
|
11
|
import java.net.URI;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.apache.log4j.Logger;
|
15
|
|
16
|
/**
|
17
|
*
|
18
|
* @author a.kohlbecker
|
19
|
*
|
20
|
*/
|
21
|
public enum DataPortalSite {
|
22
|
|
23
|
cichorieae,
|
24
|
palmae,
|
25
|
cyprus,
|
26
|
floramalesiana,
|
27
|
reference;
|
28
|
|
29
|
DataPortalContext context;
|
30
|
|
31
|
public final Logger logger = Logger.getLogger(DataPortalSite.class);
|
32
|
|
33
|
private DataPortalSite() {
|
34
|
|
35
|
try {
|
36
|
|
37
|
URI baseUri = TestConfiguration.getProperty(composePropertyKey("baseUri"), URI.class, true);
|
38
|
URI cdmServerUri = TestConfiguration.getProperty(composePropertyKey("cdmServerUri"), URI.class, false);
|
39
|
UUID classificationUUID = TestConfiguration.getProperty(composePropertyKey("classificationUUID"), UUID.class, true);
|
40
|
String siteName = TestConfiguration.getProperty(composePropertyKey("siteName"));
|
41
|
String siteLabel = this.name();
|
42
|
context = new DataPortalContext(baseUri, cdmServerUri, classificationUUID, siteName, siteLabel);
|
43
|
} catch (TestConfigurationException e) {
|
44
|
logger.error("Configuration Error: ", e);
|
45
|
System.exit(-1);
|
46
|
}
|
47
|
}
|
48
|
|
49
|
private String composePropertyKey(String fieldName) {
|
50
|
String key = DataPortalContext.class.getSimpleName().substring(0, 1).toLowerCase() + DataPortalContext.class.getSimpleName().substring(1) + "." + this.name() + "." + fieldName;
|
51
|
return key;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @return
|
56
|
*/
|
57
|
public DataPortalContext getContext() {
|
58
|
return context;
|
59
|
}
|
60
|
|
61
|
}
|