@Test public void shouldAllowImportXml() throws Exception { String inputData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<sv:node xmlns:jcr=\"http: + "xmlns:sv=\"http: + "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\">" + "<sv:value>nt:unstructured</sv:value></sv:property></sv:node>"; workspace.importXML("/", new ByteArrayInputStream(inputData.getBytes()), 0); }
@Override public void importXML( String parentAbsPath, InputStream in, int uuidBehavior ) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(parentAbsPath, "parentAbsPath"); CheckArg.isNotNull(in, "in"); session.checkLive(); boolean error = false; try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(getImportContentHandler(parentAbsPath, uuidBehavior)); parser.parse(new InputSource(in)); } catch (EnclosingSAXException ese) { Exception cause = ese.getException(); if (cause instanceof RepositoryException) { throw (RepositoryException)cause; } throw new RepositoryException(cause); } catch (SAXParseException se) { error = true; throw new InvalidSerializedDataException(se); } catch (SAXException se) { error = true; throw new RepositoryException(se); } finally { try { in.close(); } catch (IOException t) { if (!error) throw t; } catch (RuntimeException re) { if (!error) throw re; } } }
JcrWorkspace implements org.modeshape.jcr.api.Workspace { @Override public void importXML( String parentAbsPath, InputStream in, int uuidBehavior ) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(parentAbsPath, "parentAbsPath"); CheckArg.isNotNull(in, "in"); session.checkLive(); boolean error = false; try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(getImportContentHandler(parentAbsPath, uuidBehavior)); parser.parse(new InputSource(in)); } catch (EnclosingSAXException ese) { Exception cause = ese.getException(); if (cause instanceof RepositoryException) { throw (RepositoryException)cause; } throw new RepositoryException(cause); } catch (SAXParseException se) { error = true; throw new InvalidSerializedDataException(se); } catch (SAXException se) { error = true; throw new RepositoryException(se); } finally { try { in.close(); } catch (IOException t) { if (!error) throw t; } catch (RuntimeException re) { if (!error) throw re; } } } }
JcrWorkspace implements org.modeshape.jcr.api.Workspace { @Override public void importXML( String parentAbsPath, InputStream in, int uuidBehavior ) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(parentAbsPath, "parentAbsPath"); CheckArg.isNotNull(in, "in"); session.checkLive(); boolean error = false; try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(getImportContentHandler(parentAbsPath, uuidBehavior)); parser.parse(new InputSource(in)); } catch (EnclosingSAXException ese) { Exception cause = ese.getException(); if (cause instanceof RepositoryException) { throw (RepositoryException)cause; } throw new RepositoryException(cause); } catch (SAXParseException se) { error = true; throw new InvalidSerializedDataException(se); } catch (SAXException se) { error = true; throw new RepositoryException(se); } finally { try { in.close(); } catch (IOException t) { if (!error) throw t; } catch (RuntimeException re) { if (!error) throw re; } } } JcrWorkspace( JcrSession session,
                  String workspaceName ); }
