Search in sources :

Example 1 with MCRSourceContent

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

the class MCRRealmFactory method getRealms.

private static Document getRealms() throws JDOMException, TransformerException, SAXException, IOException {
    if (realmsFile == null) {
        return MCRSourceContent.getInstance(realmsURI.toASCIIString()).asXML();
    }
    if (!realmsFile.exists() || realmsFile.length() == 0) {
        LOGGER.info("Creating {}...", realmsFile.getAbsolutePath());
        MCRSourceContent realmsContent = MCRSourceContent.getInstance(RESOURCE_REALMS_URI);
        realmsContent.sendTo(realmsFile);
    }
    updateLastModified();
    return MCRXMLParserFactory.getNonValidatingParser().parseXML(new MCRFileContent(realmsFile));
}
Also used : MCRSourceContent(org.mycore.common.content.MCRSourceContent) MCRFileContent(org.mycore.common.content.MCRFileContent)

Example 2 with MCRSourceContent

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

the class MCRXMLFunctions method document.

public static Node document(String uri) throws JDOMException, IOException, SAXException, TransformerException {
    MCRSourceContent sourceContent = MCRSourceContent.getInstance(uri);
    if (sourceContent == null) {
        throw new TransformerException("Could not load document: " + uri);
    }
    DOMOutputter out = new DOMOutputter();
    return out.output(sourceContent.asXML());
}
Also used : MCRSourceContent(org.mycore.common.content.MCRSourceContent) DOMOutputter(org.jdom2.output.DOMOutputter) TransformerException(javax.xml.transform.TransformerException)

Aggregations

MCRSourceContent (org.mycore.common.content.MCRSourceContent)2 TransformerException (javax.xml.transform.TransformerException)1 DOMOutputter (org.jdom2.output.DOMOutputter)1 MCRFileContent (org.mycore.common.content.MCRFileContent)1