FileBriefcase
Overview
The FileBriefcase class provides support for persisting client data stored in a file and placed somewhere in the file system of the client. It can be useful in different scenarios, for example:
- You can use briefcase for saving client data including uncommitted changes between restarts of your application
- You can store some quite constant dictionary tables into briefcase and load them during application start, and thus avoid having to reload the same data from the server
- You can implement requesting only changed records for some huge table from the server side and then merge the delta with the client table loaded from the local briefcase.
A briefcase can hold one or more DataTables with original data and pending Delta Changes that have not been applied yet. Also briefcase can hold one or more custom application-specific string properties. This can be useful, for example, for keeping data format version, to ensure that your application can read the data correctly.
All data in the FileBriefcase are stored using the Bin2DataStreamer streamer.
File of the FileBriefcase usually has .daBriefcase extension. The related file should be passed to the constructor on briefcase creation.
The Briefcase Explorer tool can be used to load and inspect data in the briefcase.
Location
- Reference: com.remobjects.dataabstract.jar
- Package: com.remobjects.dataabstract
- Ancestry: Object | Briefcase | FileBriefcase
constructor protected (declared in Briefcase)
Creates a new instance of the Briefcase class. Cannot be called directly.
constructor
FileBriefcase()
constructor (String, Boolean)
This method fills the fiven table with the data from related file.
constructor(filename: String; preloadData: Boolean)
FileBriefcase(String filename, Boolean preloadData)
Parameters:
- filename: A name of the file that will be related to the newly created Briefcase.
- preloadData: Defines, wheter to try reading from file on briefcase creation. Set it to load data from existing briefcase file.
addTable (declared in Briefcase)
Adds a data table to the Briefcase.
Table name should be unique for the given Briefcase.
Parameters:
- aTable: Data Table to add to the Briefcase
addTables (declared in Briefcase)
Adds several data tables to the Briefcase.
Table name should be unique for the given Briefcase.
Parameters:
- aTables: An array of tables to add.
Count (declared in Briefcase)
Gets the count of Data Tables in the Briefcase.
property Count: Integer read;
Integer Count { __get; }
Thу method where an actual reading the data and filling the table should be performed. MUST be overriden by inheritors.
Parameters:
- aTables: Instantiated and named DataTable instances, that are supposed to be filled by the method.
doFill (DataTable[]) protected
This method fills the given table with the data from related file.
Parameters:
- tables: A set of data tables to fill. All tables should be named.
FileName (declared in Briefcase)
Name of the file of a folder that contain the Briefcase data
property FileName: String read;
String FileName { __get; }
fillTable (declared in Briefcase)
Fills the given named data table instance with the data from briefcase. Any further data changes in the given table won't be reflected in the briefcase, therefore use Briefcase method for this.
Parameters:
- aTable: Instantiated and named table instance to fill with data.
fillTables (declared in Briefcase)
Fills the given named data tables instances with the data from briefcase. Any further data changes in the given tables won't be reflected in the briefcase, therefore use Briefcase method for this.
Parameters:
- aTables: Instantiated and named table instances to fill with data.
Properties (declared in Briefcase)
Gets a Dictionary containing Briefcase's custom properties.
property Properties: Map<String, String> read;
Map<String, String> Properties { __get; }
Returns a copy of the data table stored in the Briefcase.
Note: DataTable instance returned by this method is a clone of the original Data Table stored in the Briefcase. So any changes made to this DataTable won't affect data actually stored in the Briefcase.
Parameters:
- tableName: A name of the table, that should be returned.
tableNamed (String, Boolean): DataTable
Returns a copy of the data table stored in the Briefcase.
Note: DataTable instance returned by this method is a clone of the original Data Table stored in the Briefcase. So any changes made to this DataTable won't affect data actually stored in the Briefcase.
method tableNamed(tableName: String; reloadData: Boolean): DataTable
DataTable tableNamed(String tableName, Boolean reloadData)
Parameters:
- tableName: A name of the table, that should be returned.
- reloadData: If true, it reloads a table with the given name from the Briefcase storage.
TableNames (declared in Briefcase)
Provides access to String array containing all briefcase's table names.
This property is calculated on the fly, so it is advised to cache its value in the case it should be accessed several times in a row.
property TableNames: array of String read;
String[] TableNames { __get; }
writeBriefcase
Writes tables from internal cache back to the related file. If some tables weren't loaded, it first forces to read them from the file before rewriting it.
method writeBriefcase
void writeBriefcase()
Count (declared in Briefcase)
Gets the count of Data Tables in the Briefcase.
property Count: Integer read;
Integer Count { __get; }
FileName (declared in Briefcase)
Name of the file of a folder that contain the Briefcase data
property FileName: String read;
String FileName { __get; }
Properties (declared in Briefcase)
Gets a Dictionary containing Briefcase's custom properties.
property Properties: Map<String, String> read;
Map<String, String> Properties { __get; }
TableNames (declared in Briefcase)
Provides access to String array containing all briefcase's table names.
This property is calculated on the fly, so it is advised to cache its value in the case it should be accessed several times in a row.
property TableNames: array of String read;
String[] TableNames { __get; }
constructor protected (declared in Briefcase)
Creates a new instance of the Briefcase class. Cannot be called directly.
constructor
FileBriefcase()
constructor (String, Boolean)
This method fills the fiven table with the data from related file.
constructor(filename: String; preloadData: Boolean)
FileBriefcase(String filename, Boolean preloadData)
Parameters:
- filename: A name of the file that will be related to the newly created Briefcase.
- preloadData: Defines, wheter to try reading from file on briefcase creation. Set it to load data from existing briefcase file.
addTable (declared in Briefcase)
Adds a data table to the Briefcase.
Table name should be unique for the given Briefcase.
Parameters:
- aTable: Data Table to add to the Briefcase
addTables (declared in Briefcase)
Adds several data tables to the Briefcase.
Table name should be unique for the given Briefcase.
Parameters:
- aTables: An array of tables to add.
Thу method where an actual reading the data and filling the table should be performed. MUST be overriden by inheritors.
Parameters:
- aTables: Instantiated and named DataTable instances, that are supposed to be filled by the method.
doFill (DataTable[]) protected
This method fills the given table with the data from related file.
Parameters:
- tables: A set of data tables to fill. All tables should be named.
fillTable (declared in Briefcase)
Fills the given named data table instance with the data from briefcase. Any further data changes in the given table won't be reflected in the briefcase, therefore use Briefcase method for this.
Parameters:
- aTable: Instantiated and named table instance to fill with data.
fillTables (declared in Briefcase)
Fills the given named data tables instances with the data from briefcase. Any further data changes in the given tables won't be reflected in the briefcase, therefore use Briefcase method for this.
Parameters:
- aTables: Instantiated and named table instances to fill with data.
Returns a copy of the data table stored in the Briefcase.
Note: DataTable instance returned by this method is a clone of the original Data Table stored in the Briefcase. So any changes made to this DataTable won't affect data actually stored in the Briefcase.
Parameters:
- tableName: A name of the table, that should be returned.
tableNamed (String, Boolean): DataTable
Returns a copy of the data table stored in the Briefcase.
Note: DataTable instance returned by this method is a clone of the original Data Table stored in the Briefcase. So any changes made to this DataTable won't affect data actually stored in the Briefcase.
method tableNamed(tableName: String; reloadData: Boolean): DataTable
DataTable tableNamed(String tableName, Boolean reloadData)
Parameters:
- tableName: A name of the table, that should be returned.
- reloadData: If true, it reloads a table with the given name from the Briefcase storage.
writeBriefcase
Writes tables from internal cache back to the related file. If some tables weren't loaded, it first forces to read them from the file before rewriting it.
method writeBriefcase
void writeBriefcase()
- Delphi:
- .NET:
-
Xcode:
- DABriefcase
- DAFolderBriefcase
-
Java
- FileBriefcase
- .daBriefcase Files