- class JcrKeyIterator implements Iterator<QName> {
- private final JcrContentProvider contentSession;
- private final PropertyIterator propertyIterator;
+ boolean exists() {
+ try {
+ return provider.getJcrSession(getSession(), jcrWorkspace).itemExists(jcrPath);
+ } catch (RepositoryException e) {
+ throw new JcrException("Cannot check whether " + jcrPath + " exists", e);
+ }
+ }
+
+ /*
+ * ADAPTERS
+ */
+ @SuppressWarnings("unchecked")
+ public <A> A adapt(Class<A> clss) {
+ if (Source.class.isAssignableFrom(clss)) {
+// try {
+ PipedInputStream in = new PipedInputStream();
+
+ ForkJoinPool.commonPool().execute(() -> {
+ try (PipedOutputStream out = new PipedOutputStream(in)) {
+ provider.getJcrSession(getSession(), jcrWorkspace).exportDocumentView(jcrPath, out, true, false);
+ out.flush();
+ } catch (IOException | RepositoryException e) {
+ throw new RuntimeException("Cannot export " + jcrPath + " in workspace " + jcrWorkspace, e);
+ }