Examples of JSONObject


Examples of com.netflix.paas.json.JsonObject

    @POST
    @Path("{db}/{table}")
    @Consumes(MediaType.TEXT_PLAIN)
    public void updateRow(@PathParam("db") String db,
            @PathParam("table") String table, String rowObject) {
        metadao.writeRow(db, table, new JsonObject(rowObject));
        // TODO Auto-generated method stub
    }
View Full Code Here

Examples of com.netflix.staash.json.JsonObject

        StaashTestHelper.createTestTable(metasvc,tblpay);
        System.out.println("Done:");
  }
  @Test
  public void testTableWriteRead() {
    datasvc.writeRow(db, table, new JsonObject(insertPay1));
    datasvc.writeRow(db, table, new JsonObject(insertPay2));
        readRows();
  }
View Full Code Here

Examples of com.newrelic.org.json.simple.JSONObject

    long begin = System.currentTimeMillis();
    operations.getAndIncrement();
    try {
      if (debug)
        System.out.println(msg.toString());
      JSONObject json = (JSONObject)new JSONParser().parse(msg.toString());
             
      JSONObject timespent = (JSONObject) json.get("timespent");
      int calls = json.containsKey("calls") ? ((Long)json.get("calls")).intValue() : 1;
     
      if(timespent != null){
        String pathTmp = json.containsKey("path") ? (String)json.get("path") : "-";
        String path = !pathTmp.startsWith("/") ? "/"+pathTmp: pathTmp;
        String method = json.containsKey("httpMethod") ? (String)json.get("httpMethod") : "-";
        long status = json.containsKey("httpStatus") ? (Long)json.get("httpStatus") : 999;
        long totaltime = 0;
 
        for (Object key : timespent.keySet()) {
          Object timeObj = timespent.get(key);
          Long time = 0L;
         
          if (timeObj instanceof Double) {
            time = (long) (((Double) timeObj)*1000);         
          } else if (timeObj instanceof Long) {
            Long t = (Long)timeObj;
            //si el numero es muy grande, entonces asume que el time esta en epoch y es el tiempo de inicio del request.
            if (t > 1000000000) {
              time = begin - (t/1000);
            } else {
              time = t;
            }
          } else if (timeObj instanceof String) {
            try {
              synchronized (sdf) {
                Date requestTime = sdf.parse((String) timeObj);
                time = begin - requestTime.getTime();
              }
            } catch (ParseException e) {
              reportParserError(msg.toString(), e);
              return;
            }       
          }
         
          totaltime += time;
          for (int i = 0; i < calls; i++) {
            if ("WEB_TRANSACTION_EXTERNAL_ALL".equals(key) || "External/allWeb".equals(key)) {
              StatsEngine.getResponseTimeStats("External/allWeb").recordResponseTime(time);             
            } else if ("URI_WEB_TRANSACTION".equals(key) || "WebTransaction/Uri".equals(key)) {
              StatsEngine.getResponseTimeStats("WebTransaction/Uri"+ path).recordResponseTime(time);         
              StatsEngine.getApdexStats(MetricSpec.lookup(MetricNames.APDEX + "/Uri" + path)).recordApdexResponseTime(time);
            } else {
              StatsEngine.getResponseTimeStats((String)key).recordResponseTime(time);
            }
          }
        }
       
        for (int i = 0; i < calls; i++) {
          StatsEngine.getResponseTimeStats(MetricSpec.DISPATCHER).recordResponseTime(totaltime);
          StatsEngine.getApdexStats(MetricSpec.APDEX).recordApdexResponseTime(totaltime);
        }
         
        boolean failed = ((status < 200) || (status > 399));
        if (failed) {
          for (int i = 0; i < calls; i++) {
            reportAppError(json, status, path, msg.toString());
          }
        }
      }
       
        JSONArray customMetrics = (JSONArray) json.get("custom_metric");
      if (customMetrics != null) {
        for (Object key : customMetrics) {
          JSONObject metric = (JSONObject)key;
             
          String name = (String) metric.get("name");
          String type = (String) metric.get("type");
          Object value = metric.get("value");
          if (type.equals("counter")) {
            if (value instanceof Double) {
              StatsEngine.getStats("/Custom/"+name).incrementCallCount(((Double)value).intValue()*calls);         
            } else if (value instanceof Long) {
              StatsEngine.getStats("/Custom/"+name).incrementCallCount(((Long)value).intValue()*calls);
 
View Full Code Here

Examples of com.oltpbenchmark.util.json.JSONObject

     * testFromJSON
     */
    public void testFromJSON() throws Exception {
        String json = h.toJSONString();
        assertNotNull(json);
        JSONObject jsonObject = new JSONObject(json);
        System.err.println(jsonObject.toString(1));
       
        Histogram<Integer> copy = new Histogram<Integer>();
        copy.fromJSON(jsonObject);
        assertEquals(h.getValueCount(), copy.getValueCount());
        for (Histogram.Members element : Histogram.Members.values()) {
View Full Code Here

Examples of com.persiste.sdk.json.JSONObject

      token = new Yytoken(Yytoken.TYPE_EOF, null);
  }
 
  private Map createObjectContainer(ContainerFactory containerFactory){
    if(containerFactory == null)
      return new JSONObject();
    Map m = containerFactory.createObjectContainer();
   
    if(m == null)
      return new JSONObject();
    return m;
  }
View Full Code Here

Examples of com.qq.open.common.json.JSONObject

   */
  private WeiBoDelResultBean jsonToBean(String jsonData) throws JSONException {
   
    WeiBoDelResultBean resultBean = new WeiBoDelResultBean();
   
    JSONObject jsonObjRoot;
    try {
      jsonObjRoot = new JSONObject(jsonData);
     
      // 接口返回错误的场合
      if (jsonObjRoot.getInt("ret") != 0) {
        // 设置错误标识为真
        resultBean.setErrorFlg(true);
        // 设置错误编号
        resultBean.setErrorCode(jsonObjRoot.get("errcode").toString());
        // 设置错误内容
        resultBean.setErrorMes(jsonObjRoot.getString("msg"));
      }
    } catch (JSONException e) {
      e.printStackTrace();
      // 日志
      log.error("delT 异常,json数据是:" + jsonData);
View Full Code Here

Examples of com.restartle.json.JsonObject

    IOUtil.writeStringToFile(sb.toString(), file);
  }

  @SuppressWarnings("unused")
  private void analyze(String url) {
    JsonObject rawJson = fetchAndParse(url);
   
    Dumper dumper = Dumper.stdout();
    analyze(dumper, rawJson);
  }
View Full Code Here

Examples of com.restfb.json.JsonObject

    List<T> data = new ArrayList<T>();

    if (json == null)
      throw new FacebookJsonMappingException("You must supply non-null connection JSON.");

    JsonObject jsonObject = null;

    try {
      jsonObject = new JsonObject(json);
    } catch (JsonException e) {
      throw new FacebookJsonMappingException("The connection JSON you provided was invalid: " + json, e);
    }

    // Pull out data
    JsonArray jsonData = jsonObject.getJsonArray("data");
    for (int i = 0; i < jsonData.length(); i++)
      data.add(connectionType.equals(JsonObject.class) ? (T) jsonData.get(i) : facebookClient.getJsonMapper()
        .toJavaObject(jsonData.get(i).toString(), connectionType));

    // Pull out paging info, if present
    if (jsonObject.has("paging")) {
      JsonObject jsonPaging = jsonObject.getJsonObject("paging");
      previousPageUrl = jsonPaging.has("previous") ? jsonPaging.getString("previous") : null;
      nextPageUrl = jsonPaging.has("next") ? jsonPaging.getString("next") : null;
      if (null != previousPageUrl && previousPageUrl.startsWith("http://")) {
        previousPageUrl = previousPageUrl.replaceFirst("http://", "https://");
      }
      if (null != nextPageUrl && nextPageUrl.startsWith("http://")) {
        nextPageUrl = nextPageUrl.replaceFirst("http://", "https://");
View Full Code Here

Examples of com.sdicons.json.model.JSONObject

     * @see de.netseeker.ejoe.adapter.SerializeAdapter#read(java.io.InputStream)
     */
    public Object read( InputStream in ) throws Exception
    {
        JSONParser parser = new JSONParser( in );
        JSONObject jObj = (JSONObject) parser.nextValue();
        Marshall marshaller = new JSONMarshall();
        return marshaller.unmarshall( jObj ).getReference();
    }
View Full Code Here

Examples of com.serotonin.json.type.JsonObject

      throws JsonException {
    Integer value = readDataType(jsonObject, DataTypes.IMAGE);
    if (value != null)
      dataTypeId = value;

    JsonObject ctjson = jsonObject.getJsonObject("changeType");
    if (ctjson == null)
      throw new TranslatableJsonException("emport.error.missingObject",
          "changeType");

    String text = ctjson.getString("type");
    if (text == null)
      throw new TranslatableJsonException("emport.error.missing", "type",
          ChangeTypeVO.CHANGE_TYPE_CODES.getCodeList());

    changeTypeId = ChangeTypeVO.CHANGE_TYPE_CODES.getId(text);
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.