Changeset 4507


Ignore:
Timestamp:
02/13/14 10:54:47 (10 years ago)
Author:
twagoo
Message:

turned VloConfig? into a POJO, created factory interface so that multiple ways. Adapted importer and web app to use this - importer still using static (but project-local) config references

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  
    4141    public static final String FIELD_SEARCHPAGE = "_searchPageRef";
    4242   
    43     // PREFIX URL for the language-link   
    44     public static final String LANGUAGE_LINK_PREFIX = VloConfig.getLanguageLinkPrefix();
    45 
    4643    //Normalized mimeTypes
    4744    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  
    44import java.net.URLEncoder;
    55import java.util.List;
    6 import org.simpleframework.xml.Element;
    7 import org.simpleframework.xml.ElementArray;
    8 import org.simpleframework.xml.ElementList;
    96import org.simpleframework.xml.Root;
    10 import org.slf4j.LoggerFactory;
    117
    128/**
    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
    3410 *
    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
    6612 */
    6713@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     }
     14public class VloConfig {
    14915
    15016    /*
     
    15723     * member parameters.
    15824     */
    159    
    16025    // 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
    16830    // 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
    19649    // 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
    22268    // 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
    24583    // 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
    25992    /**
    26093     * An array of facetFields<br><br>
     
    26497     * a correct description of an array of three facet fields<br><br>
    26598     *
    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>
    276104     * {@literal </facetFields>}<br><br>
    277105     *
     
    280108     * know that the elements inside 'facetFields' are named 'facetField'.
    281109     */
    282     @ElementArray(entry = "facetField")
    283     private static String[] facetFields = {"", "", ""};
    284    
     110    //Array(entry = "facetField")
     111    private String[] facetFields = {"", "", ""};
     112
    285113    // 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 = "";
    296122
    297123    /**
     
    302128     * application.
    303129     */
    304            
    305130    /**
    306131     * Get the value of the pagesInApplicationCache parameter<br><br>
    307132     *
    308      * The parameter represents the number of pages that Wicket will allow
    309      * to be stored in the application's cache.
    310      *
    311      * @return the value
    312      */ 
    313     public static int 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() {
    314139        return pagesInApplicationCache;
    315140    }
     
    317142    /**
    318143     * Set the value of the pagesInApplicationCache parameter<br><br>
    319      * 
    320      * The parameter represents the number of pages that Wicket will allow
    321      * to be stored in the application's cache.
    322      *
    323      * @param param the value
    324      */
    325     public static void 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) {
    326151        pagesInApplicationCache = param;
    327152    }
    328    
     153
    329154    /**
    330155     * Get the value of the sessionCacheSize parameter<br><br>
    331156     *
    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() {
    338162        return sessionCacheSize;
    339163    }
     
    342166     * Set the value of the sessionCacheSize parameter<br><br>
    343167     *
    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) {
    350173        sessionCacheSize = param;
    351174    }
     
    358181     *
    359182     * @return the value
    360      */ 
    361     public static boolean deleteAllFirst() {
     183     */
     184    public boolean deleteAllFirst() {
    362185        return deleteAllFirst;
    363186    }
     
    371194     * @param param the value
    372195     */
    373     public static void setDeleteAllFirst(boolean param) {
     196    public void setDeleteAllFirst(boolean param) {
    374197        deleteAllFirst = param;
    375198    }
    376    
     199
    377200    /**
    378201     * Get the value of the maxDocsInList parameter<br><br>
     
    383206     * @return the value
    384207     */
    385     public static int getMaxDocsInList (){
     208    public int getMaxDocsInList() {
    386209        return maxDocsInList;
    387210    }
    388    
     211
    389212    /**
    390213     * Set the value of the maxDocsInList parameter<br><br>
     
    395218     * @param param the value
    396219     */
    397     public static void setMaxDocsInList (int param){
     220    public void setMaxDocsInList(int param) {
    398221        maxDocsInList = param;
    399222    }
    400    
     223
    401224    /**
    402225     * Get the value of the minDocsInSolrQueue parameter<br><br>
     
    407230     * @return the value
    408231     */
    409     public static int getMinDocsInSolrQueue (){
     232    public int getMinDocsInSolrQueue() {
    410233        return minDocsInSolrQueue;
    411234    }
    412    
     235
    413236    /**
    414237     * Set the value of the minDocsInSolrQueue parameter<br><br>
     
    419242     * @param param the value
    420243     */
    421     public static void setMinDocsInSolrQueue (int param){
     244    public void setMinDocsInSolrQueue(int param) {
    422245        minDocsInSolrQueue = param;
    423246    }
    424    
     247
    425248    /**
    426249     * 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() {
    434257        return solrTimeOut;
    435258    }
    436    
     259
    437260    /**
    438261     * Set the value of the solrTimeOut parameter<br><br>
     
    443266     * @param param the value
    444267     */
    445     public static void setSolrTimeOut (int param){
     268    public void setSolrTimeOut(int param) {
    446269        solrTimeOut = param;
    447270    }
    448    
     271
    449272    /**
    450273     * Get the value of the maxFileSize parameter<br><br>
     
    455278     * @return the value
    456279     */
    457     public static int getMaxFileSize (){
     280    public int getMaxFileSize() {
    458281        return maxFileSize;
    459282    }
    460    
     283
    461284    /**
    462285     * Set the value of the maxFileSize parameter<br><br>
     
    467290     * @param param the value
    468291     */
    469     public static void setMaxFileSize (int param){
     292    public void setMaxFileSize(int param) {
    470293        maxFileSize = param;
    471294    }
    472    
     295
    473296    /**
    474297     * Get the value of the maxDaysInSolr parameter<br><br>
     
    479302     * @return the value
    480303     */
    481     public static int getMaxDaysInSolr (){
     304    public int getMaxDaysInSolr() {
    482305        return maxDaysInSolr;
    483306    }
    484    
     307
    485308    /**
    486309     * Set the value of the maxDaysInSolr parameter<br><br>
     
    491314     * @param param the value
    492315     */
    493     public static void setMaxDaysInSolr (int param){
    494         maxDaysInSolr = param;
    495     }
    496    
     316    public void setMaxDaysInSolr(int param) {
     317        maxDaysInSolr = param;
     318    }
     319
    497320    /**
    498321     * Get the value of the useHandleResolver parameter<br><br>
     
    503326     * @return the value
    504327     */
    505     public static boolean getUseHandleResolver (){
     328    public boolean getUseHandleResolver() {
    506329        return useHandleResolver;
    507330    }
    508    
     331
    509332    /**
    510333     * Set the value of the useHandleResolver parameter<br><br>
     
    515338     * @param param the value
    516339     */
    517     public static void setUseHandleResolver (boolean param){
     340    public void setUseHandleResolver(boolean param) {
    518341        useHandleResolver = param;
    519342    }
    520    
     343
    521344    /**
    522345     * Get the list of dataRoots parameters<br><br>
     
    527350     * @return the value
    528351     */
    529     public static List<DataRoot> getDataRoots() {
     352    public List<DataRoot> getDataRoots() {
    530353        return dataRoots;
    531354    }
    532    
     355
    533356    /**
    534357     * Set the value of a list of dataRoots parameters<br><br>
     
    539362     * @param param the value
    540363     */
    541     public static void setDataRoots(List<DataRoot> param) {
     364    public void setDataRoots(List<DataRoot> param) {
    542365        dataRoots = param;
    543366    }
     
    551374     * @return the value
    552375     */
    553     public static boolean printMapping() {
     376    public boolean printMapping() {
    554377        return printMapping;
    555378    }
    556    
     379
    557380    /**
    558381     * Set the value of the printMapping parameter<br><br>
     
    563386     * @param param the value
    564387     */
    565     public static void setPrintMapping(boolean param) {
     388    public void setPrintMapping(boolean param) {
    566389        printMapping = param;
    567390    }
     
    575398     * @return the value
    576399     */
    577     public static String getHomeUrl() {
     400    public String getHomeUrl() {
    578401        return homeUrl;
    579402    }
     
    587410     * @param param the value
    588411     */
    589     public static void setHomeUrl(String param) {
     412    public void setHomeUrl(String param) {
    590413        homeUrl = param;
    591414    }
     
    599422     * @return the value
    600423     */
    601     public static String getHelpUrl() {
     424    public String getHelpUrl() {
    602425        return helpUrl;
    603426    }
     
    611434     * @param param the value
    612435     */
    613     public static void setHelpUrl(String param) {
     436    public void setHelpUrl(String param) {
    614437        helpUrl = param;
    615438    }
     
    623446     * @return the value
    624447     */
    625     static public String getSolrUrl() {
     448    public String getSolrUrl() {
    626449        return solrUrl;
    627450    }
     
    635458     * @param param the value
    636459     */
    637     public static void setSolrUrl(String param) {
     460    public void setSolrUrl(String param) {
    638461        solrUrl = param;
    639462    }
    640    
     463
    641464    /**
    642465     * Get the value of the facetConceptsFile parameter<br><br>
     
    647470     * @return the value
    648471     */
    649     static public String getFacetConceptsFile() {
     472    public String getFacetConceptsFile() {
    650473        return facetConceptsFile;
    651474    }
     
    659482     * @param param the value
    660483     */
    661     public static void setFacetConceptsFile(String param) {
     484    public void setFacetConceptsFile(String param) {
    662485        facetConceptsFile = param;
    663486    }
     
    671494     * @return the value
    672495     */
    673     public static String getComponentRegistryProfileSchema(String id) {
     496    public String getComponentRegistryProfileSchema(String id) {
    674497        return profileSchemaUrl.replace("{PROFILE_ID}", id);
    675498    }
     
    683506     * @param param the value
    684507     */
    685     public static void setProfileSchemaUrl(String param) {
     508    public void setProfileSchemaUrl(String param) {
    686509        profileSchemaUrl = param;
    687510    }
     
    695518     * @return the value
    696519     */
    697     public static String getComponentRegistryRESTURL() {
     520    public String getComponentRegistryRESTURL() {
    698521        return componentRegistryRESTURL;
    699522    }
     
    707530     * @param param the value
    708531     */
    709     public static void setComponentRegistryRESTURL(String param) {
     532    public void setComponentRegistryRESTURL(String param) {
    710533        componentRegistryRESTURL = param;
    711534    }
     
    719542     * @return the value
    720543     */
    721     public static String getHandleServerUrl() {
     544    public String getHandleServerUrl() {
    722545        return handleServerUrl;
    723546    }
     
    731554     * @param param the value
    732555     */
    733     public static void setHandleServerUrl(String param) {
     556    public void setHandleServerUrl(String param) {
    734557        handleServerUrl = param;
    735558    }
    736559
    737560    /**
    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>
    739563     *
    740564     * For a description of the schema, refer to the general VLO documentation.
    741565     *
    742566     * @param handle the handle the URL is based on
    743      * @return the value 
    744      */
    745     public static String getIMDIBrowserUrl(String handle) {
     567     * @return the value
     568     */
     569    public String getIMDIBrowserUrl(String handle) {
    746570        String result;
    747571        try {
     
    761585     * @param param the value
    762586     */
    763     public static void setIMDIBrowserUrl(String param) {
     587    public void setIMDIBrowserUrl(String param) {
    764588        imdiBrowserUrl = param;
    765589    }
     
    773597     * @return the value
    774598     */
    775     public static String getLanguageLinkPrefix() {
     599    public String getLanguageLinkPrefix() {
    776600        return languageLinkPrefix;
    777601    }
    778    
     602
    779603    /**
    780604     * Set the value of the languageLinkPrefix parameter<br><br>
     
    785609     * @param param the value
    786610     */
    787     public static void setLanguageLinkPrefix(String param) {
     611    public void setLanguageLinkPrefix(String param) {
    788612        languageLinkPrefix = param;
    789613    }
    790    
     614
    791615    /**
    792616     * Get the value of the feedbackFromUrl parameter<br><br>
     
    797621     * @return the value
    798622     */
    799     public static String getFeedbackFromUrl() {
     623    public String getFeedbackFromUrl() {
    800624        return feedbackFromUrl;
    801625    }
    802    
     626
    803627    /**
    804628     * Set the value of the feedbackFromUrl parameter<br><br>
     
    809633     * @param param the value
    810634     */
    811     public static void setFeedbackFromUrl(String param) {
     635    public void setFeedbackFromUrl(String param) {
    812636        feedbackFromUrl = param;
    813637    }
    814    
     638
    815639    /**
    816640     * Get the value of the FederatedContentSearchUrl parameter<br><br>
     
    821645     * @return the value
    822646     */
    823     public static String getFederatedContentSearchUrl() {
     647    public String getFederatedContentSearchUrl() {
    824648        return FederatedContentSearchUrl;
    825649    }
     
    833657     * @param param the value
    834658     */
    835     public static void setFederatedContentSearchUrl(String param) {
     659    public void setFederatedContentSearchUrl(String param) {
    836660        FederatedContentSearchUrl = param;
    837661    }
     
    845669     * @return the value
    846670     */
    847     public static String getNationalProjectMapping() {
     671    public String getNationalProjectMapping() {
    848672        return nationalProjectMapping;
    849673    }
     
    857681     * @param nationalProjectMapping the value
    858682     */
    859     public static void setNationalProjectMapping(String param) {
     683    public void setNationalProjectMapping(String param) {
    860684        nationalProjectMapping = param;
    861685    }
    862    
     686
    863687    /**
    864688     * Get the value of the FacetFields parameter<br><br>
     
    869693     * @return the value
    870694     */
    871     public static String[] getFacetFields() {
     695    public String[] getFacetFields() {
    872696        return facetFields;
    873697    }
     
    881705     * @param param the value, a list of facet fields
    882706     */
    883     public static void setFacetFields(String[] param) {
     707    public void setFacetFields(String[] param) {
    884708        facetFields = param;
    885709    }
    886    
     710
    887711    /**
    888712     * Get the value of the languageFields parameter<br><br>
     
    893717     * @return the value
    894718     */
    895     public static String[] getLanguageFilters() {
     719    public String[] getLanguageFilters() {
    896720        return languageFilters;
    897721    }
     
    905729     * @param param the value, a list of language filters
    906730     */
    907     public static void setLanguageFilters(String[] param) {
     731    public void setLanguageFilters(String[] param) {
    908732        languageFilters = param;
    909733    }
    910    
     734
    911735    /**
    912736     * Get the value of the getFacetOverviewLength parameter<br><br>
     
    917741     * @return the value
    918742     */
    919     public static int getFacetOverviewLength() {
     743    public int getFacetOverviewLength() {
    920744        return facetOverviewLength;
    921745    }
     
    941765     * @return the value
    942766     */
    943     public static String getCountryComponentUrl() {
     767    public String getCountryComponentUrl() {
    944768        return countryComponentUrl;
    945769    }
     
    953777     * @param param the value
    954778     */
    955     public static void setCountryComponentUrl(String param) {
     779    public void setCountryComponentUrl(String param) {
    956780        countryComponentUrl = param;
    957781    }
     
    965789     * @return the value
    966790     */
    967     public static String getLanguage2LetterCodeComponentUrl() {
     791    public String getLanguage2LetterCodeComponentUrl() {
    968792        return language2LetterCodeComponentUrl;
    969793    }
     
    977801     * @param param the value
    978802     */
    979     public static void setLanguage2LetterCodeComponentUrl(String param) {
     803    public void setLanguage2LetterCodeComponentUrl(String param) {
    980804        language2LetterCodeComponentUrl = param;
    981805    }
    982806
    983807    /**
    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 static String 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() {
    992816        return language3LetterCodeComponentUrl;
    993817    }
    994818
    995819    /**
    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 static void 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) {
    1004828        language3LetterCodeComponentUrl = param;
    1005829    }
     
    1013837     * @return the value
    1014838     */
    1015     public static String getSilToISO639CodesUrl() {
     839    public String getSilToISO639CodesUrl() {
    1016840        return silToISO639CodesUrl;
    1017841    }
     
    1025849     * @param param the value
    1026850     */
    1027     public static void setSilToISO639CodesUrl(String param) {
     851    public void setSilToISO639CodesUrl(String param) {
    1028852        silToISO639CodesUrl = param;
    1029853    }
    1030    
     854
    1031855    /**
    1032856     * Get the value of the reverseProxyPath parameter<br><br>
     
    1037861     * @return the value
    1038862     */
    1039     public static String getReverseProxyPrefix() {
     863    public String getReverseProxyPrefix() {
    1040864        return reverseProxyPrefix;
    1041865    }
     
    1049873     * @param param the value
    1050874     */
    1051     public static void setReverseProxyPrefix(String param) {
     875    public void setReverseProxyPrefix(String param) {
    1052876        reverseProxyPrefix = param;
    1053877    }
    1054    
     878
    1055879    /**
    1056880     * Get the value of the cqlEndpointFilter parameter<br><br>
     
    1061885     * @return the value
    1062886     */
    1063     public static String getCqlEndpointFilter() {
     887    public String getCqlEndpointFilter() {
    1064888        return cqlEndpointFilter;
    1065889    }
     
    1073897     * @param param the value
    1074898     */
    1075     public static void setCqlEndpointFilter(String param) {
     899    public void setCqlEndpointFilter(String param) {
    1076900        cqlEndpointFilter = param;
    1077901    }
    1078    
     902
    1079903    /**
    1080904     * Get the value of the cqlEndpointAlternative parameter<br><br>
     
    1085909     * @return the value
    1086910     */
    1087     public static String getCqlEndpointAlternative() {
     911    public String getCqlEndpointAlternative() {
    1088912        return cqlEndpointAlternative;
    1089913    }
     
    1097921     * @param param the value
    1098922     */
    1099     public static void setCqlEndpointAlternative(String param) {
     923    public void setCqlEndpointAlternative(String param) {
    1100924        cqlEndpointAlternative = param;
    1101925    }
  • vlo/branches/vlo-3.0/vlo-commons/src/main/resources/VloConfig.xml

    r4480 r4507  
    5353    <helpUrl>http://www.clarin.eu/vlo</helpUrl>
    5454   
    55     <solrUrl>http://localhost:8084/vlo_solr/</solrUrl>
     55    <solrUrl>http://localhost:8080/vlo_solr/</solrUrl>
    5656   
    5757    <facetConceptsFile>/facetConcepts.xml</facetConceptsFile>
  • vlo/branches/vlo-3.0/vlo-commons/src/test/java/eu/clarin/cmdi/vlo/config/DefaultVloConfigFactoryTest.java

    r4480 r4507  
    88import java.util.List;
    99import static org.junit.Assert.*;
    10 import org.junit.Before;
     10import org.junit.BeforeClass;
    1111import org.junit.Test;
    1212
     
    1515 * @author keeloo
    1616 */
    17 public class VloConfigTest {
    18    
    19     public VloConfigTest() {
    20     }
    21    
    22     @Before
    23     public void setUp() {       
    24         VloConfig.readPackagedConfig();
     17public 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();
    2527    }
    2628
     
    5254        System.out.println("getDataRoots");
    5355       
    54         List rootsReturned = VloConfig.getDataRoots();
     56        List rootsReturned = config.getDataRoots();
    5557       
    5658        assertEquals(dataRoots, rootsReturned);
     
    8082        System.out.println("setDataRoots");
    8183
    82         VloConfig.setDataRoots(dataRoots);
    83        
    84         List rootsReturned = VloConfig.getDataRoots();
     84        config.setDataRoots(dataRoots);
     85       
     86        List rootsReturned = config.getDataRoots();
    8587       
    8688        assertEquals (dataRoots, rootsReturned);
     
    9698       
    9799        int expResult = 40; // as defined in vloconfig.xml
    98         int result = VloConfig.getPagesInApplicationCache();
     100        int result = config.getPagesInApplicationCache();
    99101       
    100102        assertEquals(expResult, result);
     
    111113        int param = 999;
    112114       
    113         VloConfig.setPagesInApplicationCache(param);
    114 
    115         int result = VloConfig.getPagesInApplicationCache();
     115        config.setPagesInApplicationCache(param);
     116
     117        int result = config.getPagesInApplicationCache();
    116118       
    117119        assertEquals(param, result);
     
    128130       
    129131        int expResult = 10000; // as defined in vloconfig.xml
    130         int result = VloConfig.getSessionCacheSize();
     132        int result = config.getSessionCacheSize();
    131133       
    132134        assertEquals(expResult, result);
     
    143145        int param = 9999;
    144146       
    145         VloConfig.setSessionCacheSize(param);
    146 
    147         int result = VloConfig.getSessionCacheSize();
     147        config.setSessionCacheSize(param);
     148
     149        int result = config.getSessionCacheSize();
    148150       
    149151        assertEquals(param, result);
     
    159161       
    160162        int expResult = 128;
    161         int result = VloConfig.getMaxDocsInList();
     163        int result = config.getMaxDocsInList();
    162164       
    163165        assertEquals(expResult, result);
     
    174176        int param = 1000;
    175177       
    176         VloConfig.setMaxDocsInList(param);
    177 
    178         int result = VloConfig.getMaxDocsInList();
     178        config.setMaxDocsInList(param);
     179
     180        int result = config.getMaxDocsInList();
    179181       
    180182        assertEquals(param, result);
     
    190192       
    191193        int expResult = 128;
    192         int result = VloConfig.getMaxDocsInList();
     194        int result = config.getMaxDocsInList();
    193195       
    194196        assertEquals(expResult, result);
     
    205207        int param = 1000;
    206208       
    207         VloConfig.setMaxDocsInList(param);
    208 
    209         int result = VloConfig.getMaxDocsInList();
     209        config.setMaxDocsInList(param);
     210
     211        int result = config.getMaxDocsInList();
    210212       
    211213        assertEquals(param, result);
     
    221223       
    222224        int expResult = 10000000;
    223         int result = VloConfig.getMaxFileSize();
     225        int result = config.getMaxFileSize();
    224226       
    225227        assertEquals(expResult, result);
     
    236238        int param = 10000000;
    237239       
    238         VloConfig.setMaxFileSize(param);
    239 
    240         int result = VloConfig.getMaxFileSize();
     240        config.setMaxFileSize(param);
     241
     242        int result = config.getMaxFileSize();
    241243       
    242244        assertEquals(param, result);
     
    252254       
    253255        boolean expResult = false;
    254         boolean result = VloConfig.getUseHandleResolver();
     256        boolean result = config.getUseHandleResolver();
    255257       
    256258        assertEquals(expResult, result);
     
    267269        boolean param = true;
    268270       
    269         VloConfig.setUseHandleResolver(param);
    270 
    271         boolean result = VloConfig.getUseHandleResolver();
     271        config.setUseHandleResolver(param);
     272
     273        boolean result = config.getUseHandleResolver();
    272274       
    273275        assertEquals(param, result);
     
    283285       
    284286        boolean expResult = true;
    285         boolean result = VloConfig.deleteAllFirst();
     287        boolean result = config.deleteAllFirst();
    286288       
    287289        assertEquals(expResult, result);
     
    298300        boolean param = true;
    299301       
    300         VloConfig.setDeleteAllFirst(param);
    301 
    302         boolean result = VloConfig.deleteAllFirst();
     302        config.setDeleteAllFirst(param);
     303
     304        boolean result = config.deleteAllFirst();
    303305       
    304306        assertEquals(param, result);
     
    314316       
    315317        boolean expResult = false;
    316         boolean result = VloConfig.printMapping();
     318        boolean result = config.printMapping();
    317319       
    318320        assertEquals(expResult, result);
     
    328330        boolean param = false;
    329331       
    330         VloConfig.setPrintMapping(param);
    331 
    332         boolean result = VloConfig.printMapping();
     332        config.setPrintMapping(param);
     333
     334        boolean result = config.printMapping();
    333335       
    334336        assertEquals(param, result);
     
    344346       
    345347        String expResult = "http://www.clarin.eu/vlo";
    346         String result = VloConfig.getHomeUrl();
     348        String result = config.getHomeUrl();
    347349       
    348350        assertEquals(expResult, result);
     
    359361        String param = "http://www.clarin.eu/vlo";
    360362       
    361         VloConfig.setHomeUrl(param);
    362 
    363         String result = VloConfig.getHomeUrl();
     363        config.setHomeUrl(param);
     364
     365        String result = config.getHomeUrl();
    364366       
    365367        assertEquals(param, result);
     
    375377       
    376378        String expResult = "http://www.clarin.eu/vlo";
    377         String result = VloConfig.getHelpUrl();
     379        String result = config.getHelpUrl();
    378380       
    379381        assertEquals(expResult, result);
     
    390392        String param = "http://www.clarin.eu/vlo";
    391393       
    392         VloConfig.setHelpUrl(param);
    393 
    394         String result = VloConfig.getHelpUrl();
     394        config.setHelpUrl(param);
     395
     396        String result = config.getHelpUrl();
    395397       
    396398        assertEquals(param, result);
     
    406408       
    407409        String expResult = "http://localhost:8084/vlo_solr/";
    408         String result = VloConfig.getSolrUrl();
     410        String result = config.getSolrUrl();
    409411       
    410412        assertEquals(expResult, result);
     
    421423        String param = "http://localhost:8084/vlo_solr/";
    422424       
    423         VloConfig.setSolrUrl(param);
    424 
    425         String result = VloConfig.getSolrUrl();
     425        config.setSolrUrl(param);
     426
     427        String result = config.getSolrUrl();
    426428       
    427429        assertEquals(param, result);
     
    437439       
    438440        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");
    440442       
    441443        assertEquals(expResult, result);
     
    451453       
    452454        String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/";
    453         String result = VloConfig.getComponentRegistryRESTURL();
     455        String result = config.getComponentRegistryRESTURL();
    454456       
    455457        assertEquals(expResult, result);
     
    466468        String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/";
    467469       
    468         VloConfig.setComponentRegistryRESTURL(param);
    469 
    470         String result = VloConfig.getComponentRegistryRESTURL();
     470        config.setComponentRegistryRESTURL(param);
     471
     472        String result = config.getComponentRegistryRESTURL();
    471473       
    472474        assertEquals(param, result);
     
    482484       
    483485        String expResult = "http://hdl.handle.net/";
    484         String result = VloConfig.getHandleServerUrl();
     486        String result = config.getHandleServerUrl();
    485487       
    486488        assertEquals(expResult, result);
     
    497499        String param = "http://hdl.handle.net/";
    498500       
    499         VloConfig.setHandleServerUrl(param);
    500 
    501         String result = VloConfig.getHandleServerUrl();
     501        config.setHandleServerUrl(param);
     502
     503        String result = config.getHandleServerUrl();
    502504       
    503505        assertEquals(param, result);
     
    518520            expResult = "http://corpus1.mpi.nl/ds/imdi_browser?openpath=" + "handle";
    519521        }
    520         String result = VloConfig.getIMDIBrowserUrl("handle");
     522        String result = config.getIMDIBrowserUrl("handle");
    521523
    522524        assertEquals(expResult, result);
     
    533535        String param = "http://corpus1.mpi.nl/ds/imdi_browser?openpath=";
    534536       
    535         VloConfig.setIMDIBrowserUrl(param);
     537        config.setIMDIBrowserUrl(param);
    536538
    537539        String expResult;
     
    542544        }
    543545       
    544         String result = VloConfig.getIMDIBrowserUrl("handle");
     546        String result = config.getIMDIBrowserUrl("handle");
    545547
    546548        assertEquals(expResult, result);
     
    556558       
    557559        String expResult = "http://infra.clarin.eu/service/language/info.php?code=";
    558         String result = VloConfig.getLanguageLinkPrefix();
     560        String result = config.getLanguageLinkPrefix();
    559561       
    560562        assertEquals(expResult, result);
     
    571573        String param = "http://infra.clarin.eu/service/language/info.php?code=";
    572574       
    573         VloConfig.setLanguageLinkPrefix(param);
    574 
    575         String result = VloConfig.getLanguageLinkPrefix();
     575        config.setLanguageLinkPrefix(param);
     576
     577        String result = config.getLanguageLinkPrefix();
    576578       
    577579        assertEquals(param, result);
     
    587589       
    588590        String expResult = "http://www.clarin.eu/node/3759?url=";
    589         String result = VloConfig.getFeedbackFromUrl();
     591        String result = config.getFeedbackFromUrl();
    590592       
    591593        assertEquals(expResult, result);
     
    602604        String param = "http://www.clarin.eu/node/3759?url=";
    603605       
    604         VloConfig.setFeedbackFromUrl(param);
    605 
    606         String result = VloConfig.getFeedbackFromUrl();
     606        config.setFeedbackFromUrl(param);
     607
     608        String result = config.getFeedbackFromUrl();
    607609       
    608610        assertEquals(param, result);
     
    618620       
    619621        String expResult = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/";
    620         String result = VloConfig.getFederatedContentSearchUrl();
     622        String result = config.getFederatedContentSearchUrl();
    621623       
    622624        assertEquals(expResult, result);
     
    633635        String param = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/";
    634636       
    635         VloConfig.setFederatedContentSearchUrl(param);
    636 
    637         String result = VloConfig.getFederatedContentSearchUrl();
     637        config.setFederatedContentSearchUrl(param);
     638
     639        String result = config.getFederatedContentSearchUrl();
    638640       
    639641        assertEquals(param, result);
     
    649651       
    650652        String expResult = "/nationalProjectsMapping.xml";
    651         String result = VloConfig.getNationalProjectMapping();
     653        String result = config.getNationalProjectMapping();
    652654       
    653655        assertEquals(expResult, result);
     
    664666        String param = "nationalProjectsMapping.xml";
    665667       
    666         VloConfig.setNationalProjectMapping(param);
    667 
    668         String result = VloConfig.getNationalProjectMapping();
     668        config.setNationalProjectMapping(param);
     669
     670        String result = config.getNationalProjectMapping();
    669671       
    670672        assertEquals(param, result);
     
    694696        "keywords"};
    695697   
    696         String[] result = VloConfig.getFacetFields();
     698        String[] result = config.getFacetFields();
    697699   
    698700        assertArrayEquals(expResult, result);
     
    722724        "keywords"};
    723725       
    724         VloConfig.setFacetFields(expResult);
    725        
    726         String result[] = VloConfig.getFacetFields();
     726        config.setFacetFields(expResult);
     727       
     728        String result[] = config.getFacetFields();
    727729
    728730        assertArrayEquals(expResult, result);
     
    738740       
    739741        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();
    741743       
    742744        assertEquals(expResult, result);
     
    753755        String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml";
    754756       
    755         VloConfig.setCountryComponentUrl(param);
    756 
    757         String result = VloConfig.getCountryComponentUrl();
     757        config.setCountryComponentUrl(param);
     758
     759        String result = config.getCountryComponentUrl();
    758760       
    759761        assertEquals(param, result);
     
    769771       
    770772        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();
    772774       
    773775        assertEquals(expResult, result);
     
    784786        String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml";
    785787       
    786         VloConfig.setLanguage2LetterCodeComponentUrl(param);
    787 
    788         String result = VloConfig.getLanguage2LetterCodeComponentUrl();
     788        config.setLanguage2LetterCodeComponentUrl(param);
     789
     790        String result = config.getLanguage2LetterCodeComponentUrl();
    789791       
    790792        assertEquals(param, result);
     
    800802       
    801803        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();
    803805       
    804806        assertEquals(expResult, result);
     
    815817        String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml";
    816818       
    817         VloConfig.setLanguage3LetterCodeComponentUrl(param);
    818 
    819         String result = VloConfig.getLanguage3LetterCodeComponentUrl();
     819        config.setLanguage3LetterCodeComponentUrl(param);
     820
     821        String result = config.getLanguage3LetterCodeComponentUrl();
    820822       
    821823        assertEquals(param, result);
     
    831833       
    832834        String expResult = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml";
    833         String result = VloConfig.getSilToISO639CodesUrl();
     835        String result = config.getSilToISO639CodesUrl();
    834836       
    835837        assertEquals(expResult, result);
     
    846848        String param = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml";
    847849       
    848         VloConfig.setSilToISO639CodesUrl(param);
    849 
    850         String result = VloConfig.getSilToISO639CodesUrl();
     850        config.setSilToISO639CodesUrl(param);
     851
     852        String result = config.getSilToISO639CodesUrl();
    851853       
    852854        assertEquals(param, result);
     
    862864       
    863865        String expResult = "";
    864         String result = VloConfig.getReverseProxyPrefix();
     866        String result = config.getReverseProxyPrefix();
    865867       
    866868        assertEquals(expResult, result);
     
    877879        String param = "vlodev/";
    878880       
    879         VloConfig.setReverseProxyPrefix(param);
    880 
    881         String result = VloConfig.getReverseProxyPrefix();
     881        config.setReverseProxyPrefix(param);
     882
     883        String result = config.getReverseProxyPrefix();
    882884       
    883885        assertEquals(param, result);
     
    893895       
    894896        String expResult = "http://cqlservlet.mpi.nl/";
    895         String result = VloConfig.getCqlEndpointFilter();
     897        String result = config.getCqlEndpointFilter();
    896898       
    897899        assertEquals(expResult, result);
     
    908910        String param = "http://cqlservlet.mpi.nl/";
    909911       
    910         VloConfig.setCqlEndpointFilter(param);
    911 
    912         String result = VloConfig.getCqlEndpointFilter();
     912        config.setCqlEndpointFilter(param);
     913
     914        String result = config.getCqlEndpointFilter();
    913915       
    914916        assertEquals(param, result);
     
    924926       
    925927        String expResult = "http://cqlservlet.mpi.nl/";
    926         String result = VloConfig.getCqlEndpointAlternative();
     928        String result = config.getCqlEndpointAlternative();
    927929       
    928930        assertEquals(expResult, result);
     
    939941        String param = "http://cqlservlet.mpi.nl/";
    940942       
    941         VloConfig.setCqlEndpointAlternative(param);
    942 
    943         String result = VloConfig.getCqlEndpointAlternative();
     943        config.setCqlEndpointAlternative(param);
     944
     945        String result = config.getCqlEndpointAlternative();
    944946       
    945947        assertEquals(param, result);
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIComponentProfileNamePostProcessor.java

    r3135 r4507  
    7070        }
    7171        vg = new VTDGen();
    72         BASE_URL = VloConfig.getComponentRegistryRESTURL();
     72        BASE_URL = MetadataImporter.config.getComponentRegistryRESTURL();
    7373    }
    7474}
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java

    r4029 r4507  
    88import com.ximpleware.XPathEvalException;
    99import com.ximpleware.XPathParseException;
    10 import eu.clarin.cmdi.vlo.config.VloConfig;
    1110import java.io.File;
    1211import java.io.FileInputStream;
     
    5958            LOG.info("FILE WITH WEIRD HTTP THINGY! " + tolog);
    6059        }
    61         String facetConceptsFile = VloConfig.getFacetConceptsFile();
     60        String facetConceptsFile = MetadataImporter.config.getFacetConceptsFile();
    6261        if (facetConceptsFile.length() == 0){
    6362            // use the packaged facet mapping file
     
    8382        if (index != -1) {
    8483            String profileId = nav.toString(index).trim();
    85             result = VloConfig.getComponentRegistryProfileSchema(profileId);
     84            result = MetadataImporter.config.getComponentRegistryProfileSchema(profileId);
    8685        }
    8786        return result;
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessor.java

    r2768 r4507  
    22
    33import eu.clarin.cmdi.vlo.CommonUtils;
    4 import eu.clarin.cmdi.vlo.config.VloConfig;
    54import java.util.Map;
    65import org.slf4j.Logger;
     
    4140        LOG.debug("Creating country code map.");
    4241        try {
    43             Map<String, String> result = CommonUtils.createCMDIComponentItemMap(VloConfig.getCountryComponentUrl());
     42            Map<String, String> result = CommonUtils.createCMDIComponentItemMap(MetadataImporter.config.getCountryComponentUrl());
    4443            return result;
    4544        } catch (Exception e) {
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessor.java

    r2768 r4507  
    1818
    1919import eu.clarin.cmdi.vlo.CommonUtils;
    20 import eu.clarin.cmdi.vlo.config.VloConfig;
    2120
    2221public class LanguageCodePostProcessor implements PostProcessor{
     
    9897    private Map<String, String> getTwoLetterCountryCodeMap() {
    9998        if (twoLetterCodesMap == null) {
    100             twoLetterCodesMap = createCodeMap(VloConfig.getLanguage2LetterCodeComponentUrl());
     99            twoLetterCodesMap = createCodeMap(MetadataImporter.config.getLanguage2LetterCodeComponentUrl());
    101100        }
    102101        return twoLetterCodesMap;
     
    105104    private Map<String, String> getThreeLetterCountryCodeMap() {
    106105        if (threeLetterCodesMap == null) {
    107             threeLetterCodesMap = createCodeMap(VloConfig.getLanguage3LetterCodeComponentUrl());
     106            threeLetterCodesMap = createCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl());
    108107        }
    109108        return threeLetterCodesMap;
     
    112111    protected Map<String, String> getLanguageNameToIso639Map() {
    113112        if (languageNameToIso639Map == null) {
    114                         languageNameToIso639Map = createReverseCodeMap(VloConfig.getLanguage3LetterCodeComponentUrl());
     113                        languageNameToIso639Map = createReverseCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl());
    115114        }
    116115        return languageNameToIso639Map;
     
    119118    private Map<String, String> getIso639ToLanguageNameMap() {
    120119        if (iso639ToLanguageNameMap == null) {
    121                 iso639ToLanguageNameMap = createCodeMap(VloConfig.getLanguage3LetterCodeComponentUrl());
     120                iso639ToLanguageNameMap = createCodeMap(MetadataImporter.config.getLanguage3LetterCodeComponentUrl());
    122121        }
    123122
     
    151150            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
    152151            domFactory.setNamespaceAware(true);
    153             URL url = new URL(VloConfig.getSilToISO639CodesUrl());
     152            URL url = new URL(MetadataImporter.config.getSilToISO639CodesUrl());
    154153            DocumentBuilder builder = domFactory.newDocumentBuilder();
    155154            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  
    33import java.util.Map;
    44
    5 import eu.clarin.cmdi.vlo.FacetConstants;
    65
    76public class LanguageLinkPostProcessor extends LanguageCodePostProcessor {
     
    1817            String langCode = extractISO639LanguageCode(value);
    1918            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>";
    2120        }
    2221        return result;
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r4326 r4507  
    55import eu.clarin.cmdi.vlo.config.DataRoot;
    66import eu.clarin.cmdi.vlo.config.VloConfig;
     7import eu.clarin.cmdi.vlo.config.XmlVloConfigFactory;
    78
    89import java.io.File;
    910import java.io.IOException;
    1011import java.net.MalformedURLException;
     12import java.net.URL;
    1113import java.text.SimpleDateFormat;
    1214import java.util.ArrayList;
     
    120122        try {
    121123            // Delete the whole Solr db
    122             if (VloConfig.deleteAllFirst()) {
     124            if (config.deleteAllFirst()) {
    123125                LOG.info("Deleting original data...");
    124126                solrServer.deleteByQuery("*:*");
     
    138140                List<File> files = getFilesFromDataRoot(dataRoot.getRootFile());
    139141                for (File file : files) {
    140                     if (VloConfig.getMaxFileSize() > 0 &&
    141                             file.length() > VloConfig.getMaxFileSize()) {
     142                    if (config.getMaxFileSize() > 0 &&
     143                            file.length() > config.getMaxFileSize()) {
    142144                        LOG.info("Skipping " + file.getAbsolutePath() + " because it is too large.");
    143145                    } else {
     
    153155           
    154156            // 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]");
    158160                LOG.info("Deleting old files done.");
    159161            }
     
    190192     */
    191193    protected List<DataRoot> checkDataRoots() {
    192         List<DataRoot> dataRoots = VloConfig.getDataRoots();
     194        List<DataRoot> dataRoots = config.getDataRoots();
    193195        for (DataRoot dataRoot : dataRoots) {
    194196            if (!dataRoot.getRootFile().exists()) {
     
    230232     */
    231233    protected void initSolrServer() throws MalformedURLException {
    232         String solrUrl = VloConfig.getSolrUrl();
     234        String solrUrl = config.getSolrUrl();
    233235        LOG.info("Initializing Solr Server on " + solrUrl);
    234236       
     
    237239         */
    238240        solrServer = new ConcurrentUpdateSolrServer(solrUrl,
    239                 VloConfig.getMinDocsInSolrQueue(), 2) {
     241                config.getMinDocsInSolrQueue(), 2) {
    240242                    /*
    241243                     * Let the super class method handle exceptions. Make the
     
    354356        addResourceData(solrDocument, cmdiData);
    355357        docs.add(solrDocument);
    356         if (docs.size() == VloConfig.getMaxDocsInList()) {
     358        if (docs.size() == config.getMaxDocsInList()) {
    357359            sendDocs();
    358360        }
     
    428430    }
    429431
     432    public static VloConfig config;
     433   
    430434    /**
    431435     * @param args
     
    434438    public static void main(String[] args) throws MalformedURLException, IOException {
    435439
    436         // application configuration
    437         VloConfig config;
    438440       
    439441        // path to the configuration file
     
    494496        } else {
    495497            // 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();
    497500
    498501            // optionally, modify the configuration here
     
    504507            // finished importing
    505508
    506             if (VloConfig.printMapping()) {
     509            if (MetadataImporter.config.printMapping()) {
    507510                File file = new File("xsdMapping.txt");
    508511                FacetMappingFactory.printMapping(file);
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/NationalProjectPostProcessor.java

    r4029 r4507  
    11package eu.clarin.cmdi.vlo.importer;
    22
    3 import eu.clarin.cmdi.vlo.config.VloConfig;
    43import java.io.File;
    54import java.io.IOException;
     
    5150
    5251    private Map<String, String> getNationalProjectMapping() {
    53         String projectsMappingFile = VloConfig.getNationalProjectMapping();
     52        String projectsMappingFile = MetadataImporter.config.getNationalProjectMapping();
    5453
    5554        if (projectsMappingFile.length() == 0) {
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIDataProcessorTest.java

    r4199 r4507  
    22
    33import eu.clarin.cmdi.vlo.FacetConstants;
    4 import eu.clarin.cmdi.vlo.config.VloConfig;
    54import java.io.File;
    65import java.util.ArrayList;
     
    1312import static org.junit.Assert.assertNotNull;
    1413import static org.junit.Assert.assertTrue;
    15 import org.junit.Before;
    1614import org.junit.Test;
    1715
     
    2624       
    2725        // make sure the mapping file for testing is used
    28         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     26        config.setFacetConceptsFile("/facetConceptsTest.xml");
    2927
    3028        String content = "";
     
    9088       
    9189        // make sure the mapping file for testing is used
    92         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     90        config.setFacetConceptsFile("/facetConceptsTest.xml");
    9391
    9492        String content = "";
     
    415413       
    416414        // make sure the mapping file for testing is used
    417         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     415        config.setFacetConceptsFile("/facetConceptsTest.xml");
    418416
    419417        String content = "";
     
    444442       
    445443        // make sure the mapping file for testing is used
    446         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     444        config.setFacetConceptsFile("/facetConceptsTest.xml");
    447445
    448446        String content = "";
     
    536534
    537535        // make sure the mapping file for testing is used
    538         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     536        config.setFacetConceptsFile("/facetConceptsTest.xml");
    539537
    540538        String content = "";
     
    622620       
    623621        // make sure the mapping file for testing is used
    624         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     622        config.setFacetConceptsFile("/facetConceptsTest.xml");
    625623
    626624        String content = "";
     
    717715       
    718716        // make sure the mapping file for testing is used
    719         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     717        config.setFacetConceptsFile("/facetConceptsTest.xml");
    720718
    721719        String content = "";
     
    743741       
    744742        // make sure the mapping file for testing is used
    745         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     743        config.setFacetConceptsFile("/facetConceptsTest.xml");
    746744
    747745        String content = "";
     
    769767       
    770768        // make sure the mapping file for testing is used
    771         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     769        config.setFacetConceptsFile("/facetConceptsTest.xml");
    772770
    773771        String content = "";
     
    800798       
    801799        // make sure the mapping file for testing is used
    802         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     800        config.setFacetConceptsFile("/facetConceptsTest.xml");
    803801
    804802        String content = "";
     
    852850       
    853851        // make sure the mapping file for testing is used
    854         VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     852        config.setFacetConceptsFile("/facetConceptsTest.xml");
    855853
    856854        String content = "";
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXMLTest.java

    r2768 r4507  
    33import com.ximpleware.VTDGen;
    44import com.ximpleware.VTDNav;
    5 import eu.clarin.cmdi.vlo.config.VloConfig;
     5import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory;
    66import static org.junit.Assert.assertEquals;
    77import static org.junit.Assert.assertNull;
     
    1515
    1616        // read the configuration from the packaged configuration file
    17         VloConfig.readPackagedConfig();
     17        new DefaultVloConfigFactory().newConfig();
    1818
    1919        // optionally, modify the configuration here
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessorTest.java

    r2768 r4507  
    11package eu.clarin.cmdi.vlo.importer;
    22
    3 import eu.clarin.cmdi.vlo.config.VloConfig;
     3import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory;
    44import static org.junit.Assert.assertEquals;
    55import org.junit.Before;
     
    1212       
    1313        // read the configuration from the packaged configuration file
    14         VloConfig.readPackagedConfig();
     14        new DefaultVloConfigFactory().newConfig();
    1515
    1616        // optionally, modify the configuration here
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java

    r4326 r4507  
    11package eu.clarin.cmdi.vlo.importer;
    22
     3import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory;
    34import eu.clarin.cmdi.vlo.config.VloConfig;
     5import eu.clarin.cmdi.vlo.config.VloConfigFactory;
    46import java.io.File;
    57import java.io.IOException;
     
    911
    1012public abstract class ImporterTestcase {
     13
     14    private final VloConfigFactory configFactory = new DefaultVloConfigFactory();
     15    protected VloConfig config;
     16
    1117    private File testDir;
    1218
     
    2834        testDir.mkdir();
    2935        testDir.deleteOnExit();
    30        
     36
    3137        // read the configuration defined in the packaged configuration file
    32         VloConfig.readPackagedConfig();
     38        config = configFactory.newConfig();
    3339
    3440        // 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/");
    3742    }
    3843
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java

    r2768 r4507  
    11package eu.clarin.cmdi.vlo.importer;
    22
    3 import eu.clarin.cmdi.vlo.config.VloConfig;
     3import eu.clarin.cmdi.vlo.config.DefaultVloConfigFactory;
    44import static org.junit.Assert.assertEquals;
    55import org.junit.Before;
     
    1212       
    1313        // read the configuration from the packaged configuration file
    14         VloConfig.readPackagedConfig();
     14        new DefaultVloConfigFactory().newConfig();
    1515
    1616        // optionally, modify the configuration here
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java

    r4071 r4507  
    33import eu.clarin.cmdi.vlo.FacetConstants;
    44import eu.clarin.cmdi.vlo.config.DataRoot;
    5 import eu.clarin.cmdi.vlo.config.VloConfig;
    65import java.io.File;
    76import java.io.IOException;
     
    262261               
    263262                // make sure the mapping file for testing is used
    264                 VloConfig.setFacetConceptsFile("/facetConceptsTest.xml");
     263                config.setFacetConceptsFile("/facetConceptsTest.xml");
    265264               
    266265                List<DataRoot> dataRoots = checkDataRoots();
     
    276275                                getFilesFromDataRoot(dataRoot.getRootFile());
    277276                        for (File file : files) {
    278                             if (VloConfig.getMaxFileSize () > 0
     277                            if (config.getMaxFileSize () > 0
    279278                                    && file.length() >
    280                                     VloConfig.getMaxFileSize()) {
     279                                    config.getMaxFileSize()) {
    281280                                LOG.info("Skipping " + file.getAbsolutePath() +
    282281                                        " because it is too large.");
     
    340339        dataRoot.setTostrip("");
    341340        dataRoot.setPrefix("http://example.com");
    342         VloConfig.setDataRoots(Collections.singletonList(dataRoot));
     341        config.setDataRoots(Collections.singletonList(dataRoot));
    343342    }
    344343
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/config/VloSpringConfig.java

    r4502 r4507  
    5353    @Bean
    5454    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();
    5761    }
    5862
     
    6468    @Bean
    6569    public SearchResultsDao searchResultsDao() {
    66         return new SearchResultsDaoImpl(solrServer());
     70        return new SearchResultsDaoImpl(solrServer(), vloConfig());
    6771    }
    6872
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/AutoCompleteDao.java

    r4502 r4507  
    11package eu.clarin.cmdi.vlo.service.impl;
    22
     3import eu.clarin.cmdi.vlo.config.VloConfig;
    34import java.util.ArrayList;
    45import java.util.Iterator;
     
    1819public class AutoCompleteDao extends SolrDaoImpl {
    1920
    20     public AutoCompleteDao(SolrServer solrServer) {
    21         super(solrServer);
     21    public AutoCompleteDao(SolrServer solrServer, VloConfig config) {
     22        super(solrServer, config);
    2223    }
    2324   
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SearchResultsDaoImpl.java

    r4502 r4507  
    33import eu.clarin.cmdi.vlo.service.SearchResultsDao;
    44import eu.clarin.cmdi.vlo.FacetConstants;
     5import eu.clarin.cmdi.vlo.config.VloConfig;
    56import java.util.List;
    67import org.apache.solr.client.solrj.SolrQuery;
     
    1213public class SearchResultsDaoImpl extends SolrDaoImpl implements SearchResultsDao {
    1314
    14     public SearchResultsDaoImpl(SolrServer solrServer) {
    15         super(solrServer);
     15    public SearchResultsDaoImpl(SolrServer solrServer, VloConfig config) {
     16        super(solrServer, config);
    1617    }
    1718
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/service/impl/SolrDaoImpl.java

    r4502 r4507  
    1919    private final static Logger LOG = LoggerFactory.getLogger(SolrDaoImpl.class);
    2020    private final SolrServer solrServer;
     21    private final VloConfig config;
    2122
    22     public SolrDaoImpl(SolrServer solrServer) {
     23    public SolrDaoImpl(SolrServer solrServer, VloConfig config) {
    2324        this.solrServer = solrServer;
     25        this.config = config;
    2426    }
    2527
     
    5355            // present the facets from the config file as a list to a new set
    5456            Set<String> facetsDefined;
    55             facetsDefined = new HashSet<String>(Arrays.asList(VloConfig.getFacetFields()));
     57            facetsDefined = new HashSet<String>(Arrays.asList(config.getFacetFields()));
    5658
    5759            // 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  
    1818
    1919import eu.clarin.cmdi.vlo.FacetConstants;
     20import eu.clarin.cmdi.vlo.config.VloConfig;
    2021import eu.clarin.cmdi.vlo.importer.CMDIData;
    2122import java.io.File;
     
    4950        initCore(getResourcePath(getConfigString()), getResourcePath(getSchemaString()));
    5051        server = new EmbeddedSolrServer(h.getCoreContainer(), h.getCore().getName());
    51         instance = new SearchResultsDaoImpl(server);
     52        instance = new SearchResultsDaoImpl(server, new VloConfig());
    5253    }
    5354
Note: See TracChangeset for help on using the changeset viewer.