src/main/java/org/edgegallery/appstore/application/packageupload/UploadPackageService.java
public JSONObject uploadPackage(String filePath, String packageId, String meaoId, String token, String progressId) {
        String fileName = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
        String taskName = fileName.substring(0, fileName.indexOf("."));
        JSONObject reqJson = new JSONObject();
        reqJson.put("taskName", taskName);
        reqJson.put("packageId", packageId);
        reqJson.put("meaoId", meaoId);
        reqJson.put("progressId", progressId);

        ServiceDef serviceDef = new ServiceDef();
        serviceDef.setName(taskName);
        serviceDef.setServiceType("vnfpackage");
        serviceDef.setSpecification("APP");
        serviceDef.setAction("create");
        serviceDef.setMode("normal");
        serviceDef.setFileName(fileName);
        JSONObject vnfpackageInfo = new JSONObject();
        vnfpackageInfo.put("serviceDef", serviceDef);
        reqJson.put("vnfpackageInfo", vnfpackageInfo);

        // query meao info from third party system by meaoId
        ThirdSystem meaoInfo = getMeaoInfo(meaoId, token);
        if (meaoInfo == null) {
            LOGGER.error("get meao info fail.");
            throw new AppException("get meao info fail.");
        }

        reqJson.put("vendor", meaoInfo.getVendor());
        String meaoUrl = meaoInfo.getUrl();
        LOGGER.info("meaoUrl: {}", meaoUrl);

        JSONObject session = getMeaoSession(meaoUrl, meaoInfo.getUsername(), meaoInfo.getPassword(),
            meaoInfo.getVendor());
        String csrfToken = session.getString("csrfToken");
        String cookie = session.getString("session");

        String meaoHost = meaoUrl.split("//")[1];
        return uploadHelper.uploadBigSoftware(filePath, reqJson, csrfToken, cookie, meaoHost);
    }
/**
     * uploadPackage.
     *
     * @param filePath file path
     * @return JSONObject
     */
uploadPackage.
@param filePath file path
@return JSONObject
uploadPackage . @param filePath file path @return JSONObject
public JSONObject uploadPackage(String filePath, String packageId, String meaoId, String token, String progressId) {
        String fileName = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
        String taskName = fileName.substring(0, fileName.indexOf("."));
        JSONObject reqJson = new JSONObject();
        reqJson.put("taskName", taskName);
        reqJson.put("packageId", packageId);
        reqJson.put("meaoId", meaoId);
        reqJson.put("progressId", progressId);
        ServiceDef serviceDef = new ServiceDef();
        serviceDef.setName(taskName);
        serviceDef.setServiceType("vnfpackage");
        serviceDef.setSpecification("APP");
        serviceDef.setAction("create");
        serviceDef.setMode("normal");
        serviceDef.setFileName(fileName);
        JSONObject vnfpackageInfo = new JSONObject();
        vnfpackageInfo.put("serviceDef", serviceDef);
        reqJson.put("vnfpackageInfo", vnfpackageInfo);
        ThirdSystem meaoInfo = getMeaoInfo(meaoId, token);
        if (meaoInfo == null) {
            LOGGER.error("get meao info fail.");
            throw new AppException("get meao info fail.");
        }
        reqJson.put("vendor", meaoInfo.getVendor());
        String meaoUrl = meaoInfo.getUrl();
        LOGGER.info("meaoUrl: {}", meaoUrl);
        JSONObject session = getMeaoSession(meaoUrl, meaoInfo.getUsername(), meaoInfo.getPassword(),
            meaoInfo.getVendor());
        String csrfToken = session.getString("csrfToken");
        String cookie = session.getString("session");
        String meaoHost = meaoUrl.split("//")[1];
        return uploadHelper.uploadBigSoftware(filePath, reqJson, csrfToken, cookie, meaoHost);
    }
public JSONObject uploadPackage ( String filePath , String packageId , String meaoId , String token , String progressId ) { String fileName = filePath . substring ( filePath . lastIndexOf ( File . separator ) + 1 ) ; String taskName = fileName . substring ( 0 , fileName . indexOf ( "." ) ) ; JSONObject reqJson = new JSONObject ( ) ; reqJson . put ( "taskName" , taskName ) ; reqJson . put ( "packageId" , packageId ) ; reqJson . put ( "meaoId" , meaoId ) ; reqJson . put ( "progressId" , progressId ) ; ServiceDef serviceDef = new ServiceDef ( ) ; serviceDef . setName ( taskName ) ; serviceDef . setServiceType ( "vnfpackage" ) ; serviceDef . setSpecification ( "APP" ) ; serviceDef . setAction ( "create" ) ; serviceDef . setMode ( "normal" ) ; serviceDef . setFileName ( fileName ) ; JSONObject vnfpackageInfo = new JSONObject ( ) ; vnfpackageInfo . put ( "serviceDef" , serviceDef ) ; reqJson . put ( "vnfpackageInfo" , vnfpackageInfo ) ; ThirdSystem meaoInfo = getMeaoInfo ( meaoId , token ) ; if ( meaoInfo == null ) { LOGGER . error ( "get meao info fail." ) ; throw new AppException ( "get meao info fail." ) ; } reqJson . put ( "vendor" , meaoInfo . getVendor ( ) ) ; String meaoUrl = meaoInfo . getUrl ( ) ; LOGGER . info ( "meaoUrl: {}" , meaoUrl ) ; JSONObject session = getMeaoSession ( meaoUrl , meaoInfo . getUsername ( ) , meaoInfo . getPassword ( ) , meaoInfo . getVendor ( ) ) ; String csrfToken = session . getString ( "csrfToken" ) ; String cookie = session . getString ( "session" ) ; String meaoHost = meaoUrl . split ( "//" ) [ 1 ] ; return uploadHelper . uploadBigSoftware ( filePath , reqJson , csrfToken , cookie , meaoHost ) ; }
uploadPackage.
uploadPackage .
// query meao info from third party system by meaoId