summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/persistence_client_library.c4
-rw-r--r--src/persistence_client_library_custom_loader.c86
-rw-r--r--src/persistence_client_library_db_access.c167
-rw-r--r--src/persistence_client_library_db_access.h23
-rw-r--r--src/persistence_client_library_prct_access.c63
-rw-r--r--src/persistence_client_library_prct_access.h2
6 files changed, 233 insertions, 112 deletions
diff --git a/src/persistence_client_library.c b/src/persistence_client_library.c
index e0c7d9b..022e2a4 100644
--- a/src/persistence_client_library.c
+++ b/src/persistence_client_library.c
@@ -205,9 +205,11 @@ static int private_pclInitLibrary(const char* appName, int shutdownMode)
DLT_LOG(gPclDLTContext, DLT_LOG_INFO, DLT_STRING("PAS interface not enabled, enable with \"./configure --enable-pasinterface\""));
#endif
- if(load_custom_plugins(customAsyncInitClbk) < 0) // load custom plugins
+ if((rval = load_custom_plugins(customAsyncInitClbk)) < 0) // load custom plugins
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("Failed to load custom plugins"));
+ pthread_mutex_unlock(&gDbusPendingRegMtx);
+ return rval;
}
init_key_handle_array();
diff --git a/src/persistence_client_library_custom_loader.c b/src/persistence_client_library_custom_loader.c
index be07b40..95235e3 100644
--- a/src/persistence_client_library_custom_loader.c
+++ b/src/persistence_client_library_custom_loader.c
@@ -320,7 +320,10 @@ int load_default_library(void* handle)
if(handle != NULL)
{
+ void * tmpLibVar = NULL;
+
/// D A T A B A S E F U N C T I O N S
+ // if a function could not be loaded, this is not an error
*(void **) (&plugin_persComDbOpen) = dlsym(handle, "persComDbOpen");
if ((error = dlerror()) != NULL)
{
@@ -380,45 +383,93 @@ int load_default_library(void* handle)
}
/// V A R I A B L E S
- plugin_gUser = *(char**)dlsym(handle, "gUser");
- if ((error = dlerror()) != NULL)
+ // it is an error if varaibles coulr not be loaded, and will cause an error
+ tmpLibVar = dlsym(handle, "gUser");
+ if(tmpLibVar != 0)
+ {
+ plugin_gUser = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalWt = *(char**)dlsym(handle, "gLocalWt");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalWt");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalWt = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gSeat = *(char**)dlsym(handle, "gSeat");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gSeat");
+ if(tmpLibVar != 0)
+ {
+ plugin_gSeat = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalFactoryDefault = *(char**)dlsym(handle, "gLocalFactoryDefault");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalFactoryDefault");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalFactoryDefault = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalCached = *(char**) dlsym(handle, "gLocalCached");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalCached");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalCached = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gNode = *(char**)dlsym(handle, "gNode");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gNode");
+ if(tmpLibVar != 0)
+ {
+ plugin_gNode = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gLocalConfigurableDefault = *(char**)dlsym(handle, "gLocalConfigurableDefault");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gLocalConfigurableDefault");
+ if(tmpLibVar != 0)
+ {
+ plugin_gLocalConfigurableDefault = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
- plugin_gResTableCfg = *(char**)dlsym(handle, "gResTableCfg");
- if ((error = dlerror()) != NULL)
+
+ tmpLibVar = dlsym(handle, "gResTableCfg");
+ if(tmpLibVar != 0)
+ {
+ plugin_gResTableCfg = *(char**)tmpLibVar;
+ }
+ else
{
DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("load_default_library - error:"), DLT_STRING(error));
+ rval = EPERS_NO_PLUGIN_VAR;
}
}
else
@@ -653,11 +704,10 @@ int load_custom_plugins(plugin_callback_async_t pfInitCompletedCB)
{
if(getCustomLoadingType(i) == LoadType_PclInit) // check if the plugin must be loaded on pclInitLibrary
{
- if(load_custom_library(i, &gPersCustomFuncs[i] ) <= 0)
+ if((rval = load_custom_library(i, &gPersCustomFuncs[i] )) <= 0)
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("load_custom_plugins => E r r o r could not load plugin: "),
DLT_STRING(get_custom_client_lib_name(i)));
- rval = EPERS_COMMON;
}
}
}
diff --git a/src/persistence_client_library_db_access.c b/src/persistence_client_library_db_access.c
index 6c40d3f..9b31400 100644
--- a/src/persistence_client_library_db_access.c
+++ b/src/persistence_client_library_db_access.c
@@ -92,15 +92,23 @@ static int database_get(PersistenceInfo_s* info, const char* dbPath, int dbType)
if (handleDB == -1)
{
- handleDB = plugin_persComDbOpen(path, openFlags);
- if(handleDB >= 0)
+ if(*plugin_persComDbOpen != NULL)
{
- gHandlesDB[arrayIdx][dbType] = handleDB ;
- gHandlesDBCreated[arrayIdx][dbType] = 1;
+ handleDB = plugin_persComDbOpen(path, openFlags);
+ if(handleDB >= 0)
+ {
+ gHandlesDB[arrayIdx][dbType] = handleDB ;
+ gHandlesDBCreated[arrayIdx][dbType] = 1;
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - persComDbOpen() failed"));
+ }
}
else
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - persComDbOpen() failed"));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbGet - EPERS_NO_PLUGIN_FUNCT"));
+ handleDB = EPERS_NO_PLUGIN_FUNCT;
}
}
else
@@ -134,11 +142,23 @@ int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
{
if (PersGetDefault_Data == job)
{
- read_size = plugin_persComDbReadKey(handleDefaultDB, key, (char*)buffer, (signed int)buffer_size);
+ if(*plugin_persComDbReadKey != NULL)
+ read_size = plugin_persComDbReadKey(handleDefaultDB, key, (char*)buffer, (signed int)buffer_size);
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDefaults - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else if (PersGetDefault_Size == job)
{
- read_size = plugin_persComDbGetKeySize(handleDefaultDB, key);
+ if(*plugin_persComDbGetKeySize != NULL)
+ read_size = plugin_persComDbGetKeySize(handleDefaultDB, key);
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDefaults - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else
{
@@ -191,15 +211,22 @@ void database_close_all()
{
if(gHandlesDBCreated[i][j] == 1)
{
- int iErrorCode = plugin_persComDbClose(gHandlesDB[i][j]);
- if (iErrorCode < 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - Err close db"));
- }
- else
- {
- gHandlesDBCreated[i][j] = 0;
- }
+ if(*plugin_persComDbClose != NULL)
+ {
+ int iErrorCode = plugin_persComDbClose(gHandlesDB[i][j]);
+ if (iErrorCode < 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - Err close db"));
+ }
+ else
+ {
+ gHandlesDBCreated[i][j] = 0;
+ }
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("dbCloseAll - plugin function NULL"));
+ }
}
}
}
@@ -217,10 +244,18 @@ int persistence_get_data(char* dbPath, char* key, const char* resourceID, Persis
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
- read_size = plugin_persComDbReadKey(handleDB, key, (char*)buffer, buffer_size);
- if(read_size < 0)
+ if(*plugin_persComDbReadKey != NULL)
{
- read_size = pers_get_defaults(dbPath, (char*)resourceID, info, buffer, (unsigned int)buffer_size, PersGetDefault_Data); /* 0 ==> Get data */
+ read_size = plugin_persComDbReadKey(handleDB, key, (char*)buffer, buffer_size);
+ if(read_size < 0)
+ {
+ read_size = pers_get_defaults(dbPath, (char*)resourceID, info, buffer, (unsigned int)buffer_size, PersGetDefault_Data); /* 0 ==> Get data */
+ }
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getData - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
}
}
}
@@ -330,23 +365,31 @@ int persistence_set_data(char* dbPath, char* key, const char* resource_id, Persi
if(handleDB >= 0)
{
- write_size = plugin_persComDbWriteKey(handleDB, dbInput, (char*)buffer, buffer_size) ;
- if(write_size < 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - persComDbWriteKey() failure"));
- }
- else
+ if(*plugin_persComDbWriteKey != NULL)
{
- if(PersistenceStorage_shared == info->configKey.storage)
+ write_size = plugin_persComDbWriteKey(handleDB, dbInput, (char*)buffer, buffer_size) ;
+ if(write_size < 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - persComDbWriteKey() failure"));
+ }
+ else
{
- int rval = pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_changed);
- if(rval <= 0)
+ if(PersistenceStorage_shared == info->configKey.storage)
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - Err to send noty sig"));
- write_size = rval;
+ int rval = pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_changed);
+ if(rval <= 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - Err to send noty sig"));
+ write_size = rval;
+ }
}
}
}
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("setData - EPERS_NO_PLUGIN_FUNCT"));
+ write_size = EPERS_NO_PLUGIN_FUNCT;
+ }
}
else
{
@@ -441,11 +484,18 @@ int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, P
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
-
- read_size = plugin_persComDbGetKeySize(handleDB, key);
- if(read_size < 0)
+ if(*plugin_persComDbGetKeySize != NULL)
+ {
+ read_size = plugin_persComDbGetKeySize(handleDB, key);
+ if(read_size < 0)
+ {
+ read_size = pers_get_defaults( dbPath, (char*)resourceID, info, NULL, 0, PersGetDefault_Size);
+ }
+ }
+ else
{
- read_size = pers_get_defaults( dbPath, (char*)resourceID, info, NULL, 0, PersGetDefault_Size);
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("getDataSize - EPERS_NO_PLUGIN_FUNCT"));
+ read_size = EPERS_NO_PLUGIN_FUNCT;
}
}
}
@@ -538,23 +588,31 @@ int persistence_delete_data(char* dbPath, char* key, const char* resource_id, Pe
int handleDB = database_get(info, dbPath, info->configKey.policy);
if(handleDB >= 0)
{
- ret = plugin_persComDbDeleteKey(handleDB, key) ;
- if(ret < 0)
+ if(*plugin_persComDbDeleteKey != NULL)
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - failed: "), DLT_STRING(key));
- if(PERS_COM_ERR_NOT_FOUND == ret)
+ ret = plugin_persComDbDeleteKey(handleDB, key) ;
+ if(ret < 0)
{
- ret = EPERS_NOKEY ;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - failed: "), DLT_STRING(key));
+ if(PERS_COM_ERR_NOT_FOUND == ret)
+ {
+ ret = EPERS_NOKEY ;
+ }
+ else
+ {
+ ret = EPERS_DB_ERROR_INTERNAL ;
+ }
}
- else
+
+ if(PersistenceStorage_shared == info->configKey.storage)
{
- ret = EPERS_DB_ERROR_INTERNAL ;
+ pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_deleted);
}
}
-
- if(PersistenceStorage_shared == info->configKey.storage)
+ else
{
- pers_send_Notification_Signal(resource_id, &info->context, pclNotifyStatus_deleted);
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("deleteData - EPERS_NO_PLUGIN_FUNCT"));
+ ret = EPERS_NO_PLUGIN_FUNCT;
}
}
else
@@ -708,7 +766,7 @@ int persistence_notify_on_change(const char* resource_id, const char* dbKey, uns
if(-1 == deliverToMainloop(&data))
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("notifyOnChange - Err to write to pipe"), DLT_INT(errno));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("notifyOnChange - Write to pipe"), DLT_INT(errno));
rval = -1;
}
@@ -741,7 +799,7 @@ int pers_send_Notification_Signal(const char* key, PersistenceDbContext_s* conte
if(-1 == deliverToMainloop(&data) )
{
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendNotifySig - Err write to pipe"), DLT_INT(errno));
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("sendNotifySig - Write to pipe"), DLT_INT(errno));
rval = EPERS_NOTIFY_SIG;
}
}
@@ -762,11 +820,18 @@ void pers_rct_close_all()
{
if(get_resource_cfg_table_by_idx(i) != -1)
{
- if(plugin_persComRctClose(get_resource_cfg_table_by_idx(i)) != 0)
- {
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - Err close db => index:"), DLT_INT(i));
- }
- invalidate_resource_cfg_table(i);
+ if(*plugin_persComRctClose != NULL)
+ {
+ if(plugin_persComRctClose(get_resource_cfg_table_by_idx(i)) != 0)
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - Close db => index:"), DLT_INT(i));
+ }
+ invalidate_resource_cfg_table(i);
+ }
+ else
+ {
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("prepShtdwn - No plugin function available"));
+ }
}
}
}
diff --git a/src/persistence_client_library_db_access.h b/src/persistence_client_library_db_access.h
index 5385dc3..ee97046 100644
--- a/src/persistence_client_library_db_access.h
+++ b/src/persistence_client_library_db_access.h
@@ -59,19 +59,6 @@ char* pers_get_raw_key(char *key);
/**
- * @brief open the default value database specified by the 'DefaultType'
- *
- * @param dbPath path to the directory were the databases are included in.
- * @param DefaultType the default type
- *
- * @return >= 0 for valid handler; if an error occured the following error code:
- * EPERS_COMMON
- */
-int pers_db_open_default(const char* dbPath, PersDefaultType_e DefaultType);
-
-
-
-/**
* @brief tries to get default values for a key from the configurable and factory default databases.
*
* @param dbPath the path to the directory where the default databases are in
@@ -83,7 +70,7 @@ int pers_db_open_default(const char* dbPath, PersDefaultType_e DefaultType);
*
* @return the number of bytes read or the size of the key (depends on parameter 'job').
negative value if an error occured and the following error code:
- * EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOKEY
*/
int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned char* buffer, unsigned int buffer_size, PersGetDefault_e job);
@@ -100,7 +87,7 @@ int pers_get_defaults(char* dbPath, char* key, PersistenceInfo_s* info, unsigned
* @param buffer_size the size of the buffer
*
* @return the number of bytes written or a negative value if an error occured with the following error codes:
- * EPERS_SETDTAFAILED EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_SETDTAFAILED EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
*/
int persistence_set_data(char* dbPath, char* key, const char* resource_id, PersistenceInfo_s* info, unsigned char* buffer, int buffer_size);
@@ -117,7 +104,7 @@ int persistence_set_data(char* dbPath, char* key, const char* resource_id, Persi
* @param buffer_size the size of the buffer
*
* @return the number of bytes read or a negative value if an error occured with the following error codes:
- * EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOPRCTABLE EPERS_NOKEYDATA EPERS_NOKEY
*/
int persistence_get_data(char* dbPath, char* key, const char* resourceID, PersistenceInfo_s* info, unsigned char* buffer, int buffer_size);
@@ -132,7 +119,7 @@ int persistence_get_data(char* dbPath, char* key, const char* resourceID, Persis
* @param info persistence information
*
* @return size of data in bytes read from the key or on error a negative value with the following error codes:
- * EPERS_NOPRCTABLE or EPERS_NOKEY
+ * EPERS_NO_PLUGIN_FUNCT, EPERS_NOPRCTABLE or EPERS_NOKEY
*/
int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, PersistenceInfo_s* info);
@@ -147,7 +134,7 @@ int persistence_get_data_size(char* dbPath, char* key, const char* resourceID, P
* @param info persistence information
*
* @return 0 if deletion was successfull;
- * or an error code: EPERS_DB_KEY_SIZE, EPERS_NOPRCTABLE, EPERS_DB_ERROR_INTERNAL or EPERS_NOPLUGINFUNCT
+ * or an error code: EPERS_NO_PLUGIN_FUNCT, EPERS_DB_KEY_SIZE, EPERS_NOPRCTABLE, EPERS_DB_ERROR_INTERNAL or EPERS_NOPLUGINFUNCT
*/
int persistence_delete_data(char* dbPath, char* key, const char* resource_id, PersistenceInfo_s* info);
diff --git a/src/persistence_client_library_prct_access.c b/src/persistence_client_library_prct_access.c
index db3860e..a983735 100644
--- a/src/persistence_client_library_prct_access.c
+++ b/src/persistence_client_library_prct_access.c
@@ -100,7 +100,7 @@ void invalidate_resource_cfg_table(int i)
int get_resource_cfg_table(PersistenceRCT_e rct, int group)
{
unsigned int arrayIdx = 0;
- int rval = -1;
+ int rval = EPERS_NOPRCTABLE;
// create array index: index is a combination of resource config table type and group
arrayIdx = (rct + (unsigned int)group);
@@ -126,16 +126,25 @@ int get_resource_cfg_table(PersistenceRCT_e rct, int group)
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - no valid PersistenceRCT_e"));
break;
}
- gResource_table[arrayIdx] = plugin_persComRctOpen(filename, 0x04); // 0x04 ==> open in read only mode
- if(gResource_table[arrayIdx] < 0)
+ if(*plugin_persComRctOpen != NULL)
{
- gResourceOpen[arrayIdx] = 0;
- DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - RCT problem"), DLT_INT(gResource_table[arrayIdx] ));
+ gResource_table[arrayIdx] = plugin_persComRctOpen(filename, 0x04); // 0x04 ==> open in read only mode
+
+ if(gResource_table[arrayIdx] < 0)
+ {
+ gResourceOpen[arrayIdx] = 0;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - RCT problem"), DLT_INT(gResource_table[arrayIdx] ));
+ }
+ else
+ {
+ gResourceOpen[arrayIdx] = 1 ;
+ }
}
else
{
- gResourceOpen[arrayIdx] = 1 ;
+ DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gRCT - no plugin function"));
+ rval = EPERS_NO_PLUGIN_FUNCT;
}
}
@@ -158,37 +167,45 @@ int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsign
if(handleRCT >= 0)
{
- PersistenceConfigurationKey_s sRctEntry ;
-
- // check if resouce id is in write through table
- int iErrCode = plugin_persComRctRead(handleRCT, resource_id, &sRctEntry) ;
-
- if(sizeof(PersistenceConfigurationKey_s) == iErrCode)
+ if(*plugin_persComRctRead != NULL)
{
- memcpy(&dbContext->configKey, &sRctEntry, sizeof(dbContext->configKey)) ;
- if(sRctEntry.storage != PersistenceStorage_custom )
+ PersistenceConfigurationKey_s sRctEntry ;
+
+ // check if resouce id is in write through table
+ int iErrCode = plugin_persComRctRead(handleRCT, resource_id, &sRctEntry) ;
+
+ if(sizeof(PersistenceConfigurationKey_s) == iErrCode)
{
- rval = get_db_path_and_key(dbContext, resource_id, dbKey, dbPath);
+ memcpy(&dbContext->configKey, &sRctEntry, sizeof(dbContext->configKey)) ;
+ if(sRctEntry.storage != PersistenceStorage_custom )
+ {
+ rval = get_db_path_and_key(dbContext, resource_id, dbKey, dbPath);
+ }
+ else
+ {
+ // if customer storage, we use the custom name as dbPath
+ strncpy(dbPath, dbContext->configKey.custom_name, strlen(dbContext->configKey.custom_name));
+
+ strncpy(dbKey, resource_id, strlen(resource_id)); // and resource_id as dbKey
+ }
+ resourceFound = 1;
}
else
{
- // if customer storage, we use the custom name as dbPath
- strncpy(dbPath, dbContext->configKey.custom_name, strlen(dbContext->configKey.custom_name));
-
- strncpy(dbKey, resource_id, strlen(resource_id)); // and resource_id as dbKey
+ DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - RCT: no value for key:"), DLT_STRING(resource_id) );
+ rval = EPERS_NOKEYDATA;
}
- resourceFound = 1;
}
else
{
- DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - RCT: no value for key:"), DLT_STRING(resource_id) );
- rval = EPERS_NOKEYDATA;
+ DLT_LOG(gPclDLTContext, DLT_LOG_WARN, DLT_STRING("gDBCtx - no plugin function available"));
+ rval = EPERS_NO_PLUGIN_FUNCT;
}
} // resource table
else
{
DLT_LOG(gPclDLTContext, DLT_LOG_ERROR, DLT_STRING("gDBCtx - RCT"));
- rval = EPERS_NOPRCTABLE;
+ rval = handleRCT;
}
if((resourceFound == 0) && (dbContext->context.ldbid == PCL_LDBID_LOCAL) ) // create only when the resource is local data
diff --git a/src/persistence_client_library_prct_access.h b/src/persistence_client_library_prct_access.h
index 1737497..2aa822e 100644
--- a/src/persistence_client_library_prct_access.h
+++ b/src/persistence_client_library_prct_access.h
@@ -46,7 +46,7 @@ int get_db_path_and_key(PersistenceInfo_s* dbContext, const char* resource_id, c
* @param dbKey the array where the database key will be stored
* @param dbPath the array where the database location path will be stored
*
- * @return 0 or a negative value with one of the following errors: EPERS_NOKEYDATA or EPERS_NOPRCTABLE
+ * @return 0 or a negative value with one of the following errors: EPERS_NO_PLUGIN_FUNCT, EPERS_NOKEYDATA or EPERS_NOPRCTABLE
*/
int get_db_context(PersistenceInfo_s* dbContext, const char* resource_id, unsigned int isFile, char dbKey[], char dbPath[]);