Package org.hornetq.utils.json

Examples of org.hornetq.utils.json.JSONArray


         html.append("<tr><th colspan=\"6\">Message List</th></tr>");
         html.append("<tr><td colspan=\"6\">");
         html.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">");

         JSONArray msgs = txJson.getJSONArray(TransactionDetail.KEY_TX_RELATED_MESSAGES);
         for(int i=0; i<msgs.length(); i++)
         {           
            JSONObject msgJson = msgs.getJSONObject(i);
            JSONObject props = msgJson.getJSONObject(TransactionDetail.KEY_MSG_PROPERTIES);
            StringBuilder propstr = new StringBuilder();
            @SuppressWarnings("unchecked")
            Iterator<String> propkeys = props.keys();
            while(propkeys.hasNext())
View Full Code Here


   // Static --------------------------------------------------------

    private static String toJSON(final Map<String, Object>[] messages)
    {
        JSONArray array = toJSONMsgArray(messages);
        return array.toString();
    }
View Full Code Here

        return array.toString();
    }

    private static JSONArray toJSONMsgArray(final Map<String, Object>[] messages)
    {
        JSONArray array = new JSONArray();
        for (Map<String, Object> message : messages)
        {
            array.put(new JSONObject(message));
        }
        return array;
    }
View Full Code Here

    private static String toJSON(final  Map<String, Map<String, Object>[]> messages)
    {
        try
        {
            JSONArray arrayReturn = new JSONArray();
            for (Map.Entry<String, Map<String, Object>[]> entry: messages.entrySet())
            {
                JSONObject objectItem = new JSONObject();
                objectItem.put("consumerName", entry.getKey());
                objectItem.put("elements", toJSONMsgArray(entry.getValue()));
                arrayReturn.put(objectItem);
            }

            return arrayReturn.toString();
        }
        catch (JSONException e)
        {
            return "Invalid conversion " + e.toString();
        }
View Full Code Here

      clearIO();
      try
      {
         Collection<Consumer> consumers = queue.getConsumers();

         JSONArray jsonArray = new JSONArray();

         for (Consumer consumer : consumers)
         {

            if (consumer instanceof ServerConsumer)
            {
               ServerConsumer serverConsumer = (ServerConsumer)consumer;

               JSONObject obj = new JSONObject();
               obj.put("consumerID", serverConsumer.getID());
               obj.put("connectionID", serverConsumer.getConnectionID().toString());
               obj.put("sessionID", serverConsumer.getSessionID());
               obj.put("browseOnly", serverConsumer.isBrowseOnly());
               obj.put("creationTime", serverConsumer.getCreationTime());

               jsonArray.put(obj);
            }

         }

         return jsonArray.toString();
      }
      finally
      {
         blockOnIO();
      }
View Full Code Here

            // sort by creation time, oldest first
            return (int)(entry1.getValue() - entry2.getValue());
         }
      });

      JSONArray txDetailListJson = new JSONArray();
      for (Map.Entry<Xid, Long> entry : xidsSortedByCreationTime)
      {
         Xid xid = entry.getKey();
         Transaction tx = resourceManager.getTransaction(xid);
         if (tx == null)
         {
            continue;
         }
         TransactionDetail detail = new JMSTransactionDetail(xid, tx, entry.getValue());
         txDetailListJson.put(detail.toJSON());
      }
      return txDetailListJson.toString();
   }
View Full Code Here

         html.append("<tr><th colspan=\"6\">Message List</th></tr>");
         html.append("<tr><td colspan=\"6\">");
         html.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">");

         JSONArray msgs = txJson.getJSONArray(TransactionDetail.KEY_TX_RELATED_MESSAGES);
         for (int i = 0; i < msgs.length(); i++)
         {
            JSONObject msgJson = msgs.getJSONObject(i);
            JSONObject props = msgJson.getJSONObject(TransactionDetail.KEY_MSG_PROPERTIES);
            StringBuilder propstr = new StringBuilder();
            @SuppressWarnings("unchecked")
            Iterator<String> propkeys = props.keys();
            while (propkeys.hasNext())
View Full Code Here

            // sort by creation time, oldest first
            return (int)(entry1.getValue() - entry2.getValue());
         }
      });

      JSONArray txDetailListJson = new JSONArray();
      for (Map.Entry<Xid, Long> entry : xidsSortedByCreationTime)
      {
         Xid xid = entry.getKey();
         TransactionDetail detail = new JMSTransactionDetail(xid, resourceManager.getTransaction(xid), entry.getValue());
         txDetailListJson.put(detail.toJSON());
      }
      return txDetailListJson.toString();
   }
View Full Code Here

         html.append("<tr><th colspan=\"6\">Message List</th></tr>");
         html.append("<tr><td colspan=\"6\">");
         html.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">");

         JSONArray msgs = txJson.getJSONArray(TransactionDetail.KEY_TX_RELATED_MESSAGES);
         for (int i = 0; i < msgs.length(); i++)
         {
            JSONObject msgJson = msgs.getJSONObject(i);
            JSONObject props = msgJson.getJSONObject(TransactionDetail.KEY_MSG_PROPERTIES);
            StringBuilder propstr = new StringBuilder();
            @SuppressWarnings("unchecked")
            Iterator<String> propkeys = props.keys();
            while (propkeys.hasNext())
View Full Code Here

            // sort by creation time, oldest first
            return (int)(entry1.getValue() - entry2.getValue());
         }
      });
     
      JSONArray txDetailListJson = new JSONArray();
      for (Map.Entry<Xid, Long> entry : xidsSortedByCreationTime)
      {
         Xid xid = entry.getKey();
         TransactionDetail detail = new JMSTransactionDetail(xid,
                                                             resourceManager.getTransaction(xid),
                                                             entry.getValue());
         txDetailListJson.put(detail.toJSON());
      }
      return txDetailListJson.toString();
   }
View Full Code Here

TOP

Related Classes of org.hornetq.utils.json.JSONArray

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.