Search in sources :

Example 36 with JSONObject

use of com.alibaba.fastjson.JSONObject in project CorePage by lizhangqu.

the class CorePageManager method readConfig.

/**
 * 从配置文件中读取page
 */
public void readConfig(String content) {
    Log.d(TAG, "readConfig from json");
    JSONArray jsonArray = JSON.parseArray(content);
    Iterator<Object> iterator = jsonArray.iterator();
    JSONObject jsonPage = null;
    String pageName = null;
    String pageClazz = null;
    String pageParams = null;
    while (iterator.hasNext()) {
        jsonPage = (JSONObject) iterator.next();
        pageName = jsonPage.getString("name");
        pageClazz = jsonPage.getString("class");
        pageParams = jsonPage.getString("params");
        if (TextUtils.isEmpty(pageName) || TextUtils.isEmpty(pageClazz)) {
            Log.d(TAG, "page Name is null or pageClass is null");
            return;
        }
        mPageMap.put(pageName, new CorePage(pageName, pageClazz, pageParams));
        Log.d(TAG, "put a page:" + pageName);
    }
    Log.d(TAG, "finished read pages,page size:" + mPageMap.size());
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) JSONArray(com.alibaba.fastjson.JSONArray) JSONObject(com.alibaba.fastjson.JSONObject)

Example 37 with JSONObject

use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.

the class CpuStatModel method toJSONObject.

public JSONObject toJSONObject() {
    JSONObject obj = new JSONObject();
    obj.put(CpuEnum.CPU_RATE.name(), this.cpuRate);
    obj.put(CpuEnum.CPU_REMAIN_RATE.name(), this.cpuRemainRate);
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 38 with JSONObject

use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.

the class NetStatModel method toJSONObject.

public JSONObject toJSONObject() {
    JSONObject obj = new JSONObject();
    obj.put(NetEnum.IP_ADDRESS.name(), this.ipAddress);
    obj.put(NetEnum.R_DATA_SIZE.name(), this.rDataSize);
    obj.put(NetEnum.T_DATA_SIZE.name(), this.tDataSize);
    obj.put(NetEnum.MAX_R_SPEED.name(), this.rMaxSpeed);
    obj.put(NetEnum.MAX_T_SPEED.name(), this.tMaxSpeed);
    obj.put(NetEnum.T_SPEED.name(), this.tSpeed);
    obj.put(NetEnum.R_SPEED.name(), this.rSpeed);
    obj.put(NetEnum.SUM_COUNT.name(), this.count);
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 39 with JSONObject

use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.

the class PatitionStatModel method toJSONObject.

public JSONObject toJSONObject() {
    JSONObject obj = new JSONObject();
    obj.put(PatitionEnum.MOUNT_POINT.name(), this.mountPoint);
    obj.put(PatitionEnum.USED_SIZE.name(), this.usedSize);
    obj.put(PatitionEnum.REMAIN_SIZE.name(), this.remainSize);
    obj.put(PatitionEnum.WIRTE_DATA_SIZE.name(), this.writeDataSize);
    obj.put(PatitionEnum.READ_DATA_SIZE.name(), this.readDataSize);
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject)

Example 40 with JSONObject

use of com.alibaba.fastjson.JSONObject in project BRFS by zhangnianli.

the class ResourceModel method toJSONObject.

@Override
public JSONObject toJSONObject() {
    // TODO Auto-generated method stub
    JSONObject obj = new JSONObject();
    obj.put(ServerCommonEnum.SERVER_ID.name(), this.serverId);
    JSONObject readObj = new JSONObject();
    if (this.clientSNReadMap != null) {
        for (Map.Entry<String, Double> entry : this.clientSNReadMap.entrySet()) {
            readObj.put(entry.getKey(), entry.getValue());
        }
    }
    obj.put(SceneEnum.CLIENT_READ_REQUEST.name(), readObj);
    JSONObject writeObj = new JSONObject();
    if (this.clientSNWriteMap != null) {
        for (Map.Entry<String, Double> entry : this.clientSNWriteMap.entrySet()) {
            writeObj.put(entry.getKey(), entry.getValue());
        }
    }
    obj.put(SceneEnum.CLIENT_WRITE_REQUEST.name(), writeObj);
    obj.put(SceneEnum.CLIENT_META_REQUEST.name(), this.clientMetaRequest);
    return obj;
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1750 HashMap (java.util.HashMap)302 JSONArray (com.alibaba.fastjson.JSONArray)279 Test (org.junit.Test)217 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)182 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)165 IOException (java.io.IOException)138 ArrayList (java.util.ArrayList)125 Map (java.util.Map)111 AuthPassport (com.ngtesting.platform.util.AuthPassport)96 UserVo (com.ngtesting.platform.vo.UserVo)76 Date (java.util.Date)76 List (java.util.List)72 File (java.io.File)70 UnitResponse (info.xiancloud.core.message.UnitResponse)61 JSONException (com.alibaba.fastjson.JSONException)46 StringEntity (org.apache.http.entity.StringEntity)46 HttpResponse (org.apache.http.HttpResponse)44 Header (org.apache.http.Header)36 DefaultJSONParser (com.alibaba.fastjson.parser.DefaultJSONParser)30