JcrWorkspace implements org.modeshape.jcr.api.Workspace { @Override public void importXML( String parentAbsPath, InputStream in, int uuidBehavior ) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(parentAbsPath, "parentAbsPath"); CheckArg.isNotNull(in, "in"); session.checkLive(); boolean error = false; try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(getImportContentHandler(parentAbsPath, uuidBehavior)); parser.parse(new InputSource(in)); } catch (EnclosingSAXException ese) { Exception cause = ese.getException(); if (cause instanceof RepositoryException) { throw (RepositoryException)cause; } throw new RepositoryException(cause); } catch (SAXParseException se) { error = true; throw new InvalidSerializedDataException(se); } catch (SAXException se) { error = true; throw new RepositoryException(se); } finally { try { in.close(); } catch (IOException t) { if (!error) throw t; } catch (RuntimeException re) { if (!error) throw re; } } } JcrWorkspace( JcrSession session,
                  String workspaceName ); @Override final JcrSession getSession(); @Override final String getName(); @Override void copy( String srcAbsPath,
                      String destAbsPath ); @Override void copy( String srcWorkspace,
                      String srcAbsPath,
                      String destAbsPath ); @Override void clone( String srcWorkspace,
                       String srcAbsPath,
                       String destAbsPath,
                       boolean removeExisting ); @Override void move( String srcAbsPath,
                      String destAbsPath ); @Override @SuppressWarnings("deprecation") void restore( Version[] versions,
                         boolean removeExisting ); @Override JcrLockManager getLockManager(); @Override JcrQueryManager getQueryManager(); @Override javax.jcr.NamespaceRegistry getNamespaceRegistry(); @Override IndexManager getIndexManager(); @Override JcrNodeTypeManager getNodeTypeManager(); @Override ObservationManager getObservationManager(); @Override JcrVersionManager getVersionManager(); @Override JcrRepositoryManager getRepositoryManager(); @Override ContentHandler getImportContentHandler( String parentAbsPath,
                                                   int uuidBehavior ); @Override void importXML( String parentAbsPath,
                           InputStream in,
                           int uuidBehavior ); @Override String[] getAccessibleWorkspaceNames(); @Override void createWorkspace( String name ); @Override void createWorkspace( String name,
                                 String srcWorkspace ); @Override void deleteWorkspace( String name ); @Override void reindex(); @Override void reindex( String pathStr ); @Override void reindexSince( long timestamp ); @Override Future<Boolean> reindexSinceAsync( long timestamp ); @Override Future<Boolean> reindexAsync(); @Override Future<Boolean> reindexAsync( String pathStr ); @Override FederationManager getFederationManager(); }
JcrWorkspace implements org.modeshape.jcr.api.Workspace { @Override public void importXML( String parentAbsPath, InputStream in, int uuidBehavior ) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(parentAbsPath, "parentAbsPath"); CheckArg.isNotNull(in, "in"); session.checkLive(); boolean error = false; try { XMLReader parser = XMLReaderFactory.createXMLReader(); parser.setContentHandler(getImportContentHandler(parentAbsPath, uuidBehavior)); parser.parse(new InputSource(in)); } catch (EnclosingSAXException ese) { Exception cause = ese.getException(); if (cause instanceof RepositoryException) { throw (RepositoryException)cause; } throw new RepositoryException(cause); } catch (SAXParseException se) { error = true; throw new InvalidSerializedDataException(se); } catch (SAXException se) { error = true; throw new RepositoryException(se); } finally { try { in.close(); } catch (IOException t) { if (!error) throw t; } catch (RuntimeException re) { if (!error) throw re; } } } JcrWorkspace( JcrSession session,
                  String workspaceName ); @Override final JcrSession getSession(); @Override final String getName(); @Override void copy( String srcAbsPath,
                      String destAbsPath ); @Override void copy( String srcWorkspace,
                      String srcAbsPath,
                      String destAbsPath ); @Override void clone( String srcWorkspace,
                       String srcAbsPath,
                       String destAbsPath,
                       boolean removeExisting ); @Override void move( String srcAbsPath,
                      String destAbsPath ); @Override @SuppressWarnings("deprecation") void restore( Version[] versions,
                         boolean removeExisting ); @Override JcrLockManager getLockManager(); @Override JcrQueryManager getQueryManager(); @Override javax.jcr.NamespaceRegistry getNamespaceRegistry(); @Override IndexManager getIndexManager(); @Override JcrNodeTypeManager getNodeTypeManager(); @Override ObservationManager getObservationManager(); @Override JcrVersionManager getVersionManager(); @Override JcrRepositoryManager getRepositoryManager(); @Override ContentHandler getImportContentHandler( String parentAbsPath,
                                                   int uuidBehavior ); @Override void importXML( String parentAbsPath,
                           InputStream in,
                           int uuidBehavior ); @Override String[] getAccessibleWorkspaceNames(); @Override void createWorkspace( String name ); @Override void createWorkspace( String name,
                                 String srcWorkspace ); @Override void deleteWorkspace( String name ); @Override void reindex(); @Override void reindex( String pathStr ); @Override void reindexSince( long timestamp ); @Override Future<Boolean> reindexSinceAsync( long timestamp ); @Override Future<Boolean> reindexAsync(); @Override Future<Boolean> reindexAsync( String pathStr ); @Override FederationManager getFederationManager();  }