/** * Exports the given node as an <code>sv:node</code> element. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { addAttribute(SV, "name", getXMLName(uri, local)); startElement(SV, "node"); exportProperties(node); exportNodes(node); endElement(SV, "node"); }
/** * Creates a system view exporter. * * @param session current session * @param handler SAX event handler for the export * @param recurse whether to recursively export the whole subtree * @param binary whether to export binary values */ public SystemViewExporter( Session session, ContentHandler handler, boolean recurse, boolean binary) { super(session, handler, recurse, binary); addNamespace("sv", SV); }
public void write(char[] cbuf, int off, int len) throws IOException { try { SystemViewExporter.this.characters(cbuf, off, len); } catch (Exception e) { IOException exception = new IOException(); exception.initCause(e); throw exception; } } public void close() {
/** * Calls {@link #exportProperty(String, String, int, Value[])}. */ protected void exportProperty(String uri, String local, Value value) throws RepositoryException, SAXException { // start property element addAttribute(SV, "name", getXMLName(uri, local)); addAttribute(SV, "type", PropertyType.nameFromValue(value.getType())); startElement(SV, "property"); // value exportValue(value); endElement(SV, "property"); }
throws RepositoryException, SAXException { try { boolean binary = mustSendBinary(value); if (binary) { addNamespace("xs", XS); addNamespace("xsi", XSI); addAttribute(XSI, "type", getXMLName(XS, "base64Binary")); startElement(SV, "value"); ValueHelper.serialize(value, false, binary, new Writer() { public void write(char[] cbuf, int off, int len) endElement(SV, "value"); } catch (IOException e) {
@Override public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException { export(checkNotNull(absPath), new SystemViewExporter(this, checkNotNull(contentHandler), !noRecurse, !skipBinary)); }
@Override protected void exportNodes(Node node) throws RepositoryException, SAXException { if (recurse) { super.exportNodes(node); } }
@Override protected String getXMLName(String uri, String local) throws RepositoryException { if (isFrozenNode) { if (FROZEN_PROPERTIES.contains(local)) { local = StringUtils.replace(local, "frozen", ""); local = StringUtils.uncapitalize(local); } else if (FROZEN_NODE_NAME.equals(local)) { uri = ""; local = nodeName; } } return super.getXMLName(uri, local); } }
/** * Exports the given property as an <code>sv:property</code> element. */ protected void exportProperty( String uri, String local, int type, Value[] values) throws RepositoryException, SAXException { // start property element addAttribute(SV, "name", getXMLName(uri, local)); addAttribute(SV, "type", PropertyType.nameFromValue(type)); addAttribute(SV, "multiple", Boolean.TRUE.toString()); startElement(SV, "property"); // values for (int i = 0; i < values.length; i++) { exportValue(values[i]); } endElement(SV, "property"); }
throws RepositoryException, SAXException { try { boolean binary = mustSendBinary(value); if (binary) { addNamespace("xs", XS); addNamespace("xsi", XSI); addAttribute(XSI, "type", getXMLName(XS, "base64Binary")); startElement(SV, "value"); ValueHelper.serialize(value, false, binary, new Writer() { public void write(char[] cbuf, int off, int len) endElement(SV, "value"); } catch (IOException e) {
@Override public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException { export(checkNotNull(absPath), new SystemViewExporter(this, checkNotNull(contentHandler), !noRecurse, !skipBinary)); }
/** * Calls {@link #exportProperty(String, String, int, Value[])}. */ protected void exportProperty(String uri, String local, Value value) throws RepositoryException, SAXException { // start property element addAttribute(SV, "name", getXMLName(uri, local)); addAttribute(SV, "type", PropertyType.nameFromValue(value.getType())); startElement(SV, "property"); // value exportValue(value); endElement(SV, "property"); }
/** * Exports the given node as an <code>sv:node</code> element. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { addAttribute(SV, "name", getXMLName(uri, local)); startElement(SV, "node"); exportProperties(node); exportNodes(node); endElement(SV, "node"); }
throws RepositoryException, SAXException { try { boolean binary = mustSendBinary(value); if (binary) { addNamespace("xs", XS); addNamespace("xsi", XSI); addAttribute(XSI, "type", getXMLName(XS, "base64Binary")); startElement(SV, "value"); ValueHelper.serialize(value, false, binary, new Writer() { public void write(char[] cbuf, int off, int len) endElement(SV, "value"); } catch (IOException e) {
@Override public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException { export(checkNotNull(absPath), new SystemViewExporter(this, checkNotNull(contentHandler), !noRecurse, !skipBinary)); }
public void write(char[] cbuf, int off, int len) throws IOException { try { SystemViewExporter.this.characters(cbuf, off, len); } catch (Exception e) { IOException exception = new IOException(); exception.initCause(e); throw exception; } } public void close() {
/** * Creates a system view exporter. * * @param session current session * @param handler SAX event handler for the export * @param recurse whether to recursively export the whole subtree * @param binary whether to export binary values */ public SystemViewExporter( Session session, ContentHandler handler, boolean recurse, boolean binary) { super(session, handler, recurse, binary); addNamespace("sv", SV); }
/** * Exports the given property as an <code>sv:property</code> element. */ protected void exportProperty( String uri, String local, int type, Value[] values) throws RepositoryException, SAXException { // start property element addAttribute(SV, "name", getXMLName(uri, local)); addAttribute(SV, "type", PropertyType.nameFromValue(type)); addAttribute(SV, "multiple", Boolean.TRUE.toString()); startElement(SV, "property"); // values for (int i = 0; i < values.length; i++) { exportValue(values[i]); } endElement(SV, "property"); }
/** * Exports the given node as an <code>sv:node</code> element. */ protected void exportNode(String uri, String local, Node node) throws RepositoryException, SAXException { addAttribute(SV, "name", getXMLName(uri, local)); startElement(SV, "node"); exportProperties(node); exportNodes(node); endElement(SV, "node"); }
/** * Generates a system view export using a {@link SystemViewExporter} * instance. * * @param path of the node to be exported * @param handler handler for the SAX events of the export * @param skipBinary whether binary values should be skipped * @param noRecurse whether to export just the identified node * @throws PathNotFoundException if a node at the given path does not exist * @throws SAXException if the SAX event handler failed * @throws RepositoryException if another error occurs */ public void exportSystemView( String path, ContentHandler handler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException { export(path, new SystemViewExporter( this, handler, !noRecurse, !skipBinary)); }