Search in sources :

Example 1 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class GUIService method createGroupInfoCache.

private void createGroupInfoCache() {
    Map<String, Object> where = new HashMap<String, Object>();
    where.put("state", 1);
    Map<String, Object> data = new HashMap<String, Object>();
    data.put("where", where);
    String dataStr = JSONHelper.toString(data);
    Map<String, Object> jsonRequest = new HashMap<String, Object>();
    jsonRequest.put("type", "query");
    jsonRequest.put("data", dataStr);
    HashMap<String, String> dbInfo = new HashMap<String, String>();
    dbInfo.put("dataStoreName", "AppHub.group");
    dbInfo.put("conllectionName", "uav_groupinfo");
    UAVHttpMessage request = new UAVHttpMessage();
    request.putRequest("mrd.data", JSONHelper.toString(jsonRequest));
    request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
    request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
    String jsonStr = JSONHelper.toString(request);
    byte[] datab = null;
    try {
        datab = jsonStr.getBytes("utf-8");
    } catch (Exception e) {
        logger.err(this, "GUIService createGroupInfoCache \n" + e.getMessage());
        throw new ApphubException(e);
    }
    logger.info(this, "GUIService createGroupInfoCache");
    GroupCacheCallBack groupCacheCb = new GroupCacheCallBack();
    doHttpPost("uav.app.manage.apphubmanager.http.addr", "/ah/group", datab, "application/json", "utf-8", groupCacheCb);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ApphubException(com.creditease.uav.exception.ApphubException) UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage) ApphubException(com.creditease.uav.exception.ApphubException) IOException(java.io.IOException)

Example 2 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class GUIService method createAppInfoCache.

private void createAppInfoCache() {
    Map<String, Object> where = new HashMap<String, Object>();
    where.put("state", 1);
    Map<String, Object> data = new HashMap<String, Object>();
    data.put("where", where);
    String dataStr = JSONHelper.toString(data);
    Map<String, Object> jsonRequest = new HashMap<String, Object>();
    jsonRequest.put("type", "query");
    jsonRequest.put("data", dataStr);
    HashMap<String, String> dbInfo = new HashMap<String, String>();
    dbInfo.put("dataStoreName", "AppHub.app");
    dbInfo.put("conllectionName", "uav_appinfo");
    UAVHttpMessage request = new UAVHttpMessage();
    request.putRequest("mrd.data", JSONHelper.toString(jsonRequest));
    request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
    request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
    String jsonStr = JSONHelper.toString(request);
    byte[] datab = null;
    try {
        datab = jsonStr.getBytes("utf-8");
    } catch (Exception e) {
        logger.err(this, "GUIService createAppInfoCache \n" + e.getMessage());
        throw new ApphubException(e);
    }
    logger.info(this, "GUIService createAppInfoCache");
    AppCacheCallBack appCacheCb = new AppCacheCallBack();
    doHttpPost("uav.app.manage.apphubmanager.http.addr", "/ah/app", datab, "application/json", "utf-8", appCacheCb);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ApphubException(com.creditease.uav.exception.ApphubException) UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage) ApphubException(com.creditease.uav.exception.ApphubException) IOException(java.io.IOException)

Example 3 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class ManageRestService method getRequestData.

// tools begin---------------------------------------------------------->
/**
 * 打包请求数据
 *
 * @param type
 * @param mapParam
 * @return
 */
private byte[] getRequestData(String type, Map<String, Object> mapParam) {
    Map<String, String> dbInfo = getDBInfo(type);
    UAVHttpMessage request = new UAVHttpMessage();
    request.putRequest("mrd.data", JSONHelper.toString(mapParam));
    request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
    request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
    String jsonStr = JSONHelper.toString(request);
    byte[] datab = null;
    try {
        datab = jsonStr.getBytes("utf-8");
    } catch (Exception e) {
        logger.err(this, "ManageBaseRestService getRequestData \n" + e.getMessage());
        throw new ApphubException(e);
    }
    return datab;
}
Also used : ApphubException(com.creditease.uav.exception.ApphubException) UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage) ApphubException(com.creditease.uav.exception.ApphubException)

Example 4 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class AppHubInit method run.

public void run() {
    try {
        initCheckApp("1000000001", prefixUavApp + "comptest");
        initCheckApp("1000000002", prefixUavApp + "godeye");
        initCheckApp("1000000003", prefixUavApp + "manage");
        initCheckApp("1538364490", prefixUavApp + "baseclassmgt");
        initCheckApp("2097707360", prefixUavApp + "godcompass");
        initCheckApp("4051451871", prefixUavApp + "betatest");
        initCheckApp("2094373133", prefixUavApp + "godfilter");
        initCheckGroup("uav_admin");
        initCheckGroup("vipgroup");
    } catch (Exception e) {
        logger.err(this, "AppHubInit RUN FAIL: ", e);
        throw new ApphubException(e);
    }
}
Also used : ApphubException(com.creditease.uav.exception.ApphubException) ApphubException(com.creditease.uav.exception.ApphubException)

Example 5 with ApphubException

use of com.creditease.uav.exception.ApphubException in project uavstack by uavorg.

the class AppHubInit method getRequestData.

protected byte[] getRequestData(String type, Map<String, Object> mapParam) {
    Map<String, String> dbInfo = getDBInfo(type);
    UAVHttpMessage request = new UAVHttpMessage();
    request.putRequest("mrd.data", JSONHelper.toString(mapParam));
    request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
    request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
    String jsonStr = JSONHelper.toString(request);
    byte[] datab = null;
    try {
        datab = jsonStr.getBytes("utf8");
    } catch (Exception e) {
        logger.err(this, "ManageBaseRestService getRequestData " + e.getMessage());
        throw new ApphubException(e);
    }
    return datab;
}
Also used : ApphubException(com.creditease.uav.exception.ApphubException) UAVHttpMessage(com.creditease.agent.http.api.UAVHttpMessage) ApphubException(com.creditease.uav.exception.ApphubException)

Aggregations

ApphubException (com.creditease.uav.exception.ApphubException)9 UAVHttpMessage (com.creditease.agent.http.api.UAVHttpMessage)4 HashMap (java.util.HashMap)4 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 HttpClientCallbackResult (com.creditease.uav.httpasync.HttpClientCallbackResult)1 Map (java.util.Map)1 AuthenticationException (javax.naming.AuthenticationException)1 NamingEnumeration (javax.naming.NamingEnumeration)1 NamingException (javax.naming.NamingException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1