Class: LocalProjectProvider

LocalProjectProvider()

new LocalProjectProvider()

This LocalProjectProvider class is responsible for handling the corresponding plugin js to interact with the native LocalProjectProvider class.corresponding JS methods are written under this class which are used by the end user in application script. This LocalProjectProvider allows to get assets from zip bundles stored in application resources. By default it uses BundleCacheProvider object with default cache directory and main bundle root location for bundles. Project zip bundles are expected to be named as %project_name%.zip (e.g. USIDs.zip).if Local assets needs to be stored in the customised path, You should call useCacheProvider() method.

Methods

getHighestVersion(successCallback, errorCallback, completeListener, highestVersionOptions)

To get the highest version for the given project in LocalProjectPath.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
completeListener function CallBack consists of highest local project version for a given projectName.
highestVersionOptions Object A JSON object contains the options to get the highest Local 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 - It will returns success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. completeListener - It will returns highest local project version for a given projectName.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();

 var LocalPath = "";  //Path to the folder containing zip file.
 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 highestVersionOptions={
    projectName:projectName
};
                kfxCordova.kfxEngine.createLocalProjectProvider(function(provider){
                            provider.getHighestVersion(function(result){
                            },function(error){
                                alert("getHighestVersion error:: "+JSON.stringify(error));
                            },getHighestVersionCallback,highestVersionOptions);
                },function(error){
                        alert("createLocalProjectProvider error::"+JSON.stringify(error));
                },LocalPath);
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

getHighestVersionCallback = function(result){
               alert("get Highest Version:: "+result.version);
};

getProject(successCallback, errorCallback, completeListener, getProjectOptions)

To get path to the project data for the given project and version.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
completeListener function The callBack consists of path to specified project files.
getProjectOptions Object A JSON object contains the options of the LocalProjectProvider.
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 - It will returns success call back. errorCallback - Error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. completeListener - It will returns specified project file path.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
var LocalPath = "";  //Path to the folder containing zip file.
  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:1
};
                kfxCordova.kfxEngine.createLocalProjectProvider(function(provider){
                            provider.getProject(function(result){
                            },function(error){
                                alert("getProject error:: "+JSON.stringify(error));
                            },getProjectCallback,getProjectOptions);
                },function(error){
                        alert("createLocalProjectProvider error::"+JSON.stringify(error));
                },LocalPath);

    getProjectCallback = function(result){
          alert("get Project path:: "+result.path);
    };
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

getVariant(successCallback, errorCallback, completeListener, getVariantOptions)

To get the path to specified variant files.
Parameters:
Name Type Attributes Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
completeListener function The callBack consists of path to specified variant files.
getVariantOptions Object A JSON object contains the options of the LocalProjectProvider.
Properties
Name Type Attributes Description
projectName String <optional>
Name of the project.
variantName String <optional>
VariantFileName for which the path has to be retrieved.
getProjectOptions.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 - It will returns success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are Wrong Parameters, KmcRuntimeException & Exception. completeListener - It will returns specified variant file path.
Example
var OnDeviceExtraction = kfxCordova.kfxEngine.createOnDeviceExtraction();
var LocalPath = "";  //Path to the folder containing zip file.
  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:requiredProjectName,
         variantName:'variantName',  // CA3
         version:'versionNumber'     // 1
  };
                kfxCordova.kfxEngine.createLocalProjectProvider(function(provider){
                            provider.getVariant(function(result){
                            },function(error){
                                alert("getVariant error:: "+JSON.stringify(error));
                            },getVariantCallback,getVariantOptions);
                },function(error){
                        alert("createLocalProjectProvider error::"+JSON.stringify(error));
                },LocalPath);
                                    },function(error){
                                      alert(JSON.stringify(error));
                                    }, parameters);

getVariantCallback = function(result){
               alert("get Variant path:: "+result.path);
};

useCacheProvider(successCallback, errorCallback)

Use this method to creates LocalProjectProvider object using bundleCacheProvider, before calling this method you must create bundleCacheProvider object otherwise it will get callback error.
Parameters:
Name Type Description
successCallback function Default Success call back function name
errorCallback function Default Error call back function name
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 - It will returns success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception and if bundleCacheProvider has not been created before calling this method then will gets callback error.
Example
var mBundleCacheProvider;
 var serverUrl = "";  //Initializes the serverProjectProvider object with server URL.
kfxCordova.kfxEngine.createBundleCacheProvider(function(provider){
                 mBundleCacheProvider = provider;
                kfxCordova.kfxEngine.createLocalProjectProvider(function(provider){
                            provider.useCacheProvider(function(result){
                            },function(error){
                                alert("useCacheProvider error:: "+JSON.stringify(error));
                            });
                },function(error){
                        alert("createLocalProjectProvider error::"+JSON.stringify(error));
                },serverUrl);
           },function(error){
                         alert("createBundleCacheProvider error::"+JSON.stringify(error));
           });