public class

FilerRepository

extends Object
java.lang.Object
   ↳ com.mapsted.positioning.FilerRepository

Summary

Nested Classes
interface FilerRepository.Callback  
interface FilerRepository.ProgressListener  
Constants
String PRESET_PARENT_DIR_MAP_STYLE a preset subfolder name for map style files
String PRESET_PARENT_DIR_MAP_TILES a preset subfolder name for map tile files
Public Constructors
FilerRepository(Context context, WebApiClient webApiClient)
Public Methods
File findFile(String filerId)
finds the file for this filerId in the local repository.
void getFile(String filerId, FilerRepository.Callback callback)
void getFile(String filerId, String parentDir, FilerRepository.Callback callback, FilerRepository.ProgressListener progressListener)
retrieves the file in background thread with the given filerId.
void onDestroy()
boolean removeFile(String filerId)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String PRESET_PARENT_DIR_MAP_STYLE

a preset subfolder name for map style files

Constant Value: "map_styles"

public static final String PRESET_PARENT_DIR_MAP_TILES

a preset subfolder name for map tile files

Constant Value: "map_tiles"

Public Constructors

public FilerRepository (Context context, WebApiClient webApiClient)

Public Methods

public File findFile (String filerId)

finds the file for this filerId in the local repository. If not found, returns null;

Returns
  • the file or null

public void getFile (String filerId, FilerRepository.Callback callback)

Parameters
callback callback with path to the file. If the file is not found, it will be downloaded.

public void getFile (String filerId, String parentDir, FilerRepository.Callback callback, FilerRepository.ProgressListener progressListener)

retrieves the file in background thread with the given filerId. If the file is not found in local repository, then it is downloaded from the filer remote server. The downloaded file is stored in the parentDir.

Parameters
filerId filerId of file.
parentDir subdirectory to store in. The file downloaded is stored in a dedicated folder for filer files. If parentDir is given, it will be stored in following folder structure `$filerRoot/$parentDir/$downloaded_file`. To get reference to the downloaded file use the callback. If parentDir is null `$filerRoo/$downloaded_file` see also PRESET_PARENT_DIR_MAP_STYLE PRESET_PARENT_DIR_MAP_TILES
callback callback with the file. To get the path to file, use this file.

public void onDestroy ()

public boolean removeFile (String filerId)

Returns
  • returns true if file was deleted. If file does not exist, returns true. If there was an exception or did not delete the file, returns false