Changeset 2627


Ignore:
Timestamp:
02/26/13 11:46:33 (11 years ago)
Author:
keeloo
Message:

Fixed a few tests, moved the SearchResultsDao? method to the init
method of the WebApplication? class. Tested the web application.

From now on, it is possible to override an optional external
configuration file in the context segment by a context definition of
the solrUrl parameter.

Removed parameters from application properties, removed application
properties files themselves, removed unused configuration files and
context segments, and finally: removed Spring dependencies.

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  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<actions>
    3        
    4        
    5        
    6     </actions>
     3           
     4</actions>
  • vlo/branches/vlo-2.13-param/vlo_webapp/pom.xml

    r2597 r2627  
    215215        </dependency>
    216216        <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>
    227217            <groupId>com.ximpleware</groupId>
    228218            <artifactId>vtd-xml</artifactId>
     
    245235            <version>2.4.1</version>
    246236        </dependency>
     237        <dependency>
     238            <groupId>commons-cli</groupId>
     239            <artifactId>commons-cli</artifactId>
     240            <version>1.2</version>
     241            <type>jar</type>
     242        </dependency>
    247243    </dependencies>
    248244
    249 
    250245</project>
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/CommonUtils.java

    r2352 r2627  
    77import java.util.Map;
    88import java.util.Set;
    9 
    109import javax.xml.parsers.DocumentBuilder;
    1110import javax.xml.parsers.DocumentBuilderFactory;
     
    1514import javax.xml.xpath.XPathExpressionException;
    1615import javax.xml.xpath.XPathFactory;
    17 
    1816import org.w3c.dom.Document;
    1917import org.w3c.dom.Node;
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/VloApplication.java

    r2604 r2627  
    1818public class VloApplication extends WebApplication {
    1919
    20     private final SearchResultsDao searchResults;
     20    private SearchResultsDao searchResults;
    2121
    2222    // application configuration
     
    2727
    2828    /**
    29      * Method that will be invoked when the application starts
     29     * Method that will be invoked when the application starts<br><br>
     30     *
    3031     */
    3132    @Override
     
    4748            config = VloConfig.switchToExternalConfig(servletContext);
    4849        }
     50
     51        // start the application
     52
     53        searchResults = new SearchResultsDao();
    4954    }
    5055
     
    6974        // let the {@literal init()} method know that there will be a context
    7075
    71         inContext = true;
    72 
    73         // start the application
    74 
    75         searchResults = new SearchResultsDao();
     76        inContext = true; 
    7677    }
    7778
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r2604 r2627  
    1313/**
    1414 * 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>
    2819 *
    2920 * {@literal <parameterMember>}"the value of the
     
    3627 * @element}<br> {@literal parameterMember}<br><br>
    3728 *
    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>
    5232 *
    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.
    6152 *
    6253 * Please note on the explanation of the meaning of the parameters. Because the
     
    9788   
    9889    /**
    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
    10491     */
    10592    private static VloConfig config = null;
    10693
    10794    /**
    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     *
    127100     * @param fileName
    128101     *
    129      * @return the web application configuration in a new static context
     102     * @return the web application configuration
    130103     */
    131104    public static VloConfig readConfig(String fileName) {
     
    143116
    144117    /**
    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.
    150124     *
    151125     * @param fileName
    152      * 
    153      * @return
     126     *
     127     * @return the web application configuration in a new static context
    154128     */
    155129    public static VloConfig readTestConfig(String fileName) {
     
    167141   
    168142    /**
    169      * kj: this is the new get context method
     143     * Return the configuration
    170144     *
    171145     * @return
     
    186160     */
    187161   
    188     /**
    189      * Flag to signal the records in the data to be deleted before the ingestion
    190      * starts.
    191      */
    192162    @Element // directive for Simple
    193163    private boolean deleteAllFirst = false;
    194164   
    195     /**
    196      * Flag that leads to the printing of XPATH mappings encountered. Note: need
    197      * to be more specific on this.
    198      */
    199165    @Element
    200166    private boolean printMapping = false;
    201167   
    202     /**
    203      * A list of data roots, that is: directories from which the importer
    204      * collects meta data. Note: need to elaborate on this.
    205      */
    206168    @ElementList // directive for Simple
    207169    private List<DataRoot> dataRoots;
     
    216178    @Element
    217179    private String solrUrl = "";
    218     // In the XML file, the value of the parameter is expanded by Maven.
    219180   
    220181    @Element
     
    279240
    280241    /**
    281      * Get and read methods for web application parameter members<br><br>
    282      *
    283      * By using a get or read method, you can apply an operation to a parameter
    284      * here, in the WebAppConfig class, without the need to make changes in
    285      * different parts of the application.
     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.
    286247     */
    287248   
     
    376337     * documentation.
    377338     *
    378      * @param solrUrl the value
     339     * @return the value
    379340     */
    380341    public String getSolrUrl() {
    381342        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;
    382355    }
    383356
     
    652625           
    653626    /**
    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     *
    665649     * @param config static configuration
    666650     *
     
    668652     */
    669653    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
    672660
    673661        String fileName;
    674662        fileName = context.getInitParameter("externalConfig");
    675        
     663               
    676664        if (fileName == null) {
    677             // no external config
     665            // no external configuration file
    678666        } else {
    679667            config = (VloConfig) read(fileName, config);
    680668        }
     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
    681687
    682688        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    }   
    691690}
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIComponentProfileNamePostProcessor.java

    r2501 r2627  
    11package eu.clarin.cmdi.vlo.importer;
    2 
    3 import java.util.HashMap;
    4 
    5 import org.slf4j.Logger;
    6 import org.slf4j.LoggerFactory;
    72
    83import com.ximpleware.AutoPilot;
     
    105import com.ximpleware.VTDNav;
    116import com.ximpleware.XPathParseException;
    12 
    13 import eu.clarin.cmdi.vlo.Configuration;
     7import eu.clarin.cmdi.vlo.config.VloConfig;
     8import java.util.HashMap;
     9import org.slf4j.Logger;
     10import org.slf4j.LoggerFactory;
    1411
    1512/**
     
    7269        }
    7370        vg = new VTDGen();
    74         BASE_URL = Configuration.getInstance().getComponentRegistryRESTURL();
     71        BASE_URL = VloConfig.get().getComponentRegistryRESTURL();
    7572    }
    7673}
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java

    r2498 r2627  
    11package 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;
    122
    133import com.ximpleware.AutoPilot;
     
    188import com.ximpleware.XPathEvalException;
    199import com.ximpleware.XPathParseException;
    20 
    21 import eu.clarin.cmdi.vlo.Configuration;
     10import eu.clarin.cmdi.vlo.config.VloConfig;
     11import java.io.File;
     12import java.io.FileInputStream;
     13import java.io.IOException;
     14import java.util.List;
     15import java.util.Map;
     16import org.apache.commons.io.IOUtils;
     17import org.slf4j.Logger;
     18import org.slf4j.LoggerFactory;
    2219
    2320public class CMDIParserVTDXML implements CMDIDataProcessor {
     
    8279        if (index != -1) {
    8380            String profileId = nav.toString(index).trim();
    84             result = Configuration.getInstance().getComponentRegistryProfileSchema(profileId);
     81            result = VloConfig.get().getComponentRegistryProfileSchema(profileId);
    8582        }
    8683        return result;
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessor.java

    r1043 r2627  
    11package eu.clarin.cmdi.vlo.importer;
    22
     3import eu.clarin.cmdi.vlo.CommonUtils;
     4import eu.clarin.cmdi.vlo.config.VloConfig;
    35import java.util.Map;
    4 
    56import org.slf4j.Logger;
    67import org.slf4j.LoggerFactory;
    7 
    8 import eu.clarin.cmdi.vlo.CommonUtils;
    9 import eu.clarin.cmdi.vlo.Configuration;
    108
    119public class CountryNamePostProcessor implements PostProcessor {
     
    4341        LOG.debug("Creating country code map.");
    4442        try {
    45             Map<String, String> result = CommonUtils.createCMDIComponentItemMap(Configuration.getInstance().getCountryComponentUrl());
     43            Map<String, String> result = CommonUtils.createCMDIComponentItemMap(VloConfig.get().getCountryComponentUrl());
    4644            return result;
    4745        } catch (Exception e) {
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessor.java

    r2008 r2627  
    1818
    1919import eu.clarin.cmdi.vlo.CommonUtils;
    20 import eu.clarin.cmdi.vlo.Configuration;
     20import eu.clarin.cmdi.vlo.config.VloConfig;
    2121
    2222public class LanguageCodePostProcessor implements PostProcessor{
     
    9898    private Map<String, String> getTwoLetterCountryCodeMap() {
    9999        if (twoLetterCodesMap == null) {
    100             twoLetterCodesMap = createCodeMap(Configuration.getInstance().getLanguage2LetterCodeComponentUrl());
     100            twoLetterCodesMap = createCodeMap(VloConfig.get().getLanguage2LetterCodeComponentUrl());
    101101        }
    102102        return twoLetterCodesMap;
     
    105105    private Map<String, String> getThreeLetterCountryCodeMap() {
    106106        if (threeLetterCodesMap == null) {
    107             threeLetterCodesMap = createCodeMap(Configuration.getInstance().getLanguage3LetterCodeComponentUrl());
     107            threeLetterCodesMap = createCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl());
    108108        }
    109109        return threeLetterCodesMap;
     
    112112    protected Map<String, String> getLanguageNameToIso639Map() {
    113113        if (languageNameToIso639Map == null) {
    114                         languageNameToIso639Map = createReverseCodeMap(Configuration.getInstance().getLanguage3LetterCodeComponentUrl());
     114                        languageNameToIso639Map = createReverseCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl());
    115115        }
    116116        return languageNameToIso639Map;
     
    119119    private Map<String, String> getIso639ToLanguageNameMap() {
    120120        if (iso639ToLanguageNameMap == null) {
    121                 iso639ToLanguageNameMap = createCodeMap(Configuration.getInstance().getLanguage3LetterCodeComponentUrl());
     121                iso639ToLanguageNameMap = createCodeMap(VloConfig.get().getLanguage3LetterCodeComponentUrl());
    122122        }
    123123
     
    151151            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    152152            domFactory.setNamespaceAware(true);
    153             URL url = new URL(Configuration.getInstance().getSilToISO639CodesUrl());
     153            URL url = new URL(VloConfig.get().getSilToISO639CodesUrl());
    154154            DocumentBuilder builder = domFactory.newDocumentBuilder();
    155155            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  
    22
    33import eu.clarin.cmdi.vlo.CommonUtils;
    4 import eu.clarin.cmdi.vlo.Configuration;
    54import eu.clarin.cmdi.vlo.FacetConstants;
    65import eu.clarin.cmdi.vlo.config.DataRoot;
     
    1615import java.util.Map;
    1716import java.util.Set;
     17import org.apache.commons.cli.CommandLine;
     18import org.apache.commons.cli.CommandLineParser;
     19import org.apache.commons.cli.Options;
     20import org.apache.commons.cli.PosixParser;
    1821import org.apache.commons.io.FileUtils;
    1922import org.apache.solr.client.solrj.SolrServerException;
     
    207210     */
    208211    protected void initSolrServer() throws MalformedURLException {
    209         String solrUrl = Configuration.getInstance().getSolrUrl();
     212        String solrUrl = VloConfig.get().getSolrUrl();
    210213        LOG.info("Initializing Solr Server on " + solrUrl);
    211214        solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {
     
    375378     * @throws IOException
    376379     */
    377     public static void main(String[] args) throws IOException {
    378 
    379         String fileName;
     380    public static void main(String[] args) throws MalformedURLException, IOException {
    380381
    381382        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());
    403425        }
    404426    }
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/NationalProjectPostProcessor.java

    r1887 r2627  
    11package eu.clarin.cmdi.vlo.importer;
    22
     3import eu.clarin.cmdi.vlo.config.VloConfig;
    34import java.io.File;
    45import java.io.IOException;
    56import java.util.HashMap;
    67import java.util.Map;
    7 
    88import javax.xml.parsers.DocumentBuilder;
    99import javax.xml.parsers.DocumentBuilderFactory;
     
    1111import javax.xml.xpath.XPathConstants;
    1212import javax.xml.xpath.XPathFactory;
    13 
    14 import eu.clarin.cmdi.vlo.Configuration;
    1513import org.apache.commons.io.FileUtils;
    1614import org.slf4j.Logger;
     
    5351
    5452        private Map<String, String> getNationalProjectMapping() {
    55         String mappingFileName = Configuration.getInstance().getNationalProjectMapping();
     53        String mappingFileName = VloConfig.get().getNationalProjectMapping();
    5654        if(mappingFileName == null){
    5755            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  
    11package eu.clarin.cmdi.vlo.pages;
    22
     3import eu.clarin.cmdi.vlo.FacetConstants;
     4import eu.clarin.cmdi.vlo.Resources;
     5import eu.clarin.cmdi.vlo.config.VloConfig;
     6import eu.clarin.cmdi.vlo.dao.AutoCompleteDao;
     7import fiftyfive.wicket.basic.TruncatedLabel;
    38import java.io.UnsupportedEncodingException;
    49import java.util.ArrayList;
     
    611import java.util.Iterator;
    712import java.util.List;
    8 
    913import org.apache.solr.client.solrj.SolrServerException;
    1014import org.apache.solr.client.solrj.response.FacetField;
     
    2630import org.apache.wicket.model.IModel;
    2731import 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;
    3532
    3633public class FacetedSearchPage extends BasePage {
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/HtmlFormCreator.java

    r2597 r2627  
    11package eu.clarin.cmdi.vlo.pages;
    22
     3import eu.clarin.cmdi.vlo.config.VloConfig;
    34import java.io.UnsupportedEncodingException;
    45import java.util.Iterator;
    56import java.util.List;
    67import java.util.Map;
    7 
    88import net.sf.json.JSONArray;
    99import net.sf.json.JSONObject;
    10 import eu.clarin.cmdi.vlo.Configuration;
    11 import eu.clarin.cmdi.vlo.config.VloConfig;
    1210
    1311/**
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanel.java

    r2597 r2627  
    11package eu.clarin.cmdi.vlo.pages;
    22
     3import eu.clarin.cmdi.vlo.CommonUtils;
     4import eu.clarin.cmdi.vlo.FacetConstants;
     5import eu.clarin.cmdi.vlo.config.VloConfig;
    36import java.io.IOException;
    47import java.net.HttpURLConnection;
     
    710import java.net.URLConnection;
    811import java.util.HashMap;
    9 import java.util.List;
    1012import 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;
    1713import org.apache.wicket.behavior.SimpleAttributeModifier;
    1814import org.apache.wicket.markup.html.basic.Label;
     
    2319import org.slf4j.Logger;
    2420import 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;
    3221
    3322public class ResourceLinkPanel extends Panel {
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageQuery.java

    r2597 r2627  
    11package eu.clarin.cmdi.vlo.pages;
    22
     3import eu.clarin.cmdi.vlo.FacetConstants;
     4import eu.clarin.cmdi.vlo.config.VloConfig;
    35import java.util.HashMap;
    46import java.util.Map;
    5 
    67import org.apache.solr.client.solrj.SolrQuery;
    78import org.apache.solr.client.solrj.response.FacetField;
     
    1112import org.apache.wicket.IClusterable;
    1213import 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;
    1714
    1815public class SearchPageQuery implements IClusterable {
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java

    r2597 r2627  
    5555import org.slf4j.LoggerFactory;
    5656
    57 import eu.clarin.cmdi.vlo.Configuration;
    5857import eu.clarin.cmdi.vlo.FacetConstants;
    5958import eu.clarin.cmdi.vlo.Resources;
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/resources/VloConfig.xml

    r2604 r2627  
    4646    <nationalProjectMapping>nationalProjectsMapping.xml</nationalProjectMapping>
    4747   
    48     <facetFields length="6">
     48    <facetFields length="10">
    4949        <facetField>collection</facetField>
     50        <facetField>language</facetField>
    5051        <facetField>continent</facetField>
    51         <facetField>organisation</facetField>
    5252        <facetField>genre</facetField>
    5353        <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>
    5559    </facetFields>
    5660   
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/main/webapp/META-INF/context.xml

    r2600 r2627  
    77<Context antiJARLocking="true" path="/vlo">
    88  <Parameter name="externalConfig" value="/Users/keeloo/VloConfig.xml"/>
     9  <!--Parameter name="solrUrl" value="http://localhost:8084/vlo_solr/"/-->
    910</Context>
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/SearchPageQueryTest.java

    r2570 r2627  
    11package eu.clarin.cmdi.vlo;
    22
    3 import static org.junit.Assert.assertEquals;
    4 import static org.junit.Assert.assertNull;
    5 
     3import eu.clarin.cmdi.vlo.pages.SearchPageQuery;
    64import org.apache.solr.client.solrj.response.FacetField;
    75import org.apache.solr.common.params.CommonParams;
    86import org.apache.wicket.PageParameters;
     7import static org.junit.Assert.assertEquals;
     8import static org.junit.Assert.assertNull;
    99import org.junit.Before;
    1010import org.junit.Test;
    11 
    12 import eu.clarin.cmdi.vlo.pages.SearchPageQuery;
    1311
    1412public class SearchPageQueryTest {
     
    2624        assertEquals("*:*", q.getSolrQuery().getQuery());
    2725        assertEquals("name,id,description", q.getSolrQuery().getFields());
    28         assertEquals(6, q.getSolrQuery().getFacetFields().length);
     26        assertEquals(10, q.getSolrQuery().getFacetFields().length);
    2927        assertEquals("collection", q.getSolrQuery().getFacetFields()[0]);
    3028        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  
    11package eu.clarin.cmdi.vlo;
    22
     3import eu.clarin.cmdi.vlo.config.VloConfig;
    34import org.apache.wicket.util.tester.WicketTester;
    45import org.junit.Before;
     
    910 */
    1011public class TestFacetedSearchPage {
    11     private WicketTester tester;
     12   
     13    static VloConfig testConfig;
    1214
    1315    @Before
    1416    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));
    1727    }
    1828
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java

    r1938 r2627  
    44import java.io.IOException;
    55
    6 import eu.clarin.cmdi.vlo.Configuration;
     6import eu.clarin.cmdi.vlo.config.VloConfig;
    77import org.apache.commons.io.FileUtils;
    88import org.junit.AfterClass;
     
    2929        testDir.mkdir();
    3030        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/");
    3232    }
    3333
  • vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanelTest.java

    r2059 r2627  
    33import eu.clarin.cmdi.vlo.FacetConstants;
    44import eu.clarin.cmdi.vlo.VloApplication;
     5import eu.clarin.cmdi.vlo.config.VloConfig;
    56import org.apache.wicket.util.tester.WicketTester;
    67import org.junit.Before;
     
    1011
    1112public class ResourceLinkPanelTest {
     13   
     14    static VloConfig testConfig;
    1215
    1316    public static final String _SAME_STRING = "http://blabla";
     
    1619    @Before
    1720    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));
    1931    }
    2032
Note: See TracChangeset for help on using the changeset viewer.