Changeset 6288


Ignore:
Timestamp:
06/12/15 07:45:47 (9 years ago)
Author:
Twan Goosen
Message:

Added fields with part count and resource count for further ranking
Also added a constant for running the importer and web app without network connection (e.g. on an ICE :))
Refs #750

Location:
vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/CommonUtils.java

    r5153 r6288  
    2121public final class CommonUtils {
    2222
     23    /**
     24     * Set to true to make run/import possible without a network connection
     25     * (todo: make environment variable?)
     26     */
     27    public static final Boolean SWALLOW_LOOKUP_ERRORS = false; //ONLY COMMIT AS FALSE!
     28
    2329    private final static Set<String> ANNOTATION_MIMETYPES = new HashSet<String>();
     30
    2431    static {
    2532        ANNOTATION_MIMETYPES.add("text/x-eaf+xml");
     
    3340    }
    3441    private final static Set<String> TEXT_MIMETYPES = new HashSet<String>();
     42
    3543    static {
    3644        TEXT_MIMETYPES.add("application/pdf");
     
    3846    }
    3947    private final static Set<String> VIDEO_MIMETYPES = new HashSet<String>();
     48
    4049    static {
    4150        VIDEO_MIMETYPES.add("application/mxf");
    4251    }
    4352    private final static Set<String> AUDIO_MIMETYPES = new HashSet<String>();
     53
    4454    static {
    4555        AUDIO_MIMETYPES.add("application/ogg");
     
    7585
    7686    /**
    77      * Create a mapping out of simple CMDI components for instance: lists of items: <item AppInfo="Tigrinya (ti)">ti</item> Will become key (after removal of trailing 2 or 3 letter codes),
    78      * values: ti, Tigrinya
     87     * Create a mapping out of simple CMDI components for instance: lists of
     88     * items: <item AppInfo="Tigrinya (ti)">ti</item> Will become key (after
     89     * removal of trailing 2 or 3 letter codes), values: ti, Tigrinya
     90     *
    7991     * @param urlToComponent
    8092     * @return Map with item_value, AppInfo_value pairs
     
    102114        return result;
    103115    }
    104    
     116
    105117    /**
    106      * Create a mapping out of simple CMDI components for instance: lists of items: <item AppInfo="Tigrinya">ti</item> Will become key (after removal of trailing 2 or 3 letter codes),
    107      * values: Tigrinya, ti
     118     * Create a mapping out of simple CMDI components for instance: lists of
     119     * items: <item AppInfo="Tigrinya">ti</item> Will become key (after removal
     120     * of trailing 2 or 3 letter codes), values: Tigrinya, ti
     121     *
    108122     * @param urlToComponent
    109123     * @return Map with item_value, AppInfo_value pairs
  • vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/FacetConstants.java

    r6232 r6288  
    3939    public static final String FIELD_FILENAME = "_fileName";
    4040    public static final String FIELD_RESOURCE = "_resourceRef";
     41    public static final String FIELD_RESOURCE_COUNT = "_resourceRefCount";
    4142    public static final String FIELD_CLARIN_PROFILE = "_componentProfile";
    4243    public static final String FIELD_SEARCH_SERVICE = "_contentSearchRef";
     
    4546    public static final String FIELD_IS_PART_OF = "_isPartOf";
    4647    public static final String FIELD_HAS_PART = "_hasPart";
     48    public static final String FIELD_HAS_PART_COUNT = "_hasPartCount";
    4749
    4850    /**
  • vlo/trunk/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/LanguageCodeUtils.java

    r6036 r6288  
    1919import eu.clarin.cmdi.vlo.config.VloConfig;
    2020import java.net.URL;
     21import java.util.HashMap;
    2122import java.util.Map;
    2223import java.util.concurrent.ConcurrentHashMap;
     
    149150            return result;
    150151        } catch (Exception e) {
    151             throw new RuntimeException("Cannot instantiate postProcessor:", e);
     152            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     153                return new HashMap<String, String>();
     154            } else {
     155                throw new RuntimeException("Cannot instantiate postProcessor:", e);
     156            }
    152157        }
    153158    }
     
    159164            return result;
    160165        } catch (Exception e) {
    161             throw new RuntimeException("Cannot instantiate postProcessor:", e);
     166            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     167                return new HashMap<String, String>();
     168            } else {
     169                throw new RuntimeException("Cannot instantiate postProcessor:", e);
     170            }
    162171        }
    163172    }
     
    182191            return result;
    183192        } catch (Exception e) {
    184             throw new RuntimeException("Cannot instantiate postProcessor:", e);
     193            if (CommonUtils.SWALLOW_LOOKUP_ERRORS) {
     194                return new HashMap<String, String>();
     195            } else {
     196                throw new RuntimeException("Cannot instantiate postProcessor:", e);
     197            }
    185198        }
    186199    }
Note: See TracChangeset for help on using the changeset viewer.