use of org.w3c.dom.Element 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");
}
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(long[][] value, String name, long[][] defVal) throws IOException {
if (value == null)
return;
if (Arrays.deepEquals(value, defVal))
return;
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
for (int i = 0; i < value.length; i++) {
long[] array = value[i];
write(array, "array_" + i, defVal == null ? null : defVal[i]);
}
currentElement = (Element) el.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(float[] value, String name, float[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
if (value != null) {
for (float b : value) {
buf.append(b);
buf.append(" ");
}
if (buf.length() > 0) {
//remove last space
buf.setLength(buf.length() - 1);
}
}
Element el = appendElement(name);
el.setAttribute("size", value == null ? "0" : String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(int[] value, String name, int[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
return;
}
if (Arrays.equals(value, defVal)) {
return;
}
for (int b : value) {
buf.append(b);
buf.append(" ");
}
if (buf.length() > 0) {
//remove last space
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
use of org.w3c.dom.Element in project jmonkeyengine by jMonkeyEngine.
the class DOMOutputCapsule method write.
@Override
public void write(boolean[] value, String name, boolean[] defVal) throws IOException {
StringBuilder buf = new StringBuilder();
if (value == null) {
value = defVal;
}
for (boolean b : value) {
buf.append(b);
buf.append(" ");
}
if (buf.length() > 0) {
//remove last space
buf.setLength(buf.length() - 1);
}
Element el = appendElement(name);
el.setAttribute("size", String.valueOf(value.length));
el.setAttribute(dataAttributeName, buf.toString());
currentElement = (Element) currentElement.getParentNode();
}
Aggregations