Package com.mongodb

Examples of com.mongodb.BasicDBObject.keySet()


        }

        @Override
        public StringEntryIterator readStringMap(String key) throws Exception {
            final BasicDBObject childObj = (BasicDBObject) obj.get(encodeName(key));
            final Iterator<String> it = childObj.keySet().iterator();
            return new StringEntryIterator() {
                @Override
                public boolean hasNext() {
                    return it.hasNext();
                }
View Full Code Here


        }

        @Override
        public BytesEntryIterator readBytesMap(String key) throws Exception {
            final BasicDBObject childObj = (BasicDBObject) obj.get(encodeName(key));
            final Iterator<String> it = childObj.keySet().iterator();
            return new BytesEntryIterator() {
                @Override
                public boolean hasNext() {
                    return it.hasNext();
                }
View Full Code Here

                }

                sb.append("Network I/O:\n");

                BasicDBObject netIO = (BasicDBObject) payload.get("network_io");
                Set<String> nics = new TreeSet<>(netIO.keySet());
                int nicsDisplayed = 0;

                for (String key : nics) {
                    BasicDBObject nic = (BasicDBObject) netIO.get(key);
                    long packetsIn = nic.getInt("packets_in");
View Full Code Here

                  .append(payload.getString("uptime"))
                  .append("s\n")
                  .append("Disk usage:\n");

                BasicDBObject partitionsObj = (BasicDBObject) payload.get("partitions");
                Set<String> partitions = new TreeSet<>(partitionsObj.keySet());

                for (String key : partitions) {
                    BasicDBObject partition = (BasicDBObject) partitionsObj.get(key);
                    double totalAsKb = partition.getDouble("total");
View Full Code Here

                }

                sb.append("Disk I/O:\n");

                BasicDBObject diskIO = (BasicDBObject) payload.get("disk_io");
                Set<String> disks = new TreeSet<>(diskIO.keySet());

                if (disks.size() == 0) {
                    sb.append("  Unavailable\n");
                } else {
                    for (String key : disks) {
View Full Code Here

      if (1 != inputDbo.size()) {
        errorMessage.append("Invalid input format, should be 'input { INPUT_TYPE { ... } }' (only one INPUT_TYPE) and also contain a filter, no \"s around them. (1)");
        return null;
      }//TESTED
      if (!isAdmin) {
        for (String key: inputDbo.keySet()) {
          if (!_allowedInputs.contains(key.toLowerCase())) {
            errorMessage.append("Security error, non-admin not allowed input type " + key + ", allowed options: " + _allowedInputs.toString());
            return null;
          }//TESTED
        }
View Full Code Here

      return null;     
    }//TESTED (3_2d)
    else { // Check there's only one input type and (unless admin) it's one of the allowed types
      if (!isAdmin) {
        BasicDBObject filterDbo = (BasicDBObject)filter;
        for (String key: filterDbo.keySet()) {
          if (!_allowedFilters.contains(key.toLowerCase())) {
            errorMessage.append("Security error, non-admin not allowed filter type " + key + ", allowed options: " + _allowedFilters.toString());
            return null;
          }//TESTED
        }
View Full Code Here

      boolean sourceKeyQueryComplex = false;
     
      if (sourceKeyQueryTerm instanceof BasicDBObject) {
        BasicDBObject sourceKeyQueryTermDbo = (BasicDBObject) sourceKeyQueryTerm;
        if (sourceKeyQueryTermDbo.size() <= 2) { // every term must be lt/lte/gt/gte
          for (String sourceKeyQueryTermEl: sourceKeyQueryTermDbo.keySet()) {
            if (!sourceKeyQueryTermEl.equals(DbManager.in_) &&
                !sourceKeyQueryTermEl.equals(DbManager.lt_) && !sourceKeyQueryTermEl.equals(DbManager.lte_) &&
                !sourceKeyQueryTermEl.equals(DbManager.gt_) && !sourceKeyQueryTermEl.equals(DbManager.gte_))
            {
              sourceKeyQueryComplex = true;
View Full Code Here

                return db.getName();
            }

            @Override
            public String getShortName() {
                return cmd.keySet().iterator().next();
            }

        }.addJob();
    }
View Full Code Here

            //Handle the not's child
            BasicDBObject arg = (BasicDBObject) handle(expr.getArg(0));

            //Only support the first key, let's see if there
            //is cases where this will get broken
            String key = arg.keySet().iterator().next();
            Operation<?> subOperation = (Operation<?>) expr.getArg(0);
            Operator<?> subOp = subOperation.getOperator();
            if (subOp == Ops.IN) {
                return visit(OperationImpl.create(Boolean.class, Ops.NOT_IN, subOperation.getArg(0),
                        subOperation.getArg(1)), context);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.