Kofax Mobile SDK API Reference
Classes | Public Member Functions | Protected Member Functions | List of all members
ServerProjectProvider Class Reference
Inheritance diagram for ServerProjectProvider:
IProjectProvider

Classes

class  Error
 
class  HttpClientHolder
 

Public Member Functions

 ServerProjectProvider (Context ctx, String baseUrl) throws MalformedURLException
 
 ServerProjectProvider (Context ctx, IBundleCacheProvider cacheProvider, String baseUrl, ConnectivityManager connectivityManager) throws MalformedURLException
 
void setCertificateValidatorListener (CertificateValidatorListener certificateValidatorListener)
 
void setRequestTimeout (long duration, TimeUnit timeUnit)
 
void getHighestVersion (String sdkVersion, final ICompletionListener< String > listener)
 
void getProject (String version, final ICompletionListener< File > listener)
 
void getVariant (String variantName, String version, final ICompletionListener< File > listener)
 
String getLatestCachedModelDataBuildInfo ()
 
void getHighestVersion (final String projectName, final String sdkVersion, final ICompletionListener< String > listener)
 
void getProject (final String projectName, final String version, final ICompletionListener< File > listener)
 
void getVariant (final String projectName, final String variantName, final String version, final ICompletionListener< File > listener)
 
String getLatestCachedModelDataBuildInfo (String projectName)
 
void loadAllVariantsForProject (final String projectName, final ICompletionListener< Void > listener)
 
void cancelLoadAllVariants ()
 
- Public Member Functions inherited from IProjectProvider
void getHighestVersion (final String sdkVersion, final ICompletionListener< String > listener)
 
void getProject (final String version, final ICompletionListener< File > listener)
 
void getVariant (final String variantName, final String version, final ICompletionListener< File > listener)
 

Protected Member Functions

Task< String > getHighestVersionAsync (final String projectName, final String sdkVersion, final boolean bulk)
 
String sdkVersion ()
 

Detailed Description

A reference implementation of IProjectProvider that downloads assets from a Kofax Quick Updater service instance

Note: it is required for the app or user to have android.permission.ACCESS_NETWORK_STATE permission before calling any method in this class

Constructor & Destructor Documentation

ServerProjectProvider ( Context  ctx,
String  baseUrl 
) throws MalformedURLException

Create a new ServerProjectProvider using the Kofax Quick Updater server instance at the given base URL.

Parameters
ctxThis context
baseUrlThe Kofax Quick Updater instance URL

Unfortunately, because of this constructor, we cannot check the validity of the cache provider and connectivity parameters.

ServerProjectProvider ( Context  ctx,
IBundleCacheProvider  cacheProvider,
String  baseUrl,
ConnectivityManager  connectivityManager 
) throws MalformedURLException

Create a new ServerProjectProvider using a custom cache provider, using the Kofax Quick Updater server instance at the given base URL.

Parameters
ctxThis context
cacheProviderThe cache provider
baseUrlThe Kofax Quick Updater instance URL
connectivityManagerA connectivity manager for checking network status

Member Function Documentation

void cancelLoadAllVariants ( )

Cancels any outstanding tasks related to loadAllVariantsForProject(String, ICompletionListener)

This function will do nothing if no tasks are outstanding.

If there are outstanding tasks, the ICompletionListener passed to loadAllVariantsForProject(String, ICompletionListener) will be called with a cancel success message

void getHighestVersion ( String  sdkVersion,
final ICompletionListener< String >  listener 
)

This implementation keeps a map of sdk versions to model versions. If the map contains an entry for the key pair, that value is returned, and no work is done.

If no entry exists, the network connection is checked. If a network connection exists, a server call is attempted. If that value is returned, it is stored in the map and returned.

If a server response is not acquired, local cached is checked. If a local version exists, that version is stored in the map and returned.

If no map entry exists, no network connection exists or a server call fails, and finally no cache exists, a ProjectProviderException is thrown with a message indicating work cannot continue.

Parameters
sdkVersionThe version of the SDK that must be compatible
listenerA completion listener. If this is null, no work will be done.
void getHighestVersion ( final String  projectName,
final String  sdkVersion,
final ICompletionListener< String >  listener 
)

This implementation keeps a map of sdk versions to model versions. If the map contains an entry for the key pair, that value is returned, and no work is done.

If no entry exists, the network connection is checked. If a network connection exists, a server call is attempted. If that value is returned, it is stored in the map and returned.

If a server response is not acquired, local cached is checked. If a local version exists, that version is stored in the map and returned.

