public Resource getResource(Object r) throws XMLDBException {
LocalCollection collection = null;
Subject user = null;
LocalXMLResource res = null;
if (r instanceof NodeProxy) {
NodeProxy p = (NodeProxy) r;
res = new LocalXMLResource(user, db, collection, p);
} else if (r instanceof Node) {
res = new LocalXMLResource(user, db, collection, XmldbURI.EMPTY_URI);
res.setContentAsDOM((Node)r);
} else if (r instanceof AtomicValue) {
res = new LocalXMLResource(user, db, collection, XmldbURI.EMPTY_URI);
res.setContent(r);
} else if (r instanceof LocalXMLResource)
res = (LocalXMLResource) r;
else
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, "unknown object "+r.getClass());
try {
Field field = res.getClass().getDeclaredField("outputProperties");
field.setAccessible(true);
field.set(res, new Properties(defaultProperties));
} catch (Exception e) {
}
return res;