C# Class CmisSync.Lib.Cmis.Database

Database to cache remote information from the CMIS server. Implemented with SQLite.
Inheritance: IDisposable
Afficher le fichier Open project: keithwharrison/Oris4Sync Class Usage Examples

Méthodes publiques

Méthode Description
AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata, byte filehash ) : void

Add a file to the database. If checksum is not null, it will be used for the database entry

AddFolder ( string path, System.DateTime serverSideModificationDate ) : void

Add a folder to the database.

ContainsFile ( string path ) : bool

Checks whether the database contains a given file.

ContainsFolder ( string path ) : bool

Checks whether the database contains a given folder.

Database ( string dataPath ) : System

Constructor.

Dispose ( ) : void

Implement IDisposable interface.

GetChangeLogToken ( ) : string

Get the ChangeLog token that was stored at the end of the last successful CmisSync synchronization.

GetSQLiteConnection ( ) : SQLiteConnection

Connection to the database. The sqliteConnection must not be used directly, used this method instead.

GetServerSideModificationDate ( string path ) : DateTime?

Get the time at which the file was last modified. This is the time on the CMIS server side, in UTC. Client-side time does not matter.

LocalFileHasChanged ( string path ) : bool

Check whether a file's content has changed locally since it was last synchronized. This happens when the user edits a file on the local computer. This method does not communicate with the CMIS server, it just checks whether the checksum has changed.

MoveFile ( string oldPath, string newPath ) : void

Move a file.

MoveFolder ( string oldPath, string newPath ) : void

Move a folder.

RecalculateChecksum ( string path ) : void

Recalculate the checksum of a file and save it to database.

RemoveFile ( string path ) : void

Remove a file from the database.

RemoveFolder ( string path ) : void

Remove a folder from the database.

SetChangeLogToken ( string token ) : void

Set the stored ChangeLog token. This should be called after each successful CmisSync synchronization.

SetFileServerSideModificationDate ( string path, DateTime serverSideModificationDate ) : void

Set the last modification date of a file. This is the time on the CMIS server side, in UTC. Client-side time does not matter. TODO Combine this method and the next in a new method ModifyFile, and find out if GetServerSideModificationDate is really needed.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Dispose pattern implementation.

Private Methods

Méthode Description
AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata ) : void
Checksum ( string filePath ) : string

Calculate the SHA1 checksum of a file. Code from http://stackoverflow.com/a/1993919/226958

ChecksumToString ( byte hash ) : string

Transforms a given hash into a string

ComposeSQLCommand ( SQLiteCommand command, string text, object>.Dictionary parameters ) : void

Helper method to fill the parameters inside an SQL command.

ExecuteSQLAction ( string text, object>.Dictionary parameters ) : void

Helper method to execute an SQL command that does not return anything.

ExecuteSQLFunction ( string text, object>.Dictionary parameters ) : object

Helper method to execute an SQL command that returns something.

Json ( string[]>.Dictionary dictionary ) : string

Put all the values of a dictionary into a JSON string.

Normalize ( string path ) : string

Normalize a path. All paths stored in database must be normalized. Goals: - Make data smaller in database - Reduce OS-specific differences

Method Details

AddFile() public méthode

Add a file to the database. If checksum is not null, it will be used for the database entry
public AddFile ( string path, System.DateTime serverSideModificationDate, string[]>.Dictionary metadata, byte filehash ) : void
path string
serverSideModificationDate System.DateTime
metadata string[]>.Dictionary
filehash byte
Résultat void

AddFolder() public méthode

Add a folder to the database.
public AddFolder ( string path, System.DateTime serverSideModificationDate ) : void
path string
serverSideModificationDate System.DateTime
Résultat void

ContainsFile() public méthode

Checks whether the database contains a given file.
public ContainsFile ( string path ) : bool
path string
Résultat bool

ContainsFolder() public méthode

Checks whether the database contains a given folder.
public ContainsFolder ( string path ) : bool
path string
Résultat bool

Database() public méthode

Constructor.
public Database ( string dataPath ) : System
dataPath string
Résultat System

Dispose() public méthode

Implement IDisposable interface.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Dispose pattern implementation.
protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

GetChangeLogToken() public méthode

Get the ChangeLog token that was stored at the end of the last successful CmisSync synchronization.
public GetChangeLogToken ( ) : string
Résultat string

GetSQLiteConnection() public méthode

Connection to the database. The sqliteConnection must not be used directly, used this method instead.
public GetSQLiteConnection ( ) : SQLiteConnection
Résultat SQLiteConnection

GetServerSideModificationDate() public méthode

Get the time at which the file was last modified. This is the time on the CMIS server side, in UTC. Client-side time does not matter.
public GetServerSideModificationDate ( string path ) : DateTime?
path string
Résultat DateTime?

LocalFileHasChanged() public méthode

Check whether a file's content has changed locally since it was last synchronized. This happens when the user edits a file on the local computer. This method does not communicate with the CMIS server, it just checks whether the checksum has changed.
public LocalFileHasChanged ( string path ) : bool
path string
Résultat bool

MoveFile() public méthode

Move a file.
public MoveFile ( string oldPath, string newPath ) : void
oldPath string
newPath string
Résultat void

MoveFolder() public méthode

Move a folder.
public MoveFolder ( string oldPath, string newPath ) : void
oldPath string
newPath string
Résultat void

RecalculateChecksum() public méthode

Recalculate the checksum of a file and save it to database.
public RecalculateChecksum ( string path ) : void
path string
Résultat void

RemoveFile() public méthode

Remove a file from the database.
public RemoveFile ( string path ) : void
path string
Résultat void

RemoveFolder() public méthode

Remove a folder from the database.
public RemoveFolder ( string path ) : void
path string
Résultat void

SetChangeLogToken() public méthode

Set the stored ChangeLog token. This should be called after each successful CmisSync synchronization.
public SetChangeLogToken ( string token ) : void
token string
Résultat void

SetFileServerSideModificationDate() public méthode

Set the last modification date of a file. This is the time on the CMIS server side, in UTC. Client-side time does not matter. TODO Combine this method and the next in a new method ModifyFile, and find out if GetServerSideModificationDate is really needed.
public SetFileServerSideModificationDate ( string path, DateTime serverSideModificationDate ) : void
path string
serverSideModificationDate DateTime
Résultat void