Changeset 2627
- Timestamp:
- 02/26/13 11:46:33 (11 years ago)
- Location:
- vlo/branches/vlo-2.13-param/vlo_webapp
- Files:
-
- 9 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-2.13-param/vlo_webapp/nbactions.xml
r2597 r2627 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <actions> 3 4 5 6 </actions> 3 4 </actions> -
vlo/branches/vlo-2.13-param/vlo_webapp/pom.xml
r2597 r2627 215 215 </dependency> 216 216 <dependency> 217 <groupId>org.springframework</groupId>218 <artifactId>spring-context</artifactId>219 <version>2.5.6</version>220 </dependency>221 <dependency>222 <groupId>org.springframework</groupId>223 <artifactId>spring-web</artifactId>224 <version>2.5.6</version>225 </dependency>226 <dependency>227 217 <groupId>com.ximpleware</groupId> 228 218 <artifactId>vtd-xml</artifactId> … … 245 235 <version>2.4.1</version> 246 236 </dependency> 237 <dependency> 238 <groupId>commons-cli</groupId> 239 <artifactId>commons-cli</artifactId> 240 <version>1.2</version> 241 <type>jar</type> 242 </dependency> 247 243 </dependencies> 248 244 249 250 245 </project> -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/CommonUtils.java
r2352 r2627 7 7 import java.util.Map; 8 8 import java.util.Set; 9 10 9 import javax.xml.parsers.DocumentBuilder; 11 10 import javax.xml.parsers.DocumentBuilderFactory; … … 15 14 import javax.xml.xpath.XPathExpressionException; 16 15 import javax.xml.xpath.XPathFactory; 17 18 16 import org.w3c.dom.Document; 19 17 import org.w3c.dom.Node; -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/VloApplication.java
r2604 r2627 18 18 public class VloApplication extends WebApplication { 19 19 20 private finalSearchResultsDao searchResults;20 private SearchResultsDao searchResults; 21 21 22 22 // application configuration … … 27 27 28 28 /** 29 * Method that will be invoked when the application starts 29 * Method that will be invoked when the application starts<br><br> 30 * 30 31 */ 31 32 @Override … … 47 48 config = VloConfig.switchToExternalConfig(servletContext); 48 49 } 50 51 // start the application 52 53 searchResults = new SearchResultsDao(); 49 54 } 50 55 … … 69 74 // let the {@literal init()} method know that there will be a context 70 75 71 inContext = true; 72 73 // start the application 74 75 searchResults = new SearchResultsDao(); 76 inContext = true; 76 77 } 77 78 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java
r2604 r2627 13 13 /** 14 14 * Web application configuration<br><br> 15 * 16 * A parameter that is part of the configuration of the VLO web application can 17 * be of two types: it is either a parameter that is defined from within the 18 * application, an application parameter, or it is a parameter that is defined 19 * in the context in which the application will live as a {@literal servlet}. 20 * Application parameters reside in the {@literal WebAppConfig.xml} file, while 21 * {@literal servlet} context parameters are part of the Tomcat server 22 * configuration. <br><br> 23 * 24 * An application parameter is defined an XML file in the resources directory of 25 * the application package. For every application parameter, the WebApplication 26 * class contains a member that is annotated according to the Simple framework 27 * specification. So<br><br> 15 * 16 * Map the elements in the packaged {@literal WebAppConfig.xml} file to the 17 * members in this class, the configuration of the VLO web application and 18 * importer according to the Simple framework specification. So<br><br> 28 19 * 29 20 * {@literal <parameterMember>}"the value of the … … 36 27 * @element}<br> {@literal parameterMember}<br><br> 37 28 * 38 * in the WebAppConfig class. When the application invokes Simple by<br><br> 39 * 40 * WebAppConfig.get();<br><br> 41 * 42 * the parameter itself is accessed by<br><br> 43 * 44 * WebAppConfig.get().getParameterMember();<br><br> 45 * 46 * If you want to add a type of member that is not included in the class yet, 47 * refer to the Simple framework's specification.<br><br> 48 * 49 * A context parameter also resides in an XML file. For more information on the 50 * location and the format of this file, please refer to the Apache Tomcat 51 * configuration reference.<br><br> 29 * in the VloConfig class. If you want to add a type of member that is not 30 * included in the class yet, refer to the Simple framework's 31 * specification.<br><br> 52 32 * 53 * Because the application is indifferent to the origin of a parameter, the 54 * WebAppConfig class is the place to switch from one type of parameter to the 55 * other. In other words: you do not have to change the application if you 56 * replace an application parameter by a context parameter. The change is 57 * reflected here, and not in the application. In a sense, this relieves the 58 * need to use get and read methods. Such methods still have an advantage 59 * though, because you can change a parameter without changing the rest of the 60 * application.<br><br> 33 * The parameters are stored statically. This means that a parameter can be 34 * referenced from the application without first creating a configuration 35 * object. So get() in 36 * 37 * WebAppConfig.get().getSomeParameter();<br><br> 38 * 39 * will return the static configuration, and getSomeParameter() will return a 40 * specific parameter in this configuration. 41 * 42 * Through the get and set methods, the application is indifferent to the origin 43 * of a parameter: you can get and set the value of a parameter without having 44 * to worry about how the parameter was defined originally. By invoking the read 45 * method, and by querying the context, the web application, on initialization, 46 * determines which definition to use. 47 * 48 * Also, the get and set methods allow for a modification of the original value 49 * of the parameter. For example, if the format of a parameter changes, this 50 * change can be handled in the get and set method once, instead of having to 51 * modify every reference to the parameter in the application. 61 52 * 62 53 * Please note on the explanation of the meaning of the parameters. Because the … … 97 88 98 89 /** 99 * Make the configuration statically accessible<br><br> 100 * 101 * Both the Simple framework and the methods in the web application need to 102 * access the configuration. Access is granted by defining a member holding 103 * the configuration, that is, by defining a member of type WebAppConfig. 90 * Make the configuration statically accessible 104 91 */ 105 92 private static VloConfig config = null; 106 93 107 94 /** 108 * kj: change the annotation. Instead of opening a context, it is now a 109 * matter of initializing it. Make a new method for referencing. 110 * 111 * Open a static context of WebAppConfig members, and assign values to 112 * them.<br><br> 113 * 114 * The web application can access a parameter by invoking one of the get or 115 * set methods defined below. Because these methods return a non-static 116 * value, while WebAppConfig on the other hand denotes a static 117 * context,<br><br> 118 * 119 * WebAppConfig.getParameterMember()<br><br> 120 * 121 * for example, would not be valid. On encountering get() however, a new 122 * static context is opened, and from that, getParameterMember() can be 123 * invoked:<br><br> 124 * 125 * WebAppConfig.get().getParameterMember()<br><br> 126 * 95 * Read the configuration from an XML file. 96 * 97 * Please invoke this method from the web application or from the importer; 98 * the readTestConfig method is intended for testing purposes. 99 * 127 100 * @param fileName 128 101 * 129 * @return the web application configuration in a new static context102 * @return the web application configuration 130 103 */ 131 104 public static VloConfig readConfig(String fileName) { … … 143 116 144 117 /** 145 * kj: add comment, much in the same way as the annotation of the WepApp 146 * method. 147 * 148 * In this method, exceptions to the normal web application context can 149 * be made. 118 * Read the configuration from an XML file. 119 * 120 * Please invoke this method from the package tests. If the tests invoke a 121 * method different from the one used by the web application and the 122 * important, you can make some test specific changes to the parameters 123 * here. 150 124 * 151 125 * @param fileName 152 * 153 * @return 126 * 127 * @return the web application configuration in a new static context 154 128 */ 155 129 public static VloConfig readTestConfig(String fileName) { … … 167 141 168 142 /** 169 * kj: this is the new get context method143 * Return the configuration 170 144 * 171 145 * @return … … 186 160 */ 187 161 188 /**189 * Flag to signal the records in the data to be deleted before the ingestion190 * starts.191 */192 162 @Element // directive for Simple 193 163 private boolean deleteAllFirst = false; 194 164 195 /**196 * Flag that leads to the printing of XPATH mappings encountered. Note: need197 * to be more specific on this.198 */199 165 @Element 200 166 private boolean printMapping = false; 201 167 202 /**203 * A list of data roots, that is: directories from which the importer204 * collects meta data. Note: need to elaborate on this.205 */206 168 @ElementList // directive for Simple 207 169 private List<DataRoot> dataRoots; … … 216 178 @Element 217 179 private String solrUrl = ""; 218 // In the XML file, the value of the parameter is expanded by Maven.219 180 220 181 @Element … … 279 240 280 241 /** 281 * Get and readmethods for web application parameter members<br><br>282 * 283 * By using a get or readmethod, you can apply an operation to a parameter284 * here , in the WebAppConfig class, without the need to make changes in285 * different parts of theapplication.242 * Get and set methods for web application parameter members<br><br> 243 * 244 * By using a get or set method, you can apply an operation to a parameter 245 * here without the need to make changes in different parts of the 246 * application. 286 247 */ 287 248 … … 376 337 * documentation. 377 338 * 378 * @ param solrUrlthe value339 * @return the value 379 340 */ 380 341 public String getSolrUrl() { 381 342 return solrUrl; 343 } 344 345 /** 346 * Set the value of the SolrUrl parameter<br><br> 347 * 348 * For a description of the parameter, refer to the general VLO 349 * documentation. 350 * 351 * @param the parameter 352 */ 353 public void setSolrUrl(String url) { 354 this.solrUrl = url; 382 355 } 383 356 … … 652 625 653 626 /** 654 * 655 * kj: repair annotation 656 * 657 * Contrary to Simple, the web application's context parameters are not 658 * retrieved by annotation. Get them by invoking a local method. 659 * 660 * Add properties of the {@literal servlet's} context<br><br> 661 * 662 * Keep the properties in the static context of the WebAppConfig class, next 663 * to the members representing the values in WebAppConfig.xml file.<br><br> 664 * 627 * Switch to external configuration.<br><br> 628 * 629 * In addition to the definition of the configuration by the packaged in the 630 * {@literal VloConfig.xml} file, you can configure the web application by 631 * means of an XML file that resides outside the package. By letting a 632 * parameter named<br><br> 633 * 634 * externalConfig<br><br> 635 * 636 * in the context reference an XML file similar to the packaged one, the 637 * parameters defined in this file will override the packaged parameters. 638 * Please note that the use of an external XML file is not 639 * compulsory.<br><br> 640 * 641 * Another way to externally configure the web application is to define 642 * parameters by including them in the context fragment not via an XML file, 643 * but directly. At the moment, only the packaged <br><br> 644 * 645 * solrUrl<br><br> 646 * 647 * parameter can be overridden in this way. 648 * 665 649 * @param config static configuration 666 650 * … … 668 652 */ 669 653 public static VloConfig switchToExternalConfig(ServletContext context) { 670 671 // retrieve parameter valies from the servlet context 654 655 // assume that there is no file outside the package defining parameters 656 657 boolean externalConfig = false; 658 659 // check for a reference to of such a file 672 660 673 661 String fileName; 674 662 fileName = context.getInitParameter("externalConfig"); 675 663 676 664 if (fileName == null) { 677 // no external config 665 // no external configuration file 678 666 } else { 679 667 config = (VloConfig) read(fileName, config); 680 668 } 669 670 /** 671 * In addition to modifications via an external configuration file, 672 * check if the current configuration needs to be modified because of a 673 * parameter defined in the context directly. 674 */ 675 String url = context.getInitParameter("solrUrl"); 676 677 if (url == null){ 678 // no overruling parameter in the context 679 } else 680 { 681 // overrule the current value of solrUrl 682 683 VloConfig.get().setSolrUrl(url); 684 } 685 686 // return the current configuration, modified or not 681 687 682 688 return config; 683 } 684 685 /** 686 * {@literal Servlet} context members<br><br> 687 * 688 * The following defines the members corresponding to {@servlet} context 689 * parameters. 690 */ 689 } 691 690 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIComponentProfileNamePostProcessor.java
r2501 r2627 1 1 package eu.clarin.cmdi.vlo.importer; 2 3 import java.util.HashMap;4 5 import org.slf4j.Logger;6 import org.slf4j.LoggerFactory;7 2 8 3 import com.ximpleware.AutoPilot; … … 10 5 import com.ximpleware.VTDNav; 11 6 import com.ximpleware.XPathParseException; 12 13 import eu.clarin.cmdi.vlo.Configuration; 7 import eu.clarin.cmdi.vlo.config.VloConfig; 8 import java.util.HashMap; 9 import org.slf4j.Logger; 10 import org.slf4j.LoggerFactory; 14 11 15 12 /** … … 72 69 } 73 70 vg = new VTDGen(); 74 BASE_URL = Configuration.getInstance().getComponentRegistryRESTURL();71 BASE_URL = VloConfig.get().getComponentRegistryRESTURL(); 75 72 } 76 73 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java
r2498 r2627 1 1 package eu.clarin.cmdi.vlo.importer; 2 3 import java.io.File;4 import java.io.FileInputStream;5 import java.io.IOException;6 import java.util.List;7 import java.util.Map;8 9 import org.apache.commons.io.IOUtils;10 import org.slf4j.Logger;11 import org.slf4j.LoggerFactory;12 2 13 3 import com.ximpleware.AutoPilot; … … 18 8 import com.ximpleware.XPathEvalException; 19 9 import com.ximpleware.XPathParseException; 20 21 import eu.clarin.cmdi.vlo.Configuration; 10 import eu.clarin.cmdi.vlo.config.VloConfig; 11 import java.io.File; 12 import java.io.FileInputStream; 13 import java.io.IOException; 14 import java.util.List; 15 import java.util.Map; 16 import org.apache.commons.io.IOUtils; 17 import org.slf4j.Logger; 18 import org.slf4j.LoggerFactory; 22 19 23 20 public class CMDIParserVTDXML implements CMDIDataProcessor { … … 82 79 if (index != -1) { 83 80 String profileId = nav.toString(index).trim(); 84 result = Configuration.getInstance().getComponentRegistryProfileSchema(profileId);81 result = VloConfig.get().getComponentRegistryProfileSchema(profileId); 85 82 } 86 83 return result; -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessor.java
r1043 r2627 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.CommonUtils; 4 import eu.clarin.cmdi.vlo.config.VloConfig; 3 5 import java.util.Map; 4 5 6 import org.slf4j.Logger; 6 7 import org.slf4j.LoggerFactory; 7 8 import eu.clarin.cmdi.vlo.CommonUtils;9 import eu.clarin.cmdi.vlo.Configuration;10 8 11 9 public class CountryNamePostProcessor implements PostProcessor { … … 43 41 LOG.debug("Creating country code map."); 44 42 try { 45 Map<String, String> result = CommonUtils.createCMDIComponentItemMap( Configuration.getInstance().getCountryComponentUrl());43 Map<String, String> result = CommonUtils.createCMDIComponentItemMap(VloConfig.get().getCountryComponentUrl()); 46 44 return result; 47 45 } catch (Exception e) { -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessor.java
r2008 r2627 18 18 19 19 import eu.clarin.cmdi.vlo.CommonUtils; 20 import eu.clarin.cmdi.vlo. Configuration;20 import eu.clarin.cmdi.vlo.config.VloConfig; 21 21 22 22 public class LanguageCodePostProcessor implements PostProcessor{ … … 98 98 private Map<String, String> getTwoLetterCountryCodeMap() { 99 99 if (twoLetterCodesMap == null) { 100 twoLetterCodesMap = createCodeMap( Configuration.getInstance().getLanguage2LetterCodeComponentUrl());100 twoLetterCodesMap = createCodeMap(VloConfig.get().getLanguage2LetterCodeComponentUrl()); 101 101 } 102 102 return twoLetterCodesMap; … … 105 105 private Map<String, String> getThreeLetterCountryCodeMap() { 106 106 if (threeLetterCodesMap == null) { 107 threeLetterCodesMap = createCodeMap( Configuration.getInstance().getLanguage3LetterCodeComponentUrl());107 threeLetterCodesMap = createCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl()); 108 108 } 109 109 return threeLetterCodesMap; … … 112 112 protected Map<String, String> getLanguageNameToIso639Map() { 113 113 if (languageNameToIso639Map == null) { 114 languageNameToIso639Map = createReverseCodeMap( Configuration.getInstance().getLanguage3LetterCodeComponentUrl());114 languageNameToIso639Map = createReverseCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl()); 115 115 } 116 116 return languageNameToIso639Map; … … 119 119 private Map<String, String> getIso639ToLanguageNameMap() { 120 120 if (iso639ToLanguageNameMap == null) { 121 iso639ToLanguageNameMap = createCodeMap( Configuration.getInstance().getLanguage3LetterCodeComponentUrl());121 iso639ToLanguageNameMap = createCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl()); 122 122 } 123 123 … … 151 151 DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); 152 152 domFactory.setNamespaceAware(true); 153 URL url = new URL( Configuration.getInstance().getSilToISO639CodesUrl());153 URL url = new URL(VloConfig.get().getSilToISO639CodesUrl()); 154 154 DocumentBuilder builder = domFactory.newDocumentBuilder(); 155 155 Document doc = builder.parse(url.openStream()); -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r2604 r2627 2 2 3 3 import eu.clarin.cmdi.vlo.CommonUtils; 4 import eu.clarin.cmdi.vlo.Configuration;5 4 import eu.clarin.cmdi.vlo.FacetConstants; 6 5 import eu.clarin.cmdi.vlo.config.DataRoot; … … 16 15 import java.util.Map; 17 16 import java.util.Set; 17 import org.apache.commons.cli.CommandLine; 18 import org.apache.commons.cli.CommandLineParser; 19 import org.apache.commons.cli.Options; 20 import org.apache.commons.cli.PosixParser; 18 21 import org.apache.commons.io.FileUtils; 19 22 import org.apache.solr.client.solrj.SolrServerException; … … 207 210 */ 208 211 protected void initSolrServer() throws MalformedURLException { 209 String solrUrl = Configuration.getInstance().getSolrUrl();212 String solrUrl = VloConfig.get().getSolrUrl(); 210 213 LOG.info("Initializing Solr Server on " + solrUrl); 211 214 solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) { … … 375 378 * @throws IOException 376 379 */ 377 public static void main(String[] args) throws IOException { 378 379 String fileName; 380 public static void main(String[] args) throws MalformedURLException, IOException { 380 381 381 382 VloConfig config; 382 383 if (args.length > 0) { 384 385 // get the file name from the command line 386 fileName = VloConfig.class.getResource(args[0]).getFile(); 387 388 // test for file existence 389 390 // optionally, modify the configuration before starting the importer 391 392 config = VloConfig.readConfig(fileName); 393 394 MetadataImporter importer = new MetadataImporter(config); 395 396 importer.startImport(); 397 398 if (config.isPrintMapping()) { 399 File file = new File("xsdMapping.txt"); 400 FacetMappingFactory.printMapping(file); 401 LOG.info("Printed facetMapping in " + file); 402 } 383 384 Options options = new Options(); 385 386 // add t option 387 options.addOption("f", true, "use parameters specified in -f <file>"); 388 389 CommandLineParser parser = new PosixParser(); 390 391 try { 392 // parse the command line arguments 393 CommandLine cmd = parser.parse(options, args); 394 if (cmd.hasOption("f")) { 395 // get the value of the f option 396 397 String fileName; 398 fileName = cmd.getOptionValue("f"); 399 400 // include the full path in the name 401 402 fileName = VloConfig.class.getResource(fileName).getFile(); 403 404 // optionally, check for file existence here 405 406 // read the configuration defined in the file 407 408 config = VloConfig.readConfig(fileName); 409 410 // optionally, modify the configuration here 411 412 MetadataImporter importer = new MetadataImporter(config); 413 importer.startImport(); 414 if (config.isPrintMapping()) { 415 File file = new File("xsdMapping.txt"); 416 FacetMappingFactory.printMapping(file); 417 LOG.info("Printed facetMapping in " + file); 418 } 419 } 420 421 } catch (org.apache.commons.cli.ParseException ex) { 422 LOG.error("Command line parsing failed."); 423 424 // System.err.println("Command line parsing failed. " + ex.getMessage()); 403 425 } 404 426 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/NationalProjectPostProcessor.java
r1887 r2627 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import java.io.File; 4 5 import java.io.IOException; 5 6 import java.util.HashMap; 6 7 import java.util.Map; 7 8 8 import javax.xml.parsers.DocumentBuilder; 9 9 import javax.xml.parsers.DocumentBuilderFactory; … … 11 11 import javax.xml.xpath.XPathConstants; 12 12 import javax.xml.xpath.XPathFactory; 13 14 import eu.clarin.cmdi.vlo.Configuration;15 13 import org.apache.commons.io.FileUtils; 16 14 import org.slf4j.Logger; … … 53 51 54 52 private Map<String, String> getNationalProjectMapping() { 55 String mappingFileName = Configuration.getInstance().getNationalProjectMapping();53 String mappingFileName = VloConfig.get().getNationalProjectMapping(); 56 54 if(mappingFileName == null){ 57 55 throw new RuntimeException("Configuration Error, NationalProjectMapping is null"); -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.java
r2597 r2627 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 import eu.clarin.cmdi.vlo.Resources; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 6 import eu.clarin.cmdi.vlo.dao.AutoCompleteDao; 7 import fiftyfive.wicket.basic.TruncatedLabel; 3 8 import java.io.UnsupportedEncodingException; 4 9 import java.util.ArrayList; … … 6 11 import java.util.Iterator; 7 12 import java.util.List; 8 9 13 import org.apache.solr.client.solrj.SolrServerException; 10 14 import org.apache.solr.client.solrj.response.FacetField; … … 26 30 import org.apache.wicket.model.IModel; 27 31 import org.apache.wicket.model.ResourceModel; 28 29 import eu.clarin.cmdi.vlo.Configuration;30 import eu.clarin.cmdi.vlo.FacetConstants;31 import eu.clarin.cmdi.vlo.Resources;32 import eu.clarin.cmdi.vlo.config.VloConfig;33 import eu.clarin.cmdi.vlo.dao.AutoCompleteDao;34 import fiftyfive.wicket.basic.TruncatedLabel;35 32 36 33 public class FacetedSearchPage extends BasePage { -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/HtmlFormCreator.java
r2597 r2627 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import java.io.UnsupportedEncodingException; 4 5 import java.util.Iterator; 5 6 import java.util.List; 6 7 import java.util.Map; 7 8 8 import net.sf.json.JSONArray; 9 9 import net.sf.json.JSONObject; 10 import eu.clarin.cmdi.vlo.Configuration;11 import eu.clarin.cmdi.vlo.config.VloConfig;12 10 13 11 /** -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanel.java
r2597 r2627 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.CommonUtils; 4 import eu.clarin.cmdi.vlo.FacetConstants; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 3 6 import java.io.IOException; 4 7 import java.net.HttpURLConnection; … … 7 10 import java.net.URLConnection; 8 11 import java.util.HashMap; 9 import java.util.List;10 12 import java.util.Map; 11 12 import net.handle.hdllib.HandleException;13 import net.handle.hdllib.HandleResolver;14 import net.handle.hdllib.HandleValue;15 16 import org.apache.commons.httpclient.HttpMethod;17 13 import org.apache.wicket.behavior.SimpleAttributeModifier; 18 14 import org.apache.wicket.markup.html.basic.Label; … … 23 19 import org.slf4j.Logger; 24 20 import org.slf4j.LoggerFactory; 25 26 import eu.clarin.cmdi.vlo.CommonUtils;27 import eu.clarin.cmdi.vlo.Configuration;28 import eu.clarin.cmdi.vlo.FacetConstants;29 import eu.clarin.cmdi.vlo.config.VloConfig;30 31 import javax.net.ssl.HttpsURLConnection;32 21 33 22 public class ResourceLinkPanel extends Panel { -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageQuery.java
r2597 r2627 1 1 package eu.clarin.cmdi.vlo.pages; 2 2 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 import eu.clarin.cmdi.vlo.config.VloConfig; 3 5 import java.util.HashMap; 4 6 import java.util.Map; 5 6 7 import org.apache.solr.client.solrj.SolrQuery; 7 8 import org.apache.solr.client.solrj.response.FacetField; … … 11 12 import org.apache.wicket.IClusterable; 12 13 import org.apache.wicket.PageParameters; 13 14 import eu.clarin.cmdi.vlo.Configuration;15 import eu.clarin.cmdi.vlo.FacetConstants;16 import eu.clarin.cmdi.vlo.config.VloConfig;17 14 18 15 public class SearchPageQuery implements IClusterable { -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java
r2597 r2627 55 55 import org.slf4j.LoggerFactory; 56 56 57 import eu.clarin.cmdi.vlo.Configuration;58 57 import eu.clarin.cmdi.vlo.FacetConstants; 59 58 import eu.clarin.cmdi.vlo.Resources; -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/resources/VloConfig.xml
r2604 r2627 46 46 <nationalProjectMapping>nationalProjectsMapping.xml</nationalProjectMapping> 47 47 48 <facetFields length=" 6">48 <facetFields length="10"> 49 49 <facetField>collection</facetField> 50 <facetField>language</facetField> 50 51 <facetField>continent</facetField> 51 <facetField>organisation</facetField>52 52 <facetField>genre</facetField> 53 53 <facetField>country</facetField> 54 <facetField>language</facetField> 54 <facetField>subject</facetField> 55 <facetField>organisation</facetField> 56 <facetField>resourceType</facetField> 57 <facetField>dataProvider</facetField> 58 <facetField>nationalProject</facetField> 55 59 </facetFields> 56 60 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/webapp/META-INF/context.xml
r2600 r2627 7 7 <Context antiJARLocking="true" path="/vlo"> 8 8 <Parameter name="externalConfig" value="/Users/keeloo/VloConfig.xml"/> 9 <!--Parameter name="solrUrl" value="http://localhost:8084/vlo_solr/"/--> 9 10 </Context> -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/SearchPageQueryTest.java
r2570 r2627 1 1 package eu.clarin.cmdi.vlo; 2 2 3 import static org.junit.Assert.assertEquals; 4 import static org.junit.Assert.assertNull; 5 3 import eu.clarin.cmdi.vlo.pages.SearchPageQuery; 6 4 import org.apache.solr.client.solrj.response.FacetField; 7 5 import org.apache.solr.common.params.CommonParams; 8 6 import org.apache.wicket.PageParameters; 7 import static org.junit.Assert.assertEquals; 8 import static org.junit.Assert.assertNull; 9 9 import org.junit.Before; 10 10 import org.junit.Test; 11 12 import eu.clarin.cmdi.vlo.pages.SearchPageQuery;13 11 14 12 public class SearchPageQueryTest { … … 26 24 assertEquals("*:*", q.getSolrQuery().getQuery()); 27 25 assertEquals("name,id,description", q.getSolrQuery().getFields()); 28 assertEquals( 6, q.getSolrQuery().getFacetFields().length);26 assertEquals(10, q.getSolrQuery().getFacetFields().length); 29 27 assertEquals("collection", q.getSolrQuery().getFacetFields()[0]); 30 28 assertEquals("continent", q.getSolrQuery().getFacetFields()[1]); -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/TestFacetedSearchPage.java
r2570 r2627 1 1 package eu.clarin.cmdi.vlo; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import org.apache.wicket.util.tester.WicketTester; 4 5 import org.junit.Before; … … 9 10 */ 10 11 public class TestFacetedSearchPage { 11 private WicketTester tester; 12 13 static VloConfig testConfig; 12 14 13 15 @Before 14 16 public void setUp() { 15 // Configuration.getInstance().setSolrUrl("http://localhost:8080/vlo_solr"); 16 tester = new WicketTester(new VloApplication()); 17 18 WicketTester wicketTester; 19 20 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 21 22 testConfig = VloConfig.readTestConfig(fileName); 23 24 // optionally, modify the test configuration here 25 26 wicketTester = new WicketTester(new VloApplication(testConfig)); 17 27 } 18 28 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java
r1938 r2627 4 4 import java.io.IOException; 5 5 6 import eu.clarin.cmdi.vlo. Configuration;6 import eu.clarin.cmdi.vlo.config.VloConfig; 7 7 import org.apache.commons.io.FileUtils; 8 8 import org.junit.AfterClass; … … 29 29 testDir.mkdir(); 30 30 testDir.deleteOnExit(); 31 Configuration.getInstance().setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/");31 VloConfig.get().setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"); 32 32 } 33 33 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanelTest.java
r2059 r2627 3 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 4 import eu.clarin.cmdi.vlo.VloApplication; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 5 6 import org.apache.wicket.util.tester.WicketTester; 6 7 import org.junit.Before; … … 10 11 11 12 public class ResourceLinkPanelTest { 13 14 static VloConfig testConfig; 12 15 13 16 public static final String _SAME_STRING = "http://blabla"; … … 16 19 @Before 17 20 public void setUp() { 18 new WicketTester(new VloApplication()); 21 22 WicketTester wicketTester; 23 24 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 25 26 testConfig = VloConfig.readTestConfig(fileName); 27 28 // optionally, modify the test configuration here 29 30 wicketTester = new WicketTester(new VloApplication(testConfig)); 19 31 } 20 32
Note: See TracChangeset
for help on using the changeset viewer.