22 #define impl_afw_object_get_meta \
23 afw_object_impl_internal_get_meta
25 #define impl_afw_object_get_property_meta \
26 afw_object_impl_internal_get_property_meta
28 #define impl_afw_object_get_next_property_meta \
29 afw_object_impl_internal_get_next_property_meta
32 #define AFW_IMPLEMENTATION_ID "afw_object_view"
39 #define impl_meta_property_type_get(self, property_name, xctx) \
40 afw_object_meta_get_property_type( \
41 ((const afw_object_t *)self), \
47 impl_shared_string_value(
54 impl_shared_path_value(
77 impl_additional_object_option_processing(
83 impl_add_origin_properties(
89 impl_merge_properties(
102 impl_add_inherited_properties(
108 impl_get_object_by_uri(
115 impl_object_create_entity(
136 impl_meta_set_property(
144 property_name, value, xctx);
148 impl_meta_set_property_type_property(
157 property_type_id, property_name, value, xctx);
162 impl_shared_string_value(
173 value = apr_hash_get(view->
string_values, string->s, string->len);
176 value->internal.s =
string->s;
177 value->internal.len =
string->len;
179 value->internal.s, value->internal.len, value);
187 impl_shared_path_value(
204 value = apr_hash_get(view->
path_values, path->s, path->len);
206 for (c = path->s, len = path->len; len > 0; c++, len--) {
213 parsed->normalized_uri.s, parsed->normalized_uri.len);
216 value->internal.s = parsed->normalized_uri.s;
217 value->internal.len = parsed->normalized_uri.len;
219 value->internal.s, value->internal.len, value);
222 path->s, path->len, value);
230 value->internal.s = path->s;
231 value->internal.len = path->len;
233 path->s, path->len, value);
262 result = original_value;
266 embedded_object = impl_object_create(
267 view,
self, property_name,
280 for (iterator = NULL;;) {
284 if (!original_entry_value) {
287 value = impl_make_value(
self, origin, property_name,
288 original_entry_value, xctx);
306 for (prop = self->first_property;
308 prop = prop->next_property);
331 prop->origin = origin;
332 prop->name = property_name;
333 prop->value = impl_make_value(
self, origin,
334 prop->name, original_value, xctx);
335 prop->next_property =
self->first_property;
336 self->first_property = prop;
343 impl_update_property_value(
351 prop = impl_get_property(
self, property_name);
354 "Internal error - impl_update_property_value()",
364 impl_normalize_value(
395 impl_object_type_related_object_option_processing(
423 if (!object_type_id) {
424 object_type_id = &afw_s__AdaptiveObject_;
433 " needed for normalize object option is not found",
442 if (check_required || include_defaults) {
443 for (iterator = NULL;;) {
445 object_type, &iterator, &property_name, xctx);
463 &afw_s_afw_memory_t))
466 ->
internal.size == 0)
474 if (include_defaults) {
475 value = pt->default_value;
477 impl_set_property(
self, pt->property_type_object,
478 property_name, value, xctx);
481 if (!value && check_required && pt->required) {
483 property_name,
"value required", xctx);
492 for (iterator = NULL;;) {
494 &iterator, &property_name, xctx);
499 property_name, xctx);
502 "no property type", xctx);
507 new_value = impl_normalize_value(
self, pt,
508 property_name, value, xctx);
509 if (new_value != value) {
510 impl_update_property_value(
self, property_name, new_value, xctx);
522 object_type->object_type_object,
530 for (iterator = NULL;;) {
532 &iterator, &property_name, xctx);
541 property_name, xctx);
544 if (value_data_type && (!pt || value_data_type != pt->data_type))
546 s_value = impl_shared_string_value(view,
547 &value_data_type->data_type_id, xctx);
549 property_name, &afw_s_dataType, s_value, xctx);
563 pt->property_type_object,
564 &afw_s_dataTypeParameter,
568 s_value = impl_shared_string_value(view,
569 object_type_id, xctx);
571 property_name, &afw_s_dataTypeParameter, s_value, xctx);
590 impl_additional_object_option_processing(
616 impl_object_type_related_object_option_processing(
self, xctx);
621 !self->pub.meta.embedding_object)
623 if (self->pub.meta.id) {
624 v = impl_shared_string_value(self->view, self->pub.meta.id, xctx);
634 v = impl_shared_string_value(self->view,
637 impl_meta_set_property(
self, &afw_s_objectType, v, xctx);
643 !self->pub.meta.embedding_object) ||
645 self->pub.meta.embedding_object))
647 if (!self->pub.meta.object_uri) {
651 if (self->pub.meta.object_uri) {
652 v = impl_shared_path_value(
self, self->pub.meta.object_uri, xctx);
653 impl_meta_set_property(
self, &afw_s_path, v, xctx);
668 for (iterator = NULL;;) {
673 v = impl_shared_path_value(
self, path, xctx);
679 impl_meta_set_property(
self, &afw_s_resolvedParentPaths,
683 &afw_s_parentPaths, NULL, xctx);
687 impl_meta_set_property(
self, &afw_s_parentPaths,
695 for (prop = self->first_property; prop; prop = prop->next_property)
697 if (prop->origin != self->origin) {
701 "Property %" AFW_UTF8_FMT " is missing path for inheritedFrom",
704 v = impl_shared_path_value(
self, path, xctx);
705 impl_meta_set_property_type_property(
self,
706 prop->name, &afw_s_inheritedFrom,
713 for (prop = self->first_property; prop; prop = prop->next_property)
716 impl_additional_object_option_processing(
726 impl_resolve_parents(
741 origin =
self->origin;
744 if (!parent_paths)
return;
754 for (iterator = NULL;;) {
759 *parent++ = impl_get_object_by_uri(path,
self, xctx);
767 xctx,
"Error resolving parentPaths - %s",
776 impl_merge_properties(
792 for (count = 0, ancestor = parent;
795 !ancestor->inherited_properties_being_added &&
796 !ancestor->inherited_properties_added;
808 for (ancestor = parent; count > 0; count--)
810 for (obj = ancestor, count2 = count; count2 > 1; count2--)
815 impl_add_inherited_properties(obj, xctx);
826 for (parent_prop = parent->first_property;
828 parent_prop = parent_prop->next_property)
830 self_prop = impl_get_property(
self, parent_prop->name);
832 impl_set_property(
self,
833 parent_prop->origin, parent_prop->name, parent_prop->value, xctx);
839 impl_merge_properties(
852 impl_add_inherited_properties(
862 if (self->inherited_properties_added) {
864 #ifdef __AFW_OBJECT_VIEW_DEBUG__
873 #ifdef __AFW_OBJECT_VIEW_DEBUG__
880 if (self->inherited_properties_being_added) {
883 "parentPaths recursion loop while processing %" AFW_UTF8_FMT,
886 self->inherited_properties_being_added =
true;
889 impl_resolve_parents(
self, xctx);
891 for (parent = self->parents; *parent; parent++) {
892 impl_merge_properties(
self, *parent, xctx);
897 for (prop = self->first_property; prop; prop = prop->next_property)
900 impl_add_inherited_properties(
908 self->inherited_properties_being_added =
false;
909 self->inherited_properties_added =
true;
912 #ifdef __AFW_OBJECT_VIEW_DEBUG__
921 impl_add_origin_properties(
930 for (iterator = NULL;;) {
935 impl_set_property(
self, self->origin, name, value, xctx);
943 impl_get_object_by_uri(
959 view = current->view;
966 uri_parsed =
afw_uri_parse(uri,
true, current_path, p, xctx);
967 path_parsed = uri_parsed->path_parsed;
970 for (entity = view->
main_entity; entity; entity = entity->next_entity) {
972 &uri_parsed->normalized_uri))
976 if (entity->uri_parsed->path_parsed &&
977 uri_parsed->path_parsed &&
979 &entity->uri_parsed->path_parsed->entity_path,
980 &uri_parsed->path_parsed->entity_path))
992 &path_parsed->adaptor_id,
993 &path_parsed->object_type_id,
994 &path_parsed->entity_object_id,
998 NULL, view->
p, xctx);
999 if (!
object)
goto error;
1000 entity_uri_parsed = uri_parsed;
1001 if (path_parsed && path_parsed->first_property_name) {
1003 &uri_parsed->path_parsed->entity_path,
true, current_path, p, xctx);
1005 entity = impl_object_create_entity(view,
object, entity_uri_parsed, xctx);
1011 "Not implemented - only local path supported", xctx);
1023 for (name = path_parsed->first_property_name; name; name = name->next) {
1026 (
const afw_object_t *)result, &name->property_name, xctx);
1038 " not found or invalid",
1044 impl_object_create_entity(
1052 #ifdef __AFW_OBJECT_VIEW_DEBUG__
1056 self = impl_object_create(view, NULL, NULL, origin, uri_parsed, xctx);
1059 #ifdef __AFW_OBJECT_VIEW_DEBUG__
1066 impl_add_inherited_properties(
self, xctx);
1068 #ifdef __AFW_OBJECT_VIEW_DEBUG__
1101 self->pub.inf = &impl_afw_object_inf;
1104 self->pub.meta.embedding_object = (
const afw_object_t *)embedding_object;
1105 self->pub.meta.id = property_name;
1107 self->origin = origin;
1108 self->uri_parsed = uri_parsed;
1116 if (uri_parsed && uri_parsed->path_parsed) {
1117 self->pub.meta.object_type_uri =
1118 &uri_parsed->path_parsed->object_type_id;
1119 self->pub.meta.id = &uri_parsed->path_parsed->entity_object_id;
1120 if (uri_parsed->path_parsed->first_property_name) {
1122 "Dotted property names in object id not allowed here",
1125 self->pub.meta.object_uri = &uri_parsed->path_parsed->normalized_path;
1132 if (!embedding_object) {
1136 self->next_entity = view->
main_entity->next_entity;
1143 if (uri_parsed && uri_parsed->path_parsed) {
1144 impl_meta_set_property(
self, &afw_s_path, value, xctx);
1148 impl_add_origin_properties(
self, xctx);
1229 prop = impl_get_property(
self, property_name);
1231 return (prop) ? prop->value : NULL;
1253 prop =
self->first_property;
1266 if (property_name) {
1267 *property_name = NULL;
1274 result = prop->value;
1275 if (property_name) {
1276 *property_name = prop->name;
1296 property_name, xctx) != NULL);
1340 if (!options || options->mask == 0)
1349 view->reference_count = 1;
1360 view->
uri_parsed->path_parsed->adaptor_id.len == 0)
1363 "Entity path required for afw_object_view_create()",
1372 self = impl_object_create_entity(view, instance, view->
uri_parsed, xctx);
1375 impl_additional_object_option_processing(
self, xctx);
1386 impl_meta_set_property(
self, &afw_s_reconcilable, value, xctx);
AFW_DEFINE(const afw_object_t *)
Adaptive Framework Core Internal.
Interface afw_interface implementation declares.
afw_adaptor_get_object_type(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_object_t *journal_entry, afw_xctx_t *xctx)
Get and cache AdaptiveObjectType object.
afw_adaptor_get_object(const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, const afw_object_options_t *options, const afw_query_criteria_t *criteria, const afw_object_t *journal_entry, const afw_object_t *adaptor_type_specific, const afw_pool_t *p, afw_xctx_t *xctx)
Get and cache object.
afw_integer_t afw_atomic_integer_decrement(AFW_ATOMIC afw_integer_t *mem)
Integer atomic decrement.
afw_integer_t afw_atomic_integer_increment(AFW_ATOMIC afw_integer_t *mem)
Integer atomic increment.
afw_value_create_anyURI(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type anyURI value.
afw_data_type_anyURI
Data type struct for anyURI.
afw_value_allocate_anyURI(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type anyURI value.
afw_value_create_list(const afw_list_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type list value.
afw_value_allocate_list(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type list value.
#define afw_value_is_list(A_VALUE)
Macro to determine if value is evaluated list.
#define afw_value_is_object(A_VALUE)
Macro to determine if value is evaluated object.
#define afw_object_old_get_property_as_object(object, property_name, xctx)
Get property function for data type object value.
afw_value_create_object(const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type object value.
afw_value_evaluated_object_inf
Unmanaged evaluated value inf for data type object.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
#define afw_object_old_get_property_as_string(object, property_name, xctx)
Get property function for data type string value.
afw_value_allocate_string(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for unmanaged data type string value.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
struct afw_iterator_s afw_iterator_t
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
apr_size_t afw_size_t
size_t.
#define AFW_CATCH_UNHANDLED
Catch an unhandled error that occurs in a AFW_TRY block.
#define AFW_ENDTRY
Ends an AFW try block.
#define AFW_TRY
Begin an AFW TRY block.
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
#define AFW_ERROR_THROWN
Access the thrown error. See AFW_TRY.
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
const afw_utf8_t * afw_json_from_value(const afw_value_t *value, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx)
Convert an adaptive value to JSON.
#define afw_list_get_next_value(instance, iterator, p, xctx)
Call method get_next_value of interface afw_list.
#define afw_list_get_data_type(instance, xctx)
Call method get_data_type of interface afw_list.
#define afw_list_get_count(instance, xctx)
Call method get_count of interface afw_list.
afw_list_of_utf8_get_next(const afw_list_t *instance, const afw_iterator_t **iterator, afw_xctx_t *xctx)
Get next value from list whose data type cType is afw_utf8_t.
afw_list_add_value(const afw_list_t *instance, const afw_value_t *value, afw_xctx_t *xctx)
Call method add_value of interface afw_list_setter.
#define afw_list_of_create(data_type, p, xctx)
Create an list of a specific data type in memory.
#define AFW_LOG_FZ(priority, xctx, format_z,...)
Log an message to environment's log using a printf style format and parameters.
const afw_object_setter_t * impl_afw_object_get_setter(const afw_object_t *instance, afw_xctx_t *xctx)
void impl_afw_object_add_reference(const afw_object_t *instance, afw_xctx_t *xctx)
const afw_value_t * impl_afw_object_get_next_property(const afw_object_t *instance, const afw_iterator_t **iterator, const afw_utf8_t **property_name, afw_xctx_t *xctx)
void impl_afw_object_release(const afw_object_t *instance, afw_xctx_t *xctx)
const afw_value_t * impl_afw_object_get_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
afw_boolean_t impl_afw_object_has_property(const afw_object_t *instance, const afw_utf8_t *property_name, afw_xctx_t *xctx)
afw_size_t impl_afw_object_get_count(const afw_object_t *instance, afw_xctx_t *xctx)
#define afw_object_get_property(instance, property_name, xctx)
Call method get_property of interface afw_object.
#define afw_object_add_reference(instance, xctx)
Call method add_reference of interface afw_object.
#define afw_object_get_next_property(instance, iterator, property_name, xctx)
Call method get_next_property of interface afw_object.
#define AFW_OBJECT_OPTION_IS(_options, _option)
Test mask.
afw_object_options_create(const afw_object_options_t *initial_options, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx)
Create a options.
afw_object_options_reconcilable_meta_property
Object processing options to produce reconcilable meta property.
afw_object_type_property_type_get(const afw_object_type_t *object_type, const afw_utf8_t *property_name, afw_xctx_t *xctx)
Get property type object for property.
afw_object_type_property_type_get_next(const afw_object_type_t *object_type, const afw_iterator_t **iterator, const afw_utf8_t **property_name, afw_xctx_t *xctx)
Get next property type for object type.
afw_object_type_property_type_normalize(const afw_object_type_property_type_t *pt, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Normalize a value based on property type.
afw_object_view_create(const afw_object_t *instance, const afw_utf8_t *entity_path, const afw_object_options_t *options, const afw_pool_t *p, afw_xctx_t *xctx)
Create an object view of an object in specified pool.
#define AFW_OBJECT_GET_ENTITY(entity, object)
Macro to get entity for object.
#define AFW_OBJECT_S_PN_OBJECT_ID
String pseudo meta property name for objectId.
#define afw_object_create_managed(p, xctx)
Create an empty entity object in its own pool.
#define afw_pool_malloc(instance, size, xctx)
Call method malloc of interface afw_pool.
#define afw_pool_get_apr_pool(instance)
Call method get_apr_pool of interface afw_pool.
#define afw_pool_release(instance, xctx)
Call method release of interface afw_pool.
#define afw_pool_calloc_type(instance, type, xctx)
Macro to allocate cleared memory to hold type in pool.
const afw_pool_t * afw_pool_create(const afw_pool_t *parent, afw_xctx_t *xctx)
Create a new pool.
afw_uri_parse(const afw_utf8_t *uri, afw_boolean_t is_value_path, const afw_utf8_t *current_path, const afw_pool_t *p, afw_xctx_t *xctx)
Parse a URI in specific pool.
afw_boolean_t afw_utf8_equal(const afw_utf8_t *s1, const afw_utf8_t *s2)
Check to see if a string equals another string.
#define afw_value_get_data_type(instance, xctx)
Call method get_data_type of interface afw_value.
Interface afw_data_type public struct.
Interface afw_list public struct.
Struct for object processing options.
Typedef for parsed object path.
Property name path struct.
Interface afw_object public struct.
Interface afw_object_setter public struct.
Struct for afw_object_type_property_type_t.
Struct for afw_object_type_t.
apr_hash_t * string_values
Shared string values.
afw_object_view_internal_object_self_t * main_entity
First loaded entity.
const afw_object_t * journal_entry
Journal entry used during path resolution.
const afw_uri_parsed_t * uri_parsed
Parsed URI for view entity.
const afw_pool_t * p
Pool used for all resources in view.
const afw_object_options_t * options
View options.
apr_hash_t * path_values
Shared path values.
const afw_utf8_t * adaptor_id
Parsed URI for view entity.
Interface afw_pool public struct.
Typedef for parsed URI returned from afw_uri_parse().
NFC normalized UTF-8 string.
struct for data type anyURI values.
struct for data type base64Binary values.
struct for data type list values.
struct for data type object values.
Interface afw_value public struct.
struct for data type string values.
Interface afw_xctx public struct.