Package org.exist.backup

Examples of org.exist.backup.BackupDescriptor


        } catch(final XMLDBException xe) {
            throw new RuntimeException(xe.getMessage(), xe);
        }
       
        //parse the sub-collection descriptor and restore
        final BackupDescriptor subDescriptor = descriptor.getChildBackupDescriptor(name);
        if(subDescriptor != null) {
           
            final SAXParser sax;
            try {
                sax = saxFactory.newSAXParser();
           
                final XMLReader reader = sax.getXMLReader();

                final EXistInputSource is = subDescriptor.getInputSource();
                is.setEncoding( "UTF-8" );

                final RestoreHandler handler = new RestoreHandler(listener, dbBaseUri, dbUsername, dbPassword, subDescriptor);

                reader.setContentHandler(handler);
                reader.parse(is);
            } catch(final ParserConfigurationException pce) {
                listener.error("Could not initalise SAXParser for processing sub-collection: " + descriptor.getSymbolicPath(name, false));
            } catch(final IOException ioe) {
                listener.error("Could not read sub-collection for processing: " + ioe.getMessage());
            } catch(final SAXException se) {
                listener.error("SAX exception while reading sub-collection " + subDescriptor.getSymbolicPath() + " for processing: " + se.getMessage());
            }
        } else {
            listener.error("Collection " + descriptor.getSymbolicPath(name, false) + " does not exist or is not readable.");
        }
    }
View Full Code Here


                for( int i = 0; i < files.length; i++ ) {
                    matcher.reset( files[i].getName() );

                    if( matcher.matches() ) {
                        BackupDescriptor descriptor;

                        try {

                            if( files[i].getName().endsWith( ".zip" ) ) {
                                descriptor = new ZipArchiveBackupDescriptor( files[i] );
                            } else {
                              final File descriptorFile = new File(new File(files[i], "db"), BackupDescriptor.COLLECTION_DESCRIPTOR);
                                descriptor = new FileSystemBackupDescriptor( descriptorFile );
                            }
                            final Properties properties = descriptor.getProperties();

                            if( properties != null ) {
                                final AttributesImpl attrs = new AttributesImpl();
                                attrs.addAttribute( "", "file", "file", "CDATA", files[i].getName() );
                                builder.startElement( BACKUP_ELEMENT, attrs );
View Full Code Here

        //exclude /db/system collection and sub-collections, as these have already been restored
//        if ((currentCollection.getURI().startsWith(XmldbURI.SYSTEM)))
//            return;
       
        //parse the sub-collection descriptor and restore
        final BackupDescriptor subDescriptor = descriptor.getChildBackupDescriptor(name);
        if(subDescriptor != null) {
           
            final SAXParser sax;
            try {
                sax = saxFactory.newSAXParser();
           
                final XMLReader reader = sax.getXMLReader();

                final EXistInputSource is = subDescriptor.getInputSource();
                is.setEncoding( "UTF-8" );

                final SystemImportHandler handler = new SystemImportHandler(broker, listener, dbBaseUri, subDescriptor);

                reader.setContentHandler(handler);
View Full Code Here

TOP

Related Classes of org.exist.backup.BackupDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.