Examples of LicenseApi


Examples of org.voltdb.licensetool.LicenseApi

    }

    @Override
    public LicenseApi getLicenseApi()
    {
        return new LicenseApi() {
            @Override
            public boolean initializeFromFile(File license) {
                return true;
            }
View Full Code Here

Examples of org.voltdb.licensetool.LicenseApi

    public static PartitionDRGateway getInstance(int partitionId,
                                                 NodeDRGateway nodeGateway,
                                                 boolean isRejoin)
    {
        final VoltDBInterface vdb = VoltDB.instance();
        LicenseApi api = vdb.getLicenseApi();
        final boolean licensedToDR = api.isDrReplicationAllowed();

        // if this is a primary cluster in a DR-enabled scenario
        // try to load the real version of this class
        PartitionDRGateway pdrg = null;
        if (licensedToDR && nodeGateway != null) {
View Full Code Here

Examples of org.voltdb.licensetool.LicenseApi

     * @return a valid API for community and pro editions, or null on error.
     */
    public static LicenseApi licenseApiFactory(String pathToLicense) {

        if (MiscUtils.isPro() == false) {
            return new LicenseApi() {
                @Override
                public boolean initializeFromFile(File license) {
                    return true;
                }

                @Override
                public boolean isTrial() {
                    return false;
                }

                @Override
                public int maxHostcount() {
                    return Integer.MAX_VALUE;
                }

                @Override
                public Calendar expires() {
                    Calendar result = Calendar.getInstance();
                    result.add(Calendar.YEAR, 20); // good enough?
                    return result;
                }

                @Override
                public boolean verify() {
                    return true;
                }

                @Override
                public boolean isDrReplicationAllowed() {
                    return false;
                }

                @Override
                public boolean isCommandLoggingAllowed() {
                    return false;
                }
            };
        }

        // boilerplate to create a license api interface
        LicenseApi licenseApi = null;
        Class<?> licApiKlass = MiscUtils.loadProClass("org.voltdb.licensetool.LicenseApiImpl",
                                                      "License API", false);
        if (licApiKlass != null) {
            try {
                licenseApi = (LicenseApi)licApiKlass.newInstance();
            } catch (InstantiationException e) {
                hostLog.fatal("Unable to process license file: could not create license API.");
                return null;
            } catch (IllegalAccessException e) {
                hostLog.fatal("Unable to process license file: could not create license API.");
                return null;
            }
        }

        if (licenseApi == null) {
            hostLog.fatal("Unable to load license file: could not create License API.");
            return null;
        }

        // verify the license file exists.
        File licenseFile = new File(pathToLicense);
        if (licenseFile.exists() == false) {
            return null;
        }

        // Initialize the API. This parses the file but does NOT verify signatures.
        if (licenseApi.initializeFromFile(licenseFile) == false) {
            hostLog.fatal("Unable to load license file: could not parse license.");
            return null;
        }

        // Perform signature verification - detect modified files
        try
        {
            if (licenseApi.verify() == false) {
                hostLog.fatal("Unable to load license file: could not verify license signature.");
                return null;
            }
        }
        catch (LicenseException lex)
View Full Code Here

Examples of org.voltdb.licensetool.LicenseApi

     * @return a valid API for community and pro editions, or null on error.
     */
    public static LicenseApi licenseApiFactory()
    {
        String licensePath = System.getProperty("user.dir") + "/" + licenseFileName;
        LicenseApi licenseApi = MiscUtils.licenseApiFactory(licensePath);
        if (licenseApi == null) {
            try {
                // Get location of jar file
                String jarLoc = VoltDB.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
                // Strip of file name
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.