Package org.json.simple

Examples of org.json.simple.JSONObject.keySet()


        JSONObject counters = (JSONObject) result.get("counters");

        writer.print("<table><tr><td>Number of counters:</td><td>" + counters.size() + "</td></tr></table>");
       
        @SuppressWarnings("unchecked")
        List<String> sortedKeys = new ArrayList<String>(counters.keySet());
        Collections.sort(sortedKeys);
       
        for (Object counterKey : sortedKeys) {
          String counterName = (String) counterKey;
          JSONObject json = (JSONObject) counters.get(counterName);
View Full Code Here


          JSONObject json = (JSONObject) counters.get(counterName);
         
          if (!json.isEmpty()) {
            writer.print("<table><thead><th colspan=\"3\">" + counterName + "</th></thead><tbody>");
           
            for (Object key : json.keySet()) {
              writer.print("<tr><td>");
              writer.print(key);
              writer.print("</td><td style=\"border-left: 1px solid grey; border-right: 1px solid grey;\">");
              writer.print(new Date((Long) key * 1000).toString()); //modify the dates back to include milliseconds
              writer.print("</td><td>");
View Full Code Here

        try{
            File file = new File(loc);
            String s = new Scanner(file).useDelimiter("//Z").next();
            JSONObject json = (JSONObject) new JSONParser().parse(s);

            for(Object k : json.keySet()){
                String key = (String) k;
                Object value = json.get(k);
                switch (key) {
                    case "width":
                        map_width = Integer.parseInt(value.toString());
View Full Code Here

           
            SSTableWriter writer = new SSTableWriter(ssTablePath, json.size());
            SortedMap<DecoratedKey,String> decoratedKeys = new TreeMap<DecoratedKey,String>();
           
            // sort by dk representation, but hold onto the hex version
            for (String key : (Set<String>)json.keySet())
                decoratedKeys.put(partitioner.decorateKey(ByteBuffer.wrap(hexToBytes(key))), key);

            for (Map.Entry<DecoratedKey, String> rowKey : decoratedKeys.entrySet())
            {
                if (cfType == ColumnFamilyType.Super)
View Full Code Here

    if (applications == null) {
      // Lost cause: No applications found.
      System.err.println("No mupd8:application found; Config.workerJSONs not set.");
      return performers;
    }
    Set<?> applicationNames = applications.keySet();
    if (applicationNames.size() != 1) {
      System.err.println("Exactly one application definition expected, but got "+Integer.toString(applicationNames.size())+" instead; Config.workerJSONs not set.");
      return performers;
    }
    String applicationName = applicationNames.toArray(new String[]{})[0];
View Full Code Here

      return performers;
    }
    String applicationName = applicationNames.toArray(new String[]{})[0];
    JSONObject performerSection = (JSONObject) getScopedValue(applications, new String[] { applicationName, "performers" });

    for (Object k : performerSection.keySet()) {
      String key = (String) k;
      performers.put(key, (JSONObject) performerSection.get(key));
    }

    return performers;
View Full Code Here

        ObjectName mBean = getRequest().getObjectName();
        if (mBean.isPattern()) {
            // The result value contains the list of fetched object names
            JSONObject values = getValue();
            Set<ObjectName> ret = new HashSet<ObjectName>();
            for (Object name : values.keySet()) {
                ret.add(new ObjectName((String) name));
            }
            return ret;
        } else {
            return Arrays.asList(mBean);
View Full Code Here

    public Collection<String> getAttributes(ObjectName pObjectName) {
        ObjectName requestMBean = getRequest().getObjectName();
        if (requestMBean.isPattern()) {
            // We need to got down one level in the returned values
            JSONObject attributes = getAttributesForObjectNameWithPatternRequest(pObjectName);
            return attributes.keySet();
        } else {
            if (pObjectName != null && !pObjectName.equals(requestMBean)) {
                throw new IllegalArgumentException("Given ObjectName " + pObjectName + " doesn't match with" +
                        " the single ObjectName " + requestMBean + " given in the request");
            }
View Full Code Here

        if (request.hasSingleAttribute()) {
            // Contains only a single attribute:
            return request.getAttributes();
        } else {
            JSONObject attributes = getValue();
            return attributes.keySet();
        }
    }

    /**
     * Get the value for a certain MBean and a given attribute. This method is especially
View Full Code Here

           
            SSTableWriter writer = new SSTableWriter(ssTablePath, json.size());
            SortedMap<DecoratedKey,String> decoratedKeys = new TreeMap<DecoratedKey,String>();
           
            // sort by dk representation, but hold onto the hex version
            for (String key : (Set<String>)json.keySet())
                decoratedKeys.put(partitioner.decorateKey(ByteBuffer.wrap(hexToBytes(key))), key);

            for (Map.Entry<DecoratedKey, String> rowKey : decoratedKeys.entrySet())
            {
                if (cfType == ColumnFamilyType.Super)
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.