Class: BundleCacheProvider

BundleCacheProvider()

new BundleCacheProvider()

This BundleCacheProvider class is responsible for handling the corresponding plugin js to interact with the native BundleCacheProvider class.corresponding JS methods are written under this class which are used by the end user in application script. This BundleCacheProvider handles extracting/copying entries from a bundle into a cache folder.

Methods

cacheProject(successCallback, errorCallback, cacheProjectOptions)

To cache the project data.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
cacheProjectOptions Object A JSON object contains the options of the BundleCacheProvider.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
path String <optional>
Zip bundle file path
version Number <optional>
The version of the project data
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The successCallBack consists of path to to folder containing cached project files. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
  var region = OnDeviceExtraction.getRegions();
  var idType = OnDeviceExtraction.getIDTypes();
  var parameters = {
           region: region.US,    //region.ASIA,region.CANADA,etc.
           IDType: idType.ID
  };
  OnDeviceExtraction.getProjectName(function(projectName){
 var cacheProjectOptions={
    projectName:projectName,
    path:'zipBundlePath',
    version:'versionNumber'
};
kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
 provider.cacheProject(function(success){
   alert(JSON.stringify(success));
 },function(error){
     alert("cacheProject:: "+JSON.stringify(error));
 },cacheProjectOptions);
    },function(error){
            alert("createBundleCacheProvider error:: "+JSON.stringify(error));
    });
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

cacheVariant(successCallback, errorCallback, cacheVariantOptions)

To cache the variant data.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
cacheVariantOptions Object A JSON object contains the options of the BundleCacheProvider.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
path String <optional>
Zip bundle file path
version Number <optional>
The version of the project data
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The successCallBack consists of path to to folder containing cached variant files. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
  var region = OnDeviceExtraction.getRegions();
  var idType = OnDeviceExtraction.getIDTypes();
  var parameters = {
           region: region.US,    //region.ASIA,region.CANADA,etc.
           IDType: idType.ID
  };
  OnDeviceExtraction.getProjectName(function(projectName){
  var cacheVariantOptions={
    projectName:projectName,
    path:'zipBundlePath',
    version:'versionNumber'
 };
 kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
   provider.cacheVariant(function(success){
           alert(JSON.stringify(success));
   },function(error){
       alert(JSON.stringify(error));
   },cacheVariantOptions);
       },function(error){
               alert("createBundleCacheProvider error:: "+JSON.stringify(error));
       });
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

getLatestVersionForProject(successCallback, errorCallback, parameters)

To get the latest cached version for the given project.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the options to get get the latest cached version for the given project.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The successCallBack consists of latest cached version for a given projectName. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
  var region = OnDeviceExtraction.getRegions();
  var idType = OnDeviceExtraction.getIDTypes();
  var parameters = {
           region: region.US,    //region.ASIA,region.CANADA,etc.
           IDType: idType.ID
  };
  OnDeviceExtraction.getProjectName(function(projectName){
  var latestVersionOptions={
    projectName:projectName
 };
 kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
  provider.getLatestVersionForProject(function(success){
   alert(JSON.stringify(success));
   },function(error){
     alert(JSON.stringify(error));
   },latestVersionOptions);
       },function(error){
               alert("createBundleCacheProvider error:: "+JSON.stringify(error));
       });
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

getProject(successCallback, errorCallback, parameters)

To get the path to specified project files.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the options of the BundleCacheProvider.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
version Number <optional>
The version of the project to retrieve.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The successCallBack consists of path to specified project files errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();

  var region = OnDeviceExtraction.getRegions();
  var idType = OnDeviceExtraction.getIDTypes();
  var parameters = {
           region: region.US,    //region.ASIA,region.CANADA,etc.
           IDType: idType.ID
  };
  OnDeviceExtraction.getProjectName(function(projectName){
                                     var getProjectOptions={
                                                 projectName:projectName,
                                                 version:20
                                     };
                                     kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
                                                                                         provider.getProject(function(success){
                                                                                                                 alert(JSON.stringify(success));
                                                                                                             },function(error){
                                                                                                                    alert(JSON.stringify(error));
                                                                                                             },getProjectOptions);
                                                                                         },function(error){
                                                                                             alert("createBundleCacheProvider error:: "+JSON.stringify(error));
                                                                                         });
                                     },function(error){
                                         alert(JSON.stringify(error));
                                     }, parameters);

getVariant(successCallback, errorCallback, parameters)

To get the path to specified variant files.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the options of the BundleCacheProvider.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
variantName String <optional>
VariantFileName for which the path has to be retrieved.
version Number <optional>
The version of the project to retrieve
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The successCallBack consists of path to specified variant files errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
  var region = OnDeviceExtraction.getRegions();
  var idType = OnDeviceExtraction.getIDTypes();
  var parameters = {
           region: region.US,    //region.ASIA,region.CANADA,etc.
           IDType: idType.ID
  };
  OnDeviceExtraction.getProjectName(function(projectName){
  var getVariantOptions={
    projectName:projectName,
    variantName:'variantName',
    version:'versionNumber'
 };
 kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
     provider.getVariant(function(success){
         alert(JSON.stringify(success));
     },function(error){
             alert(JSON.stringify(error));
     },getVariantOptions);
     },function(error){
             alert("createBundleCacheProvider error:: "+JSON.stringify(error));
     });
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);