Changeset 4507
- Timestamp:
- 02/13/14 10:54:47 (10 years ago)
- Location:
- vlo/branches/vlo-3.0
- Files:
-
- 3 added
- 2 deleted
- 21 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/FacetConstants.java
r4480 r4507 41 41 public static final String FIELD_SEARCHPAGE = "_searchPageRef"; 42 42 43 // PREFIX URL for the language-link44 public static final String LANGUAGE_LINK_PREFIX = VloConfig.getLanguageLinkPrefix();45 46 43 //Normalized mimeTypes 47 44 public static final String RESOURCE_TYPE_AUDIO = "audio"; -
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java
r4480 r4507 4 4 import java.net.URLEncoder; 5 5 import java.util.List; 6 import org.simpleframework.xml.Element;7 import org.simpleframework.xml.ElementArray;8 import org.simpleframework.xml.ElementList;9 6 import org.simpleframework.xml.Root; 10 import org.slf4j.LoggerFactory;11 7 12 8 /** 13 * VLO configuration<br><br> 14 * 15 * The annotated members in this class are the parameters by means of which 16 * you can configure a VLO application. 17 * 18 * A member is annotated by prepending {@literal @element} to it. When the 19 * VloConfig class is reflected into the Simple framework, the framework will 20 * assign the values it finds in the {@literal VloConfig.xml} file to the 21 * members in the VloConfig class. 22 * 23 * Whenever you need to add a parameter the VLO configuration, add a member 24 * with the appropriate name and type, and prepend an at sign to the 25 * declaration, like this: 26 * 27 * {@literal @element}<br><br> 28 * {@literal parameterMember}<br><br> 29 * 30 * The XML should in this case contain a definition like 31 * 32 * {@literal<parameterMember>} "the value of the 33 * parameter"{@literal </parameterMember>}<br><br> 9 * VLO configuration 34 10 * 35 * If you want to add a type of member that is not included in VloConfig class 36 * yet, or if you are looking for more information on the framework, please 37 * refer to VLO documentation.<br><br> 38 * 39 * In the VloConfig class, the parameters are stored statically. This means that 40 * after 41 * 42 * {@literal VloConfig.readPackagedConfig();}<br><br> 43 * 44 * has been issued from a certain context, you can reference a parameter by 45 * 46 * {@literal WebAppConfig.getSomeParameter();}<br><br> 47 * 48 * in any scope, also a scope different from the one in which the read message 49 * was send. 50 * 51 * Through the get and set methods, the application is indifferent to the origin 52 * of a parameter: you can get and set the value of a parameter without having 53 * to worry about how the parameter was defined originally. 54 * 55 * Also, the get and set methods allow for a modification of the original value 56 * of the parameter. For example, if the format of a parameter changes, this 57 * change can be handled in the get and set methods, instead of having to 58 * modify every reference to the parameter in the application. 59 * 60 * Note on the explanation of the meaning of the parameters. Because the 61 * meaning of a parameter is not local to this class, or even not local to the 62 * configuration package, they are described in the general VLO 63 * documentation.<br><br> 64 * 65 * @author keeloo 11 * @author keeloo, twagoo 66 12 */ 67 13 @Root 68 public class VloConfig extends ConfigFromFile { 69 70 /** 71 * Create a reference through which a VloConfig class object can send 72 * messages to the logging framework that has been associated with the 73 * application. 74 */ 75 private final static org.slf4j.Logger LOG = 76 LoggerFactory.getLogger(VloConfig.class); 77 78 /** 79 * Because the VloConfig class uses the Simple framework via the 80 * ConfigFilePersister class, implement the logging interface in 81 * that class. 82 */ 83 private class VloConfigLogger implements ConfigFilePersister.Logger { 84 85 @Override 86 public void log(Object data) { 87 88 /** 89 * Send a message to the logging framework by using the 90 * LOG reference. 91 */ 92 LOG.error(data.toString()); 93 } 94 } 95 96 // create a reference to the ConfigFilePersister's logging interface 97 private static VloConfigLogger logger; 98 99 /** 100 * Constructor method 101 */ 102 public VloConfig() { 103 // create the ConfigFilePersister's logging interface 104 logger = new VloConfigLogger(); 105 106 /** 107 * Initialise the ConfigFilePersister's reference to the interface 108 */ 109 ConfigFilePersister.setLogger(VloConfig.logger); 110 } 111 112 /** 113 * Read the configuration from the packaged XML configuration file. 114 * 115 * @param fileName the name of the file to read the configuration from 116 */ 117 public static void readPackagedConfig() { 118 119 // set the name of the packaged configuration file 120 String fileName = "/VloConfig.xml"; 121 122 VloConfig.readConfig (fileName); 123 } 124 125 // VLO application configuration 126 static VloConfig config = null; 127 128 /** 129 * Read the configuration from a file. 130 * 131 * Please invoke this method instead of readPackagedConfig if you want to 132 * read the configuration from a file external to the VloConfig package. 133 * 134 * @param fileName the name of the file to read the configuration from 135 */ 136 public static void readConfig(String fileName) { 137 138 if (config == null) { 139 // the configuration is not there yet; create it now 140 config = new VloConfig(); 141 } 142 143 // set lists to null because otherwise Simple will not overwrite it 144 dataRoots = null; 145 146 // get the XML file configuration from the file 147 read(fileName, config); 148 } 14 public class VloConfig { 149 15 150 16 /* … … 157 23 * member parameters. 158 24 */ 159 160 25 // page cache related parameters 161 162 @Element 163 private static int pagesInApplicationCache = 0; 164 165 @Element 166 private static int sessionCacheSize = 0; 167 26 private int pagesInApplicationCache = 0; 27 28 private int sessionCacheSize = 0; 29 168 30 // data base related parameters 169 170 @Element 171 private static String solrUrl = ""; 172 173 @Element // directive for Simple 174 private static boolean deleteAllFirst = false; 175 176 @Element 177 private static int maxDocsInList = 0; 178 179 @Element 180 private static int minDocsInSolrQueue = 0; 181 182 @Element(required = false) 183 private static int solrTimeOut = 0; 184 185 // meta data input 186 187 @ElementList // directive for Simple 188 private static List<DataRoot> dataRoots; 189 190 @Element 191 private static int maxFileSize = 0; 192 193 @Element 194 private static int maxDaysInSolr = 0; 195 31 private String solrUrl = ""; 32 33 // directive for Simple 34 private boolean deleteAllFirst = false; 35 36 private int maxDocsInList = 0; 37 38 private int minDocsInSolrQueue = 0; 39 40 //(required = false) 41 private int solrTimeOut = 0; 42 43 private List<DataRoot> dataRoots; 44 45 private int maxFileSize = 0; 46 47 private int maxDaysInSolr = 0; 48 196 49 // mapping 197 198 @Element(required = false) 199 private static String facetConceptsFile = ""; 200 201 @ElementArray(entry = "languageFilter") 202 private static String[] languageFilters = {"", "", ""}; 203 204 @Element 205 private static boolean printMapping = false; 206 207 @Element(required = false) 208 private static String nationalProjectMapping = ""; 209 210 @Element 211 private static String countryComponentUrl = ""; 212 213 @Element 214 private static String language2LetterCodeComponentUrl = ""; 215 216 @Element 217 private static String language3LetterCodeComponentUrl = ""; 218 219 @Element 220 private static String silToISO639CodesUrl = ""; 221 50 //(required = false) 51 private String facetConceptsFile = ""; 52 53 private String[] languageFilters = {"", "", ""}; 54 55 private boolean printMapping = false; 56 57 //(required = false) 58 private String nationalProjectMapping = ""; 59 60 private String countryComponentUrl = ""; 61 62 private String language2LetterCodeComponentUrl = ""; 63 64 private String language3LetterCodeComponentUrl = ""; 65 66 private String silToISO639CodesUrl = ""; 67 222 68 // services 223 224 @Element 225 private static String FederatedContentSearchUrl = ""; 226 227 @Element 228 private static boolean useHandleResolver = false; 229 230 @Element 231 private static String profileSchemaUrl = ""; 232 233 @Element 234 private static String componentRegistryRESTURL = ""; 235 236 @Element 237 private static String handleServerUrl = ""; 238 239 @Element 240 private static String imdiBrowserUrl = ""; 241 242 @Element 243 private static String languageLinkPrefix = ""; 244 69 private String FederatedContentSearchUrl = ""; 70 71 private boolean useHandleResolver = false; 72 73 private String profileSchemaUrl = ""; 74 75 private String componentRegistryRESTURL = ""; 76 77 private String handleServerUrl = ""; 78 79 private String imdiBrowserUrl = ""; 80 81 private String languageLinkPrefix = ""; 82 245 83 // web application user interface 246 247 @Element 248 private static int facetOverviewLength = 0; 249 250 @Element 251 private static String homeUrl = ""; 252 253 @Element 254 private static String helpUrl = ""; 255 256 @Element 257 private static String feedbackFromUrl = ""; 258 84 private int facetOverviewLength = 0; 85 86 private String homeUrl = ""; 87 88 private String helpUrl = ""; 89 90 private String feedbackFromUrl = ""; 91 259 92 /** 260 93 * An array of facetFields<br><br> … … 264 97 * a correct description of an array of three facet fields<br><br> 265 98 * 266 * {@literal <facetFields length="3">}<br> 267 * {@literal <facetField>}<br> 268 * {@literal fieldOne}<br> 269 * {@literal </facetField>}<br> 270 * {@literal <facetField>}<br> 271 * {@literal fieldTwo}<br> 272 * {@literal </facetField>}<br> 273 * {@literal <facetField>}<br> 274 * {@literal fieldThree}<br> 275 * {@literal </facetField>}<br> 99 * {@literal <facetFields length="3">}<br> {@literal <facetField>}<br> 100 * {@literal fieldOne}<br> {@literal </facetField>}<br> 101 * {@literal <facetField>}<br> {@literal fieldTwo}<br> 102 * {@literal </facetField>}<br> {@literal <facetField>}<br> 103 * {@literal fieldThree}<br> {@literal </facetField>}<br> 276 104 * {@literal </facetFields>}<br><br> 277 105 * … … 280 108 * know that the elements inside 'facetFields' are named 'facetField'. 281 109 */ 282 @ElementArray(entry = "facetField")283 private staticString[] facetFields = {"", "", ""};284 110 //Array(entry = "facetField") 111 private String[] facetFields = {"", "", ""}; 112 285 113 // test related parameters 286 287 @Element(required = false) 288 private static String reverseProxyPrefix = ""; 289 290 @Element(required = false) 291 private static String cqlEndpointFilter = ""; 292 293 @Element(required = false) 294 private static String cqlEndpointAlternative= ""; 295 114 //(required = false) 115 private String reverseProxyPrefix = ""; 116 117 //(required = false) 118 private String cqlEndpointFilter = ""; 119 120 //(required = false) 121 private String cqlEndpointAlternative = ""; 296 122 297 123 /** … … 302 128 * application. 303 129 */ 304 305 130 /** 306 131 * Get the value of the pagesInApplicationCache parameter<br><br> 307 132 * 308 * The parameter represents the number of pages that Wicket will allow 309 * to bestored in the application's cache.310 * 311 * @return the value 312 */ 313 public staticint getPagesInApplicationCache() {133 * The parameter represents the number of pages that Wicket will allow to be 134 * stored in the application's cache. 135 * 136 * @return the value 137 */ 138 public int getPagesInApplicationCache() { 314 139 return pagesInApplicationCache; 315 140 } … … 317 142 /** 318 143 * Set the value of the pagesInApplicationCache parameter<br><br> 319 * 320 * The parameter represents the number of pages that Wicket will allow 321 * to bestored in the application's cache.322 * 323 * @param param the value 324 */ 325 public staticvoid setPagesInApplicationCache(int param) {144 * 145 * The parameter represents the number of pages that Wicket will allow to be 146 * stored in the application's cache. 147 * 148 * @param param the value 149 */ 150 public void setPagesInApplicationCache(int param) { 326 151 pagesInApplicationCache = param; 327 152 } 328 153 329 154 /** 330 155 * Get the value of the sessionCacheSize parameter<br><br> 331 156 * 332 * The parameter represents the size in kilobytes of the session 333 * page cache. 334 * 335 * @return the value 336 */ 337 public static int getSessionCacheSize() { 157 * The parameter represents the size in kilobytes of the session page cache. 158 * 159 * @return the value 160 */ 161 public int getSessionCacheSize() { 338 162 return sessionCacheSize; 339 163 } … … 342 166 * Set the value of the sessionCacheSize parameter<br><br> 343 167 * 344 * The parameter represents the size in megabytes of the session 345 * page cache. 346 * 347 * @param param the value 348 */ 349 public static void setSessionCacheSize(int param) { 168 * The parameter represents the size in megabytes of the session page cache. 169 * 170 * @param param the value 171 */ 172 public void setSessionCacheSize(int param) { 350 173 sessionCacheSize = param; 351 174 } … … 358 181 * 359 182 * @return the value 360 */ 361 public staticboolean deleteAllFirst() {183 */ 184 public boolean deleteAllFirst() { 362 185 return deleteAllFirst; 363 186 } … … 371 194 * @param param the value 372 195 */ 373 public staticvoid setDeleteAllFirst(boolean param) {196 public void setDeleteAllFirst(boolean param) { 374 197 deleteAllFirst = param; 375 198 } 376 199 377 200 /** 378 201 * Get the value of the maxDocsInList parameter<br><br> … … 383 206 * @return the value 384 207 */ 385 public static int getMaxDocsInList (){208 public int getMaxDocsInList() { 386 209 return maxDocsInList; 387 210 } 388 211 389 212 /** 390 213 * Set the value of the maxDocsInList parameter<br><br> … … 395 218 * @param param the value 396 219 */ 397 public static void setMaxDocsInList (int param){220 public void setMaxDocsInList(int param) { 398 221 maxDocsInList = param; 399 222 } 400 223 401 224 /** 402 225 * Get the value of the minDocsInSolrQueue parameter<br><br> … … 407 230 * @return the value 408 231 */ 409 public static int getMinDocsInSolrQueue (){232 public int getMinDocsInSolrQueue() { 410 233 return minDocsInSolrQueue; 411 234 } 412 235 413 236 /** 414 237 * Set the value of the minDocsInSolrQueue parameter<br><br> … … 419 242 * @param param the value 420 243 */ 421 public static void setMinDocsInSolrQueue (int param){244 public void setMinDocsInSolrQueue(int param) { 422 245 minDocsInSolrQueue = param; 423 246 } 424 247 425 248 /** 426 249 * Get the value of the solrTimeOut parameter<br><br> 427 * 428 * For a description of the parameter, refer to the general VLO 429 * documentation. 430 * 431 * @return the value 432 */ 433 public static int getSolrTimeOut (){250 * 251 * For a description of the parameter, refer to the general VLO 252 * documentation. 253 * 254 * @return the value 255 */ 256 public int getSolrTimeOut() { 434 257 return solrTimeOut; 435 258 } 436 259 437 260 /** 438 261 * Set the value of the solrTimeOut parameter<br><br> … … 443 266 * @param param the value 444 267 */ 445 public static void setSolrTimeOut (int param){268 public void setSolrTimeOut(int param) { 446 269 solrTimeOut = param; 447 270 } 448 271 449 272 /** 450 273 * Get the value of the maxFileSize parameter<br><br> … … 455 278 * @return the value 456 279 */ 457 public static int getMaxFileSize (){280 public int getMaxFileSize() { 458 281 return maxFileSize; 459 282 } 460 283 461 284 /** 462 285 * Set the value of the maxFileSize parameter<br><br> … … 467 290 * @param param the value 468 291 */ 469 public static void setMaxFileSize (int param){292 public void setMaxFileSize(int param) { 470 293 maxFileSize = param; 471 294 } 472 295 473 296 /** 474 297 * Get the value of the maxDaysInSolr parameter<br><br> … … 479 302 * @return the value 480 303 */ 481 public static int getMaxDaysInSolr (){304 public int getMaxDaysInSolr() { 482 305 return maxDaysInSolr; 483 306 } 484 307 485 308 /** 486 309 * Set the value of the maxDaysInSolr parameter<br><br> … … 491 314 * @param param the value 492 315 */ 493 public static void setMaxDaysInSolr (int param){494 495 } 496 316 public void setMaxDaysInSolr(int param) { 317 maxDaysInSolr = param; 318 } 319 497 320 /** 498 321 * Get the value of the useHandleResolver parameter<br><br> … … 503 326 * @return the value 504 327 */ 505 public static boolean getUseHandleResolver (){328 public boolean getUseHandleResolver() { 506 329 return useHandleResolver; 507 330 } 508 331 509 332 /** 510 333 * Set the value of the useHandleResolver parameter<br><br> … … 515 338 * @param param the value 516 339 */ 517 public static void setUseHandleResolver (boolean param){340 public void setUseHandleResolver(boolean param) { 518 341 useHandleResolver = param; 519 342 } 520 343 521 344 /** 522 345 * Get the list of dataRoots parameters<br><br> … … 527 350 * @return the value 528 351 */ 529 public staticList<DataRoot> getDataRoots() {352 public List<DataRoot> getDataRoots() { 530 353 return dataRoots; 531 354 } 532 355 533 356 /** 534 357 * Set the value of a list of dataRoots parameters<br><br> … … 539 362 * @param param the value 540 363 */ 541 public staticvoid setDataRoots(List<DataRoot> param) {364 public void setDataRoots(List<DataRoot> param) { 542 365 dataRoots = param; 543 366 } … … 551 374 * @return the value 552 375 */ 553 public staticboolean printMapping() {376 public boolean printMapping() { 554 377 return printMapping; 555 378 } 556 379 557 380 /** 558 381 * Set the value of the printMapping parameter<br><br> … … 563 386 * @param param the value 564 387 */ 565 public staticvoid setPrintMapping(boolean param) {388 public void setPrintMapping(boolean param) { 566 389 printMapping = param; 567 390 } … … 575 398 * @return the value 576 399 */ 577 public staticString getHomeUrl() {400 public String getHomeUrl() { 578 401 return homeUrl; 579 402 } … … 587 410 * @param param the value 588 411 */ 589 public staticvoid setHomeUrl(String param) {412 public void setHomeUrl(String param) { 590 413 homeUrl = param; 591 414 } … … 599 422 * @return the value 600 423 */ 601 public staticString getHelpUrl() {424 public String getHelpUrl() { 602 425 return helpUrl; 603 426 } … … 611 434 * @param param the value 612 435 */ 613 public staticvoid setHelpUrl(String param) {436 public void setHelpUrl(String param) { 614 437 helpUrl = param; 615 438 } … … 623 446 * @return the value 624 447 */ 625 staticpublic String getSolrUrl() {448 public String getSolrUrl() { 626 449 return solrUrl; 627 450 } … … 635 458 * @param param the value 636 459 */ 637 public staticvoid setSolrUrl(String param) {460 public void setSolrUrl(String param) { 638 461 solrUrl = param; 639 462 } 640 463 641 464 /** 642 465 * Get the value of the facetConceptsFile parameter<br><br> … … 647 470 * @return the value 648 471 */ 649 staticpublic String getFacetConceptsFile() {472 public String getFacetConceptsFile() { 650 473 return facetConceptsFile; 651 474 } … … 659 482 * @param param the value 660 483 */ 661 public staticvoid setFacetConceptsFile(String param) {484 public void setFacetConceptsFile(String param) { 662 485 facetConceptsFile = param; 663 486 } … … 671 494 * @return the value 672 495 */ 673 public staticString getComponentRegistryProfileSchema(String id) {496 public String getComponentRegistryProfileSchema(String id) { 674 497 return profileSchemaUrl.replace("{PROFILE_ID}", id); 675 498 } … … 683 506 * @param param the value 684 507 */ 685 public staticvoid setProfileSchemaUrl(String param) {508 public void setProfileSchemaUrl(String param) { 686 509 profileSchemaUrl = param; 687 510 } … … 695 518 * @return the value 696 519 */ 697 public staticString getComponentRegistryRESTURL() {520 public String getComponentRegistryRESTURL() { 698 521 return componentRegistryRESTURL; 699 522 } … … 707 530 * @param param the value 708 531 */ 709 public staticvoid setComponentRegistryRESTURL(String param) {532 public void setComponentRegistryRESTURL(String param) { 710 533 componentRegistryRESTURL = param; 711 534 } … … 719 542 * @return the value 720 543 */ 721 public staticString getHandleServerUrl() {544 public String getHandleServerUrl() { 722 545 return handleServerUrl; 723 546 } … … 731 554 * @param param the value 732 555 */ 733 public staticvoid setHandleServerUrl(String param) {556 public void setHandleServerUrl(String param) { 734 557 handleServerUrl = param; 735 558 } 736 559 737 560 /** 738 * Get the value of the ProfileSchemaUrl parameter combined with a handle<br><br> 561 * Get the value of the ProfileSchemaUrl parameter combined with a 562 * handle<br><br> 739 563 * 740 564 * For a description of the schema, refer to the general VLO documentation. 741 565 * 742 566 * @param handle the handle the URL is based on 743 * @return the value 744 */ 745 public staticString getIMDIBrowserUrl(String handle) {567 * @return the value 568 */ 569 public String getIMDIBrowserUrl(String handle) { 746 570 String result; 747 571 try { … … 761 585 * @param param the value 762 586 */ 763 public staticvoid setIMDIBrowserUrl(String param) {587 public void setIMDIBrowserUrl(String param) { 764 588 imdiBrowserUrl = param; 765 589 } … … 773 597 * @return the value 774 598 */ 775 public staticString getLanguageLinkPrefix() {599 public String getLanguageLinkPrefix() { 776 600 return languageLinkPrefix; 777 601 } 778 602 779 603 /** 780 604 * Set the value of the languageLinkPrefix parameter<br><br> … … 785 609 * @param param the value 786 610 */ 787 public staticvoid setLanguageLinkPrefix(String param) {611 public void setLanguageLinkPrefix(String param) { 788 612 languageLinkPrefix = param; 789 613 } 790 614 791 615 /** 792 616 * Get the value of the feedbackFromUrl parameter<br><br> … … 797 621 * @return the value 798 622 */ 799 public staticString getFeedbackFromUrl() {623 public String getFeedbackFromUrl() { 800 624 return feedbackFromUrl; 801 625 } 802 626 803 627 /** 804 628 * Set the value of the feedbackFromUrl parameter<br><br> … … 809 633 * @param param the value 810 634 */ 811 public staticvoid setFeedbackFromUrl(String param) {635 public void setFeedbackFromUrl(String param) { 812 636 feedbackFromUrl = param; 813 637 } 814 638 815 639 /** 816 640 * Get the value of the FederatedContentSearchUrl parameter<br><br> … … 821 645 * @return the value 822 646 */ 823 public staticString getFederatedContentSearchUrl() {647 public String getFederatedContentSearchUrl() { 824 648 return FederatedContentSearchUrl; 825 649 } … … 833 657 * @param param the value 834 658 */ 835 public staticvoid setFederatedContentSearchUrl(String param) {659 public void setFederatedContentSearchUrl(String param) { 836 660 FederatedContentSearchUrl = param; 837 661 } … … 845 669 * @return the value 846 670 */ 847 public staticString getNationalProjectMapping() {671 public String getNationalProjectMapping() { 848 672 return nationalProjectMapping; 849 673 } … … 857 681 * @param nationalProjectMapping the value 858 682 */ 859 public staticvoid setNationalProjectMapping(String param) {683 public void setNationalProjectMapping(String param) { 860 684 nationalProjectMapping = param; 861 685 } 862 686 863 687 /** 864 688 * Get the value of the FacetFields parameter<br><br> … … 869 693 * @return the value 870 694 */ 871 public staticString[] getFacetFields() {695 public String[] getFacetFields() { 872 696 return facetFields; 873 697 } … … 881 705 * @param param the value, a list of facet fields 882 706 */ 883 public staticvoid setFacetFields(String[] param) {707 public void setFacetFields(String[] param) { 884 708 facetFields = param; 885 709 } 886 710 887 711 /** 888 712 * Get the value of the languageFields parameter<br><br> … … 893 717 * @return the value 894 718 */ 895 public staticString[] getLanguageFilters() {719 public String[] getLanguageFilters() { 896 720 return languageFilters; 897 721 } … … 905 729 * @param param the value, a list of language filters 906 730 */ 907 public staticvoid setLanguageFilters(String[] param) {731 public void setLanguageFilters(String[] param) { 908 732 languageFilters = param; 909 733 } 910 734 911 735 /** 912 736 * Get the value of the getFacetOverviewLength parameter<br><br> … … 917 741 * @return the value 918 742 */ 919 public staticint getFacetOverviewLength() {743 public int getFacetOverviewLength() { 920 744 return facetOverviewLength; 921 745 } … … 941 765 * @return the value 942 766 */ 943 public staticString getCountryComponentUrl() {767 public String getCountryComponentUrl() { 944 768 return countryComponentUrl; 945 769 } … … 953 777 * @param param the value 954 778 */ 955 public staticvoid setCountryComponentUrl(String param) {779 public void setCountryComponentUrl(String param) { 956 780 countryComponentUrl = param; 957 781 } … … 965 789 * @return the value 966 790 */ 967 public staticString getLanguage2LetterCodeComponentUrl() {791 public String getLanguage2LetterCodeComponentUrl() { 968 792 return language2LetterCodeComponentUrl; 969 793 } … … 977 801 * @param param the value 978 802 */ 979 public staticvoid setLanguage2LetterCodeComponentUrl(String param) {803 public void setLanguage2LetterCodeComponentUrl(String param) { 980 804 language2LetterCodeComponentUrl = param; 981 805 } 982 806 983 807 /** 984 * Get the value of the Language3LetterCodeComponentUrl parameter<br><br> 985 * 986 * For a description of the parameter, refer to the general VLO 987 * documentation. 988 * 989 * @return the value 990 */ 991 public staticString getLanguage3LetterCodeComponentUrl() {808 * Get the value of the Language3LetterCodeComponentUrl parameter<br><br> 809 * 810 * For a description of the parameter, refer to the general VLO 811 * documentation. 812 * 813 * @return the value 814 */ 815 public String getLanguage3LetterCodeComponentUrl() { 992 816 return language3LetterCodeComponentUrl; 993 817 } 994 818 995 819 /** 996 * Set the value of the Language3LetterCodeComponentUrl parameter<br><br> 997 * 998 * For a description of the parameter, refer to the general VLO 999 * documentation. 1000 * 1001 * @param param the value 1002 */ 1003 public staticvoid setLanguage3LetterCodeComponentUrl(String param) {820 * Set the value of the Language3LetterCodeComponentUrl parameter<br><br> 821 * 822 * For a description of the parameter, refer to the general VLO 823 * documentation. 824 * 825 * @param param the value 826 */ 827 public void setLanguage3LetterCodeComponentUrl(String param) { 1004 828 language3LetterCodeComponentUrl = param; 1005 829 } … … 1013 837 * @return the value 1014 838 */ 1015 public staticString getSilToISO639CodesUrl() {839 public String getSilToISO639CodesUrl() { 1016 840 return silToISO639CodesUrl; 1017 841 } … … 1025 849 * @param param the value 1026 850 */ 1027 public staticvoid setSilToISO639CodesUrl(String param) {851 public void setSilToISO639CodesUrl(String param) { 1028 852 silToISO639CodesUrl = param; 1029 853 } 1030 854 1031 855 /** 1032 856 * Get the value of the reverseProxyPath parameter<br><br> … … 1037 861 * @return the value 1038 862 */ 1039 public staticString getReverseProxyPrefix() {863 public String getReverseProxyPrefix() { 1040 864 return reverseProxyPrefix; 1041 865 } … … 1049 873 * @param param the value 1050 874 */ 1051 public staticvoid setReverseProxyPrefix(String param) {875 public void setReverseProxyPrefix(String param) { 1052 876 reverseProxyPrefix = param; 1053 877 } 1054 878 1055 879 /** 1056 880 * Get the value of the cqlEndpointFilter parameter<br><br> … … 1061 885 * @return the value 1062 886 */ 1063 public staticString getCqlEndpointFilter() {887 public String getCqlEndpointFilter() { 1064 888 return cqlEndpointFilter; 1065 889 } … … 1073 897 * @param param the value 1074 898 */ 1075 public staticvoid setCqlEndpointFilter(String param) {899 public void setCqlEndpointFilter(String param) { 1076 900 cqlEndpointFilter = param; 1077 901 } 1078 902 1079 903 /** 1080 904 * Get the value of the cqlEndpointAlternative parameter<br><br> … … 1085 909 * @return the value 1086 910 */ 1087 public staticString getCqlEndpointAlternative() {911 public String getCqlEndpointAlternative() { 1088 912 return cqlEndpointAlternative; 1089 913 } … … 1097 921 * @param param the value 1098 922 */ 1099 public staticvoid setCqlEndpointAlternative(String param) {923 public void setCqlEndpointAlternative(String param) { 1100 924 cqlEndpointAlternative = param; 1101 925 } -
vlo/branches/vlo-3.0/vlo-commons/src/main/resources/VloConfig.xml
r4480 r4507 53 53 <helpUrl>http://www.clarin.eu/vlo</helpUrl> 54 54 55 <solrUrl>http://localhost:808 4/vlo_solr/</solrUrl>55 <solrUrl>http://localhost:8080/vlo_solr/</solrUrl> 56 56 57 57 <facetConceptsFile>/facetConcepts.xml</facetConceptsFile> -
vlo/branches/vlo-3.0/vlo-commons/src/test/java/eu/clarin/cmdi/vlo/config/DefaultVloConfigFactoryTest.java
r4480 r4507 8 8 import java.util.List; 9 9 import static org.junit.Assert.*; 10 import org.junit.Before ;10 import org.junit.BeforeClass; 11 11 import org.junit.Test; 12 12 … … 15 15 * @author keeloo 16 16 */ 17 public class VloConfigTest { 18 19 public VloConfigTest() { 20 } 21 22 @Before 23 public void setUp() { 24 VloConfig.readPackagedConfig(); 17 public class DefaultVloConfigFactoryTest { 18 19 public DefaultVloConfigFactoryTest() { 20 } 21 22 private static VloConfig config; 23 24 @BeforeClass 25 public static void setUp() { 26 config = new DefaultVloConfigFactory().newConfig(); 25 27 } 26 28 … … 52 54 System.out.println("getDataRoots"); 53 55 54 List rootsReturned = VloConfig.getDataRoots();56 List rootsReturned = config.getDataRoots(); 55 57 56 58 assertEquals(dataRoots, rootsReturned); … … 80 82 System.out.println("setDataRoots"); 81 83 82 VloConfig.setDataRoots(dataRoots);83 84 List rootsReturned = VloConfig.getDataRoots();84 config.setDataRoots(dataRoots); 85 86 List rootsReturned = config.getDataRoots(); 85 87 86 88 assertEquals (dataRoots, rootsReturned); … … 96 98 97 99 int expResult = 40; // as defined in vloconfig.xml 98 int result = VloConfig.getPagesInApplicationCache();100 int result = config.getPagesInApplicationCache(); 99 101 100 102 assertEquals(expResult, result); … … 111 113 int param = 999; 112 114 113 VloConfig.setPagesInApplicationCache(param);114 115 int result = VloConfig.getPagesInApplicationCache();115 config.setPagesInApplicationCache(param); 116 117 int result = config.getPagesInApplicationCache(); 116 118 117 119 assertEquals(param, result); … … 128 130 129 131 int expResult = 10000; // as defined in vloconfig.xml 130 int result = VloConfig.getSessionCacheSize();132 int result = config.getSessionCacheSize(); 131 133 132 134 assertEquals(expResult, result); … … 143 145 int param = 9999; 144 146 145 VloConfig.setSessionCacheSize(param);146 147 int result = VloConfig.getSessionCacheSize();147 config.setSessionCacheSize(param); 148 149 int result = config.getSessionCacheSize(); 148 150 149 151 assertEquals(param, result); … … 159 161 160 162 int expResult = 128; 161 int result = VloConfig.getMaxDocsInList();163 int result = config.getMaxDocsInList(); 162 164 163 165 assertEquals(expResult, result); … … 174 176 int param = 1000; 175 177 176 VloConfig.setMaxDocsInList(param);177 178 int result = VloConfig.getMaxDocsInList();178 config.setMaxDocsInList(param); 179 180 int result = config.getMaxDocsInList(); 179 181 180 182 assertEquals(param, result); … … 190 192 191 193 int expResult = 128; 192 int result = VloConfig.getMaxDocsInList();194 int result = config.getMaxDocsInList(); 193 195 194 196 assertEquals(expResult, result); … … 205 207 int param = 1000; 206 208 207 VloConfig.setMaxDocsInList(param);208 209 int result = VloConfig.getMaxDocsInList();209 config.setMaxDocsInList(param); 210 211 int result = config.getMaxDocsInList(); 210 212 211 213 assertEquals(param, result); … … 221 223 222 224 int expResult = 10000000; 223 int result = VloConfig.getMaxFileSize();225 int result = config.getMaxFileSize(); 224 226 225 227 assertEquals(expResult, result); … … 236 238 int param = 10000000; 237 239 238 VloConfig.setMaxFileSize(param);239 240 int result = VloConfig.getMaxFileSize();240 config.setMaxFileSize(param); 241 242 int result = config.getMaxFileSize(); 241 243 242 244 assertEquals(param, result); … … 252 254 253 255 boolean expResult = false; 254 boolean result = VloConfig.getUseHandleResolver();256 boolean result = config.getUseHandleResolver(); 255 257 256 258 assertEquals(expResult, result); … … 267 269 boolean param = true; 268 270 269 VloConfig.setUseHandleResolver(param);270 271 boolean result = VloConfig.getUseHandleResolver();271 config.setUseHandleResolver(param); 272 273 boolean result = config.getUseHandleResolver(); 272 274 273 275 assertEquals(param, result); … … 283 285 284 286 boolean expResult = true; 285 boolean result = VloConfig.deleteAllFirst();287 boolean result = config.deleteAllFirst(); 286 288 287 289 assertEquals(expResult, result); … … 298 300 boolean param = true; 299 301 300 VloConfig.setDeleteAllFirst(param);301 302 boolean result = VloConfig.deleteAllFirst();302 config.setDeleteAllFirst(param); 303 304 boolean result = config.deleteAllFirst(); 303 305 304 306 assertEquals(param, result); … … 314 316 315 317 boolean expResult = false; 316 boolean result = VloConfig.printMapping();318 boolean result = config.printMapping(); 317 319 318 320 assertEquals(expResult, result); … … 328 330 boolean param = false; 329 331 330 VloConfig.setPrintMapping(param);331 332 boolean result = VloConfig.printMapping();332 config.setPrintMapping(param); 333 334 boolean result = config.printMapping(); 333 335 334 336 assertEquals(param, result); … … 344 346 345 347 String expResult = "http://www.clarin.eu/vlo"; 346 String result = VloConfig.getHomeUrl();348 String result = config.getHomeUrl(); 347 349 348 350 assertEquals(expResult, result); … … 359 361 String param = "http://www.clarin.eu/vlo"; 360 362 361 VloConfig.setHomeUrl(param);362 363 String result = VloConfig.getHomeUrl();363 config.setHomeUrl(param); 364 365 String result = config.getHomeUrl(); 364 366 365 367 assertEquals(param, result); … … 375 377 376 378 String expResult = "http://www.clarin.eu/vlo"; 377 String result = VloConfig.getHelpUrl();379 String result = config.getHelpUrl(); 378 380 379 381 assertEquals(expResult, result); … … 390 392 String param = "http://www.clarin.eu/vlo"; 391 393 392 VloConfig.setHelpUrl(param);393 394 String result = VloConfig.getHelpUrl();394 config.setHelpUrl(param); 395 396 String result = config.getHelpUrl(); 395 397 396 398 assertEquals(param, result); … … 406 408 407 409 String expResult = "http://localhost:8084/vlo_solr/"; 408 String result = VloConfig.getSolrUrl();410 String result = config.getSolrUrl(); 409 411 410 412 assertEquals(expResult, result); … … 421 423 String param = "http://localhost:8084/vlo_solr/"; 422 424 423 VloConfig.setSolrUrl(param);424 425 String result = VloConfig.getSolrUrl();425 config.setSolrUrl(param); 426 427 String result = config.getSolrUrl(); 426 428 427 429 assertEquals(param, result); … … 437 439 438 440 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/someId/xsd"; 439 String result = VloConfig.getComponentRegistryProfileSchema("someId");441 String result = config.getComponentRegistryProfileSchema("someId"); 440 442 441 443 assertEquals(expResult, result); … … 451 453 452 454 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; 453 String result = VloConfig.getComponentRegistryRESTURL();455 String result = config.getComponentRegistryRESTURL(); 454 456 455 457 assertEquals(expResult, result); … … 466 468 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; 467 469 468 VloConfig.setComponentRegistryRESTURL(param);469 470 String result = VloConfig.getComponentRegistryRESTURL();470 config.setComponentRegistryRESTURL(param); 471 472 String result = config.getComponentRegistryRESTURL(); 471 473 472 474 assertEquals(param, result); … … 482 484 483 485 String expResult = "http://hdl.handle.net/"; 484 String result = VloConfig.getHandleServerUrl();486 String result = config.getHandleServerUrl(); 485 487 486 488 assertEquals(expResult, result); … … 497 499 String param = "http://hdl.handle.net/"; 498 500 499 VloConfig.setHandleServerUrl(param);500 501 String result = VloConfig.getHandleServerUrl();501 config.setHandleServerUrl(param); 502 503 String result = config.getHandleServerUrl(); 502 504 503 505 assertEquals(param, result); … … 518 520 expResult = "http://corpus1.mpi.nl/ds/imdi_browser?openpath=" + "handle"; 519 521 } 520 String result = VloConfig.getIMDIBrowserUrl("handle");522 String result = config.getIMDIBrowserUrl("handle"); 521 523 522 524 assertEquals(expResult, result); … … 533 535 String param = "http://corpus1.mpi.nl/ds/imdi_browser?openpath="; 534 536 535 VloConfig.setIMDIBrowserUrl(param);537 config.setIMDIBrowserUrl(param); 536 538 537 539 String expResult; … … 542 544 } 543 545 544 String result = VloConfig.getIMDIBrowserUrl("handle");546 String result = config.getIMDIBrowserUrl("handle"); 545 547 546 548 assertEquals(expResult, result); … … 556 558 557 559 String expResult = "http://infra.clarin.eu/service/language/info.php?code="; 558 String result = VloConfig.getLanguageLinkPrefix();560 String result = config.getLanguageLinkPrefix(); 559 561 560 562 assertEquals(expResult, result); … … 571 573 String param = "http://infra.clarin.eu/service/language/info.php?code="; 572 574 573 VloConfig.setLanguageLinkPrefix(param);574 575 String result = VloConfig.getLanguageLinkPrefix();575 config.setLanguageLinkPrefix(param); 576 577 String result = config.getLanguageLinkPrefix(); 576 578 577 579 assertEquals(param, result); … … 587 589 588 590 String expResult = "http://www.clarin.eu/node/3759?url="; 589 String result = VloConfig.getFeedbackFromUrl();591 String result = config.getFeedbackFromUrl(); 590 592 591 593 assertEquals(expResult, result); … … 602 604 String param = "http://www.clarin.eu/node/3759?url="; 603 605 604 VloConfig.setFeedbackFromUrl(param);605 606 String result = VloConfig.getFeedbackFromUrl();606 config.setFeedbackFromUrl(param); 607 608 String result = config.getFeedbackFromUrl(); 607 609 608 610 assertEquals(param, result); … … 618 620 619 621 String expResult = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; 620 String result = VloConfig.getFederatedContentSearchUrl();622 String result = config.getFederatedContentSearchUrl(); 621 623 622 624 assertEquals(expResult, result); … … 633 635 String param = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; 634 636 635 VloConfig.setFederatedContentSearchUrl(param);636 637 String result = VloConfig.getFederatedContentSearchUrl();637 config.setFederatedContentSearchUrl(param); 638 639 String result = config.getFederatedContentSearchUrl(); 638 640 639 641 assertEquals(param, result); … … 649 651 650 652 String expResult = "/nationalProjectsMapping.xml"; 651 String result = VloConfig.getNationalProjectMapping();653 String result = config.getNationalProjectMapping(); 652 654 653 655 assertEquals(expResult, result); … … 664 666 String param = "nationalProjectsMapping.xml"; 665 667 666 VloConfig.setNationalProjectMapping(param);667 668 String result = VloConfig.getNationalProjectMapping();668 config.setNationalProjectMapping(param); 669 670 String result = config.getNationalProjectMapping(); 669 671 670 672 assertEquals(param, result); … … 694 696 "keywords"}; 695 697 696 String[] result = VloConfig.getFacetFields();698 String[] result = config.getFacetFields(); 697 699 698 700 assertArrayEquals(expResult, result); … … 722 724 "keywords"}; 723 725 724 VloConfig.setFacetFields(expResult);725 726 String result[] = VloConfig.getFacetFields();726 config.setFacetFields(expResult); 727 728 String result[] = config.getFacetFields(); 727 729 728 730 assertArrayEquals(expResult, result); … … 738 740 739 741 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; 740 String result = VloConfig.getCountryComponentUrl();742 String result = config.getCountryComponentUrl(); 741 743 742 744 assertEquals(expResult, result); … … 753 755 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; 754 756 755 VloConfig.setCountryComponentUrl(param);756 757 String result = VloConfig.getCountryComponentUrl();757 config.setCountryComponentUrl(param); 758 759 String result = config.getCountryComponentUrl(); 758 760 759 761 assertEquals(param, result); … … 769 771 770 772 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; 771 String result = VloConfig.getLanguage2LetterCodeComponentUrl();773 String result = config.getLanguage2LetterCodeComponentUrl(); 772 774 773 775 assertEquals(expResult, result); … … 784 786 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; 785 787 786 VloConfig.setLanguage2LetterCodeComponentUrl(param);787 788 String result = VloConfig.getLanguage2LetterCodeComponentUrl();788 config.setLanguage2LetterCodeComponentUrl(param); 789 790 String result = config.getLanguage2LetterCodeComponentUrl(); 789 791 790 792 assertEquals(param, result); … … 800 802 801 803 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; 802 String result = VloConfig.getLanguage3LetterCodeComponentUrl();804 String result = config.getLanguage3LetterCodeComponentUrl(); 803 805 804 806 assertEquals(expResult, result); … … 815 817 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; 816 818 817 VloConfig.setLanguage3LetterCodeComponentUrl(param);818 819 String result = VloConfig.getLanguage3LetterCodeComponentUrl();819 config.setLanguage3LetterCodeComponentUrl(param); 820 821 String result = config.getLanguage3LetterCodeComponentUrl(); 820 822 821 823 assertEquals(param, result); … … 831 833 832 834 String expResult = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; 833 String result = VloConfig.getSilToISO639CodesUrl();835 String result = config.getSilToISO639CodesUrl(); 834 836 835 837 assertEquals(expResult, result); … … 846 848 String param = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; 847 849 848 VloConfig.setSilToISO639CodesUrl(param);849 850 String result = VloConfig.getSilToISO639CodesUrl();850 config.setSilToISO639CodesUrl(param); 851 852 String result = config.getSilToISO639CodesUrl(); 851 853 852 854 assertEquals(param, result); … … 862 864 863 865 String expResult = ""; 864 String result = VloConfig.getReverseProxyPrefix();866 String result = config.getReverseProxyPrefix(); 865 867 866 868 assertEquals(expResult, result); … … 877 879 String param = "vlodev/"; 878 880 879 VloConfig.setReverseProxyPrefix(param);880 881 String result = VloConfig.getReverseProxyPrefix();881 config.setReverseProxyPrefix(param); 882 883 String result = config.getReverseProxyPrefix(); 882 884 883 885 assertEquals(param, result); … … 893 895 894 896 String expResult = "http://cqlservlet.mpi.nl/"; 895 String result = VloConfig.getCqlEndpointFilter();897 String result = config.getCqlEndpointFilter(); 896 898 897 899 assertEquals(expResult, result); … … 908 910 String param = "http://cqlservlet.mpi.nl/"; 909 911 910 VloConfig.setCqlEndpointFilter(param);911 912 String result = VloConfig.getCqlEndpointFilter();912 config.setCqlEndpointFilter(param); 913 914 String result = config.getCqlEndpointFilter(); 913 915 914 916 assertEquals(param, result); … … 924 926 925 927 String expResult = "http://cqlservlet.mpi.nl/"; 926 String result = VloConfig.getCqlEndpointAlternative();928 String result = config.getCqlEndpointAlternative(); 927 929 928 930 assertEquals(expResult, result); … … 939 941 String param = "http://cqlservlet.mpi.nl/"; 940 942 941 VloConfig.setCqlEndpointAlternative(param);942 943 String result = VloConfig.getCqlEndpointAlternative();943 config.setCqlEndpointAlternative(param); 944 945 String result = config.getCqlEndpointAlternative(); 944 946 945 947 assertEquals(param, result); -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIComponentProfileNamePostProcessor.java
r3135 r4507 70 70 } 71 71 vg = new VTDGen(); 72 BASE_URL = VloConfig.getComponentRegistryRESTURL();72 BASE_URL = MetadataImporter.config.getComponentRegistryRESTURL(); 73 73 } 74 74 } -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java
r4029 r4507 8 8 import com.ximpleware.XPathEvalException; 9 9 import com.ximpleware.XPathParseException; 10 import eu.clarin.cmdi.vlo.config.VloConfig;11 10 import java.io.File; 12 11 import java.io.FileInputStream; … … 59 58 LOG.info("FILE WITH WEIRD HTTP THINGY! " + tolog); 60 59 } 61 String facetConceptsFile = VloConfig.getFacetConceptsFile();60 String facetConceptsFile = MetadataImporter.config.getFacetConceptsFile(); 62 61 if (facetConceptsFile.length() == 0){ 63 62 // use the packaged facet mapping file … … 83 82 if (index != -1) { 84 83 String profileId = nav.toString(index).trim(); 85 result = VloConfig.getComponentRegistryProfileSchema(profileId);84 result = MetadataImporter.config.getComponentRegistryProfileSchema(profileId); 86 85 } 87 86 return result; -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessor.java
r2768 r4507 2 2 3 3 import eu.clarin.cmdi.vlo.CommonUtils; 4 import eu.clarin.cmdi.vlo.config.VloConfig;5 4 import java.util.Map; 6 5 import org.slf4j.Logger; … … 41 40 LOG.debug("Creating country code map."); 42 41 try { 43 Map<String, String> result = CommonUtils.createCMDIComponentItemMap( VloConfig.getCountryComponentUrl());42 Map<String, String> result = CommonUtils.createCMDIComponentItemMap(MetadataImporter.config.getCountryComponentUrl()); 44 43 return result; 45 44 } catch (Exception e) { -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessor.java
r2768 r4507 18 18 19 19 import eu.clarin.cmdi.vlo.CommonUtils; 20 import eu.clarin.cmdi.vlo.config.VloConfig;21 20 22 21 public class LanguageCodePostProcessor implements PostProcessor{ … … 98 97 private Map<String, String> getTwoLetterCountryCodeMap() { 99 98 if (twoLetterCodesMap == null) { 100 twoLetterCodesMap = createCodeMap( VloConfig.getLanguage2LetterCodeComponentUrl());99 twoLetterCodesMap = createCodeMap(MetadataImporter.config.getLanguage2LetterCodeComponentUrl()); 101 100 } 102 101 return twoLetterCodesMap; … … 105 104 private Map<String, String> getThreeLetterCountryCodeMap() { 106 105 if (threeLetterCodesMap == null) { 107 threeLetterCodesMap = createCodeMap( VloConfig.getLanguage3LetterCodeComponentUrl());106 threeLetterCodesMap = createCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl()); 108 107 } 109 108 return threeLetterCodesMap; … … 112 111 protected Map<String, String> getLanguageNameToIso639Map() { 113 112 if (languageNameToIso639Map == null) { 114 languageNameToIso639Map = createReverseCodeMap( VloConfig.getLanguage3LetterCodeComponentUrl());113 languageNameToIso639Map = createReverseCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl()); 115 114 } 116 115 return languageNameToIso639Map; … … 119 118 private Map<String, String> getIso639ToLanguageNameMap() { 120 119 if (iso639ToLanguageNameMap == null) { 121 iso639ToLanguageNameMap = createCodeMap( VloConfig.getLanguage3LetterCodeComponentUrl());120 iso639ToLanguageNameMap = createCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl()); 122 121 } 123 122 … … 151 150 DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); 152 151 domFactory.setNamespaceAware(true); 153 URL url = new URL( VloConfig.getSilToISO639CodesUrl());152 URL url = new URL(MetadataImporter.config.getSilToISO639CodesUrl()); 154 153 DocumentBuilder builder = domFactory.newDocumentBuilder(); 155 154 Document doc = builder.parse(url.openStream()); -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageLinkPostProcessor.java
r2768 r4507 3 3 import java.util.Map; 4 4 5 import eu.clarin.cmdi.vlo.FacetConstants;6 5 7 6 public class LanguageLinkPostProcessor extends LanguageCodePostProcessor { … … 18 17 String langCode = extractISO639LanguageCode(value); 19 18 if(langCode.length() == 3) 20 result = "<a href=\""+ FacetConstants.LANGUAGE_LINK_PREFIX+ langCode+"\">"+getLanguageNameForLanguageCode(langCode.toUpperCase())+"</a>";19 result = "<a href=\""+ MetadataImporter.config.getLanguageLinkPrefix() + langCode+"\">"+getLanguageNameForLanguageCode(langCode.toUpperCase())+"</a>"; 21 20 } 22 21 return result; -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r4326 r4507 5 5 import eu.clarin.cmdi.vlo.config.DataRoot; 6 6 import eu.clarin.cmdi.vlo.config.VloConfig; 7 import eu.clarin.cmdi.vlo.config.XmlVloConfigFactory; 7 8 8 9 import java.io.File; 9 10 import java.io.IOException; 10 11 import java.net.MalformedURLException; 12 import java.net.URL; 11 13 import java.text.SimpleDateFormat; 12 14 import java.util.ArrayList; … … 120 122 try { 121 123 // Delete the whole Solr db 122 if ( VloConfig.deleteAllFirst()) {124 if (config.deleteAllFirst()) { 123 125 LOG.info("Deleting original data..."); 124 126 solrServer.deleteByQuery("*:*"); … … 138 140 List<File> files = getFilesFromDataRoot(dataRoot.getRootFile()); 139 141 for (File file : files) { 140 if ( VloConfig.getMaxFileSize() > 0 &&141 file.length() > VloConfig.getMaxFileSize()) {142 if (config.getMaxFileSize() > 0 && 143 file.length() > config.getMaxFileSize()) { 142 144 LOG.info("Skipping " + file.getAbsolutePath() + " because it is too large."); 143 145 } else { … … 153 155 154 156 // delete outdated entries (based on maxDaysInSolr parameter) 155 if( VloConfig.getMaxDaysInSolr() > 0 && VloConfig.deleteAllFirst() == false) {156 LOG.info("Deleting old files that were not seen for more than "+ VloConfig.getMaxDaysInSolr()+" days...");157 solrServer.deleteByQuery(FacetConstants.FIELD_LAST_SEEN+":[* TO NOW-"+ VloConfig.getMaxDaysInSolr()+"DAYS]");157 if(config.getMaxDaysInSolr() > 0 && config.deleteAllFirst() == false) { 158 LOG.info("Deleting old files that were not seen for more than "+config.getMaxDaysInSolr()+" days..."); 159 solrServer.deleteByQuery(FacetConstants.FIELD_LAST_SEEN+":[* TO NOW-"+config.getMaxDaysInSolr()+"DAYS]"); 158 160 LOG.info("Deleting old files done."); 159 161 } … … 190 192 */ 191 193 protected List<DataRoot> checkDataRoots() { 192 List<DataRoot> dataRoots = VloConfig.getDataRoots();194 List<DataRoot> dataRoots = config.getDataRoots(); 193 195 for (DataRoot dataRoot : dataRoots) { 194 196 if (!dataRoot.getRootFile().exists()) { … … 230 232 */ 231 233 protected void initSolrServer() throws MalformedURLException { 232 String solrUrl = VloConfig.getSolrUrl();234 String solrUrl = config.getSolrUrl(); 233 235 LOG.info("Initializing Solr Server on " + solrUrl); 234 236 … … 237 239 */ 238 240 solrServer = new ConcurrentUpdateSolrServer(solrUrl, 239 VloConfig.getMinDocsInSolrQueue(), 2) {241 config.getMinDocsInSolrQueue(), 2) { 240 242 /* 241 243 * Let the super class method handle exceptions. Make the … … 354 356 addResourceData(solrDocument, cmdiData); 355 357 docs.add(solrDocument); 356 if (docs.size() == VloConfig.getMaxDocsInList()) {358 if (docs.size() == config.getMaxDocsInList()) { 357 359 sendDocs(); 358 360 } … … 428 430 } 429 431 432 public static VloConfig config; 433 430 434 /** 431 435 * @param args … … 434 438 public static void main(String[] args) throws MalformedURLException, IOException { 435 439 436 // application configuration437 VloConfig config;438 440 439 441 // path to the configuration file … … 494 496 } else { 495 497 // read the configuration from the externally supplied file 496 VloConfig.readConfig(configFile); 498 XmlVloConfigFactory configFactory = new XmlVloConfigFactory(new URL(configFile)); 499 MetadataImporter.config = configFactory.newConfig(); 497 500 498 501 // optionally, modify the configuration here … … 504 507 // finished importing 505 508 506 if ( VloConfig.printMapping()) {509 if (MetadataImporter.config.printMapping()) { 507 510 File file = new File("xsdMapping.txt"); 508 511 FacetMappingFactory.printMapping(file); -
vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/NationalProjectPostProcessor.java
r4029 r4507 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig;4 3 import java.io.File; 5 4 import java.io.IOException; … … 51 50 52 51 private Map<String, String> getNationalProjectMapping() { 53 String projectsMappingFile = VloConfig.getNationalProjectMapping();52 String projectsMappingFile = MetadataImporter.config.getNationalProjectMapping(); 54 53 55 54 if (projectsMappingFile.length() == 0) { -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIDataProcessorTest.java
r4199 r4507 2 2 3 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 import eu.clarin.cmdi.vlo.config.VloConfig;5 4 import java.io.File; 6 5 import java.util.ArrayList; … … 13 12 import static org.junit.Assert.assertNotNull; 14 13 import static org.junit.Assert.assertTrue; 15 import org.junit.Before;16 14 import org.junit.Test; 17 15 … … 26 24 27 25 // make sure the mapping file for testing is used 28 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");26 config.setFacetConceptsFile("/facetConceptsTest.xml"); 29 27 30 28 String content = ""; … … 90 88 91 89 // make sure the mapping file for testing is used 92 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");90 config.setFacetConceptsFile("/facetConceptsTest.xml"); 93 91 94 92 String content = ""; … … 415 413 416 414 // make sure the mapping file for testing is used 417 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");415 config.setFacetConceptsFile("/facetConceptsTest.xml"); 418 416 419 417 String content = ""; … … 444 442 445 443 // make sure the mapping file for testing is used 446 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");444 config.setFacetConceptsFile("/facetConceptsTest.xml"); 447 445 448 446 String content = ""; … … 536 534 537 535 // make sure the mapping file for testing is used 538 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");536 config.setFacetConceptsFile("/facetConceptsTest.xml"); 539 537 540 538 String content = ""; … … 622 620 623 621 // make sure the mapping file for testing is used 624 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");622 config.setFacetConceptsFile("/facetConceptsTest.xml"); 625 623 626 624 String content = ""; … … 717 715 718 716 // make sure the mapping file for testing is used 719 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");717 config.setFacetConceptsFile("/facetConceptsTest.xml"); 720 718 721 719 String content = ""; … … 743 741 744 742 // make sure the mapping file for testing is used 745 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");743 config.setFacetConceptsFile("/facetConceptsTest.xml"); 746 744 747 745 String content = ""; … … 769 767 770 768 // make sure the mapping file for testing is used 771 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");769 config.setFacetConceptsFile("/facetConceptsTest.xml"); 772 770 773 771 String content = ""; … … 800 798 801 799 // make sure the mapping file for testing is used 802 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");800 config.setFacetConceptsFile("/facetConceptsTest.xml"); 803 801 804 802 String content = ""; … … 852 850 853 851 // make sure the mapping file for testing is used 854 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");852 config.setFacetConceptsFile("/facetConceptsTest.xml"); 855 853 856 854 String content = ""; -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXMLTest.java
r2768 r4507 3 3 import com.ximpleware.VTDGen; 4 4 import com.ximpleware.VTDNav; 5 import eu.clarin.cmdi.vlo.config. VloConfig;5 import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory; 6 6 import static org.junit.Assert.assertEquals; 7 7 import static org.junit.Assert.assertNull; … … 15 15 16 16 // read the configuration from the packaged configuration file 17 VloConfig.readPackagedConfig();17 new DefaultVloConfigFactory().newConfig(); 18 18 19 19 // optionally, modify the configuration here -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessorTest.java
r2768 r4507 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config. VloConfig;3 import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory; 4 4 import static org.junit.Assert.assertEquals; 5 5 import org.junit.Before; … … 12 12 13 13 // read the configuration from the packaged configuration file 14 VloConfig.readPackagedConfig();14 new DefaultVloConfigFactory().newConfig(); 15 15 16 16 // optionally, modify the configuration here -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java
r4326 r4507 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory; 3 4 import eu.clarin.cmdi.vlo.config.VloConfig; 5 import eu.clarin.cmdi.vlo.config.VloConfigFactory; 4 6 import java.io.File; 5 7 import java.io.IOException; … … 9 11 10 12 public abstract class ImporterTestcase { 13 14 private final VloConfigFactory configFactory = new DefaultVloConfigFactory(); 15 protected VloConfig config; 16 11 17 private File testDir; 12 18 … … 28 34 testDir.mkdir(); 29 35 testDir.deleteOnExit(); 30 36 31 37 // read the configuration defined in the packaged configuration file 32 VloConfig.readPackagedConfig();38 config = configFactory.newConfig(); 33 39 34 40 // optionally, modify the configuration here 35 36 VloConfig.setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"); 41 config.setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"); 37 42 } 38 43 -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java
r2768 r4507 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config. VloConfig;3 import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory; 4 4 import static org.junit.Assert.assertEquals; 5 5 import org.junit.Before; … … 12 12 13 13 // read the configuration from the packaged configuration file 14 VloConfig.readPackagedConfig();14 new DefaultVloConfigFactory().newConfig(); 15 15 16 16 // optionally, modify the configuration here -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java
r4071 r4507 3 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 4 import eu.clarin.cmdi.vlo.config.DataRoot; 5 import eu.clarin.cmdi.vlo.config.VloConfig;6 5 import java.io.File; 7 6 import java.io.IOException; … … 262 261 263 262 // make sure the mapping file for testing is used 264 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");263 config.setFacetConceptsFile("/facetConceptsTest.xml"); 265 264 266 265 List<DataRoot> dataRoots = checkDataRoots(); … … 276 275 getFilesFromDataRoot(dataRoot.getRootFile()); 277 276 for (File file : files) { 278 if ( VloConfig.getMaxFileSize () > 0277 if (config.getMaxFileSize () > 0 279 278 && file.length() > 280 VloConfig.getMaxFileSize()) {279 config.getMaxFileSize()) { 281 280 LOG.info("Skipping " + file.getAbsolutePath() + 282 281 " because it is too large."); … … 340 339 dataRoot.setTostrip(""); 341 340 dataRoot.setPrefix("http://example.com"); 342 VloConfig.setDataRoots(Collections.singletonList(dataRoot));341 config.setDataRoots(Collections.singletonList(dataRoot)); 343 342 } 344 343 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/config/VloSpringConfig.java
r4502 r4507 53 53 @Bean 54 54 public VloConfig vloConfig() { 55 VloConfig.readPackagedConfig(); 56 return VloConfig.config; 55 return vloConfigFactory().newConfig(); 56 } 57 58 @Bean 59 public VloConfigFactory vloConfigFactory(){ 60 return new DefaultVloConfigFactory(); 57 61 } 58 62 … … 64 68 @Bean 65 69 public SearchResultsDao searchResultsDao() { 66 return new SearchResultsDaoImpl(solrServer() );70 return new SearchResultsDaoImpl(solrServer(), vloConfig()); 67 71 } 68 72 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/AutoCompleteDao.java
r4502 r4507 1 1 package eu.clarin.cmdi.vlo.service.impl; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import java.util.ArrayList; 4 5 import java.util.Iterator; … … 18 19 public class AutoCompleteDao extends SolrDaoImpl { 19 20 20 public AutoCompleteDao(SolrServer solrServer ) {21 super(solrServer );21 public AutoCompleteDao(SolrServer solrServer, VloConfig config) { 22 super(solrServer, config); 22 23 } 23 24 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SearchResultsDaoImpl.java
r4502 r4507 3 3 import eu.clarin.cmdi.vlo.service.SearchResultsDao; 4 4 import eu.clarin.cmdi.vlo.FacetConstants; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 5 6 import java.util.List; 6 7 import org.apache.solr.client.solrj.SolrQuery; … … 12 13 public class SearchResultsDaoImpl extends SolrDaoImpl implements SearchResultsDao { 13 14 14 public SearchResultsDaoImpl(SolrServer solrServer ) {15 super(solrServer );15 public SearchResultsDaoImpl(SolrServer solrServer, VloConfig config) { 16 super(solrServer, config); 16 17 } 17 18 -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SolrDaoImpl.java
r4502 r4507 19 19 private final static Logger LOG = LoggerFactory.getLogger(SolrDaoImpl.class); 20 20 private final SolrServer solrServer; 21 private final VloConfig config; 21 22 22 public SolrDaoImpl(SolrServer solrServer ) {23 public SolrDaoImpl(SolrServer solrServer, VloConfig config) { 23 24 this.solrServer = solrServer; 25 this.config = config; 24 26 } 25 27 … … 53 55 // present the facets from the config file as a list to a new set 54 56 Set<String> facetsDefined; 55 facetsDefined = new HashSet<String>(Arrays.asList( VloConfig.getFacetFields()));57 facetsDefined = new HashSet<String>(Arrays.asList(config.getFacetFields())); 56 58 57 59 // check the filters in the query by name -
vlo/branches/vlo-3.0/vlo-web-app/src/test/java/eu/clarin/cmdi/vlo/service/impl/SearchResultsDaoImplTest.java
r4505 r4507 18 18 19 19 import eu.clarin.cmdi.vlo.FacetConstants; 20 import eu.clarin.cmdi.vlo.config.VloConfig; 20 21 import eu.clarin.cmdi.vlo.importer.CMDIData; 21 22 import java.io.File; … … 49 50 initCore(getResourcePath(getConfigString()), getResourcePath(getSchemaString())); 50 51 server = new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName()); 51 instance = new SearchResultsDaoImpl(server );52 instance = new SearchResultsDaoImpl(server, new VloConfig()); 52 53 } 53 54
Note: See TracChangeset
for help on using the changeset viewer.