/** * Import under the supplied parent node the repository content in the XML file at the given location on the classpath. * * @param parent the node under which the content should be imported; may not be null * @param resourceName the name of the XML file on the classpath * @param uuidBehavior the UUID behavior; see {@link ImportUUIDBehavior} for values * @throws RepositoryException if there is a problem importing the content * @throws IOException if the XML file could not be read */ protected void importContent( Node parent, String resourceName, int uuidBehavior ) throws RepositoryException, IOException { InputStream stream = resourceStream(resourceName); assertThat(stream, is(notNullValue())); parent.getSession().getWorkspace().importXML(parent.getPath(), stream, uuidBehavior); }
/** * Import under the supplied parent node the repository content in the XML file at the given location on the classpath. * * @param parentPath the path to the node under which the content should be imported; may not be null * @param resourceName the name of the XML file on the classpath * @param uuidBehavior the UUID behavior; see {@link ImportUUIDBehavior} for values * @throws RepositoryException if there is a problem importing the content * @throws IOException if the XML file could not be read */ protected void importContent( String parentPath, String resourceName, int uuidBehavior ) throws RepositoryException, IOException { InputStream stream = resourceStream(resourceName); assertThat(stream, is(notNullValue())); session().getWorkspace().importXML(parentPath, stream, uuidBehavior); }
/** * Register the node types in the CND file at the given location on the classpath. * * @param resourceName the name of the CND file on the classpath * @throws RepositoryException if there is a problem registering the node types * @throws IOException if the CND file could not be read */ protected void registerNodeTypes( String resourceName ) throws RepositoryException, IOException { InputStream stream = resourceStream(resourceName); assertThat(stream, is(notNullValue())); Workspace workspace = session().getWorkspace(); org.modeshape.jcr.api.nodetype.NodeTypeManager ntMgr = (org.modeshape.jcr.api.nodetype.NodeTypeManager)workspace.getNodeTypeManager(); ntMgr.registerNodeTypes(stream, true); }