Search in sources :

Example 1 with DefaultInterfaceProcessor

use of uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor in project Openfire by igniterealtime.

the class GatewayDWR method configure.

@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = dbf.newDocumentBuilder();
        document = builder.newDocument();
        Element root = document.createElement("dwr");
        document.appendChild(root);
        Element allowElement = document.createElement("allow");
        allowElement.appendChild(buildCreator("ConfigManager", "net.sf.kraken.web.ConfigManager"));
        allowElement.appendChild(buildCreator("ConnectionTester", "net.sf.kraken.web.ConnectionTester"));
        root.appendChild(allowElement);
    } catch (ParserConfigurationException e) {
        Log.error("Error configuring DWR for gateway plugin: ", e);
    }
    configuration.addConfig(document);
    // Specify the path for the js files 
    Object bean = container.getBean("interface");
    if (bean instanceof DefaultInterfaceProcessor) {
        DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor) bean;
        processor.setOverridePath("/plugins/kraken/dwr");
    }
}
Also used : DefaultInterfaceProcessor(uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Element(org.w3c.dom.Element) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Example 2 with DefaultInterfaceProcessor

use of uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor in project Openfire by igniterealtime.

the class MonitoringDWR method configure.

@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
    try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = dbf.newDocumentBuilder();
        document = builder.newDocument();
        Element root = document.createElement("dwr");
        document.appendChild(root);
        Element allowElement = document.createElement("allow");
        // Build stats bean
        Element createElement = buildCreator("Stats", org.jivesoftware.openfire.reporting.stats.StatsAction.class.getName());
        Element convertConversationElement = document.createElement("convert");
        convertConversationElement.setAttribute("converter", "bean");
        convertConversationElement.setAttribute("match", org.jivesoftware.openfire.archive.ConversationInfo.class.getName());
        // Build conversation Element.
        Element conversationElement = buildCreator("conversations", org.jivesoftware.openfire.archive.ConversationUtils.class.getName());
        allowElement.appendChild(createElement);
        allowElement.appendChild(convertConversationElement);
        allowElement.appendChild(conversationElement);
        root.appendChild(allowElement);
    } catch (ParserConfigurationException e) {
        Log.error("error creating DWR configuration: " + e);
    }
    configuration.addConfig(document);
    // Specify the path for the Stat.js file 
    Object bean = container.getBean("interface");
    if (bean instanceof DefaultInterfaceProcessor) {
        DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor) bean;
        processor.setOverridePath("/plugins/" + MonitoringConstants.NAME + "/dwr");
    }
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Element(org.w3c.dom.Element) DefaultInterfaceProcessor(uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor) DocumentBuilder(javax.xml.parsers.DocumentBuilder) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Aggregations

DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 Element (org.w3c.dom.Element)2 DefaultInterfaceProcessor (uk.ltd.getahead.dwr.impl.DefaultInterfaceProcessor)2