Return-Path: X-Original-To: apmail-incubator-celix-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-celix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B44E3E176 for ; Wed, 5 Dec 2012 09:07:43 +0000 (UTC) Received: (qmail 25360 invoked by uid 500); 5 Dec 2012 09:07:43 -0000 Delivered-To: apmail-incubator-celix-commits-archive@incubator.apache.org Received: (qmail 25204 invoked by uid 500); 5 Dec 2012 09:07:39 -0000 Mailing-List: contact celix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: celix-dev@incubator.apache.org Delivered-To: mailing list celix-commits@incubator.apache.org Received: (qmail 25150 invoked by uid 99); 5 Dec 2012 09:07:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 09:07:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Dec 2012 09:07:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7B9F9238899C; Wed, 5 Dec 2012 09:07:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1417320 [3/7] - in /incubator/celix/trunk: dependency_manager/private/src/ dependency_manager/public/include/ deployment_admin/private/include/ deployment_admin/private/src/ device_access/device_access/private/include/ device_access/device... Date: Wed, 05 Dec 2012 09:06:34 -0000 To: celix-commits@incubator.apache.org From: abroekhuis@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121205090709.7B9F9238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/bundle_archive.c (original) +++ incubator/celix/trunk/framework/private/src/bundle_archive.c Wed Dec 5 09:05:46 2012 @@ -41,11 +41,11 @@ struct bundleArchive { char * location; apr_dir_t * archiveRootDir; char * archiveRoot; - LINKED_LIST revisions; + linked_list_t revisions; long refreshCount; time_t lastModified; - BUNDLE_STATE persistentState; + bundle_state_e persistentState; apr_pool_t *mp; }; @@ -59,7 +59,7 @@ static celix_status_t bundleArchive_init static celix_status_t bundleArchive_deleteTree(char * directory, apr_pool_t *mp); -static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_t archive, char *location, char *inputFile, long revNr, BUNDLE_REVISION *bundle_revision); +static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_t archive, char *location, char *inputFile, long revNr, bundle_revision_t *bundle_revision); static celix_status_t bundleArchive_reviseInternal(bundle_archive_t archive, bool isReload, long revNr, char * location, char *inputFile); static celix_status_t bundleArchive_readLastModified(bundle_archive_t archive, time_t *time); @@ -285,7 +285,7 @@ celix_status_t bundleArchive_getArchiveR celix_status_t bundleArchive_getCurrentRevisionNumber(bundle_archive_t archive, long *revisionNumber) { celix_status_t status = CELIX_SUCCESS; - BUNDLE_REVISION revision; + bundle_revision_t revision; *revisionNumber = -1; status = bundleArchive_getCurrentRevision(archive, &revision); @@ -296,17 +296,17 @@ celix_status_t bundleArchive_getCurrentR return status; } -celix_status_t bundleArchive_getCurrentRevision(bundle_archive_t archive, BUNDLE_REVISION *revision) { +celix_status_t bundleArchive_getCurrentRevision(bundle_archive_t archive, bundle_revision_t *revision) { *revision = linkedList_isEmpty(archive->revisions) ? NULL : linkedList_getLast(archive->revisions); return CELIX_SUCCESS; } -celix_status_t bundleArchive_getRevision(bundle_archive_t archive, long revNr, BUNDLE_REVISION *revision) { +celix_status_t bundleArchive_getRevision(bundle_archive_t archive, long revNr, bundle_revision_t *revision) { *revision = linkedList_get(archive->revisions, revNr); return CELIX_SUCCESS; } -celix_status_t bundleArchive_getPersistentState(bundle_archive_t archive, BUNDLE_STATE *state) { +celix_status_t bundleArchive_getPersistentState(bundle_archive_t archive, bundle_state_e *state) { celix_status_t status = CELIX_SUCCESS; apr_status_t apr_status; @@ -348,7 +348,7 @@ celix_status_t bundleArchive_getPersiste return status; } -celix_status_t bundleArchive_setPersistentState(bundle_archive_t archive, BUNDLE_STATE state) { +celix_status_t bundleArchive_setPersistentState(bundle_archive_t archive, bundle_state_e state) { celix_status_t status = CELIX_SUCCESS; apr_status_t apr_status; char * persistentStateLocation = NULL; @@ -551,7 +551,7 @@ celix_status_t bundleArchive_revise(bund static celix_status_t bundleArchive_reviseInternal(bundle_archive_t archive, bool isReload, long revNr, char * location, char *inputFile) { celix_status_t status; - BUNDLE_REVISION revision = NULL; + bundle_revision_t revision = NULL; if (inputFile != NULL) { location = "inputstream:"; @@ -575,14 +575,14 @@ celix_status_t bundleArchive_rollbackRev return CELIX_SUCCESS; } -static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_t archive, char *location, char *inputFile, long revNr, BUNDLE_REVISION *bundle_revision) { +static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_t archive, char *location, char *inputFile, long revNr, bundle_revision_t *bundle_revision) { celix_status_t status = CELIX_SUCCESS; char root[256]; long refreshCount; status = bundleArchive_getRefreshCount(archive, &refreshCount); if (status == CELIX_SUCCESS) { - BUNDLE_REVISION revision = NULL; + bundle_revision_t revision = NULL; apr_pool_t *pool = NULL; sprintf(root, "%s/version%ld.%ld", archive->archiveRoot, refreshCount, revNr); Modified: incubator/celix/trunk/framework/private/src/bundle_cache.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_cache.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/bundle_cache.c (original) +++ incubator/celix/trunk/framework/private/src/bundle_cache.c Wed Dec 5 09:05:46 2012 @@ -38,7 +38,7 @@ #include "constants.h" struct bundleCache { - PROPERTIES configurationMap; + properties_t configurationMap; char * cacheDir; apr_pool_t *mp; }; @@ -46,7 +46,7 @@ struct bundleCache { static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp); static apr_status_t bundleCache_destroy(void *cacheP); -celix_status_t bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp, bundle_cache_t *bundle_cache) { +celix_status_t bundleCache_create(properties_t configurationMap, apr_pool_t *mp, bundle_cache_t *bundle_cache) { celix_status_t status; bundle_cache_t cache; @@ -85,7 +85,7 @@ celix_status_t bundleCache_delete(bundle return bundleCache_deleteTree(cache->cacheDir, cache->mp); } -celix_status_t bundleCache_getArchives(bundle_cache_t cache, apr_pool_t *pool, ARRAY_LIST *archives) { +celix_status_t bundleCache_getArchives(bundle_cache_t cache, apr_pool_t *pool, array_list_t *archives) { celix_status_t status = CELIX_SUCCESS; apr_dir_t *dir; @@ -97,7 +97,7 @@ celix_status_t bundleCache_getArchives(b } if (aprStatus == APR_SUCCESS) { - ARRAY_LIST list = NULL; + array_list_t list = NULL; apr_finfo_t dp; arrayList_create(pool, &list); Modified: incubator/celix/trunk/framework/private/src/bundle_context.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/bundle_context.c (original) +++ incubator/celix/trunk/framework/private/src/bundle_context.c Wed Dec 5 09:05:46 2012 @@ -37,7 +37,7 @@ struct bundleContext { apr_pool_t *pool; }; -celix_status_t bundleContext_create(FRAMEWORK framework, BUNDLE bundle, bundle_context_t *bundle_context) { +celix_status_t bundleContext_create(framework_t framework, bundle_t bundle, bundle_context_t *bundle_context) { celix_status_t status = CELIX_SUCCESS; bundle_context_t context = NULL; @@ -84,7 +84,7 @@ celix_status_t bundleContext_destroy(bun return status; } -celix_status_t bundleContext_getBundle(bundle_context_t context, BUNDLE *bundle) { +celix_status_t bundleContext_getBundle(bundle_context_t context, bundle_t *bundle) { celix_status_t status = CELIX_SUCCESS; if (context == NULL) { @@ -96,7 +96,7 @@ celix_status_t bundleContext_getBundle(b return status; } -celix_status_t bundleContext_getFramework(bundle_context_t context, FRAMEWORK *framework) { +celix_status_t bundleContext_getFramework(bundle_context_t context, framework_t *framework) { celix_status_t status = CELIX_SUCCESS; if (context == NULL) { @@ -120,13 +120,13 @@ celix_status_t bundleContext_getMemoryPo return status; } -celix_status_t bundleContext_installBundle(bundle_context_t context, char * location, BUNDLE *bundle) { +celix_status_t bundleContext_installBundle(bundle_context_t context, char * location, bundle_t *bundle) { return bundleContext_installBundle2(context, location, NULL, bundle); } -celix_status_t bundleContext_installBundle2(bundle_context_t context, char * location, char *inputFile, BUNDLE *bundle) { +celix_status_t bundleContext_installBundle2(bundle_context_t context, char * location, char *inputFile, bundle_t *bundle) { celix_status_t status = CELIX_SUCCESS; - BUNDLE b = NULL; + bundle_t b = NULL; if (context != NULL && *bundle == NULL) { if (fw_installBundle(context->framework, &b, location, inputFile) != CELIX_SUCCESS) { @@ -142,8 +142,8 @@ celix_status_t bundleContext_installBund } celix_status_t bundleContext_registerService(bundle_context_t context, char * serviceName, void * svcObj, - PROPERTIES properties, SERVICE_REGISTRATION *service_registration) { - SERVICE_REGISTRATION registration = NULL; + properties_t properties, service_registration_t *service_registration) { + service_registration_t registration = NULL; celix_status_t status = CELIX_SUCCESS; if (context != NULL && *service_registration == NULL) { @@ -157,8 +157,8 @@ celix_status_t bundleContext_registerSer } celix_status_t bundleContext_registerServiceFactory(bundle_context_t context, char * serviceName, service_factory_t factory, - PROPERTIES properties, SERVICE_REGISTRATION *service_registration) { - SERVICE_REGISTRATION registration = NULL; + properties_t properties, service_registration_t *service_registration) { + service_registration_t registration = NULL; celix_status_t status = CELIX_SUCCESS; if (context != NULL && *service_registration == NULL) { @@ -171,7 +171,7 @@ celix_status_t bundleContext_registerSer return status; } -celix_status_t bundleContext_getServiceReferences(bundle_context_t context, const char * serviceName, char * filter, ARRAY_LIST *service_references) { +celix_status_t bundleContext_getServiceReferences(bundle_context_t context, const char * serviceName, char * filter, array_list_t *service_references) { celix_status_t status = CELIX_SUCCESS; if (context != NULL && *service_references == NULL) { @@ -183,9 +183,9 @@ celix_status_t bundleContext_getServiceR return status; } -celix_status_t bundleContext_getServiceReference(bundle_context_t context, char * serviceName, SERVICE_REFERENCE *service_reference) { - SERVICE_REFERENCE reference = NULL; - ARRAY_LIST services = NULL; +celix_status_t bundleContext_getServiceReference(bundle_context_t context, char * serviceName, service_reference_t *service_reference) { + service_reference_t reference = NULL; + array_list_t services = NULL; celix_status_t status = CELIX_SUCCESS; if (serviceName != NULL) { @@ -203,7 +203,7 @@ celix_status_t bundleContext_getServiceR return status; } -celix_status_t bundleContext_getService(bundle_context_t context, SERVICE_REFERENCE reference, void **service_instance) { +celix_status_t bundleContext_getService(bundle_context_t context, service_reference_t reference, void **service_instance) { celix_status_t status = CELIX_SUCCESS; if (context != NULL && reference != NULL && *service_instance == NULL) { @@ -215,7 +215,7 @@ celix_status_t bundleContext_getService( return status; } -celix_status_t bundleContext_ungetService(bundle_context_t context, SERVICE_REFERENCE reference, bool *result) { +celix_status_t bundleContext_ungetService(bundle_context_t context, service_reference_t reference, bool *result) { celix_status_t status = CELIX_SUCCESS; if (context != NULL && reference != NULL) { @@ -227,7 +227,7 @@ celix_status_t bundleContext_ungetServic return status; } -celix_status_t bundleContext_getBundles(bundle_context_t context, ARRAY_LIST *bundles) { +celix_status_t bundleContext_getBundles(bundle_context_t context, array_list_t *bundles) { celix_status_t status = CELIX_SUCCESS; if (context == NULL || *bundles != NULL) { @@ -239,7 +239,7 @@ celix_status_t bundleContext_getBundles( return status; } -celix_status_t bundleContext_getBundleById(bundle_context_t context, long id, BUNDLE *bundle) { +celix_status_t bundleContext_getBundleById(bundle_context_t context, long id, bundle_t *bundle) { celix_status_t status = CELIX_SUCCESS; if (context == NULL || *bundle != NULL) { @@ -251,7 +251,7 @@ celix_status_t bundleContext_getBundleBy return status; } -celix_status_t bundleContext_addServiceListener(bundle_context_t context, SERVICE_LISTENER listener, char * filter) { +celix_status_t bundleContext_addServiceListener(bundle_context_t context, service_listener_t listener, char * filter) { celix_status_t status = CELIX_SUCCESS; if (context != NULL && listener != NULL) { @@ -263,7 +263,7 @@ celix_status_t bundleContext_addServiceL return status; } -celix_status_t bundleContext_removeServiceListener(bundle_context_t context, SERVICE_LISTENER listener) { +celix_status_t bundleContext_removeServiceListener(bundle_context_t context, service_listener_t listener) { celix_status_t status = CELIX_SUCCESS; if (context != NULL && listener != NULL) { Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/bundle_revision.c (original) +++ incubator/celix/trunk/framework/private/src/bundle_revision.c Wed Dec 5 09:05:46 2012 @@ -40,11 +40,11 @@ struct bundleRevision { static apr_status_t bundleRevision_destroy(void *revisionP); -celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, BUNDLE_REVISION *bundle_revision) { +celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_t *bundle_revision) { celix_status_t status = CELIX_SUCCESS; - BUNDLE_REVISION revision = NULL; + bundle_revision_t revision = NULL; - revision = (BUNDLE_REVISION) apr_pcalloc(pool, sizeof(*revision)); + revision = (bundle_revision_t) apr_pcalloc(pool, sizeof(*revision)); if (!revision) { status = CELIX_ENOMEM; } else { @@ -76,11 +76,11 @@ celix_status_t bundleRevision_create(apr } apr_status_t bundleRevision_destroy(void *revisionP) { - BUNDLE_REVISION revision = revisionP; + bundle_revision_t revision = revisionP; return CELIX_SUCCESS; } -celix_status_t bundleRevision_getNumber(BUNDLE_REVISION revision, long *revisionNr) { +celix_status_t bundleRevision_getNumber(bundle_revision_t revision, long *revisionNr) { celix_status_t status = CELIX_SUCCESS; if (revision == NULL) { status = CELIX_ILLEGAL_ARGUMENT; @@ -90,7 +90,7 @@ celix_status_t bundleRevision_getNumber( return status; } -celix_status_t bundleRevision_getLocation(BUNDLE_REVISION revision, char **location) { +celix_status_t bundleRevision_getLocation(bundle_revision_t revision, char **location) { celix_status_t status = CELIX_SUCCESS; if (revision == NULL) { status = CELIX_ILLEGAL_ARGUMENT; @@ -100,7 +100,7 @@ celix_status_t bundleRevision_getLocatio return status; } -celix_status_t bundleRevision_getRoot(BUNDLE_REVISION revision, char **root) { +celix_status_t bundleRevision_getRoot(bundle_revision_t revision, char **root) { celix_status_t status = CELIX_SUCCESS; if (revision == NULL) { status = CELIX_ILLEGAL_ARGUMENT; Modified: incubator/celix/trunk/framework/private/src/capability.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/capability.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/capability.c (original) +++ incubator/celix/trunk/framework/private/src/capability.c Wed Dec 5 09:05:46 2012 @@ -30,17 +30,17 @@ struct capability { char * serviceName; - MODULE module; - VERSION version; - HASH_MAP attributes; - HASH_MAP directives; + module_t module; + version_t version; + hash_map_t attributes; + hash_map_t directives; }; apr_status_t capability_destroy(void *capabilityP); -celix_status_t capability_create(apr_pool_t *pool, MODULE module, HASH_MAP directives, HASH_MAP attributes, CAPABILITY *capability) { +celix_status_t capability_create(apr_pool_t *pool, module_t module, hash_map_t directives, hash_map_t attributes, capability_t *capability) { celix_status_t status = CELIX_SUCCESS; - *capability = (CAPABILITY) apr_palloc(pool, sizeof(**capability)); + *capability = (capability_t) apr_palloc(pool, sizeof(**capability)); if (!*capability) { status = CELIX_ENOMEM; } else { @@ -53,11 +53,11 @@ celix_status_t capability_create(apr_poo (*capability)->version = NULL; status = version_createEmptyVersion(pool, &(*capability)->version); if (status == CELIX_SUCCESS) { - ATTRIBUTE versionAttribute = NULL; - ATTRIBUTE serviceAttribute = (ATTRIBUTE) hashMap_get(attributes, "service"); + attribute_t versionAttribute = NULL; + attribute_t serviceAttribute = (attribute_t) hashMap_get(attributes, "service"); status = attribute_getValue(serviceAttribute, &(*capability)->serviceName); if (status == CELIX_SUCCESS) { - versionAttribute = (ATTRIBUTE) hashMap_get(attributes, "version"); + versionAttribute = (attribute_t) hashMap_get(attributes, "version"); if (versionAttribute != NULL) { char *versionStr = NULL; attribute_getValue(versionAttribute, &versionStr); @@ -72,11 +72,11 @@ celix_status_t capability_create(apr_poo } apr_status_t capability_destroy(void *capabilityP) { - CAPABILITY capability = capabilityP; + capability_t capability = capabilityP; - HASH_MAP_ITERATOR attrIter = hashMapIterator_create(capability->attributes); + hash_map_iterator_t attrIter = hashMapIterator_create(capability->attributes); while (hashMapIterator_hasNext(attrIter)) { - ATTRIBUTE attr = hashMapIterator_nextValue(attrIter); + attribute_t attr = hashMapIterator_nextValue(attrIter); hashMapIterator_remove(attrIter); } hashMapIterator_destroy(attrIter); @@ -91,17 +91,17 @@ apr_status_t capability_destroy(void *ca return APR_SUCCESS; } -celix_status_t capability_getServiceName(CAPABILITY capability, char **serviceName) { +celix_status_t capability_getServiceName(capability_t capability, char **serviceName) { *serviceName = capability->serviceName; return CELIX_SUCCESS; } -celix_status_t capability_getVersion(CAPABILITY capability, VERSION *version) { +celix_status_t capability_getVersion(capability_t capability, version_t *version) { *version = capability->version; return CELIX_SUCCESS; } -celix_status_t capability_getModule(CAPABILITY capability, MODULE *module) { +celix_status_t capability_getModule(capability_t capability, module_t *module) { *module = capability->module; return CELIX_SUCCESS; } Modified: incubator/celix/trunk/framework/private/src/filter.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/filter.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/filter.c (original) +++ incubator/celix/trunk/framework/private/src/filter.c Wed Dec 5 09:05:46 2012 @@ -61,7 +61,7 @@ filter_t filter_parseNot(char * filterSt filter_t filter_parseItem(char * filterString, int * pos, apr_pool_t *pool); char * filter_parseAttr(char * filterString, int * pos); char * filter_parseValue(char * filterString, int * pos); -ARRAY_LIST filter_parseSubstring(char * filterString, int * pos, apr_pool_t *pool); +array_list_t filter_parseSubstring(char * filterString, int * pos, apr_pool_t *pool); celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result); celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result); @@ -159,7 +159,7 @@ filter_t filter_parseFilterComp(char * f filter_t filter_parseAnd(char * filterString, int * pos, apr_pool_t *pool) { filter_t filter = (filter_t) malloc(sizeof(*filter)); - ARRAY_LIST operands = NULL; + array_list_t operands = NULL; arrayList_create(pool, &operands); filter_skipWhiteSpace(filterString, pos); @@ -182,7 +182,7 @@ filter_t filter_parseAnd(char * filterSt filter_t filter_parseOr(char * filterString, int * pos, apr_pool_t *pool) { filter_t filter = (filter_t) malloc(sizeof(*filter)); - ARRAY_LIST operands = NULL; + array_list_t operands = NULL; arrayList_create(pool, &operands); filter_skipWhiteSpace(filterString, pos); @@ -261,7 +261,7 @@ filter_t filter_parseItem(char * filterS } case '=': { filter_t filter = NULL; - ARRAY_LIST subs; + array_list_t subs; if (filterString[*pos + 1] == '*') { int oldPos = *pos; *pos += 2; @@ -372,9 +372,9 @@ char * filter_parseValue(char * filterSt return value; } -ARRAY_LIST filter_parseSubstring(char * filterString, int * pos, apr_pool_t *pool) { +array_list_t filter_parseSubstring(char * filterString, int * pos, apr_pool_t *pool) { char * sub = (char *) malloc(strlen(filterString)); - ARRAY_LIST operands = NULL; + array_list_t operands = NULL; int keepRunning = 1; int size; @@ -431,10 +431,10 @@ ARRAY_LIST filter_parseSubstring(char * return operands; } -celix_status_t filter_match(filter_t filter, PROPERTIES properties, bool *result) { +celix_status_t filter_match(filter_t filter, properties_t properties, bool *result) { switch (filter->operand) { case AND: { - ARRAY_LIST filters = (ARRAY_LIST) filter->value; + array_list_t filters = (array_list_t) filter->value; unsigned int i; for (i = 0; i < arrayList_size(filters); i++) { filter_t sfilter = (filter_t) arrayList_get(filters, i); @@ -449,7 +449,7 @@ celix_status_t filter_match(filter_t fil return CELIX_SUCCESS; } case OR: { - ARRAY_LIST filters = (ARRAY_LIST) filter->value; + array_list_t filters = (array_list_t) filter->value; unsigned int i; for (i = 0; i < arrayList_size(filters); i++) { filter_t sfilter = (filter_t) arrayList_get(filters, i); @@ -501,7 +501,7 @@ celix_status_t filter_compare(OPERAND op celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result) { switch (operand) { case SUBSTRING: { - ARRAY_LIST subs = (ARRAY_LIST) value2; + array_list_t subs = (array_list_t) value2; int pos = 0; int i; int size = arrayList_size(subs); Modified: incubator/celix/trunk/framework/private/src/framework.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/framework.c (original) +++ incubator/celix/trunk/framework/private/src/framework.c Wed Dec 5 09:05:46 2012 @@ -65,10 +65,10 @@ struct framework { struct bundle * bundle; - HASH_MAP installedBundleMap; - HASH_MAP installRequestMap; - ARRAY_LIST serviceListeners; - ARRAY_LIST bundleListeners; + hash_map_t installedBundleMap; + hash_map_t installRequestMap; + array_list_t serviceListeners; + array_list_t bundleListeners; long nextBundleId; struct serviceRegistry * registry; @@ -82,7 +82,7 @@ bundle_cache_t cache; apr_thread_mutex_t *bundleLock; apr_os_thread_t globalLockThread; - ARRAY_LIST globalLockWaitersList; + array_list_t globalLockWaitersList; int globalLockCount; bool interrupted; @@ -90,9 +90,9 @@ bundle_cache_t cache; apr_pool_t *mp; - PROPERTIES configurationMap; + properties_t configurationMap; - ARRAY_LIST requests; + array_list_t requests; apr_thread_cond_t *dispatcher; apr_thread_mutex_t *dispatcherLock; apr_thread_t *dispatcherThread; @@ -105,35 +105,35 @@ struct activator { void (*destroy)(void * userData, bundle_context_t context); }; -celix_status_t framework_setBundleStateAndNotify(FRAMEWORK framework, BUNDLE bundle, int state); -celix_status_t framework_markBundleResolved(FRAMEWORK framework, MODULE module); +celix_status_t framework_setBundleStateAndNotify(framework_t framework, bundle_t bundle, int state); +celix_status_t framework_markBundleResolved(framework_t framework, module_t module); -celix_status_t framework_acquireBundleLock(FRAMEWORK framework, BUNDLE bundle, int desiredStates); -bool framework_releaseBundleLock(FRAMEWORK framework, BUNDLE bundle); +celix_status_t framework_acquireBundleLock(framework_t framework, bundle_t bundle, int desiredStates); +bool framework_releaseBundleLock(framework_t framework, bundle_t bundle); -bool framework_acquireGlobalLock(FRAMEWORK framework); -celix_status_t framework_releaseGlobalLock(FRAMEWORK framework); +bool framework_acquireGlobalLock(framework_t framework); +celix_status_t framework_releaseGlobalLock(framework_t framework); -celix_status_t framework_acquireInstallLock(FRAMEWORK framework, char * location); -celix_status_t framework_releaseInstallLock(FRAMEWORK framework, char * location); +celix_status_t framework_acquireInstallLock(framework_t framework, char * location); +celix_status_t framework_releaseInstallLock(framework_t framework, char * location); -long framework_getNextBundleId(FRAMEWORK framework); +long framework_getNextBundleId(framework_t framework); -celix_status_t fw_installBundle2(FRAMEWORK framework, BUNDLE * bundle, long id, char * location, char *inputFile, bundle_archive_t archive); +celix_status_t fw_installBundle2(framework_t framework, bundle_t * bundle, long id, char * location, char *inputFile, bundle_archive_t archive); -celix_status_t fw_refreshBundles(FRAMEWORK framework, BUNDLE bundles[], int size); -celix_status_t fw_refreshBundle(FRAMEWORK framework, BUNDLE bundle); +celix_status_t fw_refreshBundles(framework_t framework, bundle_t bundles[], int size); +celix_status_t fw_refreshBundle(framework_t framework, bundle_t bundle); -celix_status_t fw_populateDependentGraph(FRAMEWORK framework, BUNDLE exporter, HASH_MAP *map); +celix_status_t fw_populateDependentGraph(framework_t framework, bundle_t exporter, hash_map_t *map); -celix_status_t fw_fireBundleEvent(FRAMEWORK framework, bundle_event_type_e, BUNDLE bundle); +celix_status_t fw_fireBundleEvent(framework_t framework, bundle_event_type_e, bundle_t bundle); static void *APR_THREAD_FUNC fw_eventDispatcher(apr_thread_t *thd, void *fw); -celix_status_t fw_invokeBundleListener(FRAMEWORK framework, bundle_listener_t listener, bundle_event_t event, BUNDLE bundle); +celix_status_t fw_invokeBundleListener(framework_t framework, bundle_listener_t listener, bundle_event_t event, bundle_t bundle); struct fw_refreshHelper { - FRAMEWORK framework; - BUNDLE bundle; - BUNDLE_STATE oldState; + framework_t framework; + bundle_t bundle; + bundle_state_e oldState; }; celix_status_t fw_refreshHelper_refreshOrRemove(struct fw_refreshHelper * refreshHelper); @@ -141,16 +141,16 @@ celix_status_t fw_refreshHelper_restart( celix_status_t fw_refreshHelper_stop(struct fw_refreshHelper * refreshHelper); struct fw_serviceListener { - BUNDLE bundle; - SERVICE_LISTENER listener; + bundle_t bundle; + service_listener_t listener; filter_t filter; }; -typedef struct fw_serviceListener * FW_SERVICE_LISTENER; +typedef struct fw_serviceListener * fw_service_listener_t; struct fw_bundleListener { apr_pool_t *pool; - BUNDLE bundle; + bundle_t bundle; bundle_listener_t listener; }; @@ -166,20 +166,20 @@ typedef enum event_type event_type_e; struct request { event_type_e type; - ARRAY_LIST listeners; + array_list_t listeners; int eventType; - BUNDLE bundle; + bundle_t bundle; char *filter; }; typedef struct request *request_t; -celix_status_t framework_create(FRAMEWORK *framework, apr_pool_t *memoryPool, PROPERTIES config) { +celix_status_t framework_create(framework_t *framework, apr_pool_t *memoryPool, properties_t config) { celix_status_t status = CELIX_SUCCESS; - *framework = (FRAMEWORK) apr_palloc(memoryPool, sizeof(**framework)); + *framework = (framework_t) apr_palloc(memoryPool, sizeof(**framework)); if (*framework == NULL) { status = CELIX_ENOMEM; } else { @@ -187,7 +187,7 @@ celix_status_t framework_create(FRAMEWOR if (apr_status != APR_SUCCESS) { status = CELIX_FRAMEWORK_EXCEPTION; } else { - BUNDLE bundle = NULL; + bundle_t bundle = NULL; apr_pool_t *bundlePool; apr_status_t apr_status = apr_pool_create(&bundlePool, (*framework)->mp); if (apr_status != APR_SUCCESS) { @@ -258,25 +258,25 @@ celix_status_t framework_create(FRAMEWOR return status; } -celix_status_t framework_destroy(FRAMEWORK framework) { +celix_status_t framework_destroy(framework_t framework) { celix_status_t status = CELIX_SUCCESS; - HASH_MAP_ITERATOR iterator = hashMapIterator_create(framework->installedBundleMap); + hash_map_iterator_t iterator = hashMapIterator_create(framework->installedBundleMap); while (hashMapIterator_hasNext(iterator)) { - LINKED_LIST wires; - HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator); - BUNDLE bundle = hashMapEntry_getValue(entry); + linked_list_t wires; + hash_map_entry_t entry = hashMapIterator_nextEntry(iterator); + bundle_t bundle = hashMapEntry_getValue(entry); char * location = hashMapEntry_getKey(entry); bundle_archive_t archive = NULL; // for each installed bundle, clean up memory - MODULE mod = NULL; + module_t mod = NULL; bundle_getCurrentModule(bundle, &mod); wires = module_getWires(mod); if (wires != NULL) { - LINKED_LIST_ITERATOR iter = linkedListIterator_create(wires, 0); + linked_list_iterator_t iter = linkedListIterator_create(wires, 0); while (linkedListIterator_hasNext(iter)) { - WIRE wire = linkedListIterator_next(iter); + wire_t wire = linkedListIterator_next(iter); linkedListIterator_remove(iter); } linkedListIterator_destroy(iter); @@ -311,13 +311,13 @@ typedef void (*start_function_t)(void * typedef void (*stop_function_t)(void * handle, bundle_context_t context); typedef void (*destroy_function_t)(void * handle, bundle_context_t context); -celix_status_t fw_init(FRAMEWORK framework) { +celix_status_t fw_init(framework_t framework) { celix_status_t status = framework_acquireBundleLock(framework, framework->bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE); - BUNDLE_STATE state; + bundle_state_e state; char *location; - MODULE module = NULL; - HASH_MAP wires; - ARRAY_LIST archives; + module_t module = NULL; + hash_map_t wires; + array_list_t archives; bundle_archive_t archive = NULL; if (status != CELIX_SUCCESS) { @@ -333,11 +333,11 @@ celix_status_t fw_init(FRAMEWORK framewo bundle_getState(framework->bundle, &state); if ((state == BUNDLE_INSTALLED) || (state == BUNDLE_RESOLVED)) { - PROPERTIES props = properties_create(); + properties_t props = properties_create(); properties_set(props, (char *) FRAMEWORK_STORAGE, ".cache"); status = bundleCache_create(props, framework->mp, &framework->cache); if (status == CELIX_SUCCESS) { - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(framework->bundle, &state); if (state == BUNDLE_INSTALLED) { // clean cache @@ -374,7 +374,7 @@ celix_status_t fw_init(FRAMEWORK framewo return status; } else { #ifdef _WIN32 - HMODULE this_process; + Hmodule_t this_process; #endif unsigned int arcIdx; void * handle; @@ -384,7 +384,7 @@ celix_status_t fw_init(FRAMEWORK framewo for (arcIdx = 0; arcIdx < arrayList_size(archives); arcIdx++) { bundle_archive_t archive1 = (bundle_archive_t) arrayList_get(archives, arcIdx); long id; - BUNDLE_STATE bundleState; + bundle_state_e bundleState; bundleArchive_getId(archive1, &id); framework->nextBundleId = framework->nextBundleId > id + 1 ? framework->nextBundleId : id + 1; @@ -392,7 +392,7 @@ celix_status_t fw_init(FRAMEWORK framewo if (bundleState == BUNDLE_UNINSTALLED) { bundleArchive_closeAndDelete(archive1); } else { - BUNDLE bundle = NULL; + bundle_t bundle = NULL; char *location1 = NULL; status = bundleArchive_getLocation(archive1, &location1); fw_installBundle2(framework, &bundle, id, location1, NULL, archive1); @@ -435,10 +435,10 @@ celix_status_t fw_init(FRAMEWORK framewo bundle_context_t context = NULL; void * userData = NULL; #ifdef _WIN32 - create_function_t create = (create_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE); - start_function_t start = (start_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START); - stop_function_t stop = (stop_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_STOP); - destroy_function_t destroy = (destroy_function_t) GetProcAddress((HMODULE) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_DESTROY); + create_function_t create = (create_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE); + start_function_t start = (start_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START); + stop_function_t stop = (stop_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_STOP); + destroy_function_t destroy = (destroy_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_DESTROY); #else create_function_t create = dlsym(bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_CREATE); start_function_t start = dlsym(bundle_getHandle(framework->bundle), BUNDLE_ACTIVATOR_START); @@ -476,9 +476,9 @@ celix_status_t fw_init(FRAMEWORK framewo return status; } -celix_status_t framework_start(FRAMEWORK framework) { +celix_status_t framework_start(framework_t framework) { celix_status_t lock = framework_acquireBundleLock(framework, framework->bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE); - BUNDLE_STATE state; + bundle_state_e state; if (lock != CELIX_SUCCESS) { printf("could not get lock\n"); @@ -503,11 +503,11 @@ celix_status_t framework_start(FRAMEWORK return CELIX_SUCCESS; } -void framework_stop(FRAMEWORK framework) { +void framework_stop(framework_t framework) { fw_stopBundle(framework, framework->bundle, true); } -celix_status_t fw_getProperty(FRAMEWORK framework, const char *name, char **value) { +celix_status_t fw_getProperty(framework_t framework, const char *name, char **value) { celix_status_t status = CELIX_SUCCESS; if (framework == NULL || name == NULL || *value != NULL) { @@ -524,13 +524,13 @@ celix_status_t fw_getProperty(FRAMEWORK return status; } -celix_status_t fw_installBundle(FRAMEWORK framework, BUNDLE * bundle, char * location, char *inputFile) { +celix_status_t fw_installBundle(framework_t framework, bundle_t * bundle, char * location, char *inputFile) { return fw_installBundle2(framework, bundle, -1, location, inputFile, NULL); } -celix_status_t fw_installBundle2(FRAMEWORK framework, BUNDLE * bundle, long id, char * location, char *inputFile, bundle_archive_t archive) { +celix_status_t fw_installBundle2(framework_t framework, bundle_t * bundle, long id, char * location, char *inputFile, bundle_archive_t archive) { bundle_archive_t bundle_archive = NULL; - BUNDLE_STATE state; + bundle_state_e state; apr_pool_t *bundlePool; bool locked; @@ -589,10 +589,10 @@ celix_status_t fw_installBundle2(FRAMEWO return status; } -celix_status_t framework_getBundleEntry(FRAMEWORK framework, BUNDLE bundle, char *name, apr_pool_t *pool, char **entry) { +celix_status_t framework_getBundleEntry(framework_t framework, bundle_t bundle, char *name, apr_pool_t *pool, char **entry) { celix_status_t status = CELIX_SUCCESS; - BUNDLE_REVISION revision; + bundle_revision_t revision; bundle_archive_t archive = NULL; status = bundle_getArchive(bundle, &archive); @@ -624,14 +624,14 @@ celix_status_t framework_getBundleEntry( return status; } -celix_status_t fw_startBundle(FRAMEWORK framework, BUNDLE bundle, int options) { +celix_status_t fw_startBundle(framework_t framework, bundle_t bundle, int options) { celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE); - HASH_MAP wires; + hash_map_t wires; void * handle; bundle_context_t context = NULL; - BUNDLE_STATE state; - MODULE module = NULL; + bundle_state_e state; + module_t module = NULL; MANIFEST manifest = NULL; char *library; #ifdef __linux__ @@ -745,10 +745,10 @@ celix_status_t fw_startBundle(FRAMEWORK bundle_context_t context; #ifdef _WIN32 - create_function_t create = (create_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE); - start_function_t start = (start_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START); - stop_function_t stop = (stop_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_STOP); - destroy_function_t destroy = (destroy_function_t) GetProcAddress((HMODULE) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_DESTROY); + create_function_t create = (create_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE); + start_function_t start = (start_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START); + stop_function_t stop = (stop_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_STOP); + destroy_function_t destroy = (destroy_function_t) GetProcAddress((Hmodule_t) bundle_getHandle(bundle), BUNDLE_ACTIVATOR_DESTROY); #else create_function_t create = dlsym(bundle_getHandle(bundle), BUNDLE_ACTIVATOR_CREATE); start_function_t start = dlsym(bundle_getHandle(bundle), BUNDLE_ACTIVATOR_START); @@ -788,10 +788,10 @@ celix_status_t fw_startBundle(FRAMEWORK return CELIX_SUCCESS; } -celix_status_t framework_updateBundle(FRAMEWORK framework, BUNDLE bundle, char *inputFile) { +celix_status_t framework_updateBundle(framework_t framework, bundle_t bundle, char *inputFile) { celix_status_t status; celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_ACTIVE); - BUNDLE_STATE oldState; + bundle_state_e oldState; char *location; bool locked; bundle_archive_t archive = NULL; @@ -834,7 +834,7 @@ celix_status_t framework_updateBundle(FR return CELIX_SUCCESS; } -celix_status_t fw_stopBundle(FRAMEWORK framework, BUNDLE bundle, bool record) { +celix_status_t fw_stopBundle(framework_t framework, bundle_t bundle, bool record) { celix_status_t status = CELIX_SUCCESS; status = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE); @@ -842,10 +842,10 @@ celix_status_t fw_stopBundle(FRAMEWORK f printf("Cannot stop bundle"); framework_releaseBundleLock(framework, bundle); } else { - BUNDLE_STATE state; + bundle_state_e state; ACTIVATOR activator; bundle_context_t context; - MODULE module = NULL; + module_t module = NULL; MANIFEST manifest = NULL; if (record) { bundle_setPersistentStateInactive(bundle); @@ -918,10 +918,10 @@ celix_status_t fw_stopBundle(FRAMEWORK f return status; } -celix_status_t fw_uninstallBundle(FRAMEWORK framework, BUNDLE bundle) { +celix_status_t fw_uninstallBundle(framework_t framework, bundle_t bundle) { celix_status_t status = CELIX_SUCCESS; - BUNDLE_STATE state; + bundle_state_e state; celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE|BUNDLE_STOPPING); if (lock != CELIX_SUCCESS) { @@ -945,11 +945,11 @@ celix_status_t fw_uninstallBundle(FRAMEW } else { bundle_archive_t archive = NULL; char * location; - BUNDLE target; + bundle_t target; status = bundle_getArchive(bundle, &archive); status = bundleArchive_getLocation(archive, &location); // TODO sync issues? - target = (BUNDLE) hashMap_remove(framework->installedBundleMap, location); + target = (bundle_t) hashMap_remove(framework->installedBundleMap, location); if (target != NULL) { bundle_setPersistentStateUninstalled(target); @@ -974,7 +974,7 @@ celix_status_t fw_uninstallBundle(FRAMEW locked = framework_acquireGlobalLock(framework); if (locked) { - BUNDLE bundles[] = { bundle }; + bundle_t bundles[] = { bundle }; celix_status_t refreshStatus = fw_refreshBundles(framework, bundles, 1); if (refreshStatus != CELIX_SUCCESS) { printf("Could not refresh bundle"); @@ -989,7 +989,7 @@ celix_status_t fw_uninstallBundle(FRAMEW return status; } -celix_status_t fw_refreshBundles(FRAMEWORK framework, BUNDLE bundles[], int size) { +celix_status_t fw_refreshBundles(framework_t framework, bundle_t bundles[], int size) { celix_status_t status = CELIX_SUCCESS; bool locked = framework_acquireGlobalLock(framework); @@ -998,14 +998,14 @@ celix_status_t fw_refreshBundles(FRAMEWO framework_releaseGlobalLock(framework); status = CELIX_ILLEGAL_STATE; } else { - HASH_MAP_VALUES values; - BUNDLE *newTargets; + hash_map_values_t values; + bundle_t *newTargets; int nrofvalues; bool restart = false; - HASH_MAP map = hashMap_create(NULL, NULL, NULL, NULL); + hash_map_t map = hashMap_create(NULL, NULL, NULL, NULL); int targetIdx = 0; for (targetIdx = 0; targetIdx < size; targetIdx++) { - BUNDLE bundle = bundles[targetIdx]; + bundle_t bundle = bundles[targetIdx]; hashMap_put(map, bundle, bundle); fw_populateDependentGraph(framework, bundle, &map); } @@ -1019,7 +1019,7 @@ celix_status_t fw_refreshBundles(FRAMEWO int i = 0; struct fw_refreshHelper * helpers; for (i = 0; i < nrofvalues && !restart; i++) { - BUNDLE bundle = (BUNDLE) newTargets[i]; + bundle_t bundle = (bundle_t) newTargets[i]; if (framework->bundle == bundle) { restart = true; } @@ -1027,7 +1027,7 @@ celix_status_t fw_refreshBundles(FRAMEWO helpers = (struct fw_refreshHelper * )malloc(nrofvalues * sizeof(struct fw_refreshHelper)); for (i = 0; i < nrofvalues && !restart; i++) { - BUNDLE bundle = (BUNDLE) newTargets[i]; + bundle_t bundle = (bundle_t) newTargets[i]; helpers[i].framework = framework; helpers[i].bundle = bundle; helpers[i].oldState = BUNDLE_INSTALLED; @@ -1057,9 +1057,9 @@ celix_status_t fw_refreshBundles(FRAMEWO return status; } -celix_status_t fw_refreshBundle(FRAMEWORK framework, BUNDLE bundle) { +celix_status_t fw_refreshBundle(framework_t framework, bundle_t bundle) { celix_status_t status = CELIX_SUCCESS; - BUNDLE_STATE state; + bundle_state_e state; status = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED | BUNDLE_RESOLVED); if (status != CELIX_SUCCESS) { @@ -1081,7 +1081,7 @@ celix_status_t fw_refreshBundle(FRAMEWOR } celix_status_t fw_refreshHelper_stop(struct fw_refreshHelper * refreshHelper) { - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(refreshHelper->bundle, &state); if (state == BUNDLE_ACTIVE) { refreshHelper->oldState = BUNDLE_ACTIVE; @@ -1092,7 +1092,7 @@ celix_status_t fw_refreshHelper_stop(str } celix_status_t fw_refreshHelper_refreshOrRemove(struct fw_refreshHelper * refreshHelper) { - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(refreshHelper->bundle, &state); if (state == BUNDLE_UNINSTALLED) { bundle_closeAndDelete(refreshHelper->bundle); @@ -1110,11 +1110,11 @@ celix_status_t fw_refreshHelper_restart( return CELIX_SUCCESS; } -celix_status_t fw_getDependentBundles(FRAMEWORK framework, BUNDLE exporter, ARRAY_LIST *list) { +celix_status_t fw_getDependentBundles(framework_t framework, bundle_t exporter, array_list_t *list) { celix_status_t status = CELIX_SUCCESS; if (*list == NULL && exporter != NULL && framework != NULL) { - ARRAY_LIST modules; + array_list_t modules; unsigned int modIdx = 0; apr_pool_t *pool = NULL; bundle_getMemoryPool(exporter, &pool); @@ -1122,11 +1122,11 @@ celix_status_t fw_getDependentBundles(FR modules = bundle_getModules(exporter); for (modIdx = 0; modIdx < arrayList_size(modules); modIdx++) { - MODULE module = arrayList_get(modules, modIdx); - ARRAY_LIST dependents = module_getDependents(module); + module_t module = arrayList_get(modules, modIdx); + array_list_t dependents = module_getDependents(module); unsigned int depIdx = 0; for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents)); depIdx++) { - MODULE dependent = arrayList_get(dependents, depIdx); + module_t dependent = arrayList_get(dependents, depIdx); arrayList_add(*list, module_getBundle(dependent)); } arrayList_destroy(dependents); @@ -1138,11 +1138,11 @@ celix_status_t fw_getDependentBundles(FR return status; } -celix_status_t fw_populateDependentGraph(FRAMEWORK framework, BUNDLE exporter, HASH_MAP *map) { +celix_status_t fw_populateDependentGraph(framework_t framework, bundle_t exporter, hash_map_t *map) { celix_status_t status = CELIX_SUCCESS; if (exporter != NULL && framework != NULL) { - ARRAY_LIST dependents = NULL; + array_list_t dependents = NULL; if ((status = fw_getDependentBundles(framework, exporter, &dependents)) == CELIX_SUCCESS) { unsigned int depIdx = 0; for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents)); depIdx++) { @@ -1160,7 +1160,7 @@ celix_status_t fw_populateDependentGraph return status; } -celix_status_t fw_registerService(FRAMEWORK framework, SERVICE_REGISTRATION *registration, BUNDLE bundle, char * serviceName, void * svcObj, PROPERTIES properties) { +celix_status_t fw_registerService(framework_t framework, service_registration_t *registration, bundle_t bundle, char * serviceName, void * svcObj, properties_t properties) { celix_status_t lock; if (serviceName == NULL) { printf("Service name cannot be null"); @@ -1182,9 +1182,9 @@ celix_status_t fw_registerService(FRAMEW // If this is a listener hook, invoke the callback with all current listeners if (strcmp(serviceName, listener_hook_service_name) == 0) { unsigned int i; - ARRAY_LIST infos = NULL; + array_list_t infos = NULL; apr_pool_t *subpool; - SERVICE_REFERENCE ref = NULL; + service_reference_t ref = NULL; listener_hook_service_t hook; apr_pool_t *pool = NULL; @@ -1192,7 +1192,7 @@ celix_status_t fw_registerService(FRAMEW arrayList_create(pool, &infos); for (i = 0; i > arrayList_size(framework->serviceListeners); i++) { - FW_SERVICE_LISTENER listener = arrayList_get(framework->serviceListeners, i); + fw_service_listener_t listener = arrayList_get(framework->serviceListeners, i); apr_pool_t *pool; bundle_context_t context; listener_hook_info_t info; @@ -1223,7 +1223,7 @@ celix_status_t fw_registerService(FRAMEW return CELIX_SUCCESS; } -celix_status_t fw_registerServiceFactory(FRAMEWORK framework, SERVICE_REGISTRATION *registration, BUNDLE bundle, char * serviceName, service_factory_t factory, PROPERTIES properties) { +celix_status_t fw_registerServiceFactory(framework_t framework, service_registration_t *registration, bundle_t bundle, char * serviceName, service_factory_t factory, properties_t properties) { celix_status_t lock; if (serviceName == NULL) { printf("Service name cannot be null"); @@ -1245,7 +1245,7 @@ celix_status_t fw_registerServiceFactory return CELIX_SUCCESS; } -celix_status_t fw_getServiceReferences(FRAMEWORK framework, ARRAY_LIST *references, BUNDLE bundle, const char * serviceName, char * sfilter) { +celix_status_t fw_getServiceReferences(framework_t framework, array_list_t *references, bundle_t bundle, const char * serviceName, char * sfilter) { filter_t filter = NULL; unsigned int refIdx = 0; apr_pool_t *pool = NULL; @@ -1263,10 +1263,10 @@ celix_status_t fw_getServiceReferences(F } for (refIdx = 0; (*references != NULL) && refIdx < arrayList_size(*references); refIdx++) { - SERVICE_REFERENCE ref = (SERVICE_REFERENCE) arrayList_get(*references, refIdx); - SERVICE_REGISTRATION reg = NULL; + service_reference_t ref = (service_reference_t) arrayList_get(*references, refIdx); + service_registration_t reg = NULL; char * serviceName; - PROPERTIES props = NULL; + properties_t props = NULL; serviceReference_getServiceRegistration(ref, ®); serviceRegistration_getProperties(reg, &props); serviceName = properties_get(props, (char *) OBJECTCLASS); @@ -1279,37 +1279,37 @@ celix_status_t fw_getServiceReferences(F return CELIX_SUCCESS; } -void * fw_getService(FRAMEWORK framework, BUNDLE bundle, SERVICE_REFERENCE reference) { +void * fw_getService(framework_t framework, bundle_t bundle, service_reference_t reference) { return serviceRegistry_getService(framework->registry, bundle, reference); } -celix_status_t fw_getBundleRegisteredServices(FRAMEWORK framework, apr_pool_t *pool, BUNDLE bundle, ARRAY_LIST *services) { +celix_status_t fw_getBundleRegisteredServices(framework_t framework, apr_pool_t *pool, bundle_t bundle, array_list_t *services) { return serviceRegistry_getRegisteredServices(framework->registry, pool, bundle, services); } -celix_status_t fw_getBundleServicesInUse(FRAMEWORK framework, BUNDLE bundle, ARRAY_LIST *services) { +celix_status_t fw_getBundleServicesInUse(framework_t framework, bundle_t bundle, array_list_t *services) { celix_status_t status = CELIX_SUCCESS; *services = serviceRegistry_getServicesInUse(framework->registry, bundle); return status; } -bool framework_ungetService(FRAMEWORK framework, BUNDLE bundle, SERVICE_REFERENCE reference) { +bool framework_ungetService(framework_t framework, bundle_t bundle, service_reference_t reference) { return serviceRegistry_ungetService(framework->registry, bundle, reference); } -void fw_addServiceListener(FRAMEWORK framework, BUNDLE bundle, SERVICE_LISTENER listener, char * sfilter) { +void fw_addServiceListener(framework_t framework, bundle_t bundle, service_listener_t listener, char * sfilter) { // apr_pool_t *pool; // apr_pool_t *bpool; // bundle_context_t context; // bundle_getContext(bundle, &context); // bundleContext_getMemoryPool(context, &bpool); // apr_pool_create(&pool, bpool); - ARRAY_LIST listenerHooks = NULL; + array_list_t listenerHooks = NULL; apr_pool_t *subpool; listener_hook_info_t info; unsigned int i; - FW_SERVICE_LISTENER fwListener = (FW_SERVICE_LISTENER) malloc(sizeof(*fwListener)); + fw_service_listener_t fwListener = (fw_service_listener_t) malloc(sizeof(*fwListener)); apr_pool_t *pool = NULL; bundle_context_t context = NULL; @@ -1338,9 +1338,9 @@ void fw_addServiceListener(FRAMEWORK fra info->filter = sfilter == NULL ? NULL : apr_pstrdup(subpool, sfilter); for (i = 0; i < arrayList_size(listenerHooks); i++) { - SERVICE_REFERENCE ref = arrayList_get(listenerHooks, i); + service_reference_t ref = arrayList_get(listenerHooks, i); listener_hook_service_t hook = fw_getService(framework, framework->bundle, ref); - ARRAY_LIST infos = NULL; + array_list_t infos = NULL; arrayList_create(subpool, &infos); arrayList_add(infos, info); hook->added(hook->handle, infos); @@ -1351,18 +1351,18 @@ void fw_addServiceListener(FRAMEWORK fra apr_pool_destroy(subpool); } -void fw_removeServiceListener(FRAMEWORK framework, BUNDLE bundle, SERVICE_LISTENER listener) { +void fw_removeServiceListener(framework_t framework, bundle_t bundle, service_listener_t listener) { listener_hook_info_t info = NULL; apr_pool_t *pool; unsigned int i; - FW_SERVICE_LISTENER element; + fw_service_listener_t element; bundle_context_t context; bundle_getContext(bundle, &context); bundleContext_getMemoryPool(context, &pool); for (i = 0; i < arrayList_size(framework->serviceListeners); i++) { - element = (FW_SERVICE_LISTENER) arrayList_get(framework->serviceListeners, i); + element = (fw_service_listener_t) arrayList_get(framework->serviceListeners, i); if (element->listener == listener && element->bundle == bundle) { bundle_context_t lContext = NULL; @@ -1389,13 +1389,13 @@ void fw_removeServiceListener(FRAMEWORK if (info != NULL) { unsigned int i; - ARRAY_LIST listenerHooks = NULL; + array_list_t listenerHooks = NULL; serviceRegistry_getListenerHooks(framework->registry, pool, &listenerHooks); for (i = 0; i < arrayList_size(listenerHooks); i++) { - SERVICE_REFERENCE ref = arrayList_get(listenerHooks, i); + service_reference_t ref = arrayList_get(listenerHooks, i); listener_hook_service_t hook = fw_getService(framework, framework->bundle, ref); - ARRAY_LIST infos = NULL; + array_list_t infos = NULL; apr_pool_t *pool = NULL; bundle_getMemoryPool(bundle, &pool); @@ -1409,7 +1409,7 @@ void fw_removeServiceListener(FRAMEWORK } } -celix_status_t fw_addBundleListener(FRAMEWORK framework, BUNDLE bundle, bundle_listener_t listener) { +celix_status_t fw_addBundleListener(framework_t framework, bundle_t bundle, bundle_listener_t listener) { celix_status_t status = CELIX_SUCCESS; apr_pool_t *pool = NULL; @@ -1430,7 +1430,7 @@ celix_status_t fw_addBundleListener(FRAM return status; } -celix_status_t fw_removeBundleListener(FRAMEWORK framework, BUNDLE bundle, bundle_listener_t listener) { +celix_status_t fw_removeBundleListener(framework_t framework, bundle_t bundle, bundle_listener_t listener) { celix_status_t status = CELIX_SUCCESS; unsigned int i; @@ -1447,28 +1447,28 @@ celix_status_t fw_removeBundleListener(F return status; } -void fw_serviceChanged(FRAMEWORK framework, SERVICE_EVENT_TYPE eventType, SERVICE_REGISTRATION registration, PROPERTIES oldprops) { +void fw_serviceChanged(framework_t framework, service_event_type_e eventType, service_registration_t registration, properties_t oldprops) { unsigned int i; - FW_SERVICE_LISTENER element; + fw_service_listener_t element; if (arrayList_size(framework->serviceListeners) > 0) { for (i = 0; i < arrayList_size(framework->serviceListeners); i++) { int matched = 0; - PROPERTIES props = NULL; + properties_t props = NULL; bool matchResult = false; - element = (FW_SERVICE_LISTENER) arrayList_get(framework->serviceListeners, i); + element = (fw_service_listener_t) arrayList_get(framework->serviceListeners, i); serviceRegistration_getProperties(registration, &props); if (element->filter != NULL) { filter_match(element->filter, props, &matchResult); } matched = (element->filter == NULL) || matchResult; if (matched) { - SERVICE_REFERENCE reference = NULL; - SERVICE_EVENT event; + service_reference_t reference = NULL; + service_event_t event; apr_pool_t *spool = NULL; apr_pool_create(&spool, element->listener->pool); - event = (SERVICE_EVENT) apr_palloc(spool, sizeof(*event)); + event = (service_event_t) apr_palloc(spool, sizeof(*event)); serviceRegistry_createServiceReference(framework->registry, spool, registration, &reference); @@ -1484,8 +1484,8 @@ void fw_serviceChanged(FRAMEWORK framewo } matched = (element->filter == NULL) || matchResult; if (matched) { - SERVICE_REFERENCE reference = NULL; - SERVICE_EVENT endmatch = (SERVICE_EVENT) malloc(sizeof(*endmatch)); + service_reference_t reference = NULL; + service_event_t endmatch = (service_event_t) malloc(sizeof(*endmatch)); serviceRegistry_createServiceReference(framework->registry, element->listener->pool, registration, &reference); @@ -1498,11 +1498,11 @@ void fw_serviceChanged(FRAMEWORK framewo } } -//celix_status_t fw_isServiceAssignable(FRAMEWORK fw, BUNDLE requester, SERVICE_REFERENCE reference, bool *assignable) { +//celix_status_t fw_isServiceAssignable(framework_t fw, bundle_t requester, service_reference_t reference, bool *assignable) { // celix_status_t status = CELIX_SUCCESS; // // *assignable = true; -// SERVICE_REGISTRATION registration = NULL; +// service_registration_t registration = NULL; // status = serviceReference_getServiceRegistration(reference, ®istration); // if (status == CELIX_SUCCESS) { // char *serviceName = properties_get(registration->properties, (char *) OBJECTCLASS); @@ -1541,19 +1541,19 @@ celix_status_t getManifest(bundle_archiv return status; } -long framework_getNextBundleId(FRAMEWORK framework) { +long framework_getNextBundleId(framework_t framework) { long id = framework->nextBundleId; framework->nextBundleId++; return id; } -celix_status_t framework_markResolvedModules(FRAMEWORK framework, HASH_MAP resolvedModuleWireMap) { +celix_status_t framework_markResolvedModules(framework_t framework, hash_map_t resolvedModuleWireMap) { if (resolvedModuleWireMap != NULL) { - HASH_MAP_ITERATOR iterator = hashMapIterator_create(resolvedModuleWireMap); + hash_map_iterator_t iterator = hashMapIterator_create(resolvedModuleWireMap); while (hashMapIterator_hasNext(iterator)) { - HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator); - MODULE module = (MODULE) hashMapEntry_getKey(entry); - LINKED_LIST wires = (LINKED_LIST) hashMapEntry_getValue(entry); + hash_map_entry_t entry = hashMapIterator_nextEntry(iterator); + module_t module = (module_t) hashMapEntry_getKey(entry); + linked_list_t wires = (linked_list_t) hashMapEntry_getValue(entry); module_setWires(module, wires); @@ -1566,9 +1566,9 @@ celix_status_t framework_markResolvedMod return CELIX_SUCCESS; } -celix_status_t framework_markBundleResolved(FRAMEWORK framework, MODULE module) { - BUNDLE bundle = module_getBundle(module); - BUNDLE_STATE state; +celix_status_t framework_markBundleResolved(framework_t framework, module_t module) { + bundle_t bundle = module_getBundle(module); + bundle_state_e state; if (bundle != NULL) { framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_ACTIVE); @@ -1585,29 +1585,29 @@ celix_status_t framework_markBundleResol return CELIX_SUCCESS; } -ARRAY_LIST framework_getBundles(FRAMEWORK framework) { - ARRAY_LIST bundles = NULL; - HASH_MAP_ITERATOR iterator; +array_list_t framework_getBundles(framework_t framework) { + array_list_t bundles = NULL; + hash_map_iterator_t iterator; arrayList_create(framework->mp, &bundles); iterator = hashMapIterator_create(framework->installedBundleMap); while (hashMapIterator_hasNext(iterator)) { - BUNDLE bundle = hashMapIterator_nextValue(iterator); + bundle_t bundle = hashMapIterator_nextValue(iterator); arrayList_add(bundles, bundle); } hashMapIterator_destroy(iterator); return bundles; } -BUNDLE framework_getBundle(FRAMEWORK framework, char * location) { - BUNDLE bundle = hashMap_get(framework->installedBundleMap, location); +bundle_t framework_getBundle(framework_t framework, char * location) { + bundle_t bundle = hashMap_get(framework->installedBundleMap, location); return bundle; } -BUNDLE framework_getBundleById(FRAMEWORK framework, long id) { - HASH_MAP_ITERATOR iter = hashMapIterator_create(framework->installedBundleMap); - BUNDLE bundle = NULL; +bundle_t framework_getBundleById(framework_t framework, long id) { + hash_map_iterator_t iter = hashMapIterator_create(framework->installedBundleMap); + bundle_t bundle = NULL; while (hashMapIterator_hasNext(iter)) { - BUNDLE b = hashMapIterator_nextValue(iter); + bundle_t b = hashMapIterator_nextValue(iter); bundle_archive_t archive = NULL; long bid; bundle_getArchive(b, &archive); @@ -1621,7 +1621,7 @@ BUNDLE framework_getBundleById(FRAMEWORK return bundle; } -celix_status_t framework_acquireInstallLock(FRAMEWORK framework, char * location) { +celix_status_t framework_acquireInstallLock(framework_t framework, char * location) { apr_thread_mutex_lock(framework->installRequestLock); while (hashMap_get(framework->installRequestMap, location) != NULL) { @@ -1634,7 +1634,7 @@ celix_status_t framework_acquireInstallL return CELIX_SUCCESS; } -celix_status_t framework_releaseInstallLock(FRAMEWORK framework, char * location) { +celix_status_t framework_releaseInstallLock(framework_t framework, char * location) { apr_thread_mutex_lock(framework->installRequestLock); hashMap_remove(framework->installRequestMap, location); @@ -1645,7 +1645,7 @@ celix_status_t framework_releaseInstallL return CELIX_SUCCESS; } -celix_status_t framework_setBundleStateAndNotify(FRAMEWORK framework, BUNDLE bundle, int state) { +celix_status_t framework_setBundleStateAndNotify(framework_t framework, bundle_t bundle, int state) { int ret = CELIX_SUCCESS; int err = apr_thread_mutex_lock(framework->bundleLock); @@ -1669,7 +1669,7 @@ celix_status_t framework_setBundleStateA return CELIX_SUCCESS; } -celix_status_t framework_acquireBundleLock(FRAMEWORK framework, BUNDLE bundle, int desiredStates) { +celix_status_t framework_acquireBundleLock(framework_t framework, bundle_t bundle, int desiredStates) { celix_status_t status = CELIX_SUCCESS; bool locked; @@ -1689,7 +1689,7 @@ celix_status_t framework_acquireBundleLo while (!lockable || ((framework->globalLockThread != 0) && !isSelf)) { - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(bundle, &state); if ((desiredStates & state) == 0) { status = CELIX_ILLEGAL_STATE; @@ -1713,7 +1713,7 @@ celix_status_t framework_acquireBundleLo } if (status == CELIX_SUCCESS) { - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(bundle, &state); if ((desiredStates & state) == 0) { status = CELIX_ILLEGAL_STATE; @@ -1731,7 +1731,7 @@ celix_status_t framework_acquireBundleLo return CELIX_SUCCESS; } -bool framework_releaseBundleLock(FRAMEWORK framework, BUNDLE bundle) { +bool framework_releaseBundleLock(framework_t framework, bundle_t bundle) { bool unlocked; apr_os_thread_t lockingThread = 0; @@ -1752,7 +1752,7 @@ bool framework_releaseBundleLock(FRAMEWO return true; } -bool framework_acquireGlobalLock(FRAMEWORK framework) { +bool framework_acquireGlobalLock(framework_t framework) { bool interrupted = false; bool isSelf = false; @@ -1786,7 +1786,7 @@ bool framework_acquireGlobalLock(FRAMEWO return !interrupted; } -celix_status_t framework_releaseGlobalLock(FRAMEWORK framework) { +celix_status_t framework_releaseGlobalLock(framework_t framework) { int ret = CELIX_SUCCESS; if (apr_thread_mutex_lock(framework->bundleLock) != 0) { celix_log("Error locking framework bundle lock"); @@ -1814,7 +1814,7 @@ celix_status_t framework_releaseGlobalLo return ret; } -celix_status_t framework_waitForStop(FRAMEWORK framework) { +celix_status_t framework_waitForStop(framework_t framework) { if (apr_thread_mutex_lock(framework->mutex) != 0) { celix_log("Error locking the framework, shutdown gate not set."); return CELIX_FRAMEWORK_EXCEPTION; @@ -1837,16 +1837,16 @@ celix_status_t framework_waitForStop(FRA static void *APR_THREAD_FUNC framework_shutdown(apr_thread_t *thd, void *framework) { //static void * framework_shutdown(void * framework) { - FRAMEWORK fw = (FRAMEWORK) framework; - HASH_MAP_ITERATOR iterator; + framework_t fw = (framework_t) framework; + hash_map_iterator_t iterator; int err; printf("FRAMEWORK: Shutdown\n"); iterator = hashMapIterator_create(fw->installedBundleMap); while (hashMapIterator_hasNext(iterator)) { - BUNDLE bundle = hashMapIterator_nextValue(iterator); - BUNDLE_STATE state; + bundle_t bundle = hashMapIterator_nextValue(iterator); + bundle_state_e state; bundle_getState(bundle, &state); if (state == BUNDLE_ACTIVE || state == BUNDLE_STARTING) { char *location; @@ -1895,7 +1895,7 @@ static void *APR_THREAD_FUNC framework_s return NULL; } -celix_status_t framework_getMemoryPool(FRAMEWORK framework, apr_pool_t **pool) { +celix_status_t framework_getMemoryPool(framework_t framework, apr_pool_t **pool) { celix_status_t status = CELIX_SUCCESS; if (framework != NULL && *pool == NULL) { @@ -1907,7 +1907,7 @@ celix_status_t framework_getMemoryPool(F return status; } -celix_status_t framework_getFrameworkBundle(FRAMEWORK framework, BUNDLE *bundle) { +celix_status_t framework_getFrameworkBundle(framework_t framework, bundle_t *bundle) { celix_status_t status = CELIX_SUCCESS; if (framework != NULL && *bundle == NULL) { @@ -1919,7 +1919,7 @@ celix_status_t framework_getFrameworkBun return status; } -celix_status_t fw_fireBundleEvent(FRAMEWORK framework, bundle_event_type_e eventType, BUNDLE bundle) { +celix_status_t fw_fireBundleEvent(framework_t framework, bundle_event_type_e eventType, bundle_t bundle) { celix_status_t status = CELIX_SUCCESS; if ((eventType != BUNDLE_EVENT_STARTING) @@ -1954,7 +1954,7 @@ celix_status_t fw_fireBundleEvent(FRAMEW } static void *APR_THREAD_FUNC fw_eventDispatcher(apr_thread_t *thd, void *fw) { - FRAMEWORK framework = (FRAMEWORK) fw; + framework_t framework = (framework_t) fw; request_t request = NULL; while (true) { @@ -2008,9 +2008,9 @@ static void *APR_THREAD_FUNC fw_eventDis } -celix_status_t fw_invokeBundleListener(FRAMEWORK framework, bundle_listener_t listener, bundle_event_t event, BUNDLE bundle) { +celix_status_t fw_invokeBundleListener(framework_t framework, bundle_listener_t listener, bundle_event_t event, bundle_t bundle) { // We only support async bundle listeners for now - BUNDLE_STATE state; + bundle_state_e state; bundle_getState(bundle, &state); if (state == BUNDLE_STARTING || state == BUNDLE_ACTIVE) { @@ -2029,7 +2029,7 @@ celix_status_t bundleActivator_stop(void celix_status_t status = CELIX_SUCCESS; apr_thread_t *shutdownThread; - FRAMEWORK framework; + framework_t framework; if (bundleContext_getFramework(context, &framework) == CELIX_SUCCESS) { Modified: incubator/celix/trunk/framework/private/src/manifest.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/manifest.c (original) +++ incubator/celix/trunk/framework/private/src/manifest.c Wed Dec 5 09:05:46 2012 @@ -32,7 +32,7 @@ #include "utils.h" int fpeek(FILE *stream); -celix_status_t manifest_readAttributes(MANIFEST manifest, PROPERTIES properties, FILE *file); +celix_status_t manifest_readAttributes(MANIFEST manifest, properties_t properties, FILE *file); apr_status_t manifest_destroy(void *manifestP); celix_status_t manifest_create(apr_pool_t *pool, MANIFEST *manifest) { @@ -78,11 +78,11 @@ void manifest_clear(MANIFEST manifest) { } -PROPERTIES manifest_getMainAttributes(MANIFEST manifest) { +properties_t manifest_getMainAttributes(MANIFEST manifest) { return manifest->mainAttributes; } -celix_status_t manifest_getEntries(MANIFEST manifest, HASH_MAP *map) { +celix_status_t manifest_getEntries(MANIFEST manifest, hash_map_t *map) { *map = manifest->attributes; return CELIX_SUCCESS; } @@ -103,7 +103,7 @@ celix_status_t manifest_read(MANIFEST ma apr_pool_create(&subpool, manifest->pool); while (fgets(lbuf, sizeof(lbuf), file) != NULL ) { - PROPERTIES attributes; + properties_t attributes; len = strlen(lbuf); if (lbuf[--len] != '\n') { @@ -191,7 +191,7 @@ int fpeek(FILE *stream) { return c; } -celix_status_t manifest_readAttributes(MANIFEST manifest, PROPERTIES properties, FILE *file) { +celix_status_t manifest_readAttributes(MANIFEST manifest, properties_t properties, FILE *file) { char *name = NULL; char *value = NULL; char *lastLine = NULL; Modified: incubator/celix/trunk/framework/private/src/manifest_parser.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest_parser.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/manifest_parser.c (original) +++ incubator/celix/trunk/framework/private/src/manifest_parser.c Wed Dec 5 09:05:46 2012 @@ -38,27 +38,27 @@ #include "linked_list_iterator.h" struct manifestParser { - MODULE owner; + module_t owner; MANIFEST manifest; - VERSION bundleVersion; + version_t bundleVersion; char * bundleSymbolicName; - LINKED_LIST capabilities; - LINKED_LIST requirements; + linked_list_t capabilities; + linked_list_t requirements; }; -static LINKED_LIST manifestParser_parseImportHeader(char * header, apr_pool_t *memory_pool); -static LINKED_LIST manifestParser_parseExportHeader(MODULE module, char * header, apr_pool_t *memory_pool); -static LINKED_LIST manifestParser_parseDelimitedString(char * value, char * delim, apr_pool_t *memory_pool); -static LINKED_LIST manifestParser_parseStandardHeaderClause(char * clauseString, apr_pool_t *memory_pool); -static LINKED_LIST manifestParser_parseStandardHeader(char * header, apr_pool_t *memory_pool); +static linked_list_t manifestParser_parseImportHeader(char * header, apr_pool_t *memory_pool); +static linked_list_t manifestParser_parseExportHeader(module_t module, char * header, apr_pool_t *memory_pool); +static linked_list_t manifestParser_parseDelimitedString(char * value, char * delim, apr_pool_t *memory_pool); +static linked_list_t manifestParser_parseStandardHeaderClause(char * clauseString, apr_pool_t *memory_pool); +static linked_list_t manifestParser_parseStandardHeader(char * header, apr_pool_t *memory_pool); -celix_status_t manifestParser_create(MODULE owner, MANIFEST manifest, apr_pool_t *memory_pool, MANIFEST_PARSER *manifest_parser) { +celix_status_t manifestParser_create(module_t owner, MANIFEST manifest, apr_pool_t *memory_pool, manifest_parser_t *manifest_parser) { celix_status_t status; - MANIFEST_PARSER parser; + manifest_parser_t parser; status = CELIX_SUCCESS; - parser = (MANIFEST_PARSER) apr_pcalloc(memory_pool, sizeof(*parser)); + parser = (manifest_parser_t) apr_pcalloc(memory_pool, sizeof(*parser)); if (parser) { char * bundleVersion = NULL; char * bundleSymbolicName = NULL; @@ -91,8 +91,8 @@ celix_status_t manifestParser_create(MOD return status; } -static LINKED_LIST manifestParser_parseDelimitedString(char * value, char * delim, apr_pool_t *memory_pool) { - LINKED_LIST list; +static linked_list_t manifestParser_parseDelimitedString(char * value, char * delim, apr_pool_t *memory_pool) { + linked_list_t list; apr_pool_t *temp_pool; if (linkedList_create(memory_pool, &list) == CELIX_SUCCESS) { @@ -158,11 +158,11 @@ static LINKED_LIST manifestParser_parseD return list; } -static LINKED_LIST manifestParser_parseStandardHeaderClause(char * clauseString, apr_pool_t *memory_pool) { - LINKED_LIST paths; +static linked_list_t manifestParser_parseStandardHeaderClause(char * clauseString, apr_pool_t *memory_pool) { + linked_list_t paths; apr_pool_t *temp_pool; - LINKED_LIST clause; - LINKED_LIST pieces; + linked_list_t clause; + linked_list_t pieces; clause = NULL; pieces = NULL; @@ -172,8 +172,8 @@ static LINKED_LIST manifestParser_parseS if (linkedList_create(memory_pool, &paths) == CELIX_SUCCESS) { int pathCount = 0; int pieceIdx; - HASH_MAP dirsMap = NULL; - HASH_MAP attrsMap = NULL; + hash_map_t dirsMap = NULL; + hash_map_t attrsMap = NULL; char * sepPtr; char * sep; @@ -224,7 +224,7 @@ static LINKED_LIST manifestParser_parseS if (strcmp(sep, DIRECTIVE_SEP) == 0) { // Not implemented } else { - ATTRIBUTE attr = NULL; + attribute_t attr = NULL; if (hashMap_containsKey(attrsMap, key)) { return NULL; } @@ -250,11 +250,11 @@ static LINKED_LIST manifestParser_parseS return clause; } -static LINKED_LIST manifestParser_parseStandardHeader(char * header, apr_pool_t *memory_pool) { +static linked_list_t manifestParser_parseStandardHeader(char * header, apr_pool_t *memory_pool) { int i; char *clauseString; - LINKED_LIST clauseStrings = NULL; - LINKED_LIST completeList = NULL; + linked_list_t clauseStrings = NULL; + linked_list_t completeList = NULL; if (linkedList_create(memory_pool, &completeList) == CELIX_SUCCESS) { if (header != NULL) { @@ -275,28 +275,28 @@ static LINKED_LIST manifestParser_parseS return completeList; } -static LINKED_LIST manifestParser_parseImportHeader(char * header, apr_pool_t *memory_pool) { +static linked_list_t manifestParser_parseImportHeader(char * header, apr_pool_t *memory_pool) { apr_pool_t *temp_pool; - LINKED_LIST clauses; - LINKED_LIST requirements; + linked_list_t clauses; + linked_list_t requirements; if (apr_pool_create(&temp_pool, memory_pool) == APR_SUCCESS) { int clauseIdx; - LINKED_LIST_ITERATOR iter; + linked_list_iterator_t iter; clauses = manifestParser_parseStandardHeader(header, memory_pool); linkedList_create(memory_pool, &requirements); for (clauseIdx = 0; clauseIdx < linkedList_size(clauses); clauseIdx++) { - LINKED_LIST clause = linkedList_get(clauses, clauseIdx); + linked_list_t clause = linkedList_get(clauses, clauseIdx); - LINKED_LIST paths = linkedList_get(clause, 0); - HASH_MAP directives = linkedList_get(clause, 1); - HASH_MAP attributes = linkedList_get(clause, 2); + linked_list_t paths = linkedList_get(clause, 0); + hash_map_t directives = linkedList_get(clause, 1); + hash_map_t attributes = linkedList_get(clause, 2); int pathIdx; for (pathIdx = 0; pathIdx < linkedList_size(paths); pathIdx++) { - ATTRIBUTE name = NULL; - REQUIREMENT req = NULL; + attribute_t name = NULL; + requirement_t req = NULL; char * path = (char *) linkedList_get(paths, pathIdx); if (strlen(path) == 0) { return NULL; @@ -315,9 +315,9 @@ static LINKED_LIST manifestParser_parseI iter = linkedListIterator_create(clauses, 0); while(linkedListIterator_hasNext(iter)) { - LINKED_LIST clause = linkedListIterator_next(iter); + linked_list_t clause = linkedListIterator_next(iter); - LINKED_LIST paths = linkedList_get(clause, 0); + linked_list_t paths = linkedList_get(clause, 0); linkedListIterator_remove(iter); } @@ -329,27 +329,27 @@ static LINKED_LIST manifestParser_parseI return requirements; } -static LINKED_LIST manifestParser_parseExportHeader(MODULE module, char * header, apr_pool_t *memory_pool) { - LINKED_LIST clauses; - LINKED_LIST capabilities; +static linked_list_t manifestParser_parseExportHeader(module_t module, char * header, apr_pool_t *memory_pool) { + linked_list_t clauses; + linked_list_t capabilities; int clauseIdx; - LINKED_LIST_ITERATOR iter; + linked_list_iterator_t iter; clauses = manifestParser_parseStandardHeader(header, memory_pool); linkedList_create(memory_pool, &capabilities); for (clauseIdx = 0; clauseIdx < linkedList_size(clauses); clauseIdx++) { - LINKED_LIST clause = linkedList_get(clauses, clauseIdx); + linked_list_t clause = linkedList_get(clauses, clauseIdx); - LINKED_LIST paths = linkedList_get(clause, 0); - HASH_MAP directives = linkedList_get(clause, 1); - HASH_MAP attributes = linkedList_get(clause, 2); + linked_list_t paths = linkedList_get(clause, 0); + hash_map_t directives = linkedList_get(clause, 1); + hash_map_t attributes = linkedList_get(clause, 2); int pathIdx; for (pathIdx = 0; pathIdx < linkedList_size(paths); pathIdx++) { char * path = (char *) linkedList_get(paths, pathIdx); - ATTRIBUTE name = NULL; - CAPABILITY cap = NULL; + attribute_t name = NULL; + capability_t cap = NULL; if (strlen(path) == 0) { return NULL; } @@ -366,9 +366,9 @@ static LINKED_LIST manifestParser_parseE } iter = linkedListIterator_create(clauses, 0); while(linkedListIterator_hasNext(iter)) { - LINKED_LIST clause = linkedListIterator_next(iter); + linked_list_t clause = linkedListIterator_next(iter); - LINKED_LIST paths = linkedList_get(clause, 0); + linked_list_t paths = linkedList_get(clause, 0); linkedListIterator_remove(iter); } @@ -377,16 +377,16 @@ static LINKED_LIST manifestParser_parseE return capabilities; } -celix_status_t manifestParser_getSymbolicName(MANIFEST_PARSER parser, apr_pool_t *pool, char **symbolicName) { +celix_status_t manifestParser_getSymbolicName(manifest_parser_t parser, apr_pool_t *pool, char **symbolicName) { *symbolicName = apr_pstrdup(pool, parser->bundleSymbolicName); return CELIX_SUCCESS; } -celix_status_t manifestParser_getBundleVersion(MANIFEST_PARSER parser, apr_pool_t *pool, VERSION *version) { +celix_status_t manifestParser_getBundleVersion(manifest_parser_t parser, apr_pool_t *pool, version_t *version) { return version_clone(parser->bundleVersion, pool, version); } -celix_status_t manifestParser_getCapabilities(MANIFEST_PARSER parser, apr_pool_t *pool, LINKED_LIST *capabilities) { +celix_status_t manifestParser_getCapabilities(manifest_parser_t parser, apr_pool_t *pool, linked_list_t *capabilities) { celix_status_t status = CELIX_SUCCESS; status = linkedList_clone(parser->capabilities, pool, capabilities); @@ -394,7 +394,7 @@ celix_status_t manifestParser_getCapabil return status; } -celix_status_t manifestParser_getRequirements(MANIFEST_PARSER parser, apr_pool_t *pool, LINKED_LIST *requirements) { +celix_status_t manifestParser_getRequirements(manifest_parser_t parser, apr_pool_t *pool, linked_list_t *requirements) { celix_status_t status = CELIX_SUCCESS; status = linkedList_clone(parser->requirements, pool, requirements); Modified: incubator/celix/trunk/framework/private/src/module.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/module.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/module.c (original) +++ incubator/celix/trunk/framework/private/src/module.c Wed Dec 5 09:05:46 2012 @@ -36,13 +36,13 @@ #include "bundle.h" struct module { - LINKED_LIST capabilities; - LINKED_LIST requirements; - LINKED_LIST wires; + linked_list_t capabilities; + linked_list_t requirements; + linked_list_t wires; - ARRAY_LIST dependentImporters; + array_list_t dependentImporters; - VERSION version; + version_t version; char * symbolicName; bool resolved; @@ -52,9 +52,9 @@ struct module { struct bundle * bundle; }; -MODULE module_create(MANIFEST headerMap, char * moduleId, BUNDLE bundle) { - MODULE module; - MANIFEST_PARSER mp; +module_t module_create(MANIFEST headerMap, char * moduleId, bundle_t bundle) { + module_t module; + manifest_parser_t mp; apr_pool_t *pool; apr_pool_t *bundlePool = NULL; @@ -64,7 +64,7 @@ MODULE module_create(MANIFEST headerMap, if (headerMap != NULL) { bundle_getMemoryPool(bundle, &bundlePool); - module = (MODULE) apr_palloc(bundlePool, sizeof(*module)); + module = (module_t) apr_palloc(bundlePool, sizeof(*module)); module->headerMap = headerMap; module->id = apr_pstrdup(bundlePool, moduleId); module->bundle = bundle; @@ -97,8 +97,8 @@ MODULE module_create(MANIFEST headerMap, return module; } -MODULE module_createFrameworkModule(BUNDLE bundle) { - MODULE module; +module_t module_createFrameworkModule(bundle_t bundle) { + module_t module; apr_pool_t *capabilities_pool; apr_pool_t *requirements_pool; apr_pool_t *dependentImporters_pool; @@ -106,7 +106,7 @@ MODULE module_createFrameworkModule(BUND bundle_getMemoryPool(bundle, &bundlePool); - module = (MODULE) apr_palloc(bundlePool, sizeof(*module)); + module = (module_t) apr_palloc(bundlePool, sizeof(*module)); if (module) { if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) { if (apr_pool_create(&requirements_pool, bundlePool) == APR_SUCCESS) { @@ -131,20 +131,20 @@ MODULE module_createFrameworkModule(BUND return module; } -void module_destroy(MODULE module) { +void module_destroy(module_t module) { arrayList_destroy(module->dependentImporters); module->headerMap = NULL; } -WIRE module_getWire(MODULE module, char * serviceName) { - WIRE wire = NULL; +wire_t module_getWire(module_t module, char * serviceName) { + wire_t wire = NULL; if (module->wires != NULL) { - LINKED_LIST_ITERATOR iterator = linkedListIterator_create(module->wires, 0); + linked_list_iterator_t iterator = linkedListIterator_create(module->wires, 0); while (linkedListIterator_hasNext(iterator)) { char *name; - WIRE next = linkedListIterator_next(iterator); - CAPABILITY cap = NULL; + wire_t next = linkedListIterator_next(iterator); + capability_t cap = NULL; wire_getCapability(next, &cap); capability_getServiceName(cap, &name); if (strcasecmp(name, serviceName) == 0) { @@ -156,11 +156,11 @@ WIRE module_getWire(MODULE module, char return wire; } -VERSION module_getVersion(MODULE module) { +version_t module_getVersion(module_t module) { return module->version; } -celix_status_t module_getSymbolicName(MODULE module, char **symbolicName) { +celix_status_t module_getSymbolicName(module_t module, char **symbolicName) { celix_status_t status = CELIX_SUCCESS; if (module == NULL || *symbolicName != NULL) { @@ -172,19 +172,19 @@ celix_status_t module_getSymbolicName(MO return status; } -char * module_getId(MODULE module) { +char * module_getId(module_t module) { return module->id; } -LINKED_LIST module_getWires(MODULE module) { +linked_list_t module_getWires(module_t module) { return module->wires; } -void module_setWires(MODULE module, LINKED_LIST wires) { +void module_setWires(module_t module, linked_list_t wires) { int i = 0; for (i = 0; (module->wires != NULL) && (i < linkedList_size(module->wires)); i++) { - WIRE wire = (WIRE) linkedList_get(module->wires, i); - MODULE exporter = NULL; + wire_t wire = (wire_t) linkedList_get(module->wires, i); + module_t exporter = NULL; wire_getExporter(wire, &exporter); module_removeDependentImporter(exporter, module); } @@ -192,49 +192,49 @@ void module_setWires(MODULE module, LINK module->wires = wires; for (i = 0; (module->wires != NULL) && (i < linkedList_size(module->wires)); i++) { - WIRE wire = (WIRE) linkedList_get(module->wires, i); - MODULE exporter = NULL; + wire_t wire = (wire_t) linkedList_get(module->wires, i); + module_t exporter = NULL; wire_getExporter(wire, &exporter); module_addDependentImporter(exporter, module); } } -bool module_isResolved(MODULE module) { +bool module_isResolved(module_t module) { return module->resolved; } -void module_setResolved(MODULE module) { +void module_setResolved(module_t module) { module->resolved = true; } -BUNDLE module_getBundle(MODULE module) { +bundle_t module_getBundle(module_t module) { return module->bundle; } -LINKED_LIST module_getRequirements(MODULE module) { +linked_list_t module_getRequirements(module_t module) { return module->requirements; } -LINKED_LIST module_getCapabilities(MODULE module) { +linked_list_t module_getCapabilities(module_t module) { return module->capabilities; } -ARRAY_LIST module_getDependentImporters(MODULE module) { +array_list_t module_getDependentImporters(module_t module) { return module->dependentImporters; } -void module_addDependentImporter(MODULE module, MODULE importer) { +void module_addDependentImporter(module_t module, module_t importer) { if (!arrayList_contains(module->dependentImporters, importer)) { arrayList_add(module->dependentImporters, importer); } } -void module_removeDependentImporter(MODULE module, MODULE importer) { +void module_removeDependentImporter(module_t module, module_t importer) { arrayList_removeElement(module->dependentImporters, importer); } -ARRAY_LIST module_getDependents(MODULE module) { - ARRAY_LIST dependents = NULL; +array_list_t module_getDependents(module_t module) { + array_list_t dependents = NULL; apr_pool_t *bundlePool = NULL; bundle_getMemoryPool(module->bundle, &bundlePool); arrayList_create(bundlePool, &dependents); Modified: incubator/celix/trunk/framework/private/src/properties.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/properties.c?rev=1417320&r1=1417319&r2=1417320&view=diff ============================================================================== --- incubator/celix/trunk/framework/private/src/properties.c (original) +++ incubator/celix/trunk/framework/private/src/properties.c Wed Dec 5 09:05:46 2012 @@ -73,14 +73,14 @@ // return oldValue == NULL ? NULL : oldValue->value; //} -PROPERTIES properties_create(void) { +properties_t properties_create(void) { return hashMap_create(string_hash, string_hash, string_equals, string_equals); } -void properties_destroy(PROPERTIES properties) { - HASH_MAP_ITERATOR iter = hashMapIterator_create(properties); +void properties_destroy(properties_t properties) { + hash_map_iterator_t iter = hashMapIterator_create(properties); while (hashMapIterator_hasNext(iter)) { - HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iter); + hash_map_entry_t entry = hashMapIterator_nextEntry(iter); free(hashMapEntry_getKey(entry)); free(hashMapEntry_getValue(entry)); } @@ -88,8 +88,8 @@ void properties_destroy(PROPERTIES prope hashMap_destroy(properties, false, false); } -PROPERTIES properties_load(char * filename) { - PROPERTIES props = properties_create(); +properties_t properties_load(char * filename) { + properties_t props = properties_create(); FILE *file = fopen ( filename, "r" ); char * cont = strdup("\\"); @@ -142,13 +142,13 @@ PROPERTIES properties_load(char * filena /** * Header is ignored for now, cannot handle comments yet */ -void properties_store(PROPERTIES properties, char * filename, char * header) { +void properties_store(properties_t properties, char * filename, char * header) { FILE *file = fopen ( filename, "w+" ); if (file != NULL) { if (hashMap_size(properties) > 0) { - HASH_MAP_ITERATOR iterator = hashMapIterator_create(properties); + hash_map_iterator_t iterator = hashMapIterator_create(properties); while (hashMapIterator_hasNext(iterator)) { - HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator); + hash_map_entry_t entry = hashMapIterator_nextEntry(iterator); char * line = strdup(hashMapEntry_getKey(entry)); strcat(line, "="); @@ -163,15 +163,15 @@ void properties_store(PROPERTIES propert } } -char * properties_get(PROPERTIES properties, char * key) { +char * properties_get(properties_t properties, char * key) { return hashMap_get(properties, key); } -char * properties_getWithDefault(PROPERTIES properties, char * key, char * defaultValue) { +char * properties_getWithDefault(properties_t properties, char * key, char * defaultValue) { char * value = properties_get(properties, key); return value == NULL ? defaultValue : value; } -char * properties_set(PROPERTIES properties, char * key, char * value) { +char * properties_set(properties_t properties, char * key, char * value) { return hashMap_put(properties, strdup(key), strdup(value)); }