From: Wolfgang M. M. <wol...@us...> - 2004-07-05 20:02:56
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25405/src/org/exist/xmldb Modified Files: LocalCollectionManagementService.java CollectionManagementServiceImpl.java Log Message: Fixed concurrency issue in the dom.dbx node store: in some cases, a reading thread could interfere with a writing thread. As a result, some data pages got lost. Index: LocalCollectionManagementService.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/LocalCollectionManagementService.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** LocalCollectionManagementService.java 2 Jul 2004 16:53:53 -0000 1.12 --- LocalCollectionManagementService.java 5 Jul 2004 20:02:47 -0000 1.13 *************** *** 224,227 **** --- 224,261 ---- } + /* (non-Javadoc) + * @see org.exist.xmldb.CollectionManagementServiceImpl#copy(java.lang.String, java.lang.String, java.lang.String) + */ + public void copy(String collectionPath, String destinationPath, String newName) + throws XMLDBException { + if(!collectionPath.startsWith("/db")) + collectionPath = parent.getPath() + '/' + collectionPath; + if(!destinationPath.startsWith("/db")) + destinationPath = parent.getPath() + '/' + destinationPath; + DBBroker broker = null; + try { + broker = brokerPool.get(user); + org.exist.collections.Collection collection = broker.getCollection(collectionPath); + if(collection == null) + throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection " + collectionPath + " not found"); + org.exist.collections.Collection destination = broker.getCollection(destinationPath); + if(destination == null) + throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "Collection " + destinationPath + " not found"); + broker.copyCollection(collection, destination, newName); + } catch ( EXistException e ) { + e.printStackTrace(); + throw new XMLDBException( ErrorCodes.VENDOR_ERROR, + "failed to move collection " + collectionPath, e ); + } catch ( PermissionDeniedException e ) { + throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, + e.getMessage(), e ); + } catch (LockException e) { + throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, + e.getMessage(), e ); + } finally { + brokerPool.release( broker ); + } + } + public void setCollection( Collection parent ) throws XMLDBException { this.parent = (LocalCollection) parent; Index: CollectionManagementServiceImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/CollectionManagementServiceImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CollectionManagementServiceImpl.java 21 Jun 2004 15:27:36 -0000 1.6 --- CollectionManagementServiceImpl.java 5 Jul 2004 20:02:48 -0000 1.7 *************** *** 45,47 **** --- 45,50 ---- public void copyResource(String resourcePath, String destinationPath, String newName) throws XMLDBException; + + public void copy(String collection, String destination, String newName) + throws XMLDBException; } |