ChspsDefinitionRepository Class Reference

class ChspsDefinitionRepository : public CBase

hspsDefinitionRepository is a common and secure place to store the HSPS's definition files.

Class provides the APIs to store and retrieve all the definition files: locale, style, structure and resource files.

Repository can store disk space limited number of ODT data structures and definition files (themes) for every application. Themes are identified by application uid, vendor name, theme name and theme version. Localisation is supported by naming the ODT for each language variant uniquely. TLanguage enumeration is used in the ODT header to specify the variant. The ODT can be retrieved from the repository as a fully constructed object or a descriptor stream.

Existing themes can be queried from the repository for managing purposes. Same method can be used to avoid accidental overwrites. If the query returns zero count for the appropriate ODT the new theme can be safely installed. Themes can be also removed with the valid header information. When the theme is removed also all the definition files will be deleted.

hspsDefRep.dll
Since
S60 5.0

Inherits from

  • ChspsDefinitionRepository
Public Member Functions
~ChspsDefinitionRepository()
IMPORT_C voidBackupConfigurationL(const ChspsODT &)
IMPORT_C voidClearBackupsL()
IMPORT_C voidGetODTPathL(const ChspsODT &, TDes &)
IMPORT_C TIntGetOdtHeaderL(TDes &, TLanguage, ChspsODT &)
IMPORT_C TIntGetOdtL(ChspsODT &)
IMPORT_C voidGetOdtL(const TDes &, ChspsODT &)
IMPORT_C TIntGetResourceListL(const ChspsODT &, CArrayPtrSeg< ChspsResource > &)
IMPORT_C voidGetResourcePathL(const ChspsODT &, ThspsResourceType, TDes &)
IMPORT_C voidGetThemeListAsStreamL(CArrayPtrSeg< HBufC8 > &, const ChspsODT &)
IMPORT_C voidGetThemePathListL(CDesCArraySeg &, const ChspsODT &)
IMPORT_C voidLock()
IMPORT_C TBoolLocked()
IMPORT_C voidMakeODTPathL(ChspsODT &, ChspsResource &)
IMPORT_C voidMakeResourcePathL(const ChspsODT &, ChspsResource &)
IMPORT_C ChspsDefinitionRepository *NewL(CRepository &)
IMPORT_C voidRegisterNotification(ThspsRepositoryInfo)
IMPORT_C voidRegisterObserverL(const MhspsDefinitionRepositoryObserver &)
IMPORT_C voidRemoveThemeL(const ChspsODT &)
IMPORT_C TIntRestoreBackupConfiguration(const ChspsODT &)
IMPORT_C TIntSetLocaleL(ChspsODT &, ChspsResource &)
IMPORT_C voidSetLogBus(void *)
IMPORT_C TIntSetOdtL(const ChspsODT &)
IMPORT_C TIntSetResourceL(const ChspsODT &, const CFbsBitmap &, ChspsResource &)
IMPORT_C TIntSetResourceListL(ChspsODT &, const CArrayPtrSeg< ChspsResource > &)
IMPORT_C voidUnlock()
IMPORT_C voidUnregisterObserver(const MhspsDefinitionRepositoryObserver &)
Private Member Functions
ChspsDefinitionRepository(CRepository &)
voidAddLocalePathL(TDes &, TInt)
voidAppendDesCIntoPathL(TDes &, const TDesC &)
voidAppendNumIntoPathL(TDes &, const TUint)
voidConstructL()
TInt CopyFileL(const TDesC &)
TInt CopyFileL(const TDesC &, const TDesC &)
voidFileExtensionL(ThspsResourceType, TInt)
voidGetPathL(const ChspsODT &, ThspsResourceType)
voidMatchingFoldersFromAllDrivesL(const TDesC &, const TDesC &, CDesCArraySeg &)
TInt MatchingFoldersL(const TDesC &, const TDesC &, CDesCArraySeg &)
CFileStore *OpenFileStoreLC(const TDesC &)
TInt ReadFromFileL(const TDesC &, ChspsODT &)
voidRemoveDirectoryL()
voidRemoveDirectoryL(TDesC &)
voidSelectFilesFromPathL(CDesCArraySeg &, const TDesC &, TEntryKey, const TDesC &)
voidSetupPropertiesL(const TUint)
HBufC8 *StreamHeaderFromFileL(const TDesC &)
TInt WriteToFileL(const ChspsODT &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
ChspsODT *iCacheLastODT
CRepository &iCentralRepository
RFs iFs
TBool iLicenseDefault
TInt iLockSemaphore
RPointerArray< MhspsDefinitionRepositoryObserver >iObservers
HBufC *iPath
RProperty iProperty
RArray< ThspsRepositoryInfo >iRepositoryInfoQueue
TFileName iTempFileName1
TFileName iTempFileName2

Constructor & Destructor Documentation

ChspsDefinitionRepository(CRepository &)

ChspsDefinitionRepository(CRepository &aCentralRepository)[private]

C++ default constructor.

Parameters

CRepository & aCentralRepository

~ChspsDefinitionRepository()

~ChspsDefinitionRepository()[virtual]

Destructor.

Member Functions Documentation

AddLocalePathL(TDes &, TInt)

voidAddLocalePathL(TDes &aPath,
TIntaLanguage
)[private]

Parameters

TDes & aPath
TInt aLanguage

AppendDesCIntoPathL(TDes &, const TDesC &)

voidAppendDesCIntoPathL(TDes &aPath,
const TDesC &aText
)[private]

Parameters

TDes & aPath
const TDesC & aText

AppendNumIntoPathL(TDes &, const TUint)

voidAppendNumIntoPathL(TDes &aPath,
const TUintaNum
)[private]

Parameters

TDes & aPath
const TUint aNum

BackupConfigurationL(const ChspsODT &)

IMPORT_C voidBackupConfigurationL(const ChspsODT &aODT)
Copies a defined configuration to theme backup folder
Since
S60 5.0

Parameters

const ChspsODT & aODTODT header defining the configuration to be copied

ClearBackupsL()

IMPORT_C voidClearBackupsL()
Clears previous backup data
Since
S60 5.0

ConstructL()

voidConstructL()[private]

By default Symbian 2nd phase constructor is private.

CopyFileL(const TDesC &)

TInt CopyFileL(const TDesC &aSourceFile)[private]

Parameters

const TDesC & aSourceFile

CopyFileL(const TDesC &, const TDesC &)

TInt CopyFileL(const TDesC &aSourceFile,
const TDesC &aDestinationFile
)[private]

Parameters

const TDesC & aSourceFile
const TDesC & aDestinationFile

FileExtensionL(ThspsResourceType, TInt)

voidFileExtensionL(ThspsResourceTypeaResourceType,
TIntaLanguage
)[private]

Parameters

ThspsResourceType aResourceType
TInt aLanguage

GetODTPathL(const ChspsODT &, TDes &)

IMPORT_C voidGetODTPathL(const ChspsODT &aODT,
TDes &aPath
)

Creates a path from the header information. Results are stored into the iPath member.

Since
S60 5.0

Parameters

const ChspsODT & aODTAn ODT whose path is being requested
TDes & aPathRelative path without a drive letter

GetOdtHeaderL(TDes &, TLanguage, ChspsODT &)

IMPORT_C TIntGetOdtHeaderL(TDes &aPath,
TLanguageaLang,
ChspsODT &aODT
)

Retrieves the ODT header from the repository. The aPath variable must contain the valid path. Leaves if path not found.

Since
S60 5.0

Parameters

TDes & aPathThe path where the theme is located.
TLanguage aLangInforms the correct language version.
ChspsODT & aODTA reference to ODT header object, which is filled with data from the repository.

GetOdtL(ChspsODT &)

IMPORT_C TIntGetOdtL(ChspsODT &aODT)

Retrieves the ODT from the repository. The ODT must contain the valid header information, which is used to locate the correct data. Leaves if ODT not found.

Since
S60 5.0

Parameters

ChspsODT & aODTA reference to ODT object, which is filled with data from the repository.

GetOdtL(const TDes &, ChspsODT &)

IMPORT_C voidGetOdtL(const TDes &aPath,
ChspsODT &aODT
)
Retrieves the ODT from the repository. The aPath variable must contain the valid path. Leaves if path not found.
Since
S60 5.0

Parameters

const TDes & aPathThe path where the theme is located.
ChspsODT & aODTA reference to ODT object, which is filled with data from the repository.

GetPathL(const ChspsODT &, ThspsResourceType)

voidGetPathL(const ChspsODT &aODT,
ThspsResourceTypeaResourceType
)[private]

Parameters

const ChspsODT & aODT
ThspsResourceType aResourceType

GetResourceListL(const ChspsODT &, CArrayPtrSeg< ChspsResource > &)

IMPORT_C TIntGetResourceListL(const ChspsODT &aODT,
CArrayPtrSeg< ChspsResource > &aResourceList
)

Retrieves the resource list in an array. Every registered resource has an own entry in the array. Leaves if the repository is corrupted. Use RemoveThemeL to remove the corrupted repository.

Since
S60 5.0

Parameters

const ChspsODT & aODTcontains the theme header associated to this resourcelist.
CArrayPtrSeg< ChspsResource > & aResourceListdestination resource list where resource are read from repository.

GetResourcePathL(const ChspsODT &, ThspsResourceType, TDes &)

IMPORT_C voidGetResourcePathL(const ChspsODT &aODT,
ThspsResourceTypeaResourceType,
TDes &aFilePath
)

Retrieves the exact path of the repository object. Does not check whether the object is really existing on repository or not.

Since
S60 5.0

Parameters

const ChspsODT & aODTContains the header information. Works as a search mask. Leaves if invalid data.
ThspsResourceType aResourceTyperesource type to search for.
TDes & aFilePathA file path returned to caller.

GetThemeListAsStreamL(CArrayPtrSeg< HBufC8 > &, const ChspsODT &)

IMPORT_C voidGetThemeListAsStreamL(CArrayPtrSeg< HBufC8 > &aThemeList,
const ChspsODT &aODT
)

Retrieves the list of installed themes as a streams in an array. ODT header information works as a search mask.

Since
S60 5.0

Parameters

CArrayPtrSeg< HBufC8 > & aThemeListA reference to an array, which contains internalized theme headers.
const ChspsODT & aODTContains the header information. Works as a search mask. Leaves if invalid data.

GetThemePathListL(CDesCArraySeg &, const ChspsODT &)

IMPORT_C voidGetThemePathListL(CDesCArraySeg &aThemeList,
const ChspsODT &aODT
)

Retrieves the list of installed themes in an array. ODT header information works as a search mask. If all the information is available in the header a function can be used to query the theme's existence. This is useful when the accidental overwrites needs to be avoided e.g. when installing a new theme.

Since
S60 5.0

Parameters

CDesCArraySeg & aThemeListA reference to an array, which is filled with the theme paths.
const ChspsODT & aODTContains the header information. Works as a search mask. Leaves if invalid data.

Lock()

IMPORT_C voidLock()

Increases the semaphore controlling repository locking. Locking semaphore is increased explicitly by clients that going to write data to repository.. Lockin semaphore revents reading repository as long as there are writers.

Since
S60 5.0

Locked()

IMPORT_C TBoolLocked()const

Returns repository locking status

Since
S60 5.0

MakeODTPathL(ChspsODT &, ChspsResource &)

IMPORT_C voidMakeODTPathL(ChspsODT &aODT,
ChspsResource &aResource
)

Creates a path for the ODT to be stored on repository. ODT-header information works as a set mask.

Since
S60 5.0

Parameters

ChspsODT & aODTContains the header information. Works as a set mask. Leaves if invalid data.
ChspsResource & aResourceA ChspsResource-object filled with the new path is returned to caller.

MakeResourcePathL(const ChspsODT &, ChspsResource &)

IMPORT_C voidMakeResourcePathL(const ChspsODT &aODT,
ChspsResource &aResource
)

Get a path for resource to be stored.

Since
S60 5.0

Parameters

const ChspsODT & aODTContains the header information.
ChspsResource & aResourceresource where path is stored. Leaves if path could not be defined.

MatchingFoldersFromAllDrivesL(const TDesC &, const TDesC &, CDesCArraySeg &)

voidMatchingFoldersFromAllDrivesL(const TDesC &aWildName,
const TDesC &aScanDir,
CDesCArraySeg &aThemeList
)[private]

Parameters

const TDesC & aWildName
const TDesC & aScanDir
CDesCArraySeg & aThemeList

MatchingFoldersL(const TDesC &, const TDesC &, CDesCArraySeg &)

TInt MatchingFoldersL(const TDesC &aWildName,
const TDesC &aScanDir,
CDesCArraySeg &aThemeList
)[private]

Parameters

const TDesC & aWildName
const TDesC & aScanDir
CDesCArraySeg & aThemeList

NewL(CRepository &)

IMPORT_C ChspsDefinitionRepository *NewL(CRepository &aCentralRepository)[static]

Two-phased constructor.

Since
S60 5.0

Parameters

CRepository & aCentralRepository

OpenFileStoreLC(const TDesC &)

CFileStore *OpenFileStoreLC(const TDesC &aPath)[private]

Parameters

const TDesC & aPath

ReadFromFileL(const TDesC &, ChspsODT &)

TInt ReadFromFileL(const TDesC &aPath,
ChspsODT &aODT
)[private]

Parameters

const TDesC & aPath
ChspsODT & aODT

RegisterNotification(ThspsRepositoryInfo)

IMPORT_C voidRegisterNotification(ThspsRepositoryInfoaRepositoryInfo)

GetRepositoryInfo Register a ThspsRepositoryInfo-object to the repository. Repository's responsibility is to notify its observers about the notification.

Since
S60 5.0

Parameters

ThspsRepositoryInfo aRepositoryInfois aThspsRepositorynfo-object to be registered.

RegisterObserverL(const MhspsDefinitionRepositoryObserver &)

IMPORT_C voidRegisterObserverL(const MhspsDefinitionRepositoryObserver &aObserver)

RegisterObserverL ( ) Returns a refrence to a RArray-object containing changes in repository system. It is a responsibilty of the caller to lock the repository for modifications.

Since
S60 5.0

Parameters

const MhspsDefinitionRepositoryObserver & aObserveris a MhspsDefinitionRepositoryObserver-object to be registered.

RemoveDirectoryL()

voidRemoveDirectoryL()[private]

RemoveDirectoryL(TDesC &)

voidRemoveDirectoryL(TDesC &aDirPath)[private]

Parameters

TDesC & aDirPath

RemoveThemeL(const ChspsODT &)

IMPORT_C voidRemoveThemeL(const ChspsODT &aODT)

Removes the theme specific ODT and definition files from the repository. ODT header information works as a mask, which defines the level of removal. A single theme, all themes from a provider or all application specific themes can be removed at once.

Since
S60 5.0

Parameters

const ChspsODT & aODTContains the header information. Leaves if information is not valid.

RestoreBackupConfiguration(const ChspsODT &)

IMPORT_C TIntRestoreBackupConfiguration(const ChspsODT &aODT)
Restores a defined configuration from backup folder
Since
S60 5.0

Parameters

const ChspsODT & aODTODT header defining the configuration to be restored

SelectFilesFromPathL(CDesCArraySeg &, const TDesC &, TEntryKey, const TDesC &)

voidSelectFilesFromPathL(CDesCArraySeg &aFileList,
const TDesC &aPath,
TEntryKeyaSortFlag,
const TDesC &aFileExtension
)[private]

Parameters

CDesCArraySeg & aFileList
const TDesC & aPath
TEntryKey aSortFlag
const TDesC & aFileExtension

SetLocaleL(ChspsODT &, ChspsResource &)

IMPORT_C TIntSetLocaleL(ChspsODT &aODT,
ChspsResource &aResource
)

Saves the localisation file into repository. ODT must contain the valid header information, which is used to define the location for the file. Updates resource object with the new location. Leaves if original file does not exist or information is not valid.

Since
S60 5.0

Parameters

ChspsODT & aODTContains the header information.
ChspsResource & aResourceThe resource file to be saved.

SetLogBus(void *)

IMPORT_C voidSetLogBus(void *aLogBus)

Set log bus. Empty implementation if non HSPS_LOG_ACTIVE build.

Since
S60 5.0

Parameters

void * aLogBusLog bus to be set.

SetOdtL(const ChspsODT &)

IMPORT_C TIntSetOdtL(const ChspsODT &aODT)

Saves the ODT data structure into the repository. The location of the data is defined from the ODT's header information.

Since
S60 5.0

Parameters

const ChspsODT & aODTThe actual data to be stored.

SetResourceL(const ChspsODT &, const CFbsBitmap &, ChspsResource &)

IMPORT_C TIntSetResourceL(const ChspsODT &aODT,
const CFbsBitmap &aFbsBitmap,
ChspsResource &aResource
)

Saves the resource into the repository.

Since
S60 5.0

Parameters

const ChspsODT & aODTContains the header information.
const CFbsBitmap & aFbsBitmapbitmap to store to repository.
ChspsResource & aResourceresource where path is stored. Leaves if original file does not exist.

SetResourceListL(ChspsODT &, const CArrayPtrSeg< ChspsResource > &)

IMPORT_C TIntSetResourceListL(ChspsODT &aODT,
const CArrayPtrSeg< ChspsResource > &aResourceList
)

Stores the resource list to the repository. Every registered resource has an own entry in the array. Leaves if the repository is corrupted. Use RemoveThemeL to remove the corrupted repository.

Since
S60 5.0

Parameters

ChspsODT & aODTContains the header information.
const CArrayPtrSeg< ChspsResource > & aResourceListresource list to store to repository.

SetupPropertiesL(const TUint)

voidSetupPropertiesL(const TUintaKey)[private]

Parameters

const TUint aKey

StreamHeaderFromFileL(const TDesC &)

HBufC8 *StreamHeaderFromFileL(const TDesC &aPath)[private]

Parameters

const TDesC & aPath

Unlock()

IMPORT_C voidUnlock()

Decreases the semaphore controlling repository locking. Semaphore minimun value is 0 meaning unlocked situation.

Since
S60 5.0

UnregisterObserver(const MhspsDefinitionRepositoryObserver &)

IMPORT_C voidUnregisterObserver(const MhspsDefinitionRepositoryObserver &aObserver)

UnregisterObserver Returns a refrence to a RArray-object containing changes in repository system. It is a responsibilty of the caller to lock the repository for modifications.

Since
S60 5.0

Parameters

const MhspsDefinitionRepositoryObserver & aObserveris a MhspsDefinitionRepositoryObserver-object to be unregistered.

WriteToFileL(const ChspsODT &)

TInt WriteToFileL(const ChspsODT &aODT)[private]

Parameters

const ChspsODT & aODT

Member Data Documentation

ChspsODT * iCacheLastODT

ChspsODT *iCacheLastODT[private]

CRepository & iCentralRepository

CRepository &iCentralRepository[private]

RFs iFs

RFs iFs[private]

TBool iLicenseDefault

TBool iLicenseDefault[private]

TInt iLockSemaphore

TInt iLockSemaphore[private]

RPointerArray< MhspsDefinitionRepositoryObserver > iObservers

RPointerArray< MhspsDefinitionRepositoryObserver >iObservers[private]

HBufC * iPath

HBufC *iPath[private]

RProperty iProperty

RProperty iProperty[private]

RArray< ThspsRepositoryInfo > iRepositoryInfoQueue

RArray< ThspsRepositoryInfo >iRepositoryInfoQueue[private]

TFileName iTempFileName1

TFileName iTempFileName1[private]

TFileName iTempFileName2

TFileName iTempFileName2[private]