src/main/java/org/edgegallery/appstore/domain/model/releases/BasicInfo.java
public BasicInfo load(String fileAddress) {
        String unzipDir = getUnzipDir(fileAddress);
        boolean isXmlCsar = false;
        try {
            List<String> unzipFiles = unzip(fileAddress, unzipDir);
            if (unzipFiles.isEmpty()) {
                isXmlCsar = true;
            }
            FileRelationResponse treeStruct = buildFileStructure(unzipDir, unzipDir);
            Gson gson = new Gson();
            fileStructure = gson.toJson(treeStruct);
            for (String unzipFile : unzipFiles) {
                boolean isRegular = isRegularFile(Paths.get(unzipFile));
                if (!isRegular) {
                    break;
                }
                File f = new File(unzipFile);
                String canonicalPath = f.getCanonicalPath();
                if (canonicalPath.endsWith(MANIFEST)) {
                    readManifest(f);
                }
                if (canonicalPath.endsWith(MARKDOWN)) {
                    readMarkDown(f);
                }
                if (isYamlFile(f)) {
                    isXmlCsar = false;
                }
            }
        } catch (IOException e1) {
            LOGGER.error("judge package type error {} ", e1.getMessage());
        }
        if (appName == null || provider == null || version == null || appName.length() < 1 || provider.length() < 1
            || version.length() < 1) {
            throw new AppException(MF_PRODUCT_NAME + ", " + MF_PROVIDER_META + " or " + MF_VERSION_META + " is empty.",
                ResponseConst.RET_MF_CONTENT_INVALID);
        }

        if (isXmlCsar) {
            fileType = PACKAGE_XML_FORMAT;
        } else {
            fileType = PACKAGE_YAML_FORMAT;
        }

        return this;
    }
/**
     * load file and analyse file list.
     *
     * @param fileAddress file storage path.
     */
load file and analyse file list.
@param fileAddress file storage path.
load file and analyse file list . @param fileAddress file storage path .
public BasicInfo load(String fileAddress) {
        String unzipDir = getUnzipDir(fileAddress);
        boolean isXmlCsar = false;
        try {
            List<String> unzipFiles = unzip(fileAddress, unzipDir);
            if (unzipFiles.isEmpty()) {
                isXmlCsar = true;
            }
            FileRelationResponse treeStruct = buildFileStructure(unzipDir, unzipDir);
            Gson gson = new Gson();
            fileStructure = gson.toJson(treeStruct);
            for (String unzipFile : unzipFiles) {
                boolean isRegular = isRegularFile(Paths.get(unzipFile));
                if (!isRegular) {
                    break;
                }
                File f = new File(unzipFile);
                String canonicalPath = f.getCanonicalPath();
                if (canonicalPath.endsWith(MANIFEST)) {
                    readManifest(f);
                }
                if (canonicalPath.endsWith(MARKDOWN)) {
                    readMarkDown(f);
                }
                if (isYamlFile(f)) {
                    isXmlCsar = false;
                }
            }
        } catch (IOException e1) {
            LOGGER.error("judge package type error {} ", e1.getMessage());
        }
        if (appName == null || provider == null || version == null || appName.length() < 1 || provider.length() < 1
            || version.length() < 1) {
            throw new AppException(MF_PRODUCT_NAME + ", " + MF_PROVIDER_META + " or " + MF_VERSION_META + " is empty.",
                ResponseConst.RET_MF_CONTENT_INVALID);
        }
        if (isXmlCsar) {
            fileType = PACKAGE_XML_FORMAT;
        } else {
            fileType = PACKAGE_YAML_FORMAT;
        }
        return this;
    }
public BasicInfo load ( String fileAddress ) { String unzipDir = getUnzipDir ( fileAddress ) ; boolean isXmlCsar = false ; try { List < String > unzipFiles = unzip ( fileAddress , unzipDir ) ; if ( unzipFiles . isEmpty ( ) ) { isXmlCsar = true ; } FileRelationResponse treeStruct = buildFileStructure ( unzipDir , unzipDir ) ; Gson gson = new Gson ( ) ; fileStructure = gson . toJson ( treeStruct ) ; for ( String unzipFile : unzipFiles ) { boolean isRegular = isRegularFile ( Paths . get ( unzipFile ) ) ; if ( ! isRegular ) { break ; } File f = new File ( unzipFile ) ; String canonicalPath = f . getCanonicalPath ( ) ; if ( canonicalPath . endsWith ( MANIFEST ) ) { readManifest ( f ) ; } if ( canonicalPath . endsWith ( MARKDOWN ) ) { readMarkDown ( f ) ; } if ( isYamlFile ( f ) ) { isXmlCsar = false ; } } } catch ( IOException e1 ) { LOGGER . error ( "judge package type error {} " , e1 . getMessage ( ) ) ; } if ( appName == null || provider == null || version == null || appName . length ( ) < 1 || provider . length ( ) < 1 || version . length ( ) < 1 ) { throw new AppException ( MF_PRODUCT_NAME + ", " + MF_PROVIDER_META + " or " + MF_VERSION_META + " is empty." , ResponseConst . RET_MF_CONTENT_INVALID ) ; } if ( isXmlCsar ) { fileType = PACKAGE_XML_FORMAT ; } else { fileType = PACKAGE_YAML_FORMAT ; } return this ; }
load file and analyse file list.
load file and analyse file list .