You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2012/12/05 10:06:34 UTC
svn commit: r1417320 [4/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...
Modified: incubator/celix/trunk/framework/private/src/requirement.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/requirement.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/requirement.c (original)
+++ incubator/celix/trunk/framework/private/src/requirement.c Wed Dec 5 09:05:46 2012
@@ -31,35 +31,35 @@
struct requirement {
char * targetName;
- VERSION_RANGE versionRange;
- HASH_MAP attributes;
- HASH_MAP directives;
+ version_range_t versionRange;
+ hash_map_t attributes;
+ hash_map_t directives;
};
apr_status_t requirement_destroy(void *requirementP);
-celix_status_t requirement_create(apr_pool_t *pool, HASH_MAP directives, HASH_MAP attributes, REQUIREMENT *requirement) {
+celix_status_t requirement_create(apr_pool_t *pool, hash_map_t directives, hash_map_t attributes, requirement_t *requirement) {
celix_status_t status = CELIX_SUCCESS;
- *requirement = (REQUIREMENT) apr_palloc(pool, sizeof(**requirement));
+ *requirement = (requirement_t) apr_palloc(pool, sizeof(**requirement));
if (!*requirement) {
status = CELIX_ENOMEM;
} else {
- ATTRIBUTE serviceAttribute = NULL;
- ATTRIBUTE versionAttribute = NULL;
+ attribute_t serviceAttribute = NULL;
+ attribute_t versionAttribute = NULL;
apr_pool_pre_cleanup_register(pool, *requirement, requirement_destroy);
(*requirement)->attributes = attributes;
(*requirement)->directives = directives;
- serviceAttribute = (ATTRIBUTE) hashMap_get(attributes, "service");
+ serviceAttribute = (attribute_t) hashMap_get(attributes, "service");
status = attribute_getValue(serviceAttribute, &(*requirement)->targetName);
if (status == CELIX_SUCCESS) {
(*requirement)->versionRange = NULL;
status = versionRange_createInfiniteVersionRange(pool, &(*requirement)->versionRange);
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);
@@ -74,10 +74,10 @@ celix_status_t requirement_create(apr_po
}
apr_status_t requirement_destroy(void *requirementP) {
- REQUIREMENT requirement = requirementP;
- HASH_MAP_ITERATOR attrIter = hashMapIterator_create(requirement->attributes);
+ requirement_t requirement = requirementP;
+ hash_map_iterator_t attrIter = hashMapIterator_create(requirement->attributes);
while (hashMapIterator_hasNext(attrIter)) {
- ATTRIBUTE attr = hashMapIterator_nextValue(attrIter);
+ attribute_t attr = hashMapIterator_nextValue(attrIter);
hashMapIterator_remove(attrIter);
}
hashMapIterator_destroy(attrIter);
@@ -91,20 +91,20 @@ apr_status_t requirement_destroy(void *r
return APR_SUCCESS;
}
-celix_status_t requirement_getVersionRange(REQUIREMENT requirement, VERSION_RANGE *range) {
+celix_status_t requirement_getVersionRange(requirement_t requirement, version_range_t *range) {
*range = requirement->versionRange;
return CELIX_SUCCESS;
}
-celix_status_t requirement_getTargetName(REQUIREMENT requirement, char **targetName) {
+celix_status_t requirement_getTargetName(requirement_t requirement, char **targetName) {
*targetName = requirement->targetName;
return CELIX_SUCCESS;
}
-celix_status_t requirement_isSatisfied(REQUIREMENT requirement, CAPABILITY capability, bool *inRange) {
+celix_status_t requirement_isSatisfied(requirement_t requirement, capability_t capability, bool *inRange) {
celix_status_t status = CELIX_SUCCESS;
- VERSION version = NULL;
- VERSION_RANGE range = NULL;
+ version_t version = NULL;
+ version_range_t range = NULL;
status = capability_getVersion(capability, &version);
if (status == CELIX_SUCCESS) {
Modified: incubator/celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/resolver.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/resolver.c (original)
+++ incubator/celix/trunk/framework/private/src/resolver.c Wed Dec 5 09:05:46 2012
@@ -34,36 +34,36 @@
struct capabilityList {
char * serviceName;
- LINKED_LIST capabilities;
+ linked_list_t capabilities;
};
-typedef struct capabilityList * CAPABILITY_LIST;
+typedef struct capabilityList * capability_t_LIST;
struct candidateSet {
- MODULE module;
- REQUIREMENT requirement;
- LINKED_LIST candidates;
+ module_t module;
+ requirement_t requirement;
+ linked_list_t candidates;
};
typedef struct candidateSet * CANDIDATE_SET;
-// List containing MODULEs
-LINKED_LIST m_modules = NULL;
-// List containing CAPABILITY_LISTs
-LINKED_LIST m_unresolvedServices = NULL;
-// List containing CAPABILITY_LISTs
-LINKED_LIST m_resolvedServices = NULL;
-
-int resolver_populateCandidatesMap(HASH_MAP candidatesMap, MODULE targetModule);
-CAPABILITY_LIST resolver_getCapabilityList(LINKED_LIST list, char * name);
-void resolver_removeInvalidCandidate(MODULE module, HASH_MAP candidates, LINKED_LIST invalid);
-HASH_MAP resolver_populateWireMap(HASH_MAP candidates, MODULE importer, HASH_MAP wireMap);
-
-HASH_MAP resolver_resolve(MODULE root) {
- HASH_MAP candidatesMap = NULL;
- HASH_MAP wireMap = NULL;
- HASH_MAP resolved = NULL;
- HASH_MAP_ITERATOR iter = NULL;
+// List containing module_ts
+linked_list_t m_modules = NULL;
+// List containing capability_t_LISTs
+linked_list_t m_unresolvedServices = NULL;
+// List containing capability_t_LISTs
+linked_list_t m_resolvedServices = NULL;
+
+int resolver_populateCandidatesMap(hash_map_t candidatesMap, module_t targetModule);
+capability_t_LIST resolver_getCapabilityList(linked_list_t list, char * name);
+void resolver_removeInvalidCandidate(module_t module, hash_map_t candidates, linked_list_t invalid);
+hash_map_t resolver_populateWireMap(hash_map_t candidates, module_t importer, hash_map_t wireMap);
+
+hash_map_t resolver_resolve(module_t root) {
+ hash_map_t candidatesMap = NULL;
+ hash_map_t wireMap = NULL;
+ hash_map_t resolved = NULL;
+ hash_map_iterator_t iter = NULL;
if (module_isResolved(root)) {
printf("already resolved\n");
@@ -73,14 +73,14 @@ HASH_MAP resolver_resolve(MODULE root) {
candidatesMap = hashMap_create(NULL, NULL, NULL, NULL);
if (resolver_populateCandidatesMap(candidatesMap, root) != 0) {
- HASH_MAP_ITERATOR iter = hashMapIterator_create(candidatesMap);
+ hash_map_iterator_t iter = hashMapIterator_create(candidatesMap);
while (hashMapIterator_hasNext(iter)) {
- HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iter);
- MODULE key = hashMapEntry_getKey(entry);
- LINKED_LIST value = hashMapEntry_getValue(entry);
+ hash_map_entry_t entry = hashMapIterator_nextEntry(iter);
+ module_t key = hashMapEntry_getKey(entry);
+ linked_list_t value = hashMapEntry_getValue(entry);
hashMapIterator_remove(iter);
if (value != NULL) {
- LINKED_LIST_ITERATOR candSetIter = linkedListIterator_create(value, 0);
+ linked_list_iterator_t candSetIter = linkedListIterator_create(value, 0);
while (linkedListIterator_hasNext(candSetIter)) {
CANDIDATE_SET set = linkedListIterator_next(candSetIter);
free(set);
@@ -98,12 +98,12 @@ HASH_MAP resolver_resolve(MODULE root) {
resolved = resolver_populateWireMap(candidatesMap, root, wireMap);
iter = hashMapIterator_create(candidatesMap);
while (hashMapIterator_hasNext(iter)) {
- HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iter);
- MODULE key = hashMapEntry_getKey(entry);
- LINKED_LIST value = hashMapEntry_getValue(entry);
+ hash_map_entry_t entry = hashMapIterator_nextEntry(iter);
+ module_t key = hashMapEntry_getKey(entry);
+ linked_list_t value = hashMapEntry_getValue(entry);
hashMapIterator_remove(iter);
if (value != NULL) {
- LINKED_LIST_ITERATOR candSetIter = linkedListIterator_create(value, 0);
+ linked_list_iterator_t candSetIter = linkedListIterator_create(value, 0);
while (linkedListIterator_hasNext(candSetIter)) {
CANDIDATE_SET set = linkedListIterator_next(candSetIter);
free(set);
@@ -116,19 +116,19 @@ HASH_MAP resolver_resolve(MODULE root) {
return resolved;
}
-int resolver_populateCandidatesMap(HASH_MAP candidatesMap, MODULE targetModule) {
- LINKED_LIST candSetList;
+int resolver_populateCandidatesMap(hash_map_t candidatesMap, module_t targetModule) {
+ linked_list_t candSetList;
apr_pool_t *candSetList_pool;
- LINKED_LIST candidates;
+ linked_list_t candidates;
apr_pool_t *candidates_pool;
- LINKED_LIST invalid;
+ linked_list_t invalid;
apr_pool_t *invalid_pool;
int i;
int c;
- REQUIREMENT req;
- CAPABILITY_LIST capList;
+ requirement_t req;
+ capability_t_LIST capList;
apr_pool_t *bundlePool = NULL;
- BUNDLE bundle = NULL;
+ bundle_t bundle = NULL;
bundle = module_getBundle(targetModule);
bundle_getMemoryPool(bundle, &bundlePool);
@@ -144,14 +144,14 @@ int resolver_populateCandidatesMap(HASH_
if (linkedList_create(candSetList_pool, &candSetList) == CELIX_SUCCESS) {
for (i = 0; i < linkedList_size(module_getRequirements(targetModule)); i++) {
char *targetName = NULL;
- req = (REQUIREMENT) linkedList_get(module_getRequirements(targetModule), i);
+ req = (requirement_t) linkedList_get(module_getRequirements(targetModule), i);
requirement_getTargetName(req, &targetName);
capList = resolver_getCapabilityList(m_resolvedServices, targetName);
if (apr_pool_create(&candidates_pool, bundlePool) == APR_SUCCESS) {
if (linkedList_create(candidates_pool, &candidates) == CELIX_SUCCESS) {
for (c = 0; (capList != NULL) && (c < linkedList_size(capList->capabilities)); c++) {
- CAPABILITY cap = (CAPABILITY) linkedList_get(capList->capabilities, c);
+ capability_t cap = (capability_t) linkedList_get(capList->capabilities, c);
bool satisfied = false;
requirement_isSatisfied(req, cap, &satisfied);
if (satisfied) {
@@ -160,7 +160,7 @@ int resolver_populateCandidatesMap(HASH_
}
capList = resolver_getCapabilityList(m_unresolvedServices, targetName);
for (c = 0; (capList != NULL) && (c < linkedList_size(capList->capabilities)); c++) {
- CAPABILITY cap = (CAPABILITY) linkedList_get(capList->capabilities, c);
+ capability_t cap = (capability_t) linkedList_get(capList->capabilities, c);
bool satisfied = false;
requirement_isSatisfied(req, cap, &satisfied);
if (satisfied) {
@@ -169,10 +169,10 @@ int resolver_populateCandidatesMap(HASH_
}
if (linkedList_size(candidates) > 0) {
- LINKED_LIST_ITERATOR iterator = NULL;
+ linked_list_iterator_t iterator = NULL;
for (iterator = linkedListIterator_create(candidates, 0); linkedListIterator_hasNext(iterator); ) {
- CAPABILITY candidate = (CAPABILITY) linkedListIterator_next(iterator);
- MODULE module = NULL;
+ capability_t candidate = (capability_t) linkedListIterator_next(iterator);
+ module_t module = NULL;
capability_getModule(candidate, &module);
if (!module_isResolved(module)) {
if (resolver_populateCandidatesMap(candidatesMap, module) != 0) {
@@ -214,22 +214,22 @@ int resolver_populateCandidatesMap(HASH_
return 0;
}
-void resolver_removeInvalidCandidate(MODULE invalidModule, HASH_MAP candidates, LINKED_LIST invalid) {
- HASH_MAP_ITERATOR iterator;
+void resolver_removeInvalidCandidate(module_t invalidModule, hash_map_t candidates, linked_list_t invalid) {
+ hash_map_iterator_t iterator;
hashMap_remove(candidates, invalidModule);
for (iterator = hashMapIterator_create(candidates); hashMapIterator_hasNext(iterator); ) {
- HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator);
- MODULE module = (MODULE) hashMapEntry_getKey(entry);
- LINKED_LIST candSetList = (LINKED_LIST) hashMapEntry_getValue(entry);
+ hash_map_entry_t entry = hashMapIterator_nextEntry(iterator);
+ module_t module = (module_t) hashMapEntry_getKey(entry);
+ linked_list_t candSetList = (linked_list_t) hashMapEntry_getValue(entry);
if (candSetList != NULL) {
- LINKED_LIST_ITERATOR itCandSetList;
+ linked_list_iterator_t itCandSetList;
for (itCandSetList = linkedListIterator_create(candSetList, 0); linkedListIterator_hasNext(itCandSetList); ) {
CANDIDATE_SET set = (CANDIDATE_SET) linkedListIterator_next(itCandSetList);
- LINKED_LIST_ITERATOR candIter;
+ linked_list_iterator_t candIter;
for (candIter = linkedListIterator_create(set->candidates, 0); linkedListIterator_hasNext(candIter); ) {
- CAPABILITY candCap = (CAPABILITY) linkedListIterator_next(candIter);
- MODULE module = NULL;
+ capability_t candCap = (capability_t) linkedListIterator_next(candIter);
+ module_t module = NULL;
capability_getModule(candCap, &module);
if (module == invalidModule) {
linkedListIterator_remove(candIter);
@@ -249,22 +249,22 @@ void resolver_removeInvalidCandidate(MOD
if (linkedList_size(invalid) > 0) {
while (!linkedList_isEmpty(invalid)) {
- MODULE m = (MODULE) linkedList_removeIndex(invalid, 0);
+ module_t m = (module_t) linkedList_removeIndex(invalid, 0);
resolver_removeInvalidCandidate(m, candidates, invalid);
}
}
}
-void resolver_addModule(MODULE module) {
+void resolver_addModule(module_t module) {
apr_pool_t *modules_pool;
apr_pool_t *unresolvedServices_pool;
apr_pool_t *resolvedServices_pool;
int i;
- CAPABILITY cap;
- CAPABILITY_LIST list;
+ capability_t cap;
+ capability_t_LIST list;
apr_pool_t *capabilities_pool;
apr_pool_t *bundlePool = NULL;
- BUNDLE bundle = NULL;
+ bundle_t bundle = NULL;
bundle = module_getBundle(module);
bundle_getMemoryPool(bundle, &bundlePool);
@@ -286,12 +286,12 @@ void resolver_addModule(MODULE module) {
for (i = 0; i < linkedList_size(module_getCapabilities(module)); i++) {
char *serviceName = NULL;
- cap = (CAPABILITY) linkedList_get(module_getCapabilities(module), i);
+ cap = (capability_t) linkedList_get(module_getCapabilities(module), i);
capability_getServiceName(cap, &serviceName);
list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
if (list == NULL) {
if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) {
- list = (CAPABILITY_LIST) apr_palloc(capabilities_pool, sizeof(*list));
+ list = (capability_t_LIST) apr_palloc(capabilities_pool, sizeof(*list));
if (list != NULL) {
list->serviceName = apr_pstrdup(capabilities_pool, serviceName);
if (linkedList_create(capabilities_pool, &list->capabilities) == APR_SUCCESS) {
@@ -305,17 +305,17 @@ void resolver_addModule(MODULE module) {
}
}
-void resolver_removeModule(MODULE module) {
- LINKED_LIST caps = NULL;
+void resolver_removeModule(module_t module) {
+ linked_list_t caps = NULL;
linkedList_removeElement(m_modules, module);
caps = module_getCapabilities(module);
if (caps != NULL)
{
int i = 0;
for (i = 0; i < linkedList_size(caps); i++) {
- CAPABILITY cap = (CAPABILITY) linkedList_get(caps, i);
+ capability_t cap = (capability_t) linkedList_get(caps, i);
char *serviceName = NULL;
- CAPABILITY_LIST list;
+ capability_t_LIST list;
capability_getServiceName(cap, &serviceName);
list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
if (list != NULL) {
@@ -329,13 +329,13 @@ void resolver_removeModule(MODULE module
}
}
-void resolver_moduleResolved(MODULE module) {
+void resolver_moduleResolved(module_t module) {
int capIdx;
- LINKED_LIST capsCopy;
+ linked_list_t capsCopy;
apr_pool_t *capsCopy_pool;
apr_pool_t *capabilities_pool;
apr_pool_t *bundlePool = NULL;
- BUNDLE bundle = NULL;
+ bundle_t bundle = NULL;
bundle = module_getBundle(module);
bundle_getMemoryPool(bundle, &bundlePool);
@@ -343,12 +343,12 @@ void resolver_moduleResolved(MODULE modu
if (module_isResolved(module)) {
if (apr_pool_create(&capsCopy_pool, bundlePool) == APR_SUCCESS) {
if (linkedList_create(capsCopy_pool, &capsCopy) == APR_SUCCESS) {
- LINKED_LIST wires = NULL;
+ linked_list_t wires = NULL;
for (capIdx = 0; (module_getCapabilities(module) != NULL) && (capIdx < linkedList_size(module_getCapabilities(module))); capIdx++) {
- CAPABILITY cap = (CAPABILITY) linkedList_get(module_getCapabilities(module), capIdx);
+ capability_t cap = (capability_t) linkedList_get(module_getCapabilities(module), capIdx);
char *serviceName = NULL;
- CAPABILITY_LIST list;
+ capability_t_LIST list;
capability_getServiceName(cap, &serviceName);
list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
linkedList_removeElement(list->capabilities, cap);
@@ -358,12 +358,12 @@ void resolver_moduleResolved(MODULE modu
wires = module_getWires(module);
for (capIdx = 0; (capsCopy != NULL) && (capIdx < linkedList_size(capsCopy)); capIdx++) {
- CAPABILITY cap = linkedList_get(capsCopy, capIdx);
+ capability_t cap = linkedList_get(capsCopy, capIdx);
int wireIdx = 0;
for (wireIdx = 0; (wires != NULL) && (wireIdx < linkedList_size(wires)); wireIdx++) {
- WIRE wire = (WIRE) linkedList_get(wires, wireIdx);
- REQUIREMENT req = NULL;
+ wire_t wire = (wire_t) linkedList_get(wires, wireIdx);
+ requirement_t req = NULL;
bool satisfied = false;
wire_getRequirement(wire, &req);
requirement_isSatisfied(req, cap, &satisfied);
@@ -375,17 +375,17 @@ void resolver_moduleResolved(MODULE modu
}
for (capIdx = 0; (capsCopy != NULL) && (capIdx < linkedList_size(capsCopy)); capIdx++) {
- CAPABILITY cap = linkedList_get(capsCopy, capIdx);
+ capability_t cap = linkedList_get(capsCopy, capIdx);
if (cap != NULL) {
char *serviceName = NULL;
- CAPABILITY_LIST list;
+ capability_t_LIST list;
capability_getServiceName(cap, &serviceName);
list = resolver_getCapabilityList(m_resolvedServices, serviceName);
if (list == NULL) {
if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) {
- list = (CAPABILITY_LIST) apr_palloc(capabilities_pool, sizeof(*list));
+ list = (capability_t_LIST) apr_palloc(capabilities_pool, sizeof(*list));
if (list != NULL) {
list->serviceName = apr_pstrdup(capabilities_pool, serviceName);
if (linkedList_create(capabilities_pool, &list->capabilities) == APR_SUCCESS) {
@@ -404,11 +404,11 @@ void resolver_moduleResolved(MODULE modu
}
}
-CAPABILITY_LIST resolver_getCapabilityList(LINKED_LIST list, char * name) {
- CAPABILITY_LIST capabilityList = NULL;
- LINKED_LIST_ITERATOR iterator = linkedListIterator_create(list, 0);
+capability_t_LIST resolver_getCapabilityList(linked_list_t list, char * name) {
+ capability_t_LIST capabilityList = NULL;
+ linked_list_iterator_t iterator = linkedListIterator_create(list, 0);
while (linkedListIterator_hasNext(iterator)) {
- CAPABILITY_LIST services = (CAPABILITY_LIST) linkedListIterator_next(iterator);
+ capability_t_LIST services = (capability_t_LIST) linkedListIterator_next(iterator);
if (strcmp(services->serviceName, name) == 0) {
capabilityList = services;
break;
@@ -418,24 +418,24 @@ CAPABILITY_LIST resolver_getCapabilityLi
return capabilityList;
}
-HASH_MAP resolver_populateWireMap(HASH_MAP candidates, MODULE importer, HASH_MAP wireMap) {
- LINKED_LIST serviceWires;
+hash_map_t resolver_populateWireMap(hash_map_t candidates, module_t importer, hash_map_t wireMap) {
+ linked_list_t serviceWires;
apr_pool_t *serviceWires_pool;
- LINKED_LIST emptyWires;
+ linked_list_t emptyWires;
apr_pool_t *emptyWires_pool;
apr_pool_t *bundlePool = NULL;
- BUNDLE bundle = NULL;
+ bundle_t bundle = NULL;
bundle = module_getBundle(importer);
bundle_getMemoryPool(bundle, &bundlePool);
if (candidates && importer && wireMap) {
- LINKED_LIST candSetList = NULL;
+ linked_list_t candSetList = NULL;
if (module_isResolved(importer) || (hashMap_get(wireMap, importer))) {
return wireMap;
}
- candSetList = (LINKED_LIST) hashMap_get(candidates, importer);
+ candSetList = (linked_list_t) hashMap_get(candidates, importer);
if (apr_pool_create(&serviceWires_pool, bundlePool) == APR_SUCCESS) {
if (apr_pool_create(&emptyWires_pool, bundlePool) == APR_SUCCESS) {
@@ -448,13 +448,13 @@ HASH_MAP resolver_populateWireMap(HASH_M
for (candSetIdx = 0; candSetIdx < linkedList_size(candSetList); candSetIdx++) {
CANDIDATE_SET cs = (CANDIDATE_SET) linkedList_get(candSetList, candSetIdx);
- MODULE module = NULL;
- capability_getModule(((CAPABILITY) linkedList_get(cs->candidates, 0)), &module);
+ module_t module = NULL;
+ capability_getModule(((capability_t) linkedList_get(cs->candidates, 0)), &module);
if (importer != module) {
- WIRE wire = NULL;
+ wire_t wire = NULL;
wire_create(serviceWires_pool, importer, cs->requirement,
module,
- ((CAPABILITY) linkedList_get(cs->candidates, 0)), &wire);
+ ((capability_t) linkedList_get(cs->candidates, 0)), &wire);
linkedList_addElement(serviceWires, wire);
}
Modified: incubator/celix/trunk/framework/private/src/service_reference.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_reference.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_reference.c (original)
+++ incubator/celix/trunk/framework/private/src/service_reference.c Wed Dec 5 09:05:46 2012
@@ -34,13 +34,13 @@
#include "bundle.h"
struct serviceReference {
- BUNDLE bundle;
+ bundle_t bundle;
struct serviceRegistration * registration;
};
apr_status_t serviceReference_destroy(void *referenceP);
-celix_status_t serviceReference_create(apr_pool_t *pool, BUNDLE bundle, SERVICE_REGISTRATION registration, SERVICE_REFERENCE *reference) {
+celix_status_t serviceReference_create(apr_pool_t *pool, bundle_t bundle, service_registration_t registration, service_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
*reference = apr_palloc(pool, sizeof(**reference));
@@ -57,36 +57,36 @@ celix_status_t serviceReference_create(a
}
apr_status_t serviceReference_destroy(void *referenceP) {
- SERVICE_REFERENCE reference = referenceP;
+ service_reference_t reference = referenceP;
reference->bundle = NULL;
reference->registration = NULL;
return APR_SUCCESS;
}
-celix_status_t serviceReference_getBundle(SERVICE_REFERENCE reference, BUNDLE *bundle) {
+celix_status_t serviceReference_getBundle(service_reference_t reference, bundle_t *bundle) {
*bundle = reference->bundle;
return CELIX_SUCCESS;
}
-celix_status_t serviceReference_getServiceRegistration(SERVICE_REFERENCE reference, SERVICE_REGISTRATION *registration) {
+celix_status_t serviceReference_getServiceRegistration(service_reference_t reference, service_registration_t *registration) {
*registration = reference->registration;
return CELIX_SUCCESS;
}
-celix_status_t serviceReference_invalidate(SERVICE_REFERENCE reference) {
+celix_status_t serviceReference_invalidate(service_reference_t reference) {
reference->registration = NULL;
return CELIX_SUCCESS;
}
-bool serviceReference_isAssignableTo(SERVICE_REFERENCE reference, BUNDLE requester, char * serviceName) {
+bool serviceReference_isAssignableTo(service_reference_t reference, bundle_t requester, char * serviceName) {
bool allow = true;
- BUNDLE provider = reference->bundle;
+ bundle_t provider = reference->bundle;
if (requester == provider) {
return allow;
}
-// WIRE providerWire = module_getWire(bundle_getCurrentModule(provider), serviceName);
-// WIRE requesterWire = module_getWire(bundle_getCurrentModule(requester), serviceName);
+// wire_t providerWire = module_getWire(bundle_getCurrentModule(provider), serviceName);
+// wire_t requesterWire = module_getWire(bundle_getCurrentModule(requester), serviceName);
//
// if (providerWire == NULL && requesterWire != NULL) {
// allow = (bundle_getCurrentModule(provider) == wire_getExporter(requesterWire));
@@ -101,10 +101,10 @@ bool serviceReference_isAssignableTo(SER
return allow;
}
-celix_status_t serviceReference_getUsingBundles(SERVICE_REFERENCE reference, apr_pool_t *pool, ARRAY_LIST *bundles) {
+celix_status_t serviceReference_getUsingBundles(service_reference_t reference, apr_pool_t *pool, array_list_t *bundles) {
celix_status_t status = CELIX_SUCCESS;
- SERVICE_REGISTRY registry = NULL;
+ service_registry_t registry = NULL;
serviceRegistration_getRegistry(reference->registration, ®istry);
*bundles = serviceRegistry_getUsingBundles(registry, pool, reference);
@@ -112,7 +112,7 @@ celix_status_t serviceReference_getUsing
return status;
}
-celix_status_t serviceReference_equals(SERVICE_REFERENCE reference, SERVICE_REFERENCE compareTo, bool *equal) {
+celix_status_t serviceReference_equals(service_reference_t reference, service_reference_t compareTo, bool *equal) {
*equal = (reference->registration == compareTo->registration);
return CELIX_SUCCESS;
}
@@ -124,7 +124,7 @@ int serviceReference_equals2(void *refer
}
unsigned int serviceReference_hashCode(void *referenceP) {
- SERVICE_REFERENCE reference = referenceP;
+ service_reference_t reference = referenceP;
int prime = 31;
int result = 1;
result = prime * result;
Modified: incubator/celix/trunk/framework/private/src/service_registration.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registration.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Wed Dec 5 09:05:46 2012
@@ -40,11 +40,11 @@ struct service {
};
struct serviceRegistration {
- SERVICE_REGISTRY registry;
+ service_registry_t registry;
char * className;
- ARRAY_LIST references;
- BUNDLE bundle;
- PROPERTIES properties;
+ array_list_t references;
+ bundle_t bundle;
+ properties_t properties;
void * svcObj;
long serviceId;
@@ -58,28 +58,28 @@ struct serviceRegistration {
int nrOfServices;
};
-static celix_status_t serviceRegistration_initializeProperties(SERVICE_REGISTRATION registration, PROPERTIES properties);
+static celix_status_t serviceRegistration_initializeProperties(service_registration_t registration, properties_t properties);
-celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, long serviceId,
- void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION *registration);
+celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, service_registry_t registry, bundle_t bundle, char * serviceName, long serviceId,
+ void * serviceObject, properties_t dictionary, bool isFactory, service_registration_t *registration);
-SERVICE_REGISTRATION serviceRegistration_create(apr_pool_t *pool, SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, long serviceId, void * serviceObject, PROPERTIES dictionary) {
- SERVICE_REGISTRATION registration = NULL;
+service_registration_t serviceRegistration_create(apr_pool_t *pool, service_registry_t registry, bundle_t bundle, char * serviceName, long serviceId, void * serviceObject, properties_t dictionary) {
+ service_registration_t registration = NULL;
serviceRegistration_createInternal(pool, registry, bundle, serviceName, serviceId, serviceObject, dictionary, false, ®istration);
return registration;
}
-SERVICE_REGISTRATION serviceRegistration_createServiceFactory(apr_pool_t *pool, SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, long serviceId, void * serviceObject, PROPERTIES dictionary) {
- SERVICE_REGISTRATION registration = NULL;
+service_registration_t serviceRegistration_createServiceFactory(apr_pool_t *pool, service_registry_t registry, bundle_t bundle, char * serviceName, long serviceId, void * serviceObject, properties_t dictionary) {
+ service_registration_t registration = NULL;
serviceRegistration_createInternal(pool, registry, bundle, serviceName, serviceId, serviceObject, dictionary, true, ®istration);
return registration;
}
-celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, long serviceId,
- void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION *registration) {
+celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, service_registry_t registry, bundle_t bundle, char * serviceName, long serviceId,
+ void * serviceObject, properties_t dictionary, bool isFactory, service_registration_t *registration) {
celix_status_t status = CELIX_SUCCESS;
- *registration = (SERVICE_REGISTRATION) apr_palloc(pool, sizeof(**registration));
+ *registration = (service_registration_t) apr_palloc(pool, sizeof(**registration));
(*registration)->isServiceFactory = isFactory;
(*registration)->registry = registry;
(*registration)->className = apr_pstrdup(pool,serviceName);
@@ -105,7 +105,7 @@ celix_status_t serviceRegistration_creat
return CELIX_SUCCESS;
}
-void serviceRegistration_destroy(SERVICE_REGISTRATION registration) {
+void serviceRegistration_destroy(service_registration_t registration) {
registration->className = NULL;
registration->registry = NULL;
@@ -117,7 +117,7 @@ void serviceRegistration_destroy(SERVICE
// free(registration);
}
-static celix_status_t serviceRegistration_initializeProperties(SERVICE_REGISTRATION registration, PROPERTIES dictionary) {
+static celix_status_t serviceRegistration_initializeProperties(service_registration_t registration, properties_t dictionary) {
char * sId = (char *)malloc(sizeof(registration->serviceId) + 1);
if (dictionary == NULL) {
@@ -134,17 +134,17 @@ static celix_status_t serviceRegistratio
return CELIX_SUCCESS;
}
-bool serviceRegistration_isValid(SERVICE_REGISTRATION registration) {
+bool serviceRegistration_isValid(service_registration_t registration) {
return registration == NULL ? false : registration->svcObj != NULL;
}
-void serviceRegistration_invalidate(SERVICE_REGISTRATION registration) {
+void serviceRegistration_invalidate(service_registration_t registration) {
apr_thread_mutex_lock(registration->mutex);
registration->svcObj = NULL;
apr_thread_mutex_unlock(registration->mutex);
}
-celix_status_t serviceRegistration_unregister(SERVICE_REGISTRATION registration) {
+celix_status_t serviceRegistration_unregister(service_registration_t registration) {
celix_status_t status = CELIX_SUCCESS;
apr_thread_mutex_lock(registration->mutex);
if (!serviceRegistration_isValid(registration) || registration->isUnregistering) {
@@ -155,7 +155,7 @@ celix_status_t serviceRegistration_unreg
}
apr_thread_mutex_unlock(registration->mutex);
-// BUNDLE bundle = NULL;
+// bundle_t bundle = NULL;
// status = serviceReference_getBundle(registration->reference, &bundle);
if (status == CELIX_SUCCESS) {
serviceRegistry_unregisterService(registration->registry, registration->bundle, registration);
@@ -164,7 +164,7 @@ celix_status_t serviceRegistration_unreg
return status;
}
-celix_status_t serviceRegistration_getService(SERVICE_REGISTRATION registration, BUNDLE bundle, void **service) {
+celix_status_t serviceRegistration_getService(service_registration_t registration, bundle_t bundle, void **service) {
if (registration->isServiceFactory) {
service_factory_t factory = registration->serviceFactory;
factory->getService(registration->serviceFactory, bundle, registration, service);
@@ -174,7 +174,7 @@ celix_status_t serviceRegistration_getSe
return CELIX_SUCCESS;
}
-celix_status_t serviceRegistration_getProperties(SERVICE_REGISTRATION registration, PROPERTIES *properties) {
+celix_status_t serviceRegistration_getProperties(service_registration_t registration, properties_t *properties) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL && *properties == NULL) {
@@ -186,8 +186,8 @@ celix_status_t serviceRegistration_getPr
return status;
}
-celix_status_t serviceRegistration_setProperties(SERVICE_REGISTRATION registration, PROPERTIES properties) {
- PROPERTIES oldProps = registration->properties;
+celix_status_t serviceRegistration_setProperties(service_registration_t registration, properties_t properties) {
+ properties_t oldProps = registration->properties;
serviceRegistration_initializeProperties(registration, properties);
@@ -196,7 +196,7 @@ celix_status_t serviceRegistration_setPr
return CELIX_SUCCESS;
}
-celix_status_t serviceRegistration_getRegistry(SERVICE_REGISTRATION registration, SERVICE_REGISTRY *registry) {
+celix_status_t serviceRegistration_getRegistry(service_registration_t registration, service_registry_t *registry) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL && *registry == NULL) {
@@ -208,7 +208,7 @@ celix_status_t serviceRegistration_getRe
return status;
}
-celix_status_t serviceRegistration_getServiceReferences(SERVICE_REGISTRATION registration, ARRAY_LIST *references) {
+celix_status_t serviceRegistration_getServiceReferences(service_registration_t registration, array_list_t *references) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL && *references == NULL) {
@@ -220,7 +220,7 @@ celix_status_t serviceRegistration_getSe
return status;
}
-celix_status_t serviceRegistration_getBundle(SERVICE_REGISTRATION registration, BUNDLE *bundle) {
+celix_status_t serviceRegistration_getBundle(service_registration_t registration, bundle_t *bundle) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL && *bundle == NULL) {
@@ -232,7 +232,7 @@ celix_status_t serviceRegistration_getBu
return status;
}
-celix_status_t serviceRegistration_getServiceName(SERVICE_REGISTRATION registration, char **serviceName) {
+celix_status_t serviceRegistration_getServiceName(service_registration_t registration, char **serviceName) {
celix_status_t status = CELIX_SUCCESS;
if (registration != NULL && *serviceName == NULL) {
Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Wed Dec 5 09:05:46 2012
@@ -36,34 +36,34 @@
#include "framework.h"
struct serviceRegistry {
- FRAMEWORK framework;
- HASH_MAP serviceRegistrations;
- HASH_MAP serviceReferences;
- HASH_MAP inUseMap;
- void (*serviceChanged)(FRAMEWORK, SERVICE_EVENT_TYPE, SERVICE_REGISTRATION, PROPERTIES);
+ framework_t framework;
+ hash_map_t serviceRegistrations;
+ hash_map_t serviceReferences;
+ hash_map_t inUseMap;
+ void (*serviceChanged)(framework_t, service_event_type_e, service_registration_t, properties_t);
long currentServiceId;
- ARRAY_LIST listenerHooks;
+ array_list_t listenerHooks;
apr_thread_mutex_t * mutex;
};
struct usageCount {
unsigned int count;
- SERVICE_REFERENCE reference;
+ service_reference_t reference;
void * service;
};
typedef struct usageCount * USAGE_COUNT;
-celix_status_t serviceRegistry_registerServiceInternal(SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION *registration);
-celix_status_t serviceRegistry_addHooks(SERVICE_REGISTRY registry, char *serviceName, void *serviceObject, SERVICE_REGISTRATION registration);
-celix_status_t serviceRegistry_removeHook(SERVICE_REGISTRY registry, SERVICE_REGISTRATION registration);
+celix_status_t serviceRegistry_registerServiceInternal(service_registry_t registry, bundle_t bundle, char * serviceName, void * serviceObject, properties_t dictionary, bool isFactory, service_registration_t *registration);
+celix_status_t serviceRegistry_addHooks(service_registry_t registry, char *serviceName, void *serviceObject, service_registration_t registration);
+celix_status_t serviceRegistry_removeHook(service_registry_t registry, service_registration_t registration);
apr_status_t serviceRegistry_removeReference(void *referenceP);
-USAGE_COUNT serviceRegistry_getUsageCount(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REFERENCE reference) {
- ARRAY_LIST usages = (ARRAY_LIST) hashMap_get(registry->inUseMap, bundle);
+USAGE_COUNT serviceRegistry_getUsageCount(service_registry_t registry, bundle_t bundle, service_reference_t reference) {
+ array_list_t usages = (array_list_t) hashMap_get(registry->inUseMap, bundle);
unsigned int i;
for (i = 0; (usages != NULL) && (i < arrayList_size(usages)); i++) {
USAGE_COUNT usage = (USAGE_COUNT) arrayList_get(usages, i);
@@ -74,15 +74,15 @@ USAGE_COUNT serviceRegistry_getUsageCoun
return NULL;
}
-USAGE_COUNT serviceRegistry_addUsageCount(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REFERENCE reference) {
- ARRAY_LIST usages = hashMap_get(registry->inUseMap, bundle);
+USAGE_COUNT serviceRegistry_addUsageCount(service_registry_t registry, bundle_t bundle, service_reference_t reference) {
+ array_list_t usages = hashMap_get(registry->inUseMap, bundle);
USAGE_COUNT usage = (USAGE_COUNT) malloc(sizeof(*usage));
usage->reference = reference;
usage->count = 0;
usage->service = NULL;
if (usages == NULL) {
- MODULE mod = NULL;
+ module_t mod = NULL;
apr_pool_t *pool = NULL;
bundle_getMemoryPool(bundle, &pool);
arrayList_create(pool, &usages);
@@ -93,31 +93,33 @@ USAGE_COUNT serviceRegistry_addUsageCoun
return usage;
}
-void serviceRegistry_flushUsageCount(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REFERENCE reference) {
- ARRAY_LIST usages = hashMap_get(registry->inUseMap, bundle);
- ARRAY_LIST_ITERATOR iter = arrayListIterator_create(usages);
- while (arrayListIterator_hasNext(iter)) {
- USAGE_COUNT usage = arrayListIterator_next(iter);
- if (usage->reference == reference) {
- arrayListIterator_remove(iter);
- free(usage);
+void serviceRegistry_flushUsageCount(service_registry_t registry, bundle_t bundle, service_reference_t reference) {
+ array_list_t usages = hashMap_get(registry->inUseMap, bundle);
+ if (usages != NULL) {
+ array_list_iterator_t iter = arrayListIterator_create(usages);
+ while (arrayListIterator_hasNext(iter)) {
+ USAGE_COUNT usage = arrayListIterator_next(iter);
+ if (usage->reference == reference) {
+ arrayListIterator_remove(iter);
+ free(usage);
+ }
+ }
+ arrayListIterator_destroy(iter);
+ if (arrayList_size(usages) > 0) {
+ hashMap_put(registry->inUseMap, bundle, usages);
+ } else {
+ array_list_t removed = hashMap_remove(registry->inUseMap, bundle);
+ arrayList_destroy(removed);
}
- }
- arrayListIterator_destroy(iter);
- if (arrayList_size(usages) > 0) {
- hashMap_put(registry->inUseMap, bundle, usages);
- } else {
- ARRAY_LIST removed = hashMap_remove(registry->inUseMap, bundle);
- arrayList_destroy(removed);
}
}
-SERVICE_REGISTRY serviceRegistry_create(FRAMEWORK framework, void (*serviceChanged)(FRAMEWORK, SERVICE_EVENT_TYPE, SERVICE_REGISTRATION, PROPERTIES)) {
- SERVICE_REGISTRY registry;
+service_registry_t serviceRegistry_create(framework_t framework, void (*serviceChanged)(framework_t, service_event_type_e, service_registration_t, properties_t)) {
+ service_registry_t registry;
apr_pool_t *pool = NULL;
framework_getMemoryPool(framework, &pool);
- registry = (SERVICE_REGISTRY) apr_palloc(pool, (sizeof(*registry)));
+ registry = (service_registry_t) apr_palloc(pool, (sizeof(*registry)));
if (registry == NULL) {
// no memory
} else {
@@ -136,7 +138,7 @@ SERVICE_REGISTRY serviceRegistry_create(
return registry;
}
-celix_status_t serviceRegistry_destroy(SERVICE_REGISTRY registry) {
+celix_status_t serviceRegistry_destroy(service_registry_t registry) {
hashMap_destroy(registry->inUseMap, false, false);
hashMap_destroy(registry->serviceRegistrations, false, false);
arrayList_destroy(registry->listenerHooks);
@@ -145,19 +147,19 @@ celix_status_t serviceRegistry_destroy(S
return CELIX_SUCCESS;
}
-celix_status_t serviceRegistry_getRegisteredServices(SERVICE_REGISTRY registry, apr_pool_t *pool, BUNDLE bundle, ARRAY_LIST *services) {
+celix_status_t serviceRegistry_getRegisteredServices(service_registry_t registry, apr_pool_t *pool, bundle_t bundle, array_list_t *services) {
celix_status_t status = CELIX_SUCCESS;
- ARRAY_LIST regs = (ARRAY_LIST) hashMap_get(registry->serviceRegistrations, bundle);
+ array_list_t regs = (array_list_t) hashMap_get(registry->serviceRegistrations, bundle);
if (regs != NULL) {
unsigned int i;
arrayList_create(pool, services);
for (i = 0; i < arrayList_size(regs); i++) {
- SERVICE_REGISTRATION reg = arrayList_get(regs, i);
+ service_registration_t reg = arrayList_get(regs, i);
if (serviceRegistration_isValid(reg)) {
// #todo Create SERVICE_REFERECEN for each registration
- SERVICE_REFERENCE reference = NULL;
+ service_reference_t reference = NULL;
serviceRegistry_createServiceReference(registry, pool, reg, &reference);
arrayList_add(*services, reference);
}
@@ -167,20 +169,20 @@ celix_status_t serviceRegistry_getRegist
return status;
}
-SERVICE_REGISTRATION serviceRegistry_registerService(SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, void * serviceObject, PROPERTIES dictionary) {
- SERVICE_REGISTRATION registration = NULL;
+service_registration_t serviceRegistry_registerService(service_registry_t registry, bundle_t bundle, char * serviceName, void * serviceObject, properties_t dictionary) {
+ service_registration_t registration = NULL;
serviceRegistry_registerServiceInternal(registry, bundle, serviceName, serviceObject, dictionary, false, ®istration);
return registration;
}
-SERVICE_REGISTRATION serviceRegistry_registerServiceFactory(SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, service_factory_t factory, PROPERTIES dictionary) {
- SERVICE_REGISTRATION registration = NULL;
+service_registration_t serviceRegistry_registerServiceFactory(service_registry_t registry, bundle_t bundle, char * serviceName, service_factory_t factory, properties_t dictionary) {
+ service_registration_t registration = NULL;
serviceRegistry_registerServiceInternal(registry, bundle, serviceName, (void *) factory, dictionary, true, ®istration);
return registration;
}
-celix_status_t serviceRegistry_registerServiceInternal(SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION *registration) {
- ARRAY_LIST regs;
+celix_status_t serviceRegistry_registerServiceInternal(service_registry_t registry, bundle_t bundle, char * serviceName, void * serviceObject, properties_t dictionary, bool isFactory, service_registration_t *registration) {
+ array_list_t regs;
apr_pool_t *pool = NULL;
apr_thread_mutex_lock(registry->mutex);
@@ -194,7 +196,7 @@ celix_status_t serviceRegistry_registerS
serviceRegistry_addHooks(registry, serviceName, serviceObject, *registration);
- regs = (ARRAY_LIST) hashMap_get(registry->serviceRegistrations, bundle);
+ regs = (array_list_t) hashMap_get(registry->serviceRegistrations, bundle);
if (regs == NULL) {
regs = NULL;
arrayList_create(pool, ®s);
@@ -205,7 +207,7 @@ celix_status_t serviceRegistry_registerS
apr_thread_mutex_unlock(registry->mutex);
if (registry->serviceChanged != NULL) {
-// SERVICE_EVENT event = (SERVICE_EVENT) malloc(sizeof(*event));
+// service_event_t event = (service_event_t) malloc(sizeof(*event));
// event->type = REGISTERED;
// event->reference = (*registration)->reference;
registry->serviceChanged(registry->framework, SERVICE_EVENT_REGISTERED, *registration, NULL);
@@ -216,17 +218,17 @@ celix_status_t serviceRegistry_registerS
return CELIX_SUCCESS;
}
-void serviceRegistry_unregisterService(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REGISTRATION registration) {
- // ARRAY_LIST clients;
+void serviceRegistry_unregisterService(service_registry_t registry, bundle_t bundle, service_registration_t registration) {
+ // array_list_t clients;
unsigned int i;
- ARRAY_LIST regs;
- ARRAY_LIST references = NULL;
+ array_list_t regs;
+ array_list_t references = NULL;
apr_thread_mutex_lock(registry->mutex);
serviceRegistry_removeHook(registry, registration);
- regs = (ARRAY_LIST) hashMap_get(registry->serviceRegistrations, bundle);
+ regs = (array_list_t) hashMap_get(registry->serviceRegistrations, bundle);
if (regs != NULL) {
arrayList_removeElement(regs, registration);
hashMap_put(registry->serviceRegistrations, bundle, regs);
@@ -243,15 +245,15 @@ void serviceRegistry_unregisterService(S
serviceRegistration_getServiceReferences(registration, &references);
for (i = 0; i < arrayList_size(references); i++) {
- SERVICE_REFERENCE reference = (SERVICE_REFERENCE) arrayList_get(references, i);
+ service_reference_t reference = (service_reference_t) arrayList_get(references, i);
apr_pool_t *pool = NULL;
- ARRAY_LIST clients = NULL;
+ array_list_t clients = NULL;
unsigned int j;
framework_getMemoryPool(registry->framework, &pool);
clients = serviceRegistry_getUsingBundles(registry, pool, reference);
for (j = 0; (clients != NULL) && (j < arrayList_size(clients)); j++) {
- BUNDLE client = (BUNDLE) arrayList_get(clients, j);
+ bundle_t client = (bundle_t) arrayList_get(clients, j);
while (serviceRegistry_ungetService(registry, client, reference)) {
;
}
@@ -268,22 +270,22 @@ void serviceRegistry_unregisterService(S
}
-void serviceRegistry_unregisterServices(SERVICE_REGISTRY registry, BUNDLE bundle) {
- ARRAY_LIST regs = NULL;
+void serviceRegistry_unregisterServices(service_registry_t registry, bundle_t bundle) {
+ array_list_t regs = NULL;
unsigned int i;
apr_thread_mutex_lock(registry->mutex);
- regs = (ARRAY_LIST) hashMap_get(registry->serviceRegistrations, bundle);
+ regs = (array_list_t) hashMap_get(registry->serviceRegistrations, bundle);
apr_thread_mutex_unlock(registry->mutex);
for (i = 0; (regs != NULL) && i < arrayList_size(regs); i++) {
- SERVICE_REGISTRATION reg = arrayList_get(regs, i);
+ service_registration_t reg = arrayList_get(regs, i);
if (serviceRegistration_isValid(reg)) {
serviceRegistration_unregister(reg);
}
}
if (regs != NULL && arrayList_isEmpty(regs)) {
- ARRAY_LIST removed = hashMap_remove(registry->serviceRegistrations, bundle);
+ array_list_t removed = hashMap_remove(registry->serviceRegistrations, bundle);
arrayList_destroy(removed);
removed = NULL;
}
@@ -293,11 +295,11 @@ void serviceRegistry_unregisterServices(
apr_thread_mutex_unlock(registry->mutex);
}
-celix_status_t serviceRegistry_createServiceReference(SERVICE_REGISTRY registry, apr_pool_t *pool, SERVICE_REGISTRATION registration, SERVICE_REFERENCE *reference) {
+celix_status_t serviceRegistry_createServiceReference(service_registry_t registry, apr_pool_t *pool, service_registration_t registration, service_reference_t *reference) {
celix_status_t status = CELIX_SUCCESS;
- BUNDLE bundle = NULL;
- ARRAY_LIST references = NULL;
+ bundle_t bundle = NULL;
+ array_list_t references = NULL;
apr_pool_t *spool = NULL;
apr_pool_create(&spool, pool);
@@ -313,20 +315,20 @@ celix_status_t serviceRegistry_createSer
return status;
}
-celix_status_t serviceRegistry_getServiceReferences(SERVICE_REGISTRY registry, apr_pool_t *pool, const char *serviceName, filter_t filter, ARRAY_LIST *references) {
+celix_status_t serviceRegistry_getServiceReferences(service_registry_t registry, apr_pool_t *pool, const char *serviceName, filter_t filter, array_list_t *references) {
celix_status_t status = CELIX_SUCCESS;
- HASH_MAP_VALUES registrations;
- HASH_MAP_ITERATOR iterator;
+ hash_map_values_t registrations;
+ hash_map_iterator_t iterator;
arrayList_create(pool, references);
registrations = hashMapValues_create(registry->serviceRegistrations);
iterator = hashMapValues_iterator(registrations);
while (hashMapIterator_hasNext(iterator)) {
- ARRAY_LIST regs = (ARRAY_LIST) hashMapIterator_nextValue(iterator);
+ array_list_t regs = (array_list_t) hashMapIterator_nextValue(iterator);
unsigned int regIdx;
for (regIdx = 0; (regs != NULL) && regIdx < arrayList_size(regs); regIdx++) {
- SERVICE_REGISTRATION registration = (SERVICE_REGISTRATION) arrayList_get(regs, regIdx);
- PROPERTIES props = NULL;
+ service_registration_t registration = (service_registration_t) arrayList_get(regs, regIdx);
+ properties_t props = NULL;
status = serviceRegistration_getProperties(registration, &props);
if (status == CELIX_SUCCESS) {
@@ -350,7 +352,7 @@ celix_status_t serviceRegistry_getServic
}
if (matched) {
if (serviceRegistration_isValid(registration)) {
- SERVICE_REFERENCE reference = NULL;
+ service_reference_t reference = NULL;
serviceRegistry_createServiceReference(registry, pool, registration, &reference);
arrayList_add(*references, reference);
}
@@ -365,12 +367,12 @@ celix_status_t serviceRegistry_getServic
}
apr_status_t serviceRegistry_removeReference(void *referenceP) {
- SERVICE_REFERENCE reference = referenceP;
- SERVICE_REGISTRATION registration = NULL;
+ service_reference_t reference = referenceP;
+ service_registration_t registration = NULL;
serviceReference_getServiceRegistration(reference, ®istration);
if (registration != NULL) {
- ARRAY_LIST references = NULL;
+ array_list_t references = NULL;
serviceRegistration_getServiceReferences(registration, &references);
arrayList_removeElement(references, reference);
}
@@ -378,11 +380,11 @@ apr_status_t serviceRegistry_removeRefer
return APR_SUCCESS;
}
-ARRAY_LIST serviceRegistry_getServicesInUse(SERVICE_REGISTRY registry, BUNDLE bundle) {
- ARRAY_LIST usages = hashMap_get(registry->inUseMap, bundle);
+array_list_t serviceRegistry_getServicesInUse(service_registry_t registry, bundle_t bundle) {
+ array_list_t usages = hashMap_get(registry->inUseMap, bundle);
if (usages != NULL) {
unsigned int i;
- ARRAY_LIST references = NULL;
+ array_list_t references = NULL;
apr_pool_t *pool = NULL;
bundle_getMemoryPool(bundle, &pool);
arrayList_create(pool, &references);
@@ -396,8 +398,8 @@ ARRAY_LIST serviceRegistry_getServicesIn
return NULL;
}
-void * serviceRegistry_getService(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REFERENCE reference) {
- SERVICE_REGISTRATION registration = NULL;
+void * serviceRegistry_getService(service_registry_t registry, bundle_t bundle, service_reference_t reference) {
+ service_registration_t registration = NULL;
void * service = NULL;
USAGE_COUNT usage = NULL;
serviceReference_getServiceRegistration(reference, ®istration);
@@ -428,8 +430,8 @@ void * serviceRegistry_getService(SERVIC
return service;
}
-bool serviceRegistry_ungetService(SERVICE_REGISTRY registry, BUNDLE bundle, SERVICE_REFERENCE reference) {
- SERVICE_REGISTRATION registration = NULL;
+bool serviceRegistry_ungetService(service_registry_t registry, bundle_t bundle, service_reference_t reference) {
+ service_registration_t registration = NULL;
USAGE_COUNT usage = NULL;
serviceReference_getServiceRegistration(reference, ®istration);
@@ -454,9 +456,9 @@ bool serviceRegistry_ungetService(SERVIC
return true;
}
-void serviceRegistry_ungetServices(SERVICE_REGISTRY registry, BUNDLE bundle) {
- ARRAY_LIST fusages;
- ARRAY_LIST usages;
+void serviceRegistry_ungetServices(service_registry_t registry, bundle_t bundle) {
+ array_list_t fusages;
+ array_list_t usages;
unsigned int i;
apr_pool_t *pool = NULL;
@@ -475,7 +477,7 @@ void serviceRegistry_ungetServices(SERVI
for (i = 0; i < arrayList_size(fusages); i++) {
USAGE_COUNT usage = arrayList_get(fusages, i);
- SERVICE_REFERENCE reference = usage->reference;
+ service_reference_t reference = usage->reference;
while (serviceRegistry_ungetService(registry, bundle, reference)) {
//
}
@@ -484,17 +486,17 @@ void serviceRegistry_ungetServices(SERVI
arrayList_destroy(fusages);
}
-ARRAY_LIST serviceRegistry_getUsingBundles(SERVICE_REGISTRY registry, apr_pool_t *pool, SERVICE_REFERENCE reference) {
- ARRAY_LIST bundles = NULL;
- HASH_MAP_ITERATOR iter;
+array_list_t serviceRegistry_getUsingBundles(service_registry_t registry, apr_pool_t *pool, service_reference_t reference) {
+ array_list_t bundles = NULL;
+ hash_map_iterator_t iter;
apr_pool_t *npool;
apr_pool_create(&npool, pool);
arrayList_create(npool, &bundles);
iter = hashMapIterator_create(registry->inUseMap);
while (hashMapIterator_hasNext(iter)) {
- HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iter);
- BUNDLE bundle = hashMapEntry_getKey(entry);
- ARRAY_LIST usages = hashMapEntry_getValue(entry);
+ hash_map_entry_t entry = hashMapIterator_nextEntry(iter);
+ bundle_t bundle = hashMapEntry_getKey(entry);
+ array_list_t usages = hashMapEntry_getValue(entry);
unsigned int i;
for (i = 0; i < arrayList_size(usages); i++) {
USAGE_COUNT usage = arrayList_get(usages, i);
@@ -507,7 +509,7 @@ ARRAY_LIST serviceRegistry_getUsingBundl
return bundles;
}
-celix_status_t serviceRegistry_addHooks(SERVICE_REGISTRY registry, char *serviceName, void *serviceObject, SERVICE_REGISTRATION registration) {
+celix_status_t serviceRegistry_addHooks(service_registry_t registry, char *serviceName, void *serviceObject, service_registration_t registration) {
celix_status_t status = CELIX_SUCCESS;
if (strcmp(listener_hook_service_name, serviceName) == 0) {
@@ -517,11 +519,11 @@ celix_status_t serviceRegistry_addHooks(
return status;
}
-celix_status_t serviceRegistry_removeHook(SERVICE_REGISTRY registry, SERVICE_REGISTRATION registration) {
+celix_status_t serviceRegistry_removeHook(service_registry_t registry, service_registration_t registration) {
celix_status_t status = CELIX_SUCCESS;
char *serviceName = NULL;
- PROPERTIES props = NULL;
+ properties_t props = NULL;
serviceRegistration_getProperties(registration, &props);
serviceName = properties_get(props, (char *) OBJECTCLASS);
if (strcmp(listener_hook_service_name, serviceName) == 0) {
@@ -531,7 +533,7 @@ celix_status_t serviceRegistry_removeHoo
return status;
}
-celix_status_t serviceRegistry_getListenerHooks(SERVICE_REGISTRY registry, apr_pool_t *pool, ARRAY_LIST *hooks) {
+celix_status_t serviceRegistry_getListenerHooks(service_registry_t registry, apr_pool_t *pool, array_list_t *hooks) {
celix_status_t status = CELIX_SUCCESS;
if (registry == NULL || *hooks != NULL) {
@@ -541,8 +543,8 @@ celix_status_t serviceRegistry_getListen
if (status == CELIX_SUCCESS) {
unsigned int i;
for (i = 0; i < arrayList_size(registry->listenerHooks); i++) {
- SERVICE_REGISTRATION registration = arrayList_get(registry->listenerHooks, i);
- SERVICE_REFERENCE reference = NULL;
+ service_registration_t registration = arrayList_get(registry->listenerHooks, i);
+ service_reference_t reference = NULL;
serviceRegistry_createServiceReference(registry, pool, registration, &reference);
arrayList_add(*hooks, reference);
}
@@ -552,7 +554,7 @@ celix_status_t serviceRegistry_getListen
return status;
}
-celix_status_t serviceRegistry_servicePropertiesModified(SERVICE_REGISTRY registry, SERVICE_REGISTRATION registration, PROPERTIES oldprops) {
+celix_status_t serviceRegistry_servicePropertiesModified(service_registry_t registry, service_registration_t registration, properties_t oldprops) {
if (registry->serviceChanged != NULL) {
registry->serviceChanged(registry->framework, SERVICE_EVENT_MODIFIED, registration, oldprops);
}
Modified: incubator/celix/trunk/framework/private/src/service_tracker.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Wed Dec 5 09:05:46 2012
@@ -41,21 +41,21 @@ struct serviceTracker {
apr_pool_t *pool;
service_tracker_t tracker;
service_tracker_customizer_t customizer;
- SERVICE_LISTENER listener;
- ARRAY_LIST tracked;
+ service_listener_t listener;
+ array_list_t tracked;
};
struct tracked {
- SERVICE_REFERENCE reference;
+ service_reference_t reference;
void * service;
};
typedef struct tracked * TRACKED;
static apr_status_t serviceTracker_destroy(void *trackerP);
-static void * serviceTracker_addingService(service_tracker_t tracker, SERVICE_REFERENCE reference);
-static celix_status_t serviceTracker_track(service_tracker_t tracker, SERVICE_REFERENCE reference, SERVICE_EVENT event);
-static celix_status_t serviceTracker_untrack(service_tracker_t tracker, SERVICE_REFERENCE reference, SERVICE_EVENT event);
+static void * serviceTracker_addingService(service_tracker_t tracker, service_reference_t reference);
+static celix_status_t serviceTracker_track(service_tracker_t tracker, service_reference_t reference, service_event_t event);
+static celix_status_t serviceTracker_untrack(service_tracker_t tracker, service_reference_t reference, service_event_t event);
celix_status_t serviceTracker_create(apr_pool_t *pool, bundle_context_t context, char * service, service_tracker_customizer_t customizer, service_tracker_t *tracker) {
celix_status_t status = CELIX_SUCCESS;
@@ -110,14 +110,14 @@ apr_status_t serviceTracker_destroy(void
}
celix_status_t serviceTracker_open(service_tracker_t tracker) {
- SERVICE_LISTENER listener;
- ARRAY_LIST initial = NULL;
+ service_listener_t listener;
+ array_list_t initial = NULL;
celix_status_t status = CELIX_SUCCESS;
- listener = (SERVICE_LISTENER) apr_palloc(tracker->pool, sizeof(*listener));
+ listener = (service_listener_t) apr_palloc(tracker->pool, sizeof(*listener));
status = bundleContext_getServiceReferences(tracker->context, NULL, tracker->filter, &initial);
if (status == CELIX_SUCCESS) {
- SERVICE_REFERENCE initial_reference;
+ service_reference_t initial_reference;
unsigned int i;
listener->pool = tracker->pool;
@@ -128,7 +128,7 @@ celix_status_t serviceTracker_open(servi
tracker->listener = listener;
for (i = 0; i < arrayList_size(initial); i++) {
- initial_reference = (SERVICE_REFERENCE) arrayList_get(initial, i);
+ initial_reference = (service_reference_t) arrayList_get(initial, i);
serviceTracker_track(tracker, initial_reference, NULL);
}
arrayList_clear(initial);
@@ -146,11 +146,11 @@ celix_status_t serviceTracker_close(serv
status = bundleContext_removeServiceListener(tracker->context, tracker->listener);
if (status == CELIX_SUCCESS) {
- ARRAY_LIST refs = serviceTracker_getServiceReferences(tracker);
+ array_list_t refs = serviceTracker_getServiceReferences(tracker);
if (refs != NULL) {
unsigned int i;
for (i = 0; i < arrayList_size(refs); i++) {
- SERVICE_REFERENCE ref = (SERVICE_REFERENCE) arrayList_get(refs, i);
+ service_reference_t ref = (service_reference_t) arrayList_get(refs, i);
status = serviceTracker_untrack(tracker, ref, NULL);
}
}
@@ -160,7 +160,7 @@ celix_status_t serviceTracker_close(serv
return status;
}
-SERVICE_REFERENCE serviceTracker_getServiceReference(service_tracker_t tracker) {
+service_reference_t serviceTracker_getServiceReference(service_tracker_t tracker) {
TRACKED tracked;
unsigned int i;
for (i = 0; i < arrayList_size(tracker->tracked); i++) {
@@ -170,11 +170,11 @@ SERVICE_REFERENCE serviceTracker_getServ
return NULL;
}
-ARRAY_LIST serviceTracker_getServiceReferences(service_tracker_t tracker) {
+array_list_t serviceTracker_getServiceReferences(service_tracker_t tracker) {
TRACKED tracked;
unsigned int i;
int size = arrayList_size(tracker->tracked);
- ARRAY_LIST references = NULL;
+ array_list_t references = NULL;
arrayList_create(tracker->pool, &references);
for (i = 0; i < arrayList_size(tracker->tracked); i++) {
@@ -194,11 +194,11 @@ void *serviceTracker_getService(service_
return NULL;
}
-ARRAY_LIST serviceTracker_getServices(service_tracker_t tracker) {
+array_list_t serviceTracker_getServices(service_tracker_t tracker) {
TRACKED tracked;
unsigned int i;
int size = arrayList_size(tracker->tracked);
- ARRAY_LIST references = NULL;
+ array_list_t references = NULL;
arrayList_create(tracker->pool, &references);
for (i = 0; i < arrayList_size(tracker->tracked); i++) {
@@ -208,7 +208,7 @@ ARRAY_LIST serviceTracker_getServices(se
return references;
}
-void *serviceTracker_getServiceByReference(service_tracker_t tracker, SERVICE_REFERENCE reference) {
+void *serviceTracker_getServiceByReference(service_tracker_t tracker, service_reference_t reference) {
TRACKED tracked;
unsigned int i;
for (i = 0; i < arrayList_size(tracker->tracked); i++) {
@@ -222,7 +222,7 @@ void *serviceTracker_getServiceByReferen
return NULL;
}
-void serviceTracker_serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT event) {
+void serviceTracker_serviceChanged(service_listener_t listener, service_event_t event) {
service_tracker_t tracker = listener->handle;
switch (event->type) {
case SERVICE_EVENT_REGISTERED:
@@ -237,7 +237,7 @@ void serviceTracker_serviceChanged(SERVI
}
}
-celix_status_t serviceTracker_track(service_tracker_t tracker, SERVICE_REFERENCE reference, SERVICE_EVENT event) {
+celix_status_t serviceTracker_track(service_tracker_t tracker, service_reference_t reference, service_event_t event) {
celix_status_t status = CELIX_SUCCESS;
TRACKED tracked = NULL;
@@ -286,7 +286,7 @@ celix_status_t serviceTracker_track(serv
return status;
}
-void * serviceTracker_addingService(service_tracker_t tracker, SERVICE_REFERENCE reference) {
+void * serviceTracker_addingService(service_tracker_t tracker, service_reference_t reference) {
void *svc = NULL;
if (tracker->customizer != NULL) {
@@ -304,7 +304,7 @@ void * serviceTracker_addingService(serv
return svc;
}
-celix_status_t serviceTracker_untrack(service_tracker_t tracker, SERVICE_REFERENCE reference, SERVICE_EVENT event) {
+celix_status_t serviceTracker_untrack(service_tracker_t tracker, service_reference_t reference, service_event_t event) {
celix_status_t status = CELIX_SUCCESS;
TRACKED tracked = NULL;
unsigned int i;
Modified: incubator/celix/trunk/framework/private/src/service_tracker_customizer.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker_customizer.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker_customizer.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker_customizer.c Wed Dec 5 09:05:46 2012
@@ -34,10 +34,10 @@ static apr_status_t serviceTrackerCustom
struct serviceTrackerCustomizer {
void * handle;
- celix_status_t (*addingService)(void * handle, SERVICE_REFERENCE reference, void **service);
- celix_status_t (*addedService)(void * handle, SERVICE_REFERENCE reference, void * service);
- celix_status_t (*modifiedService)(void * handle, SERVICE_REFERENCE reference, void * service);
- celix_status_t (*removedService)(void * handle, SERVICE_REFERENCE reference, void * service);
+ celix_status_t (*addingService)(void * handle, service_reference_t reference, void **service);
+ celix_status_t (*addedService)(void * handle, service_reference_t reference, void * service);
+ celix_status_t (*modifiedService)(void * handle, service_reference_t reference, void * service);
+ celix_status_t (*removedService)(void * handle, service_reference_t reference, void * service);
};
celix_status_t serviceTrackerCustomizer_create(apr_pool_t *pool, void *handle,
Modified: incubator/celix/trunk/framework/private/src/version.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version.c (original)
+++ incubator/celix/trunk/framework/private/src/version.c Wed Dec 5 09:05:46 2012
@@ -43,10 +43,10 @@ struct version {
static apr_status_t version_destroy(void *version);
-celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, int micro, char * qualifier, VERSION *version) {
+celix_status_t version_createVersion(apr_pool_t *pool, int major, int minor, int micro, char * qualifier, version_t *version) {
celix_status_t status = CELIX_SUCCESS;
- *version = (VERSION) apr_palloc(pool, sizeof(**version));
+ *version = (version_t) apr_palloc(pool, sizeof(**version));
if (!*version) {
status = CELIX_ENOMEM;
} else {
@@ -93,12 +93,12 @@ celix_status_t version_createVersion(apr
return status;
}
-celix_status_t version_clone(VERSION version, apr_pool_t *pool, VERSION *clone) {
+celix_status_t version_clone(version_t version, apr_pool_t *pool, version_t *clone) {
return version_createVersion(pool, version->major, version->minor, version->micro, version->qualifier, clone);
}
apr_status_t version_destroy(void *versionP) {
- VERSION version = versionP;
+ version_t version = versionP;
version->major = 0;
version->minor = 0;
version->micro = 0;
@@ -106,7 +106,7 @@ apr_status_t version_destroy(void *versi
return APR_SUCCESS;
}
-celix_status_t version_createVersionFromString(apr_pool_t *pool, char * versionStr, VERSION *version) {
+celix_status_t version_createVersionFromString(apr_pool_t *pool, char * versionStr, version_t *version) {
celix_status_t status = CELIX_SUCCESS;
int major = 0;
@@ -146,11 +146,11 @@ celix_status_t version_createVersionFrom
return status;
}
-celix_status_t version_createEmptyVersion(apr_pool_t *pool, VERSION *version) {
+celix_status_t version_createEmptyVersion(apr_pool_t *pool, version_t *version) {
return version_createVersion(pool, 0, 0, 0, "", version);
}
-celix_status_t version_compareTo(VERSION version, VERSION compare, int *result) {
+celix_status_t version_compareTo(version_t version, version_t compare, int *result) {
celix_status_t status = CELIX_SUCCESS;
if (compare == version) {
*result = 0;
@@ -176,7 +176,7 @@ celix_status_t version_compareTo(VERSION
return status;
}
-celix_status_t version_toString(VERSION version, apr_pool_t *pool, char **string) {
+celix_status_t version_toString(version_t version, apr_pool_t *pool, char **string) {
if (strlen(version->qualifier) > 0) {
*string = apr_psprintf(pool, "%d.%d.%d.%s", version->major, version->minor, version->micro, version->qualifier);
} else {
Modified: incubator/celix/trunk/framework/private/src/version_range.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version_range.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version_range.c (original)
+++ incubator/celix/trunk/framework/private/src/version_range.c Wed Dec 5 09:05:46 2012
@@ -30,19 +30,19 @@
#include "version_range.h"
struct versionRange {
- VERSION low;
+ version_t low;
bool isLowInclusive;
- VERSION high;
+ version_t high;
bool isHighInclusive;
};
apr_status_t versionRange_destroy(void *rangeP);
-celix_status_t versionRange_createVersionRange(apr_pool_t *pool, VERSION low, bool isLowInclusive,
- VERSION high, bool isHighInclusive, VERSION_RANGE *range) {
+celix_status_t versionRange_createVersionRange(apr_pool_t *pool, version_t low, bool isLowInclusive,
+ version_t high, bool isHighInclusive, version_range_t *range) {
celix_status_t status = CELIX_SUCCESS;
- *range = (VERSION_RANGE) apr_palloc(pool, sizeof(**range));
+ *range = (version_range_t) apr_palloc(pool, sizeof(**range));
if (!*range) {
status = CELIX_ENOMEM;
} else {
@@ -58,7 +58,7 @@ celix_status_t versionRange_createVersio
}
apr_status_t versionRange_destroy(void *rangeP) {
- VERSION_RANGE range = rangeP;
+ version_range_t range = rangeP;
range->high = NULL;
range->isHighInclusive = false;
range->low = NULL;
@@ -66,10 +66,10 @@ apr_status_t versionRange_destroy(void *
return APR_SUCCESS;
}
-celix_status_t versionRange_createInfiniteVersionRange(apr_pool_t *pool, VERSION_RANGE *range) {
+celix_status_t versionRange_createInfiniteVersionRange(apr_pool_t *pool, version_range_t *range) {
celix_status_t status = CELIX_SUCCESS;
- VERSION version = NULL;
+ version_t version = NULL;
status = version_createEmptyVersion(pool, &version);
if (status == CELIX_SUCCESS) {
status = versionRange_createVersionRange(pool, version, true, NULL, true, range);
@@ -78,7 +78,7 @@ celix_status_t versionRange_createInfini
return status;
}
-celix_status_t versionRange_isInRange(VERSION_RANGE versionRange, VERSION version, bool *inRange) {
+celix_status_t versionRange_isInRange(version_range_t versionRange, version_t version, bool *inRange) {
celix_status_t status = CELIX_SUCCESS;
if (versionRange->high == NULL) {
int cmp;
@@ -127,7 +127,7 @@ celix_status_t versionRange_isInRange(VE
return status;
}
-celix_status_t versionRange_parse(apr_pool_t *pool, char * rangeStr, VERSION_RANGE *range) {
+celix_status_t versionRange_parse(apr_pool_t *pool, char * rangeStr, version_range_t *range) {
celix_status_t status = CELIX_SUCCESS;
if (strchr(rangeStr, ',') != NULL) {
apr_pool_t *spool;
@@ -148,7 +148,7 @@ celix_status_t versionRange_parse(apr_po
if (!vhigh) {
status = CELIX_ENOMEM;
} else {
- VERSION versionLow = NULL;
+ version_t versionLow = NULL;
int rangeL = strlen(rangeStr);
char start = rangeStr[0];
char end = rangeStr[rangeL-1];
@@ -157,7 +157,7 @@ celix_status_t versionRange_parse(apr_po
status = version_createVersionFromString(pool, vlow, &versionLow);
if (status == CELIX_SUCCESS) {
- VERSION versionHigh = NULL;
+ version_t versionHigh = NULL;
status = version_createVersionFromString(pool, vhigh, &versionHigh);
if (status == CELIX_SUCCESS) {
status = versionRange_createVersionRange(pool,
@@ -174,7 +174,7 @@ celix_status_t versionRange_parse(apr_po
apr_pool_destroy(spool);
}
} else {
- VERSION version = NULL;
+ version_t version = NULL;
status = version_createVersionFromString(pool, rangeStr, &version);
if (status == CELIX_SUCCESS) {
status = versionRange_createVersionRange(pool, version, true, NULL, false, range);
Modified: incubator/celix/trunk/framework/private/src/wire.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/wire.c?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/wire.c (original)
+++ incubator/celix/trunk/framework/private/src/wire.c Wed Dec 5 09:05:46 2012
@@ -29,19 +29,19 @@
#include "wire.h"
struct wire {
- MODULE importer;
- REQUIREMENT requirement;
- MODULE exporter;
- CAPABILITY capability;
+ module_t importer;
+ requirement_t requirement;
+ module_t exporter;
+ capability_t capability;
};
apr_status_t wire_destroy(void *wireP);
-celix_status_t wire_create(apr_pool_t *pool, MODULE importer, REQUIREMENT requirement,
- MODULE exporter, CAPABILITY capability, WIRE *wire) {
+celix_status_t wire_create(apr_pool_t *pool, module_t importer, requirement_t requirement,
+ module_t exporter, capability_t capability, wire_t *wire) {
celix_status_t status = CELIX_SUCCESS;
- (*wire) = (WIRE) apr_palloc(pool, sizeof(**wire));
+ (*wire) = (wire_t) apr_palloc(pool, sizeof(**wire));
if (!*wire) {
status = CELIX_ENOMEM;
} else {
@@ -57,7 +57,7 @@ celix_status_t wire_create(apr_pool_t *p
}
apr_status_t wire_destroy(void *wireP) {
- WIRE wire = wireP;
+ wire_t wire = wireP;
wire->importer = NULL;
wire->requirement = NULL;
wire->exporter = NULL;
@@ -65,22 +65,22 @@ apr_status_t wire_destroy(void *wireP) {
return APR_SUCCESS;
}
-celix_status_t wire_getCapability(WIRE wire, CAPABILITY *capability) {
+celix_status_t wire_getCapability(wire_t wire, capability_t *capability) {
*capability = wire->capability;
return CELIX_SUCCESS;
}
-celix_status_t wire_getRequirement(WIRE wire, REQUIREMENT *requirement) {
+celix_status_t wire_getRequirement(wire_t wire, requirement_t *requirement) {
*requirement = wire->requirement;
return CELIX_SUCCESS;
}
-celix_status_t wire_getImporter(WIRE wire, MODULE *importer) {
+celix_status_t wire_getImporter(wire_t wire, module_t *importer) {
*importer = wire->importer;
return CELIX_SUCCESS;
}
-celix_status_t wire_getExporter(WIRE wire, MODULE *exporter) {
+celix_status_t wire_getExporter(wire_t wire, module_t *exporter) {
*exporter = wire->exporter;
return CELIX_SUCCESS;
}
Modified: incubator/celix/trunk/framework/public/include/bundle.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle.h?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle.h Wed Dec 5 09:05:46 2012
@@ -30,7 +30,7 @@
#include <apr_general.h>
#include <apr_portable.h>
-typedef struct bundle * BUNDLE;
+typedef struct bundle * bundle_t;
#include "celix_errno.h"
#include "bundle_state.h"
@@ -39,62 +39,62 @@ typedef struct bundle * BUNDLE;
#include "service_reference.h"
#include "bundle_context.h"
-FRAMEWORK_EXPORT celix_status_t bundle_create(BUNDLE * bundle, apr_pool_t *mp);
-FRAMEWORK_EXPORT celix_status_t bundle_createFromArchive(BUNDLE * bundle, FRAMEWORK framework, bundle_archive_t archive, apr_pool_t *bundlePool);
-FRAMEWORK_EXPORT celix_status_t bundle_destroy(BUNDLE bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_isSystemBundle(BUNDLE bundle, bool *systemBundle);
-FRAMEWORK_EXPORT celix_status_t bundle_getArchive(BUNDLE bundle, bundle_archive_t *archive);
-FRAMEWORK_EXPORT celix_status_t bundle_getCurrentModule(BUNDLE bundle, MODULE *module);
-FRAMEWORK_EXPORT ARRAY_LIST bundle_getModules(BUNDLE bundle);
-FRAMEWORK_EXPORT void * bundle_getHandle(BUNDLE bundle);
-FRAMEWORK_EXPORT void bundle_setHandle(BUNDLE bundle, void * handle);
-FRAMEWORK_EXPORT ACTIVATOR bundle_getActivator(BUNDLE bundle);
-FRAMEWORK_EXPORT celix_status_t bundle_setActivator(BUNDLE bundle, ACTIVATOR activator);
-FRAMEWORK_EXPORT celix_status_t bundle_getManifest(BUNDLE bundle, MANIFEST *manifest);
-FRAMEWORK_EXPORT celix_status_t bundle_setManifest(BUNDLE bundle, MANIFEST manifest);
-FRAMEWORK_EXPORT celix_status_t bundle_getContext(BUNDLE bundle, bundle_context_t *context);
-FRAMEWORK_EXPORT celix_status_t bundle_setContext(BUNDLE bundle, bundle_context_t context);
-FRAMEWORK_EXPORT celix_status_t bundle_getEntry(BUNDLE bundle, char * name, apr_pool_t *pool, char **entry);
-
-FRAMEWORK_EXPORT celix_status_t bundle_start(BUNDLE bundle, int options);
-FRAMEWORK_EXPORT celix_status_t bundle_update(BUNDLE bundle, char *inputFile);
-FRAMEWORK_EXPORT celix_status_t bundle_stop(BUNDLE bundle, int options);
-FRAMEWORK_EXPORT celix_status_t bundle_uninstall(BUNDLE bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_setState(BUNDLE bundle, BUNDLE_STATE state);
-FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateInactive(BUNDLE bundle);
-FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateUninstalled(BUNDLE bundle);
-
-FRAMEWORK_EXPORT void uninstallBundle(BUNDLE bundle);
-
-FRAMEWORK_EXPORT celix_status_t bundle_revise(BUNDLE bundle, char * location, char *inputFile);
-FRAMEWORK_EXPORT celix_status_t bundle_addModule(BUNDLE bundle, MODULE module);
-FRAMEWORK_EXPORT celix_status_t bundle_closeModules(BUNDLE bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_create(bundle_t * bundle, apr_pool_t *mp);
+FRAMEWORK_EXPORT celix_status_t bundle_createFromArchive(bundle_t * bundle, framework_t framework, bundle_archive_t archive, apr_pool_t *bundlePool);
+FRAMEWORK_EXPORT celix_status_t bundle_destroy(bundle_t bundle);
+
+FRAMEWORK_EXPORT celix_status_t bundle_isSystemBundle(bundle_t bundle, bool *systemBundle);
+FRAMEWORK_EXPORT celix_status_t bundle_getArchive(bundle_t bundle, bundle_archive_t *archive);
+FRAMEWORK_EXPORT celix_status_t bundle_getCurrentModule(bundle_t bundle, module_t *module);
+FRAMEWORK_EXPORT array_list_t bundle_getModules(bundle_t bundle);
+FRAMEWORK_EXPORT void * bundle_getHandle(bundle_t bundle);
+FRAMEWORK_EXPORT void bundle_setHandle(bundle_t bundle, void * handle);
+FRAMEWORK_EXPORT ACTIVATOR bundle_getActivator(bundle_t bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_setActivator(bundle_t bundle, ACTIVATOR activator);
+FRAMEWORK_EXPORT celix_status_t bundle_getManifest(bundle_t bundle, MANIFEST *manifest);
+FRAMEWORK_EXPORT celix_status_t bundle_setManifest(bundle_t bundle, MANIFEST manifest);
+FRAMEWORK_EXPORT celix_status_t bundle_getContext(bundle_t bundle, bundle_context_t *context);
+FRAMEWORK_EXPORT celix_status_t bundle_setContext(bundle_t bundle, bundle_context_t context);
+FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_t bundle, char * name, apr_pool_t *pool, char **entry);
+
+FRAMEWORK_EXPORT celix_status_t bundle_start(bundle_t bundle, int options);
+FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_t bundle, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t bundle_stop(bundle_t bundle, int options);
+FRAMEWORK_EXPORT celix_status_t bundle_uninstall(bundle_t bundle);
+
+FRAMEWORK_EXPORT celix_status_t bundle_setState(bundle_t bundle, bundle_state_e state);
+FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateInactive(bundle_t bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateUninstalled(bundle_t bundle);
+
+FRAMEWORK_EXPORT void uninstallBundle(bundle_t bundle);
+
+FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_t bundle, char * location, char *inputFile);
+FRAMEWORK_EXPORT celix_status_t bundle_addModule(bundle_t bundle, module_t module);
+FRAMEWORK_EXPORT celix_status_t bundle_closeModules(bundle_t bundle);
// Service Reference Functions
-FRAMEWORK_EXPORT ARRAY_LIST getUsingBundles(SERVICE_REFERENCE reference);
+FRAMEWORK_EXPORT array_list_t getUsingBundles(service_reference_t reference);
-FRAMEWORK_EXPORT int compareTo(SERVICE_REFERENCE a, SERVICE_REFERENCE b);
+FRAMEWORK_EXPORT int compareTo(service_reference_t a, service_reference_t b);
-FRAMEWORK_EXPORT celix_status_t bundle_getState(BUNDLE bundle, BUNDLE_STATE *state);
-FRAMEWORK_EXPORT celix_status_t bundle_isLockable(BUNDLE bundle, bool *lockable);
-FRAMEWORK_EXPORT celix_status_t bundle_getLockingThread(BUNDLE bundle, apr_os_thread_t *thread);
-FRAMEWORK_EXPORT celix_status_t bundle_lock(BUNDLE bundle, bool *locked);
-FRAMEWORK_EXPORT celix_status_t bundle_unlock(BUNDLE bundle, bool *unlocked);
+FRAMEWORK_EXPORT celix_status_t bundle_getState(bundle_t bundle, bundle_state_e *state);
+FRAMEWORK_EXPORT celix_status_t bundle_isLockable(bundle_t bundle, bool *lockable);
+FRAMEWORK_EXPORT celix_status_t bundle_getLockingThread(bundle_t bundle, apr_os_thread_t *thread);
+FRAMEWORK_EXPORT celix_status_t bundle_lock(bundle_t bundle, bool *locked);
+FRAMEWORK_EXPORT celix_status_t bundle_unlock(bundle_t bundle, bool *unlocked);
-FRAMEWORK_EXPORT celix_status_t bundle_closeAndDelete(BUNDLE bundle);
-FRAMEWORK_EXPORT celix_status_t bundle_close(BUNDLE bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_closeAndDelete(bundle_t bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_close(bundle_t bundle);
-FRAMEWORK_EXPORT celix_status_t bundle_refresh(BUNDLE bundle);
-FRAMEWORK_EXPORT celix_status_t bundle_getBundleId(BUNDLE bundle, long *id);
+FRAMEWORK_EXPORT celix_status_t bundle_refresh(bundle_t bundle);
+FRAMEWORK_EXPORT celix_status_t bundle_getBundleId(bundle_t bundle, long *id);
-FRAMEWORK_EXPORT celix_status_t bundle_getRegisteredServices(BUNDLE bundle, apr_pool_t *pool, ARRAY_LIST *list);
-FRAMEWORK_EXPORT celix_status_t bundle_getServicesInUse(BUNDLE bundle, ARRAY_LIST *list);
+FRAMEWORK_EXPORT celix_status_t bundle_getRegisteredServices(bundle_t bundle, apr_pool_t *pool, array_list_t *list);
+FRAMEWORK_EXPORT celix_status_t bundle_getServicesInUse(bundle_t bundle, array_list_t *list);
-FRAMEWORK_EXPORT celix_status_t bundle_getMemoryPool(BUNDLE bundle, apr_pool_t **pool);
+FRAMEWORK_EXPORT celix_status_t bundle_getMemoryPool(bundle_t bundle, apr_pool_t **pool);
-FRAMEWORK_EXPORT celix_status_t bundle_setFramework(BUNDLE bundle, FRAMEWORK framework);
-FRAMEWORK_EXPORT celix_status_t bundle_getFramework(BUNDLE bundle, FRAMEWORK *framework);
+FRAMEWORK_EXPORT celix_status_t bundle_setFramework(bundle_t bundle, framework_t framework);
+FRAMEWORK_EXPORT celix_status_t bundle_getFramework(bundle_t bundle, framework_t *framework);
#endif /* BUNDLE_H_ */
Modified: incubator/celix/trunk/framework/public/include/bundle_archive.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_archive.h?rev=1417320&r1=1417319&r2=1417320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle_archive.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle_archive.h Wed Dec 5 09:05:46 2012
@@ -47,8 +47,8 @@ FRAMEWORK_EXPORT celix_status_t bundleAr
FRAMEWORK_EXPORT celix_status_t bundleArchive_revise(bundle_archive_t archive, char * location, char *inputFile);
FRAMEWORK_EXPORT celix_status_t bundleArchive_rollbackRevise(bundle_archive_t archive, bool *rolledback);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getRevision(bundle_archive_t archive, long revNr, BUNDLE_REVISION *revision);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevision(bundle_archive_t archive, BUNDLE_REVISION *revision);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_getRevision(bundle_archive_t archive, long revNr, bundle_revision_t *revision);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevision(bundle_archive_t archive, bundle_revision_t *revision);
FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevisionNumber(bundle_archive_t archive, long *revisionNumber);
FRAMEWORK_EXPORT celix_status_t bundleArchive_getRefreshCount(bundle_archive_t archive, long *refreshCount);
@@ -59,7 +59,7 @@ FRAMEWORK_EXPORT celix_status_t bundleAr
FRAMEWORK_EXPORT celix_status_t bundleArchive_setLastModified(bundle_archive_t archive, time_t lastModifiedTime);
FRAMEWORK_EXPORT celix_status_t bundleArchive_getLastModified(bundle_archive_t archive, time_t *lastModified);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_setPersistentState(bundle_archive_t archive, BUNDLE_STATE state);
-FRAMEWORK_EXPORT celix_status_t bundleArchive_getPersistentState(bundle_archive_t archive, BUNDLE_STATE *state);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_setPersistentState(bundle_archive_t archive, bundle_state_e state);
+FRAMEWORK_EXPORT celix_status_t bundleArchive_getPersistentState(bundle_archive_t archive, bundle_state_e *state);
#endif /* BUNDLE_ARCHIVE_H_ */