Class G2ProductJNI

    • Constructor Detail

      • G2ProductJNI

        public G2ProductJNI()
    • Method Detail

      • init

        public int init​(String moduleName,
                        String iniParams,
                        boolean verboseLogging)
        Initializes the G2 product API with the specified module name, init parameters and flag indicating verbose logging. If the G2CONFIGFILE init parameter is absent then the default configuration from the repository is used.
        Specified by:
        init in interface G2Product
        Parameters:
        moduleName - A short name given to this instance of the product API.
        iniParams - A JSON string containing configuration parameters.
        verboseLogging - Enable diagnostic logging which will print a massive amount of information to stdout.
        Returns:
        Zero (0) on success and non-zero on failure.
      • destroy

        public int destroy()
        Uninitializes the G2 product API.
        Specified by:
        destroy in interface G2Product
        Returns:
        Zero (0) on success and non-zero on failure.
      • license

        public String license()
        Returns the currently configured license details.
        Specified by:
        license in interface G2Product
        Returns:
        The JSON document describing the license details.
      • validateLicenseFile

        public int validateLicenseFile​(String licenseFile,
                                       StringBuffer errorResponse)
        Determines whether a specified license file is valid
        Specified by:
        validateLicenseFile in interface G2Product
        Parameters:
        licenseFile - The path
        errorResponse - The StringBuffer to write any error response to (if an error occurs).
        Returns:
        Zero (0) for valid license, one (1) for invalid, and a negative number for errors.
      • validateLicenseStringBase64

        public int validateLicenseStringBase64​(String licenseData,
                                               StringBuffer errorResponse)
        Determines whether a specified license Base-64 string is valid.
        Specified by:
        validateLicenseStringBase64 in interface G2Product
        Parameters:
        licenseData - The license data as a encoded Base-64 String.
        errorResponse - The StringBuffer to write any error response to (if an error occurs).
        Returns:
        Zero (0) for valid license, one (1) for invalid, and a negative number for errors.
      • version

        public String version()
        Returns the currently installed version details
        Specified by:
        version in interface G2Product
        Returns:
        JSON document of version details.
      • getLastException

        public String getLastException()
        Returns a string about the last error the system received. This is most commonly called after an API function returns an error code (non-zero or NULL)
        Specified by:
        getLastException in interface G2Fallible
        Returns:
        An error message
      • getLastExceptionCode

        public int getLastExceptionCode()
        Returns the exception code of the last error the system received. This is most commonly called after an API function returns an error code (non-zero or NULL)
        Specified by:
        getLastExceptionCode in interface G2Fallible
        Returns:
        An error code
      • clearLastException

        public void clearLastException()
        Clears the information about the last error the system received.
        Specified by:
        clearLastException in interface G2Fallible