@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 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 public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws SAXException, RepositoryException { export(checkNotNull(absPath), new SystemViewExporter(this, checkNotNull(contentHandler), !noRecurse, !skipBinary)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }
@Override public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, RepositoryException { try { ContentHandler handler = new ToXmlContentHandler(checkNotNull(out)); export(checkNotNull(absPath), new SystemViewExporter(this, handler, !noRecurse, !skipBinary)); } catch (SAXException e) { Exception exception = e.getException(); if (exception instanceof RepositoryException) { throw (RepositoryException) exception; } else if (exception instanceof IOException) { throw (IOException) exception; } else { throw new RepositoryException( "Error serializing system view XML", e); } } }
Exporter exporter = new SystemViewExporter(session, handler, !noRecurse, !skipBinary); Item item = session.getItem(absPath);
Exporter exporter = new SystemViewExporter(session, handler, !noRecurse, !skipBinary); Item item = session.getItem(absPath);
@Test public void onlyGivenNamespacesAreWhitelisted() throws Exception { // GIVEN an arbitrary ContentHandler … JDOMResult jdomResult = new JDOMResult(); ContentHandler contentHandler = jdomResult.getHandler(); // … wrapped with the NamespaceFilter NamespaceFilter filter = new NamespaceFilter("yes"); filter.setContentHandler(contentHandler); Exporter exporter = new SystemViewExporter(session, filter, true, false); XMLOutputter outputter = new XMLOutputter(); StringWriter writer = new StringWriter(); // WHEN exporter.export(session.getNode("/foo")); outputter.output(jdomResult.getDocument(), writer); // THEN String export = writer.toString(); assertThat(export, containsString("xmlns:yes=\"urn:yes:1.0\"")); assertThat(export, not(containsString("xmlns:no=\"urn:no:1.0\""))); } }