1 | package eu.clarin.cmdi.vlo; |
---|
2 | |
---|
3 | import java.io.UnsupportedEncodingException; |
---|
4 | import java.net.URLEncoder; |
---|
5 | |
---|
6 | /** |
---|
7 | * see applicationContext.xml resource for proper values. |
---|
8 | * |
---|
9 | **/ |
---|
10 | public final class Configuration { |
---|
11 | |
---|
12 | private final static Configuration INSTANCE = new Configuration(); |
---|
13 | |
---|
14 | public static final String CONFIG_FILE = "applicationContext.xml"; |
---|
15 | private final static String PROFILE_ID_PLACEHOLDER = "{PROFILE_ID}"; |
---|
16 | private String solrUrl; |
---|
17 | |
---|
18 | public String getImporterConfigFile() { |
---|
19 | return importerConfigFile; |
---|
20 | } |
---|
21 | |
---|
22 | public void setImporterConfigFile(String importerConfigFile) { |
---|
23 | this.importerConfigFile = importerConfigFile; |
---|
24 | } |
---|
25 | |
---|
26 | private String importerConfigFile; |
---|
27 | |
---|
28 | private String nationalProjectMapping = "nationalProjectsMapping.xml"; |
---|
29 | |
---|
30 | public String getNationalProjectMapping() { |
---|
31 | return nationalProjectMapping; |
---|
32 | } |
---|
33 | |
---|
34 | public void setNationalProjectMapping(String nationalProjectMapping) { |
---|
35 | this.nationalProjectMapping = nationalProjectMapping; |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | private String imdiBrowserUrl;// = "http://corpus1.mpi.nl/ds/imdi_browser?openpath="; |
---|
40 | |
---|
41 | private String[] facetFields;// = new String[] { "collection", "organisation", "continent", "genre", "country", "subject", "language" }; |
---|
42 | |
---|
43 | private String handleServerUrl; //"http://hdl.handle.net/" |
---|
44 | |
---|
45 | /** |
---|
46 | * Default values you can overwrite in applicationContext.xml: e.g. <property name="countryComponentUrl" value="" /> |
---|
47 | */ |
---|
48 | private String countryComponentUrl = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; |
---|
49 | private String language2LetterCodeComponentUrl = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; |
---|
50 | private String language3LetterCodeComponentUrl = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; |
---|
51 | private String silToISO639CodesUrl = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; |
---|
52 | private String profileSchemaUrl = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/" + PROFILE_ID_PLACEHOLDER |
---|
53 | + "/xsd"; |
---|
54 | |
---|
55 | private String vloHomeLink = "http://www.clarin.eu/vlo";//default can be overridden in xml |
---|
56 | |
---|
57 | private Configuration() { |
---|
58 | } |
---|
59 | |
---|
60 | public static Configuration getInstance() { |
---|
61 | return INSTANCE; |
---|
62 | } |
---|
63 | |
---|
64 | public void setSolrUrl(String solrUrl) { |
---|
65 | this.solrUrl = solrUrl; |
---|
66 | } |
---|
67 | |
---|
68 | public String getSolrUrl() { |
---|
69 | return solrUrl; |
---|
70 | } |
---|
71 | |
---|
72 | public void setIMDIBrowserUrl(String imdiBrowserUrl) { |
---|
73 | this.imdiBrowserUrl = imdiBrowserUrl; |
---|
74 | } |
---|
75 | |
---|
76 | public String getIMDIBrowserUrl(String handle) { |
---|
77 | String result; |
---|
78 | try { |
---|
79 | result = imdiBrowserUrl + URLEncoder.encode(handle, "UTF-8"); |
---|
80 | } catch (UnsupportedEncodingException e) { |
---|
81 | result = imdiBrowserUrl + handle; |
---|
82 | } |
---|
83 | return result; |
---|
84 | } |
---|
85 | |
---|
86 | public String[] getFacetFields() { |
---|
87 | return facetFields; |
---|
88 | } |
---|
89 | |
---|
90 | public void setFacetFields(String[] facetFields) { |
---|
91 | this.facetFields = facetFields; |
---|
92 | } |
---|
93 | |
---|
94 | public String getHandleServerUrl() { |
---|
95 | return handleServerUrl; |
---|
96 | } |
---|
97 | |
---|
98 | public void setHandleServerUrl(String handleServerUrl) { |
---|
99 | this.handleServerUrl = handleServerUrl; |
---|
100 | } |
---|
101 | |
---|
102 | public String getCountryComponentUrl() { |
---|
103 | return countryComponentUrl; |
---|
104 | } |
---|
105 | |
---|
106 | public void setCountryComponentUrl(String countryComponentUrl) { |
---|
107 | this.countryComponentUrl = countryComponentUrl; |
---|
108 | } |
---|
109 | |
---|
110 | public String getLanguage2LetterCodeComponentUrl() { |
---|
111 | return language2LetterCodeComponentUrl; |
---|
112 | } |
---|
113 | |
---|
114 | public void setLanguage2LetterCodeComponentUrl(String language2LetterCodeComponentUrl) { |
---|
115 | this.language2LetterCodeComponentUrl = language2LetterCodeComponentUrl; |
---|
116 | } |
---|
117 | |
---|
118 | public String getLanguage3LetterCodeComponentUrl() { |
---|
119 | return language3LetterCodeComponentUrl; |
---|
120 | } |
---|
121 | |
---|
122 | public void setLanguage3LetterCodeComponentUrl(String language3LetterCodeComponentUrl) { |
---|
123 | this.language3LetterCodeComponentUrl = language3LetterCodeComponentUrl; |
---|
124 | } |
---|
125 | |
---|
126 | public String getSilToISO639CodesUrl() { |
---|
127 | return silToISO639CodesUrl; |
---|
128 | } |
---|
129 | |
---|
130 | public void setSilToISO639CodesUrl(String silToISO639CodesUrl) { |
---|
131 | this.silToISO639CodesUrl = silToISO639CodesUrl; |
---|
132 | } |
---|
133 | |
---|
134 | public String getVloHomeLink() { |
---|
135 | return vloHomeLink; |
---|
136 | } |
---|
137 | |
---|
138 | public void setVloHomeLink(String vloHomeLink) { |
---|
139 | this.vloHomeLink = vloHomeLink; |
---|
140 | } |
---|
141 | |
---|
142 | public String getComponentRegistryProfileSchema(String profileId) { |
---|
143 | return profileSchemaUrl.replace(PROFILE_ID_PLACEHOLDER, profileId); |
---|
144 | } |
---|
145 | |
---|
146 | public void setProfileSchemaUrl(String profileSchemaUrl) { |
---|
147 | this.profileSchemaUrl = profileSchemaUrl; |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | } |
---|