If no map entry exists, no network connection exists or a server call fails, and finally no cache exists, a ProjectProviderException is thrown with a message indicating work cannot continue.

Parameters
projectNameThe name of the project. This parameter is no longer used and will be ignored.
sdkVersionThe version of the SDK that must be compatible
listenerA completion listener. If this is null, no work will be done.

Implements IProjectProvider.

Task<String> getHighestVersionAsync ( final String  projectName,
final String  sdkVersion,
final boolean  bulk 
)
protected
String getLatestCachedModelDataBuildInfo ( )

Get the latest model data build information from cached project

Returns
The latest model data build info if available, otherwise a null string

Implements IProjectProvider.

String getLatestCachedModelDataBuildInfo ( String  projectName)

Get the latest model data build information from cached project

Parameters
projectNameThe name of the project. This parameter is no longer used and will be ignored.
Returns
The latest model data build info if available, otherwise a null string
Deprecated:
Deprecated in SDK 3.5. Replaced by IProjectProvider#getLatestCachedModelDataBuildInfo().

Implements IProjectProvider.

void getProject ( String  version,
final ICompletionListener< File >  listener 
)

Returns the directory containing the project files. If the project files already exist in the provided IBundleCacheProvider, those will be used.

If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.

If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.

Parameters
versionThe version of the project
listenerA completion listener. If this is null, no work will be done.
void getProject ( final String  projectName,
final String  version,
final ICompletionListener< File >  listener 
)

Returns the directory containing the project files. If the project files already exist in the provided IBundleCacheProvider, those will be used.

If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.

If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.

Parameters
projectNameThe name of the project. This parameter is no longer used and will be ignored.
versionThe version of the project
listenerA completion listener. If this is null, no work will be done.

Implements IProjectProvider.

void getVariant ( String  variantName,
String  version,
final ICompletionListener< File >  listener 
)

Returns the directory containing the variant files. If the variant files already exist in the provided IBundleCacheProvider, those will be used.

If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.

If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.

Parameters
variantNameThe name of the variant
versionThe version of the variant (this should match the same version string retrieved from getHighestVersion(String, String, ICompletionListener)
listenerA completion listener. If this is null, no work will be done.
void getVariant ( final String  projectName,
final String  variantName,
final String  version,
final ICompletionListener< File >  listener 
)

Returns the directory containing the variant files. If the variant files already exist in the provided IBundleCacheProvider, those will be used.

If no cache version exists, the network connection is checked. If a network connection exists, a server call is attempted. If the files are acquired from the server, they are cached and returned.

If no cache exists, and either there's no network connection or a server error, an exception is thrown with a message indicating work cannot continue.

Parameters
projectNameThe name of the project. This parameter is no longer used and will be ignored.
variantNameThe name of the variant
versionThe version of the variant (this should match the same version string retrieved from getHighestVersion(String, String, ICompletionListener)
listenerA completion listener. If this is null, no work will be done.

Implements IProjectProvider.

void loadAllVariantsForProject ( final String  projectName,
final ICompletionListener< Void >  listener 
)

Loads all the variants for a given project. This method uses the SdkVersion#getSdkVersion() when calling getHighestVersion(String, String, ICompletionListener). Subsequently, it retrieves the project files, and uses the contained variants list to download each variant.

If a variant already exists in the provided IBundleCacheProvider, it will not be re-downloaded.

Parameters
projectNameThe name of the project to load
listenerA listener to call when loading is complete. The type argument is Void because no object is returned.
String sdkVersion ( )
protected
void setCertificateValidatorListener ( CertificateValidatorListener  certificateValidatorListener)

Sets the SSL certificate validator listener.

The listener receives certificate validation challenges in response to an authentication request from the Kofax Quick Updater instance.

Parameters
certificateValidatorListener
See also
CertificateValidatorListener
void setRequestTimeout ( long  duration,
TimeUnit  timeUnit 
)

Change the connection timeout.

This parameter corresponds to all connection timeouts: connect, read and write. If any operation exceeds the timeout, the process is cancelled, and an exception will be raised.

Note: This sets the timeout for new connections. A value of 0 means no timeout, otherwise values must be between 1 and Integer::MAX_VALUE when converted to milliseconds.

Parameters
durationThe amount of the timeout
timeUnitThe time unit associated with the duration
Exceptions
IllegalArgumentException

The documentation for this class was generated from the following file:
Untitled Document © 2018 Kofax, Inc. All rights reserved. Use is subject to license terms.