Search in sources :

Example 21 with CSPDependencyException

use of org.collectionspace.csp.api.core.CSPDependencyException 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

CSPDependencyException (org.collectionspace.csp.api.core.CSPDependencyException)21 IOException (java.io.IOException)7 SAXException (org.xml.sax.SAXException)7 ConfigFinder (org.collectionspace.csp.helper.core.ConfigFinder)6 Spec (org.collectionspace.chain.csp.schema.Spec)5 JSONException (org.json.JSONException)5 File (java.io.File)4 ExistException (org.collectionspace.csp.api.persistence.ExistException)4 Storage (org.collectionspace.csp.api.persistence.Storage)4 UnderlyingStorageException (org.collectionspace.csp.api.persistence.UnderlyingStorageException)4 UnimplementedException (org.collectionspace.csp.api.persistence.UnimplementedException)4 JSONObject (org.json.JSONObject)4 InputSource (org.xml.sax.InputSource)4 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)3 CoreConfig (org.collectionspace.chain.csp.inner.CoreConfig)3 CSPManager (org.collectionspace.csp.api.container.CSPManager)3 CSPManagerImpl (org.collectionspace.csp.container.impl.CSPManagerImpl)3 TestConfigFinder (org.collectionspace.csp.helper.test.TestConfigFinder)3 FileNotFoundException (java.io.FileNotFoundException)2