Package com.github.couchapptakeout.events

Examples of com.github.couchapptakeout.events.LoadingMessage


            int totalSteps = 3;

            if (haveToInstallCouch) {
                step++;
                totalSteps = 4; // one extra step
                EventBus.publish(new LoadingMessage(step++, totalSteps, "Installing DB...", 0, 0, "Starting..." ));
                localCouchManager.installCouchDbEmbedded();

            }

            couchDbInstance = localCouchManager.getCouchInstance();
            CouchDbConnector db = localCouchManager.getCouchConnector(localDbName, couchDbInstance);
            try {
                db.createDatabaseIfNotExists();
            catch (org.ektorp.DbAccessException dae) {
                // we need to login to the db
                promptForCredientials(true);
                localCouchManager.setCredentials(local_username, local_password);
                couchDbInstance = localCouchManager.getCouchInstance();
                db = localCouchManager.getCouchConnector(localDbName, couchDbInstance);
                db.createDatabaseIfNotExists();
            }


            // handle design docs very differently.
            EventBus.publish(new LoadingMessage(step++, totalSteps, "Downloading Data", 0, 0, "Copy data from " + getSrcReplicationUrl(false) ));
            copyDesignDocs(getSrcConnector(), db);

            // init one time replicate   
            setupReplication(couchDbInstance, db);



            EventBus.publish(new LoadingMessage(totalSteps, totalSteps, "Downloading Data", 4, 4, "Complete!"));
           
            return db;
    }
View Full Code Here


                dest.create(design);

                for (Iterator<String> i = attachments.getFieldNames(); i.hasNext(); ) {
                    String attachmentName = i.next();
                   
                    EventBus.publish(new LoadingMessage(0, 0, "Downloading Data", currentAttachment++, totalAttachments, "Copy data from " + cachedUrl ));
                    System.out.println("Copy attachment  " + currentAttachment  +   " : " + attachmentName);
                    AttachmentInputStream in = src.getAttachment(row.getId(), attachmentName);

                    String rev = dest.createAttachment(row.getId(), design.get("_rev").getTextValue() , in);
                    try {
View Full Code Here

    @Override
    public void run() {
         try {
            EventBus.subscribeStrongly(ExitApplicationMessage.class, this);
            Logger.getLogger(CouchRunner.class.getName()).log(Level.INFO, "Starting couch.");
            EventBus.publish(new LoadingMessage(-1, -1, null, 0, 0, "Starting Database" ));

            if (couchProcess != null) {
                couchProcess.destroy();
            }
View Full Code Here

        FileDownloader downloader = new FileDownloader(source, dest);
        new Thread(downloader).start();

        while(downloader.getStatus() == FileDownloader.DOWNLOADING ) {
            if (cancel) downloader.cancel();
            EventBus.publish(new LoadingMessage(-1, -1, null, (int)downloader.getProgress(), 100, "Downloading..." ));
            Thread.sleep(1000);
        }
        return dest;
    }
View Full Code Here

TOP

Related Classes of com.github.couchapptakeout.events.LoadingMessage

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.