All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.granite.crx2oak.util.ExtensionInfo Maven / Gradle / Ivy

/*******************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2015 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 ******************************************************************************/
package com.adobe.granite.crx2oak.util;

import com.adobe.granite.crx2oak.CRX2Oak;

import java.io.File;

/**
 * The quickstart extension info this application generic model.
 */
public class ExtensionInfo {

    private static final String JAR_NAME;
    private static final String JAR_PATH;
    private static final JarFile JAR_FILE;

    static {
        JAR_PATH = CRX2Oak.class.getProtectionDomain().getCodeSource().getLocation().getPath();
        JAR_NAME = JAR_PATH.substring(JAR_PATH.lastIndexOf(File.separator) + 1);
        JarFile jarFile;
        try {
            jarFile = new JarFile(JAR_PATH);
        } catch(RuntimeException e) {
            jarFile = null;
        }
        JAR_FILE = jarFile;
    }

    /**
     * Get the not null JAR FILE extension version.
     *
     * @return the not null version of extension
     */
    public static String getExtensionVersion() {
        return JAR_FILE == null ? "" : JAR_FILE.getVersion();
    }

    /**
     * Get the jar file name.
     *
     * @return not null jar file name including the extension
     */
    public static String getExtensionJarName() {
        return JAR_NAME;
    }

    /**
     * Get the optional checksum of the JAR file.
     *
     * @return not null (possible empty) jar file extension textual checksum
     */
    public static String getExtensionSHA1Checksum() {
        return JAR_FILE == null ? "" : JAR_FILE.getSHA1Checksum();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy