Search in sources :

Example 11 with MCRURLContent

use of org.mycore.common.content.MCRURLContent in project mycore by MyCoRe-Org.

the class MCRConfigurationInputStream method getPropertyStream.

private static InputStream getPropertyStream(String filename) throws IOException {
    File mycoreProperties = new File(filename);
    MCRContent input = null;
    if (mycoreProperties.canRead()) {
        input = new MCRFileContent(mycoreProperties);
    } else {
        URL url = MCRConfigurationInputStream.class.getClassLoader().getResource(filename);
        if (url != null) {
            input = new MCRURLContent(url);
        }
    }
    return input == null ? null : input.getInputStream();
}
Also used : MCRFileContent(org.mycore.common.content.MCRFileContent) MCRURLContent(org.mycore.common.content.MCRURLContent) File(java.io.File) MCRContent(org.mycore.common.content.MCRContent) URL(java.net.URL)

Aggregations

MCRURLContent (org.mycore.common.content.MCRURLContent)11 URL (java.net.URL)8 Document (org.jdom2.Document)5 Test (org.junit.Test)4 MCRCategory (org.mycore.datamodel.classifications2.MCRCategory)4 IOException (java.io.IOException)3 File (java.io.File)2 MCRContent (org.mycore.common.content.MCRContent)2 MCRFileContent (org.mycore.common.content.MCRFileContent)2 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)2 JsonElement (com.google.gson.JsonElement)1 MalformedURLException (java.net.MalformedURLException)1 EntityManager (javax.persistence.EntityManager)1 TransformerException (javax.xml.transform.TransformerException)1 SolrClient (org.apache.solr.client.solrj.SolrClient)1 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)1 Element (org.jdom2.Element)1 MCRCategoryID (org.mycore.datamodel.classifications2.MCRCategoryID)1 MCRFile (org.mycore.datamodel.ifs.MCRFile)1 MCRSolrURL (org.mycore.solr.search.MCRSolrURL)1