List of usage examples for com.mongodb MongoClient getWriteConcern
public WriteConcern getWriteConcern()
From source file:com.edgytech.umongo.MongoPanel.java
License:Apache License
@Override protected void updateComponentCustom(JPanel old) { try {//ww w . j ava2 s .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;/*from ww w . j a v a2 s . com*/ } mongo.setOptions(od.getQueryOptions()); mongo.setWriteConcern(od.getWriteConcern()); mongo.setReadPreference(od.getReadPreference()); refresh(); }