You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2017/11/20 20:33:21 UTC

[24/46] celix git commit: CELIX-417: Initial refactoring for CMake usage

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/bundle_context.c
----------------------------------------------------------------------
diff --git a/framework/private/src/bundle_context.c b/framework/private/src/bundle_context.c
deleted file mode 100644
index face85d..0000000
--- a/framework/private/src/bundle_context.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * bundle_context.c
- *
- *  \date       Mar 26, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "bundle_context_private.h"
-#include "framework_private.h"
-#include "bundle.h"
-#include "celix_log.h"
-
-celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt logger, bundle_pt bundle, bundle_context_pt *bundle_context) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_context_pt context = NULL;
-
-	if (*bundle_context != NULL && framework == NULL && bundle == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-        context = malloc(sizeof(*context));
-        if (!context) {
-            status = CELIX_ENOMEM;
-        } else {
-            context->framework = framework;
-            context->bundle = bundle;
-
-            *bundle_context = context;
-        }
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to create context");
-
-	return status;
-}
-
-celix_status_t bundleContext_destroy(bundle_context_pt context) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (context != NULL) {
-	    free(context);
-		context = NULL;
-	} else {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to destroy context");
-
-	return status;
-}
-
-celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (context == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*bundle = context->bundle;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get bundle");
-
-	return status;
-}
-
-celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (context == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*framework = context->framework;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get framework");
-
-	return status;
-}
-
-celix_status_t bundleContext_installBundle(bundle_context_pt context, const char * location, bundle_pt *bundle) {
-	return bundleContext_installBundle2(context, location, NULL, bundle);
-}
-
-celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char * location, const char *inputFile, bundle_pt *bundle) {
-	celix_status_t status = CELIX_SUCCESS;
-	bundle_pt b = NULL;
-
-	if (context != NULL && *bundle == NULL) {
-		if (fw_installBundle(context->framework, &b, location, inputFile) != CELIX_SUCCESS) {
-            status = CELIX_FRAMEWORK_EXCEPTION;
-		} else {
-			*bundle = b;
-		}
-	} else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to install bundle");
-
-	return status;
-}
-
-celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, const void * svcObj,
-        properties_pt properties, service_registration_pt *service_registration) {
-	service_registration_pt registration = NULL;
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (context != NULL) {
-	    fw_registerService(context->framework, &registration, context->bundle, serviceName, svcObj, properties);
-	    *service_registration = registration;
-	} else {
-	    status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to register service. serviceName '%s'", serviceName);
-
-	return status;
-}
-
-celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory,
-        properties_pt properties, service_registration_pt *service_registration) {
-    service_registration_pt registration = NULL;
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && *service_registration == NULL) {
-        fw_registerServiceFactory(context->framework, &registration, context->bundle, serviceName, factory, properties);
-        *service_registration = registration;
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to register service factory");
-
-    return status;
-}
-
-celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && *service_references == NULL) {
-        fw_getServiceReferences(context->framework, service_references, context->bundle, serviceName, filter);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get service references");
-
-	return status;
-}
-
-celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference) {
-    service_reference_pt reference = NULL;
-    array_list_pt services = NULL;
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (serviceName != NULL) {
-        if (bundleContext_getServiceReferences(context, serviceName, NULL, &services) == CELIX_SUCCESS) {
-            reference = (arrayList_size(services) > 0) ? arrayList_get(services, 0) : NULL;
-            arrayList_destroy(services);
-            *service_reference = reference;
-        } else {
-            status = CELIX_ILLEGAL_ARGUMENT;
-        }
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get service reference");
-
-	return status;
-}
-
-FRAMEWORK_EXPORT celix_status_t bundleContext_retainServiceReference(bundle_context_pt context, service_reference_pt ref) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && ref != NULL) {
-        serviceRegistry_retainServiceReference(context->framework->registry, context->bundle, ref);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get service references");
-
-    return status;
-}
-
-celix_status_t bundleContext_ungetServiceReference(bundle_context_pt context, service_reference_pt reference) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && reference != NULL) {
-        status = framework_ungetServiceReference(context->framework, context->bundle, reference);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to unget service_reference");
-
-    return status;
-}
-
-celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void** service_instance) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && reference != NULL && *service_instance == NULL) {
-        /*NOTE argument service_instance should be considerd a 'const void**'. 
-        To ensure backwards compatiblity a cast is made instead.
-        */
-	    status = fw_getService(context->framework, context->bundle, reference, (const void**) service_instance);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get service");
-
-    return status;
-}
-
-celix_status_t bundleContext_ungetService(bundle_context_pt context, service_reference_pt reference, bool *result) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && reference != NULL) {
-        status = framework_ungetService(context->framework, context->bundle, reference, result);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to unget service");
-
-    return status;
-}
-
-celix_status_t bundleContext_getBundles(bundle_context_pt context, array_list_pt *bundles) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	if (context == NULL || *bundles != NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*bundles = framework_getBundles(context->framework);
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get bundles");
-
-	return status;
-}
-
-celix_status_t bundleContext_getBundleById(bundle_context_pt context, long id, bundle_pt *bundle) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context == NULL || *bundle != NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        *bundle = framework_getBundleById(context->framework, id);
-        if (*bundle == NULL) {
-            status = CELIX_BUNDLE_EXCEPTION;
-        }
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get bundle [id=%ld]", id);
-
-	return status;
-}
-
-celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, const char* filter) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_addServiceListener(context->framework, context->bundle, listener, filter);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to add service listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_removeServiceListener(bundle_context_pt context, service_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_removeServiceListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to remove service listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_addBundleListener(bundle_context_pt context, bundle_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_addBundleListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to add bundle listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_removeBundleListener(bundle_context_pt context, bundle_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_removeBundleListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to remove bundle listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_addFrameworkListener(bundle_context_pt context, framework_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_addFrameworkListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to add framework listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_removeFrameworkListener(bundle_context_pt context, framework_listener_pt listener) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context != NULL && listener != NULL) {
-        fw_removeFrameworkListener(context->framework, context->bundle, listener);
-    } else {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to remove framework listener");
-
-    return status;
-}
-
-celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, const char** value) {
-	return bundleContext_getPropertyWithDefault(context, name, NULL, value);
-}
-
-celix_status_t bundleContext_getPropertyWithDefault(bundle_context_pt context, const char* name, const char* defaultValue, const char** value) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context == NULL || name == NULL || *value != NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        fw_getProperty(context->framework, name, defaultValue, value);
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get property [name=%s]", name);
-
-    return status;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/bundle_revision.c
----------------------------------------------------------------------
diff --git a/framework/private/src/bundle_revision.c b/framework/private/src/bundle_revision.c
deleted file mode 100644
index cfa10aa..0000000
--- a/framework/private/src/bundle_revision.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * bundle_revision.c
- *
- *  \date       Apr 12, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <archive.h>
-#include <string.h>
-
-#include "bundle_revision_private.h"
-
-celix_status_t bundleRevision_create(const char *root, const char *location, long revisionNr, const char *inputFile, bundle_revision_pt *bundle_revision) {
-    celix_status_t status = CELIX_SUCCESS;
-	bundle_revision_pt revision = NULL;
-
-	revision = (bundle_revision_pt) malloc(sizeof(*revision));
-    if (!revision) {
-    	status = CELIX_ENOMEM;
-    } else {
-    	// TODO: This overwrites an existing revision, is this supposed to happen?
-        int state = mkdir(root, S_IRWXU);
-        if ((state != 0) && (errno != EEXIST)) {
-            free(revision);
-            status = CELIX_FILE_IO_EXCEPTION;
-        } else {
-            if (inputFile != NULL) {
-                status = extractBundle(inputFile, root);
-            } else if (strcmp(location, "inputstream:") != 0) {
-            	// TODO how to handle this correctly?
-            	// If location != inputstream, extract it, else ignore it and assume this is a cache entry.
-                status = extractBundle(location, root);
-            }
-
-            status = CELIX_DO_IF(status, arrayList_create(&(revision->libraryHandles)));
-            if (status == CELIX_SUCCESS) {
-                revision->revisionNr = revisionNr;
-                revision->root = strdup(root);
-                revision->location = strdup(location);
-
-                *bundle_revision = revision;
-
-                char manifest[512];
-                snprintf(manifest, sizeof(manifest), "%s/META-INF/MANIFEST.MF", revision->root);
-				status = manifest_createFromFile(manifest, &revision->manifest);
-            }
-            else {
-            	free(revision);
-            }
-
-        }
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to create revision");
-
-	return status;
-}
-
-celix_status_t bundleRevision_destroy(bundle_revision_pt revision) {
-    arrayList_destroy(revision->libraryHandles);
-    manifest_destroy(revision->manifest);
-    free(revision->root);
-    free(revision->location);
-    free(revision);
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleRevision_getNumber(bundle_revision_pt revision, long *revisionNr) {
-	celix_status_t status = CELIX_SUCCESS;
-    if (revision == NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-    	*revisionNr = revision->revisionNr;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get revision number");
-
-	return status;
-}
-
-celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, const char **location) {
-	celix_status_t status = CELIX_SUCCESS;
-	if (revision == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*location = revision->location;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get revision location");
-
-	return status;
-}
-
-celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, const char **root) {
-	celix_status_t status = CELIX_SUCCESS;
-	if (revision == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*root = revision->root;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get revision root");
-
-	return status;
-}
-
-celix_status_t bundleRevision_getManifest(bundle_revision_pt revision, manifest_pt *manifest) {
-	celix_status_t status = CELIX_SUCCESS;
-	if (revision == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*manifest = revision->manifest;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get manifest");
-
-	return status;
-}
-
-celix_status_t bundleRevision_getHandles(bundle_revision_pt revision, array_list_pt *handles) {
-    celix_status_t status = CELIX_SUCCESS;
-    if (revision == NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        *handles = revision->libraryHandles;
-    }
-
-    framework_logIfError(logger, status, NULL, "Failed to get handles");
-
-    return status;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/capability.c
----------------------------------------------------------------------
diff --git a/framework/private/src/capability.c b/framework/private/src/capability.c
deleted file mode 100644
index 9e4dc3a..0000000
--- a/framework/private/src/capability.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * capability.c
- *
- *  \date       Jul 12, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdlib.h>
-
-#include "capability_private.h"
-#include "attribute.h"
-#include "celix_log.h"
-
-celix_status_t capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability) {
-	celix_status_t status;
-	*capability = (capability_pt) malloc(sizeof(**capability));
-	if (!*capability) {
-		status = CELIX_ENOMEM;
-	} else {
-		(*capability)->module = module;
-		(*capability)->attributes = attributes;
-		(*capability)->directives = directives;
-		(*capability)->version = NULL;
-
-		attribute_pt versionAttribute = NULL;
-		attribute_pt serviceAttribute = (attribute_pt) hashMap_get(attributes, "service");
-		status = attribute_getValue(serviceAttribute, &(*capability)->serviceName);
-		if (status == CELIX_SUCCESS) {
-			versionAttribute = (attribute_pt) hashMap_get(attributes, "version");
-			if (versionAttribute != NULL) {
-				char *versionStr = NULL;
-				attribute_getValue(versionAttribute, &versionStr);
-				status = version_createVersionFromString(versionStr, &(*capability)->version);
-			} else {
-				status = version_createEmptyVersion(&(*capability)->version);
-			}
-		}
-
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to create capability");
-
-	return status;
-}
-
-celix_status_t capability_destroy(capability_pt capability) {
-	hash_map_iterator_pt attrIter = hashMapIterator_create(capability->attributes);
-	while (hashMapIterator_hasNext(attrIter)) {
-		attribute_pt attr = hashMapIterator_nextValue(attrIter);
-		hashMapIterator_remove(attrIter);
-		attribute_destroy(attr);
-	}
-	hashMapIterator_destroy(attrIter);
-	hashMap_destroy(capability->attributes, false, false);
-	hashMap_destroy(capability->directives, false, false);
-
-	capability->attributes = NULL;
-	capability->directives = NULL;
-	capability->module = NULL;
-
-	version_destroy(capability->version);
-	capability->version = NULL;
-
-	free(capability);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t capability_getServiceName(capability_pt capability, const char **serviceName) {
-	*serviceName = capability->serviceName;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t capability_getVersion(capability_pt capability, version_pt *version) {
-	*version = capability->version;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t capability_getModule(capability_pt capability, module_pt *module) {
-	*module = capability->module;
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/celix_errorcodes.c
----------------------------------------------------------------------
diff --git a/framework/private/src/celix_errorcodes.c b/framework/private/src/celix_errorcodes.c
deleted file mode 100644
index 80323e7..0000000
--- a/framework/private/src/celix_errorcodes.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * celix_errorcodes.c
- *
- *  \date       Aug 30, 2011
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <string.h>
-
-#include "celix_errno.h"
-
-static char* celix_error_string(celix_status_t statcode) {
-	switch (statcode) {
-        case CELIX_BUNDLE_EXCEPTION:
-            return "Bundle exception";
-        case CELIX_INVALID_BUNDLE_CONTEXT:
-            return "Invalid bundle context";
-        case CELIX_ILLEGAL_ARGUMENT:
-            return "Illegal argument";
-        case CELIX_INVALID_SYNTAX:
-            return "Invalid syntax";
-        case CELIX_FRAMEWORK_SHUTDOWN:
-            return "Framework shutdown";
-        case CELIX_ILLEGAL_STATE:
-            return "Illegal state";
-        case CELIX_FRAMEWORK_EXCEPTION:
-            return "Framework exception";
-        case CELIX_FILE_IO_EXCEPTION:
-            return "File I/O exception";
-        case CELIX_SERVICE_EXCEPTION:
-            return "Service exception";
-        default:
-            return "Unknown code";
-	}
-}
-
-char* celix_strerror(celix_status_t errorcode, char *buffer, size_t bufferSize) {
-    if (errorcode < CELIX_START_ERROR) {
-        return strerror(errorcode);
-    } else {
-    	char * str = celix_error_string(errorcode);
-    	strncpy(buffer, str, bufferSize);
-        return buffer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/celix_launcher.c
----------------------------------------------------------------------
diff --git a/framework/private/src/celix_launcher.c b/framework/private/src/celix_launcher.c
deleted file mode 100644
index ba83f25..0000000
--- a/framework/private/src/celix_launcher.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * celix_launcher.c
- *
- *  \date       Mar 23, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-
-#include "celix_launcher.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <signal.h>
-
-#ifndef CELIX_NO_CURLINIT
-#include <curl/curl.h>
-#endif
-
-#include <string.h>
-#include <curl/curl.h>
-#include <signal.h>
-#include <libgen.h>
-#include "celix_launcher.h"
-#include "framework.h"
-#include "linked_list_iterator.h"
-
-static void show_usage(char* prog_name);
-static void shutdown_framework(int signal);
-static void ignore(int signal);
-
-#define DEFAULT_CONFIG_FILE "config.properties"
-
-static framework_pt framework = NULL;
-
-int celixLauncher_launchWithArgs(int argc, char *argv[]) {
-	// Perform some minimal command-line option parsing...
-	char *opt = NULL;
-	if (argc > 1) {
-		opt = argv[1];
-	}
-
-	char *config_file = NULL;
-
-	if (opt) {
-		// Check whether the user wants some help...
-		if (strcmp("-h", opt) == 0 || strcmp("-help", opt) == 0) {
-			show_usage(argv[0]);
-			return 0;
-		} else {
-			config_file = opt;
-		}
-	} else {
-		config_file = DEFAULT_CONFIG_FILE;
-	}
-
-	struct sigaction sigact;
-	memset(&sigact, 0, sizeof(sigact));
-	sigact.sa_handler = shutdown_framework;
-	sigaction(SIGINT,  &sigact, NULL);
-	sigaction(SIGTERM, &sigact, NULL);
-
-	memset(&sigact, 0, sizeof(sigact));
-	sigact.sa_handler = ignore;
-	sigaction(SIGUSR1,  &sigact, NULL);
-	sigaction(SIGUSR2,  &sigact, NULL);
-
-	int rc = celixLauncher_launch(config_file, &framework);
-	if (rc == 0) {
-		celixLauncher_waitForShutdown(framework);
-		celixLauncher_destroy(framework);
-	}
-	return rc;
-}
-
-static void show_usage(char* prog_name) {
-	printf("Usage:\n  %s [path/to/config.properties]\n\n", basename(prog_name));
-}
-
-static void shutdown_framework(int signal) {
-	if (framework != NULL) {
-		celixLauncher_stop(framework); //NOTE main thread will destroy
-	}
-}
-
-static void ignore(int signal) {
-	//ignoring for signal SIGUSR1, SIGUSR2. Can be used on threads
-}
-
-int celixLauncher_launch(const char *configFile, framework_pt *framework) {
-	int status = 0;
-	FILE *config = fopen(configFile, "r");
-	if (config != NULL) {
-		status = celixLauncher_launchWithStream(config, framework);
-	} else {
-		fprintf(stderr, "Error: invalid or non-existing configuration file: '%s'.", configFile);
-		perror("");
-		status = 1;
-	}
-	return status;
-}
-
-int celixLauncher_launchWithStream(FILE *stream, framework_pt *framework) {
-	int status = 0;
-
-	properties_pt config = properties_loadWithStream(stream);
-	fclose(stream);
-	// Make sure we've read it and that nothing went wrong with the file access...
-	if (config == NULL) {
-		fprintf(stderr, "Error: invalid configuration file");
-		perror(NULL);
-		status = 1;
-	}
-	else {
-		status = celixLauncher_launchWithProperties(config, framework);
-	}
-
-	return status;
-}
-
-
-int celixLauncher_launchWithProperties(properties_pt config, framework_pt *framework) {
-	celix_status_t status;
-#ifndef CELIX_NO_CURLINIT
-	// Before doing anything else, let's setup Curl
-	curl_global_init(CURL_GLOBAL_NOTHING);
-#endif
-
-	const char* autoStartProp = properties_get(config, "cosgi.auto.start.1");
-	char* autoStart = NULL;
-	if (autoStartProp != NULL) {
-		autoStart = strndup(autoStartProp, 1024*10);
-	}
-
-	status = framework_create(framework, config);
-	bundle_pt fwBundle = NULL;
-	if (status == CELIX_SUCCESS) {
-		status = fw_init(*framework);
-		if (status == CELIX_SUCCESS) {
-			// Start the system bundle
-			status = framework_getFrameworkBundle(*framework, &fwBundle);
-
-			if(status == CELIX_SUCCESS){
-				bundle_start(fwBundle);
-
-				char delims[] = " ";
-				char *result = NULL;
-				char *save_ptr = NULL;
-				linked_list_pt bundles;
-				array_list_pt installed = NULL;
-				bundle_context_pt context = NULL;
-				linked_list_iterator_pt iter = NULL;
-				unsigned int i;
-
-				linkedList_create(&bundles);
-				result = strtok_r(autoStart, delims, &save_ptr);
-				while (result != NULL) {
-					char *location = strdup(result);
-					linkedList_addElement(bundles, location);
-					result = strtok_r(NULL, delims, &save_ptr);
-				}
-				// First install all bundles
-				// Afterwards start them
-				arrayList_create(&installed);
-				bundle_getContext(fwBundle, &context);
-				iter = linkedListIterator_create(bundles, 0);
-				while (linkedListIterator_hasNext(iter)) {
-					bundle_pt current = NULL;
-					char *location = (char *) linkedListIterator_next(iter);
-					if (bundleContext_installBundle(context, location, &current) == CELIX_SUCCESS) {
-						// Only add bundle if it is installed correctly
-						arrayList_add(installed, current);
-					} else {
-						printf("Could not install bundle from %s\n", location);
-					}
-					linkedListIterator_remove(iter);
-					free(location);
-				}
-				linkedListIterator_destroy(iter);
-				linkedList_destroy(bundles);
-
-				for (i = 0; i < arrayList_size(installed); i++) {
-					bundle_pt installedBundle = (bundle_pt) arrayList_get(installed, i);
-					bundle_startWithOptions(installedBundle, 0);
-				}
-
-				arrayList_destroy(installed);
-			}
-		}
-	}
-
-	if (status != CELIX_SUCCESS) {
-		printf("Problem creating framework\n");
-	}
-
-	printf("Launcher: Framework Started\n");
-
-	free(autoStart);
-	
-	return status;
-}
-
-void celixLauncher_waitForShutdown(framework_pt framework) {
-	framework_waitForStop(framework);
-}
-
-void celixLauncher_destroy(framework_pt framework) {
-	framework_destroy(framework);
-
-#ifndef CELIX_NO_CURLINIT
-	// Cleanup Curl
-	curl_global_cleanup();
-#endif
-
-	printf("Launcher: Exit\n");
-}
-
-void celixLauncher_stop(framework_pt framework) {
-	bundle_pt fwBundle = NULL;
-	if( framework_getFrameworkBundle(framework, &fwBundle) == CELIX_SUCCESS){
-		bundle_stop(fwBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/celix_log.c
----------------------------------------------------------------------
diff --git a/framework/private/src/celix_log.c b/framework/private/src/celix_log.c
deleted file mode 100644
index c4d51e2..0000000
--- a/framework/private/src/celix_log.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * celix_log.c
- *
- *  \date       6 Oct 2013
- *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright  Apache License, Version 2.0
- */
-#include <stdarg.h>
-
-#include "celix_errno.h"
-#include "celix_log.h"
-
-void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg, ...) {
-    char msg[512];
-    va_list listPointer;
-    va_start(listPointer, fmsg);
-    vsprintf(msg, fmsg, listPointer);
-
-    //FIXME logger and/or logger->logFucntion can be null. But this solution is not thread safe!
-    if (logger != NULL && logger->logFunction != NULL) {
-        logger->logFunction(level, func, file, line, msg);
-    }
-
-    va_end(listPointer);
-}
-
-void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, const char *fmsg, ...) {
-    char message[256];
-    celix_strerror(code, message, 256);
-    char msg[512];
-    va_list listPointer;
-    va_start(listPointer, fmsg);
-    vsprintf(msg, fmsg, listPointer);
-
-    framework_log(logger, level, func, file, line, "%s [%d]: %s", message, code, msg);
-
-    va_end(listPointer);
-}
-
-celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char *msg) {
-    char *levelStr = NULL;
-    switch (level) {
-        case OSGI_FRAMEWORK_LOG_ERROR:
-            levelStr = "ERROR";
-            break;
-        case OSGI_FRAMEWORK_LOG_WARNING:
-            levelStr = "WARNING";
-            break;
-        case OSGI_FRAMEWORK_LOG_INFO:
-            levelStr = "INFO";
-            break;
-        case OSGI_FRAMEWORK_LOG_DEBUG:
-        default:
-            levelStr = "DEBUG";
-            break;
-    }
-
-    if (level == OSGI_FRAMEWORK_LOG_ERROR) {
-        printf("%s: %s\n\tat %s(%s:%d)\n", levelStr, msg, func, file, line);
-    } else {
-        printf("%s: %s\n", levelStr, msg);
-    }
-
-    return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/a1c30887/framework/private/src/filter.c
----------------------------------------------------------------------
diff --git a/framework/private/src/filter.c b/framework/private/src/filter.c
deleted file mode 100644
index f06d6e8..0000000
--- a/framework/private/src/filter.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * filter.c
- *
- *  \date       Apr 28, 2010
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "celix_log.h"
-#include "filter_private.h"
-
-static void filter_skipWhiteSpace(char* filterString, int* pos);
-static filter_pt filter_parseFilter(char* filterString, int* pos);
-static filter_pt filter_parseFilterComp(char* filterString, int* pos);
-static filter_pt filter_parseAnd(char* filterString, int* pos);
-static filter_pt filter_parseOr(char* filterString, int* pos);
-static filter_pt filter_parseNot(char* filterString, int* pos);
-static filter_pt filter_parseItem(char* filterString, int* pos);
-static char * filter_parseAttr(char* filterString, int* pos);
-static char * filter_parseValue(char* filterString, int* pos);
-static array_list_pt filter_parseSubstring(char* filterString, int* pos);
-
-static celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result);
-static celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result);
-
-static void filter_skipWhiteSpace(char * filterString, int * pos) {
-	int length;
-	for (length = strlen(filterString); (*pos < length) && isspace(filterString[*pos]);) {
-		(*pos)++;
-	}
-}
-
-filter_pt filter_create(const char* filterString) {
-	filter_pt filter = NULL;
-	char* filterStr = (char*) filterString;
-	int pos = 0;
-	filter = filter_parseFilter(filterStr, &pos);
-	if (pos != strlen(filterStr)) {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR,  "Error: Extraneous trailing characters.");
-		filter_destroy(filter);
-		return NULL;
-	}
-	if(filter != NULL){
-		filter->filterStr = filterStr;
-	} 
-
-	return filter;
-}
-
-void filter_destroy(filter_pt filter) {
-	if (filter != NULL) {
-		if(filter->value!=NULL){
-			if (filter->operand == SUBSTRING) {
-				int size = arrayList_size(filter->value);
-				for (; size > 0; --size) {
-					char* operand = (char*) arrayList_remove(filter->value, 0);
-					free(operand);
-				}
-				arrayList_destroy(filter->value);
-				filter->value = NULL;
-			} else if ( (filter->operand == OR) || (filter->operand == AND) ) {
-				int size = arrayList_size(filter->value);
-				unsigned int i = 0;
-				for (i = 0; i < size; i++) {
-					filter_pt f = arrayList_get(filter->value, i);
-					filter_destroy(f);
-				}
-				arrayList_destroy(filter->value);
-				filter->value = NULL;
-			} else  if (filter->operand == NOT) {
-				filter_destroy(filter->value);
-				filter->value = NULL;
-			} else {
-				free(filter->value);
-				filter->value = NULL;
-			}
-		}
-		free(filter->attribute);
-		filter->attribute = NULL;
-		free(filter);
-		filter = NULL;
-	}
-}
-
-static filter_pt filter_parseFilter(char * filterString, int * pos) {
-	filter_pt filter;
-	filter_skipWhiteSpace(filterString, pos);
-	if (filterString[*pos] != '(') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '(' in filter string '%s'.", filterString);
-		return NULL;
-	}
-	(*pos)++;
-
-	filter = filter_parseFilterComp(filterString, pos);
-
-	filter_skipWhiteSpace(filterString, pos);
-
-	if (filterString[*pos] != ')') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing ')' in filter string '%s'.", filterString);
-		if(filter!=NULL){
-			filter_destroy(filter);
-		}
-		return NULL;
-	}
-	(*pos)++;
-	filter_skipWhiteSpace(filterString, pos);
-
-	if(filter != NULL){
-		if(filter->value == NULL && filter->operand!=PRESENT){
-			filter_destroy(filter);
-			return NULL;
-		}
-	}
-
-	return filter;
-}
-
-static filter_pt filter_parseFilterComp(char * filterString, int * pos) {
-	char c;
-	filter_skipWhiteSpace(filterString, pos);
-
-	c = filterString[*pos];
-
-	switch (c) {
-		case '&': {
-			(*pos)++;
-			return filter_parseAnd(filterString, pos);
-		}
-		case '|': {
-			(*pos)++;
-			return filter_parseOr(filterString, pos);
-		}
-		case '!': {
-			(*pos)++;
-			return filter_parseNot(filterString, pos);
-		}
-	}
-	return filter_parseItem(filterString, pos);
-}
-
-static filter_pt filter_parseAnd(char * filterString, int * pos) {
-
-	array_list_pt operands = NULL;
-	filter_skipWhiteSpace(filterString, pos);
-	bool failure = false;
-
-	if (filterString[*pos] != '(') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
-		return NULL;
-	}
-
-	arrayList_create(&operands);
-	while(filterString[*pos] == '(') {
-		filter_pt child = filter_parseFilter(filterString, pos);
-		if(child == NULL){
-			failure = true;
-			break;
-		}
-		arrayList_add(operands, child);
-	}
-
-	if(failure == true){
-		array_list_iterator_pt listIt = arrayListIterator_create(operands);
-		while(arrayListIterator_hasNext(listIt)){
-			filter_pt f = arrayListIterator_next(listIt);
-			filter_destroy(f);
-		}
-		arrayListIterator_destroy(listIt);
-		arrayList_destroy(operands);
-		operands = NULL;
-	}
-
-	filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-	filter->operand = AND;
-	filter->attribute = NULL;
-	filter->value = operands;
-
-	return filter;
-}
-
-static filter_pt filter_parseOr(char * filterString, int * pos) {
-
-	array_list_pt operands = NULL;
-
-	filter_skipWhiteSpace(filterString, pos);
-	bool failure = false;
-
-	if (filterString[*pos] != '(') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
-		return NULL;
-	}
-
-	arrayList_create(&operands);
-	while(filterString[*pos] == '(') {
-		filter_pt child = filter_parseFilter(filterString, pos);
-		if(child == NULL){
-			failure = true;
-			break;
-		}
-		arrayList_add(operands, child);
-	}
-
-	if(failure == true){
-		array_list_iterator_pt listIt = arrayListIterator_create(operands);
-		while(arrayListIterator_hasNext(listIt)){
-			filter_pt f = arrayListIterator_next(listIt);
-			filter_destroy(f);
-		}
-		arrayListIterator_destroy(listIt);
-		arrayList_destroy(operands);
-		operands = NULL;
-	}
-
-	filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-	filter->operand = OR;
-	filter->attribute = NULL;
-	filter->value = operands;
-
-	return filter;
-}
-
-static filter_pt filter_parseNot(char * filterString, int * pos) {
-	filter_pt child = NULL;
-	filter_skipWhiteSpace(filterString, pos);
-
-	if (filterString[*pos] != '(') {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
-		return NULL;
-	}
-
-	child = filter_parseFilter(filterString, pos);
-
-
-	filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-	filter->operand = NOT;
-	filter->attribute = NULL;
-	filter->value = child;
-
-	return filter;
-}
-
-static filter_pt filter_parseItem(char * filterString, int * pos) {
-	char * attr = filter_parseAttr(filterString, pos);
-	if(attr == NULL){
-		return NULL;
-	}
-
-	filter_skipWhiteSpace(filterString, pos);
-	switch(filterString[*pos]) {
-		case '~': {
-			if (filterString[*pos + 1] == '=') {
-				filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-				*pos += 2;
-				filter->operand = APPROX;
-				filter->attribute = attr;
-				filter->value = filter_parseValue(filterString, pos);
-				return filter;
-			}
-			break;
-		}
-		case '>': {
-			if (filterString[*pos + 1] == '=') {
-				filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-				*pos += 2;
-				filter->operand = GREATEREQUAL;
-				filter->attribute = attr;
-				filter->value = filter_parseValue(filterString, pos);
-				return filter;
-			}
-			else {
-                filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-                *pos += 1;
-                filter->operand = GREATER;
-                filter->attribute = attr;
-                filter->value = filter_parseValue(filterString, pos);
-                return filter;
-			}
-			break;
-		}
-		case '<': {
-			if (filterString[*pos + 1] == '=') {
-				filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-				*pos += 2;
-				filter->operand = LESSEQUAL;
-				filter->attribute = attr;
-				filter->value = filter_parseValue(filterString, pos);
-				return filter;
-			}
-			else {
-                filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-                *pos += 1;
-                filter->operand = LESS;
-                filter->attribute = attr;
-                filter->value = filter_parseValue(filterString, pos);
-                return filter;
-			}
-			break;
-		}
-		case '=': {
-			filter_pt filter = NULL;
-			array_list_pt subs;
-			if (filterString[*pos + 1] == '*') {
-				int oldPos = *pos;
-				*pos += 2;
-				filter_skipWhiteSpace(filterString, pos);
-				if (filterString[*pos] == ')') {
-					filter_pt filter = (filter_pt) malloc(sizeof(*filter));
-					filter->operand = PRESENT;
-					filter->attribute = attr;
-					filter->value = NULL;
-					return filter;
-				}
-				*pos = oldPos;
-			}
-			filter = (filter_pt) malloc(sizeof(*filter));			
-			(*pos)++;
-			subs = filter_parseSubstring(filterString, pos);
-			if(subs!=NULL){
-				if (arrayList_size(subs) == 1) {
-					char * string = (char *) arrayList_get(subs, 0);
-					if (string != NULL) {
-						filter->operand = EQUAL;
-						filter->attribute = attr;
-						filter->value = string;
-
-						arrayList_clear(subs);
-						arrayList_destroy(subs);
-
-						return filter;
-					}
-				}
-			}
-			filter->operand = SUBSTRING;
-			filter->attribute = attr;
-			filter->value = subs;
-			return filter;
-		}
-	}
-	fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid operator.");
-	free(attr);
-	return NULL;
-}
-
-static char * filter_parseAttr(char * filterString, int * pos) {
-	char c;
-	int begin = *pos;
-	int end = *pos;
-	int length = 0;
-
-	filter_skipWhiteSpace(filterString, pos);
-	c = filterString[*pos];
-
-	while (c != '~' && c != '<' && c != '>' && c != '=' && c != '(' && c != ')') {
-		(*pos)++;
-
-		if (!isspace(c)) {
-			end = *pos;
-		}
-
-		c = filterString[*pos];
-	}
-
-	length = end - begin;
-
-	if (length == 0) {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing attr.");
-		return NULL;
-	} else {
-		char * attr = (char *) malloc(length+1);
-		strncpy(attr, filterString+begin, length);
-		attr[length] = '\0';
-		return attr;
-	}
-}
-
-static char * filter_parseValue(char * filterString, int * pos) {
-	char *value = calloc(strlen(filterString) + 1, sizeof(*value));
-	int keepRunning = 1;
-
-	while (keepRunning) {
-		char c = filterString[*pos];
-
-		switch (c) {
-			case ')': {
-				keepRunning = 0;
-				break;
-			}
-			case '(': {
-				fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid value.");
-				free(value);
-				return NULL;
-			}
-			case '\0':{
-				fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unclosed bracket.");
-				free(value);
-				return NULL;
-			}
-			case '\\': {
-				(*pos)++;
-				c = filterString[*pos];
-			}
-			/* no break */
-			default: {
-				char ch[2];
-				ch[0] = c;
-				ch[1] = '\0';
-				strcat(value, ch);
-				(*pos)++;
-				break;
-			}
-		}
-	}
-
-	if (strlen(value) == 0) {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
-		free(value);
-		return NULL;
-	}
-	return value;
-}
-
-static array_list_pt filter_parseSubstring(char * filterString, int * pos) {
-	char *sub = calloc(strlen(filterString) + 1, sizeof(*sub));
-	array_list_pt operands = NULL;
-	int keepRunning = 1;
-
-	arrayList_create(&operands);
-	while (keepRunning) {
-		char c = filterString[*pos];
-		
-
-		switch (c) {
-			case ')': {
-				if (strlen(sub) > 0) {
-					arrayList_add(operands, strdup(sub));
-				}
-				keepRunning = 0;
-				break;
-			}
-			case '\0':{
-				fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Unclosed bracket.");
-				keepRunning = false;
-				break;
-			}
-			case '(': {
-				fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid value.");
-				keepRunning = false;
-				break;
-			}
-			case '*': {
-				if (strlen(sub) > 0) {
-					arrayList_add(operands, strdup(sub));
-				}
-				sub[0] = '\0';
-				arrayList_add(operands, NULL);
-				(*pos)++;
-				break;
-			}
-			case '\\': {
-				(*pos)++;
-				c = filterString[*pos];
-			}
-			/* no break */
-			default: {
-				char ch[2];
-				ch[0] = c;
-				ch[1] = '\0';
-				strcat(sub, ch);
-				(*pos)++;
-				break;
-			}
-		}
-	}
-	free(sub);
-
-	if (arrayList_size(operands) == 0) {
-		fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
-		arrayList_destroy(operands);
-		return NULL;
-	}
-
-	return operands;
-}
-
-celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result) {
-	switch (filter->operand) {
-		case AND: {
-			array_list_pt filters = (array_list_pt) filter->value;
-			unsigned int i;
-			for (i = 0; i < arrayList_size(filters); i++) {
-				filter_pt sfilter = (filter_pt) arrayList_get(filters, i);
-				bool mresult;
-				filter_match(sfilter, properties, &mresult);
-				if (!mresult) {
-					*result = 0;
-					return CELIX_SUCCESS;
-				}
-			}
-			*result = 1;
-			return CELIX_SUCCESS;
-		}
-		case OR: {
-			array_list_pt filters = (array_list_pt) filter->value;
-			unsigned int i;
-			for (i = 0; i < arrayList_size(filters); i++) {
-				filter_pt sfilter = (filter_pt) arrayList_get(filters, i);
-				bool mresult;
-				filter_match(sfilter, properties, &mresult);
-				if (mresult) {
-					*result = 1;
-					return CELIX_SUCCESS;
-				}
-			}
-			*result = 0;
-			return CELIX_SUCCESS;
-		}
-		case NOT: {
-			filter_pt sfilter = (filter_pt) filter->value;
-			bool mresult;
-			filter_match(sfilter, properties, &mresult);
-			*result = !mresult;
-			return CELIX_SUCCESS;
-		}
-		case SUBSTRING :
-		case EQUAL :
-		case GREATER :
-        case GREATEREQUAL :
-		case LESS :
-        case LESSEQUAL :
-		case APPROX : {
-			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);
-
-			return filter_compare(filter->operand, value, filter->value, result);
-		}
-		case PRESENT: {
-			char * value = (properties == NULL) ? NULL: (char*)properties_get(properties, filter->attribute);
-			*result = value != NULL;
-			return CELIX_SUCCESS;
-		}
-	}
-	*result = 0;
-	return CELIX_SUCCESS;
-}
-
-static celix_status_t filter_compare(OPERAND operand, char * string, void * value2, bool *result) {
-	if (string == NULL) {
-		*result = 0;
-		return CELIX_SUCCESS;
-	}
-	return filter_compareString(operand, string, value2, result);
-
-}
-
-static celix_status_t filter_compareString(OPERAND operand, char * string, void * value2, bool *result) {
-	switch (operand) {
-		case SUBSTRING: {
-			array_list_pt subs = (array_list_pt) value2;
-			int pos = 0;
-			unsigned int i;
-			int size = arrayList_size(subs);
-			for (i = 0; i < size; i++) {
-				char * substr = (char *) arrayList_get(subs, i);
-
-				if (i + 1 < size) {
-					if (substr == NULL) {
-						unsigned int index;
-						char * substr2 = (char *) arrayList_get(subs, i + 1);
-						if (substr2 == NULL) {
-							continue;
-						}
-						index = strcspn(string+pos, substr2);
-						if (index == strlen(string+pos)) {
-							*result = false;
-							return CELIX_SUCCESS;
-						}
-
-						pos = index + strlen(substr2);
-						if (i + 2 < size) {
-							i++;
-						}
-					} else {
-						unsigned int len = strlen(substr);
-						char * region = (char *)malloc(len+1);
-						strncpy(region, string+pos, len);
-						region[len]	= '\0';
-						if (strcmp(region, substr) == 0) {
-							pos += len;
-						} else {
-							free(region);
-							*result = false;
-							return CELIX_SUCCESS;
-						}
-						free(region);
-					}
-				} else {
-					unsigned int len;
-					int begin;
-
-					if (substr == NULL) {
-						*result = true;
-						return CELIX_SUCCESS;
-					}
-					len = strlen(substr);
-					begin = strlen(string)-len;
-					*result = (strcmp(string+begin, substr) == 0);
-					return CELIX_SUCCESS;
-				}
-			}
-			*result = true;
-			return CELIX_SUCCESS;
-		}
-		case APPROX: //TODO: Implement strcmp with ignorecase and ignorespaces
-		case EQUAL: {
-			*result = (strcmp(string, (char *) value2) == 0);
-			return CELIX_SUCCESS;
-		}
-		case GREATER: {
-			*result = (strcmp(string, (char *) value2) > 0);
-			return CELIX_SUCCESS;
-		}
-        case GREATEREQUAL: {
-            *result = (strcmp(string, (char *) value2) >= 0);
-            return CELIX_SUCCESS;
-        }
-		case LESS: {
-			*result = (strcmp(string, (char *) value2) < 0);
-			return CELIX_SUCCESS;
-		}
-        case LESSEQUAL: {
-            *result = (strcmp(string, (char *) value2) <= 0);
-            return CELIX_SUCCESS;
-        }
-		case AND:
-		case NOT:
-		case OR:
-		case PRESENT: {
-		}
-		/* no break */
-	}
-	*result = false;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t filter_getString(filter_pt filter, const char **filterStr) {
-	if (filter != NULL) {
-		*filterStr = filter->filterStr;
-	}
-	return CELIX_SUCCESS;
-}
-
-celix_status_t filter_match_filter(filter_pt src, filter_pt dest, bool *result) {
-	char *srcStr = NULL;
-	char *destStr = NULL;
-	*result = false;
-
-	if (src) srcStr = src->filterStr;
-	if (dest) destStr = dest->filterStr;
-
-	if ((srcStr != NULL) && (destStr != NULL)) {
-		// TODO: should be done smarted, e.g. src="&(a=1)(b=2)" and dest="&(b=2)(a=1)" should result in true
-		*result = (strcmp(srcStr, destStr) == 0);
-	}
-
-	return CELIX_SUCCESS;
-}