Search in sources :

Example 26 with MCRConfiguration

use of org.mycore.common.config.MCRConfiguration in project mycore by MyCoRe-Org.

the class MCRDataSourceFactory method buildDataSource.

private MCRDataSource buildDataSource(String sourceID) {
    MCRConfiguration config = MCRConfiguration.instance();
    MCRDataSource dataSource = new MCRDataSource(sourceID);
    String[] identifierTypes = config.getString("MCR.MODS.EnrichmentResolver.DataSource." + sourceID + ".IdentifierTypes").split("\\s");
    for (String typeID : identifierTypes) {
        String prefix = "MCR.MODS.EnrichmentResolver.DataSource." + sourceID + "." + typeID + ".";
        String uri = config.getString(prefix + "URI");
        MCRIdentifierType idType = MCRIdentifierTypeFactory.instance().getType(typeID);
        MCRIdentifierResolver resolver = new MCRIdentifierResolver(idType, uri);
        dataSource.addResolver(resolver);
    }
    return dataSource;
}
Also used : MCRConfiguration(org.mycore.common.config.MCRConfiguration)

Aggregations

MCRConfiguration (org.mycore.common.config.MCRConfiguration)26 File (java.io.File)3 ArrayList (java.util.ArrayList)3 MCRConfigurationException (org.mycore.common.config.MCRConfigurationException)3 URI (java.net.URI)2 Hashtable (java.util.Hashtable)2 Test (org.junit.Test)2 CategoryDAOMock (org.mycore.frontend.classeditor.mocks.CategoryDAOMock)2 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1 URLConnection (java.net.URLConnection)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1