+// class JcrKeyIterator implements Iterator<QName> {
+// private final PropertyIterator propertyIterator;
+//
+// protected JcrKeyIterator(PropertyIterator propertyIterator) {
+// this.propertyIterator = propertyIterator;
+// }
+//
+// @Override
+// public boolean hasNext() {
+// return propertyIterator.hasNext();
+// }
+//
+// @Override
+// public QName next() {
+// Property property = null;
+// try {
+// property = propertyIterator.nextProperty();
+// // TODO map standard property names
+// return NamespaceUtils.parsePrefixedName(provider, property.getName());
+// } catch (RepositoryException e) {
+// throw new JcrException("Cannot retrieve property " + property, null);
+// }
+// }
+//
+// }
+ /*
+ * STATIC UTLITIES
+ */
+ public static Content nodeToContent(Node node) {
+ if (node == null)
+ return null;
+ try {
+ ProvidedSession contentSession = (ProvidedSession) node.getSession()
+ .getAttribute(ProvidedSession.class.getName());
+ if (contentSession == null)
+ throw new IllegalArgumentException(
+ "Cannot adapt " + node + " to content, because it was not loaded from a content session");
+ return contentSession.get(CmsConstants.SYS_WORKSPACE + node.getPath());
+ } catch (RepositoryException e) {
+ throw new JcrException("Cannot adapt " + node + " to a content", e);
+ }