Adaptive Framework
0.9.0
|
Files | |
file | afw_adaptor_impl.h |
Helpers for adaptor implementation development. | |
Data Structures | |
struct | afw_adaptor_impl_core_object_type_s |
afw_adaptor_impl_t supported_core_object_types entry. More... | |
struct | afw_adaptor_impl_s |
Internal struct used by common adaptor code for all adaptors. More... | |
struct | afw_adaptor_impl_session_s |
Internal session info used by afw_adaptor_impl*() functions. More... | |
struct | afw_adaptor_impl_request_s |
Internal request info used by afw_adaptor_impl*() functions. More... | |
Macros | |
#define | AFW_ADAPTOR_IMPL_LOCK_READ_BEGIN(adaptor) AFW_LOCK_READ_BEGIN((adaptor)->impl->adaptor_lock_rw) |
Macro to begin an adaptor read lock section. More... | |
#define | AFW_ADAPTOR_IMPL_LOCK_READ_END AFW_LOCK_READ_END |
Macro to end an adaptor read lock section. More... | |
#define | AFW_ADAPTOR_IMPL_LOCK_WRITE_BEGIN(adaptor) AFW_LOCK_WRITE_BEGIN((adaptor)->impl->adaptor_lock_rw) |
Macro to begin an adaptor write lock section. More... | |
#define | AFW_ADAPTOR_IMPL_LOCK_WRITE_END AFW_LOCK_WRITE_END |
Macro to end an adaptor write lock section. More... | |
#define | AFW_ADAPTOR_IMPL_ERROR_ADAPTOR_IMMUTABLE AFW_THROW_ERROR_Z(read_only, "Adaptor is read-only.", xctx) |
Typedefs | |
typedef struct afw_adaptor_impl_core_object_type_s | afw_adaptor_impl_core_object_type_t |
afw_adaptor_impl_t supported_core_object_types entry. | |
Functions | |
afw_adaptor_t * | afw_adaptor_impl_create_cede_p (const afw_adaptor_inf_t *inf, afw_size_t instance_size, const afw_object_t *properties, const afw_pool_t *p, afw_xctx_t *xctx) |
Developers should call this in all create functions for afw_adaptor. More... | |
void | afw_adaptor_impl_object_type_cache_initialize (afw_adaptor_object_type_cache_t *object_type_cache, const afw_adaptor_object_type_cache_inf_t *inf, const afw_adaptor_session_t *session, afw_boolean_t all_object_types_immutable, afw_xctx_t *xctx) |
Initialize object type cache instance. More... | |
void | afw_adaptor_impl_set_object_types_fully_loaded (const afw_adaptor_t *adaptor, afw_xctx_t *xctx) |
Set object types fully loaded. More... | |
const afw_object_t * | afw_adaptor_impl_generic_object_type_object_get (const afw_adaptor_t *adaptor, const afw_utf8_t *object_type_id, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a generic object type object. More... | |
void | afw_adaptor_impl_push_qualifiers (const afw_adaptor_t *adaptor, afw_xctx_t *xctx) |
Push adaptor qualifiers to xctx. More... | |
void | afw_adaptor_impl_throw_property_invalid (const afw_adaptor_t *adaptor, const afw_utf8_t *property_name, afw_xctx_t *xctx) |
Developers should call this for configuration property errors. More... | |
void | afw_adaptor_impl_throw_property_required (const afw_adaptor_t *adaptor, const afw_utf8_t *property_name, afw_xctx_t *xctx) |
Developers should call this for missing required configuration property. More... | |
void | afw_adaptor_impl_call_object_cb_from_list (const afw_list_t *list, void *context, afw_object_cb_t callback, afw_xctx_t *xctx) |
Call object cb from list. More... | |
afw_boolean_t | afw_adaptor_impl_is_journal_entry_applicable (const afw_adaptor_journal_t *instance, const afw_object_t *entry, const afw_object_t *consumer, const afw_value_t *const *filter, afw_xctx_t *xctx) |
Determine whether a journal entry is applicable to a consumer. More... | |
void | afw_adaptor_impl_set_supported_core_object_type (const afw_adaptor_t *adaptor, const afw_utf8_t *object_type_id, afw_boolean_t allow_entity, afw_boolean_t allow_write, afw_xctx_t *xctx) |
Indicates support of a core object type. More... | |
Variables | |
afw_adaptor_impl_object_type_cache_inf | |
inf for an implementation of afw_adaptor_object_type_cache. More... | |
Helpers for afw_adapor implementations.
#define AFW_ADAPTOR_IMPL_LOCK_READ_BEGIN | ( | adaptor | ) | AFW_LOCK_READ_BEGIN((adaptor)->impl->adaptor_lock_rw) |
Macro to begin an adaptor read lock section.
adaptor | |
xctx | of caller. |
Usage:
AFW_ADAPTOR_IMPL_LOCK_READ_BEGIN(adaptor, xctx) { ... a very small amount of code that doesn't call anything that might lock this again. } AFW_ADAPTOR_IMPL_LOCK_READ_END;
Definition at line 43 of file afw_adaptor_impl.h.
#define AFW_ADAPTOR_IMPL_LOCK_READ_END AFW_LOCK_READ_END |
Macro to end an adaptor read lock section.
See AFW_ADAPTOR_IMPL_LOCK_READ_BEGIN for usage.
Definition at line 52 of file afw_adaptor_impl.h.
#define AFW_ADAPTOR_IMPL_LOCK_WRITE_BEGIN | ( | adaptor | ) | AFW_LOCK_WRITE_BEGIN((adaptor)->impl->adaptor_lock_rw) |
Macro to begin an adaptor write lock section.
adaptor | |
xctx | of caller. |
Usage:
AFW_ADAPTOR_IMPL_LOCK_WRITE_BEGIN(adaptor, xctx) { ... a very small amount of code that doesn't call anything that might lock this again. } AFW_ADAPTOR_IMPL_LOCK_WRITE_END;
Definition at line 69 of file afw_adaptor_impl.h.
#define AFW_ADAPTOR_IMPL_LOCK_WRITE_END AFW_LOCK_WRITE_END |
Macro to end an adaptor write lock section.
See AFW_ADAPTOR_IMPL_LOCK_WRITE_BEGIN for usage.
Definition at line 78 of file afw_adaptor_impl.h.
void afw_adaptor_impl_call_object_cb_from_list | ( | const afw_list_t * | list, |
void * | context, | ||
afw_object_cb_t | callback, | ||
afw_xctx_t * | xctx | ||
) |
Call object cb from list.
list | |
context | |
callback | |
xctx | of caller. |
Definition at line 446 of file afw_adaptor_impl.c.
afw_adaptor_t* afw_adaptor_impl_create_cede_p | ( | const afw_adaptor_inf_t * | inf, |
afw_size_t | instance_size, | ||
const afw_object_t * | properties, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Developers should call this in all create functions for afw_adaptor.
inf | afw_adaptor_inf_t pointer for implementation. |
instance_size | 0 or size greater than sizeof(afw_adaptor_t). |
properties | config object. |
start | is function to call to start adaptor. |
stop | is function to call to stop adaptor. |
p | to use as parent when creating adaptor pool. |
xctx | of caller. |
This function creates and initializes an afw_adaptor instance. After calling this function, the caller should do additional adaptor type specific processing. The instance_size parameter can be specified to get a larger instance size than sizeof(afw_adaptor_t) for adaptor type specific use.
A new pool is created in the callings xctx's pool for use by the adaptor.
This function validates and normalizes the adaptor properties based on /afw/_AdaptiveObjectType_/_AdaptiveConf_adaptor_<adaptorType>
, where <adaptorType>
is the value of the adaptorType property.
All properties from /afw/_AdaptiveObjectType_/_AdaptiveConf_adaptor are processed.
Some additional properties are processed if they pass validation. Properties isModelLocation and isPolicyLocation cause the appropriate core object types to be supported.
If this adaptorId is the layout adaptorId, the appropriate core object types are supported.
See afw_adaptor_impl_s for more information on how on how common adaptor code uses this information.
Definition at line 212 of file afw_adaptor_impl.c.
const afw_object_t* afw_adaptor_impl_generic_object_type_object_get | ( | const afw_adaptor_t * | adaptor, |
const afw_utf8_t * | object_type_id, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a generic object type object.
adaptor_id. | |
object_type_id. | |
p | to use for result. |
xctx | of caller. |
This can be used by adaptors that don't have specific object types to create generic object types to return on get_object.
Definition at line 580 of file afw_adaptor_impl.c.
afw_boolean_t afw_adaptor_impl_is_journal_entry_applicable | ( | const afw_adaptor_journal_t * | instance, |
const afw_object_t * | entry, | ||
const afw_object_t * | consumer, | ||
const afw_value_t *const * | filter, | ||
afw_xctx_t * | xctx | ||
) |
Determine whether a journal entry is applicable to a consumer.
afw_adaptor_journal | instance. |
entry | from journal. |
consumer | object. |
filter | should be initialized to NULL on first call and anytime the filter has changed. The value returned should be passed to subsequent calls. This holds the evaluated expression from the consumer filter property. |
xctx | of caller. |
Definition at line 470 of file afw_adaptor_impl.c.
void afw_adaptor_impl_object_type_cache_initialize | ( | afw_adaptor_object_type_cache_t * | object_type_cache, |
const afw_adaptor_object_type_cache_inf_t * | inf, | ||
const afw_adaptor_session_t * | session, | ||
afw_boolean_t | all_object_types_immutable, | ||
afw_xctx_t * | xctx | ||
) |
Initialize object type cache instance.
object_type_cache | to initialize. |
inf | for instance. |
session | for instance. |
all_object_types_immutable | for instance. |
xctx | of caller. |
This can be used in implementation of method afw_adaptor_session_get_index_interface to initialize afw_adaptor_object_type_cache_t to return. Parameter should probably be defined in the sessions self.
Definition at line 618 of file afw_adaptor_impl.c.
void afw_adaptor_impl_push_qualifiers | ( | const afw_adaptor_t * | adaptor, |
afw_xctx_t * | xctx | ||
) |
Push adaptor qualifiers to xctx.
adaptor. | |
xctx | of caller. |
Call this to add adaptor related qualifiers to xctx. Make sure to save and restore xctx->qualifier_stack->nelts.
Definition at line 194 of file afw_adaptor_impl.c.
void afw_adaptor_impl_set_object_types_fully_loaded | ( | const afw_adaptor_t * | adaptor, |
afw_xctx_t * | xctx | ||
) |
Set object types fully loaded.
This can be called by adaptor implementation to indicate that all object types that last for life of adaptor have been accessed at least once. This allows gets for unknown object types to fail quicker.
Definition at line 634 of file afw_adaptor_impl.c.
void afw_adaptor_impl_set_supported_core_object_type | ( | const afw_adaptor_t * | adaptor, |
const afw_utf8_t * | object_type_id, | ||
afw_boolean_t | allow_entity, | ||
afw_boolean_t | allow_write, | ||
afw_xctx_t * | xctx | ||
) |
Indicates support of a core object type.
adaptor. | |
object_type_id. | |
allow_entity | indicates adaptor allows entities of this type. |
allow_write | indicates adaptor can store instances of this type. |
xctx | of caller. |
afw_adaptor_impl_create_cede_p() calls this for AdaptiveObjectType with allow_write false. Other common conf parameters can cause allow_write to change to true and for other object types to be added.
After return from afw_adaptor_impl_create_cede_p(), an implementation can call this to add additional ids.
The common session impl code will use this information before calling a custom adaptor type implementation. This includes returning these object types for get/retrieve requests and insuring the objects are not modified if allow_write is false.
Definition at line 525 of file afw_adaptor_impl.c.
void afw_adaptor_impl_throw_property_invalid | ( | const afw_adaptor_t * | adaptor, |
const afw_utf8_t * | property_name, | ||
afw_xctx_t * | xctx | ||
) |
Developers should call this for configuration property errors.
adaptor. | |
property_name | this is in error. |
xctx | of caller. |
Definition at line 137 of file afw_adaptor_impl.c.
void afw_adaptor_impl_throw_property_required | ( | const afw_adaptor_t * | adaptor, |
const afw_utf8_t * | property_name, | ||
afw_xctx_t * | xctx | ||
) |
Developers should call this for missing required configuration property.
adaptor. | |
property_name | this is in error. |
xctx | of caller. |
Definition at line 158 of file afw_adaptor_impl.c.
afw_adaptor_impl_object_type_cache_inf |
inf for an implementation of afw_adaptor_object_type_cache.
This is the inf for an implementation of afw_adaptor_object_type_cache that provided life of the adaptor cache support for object types. The address of this can be passed as the inf parameter of afw_adaptor_impl_object_type_cache_initialize() if this meets the needs of the adaptor implementation.
Definition at line 334 of file afw_adaptor_impl.h.