Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (working copy) @@ -987,7 +987,7 @@ * * @throws RepositoryException */ - protected Properties loadRepProps() throws RepositoryException { + public Properties loadRepProps() throws RepositoryException { FileSystemResource propFile = new FileSystemResource(metaDataStore, PROPERTIES_RESOURCE); try { Properties props = new Properties(); Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (working copy) @@ -1179,6 +1179,50 @@ throw new RepositoryException(se); } } + + + /** + * {@inheritDoc} + */ + public void exportSystemView(String absPath, ContentHandler contentHandler, + boolean skipBinary, boolean noRecurse, boolean noJcrSystem) + throws PathNotFoundException, SAXException, RepositoryException { + // check sanity of this session + sanityCheck(); + + Item item = getItem(absPath); + if (!item.isNode()) { + // there's a property, though not a node at the specified path + throw new PathNotFoundException(absPath); + } + new SysViewSAXEventGenerator((Node) item, noRecurse, skipBinary, + contentHandler, noJcrSystem).serialize(); + } + + /** + * {@inheritDoc} + */ + public void exportSystemView(String absPath, OutputStream out, + boolean skipBinary, boolean noRecurse, boolean noJcrSystem) + throws IOException, PathNotFoundException, RepositoryException { + + SAXTransformerFactory stf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + try { + TransformerHandler th = stf.newTransformerHandler(); + th.setResult(new StreamResult(out)); + th.getTransformer().setParameter(OutputKeys.METHOD, "xml"); + th.getTransformer().setParameter(OutputKeys.ENCODING, "UTF-8"); + th.getTransformer().setParameter(OutputKeys.INDENT, "no"); + + exportSystemView(absPath, th, skipBinary, noRecurse, noJcrSystem); + } catch (TransformerException te) { + throw new RepositoryException(te); + } catch (SAXException se) { + throw new RepositoryException(se); + } + } + + /** * {@inheritDoc} Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (working copy) @@ -53,6 +53,11 @@ /** Name of the bean parameter value configuration attribute. */ public static final String VALUE_ATTRIBUTE = "value"; + /** Name of the persistence manager configuration element. */ + public static final String PERSISTENCE_MANAGER_ELEMENT = + "PersistenceManager"; + + /** * The configuration parser variables. These name-value pairs * are used to substitute ${...} variable references @@ -70,6 +75,7 @@ public ConfigurationParser(Properties variables) { this.variables = variables; } + /** * Returns the variables. @@ -267,6 +273,7 @@ + element.getNodeName() + "."); } } + /** * Returns the value of the named attribute of the given element. Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (working copy) @@ -73,9 +73,7 @@ /** Name of the file system configuration element. */ public static final String FILE_SYSTEM_ELEMENT = "FileSystem"; - /** Name of the persistence manager configuration element. */ - public static final String PERSISTENCE_MANAGER_ELEMENT = - "PersistenceManager"; + /** Name of the search index configuration element. */ public static final String SEARCH_INDEX_ELEMENT = "SearchIndex"; @@ -427,18 +425,7 @@ return new VersioningConfig(home, fsc, pmc); } - /** - * Parses the PersistenceManager config. - * - * @param parent parent of the PersistenceManager element - * @return persistence manager configuration - * @throws ConfigurationException if the configuration is broken - */ - protected PersistenceManagerConfig parsePersistenceManagerConfig( - Element parent) throws ConfigurationException { - return new PersistenceManagerConfig( - parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT)); - } + /** * Creates a new instance of a configuration parser but with overlayed @@ -453,5 +440,18 @@ props.putAll(variables); return new RepositoryConfigurationParser(props); } + + /** + * Parses the PersistenceManager config. + * + * @param parent parent of the PersistenceManager element + * @return persistence manager configuration + * @throws ConfigurationException if the configuration is broken + */ + protected PersistenceManagerConfig parsePersistenceManagerConfig( + Element parent) throws ConfigurationException { + return new PersistenceManagerConfig( + parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT)); + } } Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/AbstractSAXEventGenerator.java (working copy) @@ -96,6 +96,11 @@ * The jcr:xmlCharacters property name (allowed for session-local prefix mappings) */ protected final String jcrXMLCharacters; + + /** + * Allow us to know if we should export or not the shared subtree /jcr:system + */ + protected boolean noJcrSystem; /** * Constructor @@ -119,6 +124,41 @@ this.contentHandler = contentHandler; this.skipBinary = skipBinary; this.noRecurse = noRecurse; + + //Since not initialized + this.noJcrSystem = false; + + // resolve the names of some wellknown properties + // allowing for session-local prefix mappings + try { + jcrPrimaryType = NameFormat.format(QName.JCR_PRIMARYTYPE, nsResolver); + jcrMixinTypes = NameFormat.format(QName.JCR_MIXINTYPES, nsResolver); + jcrUUID = NameFormat.format(QName.JCR_UUID, nsResolver); + jcrRoot = NameFormat.format(QName.JCR_ROOT, nsResolver); + jcrXMLText = NameFormat.format(QName.JCR_XMLTEXT, nsResolver); + jcrXMLCharacters = NameFormat.format(QName.JCR_XMLCHARACTERS, nsResolver); + } catch (NameException e) { + // should never get here... + String msg = "internal error: failed to resolve namespace mappings"; + log.error(msg, e); + throw new RepositoryException(msg, e); + } + } + + protected AbstractSAXEventGenerator(Node node, boolean noRecurse, boolean skipBinary, ContentHandler contentHandler, boolean noJcrSystem) throws RepositoryException { + + //TODO is there a way to call another constructor of the same class within the same class? + //Copy/paste of the previous constructor. + startNode = node; + session = node.getSession(); + nsResolver = new SessionNamespaceResolver(session); + + this.contentHandler = contentHandler; + this.skipBinary = skipBinary; + this.noRecurse = noRecurse; + + //Only difference + this.noJcrSystem = noJcrSystem; // resolve the names of some wellknown properties // allowing for session-local prefix mappings @@ -277,8 +317,10 @@ NodeIterator nodeIter = node.getNodes(); while (nodeIter.hasNext()) { Node childNode = nodeIter.nextNode(); - // recurse - process(childNode, level + 1); + // recurse and if needed exclude /jcr:system + if (!(this.noJcrSystem == true && childNode.getName().equals("jcr:system") && level == 0)) { + process(childNode, level + 1); + } } } Index: /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java =================================================================== --- /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java (revision 426276) +++ /home/ntoper/workspace/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SysViewSAXEventGenerator.java (working copy) @@ -62,6 +62,7 @@ public static final String CDATA_TYPE = "CDATA"; public static final String ENUMERATION_TYPE = "ENUMERATION"; + /** * Constructor * @@ -78,6 +79,11 @@ ContentHandler contentHandler) throws RepositoryException { super(node, noRecurse, skipBinary, contentHandler); + super.noJcrSystem = false; + } + + public SysViewSAXEventGenerator(Node node, boolean noRecurse, boolean skipBinary, ContentHandler contentHandler, boolean noJcrSystem) throws RepositoryException { + super(node, noRecurse, skipBinary, contentHandler, noJcrSystem); } /**