jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas " <nto...@gmail.com>
Subject Re: Refactoring of the backupTool
Date Thu, 31 Aug 2006 19:43:37 GMT
Sure, I have attached the relevant classes. Please keep in mind, they are
not over yet (but working). A few items need still to be implemented.

Please find below the relevant part of VersionManagerImpl:

Thanks
Nico

 public void importVersions(InputStream in, HierarchyManager hierMgr,
NamespaceResolver nsResolver, NamespaceRegistryImpl nsRegistry) throws
IOException, RepositoryException {


        UpdatableItemStateManager upMgr = new
NodeVersionHistoriesUpdatableStateManager(sharedStateMgr, pMgr);
        BatchedItemOperations itemOps = new
RestoreBatchedItemOperations(upMgr, ntReg, hierMgr, nsResolver);
        Importer importer = new SysViewImporter(VERSION_STORAGE_PATH,
hierMgr, ntReg, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING,
itemOps);
        ImportHandler handler = new ImportHandler(importer, nsResolver,
nsRegistry);

        try {

        XMLReader parser =
            XMLReaderFactory.createXMLReader("
org.apache.xerces.parsers.SAXParser");
        parser.setContentHandler(handler);
        parser.setErrorHandler(handler);
        // being paranoid...
        parser.setFeature("http://xml.org/sax/features/namespaces", true);
        parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
                false);
        parser.parse(new InputSource(in));
    } catch (SAXException se) {
        // check for wrapped repository exception
        Exception e = se.getException();
        if (e != null && e instanceof RepositoryException) {
            throw (RepositoryException) e;
        } else {
            String msg = "failed to parse XML stream";
            throw new InvalidSerializedDataException(msg, se);
        }
    }

    }

Mime
View raw message