Search in sources :

Example 11 with ConfigFinder

use of org.collectionspace.csp.helper.core.ConfigFinder in project application by collectionspace.

the class TestConfigFinder method getConfigFile.

public static File getConfigFile(String filename) throws CSPDependencyException {
    try {
        ConfigFinder cfg = new ConfigFinder(null);
        // InputSource out=cfg.resolveEntity("-//CSPACE//ROOT",filename);
        File out = cfg.resolveEntityAsFile("-//CSPACE//TESTROOT", filename);
        if (out != null) {
            return out;
        }
        throw new CSPDependencyException("No config file found by any method");
    } catch (SAXException x) {
        throw new CSPDependencyException("Parsing failed", x);
    } catch (IOException x) {
        throw new CSPDependencyException("Parsing failed", x);
    }
}
Also used : CSPDependencyException(org.collectionspace.csp.api.core.CSPDependencyException) IOException(java.io.IOException) File(java.io.File) ConfigFinder(org.collectionspace.csp.helper.core.ConfigFinder) SAXException(org.xml.sax.SAXException)

Aggregations

ConfigFinder (org.collectionspace.csp.helper.core.ConfigFinder)11 CSPManagerImpl (org.collectionspace.csp.container.impl.CSPManagerImpl)8 CoreConfig (org.collectionspace.chain.csp.inner.CoreConfig)7 Spec (org.collectionspace.chain.csp.schema.Spec)7 CSPManager (org.collectionspace.csp.api.container.CSPManager)7 CSPDependencyException (org.collectionspace.csp.api.core.CSPDependencyException)6 ConfigRoot (org.collectionspace.chain.csp.config.ConfigRoot)5 TestConfigFinder (org.collectionspace.csp.helper.test.TestConfigFinder)5 InputSource (org.xml.sax.InputSource)4 SAXException (org.xml.sax.SAXException)4 IOException (java.io.IOException)3 Test (org.junit.Test)3 File (java.io.File)2 ServicesStorageGenerator (org.collectionspace.chain.csp.persistence.services.ServicesStorageGenerator)2 TenantSpec (org.collectionspace.chain.csp.persistence.services.TenantSpec)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 WebUI (org.collectionspace.chain.csp.webui.main.WebUI)1 UI (org.collectionspace.csp.api.ui.UI)1 UIException (org.collectionspace.csp.api.ui.UIException)1 JSONException (org.json.JSONException)1