static void celix_dmComponent_printFullInfo()

in libs/framework/src/dm_component_impl.c [1068:1114]


static void celix_dmComponent_printFullInfo(FILE *out, bool colors, celix_dm_component_info_t* compInfo) {
    const char *startColors = "";
    const char *endColors = "";
    if (colors) {
        startColors = compInfo->active ? CELIX_DM_PRINT_OK_COLOR : CELIX_DM_PRINT_NOK_COLOR;
        endColors = CELIX_DM_PRINT_END_COLOR;
    }
    fprintf(out, "%sComponent: Name=%s%s\n", startColors, compInfo->name, endColors);
    fprintf(out, "|- UUID   = %s\n", compInfo->id);
    fprintf(out, "|- Active = %s\n", compInfo->active ? "true" : "false");
    fprintf(out, "|- State  = %s\n", compInfo->state);
    fprintf(out, "|- Bundle = %li (%s)\n", compInfo->bundleId, compInfo->bundleSymbolicName);
    fprintf(out, "|- Nr of times started = %i\n", (int)compInfo->nrOfTimesStarted);
    fprintf(out, "|- Nr of times resumed = %i\n", (int)compInfo->nrOfTimesResumed);

    fprintf(out, "|- Interfaces (%d):\n", celix_arrayList_size(compInfo->interfaces));
    for (int interfCnt = 0; interfCnt < celix_arrayList_size(compInfo->interfaces); interfCnt++) {
        dm_interface_info_pt intfInfo = celix_arrayList_get(compInfo->interfaces, interfCnt);
        fprintf(out, "   |- %sInterface %i: %s%s\n", startColors, (interfCnt+1), intfInfo->name, endColors);

        hash_map_iterator_t iter = hashMapIterator_construct((hash_map_pt) intfInfo->properties);
        char *key = NULL;
        while ((key = hashMapIterator_nextKey(&iter)) != NULL) {
            fprintf(out, "      | %15s = %s\n", key, celix_properties_get(intfInfo->properties, key, "!ERROR!"));
        }
    }

    fprintf(out, "|- Dependencies (%d):\n", celix_arrayList_size(compInfo->dependency_list));
    for (int depCnt = 0; depCnt < celix_arrayList_size(compInfo->dependency_list); ++depCnt) {
        dm_service_dependency_info_pt dependency;
        dependency = celix_arrayList_get(compInfo->dependency_list, depCnt);
        const char *depStartColors = "";
        if (colors) {
            if (dependency->required) {
                depStartColors = dependency->available ? CELIX_DM_PRINT_OK_COLOR : CELIX_DM_PRINT_NOK_COLOR;
            } else {
                depStartColors = dependency->available ? CELIX_DM_PRINT_OK_COLOR : CELIX_DM_PRINT_WARNING_COLOR;
            }
        }
        fprintf(out, "   |- %sDependency %i: %s%s\n", depStartColors, (depCnt+1), dependency->serviceName == NULL ? "(any)" : dependency->serviceName, endColors);
        fprintf(out, "      | %15s = %s\n", "Available", dependency->available ? "true " : "false");
        fprintf(out, "      | %15s = %s\n", "Required", dependency->required ? "true " : "false");
        fprintf(out, "      | %15s = %s\n", "Version Range", dependency->versionRange == NULL ? "N/A" : dependency->versionRange);
        fprintf(out, "      | %15s = %s\n", "Filter", dependency->filter == NULL ? "N/A" : dependency->filter);
    }
    fprintf(out, "\n");
}