Example usage for com.mongodb MongoClient getOptions

List of usage examples for com.mongodb MongoClient getOptions

Introduction

In this page you can find the example usage for com.mongodb MongoClient getOptions.

Prototype

@Deprecated
public int getOptions() 

Source Link

Document

Gets the default query options for reads operations executed on any DBCollection created indirectly from this instance, via a DB instance created from #getDB(String) .

Usage

From source file:com.edgytech.umongo.MongoPanel.java

License:Apache License

@Override
protected void updateComponentCustom(JPanel old) {
    try {/*from w  ww  .  j  a v  a 2s  .  c o m*/
        MongoClient mongo = getMongoNode().getMongoClient();
        setStringFieldValue(Item.version, mongo.getVersion());

        ServerAddress master = mongo.getAddress();
        if (master != null) {
            setStringFieldValue(Item.masterServer, getServerAddressString(master));
        }
        List<ServerAddress> addrs = mongo.getAllAddress();
        String html = "<html>";
        for (ServerAddress addr : addrs) {
            html += getServerAddressString(addr) + "<br/>";
        }
        html += "</html>";
        setStringFieldValue(Item.seedServers, html);

        addrs = mongo.getServerAddressList();
        html = "<html>";
        for (ServerAddress addr : addrs) {
            //                String ports = MongoUtils.makeInfoString("used", mongo.getConnector().getDBPortPool(addr).inUse(),
            //                        "available", mongo.getConnector().getDBPortPool(addr).available(),
            //                        "created", mongo.getConnector().getDBPortPool(addr).everCreated());
            String txt = getServerAddressString(addr);
            html += txt + "<br/>";
        }
        setStringFieldValue(Item.activeServers, html);

        setStringFieldValue(Item.queryOptions, MongoUtils.queryOptionsToString(mongo.getOptions()));
        ((DocField) getBoundUnit(Item.writeConcern)).setDoc(mongo.getWriteConcern().getCommand());
        ((DocField) getBoundUnit(Item.readPreference)).setDoc(mongo.getReadPreference().toDBObject());
        setStringFieldValue(Item.maxObjectSize, String.valueOf(mongo.getMaxBsonObjectSize()));
    } catch (Exception e) {
        UMongo.instance.showError(this.getClass().getSimpleName() + " update", e);
    }
}

From source file:com.edgytech.umongo.MongoPanel.java

License:Apache License

public void readWriteOptions(ButtonBase button) {
    MongoClient mongo = getMongoNode().getMongoClient();
    OptionDialog od = UMongo.instance.getGlobalStore().getOptionDialog();
    od.update(mongo.getOptions(), mongo.getWriteConcern(), mongo.getReadPreference());
    if (!od.show()) {
        return;/*  www  . j  av a2  s . c  o  m*/
    }
    mongo.setOptions(od.getQueryOptions());
    mongo.setWriteConcern(od.getWriteConcern());
    mongo.setReadPreference(od.getReadPreference());
    refresh();
}