Package com.edgytech.swingfast

Examples of com.edgytech.swingfast.FormDialog


    public void getStats(ButtonBase button) {
        new DbJobCmd(getIndexNode().getStatsCollection(), "collstats").addJob();
    }

    public void settings(ButtonBase button) {
        FormDialog dialog = (FormDialog) ((MenuItem) getBoundUnit(Item.settings)).getDialog();
        BasicDBObject index = (BasicDBObject) getIndexInfo();
        boolean isTTL = false;
        long ttl = 0;
        if (index.containsField("expireAfterSeconds")) {
            isTTL = true;
            ttl = index.getLong("expireAfterSeconds");
        }
        setLongFieldValue(Item.expireAfterSeconds, ttl);
        if (!dialog.show())
            return;
       
        long newTTL = getLongFieldValue(Item.expireAfterSeconds);
        if (newTTL != ttl) {
            BasicDBObject cmd = new BasicDBObject("collMod", getIndexNode().getCollectionNode().getCollection().getName());
View Full Code Here


        list.items = items;
        list.structureComponent();
    }

    public void addOperation(ButtonBase button) {
        FormDialog od = (FormDialog) getBoundUnit(Item.addOperationDialog);
        if (!od.show()) {
            return;
        }
        String op = getStringFieldValue(Item.operation);
        BasicDBObject opObj = editOperation(null, "$" + op);
View Full Code Here

        final DB db = router.getMongoClient().getDB("admin");
        new DbJobCmd(db, cmd, this, null).addJob();
    }

    public void removeShard(ButtonBase button) {
        FormDialog dialog = (FormDialog) ((MenuItem) getBoundUnit(Item.removeShard)).getDialog();
        ComboBox combo = (ComboBox) getBoundUnit(Item.rsShard);
        combo.value = 0;
        combo.items = getRouterNode().getShardNames();
        combo.structureComponent();

        if (!dialog.show())
            return;
       
        final BasicDBObject cmd = new BasicDBObject("removeshard", getStringFieldValue(Item.rsShard));
        final DB db = getRouterNode().getMongoClient().getDB("admin");
        new DbJobCmd(db, cmd, this, null).addJob();
View Full Code Here

    public void balancer(ButtonBase button) {
        final MongoClient mongo = getRouterNode().getMongoClient();
        final DB config = mongo.getDB("config");
        final DBCollection settings = config.getCollection("settings");

        FormDialog diag = (FormDialog) ((MenuItem)getBoundUnit(Item.balancer)).getDialog();
        diag.xmlLoadCheckpoint();
       
        final BasicDBObject query = new BasicDBObject("_id", "balancer");
        BasicDBObject balDoc = (BasicDBObject) settings.findOne(query);
        if (balDoc != null) {
            if (balDoc.containsField("stopped"))
                setIntFieldValue(Item.balStopped, balDoc.getBoolean("stopped") ? 1 : 2);
            if (balDoc.containsField("_secondaryThrottle"))
                setIntFieldValue(Item.balSecThrottle, balDoc.getBoolean("_secondaryThrottle") ? 1 : 2);
            BasicDBObject window = (BasicDBObject) balDoc.get("activeWindow");
            if (window != null) {
                setStringFieldValue(Item.balStartTime, window.getString("start"));
                setStringFieldValue(Item.balStopTime, window.getString("stop"));
            }
        }

        if (!diag.show())
            return;
       
        if (balDoc == null)
            balDoc = new BasicDBObject("_id", "balancer");
        int stopped = getIntFieldValue(Item.balStopped);
View Full Code Here

            }
            shardList.put(shard, shardObj);
        }
        result.put("shards", shardList);

        FormDialog dia = (FormDialog) getBoundUnit(Item.regenRSList);
        dia.setStringFieldValue(Item.regenRSListArea, txt);
        if (!dia.show()) {
            return;
        }

        DB config = cmongo.getDB("config");

        // add database record
        BasicDBObject doc = new BasicDBObject("_id", db);
        doc.put("partitioned", true);
        doc.put("primary", primaryShard);
        config.getCollection("databases").save(doc);

        // add collection record
        doc = new BasicDBObject("_id", ns);
        doc.put("lastmod", new Date());
        doc.put("dropped", false);
        doc.put("key", shardKey);
        doc.put("unique", unique);
        config.getCollection("collections").save(doc);

        final DBCollection chunks = config.getCollection("chunks");
        long count = chunks.count(new BasicDBObject("ns", ns));
        if (count > 0) {
            dia = (FormDialog) getBoundUnit(Item.regenDeleteChunks);
            if (dia.show()) {
                chunks.remove(new BasicDBObject("ns", ns));
            } else {
                return;
            }
        }

        // add temp collection to sort chunks with shard key
        final DBCollection tmpchunks = config.getCollection("_tmpchunks_" + col);
        tmpchunks.drop();
        // should be safe environment, and dup keys should be ignored
        tmpchunks.setWriteConcern(WriteConcern.NORMAL);
        // can use shardKey as unique _id
//        tmpchunks.ensureIndex(shardKey, "shardKey", true);

        // create filter for shard fields
        final DBObject shardKeyFilter = new BasicDBObject();
//        final DBObject shardKeyDescend = new BasicDBObject();
        boolean hasId = false;
        for (String key : shardKey.keySet()) {
            shardKeyFilter.put(key, 1);
            if (key.equals("_id")) {
                hasId = true;
            }
        }
        if (!hasId) {
            shardKeyFilter.put("_id", 0);
        }

        dia = (FormDialog) getBoundUnit(Item.regenConfirm);
        if (!dia.show()) {
            return;
        }

        // now fetch all records from each shard
        final AtomicInteger todo = new AtomicInteger(mongoToShard.size());
View Full Code Here

TOP

Related Classes of com.edgytech.swingfast.FormDialog

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.